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 |
|---|---|---|---|---|---|---|
Use callbacks to share common setup or constraints between actions.
|
def set_serie_detalle
@serie_detalle = SerieDetalle.find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] |
[
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] |
0.0
|
-1
|
Never trust parameters from the scary internet, only allow the white list through.
|
def serie_detalle_params
params.require(:serie_detalle).permit(:lugar, :marca, :pista, :atleta, :an, :club, :region, :pais)
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
|
Use callbacks to share common setup or constraints between actions.
|
def set_game_event
@game_event = GameEvent.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 game_event_params
params.fetch(:game_event, {})
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
|
GET /task_stats/1 GET /task_stats/1.json
|
def show
@task_stat = TaskStat.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @task_stat }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def stats\n # find project\n @project = Project.find(params[:id])\n # check user is manager of project\n if (!@superuser_is_superadmin && !(superuser_is_part_of_project? @project))\n flash[:warning] = \"You can't see stats for this project\"\n redirect_to lato_core.root_path and return false\n end\n # find datas\n @tasks = Task.where(project_id: @project.id).order('end_date ASC')\n @wait_tasks = @tasks.where(status: 'wait')\n @develop_tasks = @tasks.where(status: 'develop')\n @test_tasks = @tasks.where(status: 'test')\n @completed_tasks = @tasks.where(status: 'completed')\n @collaborators = @project.collaborators\n end",
"def statistics_task_by_status_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: StatisticsApi.statistics_task_by_status ...'\n end\n # resource path\n local_var_path = '/statistics/task_by_status'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'q'] = opts[:'q'] if !opts[:'q'].nil?\n query_params[:'fq'] = @api_client.build_collection_param(opts[:'fq'], :pipe) if !opts[:'fq'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'ByTaskStatusFacet' \n\n # auth_names\n auth_names = opts[:auth_names] || ['BasicAuth', 'BearerAuth']\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: StatisticsApi#statistics_task_by_status\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def stats\n request :get, \"_stats\"\n end",
"def stats\n request :get, \"_stats\"\n end",
"def stats\n Client.current.get(\"#{resource_url}/stats\")\n end",
"def show\n @task_metric = TaskMetric.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @task_metric }\n end\n end",
"def index\n @statistics = Statistic.all\n if params[:project_id]\n @project = Project.find(params[:project_id])\n end\n if params[:task_id]\n @task = Task.find(params[:task_id])\n end\n end",
"def index\n @tasks = Task.all\n response = @tasks.map{|task| get_task_hash(task)}\n render json: response\n end",
"def index\n render json: {\n tasks: tasks.map(&:to_hash)\n }\n end",
"def activity_statistics\n get(\"/user/#{@user_id}/activities.json\")\n end",
"def activity_statistics\n get(\"/user/#{@user_id}/activities.json\")\n end",
"def statistics_task_by_status(opts = {})\n data, _status_code, _headers = statistics_task_by_status_with_http_info(opts)\n data\n end",
"def statistics_task_by_workflow_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: StatisticsApi.statistics_task_by_workflow ...'\n end\n # resource path\n local_var_path = '/statistics/task_by_workflow'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'q'] = opts[:'q'] if !opts[:'q'].nil?\n query_params[:'fq'] = @api_client.build_collection_param(opts[:'fq'], :pipe) if !opts[:'fq'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'ByTaskWorkflowFacet' \n\n # auth_names\n auth_names = opts[:auth_names] || ['BasicAuth', 'BearerAuth']\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: StatisticsApi#statistics_task_by_workflow\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def statistics_task_by_storage_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: StatisticsApi.statistics_task_by_storage ...'\n end\n # resource path\n local_var_path = '/statistics/task_by_storage'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'q'] = opts[:'q'] if !opts[:'q'].nil?\n query_params[:'fq'] = @api_client.build_collection_param(opts[:'fq'], :pipe) if !opts[:'fq'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'ByTaskStorageFacet' \n\n # auth_names\n auth_names = opts[:auth_names] || ['BasicAuth', 'BearerAuth']\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: StatisticsApi#statistics_task_by_storage\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def statistics_task_by_metadata_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: StatisticsApi.statistics_task_by_metadata ...'\n end\n allowable_values = [\"count\", \"tasks_count\", \"to_process_size_sum\", \"processed_size_sum\", \"to_process_files_sum\", \"processed_files_sum\", \"finalized_files_sum\", \"bandwidth_avg\", \"bandwidth_count\"]\n if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])\n fail ArgumentError, \"invalid value for \\\"sort\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/statistics/task_by_metadata'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'q'] = opts[:'q'] if !opts[:'q'].nil?\n query_params[:'fq'] = @api_client.build_collection_param(opts[:'fq'], :pipe) if !opts[:'fq'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'ByTaskMetadataFacet' \n\n # auth_names\n auth_names = opts[:auth_names] || ['BasicAuth', 'BearerAuth']\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: StatisticsApi#statistics_task_by_metadata\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index_tasks_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TasksApi.index_tasks ...'\n end\n # resource path\n local_var_path = '/tasks'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'sort_by'] = @api_client.build_collection_param(opts[:'sort_by'], :pipe) if !opts[:'sort_by'].nil?\n query_params[:'id'] = opts[:'id'] if !opts[:'id'].nil?\n query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?\n query_params[:'comment'] = opts[:'comment'] if !opts[:'comment'].nil?\n query_params[:'workflow_type'] = opts[:'workflow_type'] if !opts[:'workflow_type'].nil?\n query_params[:'workflow_action'] = opts[:'workflow_action'] if !opts[:'workflow_action'].nil?\n query_params[:'source_type'] = opts[:'source_type'] if !opts[:'source_type'].nil?\n query_params[:'destination_type'] = opts[:'destination_type'] if !opts[:'destination_type'].nil?\n query_params[:'priority'] = opts[:'priority'] if !opts[:'priority'].nil?\n query_params[:'conflict_resolution'] = opts[:'conflict_resolution'] if !opts[:'conflict_resolution'].nil?\n query_params[:'action'] = opts[:'action'] if !opts[:'action'].nil?\n query_params[:'activate'] = opts[:'activate'] if !opts[:'activate'].nil?\n query_params[:'creation_date'] = opts[:'creation_date'] if !opts[:'creation_date'].nil?\n query_params[:'creation_username'] = opts[:'creation_username'] if !opts[:'creation_username'].nil?\n query_params[:'modification_date'] = opts[:'modification_date'] if !opts[:'modification_date'].nil?\n query_params[:'modification_username'] = opts[:'modification_username'] if !opts[:'modification_username'].nil?\n query_params[:'job_started'] = opts[:'job_started'] if !opts[:'job_started'].nil?\n query_params[:'job_finished'] = opts[:'job_finished'] if !opts[:'job_finished'].nil?\n query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?\n query_params[:'processed_size'] = opts[:'processed_size'] if !opts[:'processed_size'].nil?\n query_params[:'to_process_size'] = opts[:'to_process_size'] if !opts[:'to_process_size'].nil?\n query_params[:'source_pool_id'] = opts[:'source_pool_id'] if !opts[:'source_pool_id'].nil?\n query_params[:'source_pool_name'] = opts[:'source_pool_name'] if !opts[:'source_pool_name'].nil?\n query_params[:'source_tape_id'] = opts[:'source_tape_id'] if !opts[:'source_tape_id'].nil?\n query_params[:'source_tape_barcode'] = opts[:'source_tape_barcode'] if !opts[:'source_tape_barcode'].nil?\n query_params[:'destination_pool_id'] = opts[:'destination_pool_id'] if !opts[:'destination_pool_id'].nil?\n query_params[:'destination_pool_name'] = opts[:'destination_pool_name'] if !opts[:'destination_pool_name'].nil?\n query_params[:'destination_tape_id'] = opts[:'destination_tape_id'] if !opts[:'destination_tape_id'].nil?\n query_params[:'destination_tape_barcode'] = opts[:'destination_tape_barcode'] if !opts[:'destination_tape_barcode'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'TaskCollection' \n\n # auth_names\n auth_names = opts[:auth_names] || ['BasicAuth', 'BearerAuth']\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: TasksApi#index_tasks\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\r\n @status_task = StatusTask.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @status_task }\r\n end\r\n end",
"def show\n @task = Task.find(params[:id])\n\n render json: @task\n end",
"def index\n @tasks = Task.all\n\n render json: @tasks\n end",
"def index\n page = params[:page] || 1\n @tasks = Task.order(created_at: :desc).page(page).per(10)\n @status_arr = Task.statuses.keys.each_with_object({}) { |status, arr| arr[status] = Task.try(status).count; arr }\n @users = User.all\n @statuses = Task.statuses.keys.to_a\n end",
"def get_task_status(index_name, task_id, opts = {})\n res = @transporter.read(:GET, path_encode('/1/indexes/%s/task/%s', index_name, task_id), {}, opts)\n get_option(res, 'status')\n end",
"def show\n @task = Task.find(params[:id])\n @subtasks = @task.statuses.order(:created_at).reverse\n @subtask = Status.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def task_counters_url(task_id)\n NAMENODE_URL + \":50030/taskstats.jsp?jobid=job_#{job_slug}&tipid=#{task_id}\"\n end",
"def index\n @tasks = Task.order(created_at: :desc).limit(50)\n\n @last_fs_import = Task.where(service: Service::LOCAL_STORAGE).\n where('completed_at IS NOT NULL').\n order(completed_at: :desc).limit(1).first\n @last_ht_check = Task.where(service: Service::HATHITRUST).\n where('completed_at IS NOT NULL').\n order(completed_at: :desc).limit(1).first\n @last_ia_check = Task.where(service: Service::INTERNET_ARCHIVE).\n where('completed_at IS NOT NULL').\n order(completed_at: :desc).limit(1).first\n @last_gb_check = Task.where(service: Service::GOOGLE).\n where('completed_at IS NOT NULL').\n order(completed_at: :desc).limit(1).first\n\n render partial: 'tasks' if request.xhr?\n end",
"def stats\n _get(\"/system/stats\") { |json| json }\n end",
"def get_task(taskid)\n params = {\n 'method' => :get,\n 'command' => \"/task/#{taskid}\"\n }\n\n response, headers = send_request(params)\n\n task = response.css('Task').first\n status = task['status']\n start_time = task['startTime']\n end_time = task['endTime']\n\n { :status => status, :start_time => start_time, :end_time => end_time, :response => response }\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 destroy\n @task_stat = TaskStat.find(params[:id])\n @task_stat.destroy\n\n respond_to do |format|\n format.html { redirect_to task_stats_url }\n format.json { head :no_content }\n end\n end",
"def get_json_stats_from(ip, port)\n Net::HTTP.start(ip, port) {|http| http.get('/stats.json') }.body rescue \"{}\"\nend",
"def new\n @task_stat = TaskStat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task_stat }\n end\n end",
"def index \n render :json => Project.find(11).tasks\n end",
"def get_tasks_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TasksApi#get_tasks ...\"\n end\n \n # resource path\n local_var_path = \"/Tasks\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'brief'] = opts[:'brief'] if opts[:'brief']\n query_params[:'skip'] = opts[:'skip'] if opts[:'skip']\n query_params[:'top'] = opts[:'top'] if opts[:'top']\n query_params[:'count_total'] = opts[:'count_total'] if opts[:'count_total']\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 auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<InlineResponse20014>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TasksApi#get_tasks\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @task = Task[params[:id]]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def get_task(taskid)\n params = {\n 'method' => :get,\n 'command' => \"/task/#{taskid}\"\n }\n\n response, headers = send_request(params)\n\n task = response.css('Task').first\n status = task['status']\n start_time = task['startTime']\n end_time = task['endTime']\n\n { :status => status, :start_time => start_time, :end_time => end_time, :response => response }\n end",
"def get_task(taskid)\n params = {\n 'method' => :get,\n 'command' => \"/task/#{taskid}\"\n }\n\n response, headers = send_request(params)\n\n task = response.css('Task').first\n status = task['status']\n start_time = task['startTime']\n end_time = task['endTime']\n\n { :status => status, :start_time => start_time, :end_time => end_time, :response => response }\n end",
"def index\n @tasks = Task.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end",
"def index\n @tasks = Task.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end",
"def index\n @tasks = Task.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end",
"def index\n @tasks = Task.all \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end",
"def new\n @task = Task.new\n # tasks_counts\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end",
"def show\n render json: @task\n end",
"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 get_tasks_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TasksApi#get_tasks ...\"\n end\n \n # resource path\n path = \"/Tasks\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'brief'] = opts[:'brief'] if opts[:'brief']\n query_params[:'skip'] = opts[:'skip'] if opts[:'skip']\n query_params[:'top'] = opts[:'top'] if opts[:'top']\n query_params[:'count_total'] = opts[:'count_total'] if opts[:'count_total']\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 = []\n data, status_code, headers = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<APITask>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TasksApi#get_tasks\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n # GET /tasks\n @tasks = Task.all\n end",
"def index\n @tasks = Task.find_all_by_user_id(current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end",
"def index\n\t\t@tasks = @event.tasks.all\n\n\n\n\t\t# @task.find(task_id).user.name\n\t\t# user_id = params[:user_id]\n\t\t# @user = User.find(user_id)\n\t\t# render :index\n\t\trespond_to do |format|\n\t\t\tformat.html { render :index}\n\t\t\tformat.json { render json: @tasks }\n\t\tend\n\tend",
"def index\n #@tasks = Task.all\n tasks = @task_list.tasks.all\n render :json => tasks\n end",
"def show\n url = Url.find(params[:id].to_i)\n @stats = {\n shortened_url: \"#{request.base_url}/#{url.shortened_url}\",\n original_url: url.original_url,\n usage_count: url.count,\n created_at: url.created_at,\n most_recent_use: url.updated_at\n }\n end",
"def get_task_status(taskID, request_options = {})\n client.get_task_status(name, taskID, request_options)\n end",
"def index\n active_task\n completed_task\n end",
"def show\n @analysis_task = AnalysisTask.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @analysis_task }\n end\n end",
"def stats\n @stats = time_data Gig.all\n\n respond_to do |format|\n format.html # stats.html.erb\n format.json { render json: time_data(Gig.all, :hash), callback: params[:callback] }\n format.xml { render xml: time_data(Gig.all, :hash) }\n end\n end",
"def index\n @task_results = TaskResult.all\n end",
"def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def show\n @completed_tasks_count = @network_event.network_event_tasks.where.not(completed_at: nil).count\n @network_event_task = NetworkEventTask.new\n end",
"def task(name)\n get \"#{base_url}/tasks/#{name}\"\n end",
"def index\n @tasks = Task.includes(:user).order(created_at: :desc).all\n render json: @tasks, each_serializer: TasksSerializer\n end",
"def tasks_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TasksApi.tasks_get ...'\n end\n # resource path\n local_var_path = '/tasks'\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].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', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'multipart/form-data'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BrainPortalSession']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<CbrainTask>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TasksApi#tasks_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def http_statistics\n super\n end",
"def stats\n repo = Repo.find(params[:id])\n\n render(:json => CodeburnerUtil.get_repo_stats(repo.id))\n rescue ActiveRecord::RecordNotFound\n render(:json => {error: \"Service or findings not found}\"}, :status => 404)\n end",
"def index\n @task = Task.new\n @tasks = Task.all.sort_by{|task| task.done? ? 0 : 1;}\n respond_to do |format|\n format.html {render action: 'index'}\n format.json {render json: @tasks}\n end\n end",
"def stats\n @server.make_json_request('show.stats', tvdbid: @tvdbid)['data']\n end",
"def index\n @usages = get_usages\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @usages }\n end\n end",
"def index\n @api_tasks = Api::Task.all\n end",
"def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @task }\n end\n end",
"def raw_stats\n url = URI.parse(stats_url)\n Net::HTTP.start(url.host, url.port) {|http|\n http.request(Net::HTTP::Get.new(url.path))\n }.body\nend",
"def get_tasks_by_search_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TasksApi#get_tasks_by_search ...\"\n end\n \n # resource path\n local_var_path = \"/Tasks/Search\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'title'] = opts[:'title'] if opts[:'title']\n query_params[:'status'] = opts[:'status'] if opts[:'status']\n query_params[:'category_id'] = opts[:'category_id'] if opts[:'category_id']\n query_params[:'owner_user_id'] = opts[:'owner_user_id'] if opts[:'owner_user_id']\n query_params[:'updated_after_utc'] = opts[:'updated_after_utc'] if opts[:'updated_after_utc']\n query_params[:'brief'] = opts[:'brief'] if opts[:'brief']\n query_params[:'skip'] = opts[:'skip'] if opts[:'skip']\n query_params[:'top'] = opts[:'top'] if opts[:'top']\n query_params[:'count_total'] = opts[:'count_total'] if opts[:'count_total']\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 auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<InlineResponse20014>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TasksApi#get_tasks_by_search\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def stats\n @stats = {}\n @stats[\"online\"] = \"Of course. That's how the internet works.\"\n @stats[\"requested_at\"] = Time.now\n @stats[\"total_tweets\"] = ActiveRecord::Base.connection.execute(\"explain select count(id) from tweets\").all_hashes.first[\"rows\"]\n @stats[\"total_users\"] = ActiveRecord::Base.connection.execute(\"explain select count(id) from users\").all_hashes.first[\"rows\"]\n @stats[\"number_collections\"] = ActiveRecord::Base.connection.execute(\"select count(id) from collections\").fetch_row.first\n @stats[\"researchers_active\"] = ActiveRecord::Base.connection.execute(\"select count(id) from researchers\").fetch_row.first\n @stats[\"scrape_count\"] = ActiveRecord::Base.connection.execute(\"select count(id) from scrapes\").fetch_row.first\n @stats[\"datasets_count\"] = ActiveRecord::Base.connection.execute(\"select count(id) from collections where single_dataset = 1\").fetch_row.first\n @stats[\"analysis_jobs_completed\"] = ActiveRecord::Base.connection.execute(\"select count(id) from analysis_metadatas\").fetch_row.first\n @stats[\"total_graphs\"] = ActiveRecord::Base.connection.execute(\"select count(id) from graphs\").all_hashes.first[\"rows\"]\n @stats[\"total_graph_points\"] = ActiveRecord::Base.connection.execute(\"select count(id) from graph_points\").all_hashes.first[\"rows\"]\n @stats[\"total_edges\"] = ActiveRecord::Base.connection.execute(\"select count(id) from edges\").fetch_row.first\n respond_to do |format|\n format.xml { render :xml => @stats.to_xml }\n format.json { render :json => @stats.to_json }\n end\n end",
"def tasks\n render json: [{id: 1, name: 'One'}, {id: 2, name: 'Two'}]\n end",
"def index\n get_tasks\n get_priorities\n get_users\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tasks }\n end\n end",
"def stats\n @stats = time_data MonzoTransaction.all\n\n respond_to do |format|\n format.html # stats.html.erb\n format.json { render json: time_data(MonzoTransaction.all, :hash), callback: params[:callback] }\n format.xml { render xml: time_data(MonzoTransaction.all, :hash) }\n end\n end",
"def stats\n @stats = {\n total_distance: CyclingEvent.sum(:distance),\n total_time: CyclingEvent.sum(:finish_time),\n average_speed: CyclingEvent.sum(:distance).to_f / CyclingEvent.sum(:finish_time).to_f\n }\n\n respond_to do |format|\n format.html # stats.html.erb\n format.json { render json: @stats, callback: params[:callback] }\n format.xml { render xml: @stats }\n end\n end",
"def index\n @instances = Instance.all.where(task: params[:task_id])\n end",
"def usage(opts)\n url = '/stats/usage'\n url += '_by_month' if opts.delete(:by_month)\n url += '_by_service' if opts.delete(:by_service)\n client.get_stats(url, opts)\n end",
"def index\n @timed_tasks = TimedTask.all\n end",
"def index\n @tasks = @list.tasks.order(status: :asc)\n return render_success_task_index\n end",
"def print_rpc_stats(stats)\n out.puts stats.report(\"Task Stats\", false, @verbose)\n end",
"def get_tasks_by_search_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TasksApi#get_tasks_by_search ...\"\n end\n \n # resource path\n path = \"/Tasks/Search\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'title'] = opts[:'title'] if opts[:'title']\n query_params[:'status'] = opts[:'status'] if opts[:'status']\n query_params[:'category_id'] = opts[:'category_id'] if opts[:'category_id']\n query_params[:'owner_user_id'] = opts[:'owner_user_id'] if opts[:'owner_user_id']\n query_params[:'updated_after_utc'] = opts[:'updated_after_utc'] if opts[:'updated_after_utc']\n query_params[:'brief'] = opts[:'brief'] if opts[:'brief']\n query_params[:'skip'] = opts[:'skip'] if opts[:'skip']\n query_params[:'top'] = opts[:'top'] if opts[:'top']\n query_params[:'count_total'] = opts[:'count_total'] if opts[:'count_total']\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 = []\n data, status_code, headers = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<APITask>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TasksApi#get_tasks_by_search\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def stats\n return self.endpoint.stats(self.id)\n end",
"def status_summary(statuspage_id)\n request :method => :get,\n :url => @url + 'status/summary/' + statuspage_id\n end",
"def index_tape_stats_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TapesApi.index_tape_stats ...'\n end\n # resource path\n local_var_path = '/tape_stats'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'TapeStatCollection' \n\n # auth_names\n auth_names = opts[:auth_names] || ['BasicAuth', 'BearerAuth']\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: TapesApi#index_tape_stats\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @scheduled_tasks = ScheduledTask.paginate(\n :per_page => 20,\n :page => params[:page]\n )\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @scheduled_tasks }\n end\n end",
"def stats(id)\n request(:get, \"/users/#{id}/vm_stats.json\")\n end",
"def show\n @task = @project.tasks.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { redner json: @task }\n end\n\n end",
"def show\n @packages = @batch.packages.in_progress.where(:requires_approval => true).order(\"status_id desc\").page(params[:page])\n @failures = @batch.tasks.where(status_id: Status.failed.id).count\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @batch }\n end\n end",
"def index\n @tasks = @project.tasks.find(:all, :order => 'project_name asc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { redner json: @tasks }\n end\n\n end"
] |
[
"0.69776034",
"0.6922608",
"0.6896724",
"0.6896724",
"0.6692689",
"0.6617102",
"0.65072155",
"0.6478461",
"0.6474785",
"0.646865",
"0.646865",
"0.6409019",
"0.6399133",
"0.63694054",
"0.63545054",
"0.63197196",
"0.6291455",
"0.6265213",
"0.62576157",
"0.6249133",
"0.6210367",
"0.6208725",
"0.6191695",
"0.6190882",
"0.61886954",
"0.6169106",
"0.6130523",
"0.61282516",
"0.6125694",
"0.6124748",
"0.6120758",
"0.61183625",
"0.6116756",
"0.61075646",
"0.61075646",
"0.61061275",
"0.61061275",
"0.61061275",
"0.6106062",
"0.60977894",
"0.60879153",
"0.60635555",
"0.60164464",
"0.6009687",
"0.6009558",
"0.6000173",
"0.5996046",
"0.5976778",
"0.5970778",
"0.59663117",
"0.5956796",
"0.59550756",
"0.5945027",
"0.5943046",
"0.5943046",
"0.5943046",
"0.5943046",
"0.5943046",
"0.5943046",
"0.5943046",
"0.5943046",
"0.5943046",
"0.5943046",
"0.5943046",
"0.5943046",
"0.5943046",
"0.5943046",
"0.59427565",
"0.5931709",
"0.5931281",
"0.5916343",
"0.5915682",
"0.5913112",
"0.59034866",
"0.58931214",
"0.5889059",
"0.5888724",
"0.588043",
"0.5880146",
"0.5874588",
"0.5857338",
"0.5848483",
"0.5844615",
"0.5838825",
"0.58368593",
"0.5832336",
"0.58316916",
"0.5829494",
"0.5828216",
"0.5824093",
"0.5823709",
"0.58201534",
"0.5819635",
"0.5812875",
"0.58126545",
"0.5810855",
"0.5808929",
"0.58058476",
"0.5805839",
"0.580218"
] |
0.72672075
|
0
|
GET /task_stats/new GET /task_stats/new.json
|
def new
@task_stat = TaskStat.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @task_stat }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @task = Task.new\n # tasks_counts\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end",
"def create\n @task_stat = TaskStat.new(params[:task_stat])\n\n respond_to do |format|\n if @task_stat.save\n format.html { redirect_to @task_stat, notice: 'Task stat was successfully created.' }\n format.json { render json: @task_stat, status: :created, location: @task_stat }\n else\n format.html { render action: \"new\" }\n format.json { render json: @task_stat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\r\n @status_task = StatusTask.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @status_task }\r\n end\r\n end",
"def new\n @task_metric = TaskMetric.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @task_metric }\n end\n end",
"def new\n\n\n\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end",
"def new\n # raise params.inspect\n @task = Task.new \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end",
"def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end",
"def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end",
"def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end",
"def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end",
"def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end",
"def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end",
"def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end",
"def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end",
"def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end",
"def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end",
"def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end",
"def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end",
"def new\n options = {} \n options[:status_id] = Status.find_by_title(params[:page]).id if params[:page]\n @task = Task.new(options)\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n format.js { render :layout => false }\n end\n end",
"def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @task }\n end\n end",
"def new\n @analysis_task = AnalysisTask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @analysis_task }\n end\n end",
"def new\n @stat = Stat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stat }\n end\n end",
"def new\n @stat = Stat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @stat }\n end\n end",
"def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task_list }\n end\n end",
"def new\n @template_task = TemplateTask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @template_task }\n end\n end",
"def new\n @task = Task.new(:project_id => params[:id])\n\t\t@projects = Project.sorted\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end",
"def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n format.xml { render xml: @tasks }\n end\n end",
"def new\n \n if params[:id].nil?\n @projects = Project.all\n else\n @project = Project.find(params[:id])\n end\n\n @priorities = Priority.all\n @stopovers = Stopover.all\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end",
"def new\n @project = Project.find(params[:project_id])\n @sprint = Sprint.find(params[:sprint_id])\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end",
"def new\n @task = Task.new(sdate:Time.now.getlocal.strftime(\"%F\"),edate:Time.now.getlocal.strftime(\"%F\"))\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end",
"def new\n @task_completion = TaskCompletion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task_completion }\n end\n end",
"def new\n @task_changes = TaskChange.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task_changes }\n end\n end",
"def new\n @task = Task.new\n \n respond_to do |format|\n format.html # new.html.erb\n end\n end",
"def new\n @indexer_task = IndexerTask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @indexer_task }\n end\n end",
"def new\n @task = Task.new\n respond_with(@task)\n end",
"def new\n @scheduled_task = ScheduledTask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scheduled_task }\n end\n end",
"def new\n @tasktype = Tasktype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tasktype }\n end\n end",
"def new\n @group_stat = GroupStat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group_stat }\n end\n end",
"def new\n @active_stat = ActiveStat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @active_stat }\n end\n end",
"def new\n @new_status = NewStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_status }\n end\n end",
"def new\n @task = Task.new(params[:task])\n end",
"def new\n @stat_misc = StatMisc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stat_misc }\n end\n end",
"def new\n\t@task = Task.new\nend",
"def new\n @todo_task = TodoTask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todo_task }\n end\n end",
"def new\n @progress = Progress.new\n\n respond_to do |format|\n format.json { render json: @progress }\n end\n end",
"def new\n @tstat = Tstat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tstat }\n end\n end",
"def new\n @task_definition = TaskDefinition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task_definition }\n end\n end",
"def new\n @task_type = TaskType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task_type }\n end\n end",
"def new\n @workdetail = Workdetail.new\n @taskid = params[:task_id]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @workdetail}\n end\n end",
"def create\n @task = Task.new(task_params)\n @task.save\n render json: full_task(@task)\n end",
"def new\n @task = Task.new\n 3.times{@task.assignments.build}\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end",
"def new\n @task = Task.new\n @sprint = Sprint.find(params[:id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end",
"def new\n @traffic = Traffic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @traffic }\n end\n end",
"def create\n @task_metric = TaskMetric.new(params[:task_metric])\n\n respond_to do |format|\n if @task_metric.save\n format.html { redirect_to @task_metric, :notice => 'Task metric was successfully created.' }\n format.json { render :json => @task_metric, :status => :created, :location => @task_metric }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @task_metric.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\r\n @task = @current_user.tasks.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @task }\r\n end\r\n end",
"def new\n @task = Task.new(:expires => true, :time => -1, :start_date => Time.now.at_beginning_of_day, :end_date => Time.now.at_beginning_of_day)\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end",
"def new\n @task_transition = TaskTransition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task_transition }\n end\n end",
"def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end",
"def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end",
"def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end",
"def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end",
"def new\n @task = Task.new(:due_at => Time.now)\n \n respond_with @task\n end",
"def new\n @client = Client.find(params[:cl_id])\n @task = Task.new(cl_id: params[:cl_id], type_t: params[:type_t], status: params[:status])\n @task.status = \"new\" if @task.status.nil?\n if ! params[:point_group].nil? && ! params[:point_group].to_s.empty?\n pred_t = Task.where(point_group: params[:point_group]).last\n @task.name = pred_t.name\n @task.type_s = params[:type_s].nil? ? pred_t.type_s : params[:type_s]\n @task.target = pred_t.target\n @task.point_group = params[:point_group]\n @task.zapros_gid = pred_t.zapros_gid\n else\n @task.name = @client.address\n @task.zapros_gid = params[:zapros_gid]\n @task.type_s = params[:type_s]\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end",
"def new\n @usage = Usage.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @usage }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end",
"def new\n\t\t@task= Task.new\n\tend",
"def create\n @task = Task.new(task_params)\n\t\t\n\t\t# Assume none are taken at creation...\n\t\t@task.taken = 0\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @task = context.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end",
"def new\n @tasklink = Tasklink.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tasklink }\n end\n end",
"def new\n @task = Task.new\n end",
"def new\n @task = Task.new\n end",
"def new\n @task = Task.new\n end",
"def new\n @task = Task.new\n end",
"def new\n @task = Task.new\n end",
"def new\n @task = Task.new\n end",
"def new\n @task = Task.new\n end",
"def new\n @task = Task.new\n end",
"def new\n @task = Task.new\n end",
"def new\n @task = Task.new\n end",
"def new\n @task = Task.new\n end",
"def new\n @task = Task.new\n end",
"def new\n @task = Task.new\n end",
"def new\n @script = Script.new\n @task = Task.get(params[:task_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @script }\n end\n end",
"def new\n @status = Status.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @status }\n end\n end",
"def new\n @volunteer_task = VolunteerTask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @volunteer_task }\n end\n end",
"def new\n @annual_stat = AnnualStat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @annual_stat }\n end\n end",
"def new\n @task_doer = TaskDoer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task_doer }\n end\n end",
"def new\n @time_task = TimeTask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @time_task }\n end\n end",
"def new\n @t = T.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @t }\n end\n end",
"def create\n @task = Task.new(task_param)\n if @task.save\n render json: get_task_hash(@task)\n else\n render json: @task.errors.full_messages \n end\n end",
"def new\n @alarm_task = AlarmTask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @alarm_task }\n end\n end",
"def create\n @task = @project.tasks.new(task_params)\n @task.user = current_user if current_user.developer?\n @statuses = Task.statuses.keys\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to edit_project_task_path(@project, @task.id), notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n puts @task.errors.as_json\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @match_stat = MatchStat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @match_stat }\n end\n end",
"def new\n @taskuser = Taskuser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @taskuser }\n end\n end",
"def new\n @request_status = RequestStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request_status }\n end\n end",
"def new\n @tasks_person = TasksPerson.new \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tasks_person }\n end\n end",
"def new\n @stat = Stat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stat }\n end\n end",
"def new\n @stat = Stat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stat }\n end\n end",
"def create\r\n @status_task = StatusTask.new(params[:status_task])\r\n\r\n respond_to do |format|\r\n if @status_task.save\r\n format.html { redirect_to @status_task, notice: 'Status task was successfully created.' }\r\n format.json { render json: @status_task, status: :created, location: @status_task }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @status_task.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def new\n @task = Task.new(:user_id => current_user.id)\n\n respond_to do |format|\n format.xml { render :xml => @task }\n end\n end"
] |
[
"0.78133494",
"0.72910285",
"0.7270663",
"0.7237737",
"0.71275204",
"0.7059263",
"0.70552117",
"0.70552117",
"0.70552117",
"0.70552117",
"0.70552117",
"0.70552117",
"0.70552117",
"0.70552117",
"0.70552117",
"0.70552117",
"0.70552117",
"0.70552117",
"0.70043796",
"0.69897836",
"0.69827485",
"0.6952909",
"0.6886851",
"0.6872732",
"0.6852348",
"0.68454117",
"0.6819907",
"0.6813142",
"0.6799364",
"0.67441255",
"0.67299867",
"0.67096055",
"0.666753",
"0.664688",
"0.6607414",
"0.6584659",
"0.65693206",
"0.6544218",
"0.6540256",
"0.65278375",
"0.6480727",
"0.647061",
"0.646071",
"0.6459309",
"0.64521915",
"0.6433296",
"0.6417524",
"0.6408844",
"0.64009255",
"0.638683",
"0.63717586",
"0.63712853",
"0.6369108",
"0.63632244",
"0.6361267",
"0.63596785",
"0.635828",
"0.6351651",
"0.6351651",
"0.6351651",
"0.6351651",
"0.63510066",
"0.63433266",
"0.63089556",
"0.6308378",
"0.6305041",
"0.630366",
"0.63001823",
"0.62979066",
"0.6292892",
"0.6292892",
"0.6292892",
"0.6292892",
"0.6292892",
"0.6292892",
"0.6292892",
"0.6292892",
"0.6292892",
"0.6292892",
"0.6292892",
"0.6292892",
"0.6292892",
"0.628869",
"0.6286895",
"0.6267159",
"0.6263801",
"0.62599665",
"0.62508976",
"0.62409616",
"0.623245",
"0.6218178",
"0.62094426",
"0.62091",
"0.6208484",
"0.62061924",
"0.6203685",
"0.619534",
"0.619534",
"0.61914927",
"0.6177132"
] |
0.81066436
|
0
|
POST /task_stats POST /task_stats.json
|
def create
@task_stat = TaskStat.new(params[:task_stat])
respond_to do |format|
if @task_stat.save
format.html { redirect_to @task_stat, notice: 'Task stat was successfully created.' }
format.json { render json: @task_stat, status: :created, location: @task_stat }
else
format.html { render action: "new" }
format.json { render json: @task_stat.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def statistics_task_by_status_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: StatisticsApi.statistics_task_by_status ...'\n end\n # resource path\n local_var_path = '/statistics/task_by_status'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'q'] = opts[:'q'] if !opts[:'q'].nil?\n query_params[:'fq'] = @api_client.build_collection_param(opts[:'fq'], :pipe) if !opts[:'fq'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'ByTaskStatusFacet' \n\n # auth_names\n auth_names = opts[:auth_names] || ['BasicAuth', 'BearerAuth']\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: StatisticsApi#statistics_task_by_status\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def statistics_task_by_metadata_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: StatisticsApi.statistics_task_by_metadata ...'\n end\n allowable_values = [\"count\", \"tasks_count\", \"to_process_size_sum\", \"processed_size_sum\", \"to_process_files_sum\", \"processed_files_sum\", \"finalized_files_sum\", \"bandwidth_avg\", \"bandwidth_count\"]\n if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])\n fail ArgumentError, \"invalid value for \\\"sort\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/statistics/task_by_metadata'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'q'] = opts[:'q'] if !opts[:'q'].nil?\n query_params[:'fq'] = @api_client.build_collection_param(opts[:'fq'], :pipe) if !opts[:'fq'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'ByTaskMetadataFacet' \n\n # auth_names\n auth_names = opts[:auth_names] || ['BasicAuth', 'BearerAuth']\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: StatisticsApi#statistics_task_by_metadata\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def statistics_task_by_workflow_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: StatisticsApi.statistics_task_by_workflow ...'\n end\n # resource path\n local_var_path = '/statistics/task_by_workflow'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'q'] = opts[:'q'] if !opts[:'q'].nil?\n query_params[:'fq'] = @api_client.build_collection_param(opts[:'fq'], :pipe) if !opts[:'fq'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'ByTaskWorkflowFacet' \n\n # auth_names\n auth_names = opts[:auth_names] || ['BasicAuth', 'BearerAuth']\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: StatisticsApi#statistics_task_by_workflow\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def stats\n # find project\n @project = Project.find(params[:id])\n # check user is manager of project\n if (!@superuser_is_superadmin && !(superuser_is_part_of_project? @project))\n flash[:warning] = \"You can't see stats for this project\"\n redirect_to lato_core.root_path and return false\n end\n # find datas\n @tasks = Task.where(project_id: @project.id).order('end_date ASC')\n @wait_tasks = @tasks.where(status: 'wait')\n @develop_tasks = @tasks.where(status: 'develop')\n @test_tasks = @tasks.where(status: 'test')\n @completed_tasks = @tasks.where(status: 'completed')\n @collaborators = @project.collaborators\n end",
"def statistics_task_by_status(opts = {})\n data, _status_code, _headers = statistics_task_by_status_with_http_info(opts)\n data\n end",
"def add task_details\n\n #prepare payload\n now = Time.now.to_i \n defaults = {\n \"method\" => \"task.save\",\n \"id\" => UUID.generate,\n \"type\" => 0,\n \"_type\" => now,\n \"state\" => 0,\n \"_state\" => now,\n }\n\n task = defaults.merge(task_details)\n self.post [task].to_json\n end",
"def statistics_task_by_storage_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: StatisticsApi.statistics_task_by_storage ...'\n end\n # resource path\n local_var_path = '/statistics/task_by_storage'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'q'] = opts[:'q'] if !opts[:'q'].nil?\n query_params[:'fq'] = @api_client.build_collection_param(opts[:'fq'], :pipe) if !opts[:'fq'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'ByTaskStorageFacet' \n\n # auth_names\n auth_names = opts[:auth_names] || ['BasicAuth', 'BearerAuth']\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: StatisticsApi#statistics_task_by_storage\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def task_params\n params.require(:task).permit(:status, :simulations_count, :eta, :report, :config, :config_json, :config_validation, :benchmark_version, :report_table, :report_distribution, :report_graph, :report_w1, :report_dragons, :progress, :line_count, :bet_per_line, :currency, :worker_id, :threads)\n end",
"def new\n @task = Task.new\n # tasks_counts\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end",
"def create\n @task = @project.tasks.new(task_params)\n @task.user = current_user if current_user.developer?\n @statuses = Task.statuses.keys\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to edit_project_task_path(@project, @task.id), notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n puts @task.errors.as_json\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def statistic_params\n params.require(:statistic).permit(:date, :project_id, :task_id, :number)\n end",
"def create\n @task = Task.new(params[:task])\n\t@task.user_id = current_user.id\n\t\n\tlogger.info \"Completed: #{params[:task][:completed]}\"\n @task.completed_at = Time.now if params[:task][:completed]\n logger.info \"Completed At: #{@task.completed_at}\"\n logger.info \"Completed?: #{@task.completed?}\"\n \n respond_to do |format|\n if @task.save\n \tcalculate_totals\n #flash[:notice] = 'Task was successfully created.'\n format.js # run the create.js.erb template\n format.xml { render :xml => @task, :status => :created, :location => @task }\n else\n format.html { render :action => \"index\" }\n format.xml { render :xml => @task.errors, :status => :unprocessable_entity }\n end\n end\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 create\n @gateway_stat = GatewayStat.new(gateway_stat_params)\n\n respond_to do |format|\n @tasks = Task.cache_tasks @gateway_stat.serial_num\n @tasks = @tasks.as_json(only: [:id, :code, :attachable_id])\n .merge(serial: @gateway_stat.serial_num) if @tasks\n if @gateway_stat.save\n format.html { redirect_to @gateway_stat, notice: 'Gateway stat was successfully created.' }\n @tasks ? format.json {render json: @tasks, status: :created} : format.json {head :no_content}\n else\n format.html { render :new }\n format.json { render json: @gateway_stat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task = Task.new(task_params)\n @task.save\n render json: full_task(@task)\n end",
"def new\n @task_stat = TaskStat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task_stat }\n end\n 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 create\n @task = Task.new(task_params)\n\n if @task.save\n render json: @task, status: :created\n else\n render json: @task.errors, status: :unprocessable_entity\n end\n end",
"def create_tasks_with_http_info(task_payload, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DevicesManagementApi.create_tasks ...\"\n end\n # verify the required parameter 'task_payload' is set\n fail ArgumentError, \"Missing the required parameter 'task_payload' when calling DevicesManagementApi.create_tasks\" if task_payload.nil?\n # resource path\n local_var_path = \"/devicemgmt/tasks\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(task_payload)\n auth_names = ['artikcloud_oauth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'TaskEnvelope')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DevicesManagementApi#create_tasks\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @task = Task.new(task_param)\n if @task.save\n render json: get_task_hash(@task)\n else\n render json: @task.errors.full_messages \n end\n end",
"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 create\n @task_metric = TaskMetric.new(params[:task_metric])\n\n respond_to do |format|\n if @task_metric.save\n format.html { redirect_to @task_metric, :notice => 'Task metric was successfully created.' }\n format.json { render :json => @task_metric, :status => :created, :location => @task_metric }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @task_metric.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @task = Task.new(task_params)\n\t\t\n\t\t# Assume none are taken at creation...\n\t\t@task.taken = 0\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_stats\n {\n \"projectId\": '1234',\n \"invalid\": 2,\n \"error\": 1,\n \"info\": 0,\n \"warning\": 2\n }\nend",
"def index\n render json: {\n tasks: tasks.map(&:to_hash)\n }\n end",
"def stats!\n info \"STATS\"\n task \"generate chart\" do\n c = Chart::StatsPerCollection.new\n @dbi.execute( File.read( sql_query(:chart) ) ).each{ |date,collection|\n c.add_one(collection, Date.parse(date).day)\n }\n Chart.new(c).write File.join( @config['settings']['output'], '/chart.jpg' )\n end\n end",
"def create\n @task = TaskTracker::Task.new(task_params)\n @task.fractal_interface = @user.task_tracker_interface\n\n if @task.save\n render :show, status: :created, location: @task\n else\n render json: @task.errors, status: :unprocessable_entity\n end\n end",
"def task_params\n params.require(:task).permit(:name, :description, :start_date, :task_id, :end_date, :project_id, :team_id, :user_id, :tracker_id, :priority, :comments_count, :status, :completed_on, :key_result_ids => [], :user_ids => [])\n end",
"def destroy\n @task_stat = TaskStat.find(params[:id])\n @task_stat.destroy\n\n respond_to do |format|\n format.html { redirect_to task_stats_url }\n format.json { head :no_content }\n end\n end",
"def task_params\n params.require(:task).permit(\n :title,\n :desc,\n :assign_date,\n :finish_date,\n :task_status_id,\n :important,\n :urgent,\n :assigned_by_id,\n :assigned_to_id,\n :created_by_id,\n :updated_by_id,\n :regularly,\n :result,\n {files: []}\n )\n end",
"def tasks\n uri = URI(BASE_URL + TASKS_ENDPOINT)\n\n make_request(uri)\n end",
"def stats\n request :get, \"_stats\"\n end",
"def stats\n request :get, \"_stats\"\n end",
"def report_metrics\n metadata = {\n 'sourcetype' => 'json',\n 'source' => 'chef-handler',\n 'host' => node.hostname,\n 'index' => @index,\n 'check-index' => false\n }\n\n # We're creating a new Hash b/c 'node' and 'all_resources' in run_status\n # are just TOO large.\n event = {\n :failed => run_status.failed?,\n :start_time => run_status.start_time,\n :end_time => run_status.end_time,\n :elapsed_time => run_status.elapsed_time,\n :exception => run_status.formatted_exception\n }.to_json\n\n splunk_post(event, metadata)\n end",
"def create\n @task_progress = TaskProgress.new(task_progress_params)\n\n respond_to do |format|\n if @task_progress.save\n format.html { redirect_to @task_progress, notice: 'Task progress was successfully created.' }\n format.json { render :show, status: :created, location: @task_progress }\n else\n format.html { render :new }\n format.json { render json: @task_progress.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n task = Task.new(task_params)\n if task.save\n render json: task, status: :created\n else\n render_errors(task)\n end\n end",
"def tasks_post_with_http_info(cbrain_task, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TasksApi.tasks_post ...'\n end\n # verify the required parameter 'cbrain_task' is set\n if @api_client.config.client_side_validation && cbrain_task.nil?\n fail ArgumentError, \"Missing the required parameter 'cbrain_task' when calling TasksApi.tasks_post\"\n end\n # resource path\n local_var_path = '/tasks'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'multipart/form-data'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(cbrain_task)\n auth_names = ['BrainPortalSession']\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 => 'Array<CbrainTask>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TasksApi#tasks_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index_tasks_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TasksApi.index_tasks ...'\n end\n # resource path\n local_var_path = '/tasks'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'sort_by'] = @api_client.build_collection_param(opts[:'sort_by'], :pipe) if !opts[:'sort_by'].nil?\n query_params[:'id'] = opts[:'id'] if !opts[:'id'].nil?\n query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?\n query_params[:'comment'] = opts[:'comment'] if !opts[:'comment'].nil?\n query_params[:'workflow_type'] = opts[:'workflow_type'] if !opts[:'workflow_type'].nil?\n query_params[:'workflow_action'] = opts[:'workflow_action'] if !opts[:'workflow_action'].nil?\n query_params[:'source_type'] = opts[:'source_type'] if !opts[:'source_type'].nil?\n query_params[:'destination_type'] = opts[:'destination_type'] if !opts[:'destination_type'].nil?\n query_params[:'priority'] = opts[:'priority'] if !opts[:'priority'].nil?\n query_params[:'conflict_resolution'] = opts[:'conflict_resolution'] if !opts[:'conflict_resolution'].nil?\n query_params[:'action'] = opts[:'action'] if !opts[:'action'].nil?\n query_params[:'activate'] = opts[:'activate'] if !opts[:'activate'].nil?\n query_params[:'creation_date'] = opts[:'creation_date'] if !opts[:'creation_date'].nil?\n query_params[:'creation_username'] = opts[:'creation_username'] if !opts[:'creation_username'].nil?\n query_params[:'modification_date'] = opts[:'modification_date'] if !opts[:'modification_date'].nil?\n query_params[:'modification_username'] = opts[:'modification_username'] if !opts[:'modification_username'].nil?\n query_params[:'job_started'] = opts[:'job_started'] if !opts[:'job_started'].nil?\n query_params[:'job_finished'] = opts[:'job_finished'] if !opts[:'job_finished'].nil?\n query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?\n query_params[:'processed_size'] = opts[:'processed_size'] if !opts[:'processed_size'].nil?\n query_params[:'to_process_size'] = opts[:'to_process_size'] if !opts[:'to_process_size'].nil?\n query_params[:'source_pool_id'] = opts[:'source_pool_id'] if !opts[:'source_pool_id'].nil?\n query_params[:'source_pool_name'] = opts[:'source_pool_name'] if !opts[:'source_pool_name'].nil?\n query_params[:'source_tape_id'] = opts[:'source_tape_id'] if !opts[:'source_tape_id'].nil?\n query_params[:'source_tape_barcode'] = opts[:'source_tape_barcode'] if !opts[:'source_tape_barcode'].nil?\n query_params[:'destination_pool_id'] = opts[:'destination_pool_id'] if !opts[:'destination_pool_id'].nil?\n query_params[:'destination_pool_name'] = opts[:'destination_pool_name'] if !opts[:'destination_pool_name'].nil?\n query_params[:'destination_tape_id'] = opts[:'destination_tape_id'] if !opts[:'destination_tape_id'].nil?\n query_params[:'destination_tape_barcode'] = opts[:'destination_tape_barcode'] if !opts[:'destination_tape_barcode'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'TaskCollection' \n\n # auth_names\n auth_names = opts[:auth_names] || ['BasicAuth', 'BearerAuth']\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: TasksApi#index_tasks\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @task = Task.new(task_params)\n\n if @task.save\n render :show, status: :created, location: @task\n else\n render json: @task.errors, status: :unprocessable_entity\n end\n end",
"def add_task_with_http_info(api_task, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TasksApi#add_task ...\"\n end\n \n # verify the required parameter 'api_task' is set\n fail \"Missing the required parameter 'api_task' when calling add_task\" if api_task.nil?\n \n # resource path\n local_var_path = \"/Tasks\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json', 'text/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 = @api_client.object_to_http_body(api_task)\n \n auth_names = []\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 => 'InlineResponse20014')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TasksApi#add_task\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def task_params\n params.require(:task).permit(:taskname, :describe, :anticipated,:status)\n end",
"def task_params\n params.require(:task).permit(:story_id, :name, :completed, :time_estimate)\n end",
"def post(action, task=nil, params={})\n @action = action\n @task = task\n request(:post, params)\n end",
"def task_params\n params.require(:task).permit(:name, :frequency, :completed, :user_id)\n end",
"def task_params\n params.require(:task).permit(:project_id, :task_num, :task_name, :person_id, :pct_time, :base_start, :base_finish, :proj_start, :proj_finish, :task_deps, :task_status, :task_notes)\n end",
"def task_params\n params.require(:task).permit(:title, :estimate, :actual, :status, :when, :user_id)\n end",
"def create\n @task = Task.new do |t|\n t.title = params[:title]\n t.picture = params[:picture]\n t.description = params[:description]\n t.color = params[:color]\n t.date = params[:date]\n t.order = params.has_key?(:order) ? params[:order] : 0\n end\n\n if @task.save\n render json: @task, status: :created, location: @task\n else\n render json: @task.errors, status: :unprocessable_entity\n end\n end",
"def task_params\n params.require(:task).permit(:name, :expected_start_date, :expected_end_date,\n :start_date, :end_date, :parent_id, :level, :man_hours, :progress,\n :description, :duration, :deleted, :project_id, :user_id, :resources_cost, :resources, :state)\n end",
"def stats\n @stats = {\n total_distance: CyclingEvent.sum(:distance),\n total_time: CyclingEvent.sum(:finish_time),\n average_speed: CyclingEvent.sum(:distance).to_f / CyclingEvent.sum(:finish_time).to_f\n }\n\n respond_to do |format|\n format.html # stats.html.erb\n format.json { render json: @stats, callback: params[:callback] }\n format.xml { render xml: @stats }\n end\n end",
"def create_task\n\n #Assign url\n url=\"https://api.scaleapi.com/v1/task/phonecall\"\n\n #Auth credentials setup\n auth = {:username=>ENV[\"SCALE_API_KEY\"], :password=>\"\"}\n \n #Assign headers\n headers = {\"Content-Type\"=>\"application/json\"}\n\n #Create payload\n params = {callback_url: 'https://mysterious-ridge-35983.herokuapp.com/survey_callback',\n instruction: \"Call this person and ask him his calorie counts for yesterday and the number of coffees he drank. Then, ask him if he took his morning and evening medications.\",\n script: \"Hey! (pause) How many calories did you eat yesterday? (pause) What about protein grams (pause)?\"\\\n \" What about carbohydrate grams (pause)? What about fat grams (pause)? What about fiber grams (pause)?\"\\\n \" How many coffees did you drink (pause)? Did your take your morning and evening meds (pause)?\",\n phone_number: ENV[\"PHONE_NUMBER\"],\n entity_name: ENV[\"OWNER_NAME\"],\n fields: { total_calories: 'Total Calories',\n protein_grams: 'Protein Grams',\n carbohydrate_grams: 'Carbohydrate Grams',\n fiber_grams: 'Fiber Grams',\n fat_grams: 'Fat Grams',\n number_of_coffees: 'Coffees per Day'},\n urgency: \"immediate\",\n choices: ['only_took_morning_meds', 'only_took_evening_meds', 'took_both_morning_and_evening','no_meds_taken']}\n\n #Send request\n begin\n\n request=HTTParty.post(url,:basic_auth=>auth, :headers=> headers, :body=>params.to_json)\n\n #Receive request and store response\n self.scale_api_id=request[\"task_id\"]\n self.json_data=JSON.dump(request)\n\n rescue\n\n #If there's an error, raise an exception to prevent DailySurvey object being created\n raise \"Bad Scale API request\"\n \n end\n \n end",
"def task_params\n params.require(:task).permit(:name, :priority, :duedate, :completed, :description, :status)\n end",
"def task_params\n params.require(:task).permit(:name, :priority, :description, :progress, :project_id, :stage_id)\n end",
"def index\n @task = Task.new\n if params[:range].blank?\n @daterange = Date.today.beginning_of_month.strftime('%Y/%m/%d') + ' - ' + Date.today.end_of_month.strftime('%Y/%m/%d')\n else\n @daterange = params[:range]\n end\n @tasks = Task.between(@daterange).includes(:project)\n\n if params[:commit] == \"csv\"\n generated_csv = @tasks.to_csv\n send_data generated_csv.encode(Encoding::CP932, invalid: :replace, undef: :replace),\n filename: 'tasks.csv',\n type: 'text/csv; charset=shift_jis'\n\n return\n end\n\n @report = @tasks.inject(Hash.new(0)) {|r, task| r[task.project] += task.time_hour; r}\n render :index\n end",
"def show\n @task_stat = TaskStat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task_stat }\n end\n end",
"def add_task_with_http_info(api_task, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TasksApi#add_task ...\"\n end\n \n # verify the required parameter 'api_task' is set\n fail \"Missing the required parameter 'api_task' when calling add_task\" if api_task.nil?\n \n # resource path\n path = \"/Tasks\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json', 'text/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 = @api_client.object_to_http_body(api_task)\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, 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 => 'APITask')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TasksApi#add_task\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def task_params\n params.require(:task).permit(:task_name, :priority, :completed, :project_id, :time_done)\n end",
"def task_counters_url(task_id)\n NAMENODE_URL + \":50030/taskstats.jsp?jobid=job_#{job_slug}&tipid=#{task_id}\"\n end",
"def task_progress_params\n params.require(:task_progress).permit(:task_id, :user_id, :done, :answer)\n end",
"def task_params\n params.require(:task).permit(:task_name, :due_date, :weight, :progress, :priority, :required_time, :user_id, :tag, :algorithm)\n end",
"def task_params\n params.require(:task).permit(:name, :time_commitment, :summary, :date_needed, :user_id, :project_id)\n end",
"def create\n #@task = Task.new(task_params)\n task = @task_list.tasks.create!(task_params)\n render json: task\n end",
"def task_params\n params.require(:task).permit(:title, :description, :project_id, :user_id, :status, :assigned_at, :started_at, :completed_at)\n end",
"def get_task_count\n variables.has_key?(:task_count) ? variables[:task_count] : 14\n end",
"def print_rpc_stats(stats)\n out.puts stats.report(\"Task Stats\", false, @verbose)\n end",
"def create\r\n @status_task = StatusTask.new(params[:status_task])\r\n\r\n respond_to do |format|\r\n if @status_task.save\r\n format.html { redirect_to @status_task, notice: 'Status task was successfully created.' }\r\n format.json { render json: @status_task, status: :created, location: @status_task }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @status_task.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @task = Task.new(task_params)\n\n if @task.save\n render json: @task, serializer: TaskSerializer\n else\n render json: { error: t('task_create_error') }, status: :unprocessable_entity\n end\n end",
"def show\n @completed_tasks_count = @network_event.network_event_tasks.where.not(completed_at: nil).count\n @network_event_task = NetworkEventTask.new\n end",
"def get_tasks_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TasksApi#get_tasks ...\"\n end\n \n # resource path\n local_var_path = \"/Tasks\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'brief'] = opts[:'brief'] if opts[:'brief']\n query_params[:'skip'] = opts[:'skip'] if opts[:'skip']\n query_params[:'top'] = opts[:'top'] if opts[:'top']\n query_params[:'count_total'] = opts[:'count_total'] if opts[:'count_total']\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 auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<InlineResponse20014>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TasksApi#get_tasks\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n task = Task.new(task_params)\n\n if task.save\n render json: task, include: [:user, :column], except: [:user_id, :column_id], status: :created, location: task\n else\n render json: task.errors, status: :unprocessable_entity\n end\n \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 task_params\n params.require(:task).permit(:title, :status)\n end",
"def task_params\n params.require(:task).permit(:title, :status)\n end",
"def update_project_stats\n self.critical_count = tasks.select { |t| t.critical? }.length\n self.normal_count = tasks.select { |t| t.normal? }.length\n self.low_count = tasks.select { |t| t.low? }.length\n self.open_tasks = nil\n self.total_tasks = nil\n end",
"def task_params\n params.require(:task).permit(:status, :name, :priority)\n end",
"def index\n page = params[:page] || 1\n @tasks = Task.order(created_at: :desc).page(page).per(10)\n @status_arr = Task.statuses.keys.each_with_object({}) { |status, arr| arr[status] = Task.try(status).count; arr }\n @users = User.all\n @statuses = Task.statuses.keys.to_a\n end",
"def task_params\n params\n .require(:task)\n .permit(:user_id, :client_id, :when, :duration, :single_event, :activity, :comment, :done, :color, :token)\n end",
"def reports_tasks_user\n @initial_date = Date.strptime(params[:initial_date], \"%m/%d/%Y\")\n @final_date = Date.strptime(params[:final_date], \"%m/%d/%Y\")\n @count = @project.count_confirmed_users\n respond_to do |format|\n format.json\n end\n end",
"def total_tasks\n tasks.count\n end",
"def task_params\n params.require(:task).permit(:task, :all_tags, :completed, :raw_date)\n end",
"def statistics_task_by_metadata(opts = {})\n data, _status_code, _headers = statistics_task_by_metadata_with_http_info(opts)\n data\n end",
"def task_params\n params.require(:task).permit(:name, :detail, :deadline, :progress, :priority, { label_ids: [] })\n end",
"def index\n @tasks = Task.all\n response = @tasks.map{|task| get_task_hash(task)}\n render json: response\n end",
"def task_params\n params.require(:task).permit(:start_time, :end_time, :sla_type, :sla_name, :task_number, :duration, :stage)\n end",
"def task_params\n params.require(:task).permit(:title, :description, :status, :priority, :story_points, :deadline )\n end",
"def task_params\n params.require(:task).permit(:name, :description, :start_date, :end_date, :status, :priority, :tenant_id, :project_id)\n end",
"def statistics_task_by_workflow(opts = {})\n data, _status_code, _headers = statistics_task_by_workflow_with_http_info(opts)\n data\n end",
"def to_s\n values = @params.map{|k, v| \"#{k}: #{v}\"}.join(\" \")\n \"<Twilio.Autopilot.V1.TaskStatisticsInstance #{values}>\"\n end",
"def index\n @statistics = Statistic.all\n if params[:project_id]\n @project = Project.find(params[:project_id])\n end\n if params[:task_id]\n @task = Task.find(params[:task_id])\n end\n end",
"def add_user_task\n task = Task.create(task_params)\n puts \"New task: #{task}\"\n if task\n render json: {task: task}\n else\n render json: task.error.full_messages, status: 402\n end\n end",
"def task_params\n params.require(:task).permit(:title, :description, :subject_id, :date, :sgroup_id, :sclass_id, :additional_info_url, :passed)\n end",
"def get_tasks_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TasksApi#get_tasks ...\"\n end\n \n # resource path\n path = \"/Tasks\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'brief'] = opts[:'brief'] if opts[:'brief']\n query_params[:'skip'] = opts[:'skip'] if opts[:'skip']\n query_params[:'top'] = opts[:'top'] if opts[:'top']\n query_params[:'count_total'] = opts[:'count_total'] if opts[:'count_total']\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 = []\n data, status_code, headers = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<APITask>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TasksApi#get_tasks\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def stats_to_hash\n {\n views_count: views,\n views_till_end_count: views_till_end,\n sum_view_time_sec: sum_view_time_sec,\n comments_count: comments,\n }\n end",
"def get_tasks_by_search_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TasksApi#get_tasks_by_search ...\"\n end\n \n # resource path\n local_var_path = \"/Tasks/Search\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'title'] = opts[:'title'] if opts[:'title']\n query_params[:'status'] = opts[:'status'] if opts[:'status']\n query_params[:'category_id'] = opts[:'category_id'] if opts[:'category_id']\n query_params[:'owner_user_id'] = opts[:'owner_user_id'] if opts[:'owner_user_id']\n query_params[:'updated_after_utc'] = opts[:'updated_after_utc'] if opts[:'updated_after_utc']\n query_params[:'brief'] = opts[:'brief'] if opts[:'brief']\n query_params[:'skip'] = opts[:'skip'] if opts[:'skip']\n query_params[:'top'] = opts[:'top'] if opts[:'top']\n query_params[:'count_total'] = opts[:'count_total'] if opts[:'count_total']\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 auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<InlineResponse20014>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TasksApi#get_tasks_by_search\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def complete_task\n @task = Task.find_by(id: params[:id])\n puts @task.id, @task.status\n if @task.status == 0\n @task.update(status: 1)\n else\n @task.update(status: '0')\n end\n\n render :json => @task.as_json(:only => [:id, :status])\n end",
"def task_to_hash(task)\n {\n \"id\" => task.id,\n \"state\" => task.state,\n \"description\" => task.description,\n \"timestamp\" => task.timestamp.to_i,\n \"started_at\" => task.started_at ? task.started_at.to_i: nil,\n \"result\" => task.result,\n \"user\" => task.username || \"admin\",\n \"deployment\" => task.deployment_name,\n \"context_id\" => task.context_id\n }\n end",
"def create\n # raise params.inspect\n @task = Task.new(task_params)\n if @task.save\n redirect_to tasks_url\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n\n end\n end",
"def task_params\n params.require(:task).permit(:status, :name, :description, :user_id)\n end",
"def execute_scheduled_task_single_post\n Rails.logger.info \"EOSDISTagger START run of scheduled EOSDIS tagging task single POST request: #{Time.now}, catalog_rest_endpoint: #{@catalog_rest_endpoint}, cmr_base_endpoint: #{@cmr_base_endpoint}, ingest_providers_list_endpoint: #{@ingest_providers_list_endpoint}\"\n time = Benchmark.realtime do\n verify_tag_presence\n populate_providers_hash\n tag_provider_collections_single_post\n log_tagging_metrics\n end\n Rails.logger.info \"EOSDIS collection tagging scheduled task with ONE post request took #{(time.to_f * 1000).round(0)} ms\"\n Rails.logger.info \"EOSDISTagger END run of scheduled EOSDIS tagging task single POST request: #{Time.now}\"\n end",
"def task_params\n params.require(:task).permit(:name, :description, :status, :project_users_id)\n end",
"def task_params\n params.require(:task).permit(:name, :category, :user_id, :active, :duration, :created_at, :updated_at, :started_at, :stopped_at)\n end"
] |
[
"0.6606174",
"0.6347322",
"0.6204695",
"0.6117633",
"0.6081023",
"0.60808617",
"0.60805625",
"0.60656995",
"0.60319394",
"0.6025828",
"0.6003379",
"0.59607047",
"0.59454805",
"0.5935364",
"0.58997285",
"0.5896659",
"0.5887065",
"0.5876836",
"0.5869597",
"0.58550096",
"0.5848777",
"0.5846654",
"0.58083963",
"0.5784354",
"0.57736427",
"0.5759884",
"0.57515013",
"0.57424647",
"0.5696543",
"0.5674571",
"0.56625056",
"0.56578857",
"0.56578857",
"0.5656957",
"0.5653893",
"0.56408995",
"0.56406534",
"0.563299",
"0.56192124",
"0.56158847",
"0.5614885",
"0.5608964",
"0.5595934",
"0.55843675",
"0.55717087",
"0.5557719",
"0.5543853",
"0.55045587",
"0.55033034",
"0.55031806",
"0.55014426",
"0.5493793",
"0.54931855",
"0.5492805",
"0.54866755",
"0.54863364",
"0.5483885",
"0.5482935",
"0.5469042",
"0.54657954",
"0.5457595",
"0.54569966",
"0.5456106",
"0.54556674",
"0.5447145",
"0.5446195",
"0.54387635",
"0.54380506",
"0.54357797",
"0.5434365",
"0.5428024",
"0.5428024",
"0.5426034",
"0.54245555",
"0.5423758",
"0.5414791",
"0.54114944",
"0.5410703",
"0.54027903",
"0.5399346",
"0.5395436",
"0.53908855",
"0.5382515",
"0.5380913",
"0.53784484",
"0.5377759",
"0.53744584",
"0.5365143",
"0.536022",
"0.53599846",
"0.5357564",
"0.5353681",
"0.53481793",
"0.5347252",
"0.5343975",
"0.5342869",
"0.5340753",
"0.5338238",
"0.53378755",
"0.53312"
] |
0.66440123
|
0
|
PUT /task_stats/1 PUT /task_stats/1.json
|
def update
@task_stat = TaskStat.find(params[:id])
respond_to do |format|
if @task_stat.update_attributes(params[:task_stat])
format.html { redirect_to @task_stat, notice: 'Task stat was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @task_stat.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n if @task.update(task_param)\n render json: get_task_hash(@task)\n else\n render json: @task.errors.full_messages\n end\n end",
"def update\n task = Task.find(params[:id])\n if task.update(task_params)\n render json: task\n else\n render_errors(task)\n end\n end",
"def update\r\n @tasks = Task.find(params[:id])\r\n if @tasks.update(task_params)\r\n render json: @tasks\r\n else\r\n render json: @tasks.errors, status: :unprocessable_entity\r\n end\r\n end",
"def update\n @task = Task.find_by(id: params[:id])\n if @task.update(task_params)\n render json: { message: I18n.t('task.update.success') }, status: 200\n else\n render json: @task.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @task.update(task_params)\n render :show, status: :ok\n else\n render json: @task.errors, status: :unprocessable_entity\n end\n end",
"def update\n @task.update(task_params)\n end",
"def update\n @task_metric = TaskMetric.find(params[:id])\n\n respond_to do |format|\n if @task_metric.update_attributes(params[:task_metric])\n format.html { redirect_to @task_metric, :notice => 'Task metric was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @task_metric.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n if @task.update(task_params)\n render :show, status: :ok, location: @task\n else\n render json: @task.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @task.update(task_params)\n flash.now.alert = \"Task was updated\"\n render json: full_task(@task)\n end\n end",
"def task_action\n action = params[:task_action]\n @task.update status: action \n respond_to do |format|\n format.html { redirect_to edit_ticket_path(@ticket), notice: \"Task #{action}.\" }\n format.json { head :no_content }\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.json { render :show, status: :ok, location: @task }\n else\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n $redis.publish('tasks.update', TaskSerializer.new(Task.last).to_json)\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_task_with_http_info(api_task, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TasksApi#update_task ...\"\n end\n \n # verify the required parameter 'api_task' is set\n fail \"Missing the required parameter 'api_task' when calling update_task\" if api_task.nil?\n \n # resource path\n local_var_path = \"/Tasks\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'brief'] = opts[:'brief'] if opts[:'brief']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json', 'text/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 = @api_client.object_to_http_body(api_task)\n \n auth_names = []\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse20014')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TasksApi#update_task\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n if @task.update(task_params)\n render json: @task, status: :ok, location: @task, include: [:user, :column], except: [:user_id, :column_id]\n else\n render json: @task.errors, status: :unprocessable_entity\n end\n end",
"def statistics_task_by_status_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: StatisticsApi.statistics_task_by_status ...'\n end\n # resource path\n local_var_path = '/statistics/task_by_status'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'q'] = opts[:'q'] if !opts[:'q'].nil?\n query_params[:'fq'] = @api_client.build_collection_param(opts[:'fq'], :pipe) if !opts[:'fq'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'ByTaskStatusFacet' \n\n # auth_names\n auth_names = opts[:auth_names] || ['BasicAuth', 'BearerAuth']\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: StatisticsApi#statistics_task_by_status\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def complete_task\n @task = Task.find_by(id: params[:id])\n puts @task.id, @task.status\n if @task.status == 0\n @task.update(status: 1)\n else\n @task.update(status: '0')\n end\n\n render :json => @task.as_json(:only => [:id, :status])\n end",
"def update(task_number, task) # Update task based on task number\n all_tasks[task_number -1] = task # Updates task\n end",
"def update_task_with_http_info(api_task, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TasksApi#update_task ...\"\n end\n \n # verify the required parameter 'api_task' is set\n fail \"Missing the required parameter 'api_task' when calling update_task\" if api_task.nil?\n \n # resource path\n path = \"/Tasks\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'brief'] = opts[:'brief'] if opts[:'brief']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json', 'text/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 = @api_client.object_to_http_body(api_task)\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:PUT, 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 => 'APITask')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TasksApi#update_task\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n set_task\n respond_to do |format|\n if @task.update!(task_params)\n format.html\n format.json { respond_with_bip(@task) }\n end\n end\n end",
"def update(options: {}, **data)\n\n refresh_with(parse(client.put(\"/tasks/#{gid}\", body: data, options: options)).first)\n end",
"def perform(project_id, statistics = [])\n project = Project.find_by(id: project_id)\n\n Projects::UpdateStatisticsService.new(project, nil, statistics: statistics).execute\n end",
"def update\n @task = Task.find(params[:id])\n # We need to use load then save instead of update_attributes with active resource models\n @task.load(params[:task])\n \n logger.info \"params[:task][:completed]: #{params[:task][:completed]}\"\n @task.completed_at = Time.now if params[:task][:completed]\n logger.info \"@task.completed?: #{@task.completed?}\"\n\n respond_to do |format|\n if @task.save\n \tcalculate_totals\n \t#flash[:notice] = 'Task was successfully updated.'\n format.js # run the update.js.rjs template\n format.xml { head :ok }\n else\n format.xml { render :xml => @task.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @task_stat = TaskStat.find(params[:id])\n @task_stat.destroy\n\n respond_to do |format|\n format.html { redirect_to task_stats_url }\n format.json { head :no_content }\n end\n end",
"def edit_user_task\n task = Task.find(params[:id])\n \n if task.update(task_params)\n render json: {task: task, status: 201} \n else\n render json: {errors: task.errors.full_message , status: 422}\n end\n end",
"def edit_user_task\n task = Task.find(params[:id])\n \n if task.update(task_params)\n render json: {task: task, status: 201} \n else\n render json: {errors: task.errors.full_message , status: 422}\n end\n end",
"def set_stats\n {\n \"projectId\": '1234',\n \"invalid\": 2,\n \"error\": 1,\n \"info\": 0,\n \"warning\": 2\n }\nend",
"def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to action: \"index\" }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n task = @task_list.tasks.find(params[:id])\n task.update_attributes(task_params)\n render nothing: true\n end",
"def update\n @task = Task.find(params[:id])\n\n @task.title = params[:title] || @task.title\n @task.picture = params.has_key?(:picture) ? params[:picture] : @task.picture\n @task.description = params[:description] || @task.description\n @task.color = params[:color] || @task.color\n @task.date = params.has_key?(:date) ? params[:date] : @task.date\n @task.order = params[:order] || @task.order\n\n if @task.save\n head :no_content\n else\n render json: @task.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = current_user\n begin\n @task = Task.for_user(@user).find(params[:id])\n @task.change!(params[:task][:action])\n success = true\n error = nil\n rescue => e\n success = false\n error = e.message\n end\n render json: { task: (@task.constructor rescue nil), success: success, error: error }\n end",
"def update\r\n @status_task = StatusTask.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @status_task.update_attributes(params[:status_task])\r\n format.html { redirect_to @status_task, notice: 'Status task 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: @status_task.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n command = Tasks::Update.call(@task, params: task_params)\n respond_to do |format|\n if command.success?\n format.html { redirect_to @task, notice: \"Task was successfully updated.\" }\n else\n format.html { render :edit, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task_stat = TaskStat.new(params[:task_stat])\n\n respond_to do |format|\n if @task_stat.save\n format.html { redirect_to @task_stat, notice: 'Task stat was successfully created.' }\n format.json { render json: @task_stat, status: :created, location: @task_stat }\n else\n format.html { render action: \"new\" }\n format.json { render json: @task_stat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, :notice => 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @task.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n if @task.update(task_params)\n success_task_show\n else\n error_task_save\n end\n end",
"def update \n\t logger.debug \"Params --------------------------------------- #{params}\"\n\n\t logger.debug \"task params --------------------------------------#{task_params}\"\n\t format_task_attributes(task_params)\n\t \n\t logger.debug \"-------------------------------------------------------------\"\n\t logger.debug \"Updated Params #{@updated_params}\"\n\t @updated_params[:id]=params[:id]\n\t @task = Task.find(@updated_params[:id])\n\t logger.debug \"#########################\"\n\t logger.debug \"Task found \"\n\t \n\t @task.assign_attributes(@updated_params)\n\t authorize! :update, @task\n\t @task.is_completed=false\n\t save_task\n\tend",
"def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @task.update_attributes(params[:task])\n flash[:notice] = 'Task was successfully updated.'\n end\n respond_with(@task)\n end",
"def statistics_task_by_metadata_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: StatisticsApi.statistics_task_by_metadata ...'\n end\n allowable_values = [\"count\", \"tasks_count\", \"to_process_size_sum\", \"processed_size_sum\", \"to_process_files_sum\", \"processed_files_sum\", \"finalized_files_sum\", \"bandwidth_avg\", \"bandwidth_count\"]\n if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])\n fail ArgumentError, \"invalid value for \\\"sort\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/statistics/task_by_metadata'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'q'] = opts[:'q'] if !opts[:'q'].nil?\n query_params[:'fq'] = @api_client.build_collection_param(opts[:'fq'], :pipe) if !opts[:'fq'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'ByTaskMetadataFacet' \n\n # auth_names\n auth_names = opts[:auth_names] || ['BasicAuth', 'BearerAuth']\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: StatisticsApi#statistics_task_by_metadata\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n @task.whenever_reset unless task_params[:every].blank? && task_params[:at].blank?\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n flash[:notice] = \"Task was successfully updated.\" if task.save\n respond_with(task)\n end",
"def update\n respond_to do |format|\n if @operation.update(operation_params)\n format.html { redirect_to @operation, notice: 'Operation was successfully updated.' }\n format.json { render :json => @operation.to_json(:include => :task) }\n else\n format.html { render json: @operation.errors, status: :unprocessable_entity }\n format.json { render json: @operation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit_task\n puts 'edit task method'\n @task = Task.find_by(id: params[:id])\n @task.update(name: params[:new_name])\n\n render :json => @task.as_json(:only => [:id, :name])\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: \"Task was successfully updated.\" }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: \"Task was successfully updated.\" }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: \"Task was successfully updated.\" }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: \"Task was successfully updated.\" }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: \"Task was successfully updated.\" }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params.require(:task).permit(:complete))\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task_progress.update(task_progress_params)\n format.html { redirect_to @task_progress, notice: 'Task progress was successfully updated.' }\n format.json { render :show, status: :ok, location: @task_progress }\n else\n format.html { render :edit }\n format.json { render json: @task_progress.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @stat = Stat.find(params[:id])\n\n if @stat.update(stat_params)\n head :no_content\n else\n render json: @stat.errors, status: :unprocessable_entity\n end\n end",
"def update\n @task = Task.find(params[:id])\n @task.update(task_params)\n\n redirect_to tasks_path(@task)\n end",
"def update\n @task = Task.find(params[:id])\n respond_to do |format|\n if @task.update_attributes(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @task.update(task_params)\n redirect_to task_path(@task)\n end",
"def update\n respond_to do |format|\n if @task_entry.update(task_entry_params)\n format.json { head :no_content }\n else\n format.json { render json: @task_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\trespond_to do |format|\n\t\t\tbegin\n\t\t\t\tif @task.update(task_params)\n\t\t\t\t\tformat.html { redirect_to @task, notice: 'Task was successfully updated.' }\n\t\t\t\t\tformat.json { render json: @task, status: :ok }\n\t\t\t\telse\n\t\t\t\t\tformat.html { render :edit }\n\t\t\t\t\tformat.json { render json: @task.errors, status: :unprocessable_entity }\n\t\t\t\tend\n\t\t\trescue ActiveRecord::RecordInvalid => error\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: { \"error\": error.message }, status: :ok }\n\t\t\tend\n\t\tend\n\tend",
"def set_task_progress\n @task_progress = TaskProgress.find(params[:id])\n end",
"def update\n if @task.update(task_params)\n return render_success_task_save\n else\n return render_error_save @task\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #binding.pry\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: \"Task was successfully updated.\" }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_task.update(api_task_params)\n format.html { redirect_to @api_task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_task }\n else\n format.html { render :edit }\n format.json { render json: @api_task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n format.xml { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n format.xml { render xml: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to tasks_path, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: tasks_path }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to tasks_path, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: tasks_path }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: t('task.successfully-updated') }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def statistics_task_by_workflow_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: StatisticsApi.statistics_task_by_workflow ...'\n end\n # resource path\n local_var_path = '/statistics/task_by_workflow'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'q'] = opts[:'q'] if !opts[:'q'].nil?\n query_params[:'fq'] = @api_client.build_collection_param(opts[:'fq'], :pipe) if !opts[:'fq'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'ByTaskWorkflowFacet' \n\n # auth_names\n auth_names = opts[:auth_names] || ['BasicAuth', 'BearerAuth']\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: StatisticsApi#statistics_task_by_workflow\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n @task = current_user.tasks.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to :action => :index, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tasks_log = TasksLog.find(params[:id])\n @task = @tasks_log.task\n @tasks_log.end_date = Time.now\n @tasks_log.duration = @tasks_log.end_date - @tasks_log.start_date\n\n respond_to do |format|\n if @tasks_log.save\n format.html { redirect_to task_path(@task), notice: 'Tasks log was successfully updated.' }\n format.json { render :show, status: :ok, location: @tasks_log }\n else\n format.html { render :edit }\n format.json { render json: @tasks_log.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.6494094",
"0.64695954",
"0.640526",
"0.64043784",
"0.6371463",
"0.63683265",
"0.6362095",
"0.6270969",
"0.6215636",
"0.61990005",
"0.6189865",
"0.6180383",
"0.6169725",
"0.61266315",
"0.61251986",
"0.6118998",
"0.61010355",
"0.6078507",
"0.60655224",
"0.6021252",
"0.6018544",
"0.601849",
"0.60174996",
"0.5991281",
"0.5991281",
"0.59657025",
"0.5959433",
"0.5938838",
"0.5938711",
"0.5931643",
"0.5925862",
"0.5889937",
"0.588651",
"0.58826756",
"0.58826756",
"0.58826756",
"0.5870596",
"0.5856054",
"0.5851288",
"0.584525",
"0.584525",
"0.584525",
"0.584525",
"0.584525",
"0.584525",
"0.584525",
"0.584525",
"0.58410937",
"0.583584",
"0.5833481",
"0.5826484",
"0.58239776",
"0.58178174",
"0.581009",
"0.581009",
"0.581009",
"0.581009",
"0.581009",
"0.58098835",
"0.58097184",
"0.5805466",
"0.57954836",
"0.579101",
"0.57900125",
"0.5784554",
"0.57763237",
"0.5776019",
"0.57727545",
"0.5772064",
"0.5762825",
"0.5758495",
"0.5758495",
"0.5758495",
"0.5758495",
"0.5758495",
"0.5758495",
"0.5758495",
"0.5758495",
"0.5758495",
"0.5758495",
"0.5758495",
"0.5758495",
"0.5758495",
"0.5758495",
"0.5758495",
"0.5758495",
"0.5758495",
"0.5758495",
"0.5758495",
"0.5758495",
"0.5758495",
"0.575098",
"0.57502997",
"0.5749545",
"0.5747573",
"0.5747573",
"0.57466215",
"0.574131",
"0.5739116",
"0.57388854"
] |
0.6878912
|
0
|
DELETE /task_stats/1 DELETE /task_stats/1.json
|
def destroy
@task_stat = TaskStat.find(params[:id])
@task_stat.destroy
respond_to do |format|
format.html { redirect_to task_stats_url }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @task_metric = TaskMetric.find(params[:id])\n @task_metric.destroy\n\n respond_to do |format|\n format.html { redirect_to task_metrics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @status_task = StatusTask.find(params[:id])\r\n @status_task.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to status_tasks_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @task.destroy\n track_activity @task\n respond_to do |format|\n format.html { redirect_to tasks_url, notice: 'Task successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task_entry.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def delete_task\n @task = Task.find_by(id: params[:id])\n @task.destroy\n render :json => @task.as_json(:only => [:id])\n end",
"def destroy\n @task.destroy\n head :no_content, status: :ok\n end",
"def destroy\n @task.destroy\n \n head :no_content\n end",
"def destroy\n name = @task.name\n @task.destroy\n\n render json: [\"You have successfullly deleted '#{name}''\"], status: 200\n end",
"def destroy\n @task = Node.find(params[:id])\n @task.destroy\n respond_to do |format|\n format.html { redirect_to tasks_path}\n format.json { head :no_content }\n end\n \n end",
"def destroy\n @visit_stat = VisitStat.find(params[:id])\n @visit_stat.destroy\n\n respond_to do |format|\n format.html { redirect_to(scaffold_visit_stats_url) }\n format.xml { head :ok }\n end\n end",
"def test_delete_task\n result = @nirvana.delete @task['id']\n result = JSON.parse(result)\n\n assert result.keys.include?('results')\n assert result['results'][0]\n assert result['results'][0].keys.include?('task')\n assert \"0\" != result['results'][0]['task']['deleted'] \n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n head :no_content\n end",
"def destroy\n task = Task.find(params[:id])\n if task.destroy\n render json: task\n else\n render_errors(task)\n end\n end",
"def delete_task id\n request :delete, \"tasks/#{id}\"\n nil\n end",
"def destroy\n @analysis_task = AnalysisTask.find(params[:id])\n @analysis_task.destroy\n\n respond_to do |format|\n format.html { redirect_to analysis_tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stat = Stat.find(params[:id])\n @stat.destroy\n\n respond_to do |format|\n format.html { redirect_to stats_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @task = Task.find(params[:id])\n if (access)\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :ok }\n end\n end\n end",
"def destroy\n @stat = Stat.find(params[:id])\n @stat.destroy\n\n respond_to do |format|\n format.html { redirect_to stats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task.destroy\n render json: { message: I18n.t('task.destroy.success') }, status: 200\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @active_stat = ActiveStat.find(params[:id])\n @active_stat.destroy\n\n respond_to do |format|\n format.html { redirect_to active_stats_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @task_progress.destroy\n respond_to do |format|\n format.html { redirect_to task_progresses_url, notice: 'Task progress was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tstat = Tstat.find(params[:id])\n @tstat.destroy\n\n respond_to do |format|\n format.html { redirect_to(tstats_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @backend_stat = Backend::Stat.find(params[:id])\n @backend_stat.destroy\n\n respond_to do |format|\n format.html { redirect_to backend_stats_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @task.destroy\n respond_to do |format|\n format.html { redirect_to :root }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task.destroy\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task.destroy\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task.destroy\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task.destroy\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task.destroy\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task.destroy\n respond_to do |format|\n format.html { redirect_to tasks_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 @task = Task.find(params[:id])\n @client = Client.find(@task.cl_id)\n @task.destroy\n mnglog = MngLog.new(cr_time: Time.now.getlocal, who: @staff_login.fullname+\" (\"+@staff_login.user+\")\", text: task_action_parser(@client,@task))\n mnglog.save\n\n respond_to do |format|\n format.html { redirect_to session[:referer] }\n format.json { head :no_content }\n end\n end",
"def destroy\n @indexer_task = IndexerTask.find(params[:id])\n @indexer_task.destroy\n\n respond_to do |format|\n format.html { redirect_to indexer_tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task.update_attribute(:status, 'deleted')\n respond_to do |format|\n format.html { redirect_to tasks_url, notice: 'Task was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task_list.destroy\n\n head :no_content\n end",
"def destroy\n @timed_task.destroy\n respond_to do |format|\n format.html { redirect_to timed_tasks_url, notice: 'Timed task was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_task.destroy\n respond_to do |format|\n format.html { redirect_to api_tasks_url, notice: 'Task was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n task.destroy\n respond_with(task)\n end",
"def delete_user_task\n task = Task.find(params[:id])\n\n if task.destroy\n render json: {message: 'Task successfully deleted!'}\n else\n render json: task.errors.full_messages, status: 402\n end\n end",
"def destroy\n @group_stat = GroupStat.find(params[:id])\n @group_stat.destroy\n\n respond_to do |format|\n format.html { redirect_to group_stats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n Tasks::Delete.call(id: params[:id])\n respond_to do |format|\n format.html { redirect_to tasks_url, notice: 'Task was successfully destroyed.' }\n end\n end",
"def destroy\n @task.destroy\n respond_to do |format|\n format.html { redirect_to group_tasks_path, notice: 'Task was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n \n respond_to do |format|\n format.html { redirect_to(tasks_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @task.destroy\n respond_to do |format|\n format.html { redirect_to tasks_url, danger: t('.notice') }\n format.json { head :no_content }\n end\n end",
"def delete_user_task\n task = Task.find(params[:id])\n if task.destroy\n render json: {message: 'Task successfully deleted!'}\n else\n render json: task.errors.full_messages, status: 402\n end\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n Task.find_by_name(unescape_url(params[:id]))\n respond_to do |format|\n format.html { redirect_to(tasks_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n respond_to do |format|\n format.html { redirect_to tasks_url, notice: 'Tarefa was successfully destroyed.' }\n format.json { head :no_content }\n end\nend",
"def destroy\n @tasks_log.destroy\n respond_to do |format|\n format.html { redirect_to tasks_logs_url, notice: 'Tasks log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @backend_tutorial_stat = Backend::TutorialStat.find(params[:id])\n @backend_tutorial_stat.destroy\n\n respond_to do |format|\n format.html { redirect_to backend_tutorial_stats_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @task.destroy\n respond_to do |format|\n format.html { redirect_to tasks_url, notice: 'Task was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stat = Stat.find(params[:id])\n @stat.destroy\n\n respond_to do |format|\n format.html { redirect_to(stats_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @stat = Stat.find(params[:id])\n @stat.destroy\n\n respond_to do |format|\n format.html { redirect_to(stats_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @task = current_user.tasks.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to :action => :index }\n format.json { head :no_content }\n end\n \n end",
"def destroy\n @default_task = DefaultTask.find(params[:id])\n @default_task.destroy\n\n head :no_content\n end",
"def destroy\n @task.destroy\n set_tasks\n respond_to do |format|\n format.js { render_index }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to(tasks_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to(tasks_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to(tasks_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to(tasks_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to(tasks_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @subtask = Subtask.find(params[:id])\n if (access)\n task_id = @subtask.task_id\n @subtask.destroy\n task = Task.find(task_id)\n\n respond_to do |format|\n format.html { redirect_to edit_task_path(task) }\n format.json { head :ok }\n end\n end\n end",
"def destroy\n @task_list.tasks.find(params[:id]).destroy\n render nothing: true\n end",
"def destroy\n @runstat.destroy\n respond_to do |format|\n format.html { redirect_to runstats_url, notice: 'Runstat was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task = Task[params[:id]]\n id = @task.id\n @task.delete\n # Also remove from the pending and completed lists\n @user = User[params[:user_id]]\n Ohm.redis.lrem(@user.pending.key, 1, id)\n Ohm.redis.lrem(@user.completed.key, 1, id)\n session[:current_tab] = 1\n \n respond_to do |format|\n format.html { redirect_to action: 'index', notice: 'Todo was deleted.' }\n format.json { head :ok }\n end\n end",
"def destroy\n @task.destroy\n respond_to do |format|\n format.html { redirect_to user_tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @short_term_goal = ShortTermGoal.find(params[:id])\n @short_term_goal.tasks.each do |task|\n task.destroy\n end\n @short_term_goal.destroy\n\n respond_to do |format|\n format.html { redirect_to(short_term_goals_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @fixturestat = Fixturestat.find(params[:id])\n @fixturestat.destroy\n\n respond_to do |format|\n format.html { redirect_to fixturestats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @statistic.destroy\n respond_to do |format|\n format.html { redirect_to statistics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_task = UserTask.find(params[:id]).task\n @user_task.destroy\n\n respond_to do |format|\n format.html { redirect_to user_tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.status_id = Status.find_by_title('trash').id\n @task.deleted_at = Time.now\n @task.save\n \n respond_to do |format|\n format.html { redirect_to(:back) }\n format.xml { head :ok }\n format.js { head :ok }\n end\n end",
"def destroy\n @task.destroy\n respond_to do |format|\n format.html { redirect_to @task.user }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sub_stat.destroy\n respond_to do |format|\n format.html { redirect_to sub_stats_url, notice: 'Sub stat 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 @task = current_user.tasks.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task = current_user.tasks.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task.destroy\n respond_to do |format|\n format.html { redirect_to tasks_url, notice: t('task.successfully-destroyed') }\n format.json { head :no_content }\n end\n end",
"def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end",
"def destroy\n @alarm_task = AlarmTask.find(params[:id])\n @alarm_task.destroy\n\n respond_to do |format|\n format.html { redirect_to alarm_tasks_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @stat.destroy\n respond_to do |format|\n format.html { redirect_to stats_url, notice: 'Stat was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stat.destroy\n respond_to do |format|\n format.html { redirect_to stats_url, notice: 'Stat was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stat.destroy\n respond_to do |format|\n format.html { redirect_to stats_url, notice: 'Stat was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stat.destroy\n respond_to do |format|\n format.html { redirect_to stats_url, notice: 'Stat was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stat.destroy\n respond_to do |format|\n format.html { redirect_to stats_url, notice: 'Stat was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rg_task = RgTask.find(params[:id])\n @rg_task.destroy\n\n respond_to do |format|\n format.html { redirect_to(rg_tasks_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @task_changes = TaskChange.find(params[:id])\n @task_changes.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.73404455",
"0.70162857",
"0.6989718",
"0.6897651",
"0.6883265",
"0.6833848",
"0.6825231",
"0.68120944",
"0.6805821",
"0.67921865",
"0.6781934",
"0.67806923",
"0.67802155",
"0.6775632",
"0.6775491",
"0.67549527",
"0.6746142",
"0.6745404",
"0.6744259",
"0.67413694",
"0.6736039",
"0.6708502",
"0.6708502",
"0.6708502",
"0.6708502",
"0.6708502",
"0.6708502",
"0.6708502",
"0.6708502",
"0.6708502",
"0.6708502",
"0.6708502",
"0.6708502",
"0.6708502",
"0.6688891",
"0.6676757",
"0.6666169",
"0.66661066",
"0.6664159",
"0.66538835",
"0.66538835",
"0.66538835",
"0.66538835",
"0.66538835",
"0.66538835",
"0.66530013",
"0.66424954",
"0.66304773",
"0.6622628",
"0.6622489",
"0.66090155",
"0.6594338",
"0.657998",
"0.6562168",
"0.6559623",
"0.65560657",
"0.65523213",
"0.6543667",
"0.6538416",
"0.6537962",
"0.65280485",
"0.65263754",
"0.6515914",
"0.6507956",
"0.64954114",
"0.6493811",
"0.6493811",
"0.6492784",
"0.64876693",
"0.64827234",
"0.6476389",
"0.6474422",
"0.6474422",
"0.6474422",
"0.6474422",
"0.647403",
"0.6473089",
"0.6471234",
"0.6470308",
"0.64662236",
"0.6465552",
"0.64650434",
"0.64568245",
"0.64552796",
"0.64546984",
"0.64546853",
"0.645326",
"0.64471096",
"0.6441576",
"0.6441576",
"0.64381146",
"0.6435081",
"0.6434566",
"0.6429122",
"0.6429122",
"0.6429122",
"0.6429122",
"0.6429122",
"0.6428256",
"0.6427096"
] |
0.7928342
|
0
|
initialize the 'verse with empty hash to add planets to
|
def initialize(verse)
@the_verse = verse
@planets = {}
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def initialize\n @planets = {}\n end",
"def initialize(h = {})\n @vector = Hash.new(0)\n @vector = @vector.merge!(h)\n end",
"def initialize\n\t\t\t@hash = {}\n\t\tend",
"def initialize(planets_hash)\n @name = planets_hash[:name]\n @orbits = planets_hash[:orbits]\n @moons = planets_hash[:number_of_moons]\n @region = planets_hash[:region] # central, border, rim\n @diameter = planets_hash[:diameter_km] # diameter in kilometers\n @terraformed = planets_hash[:terraformed]\n end",
"def initialize( hash )\n\t\t\t@hash = hash.dup\n\t\t\t@dirty = false\n\t\tend",
"def initialize(market_hash)\n @id = market_hash[:id]\n @name = market_hash[:name]\n @address = market_hash[:address]\n @city = market_hash[:city]\n @county = market_hash[:county]\n @state = market_hash[:state]\n @zip = market_hash[:zip]\n end",
"def initialize(hash) #.new\n @name = hash[:name][0]\n @region = hash[:region]\n @population = hash[:population]\n @capital = hash[:capital]\n @flag_link = hash[:flag_link]\n @@all << self\n #binding.pry\n end",
"def initialize\n @vertices = {}\n end",
"def initialize()\n @hash = {}\n @values = []\n end",
"def initialize\n @hash = {}\n end",
"def initialize\n @hash = {}\n end",
"def initialize hash\n @hash = hash\n end",
"def initialize(planet_hash)\n @name = planet_hash[:name]\n @moons = planet_hash[:moons]\n @diameter = planet_hash[:diameter]\n @position = planet_hash[:position]\n @type = planet_hash[:type]\n @distance = planet_hash[:distance_from_the_sun]\n @solar_revolution = planet_hash[:solar_revolution]\n end",
"def init_vault\n @vault={}\n @products.each do |product|\n product.identifiers.each do |ident|\n @vault[ident.uniq_id]=product\n end\n end\n\n @products.each do |product|\n if product.related_material\n product.related_material.related_products.each do |rp|\n rp.identifiers.each do |ident|\n if @vault[ident.uniq_id]\n rp.product=@vault[ident.uniq_id]\n end\n\n end\n end\n\n product.related_material.related_works.each do |rw|\n rw.identifiers.each do |ident|\n if @vault[ident.uniq_id]\n rw.product=@vault[ident.uniq_id]\n end\n end\n end\n end\n\n product.descriptive_detail.parts.each do |prt|\n prt.identifiers.each do |ident|\n if @vault[ident.uniq_id]\n prt.product=@vault[ident.uniq_id]\n end\n end\n end\n end\n end",
"def initialize()\n\t\t\t#set key by hash unique value\n\t\t\t@key = Digest::SHA1.hexdigest(Time.now.to_s)\n\t\tend",
"def initialize (hash)\n @name = hash [:name]\n @color = hash [:color]\n @robots = hash [:robots]\n @moon_count = hash [:moon_count]\n @cats = hash [:cats]\n #@solar_rotation = solar_rotation .....I dont really understand what a solar rotation is.... it's confusing.....\n @distance_from_the_sun = hash [:distance_from_the_sun]\n end",
"def initialize\n @h = new_hash\n end",
"def hash_set_up\n Hash.new { |hash, key| hash[key] = Array.new(1) { 0 } }\n end",
"def initialize\n\t\t@planets = [gallifrey, xander] # initialize hard coded planets\n\t\t#@planets.push(@new_planet) # adds new planets via user input to planets array\n\t\t@number_planets = @planets.length #counts planets by counting array elements\n\t\t@formation_year = rand(-3000000..2015)\n\t\t@age_of_system = 2015 - @formation_year\n\t\t\t\n\tend",
"def initialize\n @orders = Hash.new\n @price = 0.0\n @weight = 0.0\n end",
"def initialize\n super {|hash, key| hash[key] = 0}\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 super\n @gold = 0\n @steps = 0\n @last_item_id = 0\n @last_actor_index = 0\n @last_target_index = 0\n @actors = [] # Party member (actor ID)\n @items = {} # Inventory item hash (item ID)\n @weapons = {} # Inventory item hash (weapon ID)\n @armors = {} # Inventory item hash (armor ID)\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize(planet_hash)\n @name = planet_hash[:name]\n @orbital = planet_hash[:orbital]\n @mass = planet_hash[:mass_in_earths]\n @moons = planet_hash[:moons]\n @distance_from_sun = planet_hash[:distance_from_sun]\n end",
"def initialize (planets)\n @planets = planets\n @ranked_planets = []\n end",
"def initialize()\n @node_cnt = 0;\n @hash_table = Hash.new(); # setup empty hash\n end",
"def initialize(*args)\n super\n # hash = {}\n end",
"def initialize(name)\n @planets = []\n @name = name\n @constellation = nil\n @type = nil\n @age = 0\n end",
"def initialize\n\t\t@wallets = Set[ \"0\" ]\n\t\t@uuid = UUID.new\n\n\t\tsuper\n\tend",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize\n @@spots = {}\n @@fines = {}\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize\n @components = Set.new\n @rpz = {}\n @size = {}\n end",
"def initialize(market_info_hash)\n @market_id = market_info_hash[:market_id]\n @name = market_info_hash[:name]\n @address = market_info_hash[:address]\n @city = market_info_hash[:city]\n @county = market_info_hash[:county]\n @state = market_info_hash[:state]\n @zip = market_info_hash[:zip]\n end",
"def initialize(planet_attributes)\n @name = planet_attributes[:name]\n @age = planet_attributes[:age]\n @size = planet_attributes[:size]\n @visitor_count = planet_attributes[:visitor_count]\n @inhabitants = planet_attributes[:inhabitants]\n end",
"def initialize(setlist_item_hash)\n @encore = !setlist_item_hash[\"encore\"].zero?\n @name = setlist_item_hash[\"name\"]\n end",
"def initialize\n en_be_gp_i\n @bestiary_known_data = {}\n @bestiary_known_data[:ene] = {}\n @bestiary_known_data[:dro] = {}\n @bestiary_known_data[:ele] = {}\n @bestiary_known_data[:sta] = {}\n @bestiary_known_data[:ski] = {}\n end",
"def init; @entries = [] end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end"
] |
[
"0.7054539",
"0.61360115",
"0.60881835",
"0.6036678",
"0.60051775",
"0.59888273",
"0.5929172",
"0.581281",
"0.5809486",
"0.5798407",
"0.5798407",
"0.57707095",
"0.57640386",
"0.57557666",
"0.5723301",
"0.5717671",
"0.5712388",
"0.57121176",
"0.5699053",
"0.5680995",
"0.56485385",
"0.564785",
"0.5644754",
"0.5631316",
"0.5627413",
"0.56227183",
"0.56097585",
"0.5605142",
"0.5591599",
"0.55827755",
"0.5575804",
"0.5575804",
"0.5575804",
"0.5575804",
"0.5575804",
"0.5575804",
"0.5575804",
"0.5575804",
"0.55723894",
"0.5572086",
"0.55718184",
"0.55678225",
"0.5565848",
"0.55465364",
"0.55447537",
"0.5541052",
"0.5524727",
"0.5524727",
"0.5515026",
"0.5515026",
"0.5515026",
"0.5515026",
"0.55129766",
"0.55129766",
"0.55129766",
"0.5511685",
"0.5511153",
"0.5511153",
"0.5511153",
"0.5511153",
"0.5511153",
"0.5511153",
"0.5511153",
"0.5511153",
"0.5511153",
"0.5511153",
"0.5511153",
"0.5511153",
"0.5511153",
"0.5511153",
"0.5511153",
"0.5511153",
"0.5511153",
"0.5511153",
"0.5511153",
"0.5511153",
"0.5511153",
"0.5511153",
"0.5511153",
"0.5511153",
"0.5511153",
"0.5511153",
"0.5511153",
"0.5511153",
"0.5511153",
"0.5511153",
"0.5511153",
"0.5511153",
"0.5511153",
"0.5511153",
"0.5511153",
"0.5511153",
"0.5511153",
"0.5511153",
"0.5511153",
"0.5511153",
"0.5511153",
"0.5511153",
"0.5511153",
"0.5511153"
] |
0.7631313
|
0
|
method to add new planets to the hash, adding name as key
|
def new_planet(planet)
@planets[planet.name] = planet
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def add new_planet\n @planets << new_planet\n end",
"def initialize\n @planets = {}\n end",
"def add_planet(new_planet)\n @planets << new_planet\n end",
"def add_planet(new_planet)\n @planets << new_planet\n end",
"def add_planet(new_planet)\n @planets << new_planet\n end",
"def add_planet(new_planet)\n @planets << new_planet\n end",
"def add_planet(planet)\n @planets << planet\n end",
"def add_planets\n get_list_of_planets.each {|planet| Planet.new(planet)} \n end",
"def add_new_planet(new_planet)\n @planets.push(new_planet)\n end",
"def add_planet(planet)\n # planets = @planets.map { |i| i.name.downcase }\n if @planets.include?(planet.name.downcase)\n raise ArgumentError.new(\"Planet already exists. A solar system cannot have duplicate planets\")\n end\n @planets.push(planet)\n end",
"def create\n\n new_hash = params.require(:planet).permit(:name, :image_url, :diameter, :mass, :life)\n new_planet = Planet.create(new_hash)\n redirect_to \"/planets/#{new_planet.id}\"\n end",
"def add_planet(planet)\n @planets << planet\n end",
"def add_planet(planet)\n @planets << planet\n end",
"def add_planet(planet)\n @planets << planet\n end",
"def add_planet(planet)\n @planets << planet\n end",
"def add_planet(planet)\n @planets << planet\n end",
"def add_planet(planet_to_add)\n @planets << planet_to_add\n end",
"def add_planets(planets)\n planets.each do |planet|\n @planets.push(planet)\n end\n end",
"def add_planet(planet)\n\t\t@planets << planet\n\tend",
"def add_planet_by_name(name)\n planet = get_space_body_by_name(name)[0]\n Planet.new(planet)\n end",
"def add_planet(planet)\n @planets.push(planet)\n end",
"def add_planet(planet)\n @planets.push(planet)\n end",
"def add_planet(planet)\n @planets.push(planet)\n end",
"def add_planet(planet)\n @planets.push(planet)\n end",
"def add_planet(new_planet)\n return @planets << new_planet\n end",
"def add_planet_object(new_planet_object)\n @planets_collection.push(new_planet_object)\n end",
"def add_pet_to_stock(pet_shop_hash, new_pet)\n pet_shop_hash[:pets] << new_pet\nend",
"def add_planet(planet)\n @planet << planet\n end",
"def add_new_season_and_holiday_with_supplies(holiday_hash, season, holiday_name, supply_array)\n holiday_hash[season] = {holiday_name => supply_array} # the new echelon being created is to the left of the equals sign.\n holiday_hash\nend",
"def add_planets(planet)\n @planets << planet\n return @planets\n end",
"def add_pet_to_stock(shop_name, new_pet)\n shop_name[:pets] << new_pet\nend",
"def add_planet(new_planet)\n @planets.push(new_planet)\n return @planets\n end",
"def add_planet(new_planet)\n new = 0\n @array_of_planets.each do |each_planet|\n if each_planet.name == new_planet.name\n new += 1\n end\n end\n if new == 0\n @array_of_planets << new_planet\n else\n puts \"That planet is already in the solar system!\"\n end\n end",
"def planet_add(planet)\n @planets.push(planet)\n return @planets\n end",
"def planet_add(planet)\n @planets.push(planet)\n return @planets\n end",
"def add_planet(planet_obj)#parameter\n @planets_list.push(planet_obj)#push method with argument of \"planet_object\"\n puts \"You just added the planet #{planet_obj.name} to the #{\"Juice Box Solar System\"}.\" #what is planet_obj here? hwhere is it pointing?\n end",
"def add_pet_to_stock(shop_hash, new_pet_hash)\n shop_hash[:pets].push(new_pet_hash)\nend",
"def add_planet\n planet = Planet.new(get_planet_name, get_planet_distance, get_planet_rotation, get_planet_moons)\n return planet\nend",
"def build_system(name, planet)\n @planets[name] = planet\n end",
"def add_to_hash(storage_hash, name, new_name)\r\n storage_hash[name] = new_name\r\nend",
"def add_pet_to_stock(pet_shop_hash, new_pet_hash)\n\tpet_shop_hash[:pets].push(new_pet_hash)\nend",
"def create_planet\n new_planet ={}\n\n print \"\\nWhat is the name of the planet? \"\n new_planet[:name] = gets.chomp.downcase\n\n print \"How old is #{new_planet[:name].each_first_letters} in Earth years? \"\n new_planet[:age] = gets.chomp.to_i\n\n print \"What is the size of #{new_planet[:name].each_first_letters}? \"\n new_planet[:size] = gets.chomp\n\n print \"How many visitors does #{new_planet[:name].each_first_letters} get? \"\n new_planet[:visitor_count] = gets.chomp\n\n print \"Who or what are #{new_planet[:name].each_first_letters} inhabitants? \"\n new_planet[:inhabitants] = gets.chomp\n\n new_planet = Planet.new(new_planet)\n\n return new_planet\nend",
"def initialize(planets_hash)\n @name = planets_hash[:name]\n @orbits = planets_hash[:orbits]\n @moons = planets_hash[:number_of_moons]\n @region = planets_hash[:region] # central, border, rim\n @diameter = planets_hash[:diameter_km] # diameter in kilometers\n @terraformed = planets_hash[:terraformed]\n end",
"def buy_fish(name)\n pets[:fishes] << Fish.new(name)\nend",
"def add_new_holiday_with_supplies(holiday_hash, season, holiday_name, supply_array)\n holiday_hash[season][holiday_name] = supply_array\n holiday_hash\nend",
"def add_new_holiday_with_supplies(holiday_hash, season, holiday_name, supply_array)\n holiday_hash[season][holiday_name] = supply_array\n holiday_hash\nend",
"def add_a_key_value_pair\n new_hash = create_olympics_hash\n new_hash[:Atlanta] = \"1996\"\n new_hash\nend",
"def add_pet_to_stock(shop, new_pet)\n shop[:pets] << new_pet\nend",
"def add_pet_to_stock(shop, pet)\n shop[:pets] << pet\nend",
"def add_pet_to_stock(shop, new_pet)\n shop[:pets] << new_pet\nend",
"def add_pet(pet)\n @pets[pet.name.to_sym] = pet\n end",
"def add_initial_planets(solar_system)\n earth = Planet.new('Earth', 'blue-green', 5.972e24, 1.496e16, 'Only planet known to support life')\n cyborg = Planet.new('Cyborg', 'neon green', 10.993e24, 2.496e90, 'Humans have not yet discovered this planet' )\n mars = Planet.new('Mars', 'red', 9.972e24, 2.496e16, 'This planet was named after the Roman god of war')\n solar_system.add_planet(earth)\n solar_system.add_planet(cyborg)\n solar_system.add_planet(mars)\nend",
"def add_pet_to_customer(customer, new_pet_hash)\n customer[:pets] << (new_pet_hash)\nend",
"def add_list_of_planets(list_of_planets)\n list_of_planets.each do |planet|\n @planets.push(planet)\n end\n end",
"def add_pet_to_stock(shop,new_animal)\n shop[:pets] << new_animal\nend",
"def add_item(hash,item)\n hash[:inventory].push(item)\nend",
"def add_pet_to_stock(pet_shop, new_pet)\n pet_shop[:pets] << new_pet\nend",
"def add_planet_object(new_planet_object)\n @solar_system.push(new_planet_object)\n end",
"def add_planet\n\t\tputs \"Would you like to add a planet? Enter Y/N\".colorize(:blue)\n\t\tanswer = gets.chomp.downcase\n\t\tif answer == \"y\"\n\t\t\tputs \"Great! Please enter the name of planet.\"\n\t\t\tname = gets.chomp\n\t\t\tputs \"Now enter the diameter of your planet.\"\n\t\t\tdiameter = gets.chomp\n\t\t\tputs \"What is the mass of your new planet?\"\n\t\t\tmass = gets.chomp\n\t\t\tputs \"How many moons?\"\n\t\t\tmoons = gets.chomp\n\t\t\tputs \"Is there life on your planet? Please enter \\\"Y\\\" or \\\"N\\\".\"\n\t\t\tlife = gets.chomp.downcase\n\t\t\t\tif life == \"y\"\n\t\t\t\t\tlife = true\n\t\t\t\telse \n\t\t\t\t\tlife = false\n\t\t\t\tend\n\t\t\tputs \"Finally, what is the solar rotation of your planet?\"\n\t\t\trotation = gets.chomp\n\t\t\t@new_planet = Planet.new(name: name, diameter: diameter, mass: mass, moons: moons, life: life, rotation: rotation)\n\t\t\t@planets.push(new_planet)\n\t\t\tputs \"Great! #{name} is born!\".colorize(:blue)\n\t\telse\n\t\t\tputs \"Fine. I didn't want your planets anyway.\".colorize(:blue)\n\t\tend\n\tend",
"def show_planets\n @planet_names = planets.keys{:name}\n end",
"def addSport(name, sport)\n @sports[name] = sport\n end",
"def planet_params\n params.require(:planet).permit(:name)\n end",
"def initialize(name)\n @planets = []\n @name = name\n @constellation = nil\n @type = nil\n @age = 0\n end",
"def add(o)\n really_added = false\n oh = o.hash\n unless @hash.key?(oh)\n really_added = true\n @hash[oh] = o\n @plans << o\n end\n really_added \n end",
"def add_item(hash, new_item, qty)\n hash[new_item] = qty\n hash \nend",
"def add_pet_to_customer(customer_hash, new_pet)\n return customer_hash[:pets] << new_pet\nend",
"def add_new_holiday_with_supplies(holiday_hash, season, holiday_name, supply_array)\n holiday_hash.each do |season, hash|\n # it appears we are adding a new holiday_name and supplY_array to each season\n holiday_hash[season][holiday_name] = supply_array\n end\nend",
"def tk_add\n \"add planet #{id} - 10 #{x} #{y} 0\\n\" +\n \"param #{id} 0 #{size}\\n\" +\n \"param #{id} 1 #{-size}\\n\" +\n \"param #{id} 2 #{color}\\n\" +\n \"param #{id} 3 #{name}\"\n end",
"def create\n\n Planet.create(\n name: params[:name],\n image: params[:image],\n orbit: params[:orbit],\n diameter: params[:diameter],\n mass: params[:mass],\n moons: params[:moons]\n )\n\n # Create actions have no template of their own, and we also\n # want to avoid accidental form resubmission; so we redirect\n redirect_to( planets_path ) # /planets\n\n end",
"def add(hash, item, qty)\n hash[item] = qty\n \nend",
"def add(product_name,quantity)\n $products[product_name] = quantity\n $products\nend",
"def planet_params\n params.require(:planet).permit(:name, :life, :moons, :image, :star_id, :galaxy_id, :description, :category)\n end",
"def add(hash, item, qty)\n hash[item] = qty\n\nend",
"def initialize(some_planets, name, solar_age)\n @planets = some_planets\n @name = name\n @solar_age = solar_age\n end",
"def add_planet(solar_system)\n# Ask the user for details about the planet\n print \"Enter the name of the planet: \"\n name = gets.chomp\n name = check_String(name)\n print \"Enter the color of the planet: \"\n color = gets.chomp\n color = check_String(color)\n print \"Enter the mass in kg: \"\n mass_kg = gets.chomp.to_i\n mass_kg = check_number(mass_kg)\n\n print \"Enter the distance from sun in km: \"\n distance_from_sun_km = gets.chomp.to_i\n distance_from_sun_km = check_number(distance_from_sun_km)\n print \"Enter a fun fact: \"\n fun_fact = gets.chomp\n fun_fact = check_String(fun_fact)\n# Create a new instance of Planet with that info\n # binding.pry\n planet_added = Planet.new(name, color, mass_kg, distance_from_sun_km,fun_fact)\n# Add it to the SolarSystem\n solar_system.add_planet(planet_added)\n return solar_system\nend",
"def add(k, v)\n\t\titem = Item.new(k, v)\n\t\t@h.add(item)\n\t\treturn\n\tend",
"def planets; end",
"def buy_fish(name)\n new_fish = Fish.new(name)\n self.pets[:fishes] << new_fish \n end",
"def add_product(name, price)\n @name = name # this is a key\n @price = price # this is that key's value\n \n if @products.keys.include? name\n raise(ArgumentError, \"This product is already included in this order!\")\n else @products[name] = price\n end\n end",
"def create\n @planet = Planet.new(planet_params)\n\n respond_to do |format|\n if @planet.save\n format.html { redirect_to @planet, notice: 'Planet was successfully created.' }\n format.json { render :show, status: :created, location: @planet }\n else\n format.html { render :new }\n format.json { render json: @planet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @planet = Planet.new(planet_params)\n\n respond_to do |format|\n if @planet.save\n format.html { redirect_to @planet, notice: 'Planet was successfully created.' }\n format.json { render :show, status: :created, location: @planet }\n else\n format.html { render :new }\n format.json { render json: @planet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @planet_type = PlanetType.new(planet_type_params)\n\n respond_to do |format|\n if @planet_type.save\n format.html { redirect_to @planet_type, notice: 'Planet type was successfully created.' }\n format.json { render :show, status: :created, location: @planet_type }\n else\n format.html { render :new }\n format.json { render json: @planet_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_item(hash, new_item, item_quantity)\n hash[new_item] = item_quantity\nend",
"def add_pet_to_stock(shop, new_pet)\n shop[:pets].push(new_pet)\nend",
"def add_new_holiday_with_supplies(holiday_supplies, season, holiday_name, supply_array)\n holiday_supplies[season][holiday_name] = supply_array\n holiday_supplies\nend",
"def buy_fish(name)\n#knows about its fishes\n pets[:fishes] << Fish.new(name)\n end",
"def add_pet_to_stock(pet_shop, new_pet)\n pet_shop[:pets].push(new_pet)\nend",
"def add_pet_to_stock(pet_shop, new_pet)\n pet_shop[:pets].push(new_pet)\nend",
"def add_pet_to_stock(pet_shop, new_pet)\n pet_shop[:pets].push(new_pet)\nend",
"def add_pet_to_stock(pet_shop, new_pet)\n pet_shop[:pets].push(new_pet)\nend",
"def add_pet_to_stock(pet_shop, new_pet)\n pet_shop[:pets].push(new_pet)\nend",
"def add_planet (solar_system)\n print\"Enter a planet name: \"\n planet_name = gets.chomp # ask them for the name of the planet they wish to learn about\n planet = solar_system.find_planet_by_name(planet_name)\n if planet.nil?\n # Ask the user for details about the planet (W3.3)\n puts\"What is the planet color? \"\n planet_color = gets.chomp #\n\n puts\"What is the planet mass kg?: \"\n planet_mass = gets.chomp.to_i #\n\n puts\"What is the planet distance from sun? \"\n planet_distance = gets.chomp.to_i #\n\n puts\" What is a fun fact about the planet?\"\n planet_fun_fact = gets.chomp #\n # Create a new instance of Planet with that info, and add to solar_system(W3.3)\n new_planet = Planet.new(planet_name, planet_color, planet_mass, planet_distance, planet_fun_fact)\n solar_system.add_planet(new_planet)\n puts \"Planet added with success!\"\n puts new_planet.summary\n else\n puts \"That planet already exists!\"\n puts planet.summary\n end\nend",
"def add(key, value); end",
"def add(hash); end",
"def adding\n shipping_manifest = {\"whale bone corsets\" => 5, \"porcelain vases\" => 2, \"oil paintings\" => 3}\n shipping_manifest[\"muskets\"] = 2\n shipping_manifest[\"gun powder\"] = 4\n\n shipping_manifest\nend",
"def create(name)\n @name=name\n @vserver_hash=Map.new.set(:properties, :basic, :pool)\n end",
"def initialize(planet_hash)\n @name = planet_hash[:name]\n @moons = planet_hash[:moons]\n @diameter = planet_hash[:diameter]\n @position = planet_hash[:position]\n @type = planet_hash[:type]\n @distance = planet_hash[:distance_from_the_sun]\n @solar_revolution = planet_hash[:solar_revolution]\n end",
"def add(item, quantity, hash)\n hash[item] = quantity\nend",
"def planet_params\n params.require(:planet).permit(:name, :rotation_period, :orbital_period, :diameter, :climate, :gravity, :terrain, :surface_water, :population)\n end",
"def add_pet_to_stock(pet_shop, new_pet)\n num_of_pets = pet_shop[:pets].length\n if num_of_pets < 7\n pet_shop[:pets] << {\n name: \"Seventh One\",\n pet_type: :elephant,\n breed: \"Big eared one\",\n price: 500\n }\n end\nend"
] |
[
"0.700943",
"0.67678547",
"0.67073286",
"0.67073286",
"0.67073286",
"0.67073286",
"0.66107464",
"0.6601579",
"0.6596737",
"0.6593632",
"0.6557101",
"0.651149",
"0.651149",
"0.651149",
"0.651149",
"0.651149",
"0.65045094",
"0.6502309",
"0.64114976",
"0.63861555",
"0.6367412",
"0.6367412",
"0.6367412",
"0.6367412",
"0.6345664",
"0.633867",
"0.632013",
"0.6226961",
"0.6217971",
"0.61991173",
"0.61990976",
"0.61918235",
"0.6167376",
"0.6112329",
"0.6112329",
"0.6064226",
"0.6056523",
"0.60124433",
"0.6006783",
"0.59652317",
"0.59596235",
"0.5936874",
"0.58964",
"0.5885386",
"0.5877343",
"0.5877343",
"0.58528787",
"0.58236176",
"0.5823461",
"0.5823338",
"0.58124256",
"0.5806096",
"0.57899624",
"0.57814056",
"0.57705605",
"0.57664174",
"0.5757612",
"0.57504827",
"0.56974345",
"0.5677008",
"0.5674263",
"0.5673026",
"0.5625724",
"0.5604243",
"0.5603496",
"0.5602534",
"0.55964774",
"0.55314434",
"0.55284494",
"0.55180484",
"0.5507718",
"0.55070925",
"0.5491199",
"0.5485239",
"0.5475877",
"0.544587",
"0.5440971",
"0.5435157",
"0.5416768",
"0.54126996",
"0.54126996",
"0.54045093",
"0.5401652",
"0.53974146",
"0.5387081",
"0.5376315",
"0.53755295",
"0.53755295",
"0.53755295",
"0.53755295",
"0.53755295",
"0.5373666",
"0.536117",
"0.53585815",
"0.5343429",
"0.53353024",
"0.5328589",
"0.53272367",
"0.53261495",
"0.5318117"
] |
0.71357214
|
0
|
method to print out planet names as ordered list
|
def list_planets
counter = 1
@planets.each_key do |planet|
puts counter.to_s + ". " + planet
counter += 1
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def planet_list\n list = \"\"\n @planets.each_with_index do |planet, i|\n list += \" #{i+1}. #{planet.name}\\n\"\n end\n return list\n end",
"def list_planets\n planet_list = ''\n i = 0\n @planets.each do |planet|\n i += 1\n planet_list << \"#{i}. #{planet.name.capitalize}\\n\"\n end\n planet_list\n end",
"def list_of_planets()\n counter = 0\n planet_names = \"\"\n @planets.each do |planet|\n planet_names += \"\\n#{counter+1}. #{planet.planet_details}\"\n counter+=1\n end\n return planet_names\n end",
"def list_planets\n planet_list = \"Planets orbiting #{@star_name}:\"\n @planets.each_with_index do |planet, index|\n planet_list += \"\\n#{index + 1}. #{planet.name}\"\n end\n return planet_list\n end",
"def list_planets()\n\t\tplanets_list = @planets.each_with_index.map {|planet,index|\n\t\t\t\"#{index + 1}. #{planet.name}\"}\n\t\tplanets_list.unshift(\"Planets orbiting #{@star_name}:\\n\").to_s\n\t\t\n\t\treturn planets_list \n\tend",
"def list_planets\n i = 1\n planets_list = \"\"\n @planets.each do |planet|\n planets_list += \"#{i}. #{planet.name}\\n\"\n i += 1\n end\n return \"Planets orbiting #{@star_name}:\\n#{planets_list}\"\n end",
"def list_planets\n list = \"Planets orbiting #{@star_name}:\\n\"\n @planets.each do |planet|\n list += \"* #{planet.name}\\n\"\n end\n list += \"\\n\"\n return list\n end",
"def list_planets\n planet_list = \"Planets orbiting #{ @star_name }\\n\"\n @planets.length.times do |add|\n planet_list += \"#{ add + 1 }. #{ @planets[add].name }\\n\"\n end\n\n return planet_list\n end",
"def list_planets\n planet_string = \"Planets orbiting #{@star_name} \\n\"\n @planets.each_with_index do |planet, index|\n planet_string += \"#{index+1}. #{planet.name} \\n\"\n end\n return planet_string\n end",
"def list_planet_names\n list_planet_names = []\n planets_collection.each do |planet_name|\n list_planet_names << planet_name.name\n end\n return list_planet_names\n end",
"def list\n list = \"\"\n i = 0\n @planets.each do |planet|\n list << \"#{i+1}. #{planet}\\n\"\n i += 1\n end\n return list\n end",
"def names\n planet_names = []\n @planets.each do |planet|\n planet_names << planet.name\n end\n return planet_names\n end",
"def display_planet_list\n puts \"Here are the current planets in our solar system:\"\n @all_planets.each do |planet_info|\n puts planet_info.name\n end\n end",
"def list_planets\n list_planets = \"Planets orbiting #{star_name} \\n\"\n\n @planets.each_with_index do |planet, index|\n list_planets = \"#{list_planets}\" + \"#{index + 1}. #{planet.name}\\n\"\n end\n\n return list_planets\n end",
"def planet_list\n puts \"\\n1: Mercury, 2: Venus, 3: Earth, 4: Secret Earth, 5: Mars, 6: Jupiter, 7: Saturn, 8: Uranus, 9: Neptune, 10: Pluto\".colorize(:yellow)\n puts \"\\n11: Exits our solar system (so you can start making your own solar systems and planets!)\".colorize(:yellow)\n puts \"\\n(At this time, you are unable to return to our solar system's information after exiting.)\".colorize(:yellow)\nend",
"def list_planets\n str = \"Planets orbiting #{@star_name}:\\n\"\n count = 0\n @planets.each do |planet|\n count += 1\n str += \"#{count.to_s}. #{planet.name}\\n\"\n end\n return str\n end",
"def return_planet_names\n planet_names = \"\"\n @solar_system.each do |planet_name|\n planet_names += planet_name.planets_name\n end\n return planet_names\n end",
"def print_list(solar_system)\n solar_system.planet_list.each_index do |i|\n print \"#{i + 1}. #{solar_system.planet_list[i]} \"\n end\nend",
"def print_planets\n puts \"\\n#{@name} has #{@planets.length} planets and was formed #{@formation_year} years ago.\"\n puts \"\\nHere are the planets in the #{@name} solar system:\\n\\n\"\n @planets.each do |planet|\n puts \"#{planet.print_planet_data}\"\n end\n puts \"\\n\"\n end",
"def show_library\n @name_pool = []\n @planet_names = \"\"\n @planets.length.times do |i|\n @planet_names += \"#{i + 1}. #{@planets[i].name}\\n\"\n @name_pool << @planets[i].name\n end\n return @planet_names\n end",
"def all_planet_info\n list_string = \"\"\n @planets.each_with_index do |planet, i|\n list_string << \"#{i+1}.\\n#{planet.planet_info}\\n\"\n end\n return list_string\n end",
"def planets_list\n @list = String.new\n @planets.each_with_index do |planet, i|\n @list += \"#{i+1}. #{planet.name}\\n\"\n end\n return @list\n end",
"def return_planets\n planet_list = \"\"\n @planets.each do |planet|\n planet_list << \"#{@planets.index(planet) + 1}. #{planet.name} \\n\"\n end\n return planet_list\n end",
"def list_planets(format)\n planet_list = \"\"\n\n if format == :num\n @planets.each do |planet|\n num = @planets.index(planet)\n planet_list.concat(\"#{num + 1}. #{planet.name}\\n\")\n end\n elsif format == :comma\n @planets.each do |planet|\n planet_list.concat(planet.name + \", \")\n end\n return planet_list.strip.chop\n end\n return planet_list\n end",
"def list_planets\n x = \"Planets orbitting #{@star_name}\\n\"\n z = \"\"\n z = z + x\n l = 1\n while l <= @planets.length\n y = \"#{l}. #{@planets[l-1].name}\\n\"\n z += y\n l += 1\n end\n return z\n end",
"def list_planets\n puts \"Planets orbiting #{star_name}:\"\n\n @planets.each_with_index do |planet, i|\n @list_of_planets << \"#{i+1}. #{planet.name}\"\n end\n return @list_of_planets\n end",
"def list_planets\n list = \"\"\n @planets.each do |planet|\n list += \"#{@planets.index(planet) + 1}. #{planet}\\n\"\n end\n return list\n end",
"def planet_list\n planet_array = []\n @planets.each_with_index do |planet, index|\n # **--->how to do without storing list in an array as a variable??\n # **--->prints whole array of hashes if not\n current_planet = \"#{index + 1}. #{planet.name}\"\n planet_array << current_planet\n end\n return planet_array\n end",
"def list_all_planets\n puts \"The #{ @system } system has these #{ @all_planets.length } planets:\"\n @all_planets.each do |planet|\n puts \"#{@all_planets.index(planet)+1}. #{planet.name}\"\n end\n end",
"def list_planet_names_in_solar(solar_obj)\n solar_obj.list_of_planets.each do |element|\n puts element.name\n end\nend",
"def show_planets\n @planet_names = planets.keys{:name}\n end",
"def prints_solarsystem_props\n puts \"I am the #{@name} solar system.\"\n puts \"I have #{@planet.length} planet(s), they are:\"\n @planet.each do |p|\n puts p.name\n end\n end",
"def get_planet_names_sorted_by_increasing_distance_from_sun()\n sorted_planets_by_distance = @planets.sort_by { |planet| planet.distance_from_sun }\n return sorted_planets_by_distance.map { |planet| planet.name}\n end",
"def list_planets\n counter = 0\n list = \"\"\n @planets.each do |planet|\n counter += 1\n list += \"#{counter}. #{planet.name.each_first_letters}\\n\"\n end\n\n list += \"#{counter + 1}. **CREATE NEW PLANET**\"\n return list\n end",
"def display_planet_details\n puts \"Name: #{@name}, Primary Export: #{@primary_export}, Year-Length: #{@year_length}\"\n end",
"def list_of_planets\n list = []\n @planets.length.times do |index|\n list << \"#{index+1}. #{@planets[index].name}\"\n end\n return list\n end",
"def plant_list\n self.plant_types.order('name').map {|m| m.name}.to_sentence\n end",
"def each_planet_return\n return \"#{@name} is a planet in the solar system that is #{@distance_from_sun} million miles from the sun and has a year length of #{@planet_year} days.\\n\"\n end",
"def print_planet_info\n puts \"☛ Planet #{@name} takes #{@year_length} earth days to go around its star.✰\".bold\n puts \"\"\n puts \"◆ It is #{@distance_from_the_sun} kilometers away from the sun ☀️ and has a mass of #{@mass} kilogram.\".bold\n puts \"\"\n puts \"◆ It's diameter is #{@diameter} kilometer and it has these atmospheric components: #{@atmospheric_components}.\".bold\n puts \"\"\n end",
"def print_info\n puts \"#{ @name } is the #{ @position } planet from the sun.\\nIt is a #{ @type } planet that is #{ @diameter } miles wide.\\n#{ @name } has #{ @moons } moons.\"\n end",
"def summon_captain_planet(elements)\n p elements.map {|summon_elements| \"#{summon_elements}!\".capitalize}\nend",
"def show_menu\n planet_list = \"\"\n i = 1\n @solar_system.length.times do |n|\n planet_list << \"\\n#{i}. #{@solar_system[n].name}\"\n i += 1\n end\n return \"\\nPlanet List#{planet_list}\\nOther: Exit\\n\\n\"\n end",
"def print_planet_data\n\n if validate_planet\n\n # print the moon info\n print \"#{@name} has #{@moons.length} moon(s) and has\"\n\n # rings information\n if @rings\n puts \" rings!\"\n else\n puts \" no rings.\"\n end\n\n # other data here\n puts \"#{@name} is #{@surface_temp} and is as wide as #{@diameter_in_earths} Earth(s)!\"\n puts \"#{@name}'s rate of solar rotation is #{@rate_of_solar_rotation} Earth days.\"\n puts \"It's #{@distance_from_the_sun_in_miles} miles from the sun!\"\n\n end\n end",
"def planet_info #(there's no parameter here)\n puts \"#{@name} has #{@orbital} days in one of its years, weighs #{@mass} earth, has #{@moons}, and is #{@distance_from_sun} million miles from the sun.\"\n end",
"def summon_captain_planet(planteers)\n updated = []\n planteers.each do |planteer|\n planteer = planteer.capitalize() \n updated << \"#{planteer}!\"\n end\n updated\nend",
"def planet_list\n return @planets\n end",
"def summon_captain_planet(planeteer_calls)\n planeteer_calls.collect{|item| \"#{item.capitalize}!\" }\nend",
"def list_current_poems\n self.current_poems_alphabetized.each.with_index(1) do |poem, index|\n puts \"#{index}. #{poem.name} - #{poem.poet.name}\"\n end\n puts \"\"\n end",
"def print_songs\n song_names = []\n self.songs.collect {|song| song_names << song.name}\n puts song_names\n end",
"def get_planet_names_sorted_by_size_decreasing()\n planets_sorted_by_size = @planets.sort_by { |planet| planet.diameter }\n planets_sorted_by_size_decreasing = planets_sorted_by_size.reverse\n planets_sorted_by_size_decreasing.map { |planet| planet.name }\n\nend",
"def solarsystem_list_return\n list = []\n @array_of_planets.each do |bodies|\n list << \"#{@array_of_planets.index(bodies) + 1}. #{bodies.name}\"\n end\n return list\n end",
"def planet_information(some_planet)\n @planets.each do |planet|\n if some_planet.downcase == planet.name.downcase\n return planet.organized_planet_details\n end\n end\n end",
"def all_info(the_planet_i_care_about)\n return @planets.each do |each_planet_in_my_solar_system|\n if each_planet_in_my_solar_system.name == the_planet_i_care_about\n puts each_planet_in_my_solar_system.info\n end\n end\n end",
"def showlist\n\t\t@people_list.each do |x|\n\t\t\tputs \"* #{capitalize(x.type)}, #{capitalize(x.name)}, #{capitalize(x.party)}\"\n\t\tend\n\tend",
"def organized_planet_details\n detailed_summary = \"Here are your facts about #{name}:\"\n detailed_summary << \"\\nNumber of Moons: #{@moons}\\nYear Length: #{@year_length}\"\n detailed_summary << \"\\nDistance from its Star: #{@distance_from_sun} million miles\"\n detailed_summary << \"\\nMass: #{@mass} kg.\\nDiameter: #{@diameter} miles.\"\n detailed_summary << \"\\nDiety Namesake: #{@diety}\"\n detailed_summary << \"\\nWe hope you learned something new about #{@name}.\"\n return detailed_summary\n end",
"def summon_captain_planet(planeteer_calls)\n planeteer_calls.collect {|i| i + \"!\"}.map(&:capitalize)\nend",
"def get_planet_info\n \"#{@name} has a mass of #{@mass} kilograms, a mean diameter of \" +\n \"#{@diameter} kilometers, and #{@moons} moon(s). It is #{@sun_distance}\" +\n \" million kilometers from the sun and one planetary year on #{@name} is\" +\n \" equal to #{@planetary_year} Earth days. If you were to stand on the \" +\n \" surface of #{@name}, you would experience a gravitational force of \" +\n \"#{@gravity} meters per second squared and a mean temperature of \" +\n \"#{@temp} degrees Kelvin. That's approximately \" +\n \"#{kelvin_to_fahrenheit(@temp).to_i} degrees Fahrenheit! \"\n end",
"def planet_name(planet_seed)\n s = planet_seed.clone\n pairs = 4.times.collect do\n pair = letter_pair(s)\n s = next_fib_triple(s)\n pair\n end \n pairs = pairs.take(3) unless long_name?(planet_seed)\n return pairs.join.capitalize, s \n end",
"def planet_details(solarsystem)\n puts \"which planet would you like to know more about?\"\n planet = gets.chomp.downcase\n solarsystem.planets.each do |planetlist|\n if planetlist.name.downcase == planet\n puts planetlist.summary\n else puts \"this planet is not in this solar system! try a different planet!\"\n end\n end\nend",
"def print_list\n\t puts \"\"\n\t puts \"\"\n\t\tputs \"#{@list_name}\"\n\t\tprint \"-\" * 40\n\t\t@grocery_list.each {|k, v| puts \"#{k} #{v}\"}\n\t\tputs \"\"\n\t\tget_item\n\tend",
"def print_songs\n puts @songs.collect {|song| song.name}\n end",
"def do_names\n animal_list = get_names()\n print_names(animal_list)\n end",
"def planet_details ()\n return planet_detail = \"\\n#{@name} Planet Information : \\nRadius (mi): #{@radius_mi}\\nDistance from Sun (mi): #{@distance_frm_sun}\\nNumber of moons: #{@num_moons}\\nNumber of suns: #{@num_moons}\\nNumber of days in year: #{@year_in_days}\\n\"\n end",
"def summon_captain_planet( array )\n new_array = []\n array.map do |elements|\n new_elements = elements.split.map(&:capitalize).join(' ')\n new_elements = \"#{new_elements}!\"\n new_array << new_elements\n end\n new_array\nend",
"def print_info\n puts \" Planet Summary\"\n puts \"=============================================================\"\n puts \"Planet Name: #{@name.capitalize}\"\n puts \"Mass: #{@mass} e+24 kg\"\n puts \"Diameter: #{@diameter} km\"\n puts \"Number of Moons: #{@number_of_moons}\"\n puts \"Average Distance From The Sun: #{@distance_from_the_sun} e+6 km\"\n puts \"Rate of Solar Rotation: #{@rate_of_solar_rotation} hours\"\n puts \"Orbital Period: #{@orbital_period} Earth days\\n\\n\"\n end",
"def portfolios_listing\n portfolios.each_index do |index|\n puts \"Portfolio (#{index}) : #{portfolios.to_s}\"\n end\n end",
"def summon_captain_planet(planeteer_calls)\n planeteer_calls.map { |element| element.capitalize! + \"!\"}\nend",
"def summon_captain_planet(array)\n array.collect do |calls|\n \"#{calls.capitalize}!\"\n end\nend",
"def print_all_players(print_title, players)\r\n puts\r\n puts(print_title)\r\n players.each do |player|\r\n puts(\"\\t >> #{player}\")\r\n end\r\n puts\r\nend",
"def cycle_through_system\n @planets.each do|planet|\n @ranked_planets.push(planet[:name])\n end\n # Ranked numbered list of planets\n return @ranked_planets\n end",
"def print_backpack_list\n output = []\n output << \"Melinda, here's your packing list!\"\n output << \"Day: #{@attributes[:day_of_week]}, Weather: #{@attributes[:weather]}\"\n output << \"\"\n\n @items.each do |item|\n output << \"- #{item}\"\n end\n output.join(\"\\n\")\n end",
"def \n \n summon_captain_planet(planeteer_calls)\n \n planeteer_calls.map { |element| element.capitalize + \"!\" }\n \nend",
"def print_songs\n @songs.each {|x| puts \"#{x.name}\\n\"}\n end",
"def get_planet_name(id)\n %w[0 Mercury Venus Earth Mars Jupiter Saturn Uranus Neptune][id]\nend",
"def list_all_titles\n Anime.all.sort{|a,b| a.name <=> b.name}.each_with_index do |anime,i|\n puts \"#{i+1}. #{anime.name}\"\n end\n self.more_info\n end",
"def to_s\n\t\t@platos.each do |alimento|\n\t\t\tputs alimento.nombre\n\t\tend\n\tend",
"def park_list\n NSWParks::Nsw_parks.all.each.with_index(1) {|a,i| puts \"#{i}. #{a.park_name}\"} # Start array index from 1 not 0\n end",
"def summon_captain_planet(captain_planet)\n captain_planet.collect{ |food, index| \"#{index}#{food.capitalize}!\"}\n # Your code here\nend",
"def summon_captain_planet(planeteer_calls) \n planeteer_calls.map do |n| \n n.capitalize << \"!\" \n end\nend",
"def print_locations(array)\n puts \"id\".ljust(5)+\"name\".ljust(15)\n puts \"-\" * 80\n array.each do |object|\n puts object.id.to_s.ljust(5) + object.name.ljust(15) \n end\n end",
"def summon_captain_planet(planeteer_calls)\n planeteer_calls.map do |call|\n call.capitalize + \"!\"\n end\nend",
"def display_pets\n\t\tpets.join(\"\\n\")\n\tend",
"def summon_captain_planet(planeteer_calls)\n planeteer_calls.map do |calls|\n \"#{calls.capitalize}!\"\n # binding.pry\n end\nend",
"def attributes_of_planet(planet_of_choice)\n planet_attributes = \"\"\n @planets.each do |planet_info|\n if planet_info.name == planet_of_choice\n planet_attributes += \"#{planet_info.name}'s attributes:\"\n planet_attributes += \"\\nIt has a diameter of #{planet_info.diameter}.\"\n planet_attributes += \"\\nIts gravity is #{planet_info.gravity}.\"\n planet_attributes += \"\\nIt takes #{planet_info.year_length} to spin on Axis.\"\n planet_attributes += \"\\nIts distance from the sun is #{planet_info.distance_from_the_sun}.\\n\"\n end\n end\n return planet_attributes\n end",
"def print_names\n @file.each do |line|\n puts \"#{line[:first_name]} #{line[:last_name]} \"\n end\n end",
"def print(names)\n names.each do |name|\n puts name\n end \nend",
"def summon_captain_planet(planeteer_calls)\nplaneteer_calls.map { |string| \"#{string.capitalize}!\" }\nend",
"def list_artists\n sorted_list = Artist.all.sort_by {|artist| artist.name}\n sorted_list.each_with_index do |artist, idx|\n puts \"#{(idx + 1).to_s}. #{artist.name}\"\n end\n end",
"def show_planet(number)\n selected = @solar_system[number-1]\n\n # Calculate planet related ages\n age = 4.5e9/(selected.rotation_time/12.0)\n age = age.to_i.to_s\n age = age.reverse.scan(/\\d{3}|.+/).join(\",\").reverse\n\n # Calculate the closest neighboring planets\n # Collect names and distances of planets\n distance_and_name = []\n @solar_system.length.times do |i|\n planet_info = {}\n planet_info[:name] = @solar_system[i].name\n planet_info[:distance] = @solar_system[i].distance_from_the_sun\n distance_and_name << planet_info\n end\n # Get only the distances and sort them\n planet_distances = []\n @solar_system.each do |planet|\n planet_distances << planet.distance_from_the_sun\n end\n ordered_planets = planet_distances.sort\n number_index = ordered_planets.index(selected.distance_from_the_sun).to_i\n\n # Find the select planet's distance neighbors (2)\n if (number_index+1) == @solar_system.length\n neighbor1_distance = 0\n neighbor1_difference = 0\n else\n neighbor1_distance = ordered_planets[(number_index+1)]\n neighbor1_difference = (selected.distance_from_the_sun - neighbor1_distance).abs.round(2)\n end\n if (number_index-1) < 0\n neighbor2_distance = 0\n neighbor2_difference = 0\n else\n neighbor2_distance = ordered_planets[(number_index-1)]\n neighbor2_difference = (selected.distance_from_the_sun - neighbor2_distance).abs.round(2)\n end\n neighbor1_name = \"\"\n neighbor2_name = \"\"\n distance_and_name.each do |planet|\n if neighbor1_distance == planet[:distance]\n neighbor1_name << planet[:name]\n end\n if neighbor2_distance == planet[:distance]\n neighbor2_name << planet[:name]\n end\n end\n if neighbor1_distance == 0 && neighbor2_distance == 0\n true_neighbor = \"not to be found\"\n true_distance = \"both infinity and negative infinity\"\n elsif neighbor1_distance == 0 && neighbor2_distance > 0\n true_neighbor = neighbor2_name\n true_distance = neighbor2_difference\n elsif neighbor2_distance == 0 && neighbor1_distance > 0\n true_neighbor = neighbor1_name\n true_distance = neighbor1_difference\n else\n true_neighbor = \"#{neighbor2_name} and #{neighbor1_name}\"\n true_distance = \"#{neighbor2_difference} and #{neighbor1_difference}\"\n end\n\n # Text summary shown to user\n text = \"\\nThe planet \\[#{selected.name}\\] is #{selected.distance_from_the_sun} Astronomical Units from the sun.\n \\rThe closest neighboring planet(s) is/are #{true_neighbor}, which is/are #{true_distance} AU away.\n \\rIt orbits the sun once every #{selected.rotation_time} Earth months, or #{(selected.rotation_time/12.0).round(2)} Earth years.\n \\rSince our sun is 4.5 billion Earth years old, this planet's age is #{age}!\n \\r#{selected.name} also enjoys #{selected.moon_count} moon(s) orbitin' around it.\\n\"\n return text\n end",
"def print_songs\n songs.each {|song| puts song.name}\n end",
"def list_pokemon\n puts \"\"\n puts \"See below for the list of the original Pokemon!\"\n puts \"\"\n @pokemon_objects.each.with_index(1) do |a, i|\n puts \"#{i}. #{a.name}\"\n end\n puts \"\"\n end",
"def print_songs\n songs.each do |song|\n puts \"#{song.name}\"\n end\n end",
"def list_songs\n self.sorted_list_songs.each_with_index do |song, idx|\n puts \"#{(idx + 1).to_s}. #{song.artist.name} - #{song.name} - #{song.genre.name}\"\n end\n end",
"def printable\r\n list = @@words.to_a.sort.map {|word,definition| \"[#{word}] \\\"#{definition}\\\"\"}\r\n list.join(\"\\n\")\r\nend",
"def display_names names\n names.each do |name|\n name = expand_name name\n\n display_name name\n end\n end",
"def print_songs\n songs.each { |song| puts \"#{song.name}\" }\n end",
"def print\n unless success?\n return nil\n end\n nlen = \"Name\".length\n clen = \"Craft\".length\n @data['people'].each do |p|\n nlen = p['name'].length > nlen ? p['name'].length : nlen\n clen = p['craft'].length > clen ? p['craft'].length : clen\n end\n\n print_header(nlen, clen)\n @data['people'].each do |p|\n print_line(nlen, p['name'], clen, p['craft'])\n end\n end",
"def return_solar_system_info\n solar_system_output = \"\"\n @planets_collection.each do |planet_object| # planet_object represents a new planet instance\n #add to planet_output string\n solar_system_output += planet_object.planet_output\n end\n return solar_system_output\n end",
"def summon_captain_planet(calls)\n calls.map do |call|\n call.capitalize + \"!\"\n end\nend",
"def planets\n # go through my colonies\n self.colonies.map do |my_colony|\n # get the information about each planet the colony is on\n my_colony.planet\n end\n end",
"def print_list; end"
] |
[
"0.8038312",
"0.7909215",
"0.7888411",
"0.7775698",
"0.77554214",
"0.77265286",
"0.770354",
"0.7662915",
"0.7594998",
"0.75379795",
"0.750365",
"0.7492974",
"0.74704254",
"0.74613446",
"0.74046934",
"0.74029946",
"0.74027395",
"0.737152",
"0.7370719",
"0.73535645",
"0.7334707",
"0.7331757",
"0.7248858",
"0.72437286",
"0.7241785",
"0.71841234",
"0.7176816",
"0.7134872",
"0.71061975",
"0.7059626",
"0.68927944",
"0.68760455",
"0.68390095",
"0.67856133",
"0.673756",
"0.67072886",
"0.6670479",
"0.6650723",
"0.65877956",
"0.6533898",
"0.6452209",
"0.6424675",
"0.63991684",
"0.6352941",
"0.63170654",
"0.62917286",
"0.62806785",
"0.625852",
"0.62403077",
"0.6210453",
"0.6160848",
"0.6148526",
"0.60943913",
"0.6081067",
"0.60741144",
"0.6052742",
"0.6039027",
"0.60240006",
"0.60204685",
"0.6000426",
"0.59863925",
"0.59834254",
"0.5973502",
"0.59715796",
"0.5949582",
"0.59480566",
"0.59462273",
"0.59443516",
"0.59367836",
"0.59302473",
"0.5925884",
"0.5886705",
"0.58817387",
"0.58742684",
"0.5874131",
"0.5871074",
"0.58629364",
"0.58498883",
"0.5846072",
"0.58382845",
"0.58244395",
"0.5819093",
"0.5813976",
"0.58126944",
"0.58115655",
"0.5802761",
"0.58025336",
"0.5799449",
"0.57974994",
"0.57965845",
"0.5790865",
"0.5786199",
"0.5785465",
"0.5782851",
"0.5779982",
"0.57686067",
"0.5751903",
"0.5748514",
"0.57475805",
"0.57434624",
"0.57401997"
] |
0.0
|
-1
|
creates hash of planets with variables as keys
|
def initialize(planets_hash)
@name = planets_hash[:name]
@orbits = planets_hash[:orbits]
@moons = planets_hash[:number_of_moons]
@region = planets_hash[:region] # central, border, rim
@diameter = planets_hash[:diameter_km] # diameter in kilometers
@terraformed = planets_hash[:terraformed]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def initialize\n @planets = {}\n end",
"def create_planet\n new_planet ={}\n\n print \"\\nWhat is the name of the planet? \"\n new_planet[:name] = gets.chomp.downcase\n\n print \"How old is #{new_planet[:name].each_first_letters} in Earth years? \"\n new_planet[:age] = gets.chomp.to_i\n\n print \"What is the size of #{new_planet[:name].each_first_letters}? \"\n new_planet[:size] = gets.chomp\n\n print \"How many visitors does #{new_planet[:name].each_first_letters} get? \"\n new_planet[:visitor_count] = gets.chomp\n\n print \"Who or what are #{new_planet[:name].each_first_letters} inhabitants? \"\n new_planet[:inhabitants] = gets.chomp\n\n new_planet = Planet.new(new_planet)\n\n return new_planet\nend",
"def hash\n vari = 0\n\n args = arg_list.clone\n\n args.each do |var1|\n next if var1.const?\n\n vari += 1\n new_var = Variable.new(vari.to_s)\n\n args.each.with_index do |var2, idx|\n args[idx] = new_var if !var2.const? && var2.name == var1.name\n end\n end\n\n ([name] + args).map { |v| v.hash }.hash\n end",
"def show_planets\n @planet_names = planets.keys{:name}\n end",
"def new_planet(planet)\n @planets[planet.name] = planet\n end",
"def planets()\n pseed = @seed.clone\n Enumerator.new do |yielder|\n loop do\n name, new_seed = planet_name(pseed)\n yielder.yield name\n break if new_seed==@seed\n pseed = new_seed\n end\n end\n end",
"def initialize(planet_hash)\n @name = planet_hash[:name]\n @moons = planet_hash[:moons]\n @diameter = planet_hash[:diameter]\n @position = planet_hash[:position]\n @type = planet_hash[:type]\n @distance = planet_hash[:distance_from_the_sun]\n @solar_revolution = planet_hash[:solar_revolution]\n end",
"def hash\n [auto_points, teleop_points, foul_points, adjust_points, total_points, robot1_auto, robot2_auto, robot3_auto, rotor1_auto, rotor2_auto, auto_fuel_low, auto_fuel_high, auto_mobility_points, auto_rotor_points, auto_fuel_points, teleop_fuel_points, teleop_fuel_low, teleop_fuel_high, teleop_rotor_points, k_pa_ranking_point_achieved, teleop_takeoff_points, k_pa_bonus_points, rotor_bonus_points, rotor1_engaged, rotor2_engaged, rotor3_engaged, rotor4_engaged, rotor_ranking_point_achieved, tech_foul_count, foul_count, touchpad_near, touchpad_middle, touchpad_far].hash\n end",
"def planets; end",
"def hash_template\n template = {}\n \n info.each do | key, value |\n template[key] = generate_structure( value )\n end\n \n template\n end",
"def initialize(planet_hash)\n @name = planet_hash[:name]\n @orbital = planet_hash[:orbital]\n @mass = planet_hash[:mass_in_earths]\n @moons = planet_hash[:moons]\n @distance_from_sun = planet_hash[:distance_from_sun]\n end",
"def initialize(planet_hash)\n @name = planet_hash[:name]\n @mass = planet_hash[:mass] #unit: (e+24 kg)\n @diameter = planet_hash[:diameter] #unit: (km)\n @number_of_moons = planet_hash[:number_of_moons]\n @distance_from_the_sun = planet_hash[:distance_from_the_sun] #unit: (e+6 km)\n @rate_of_solar_rotation = planet_hash[:rate_of_solar_rotation] #unit: (length of one day in hours)\n @orbital_period = planet_hash[:orbital_period] #unit : (length of year in earth days)\n end",
"def create_hashes\n cloud Mash.new\n cloud[:public_ip] = Hash.new\n cloud[:private_ip] = Hash.new\nend",
"def local_spares\n #{ chain: '10-speed', tire_size: '20', tape_color: tape_color} \n #super.merge({:tape_color => tape_color})\n {:tape_color => tape_color}\n end",
"def hash\n [year, make, model, trim, short_trim, body_type, body_subtype, vehicle_type, transmission, drivetrain, fuel_type, engine, engine_size, engine_block, doors, cylinders, made_in, steering_type, antibrake_sys, tank_size, overall_height, overall_length, overall_width, std_seating, opt_seating, highway_miles, city_miles, engine_measure, engine_aspiration, trim_r].hash\n end",
"def spares\n { chain: '11-speed',\n tire_size: '23',\n tape_color: tape_color }\n end",
"def spares\n { chain: '11-speed',\n tire_size: '23',\n tape_color: tape_color }\n end",
"def hash\n [bevel_bottom, bevel_top, camera, contour_color, contour_width, depth, extrusion_color, extrusion_height, light_rig, material].hash\n end",
"def initialize(planet_attributes)\n @name = planet_attributes[:name]\n @age = planet_attributes[:age]\n @size = planet_attributes[:size]\n @visitor_count = planet_attributes[:visitor_count]\n @inhabitants = planet_attributes[:inhabitants]\n end",
"def spares\n { chain: '10-speed',\n tire_size: '23',\n tape_color: tape_color}\n end",
"def spares\n {\n chain: '11-speed',\n tire_size: '23',\n tape_color: tape_color\n }\n end",
"def spares\n {chain: '10-speed',\n tire_size: '23',\n tape_color: tape_color}\n end",
"def hash()\n {\n \"attributes\" => attributes,\n \"variables\" => variables,\n \"dimensions\" => dimensions,\n \"metadata\" => metadata,\n \"data\" => variable_hash\n }\n end",
"def spares\n { chain: '10-speed',\n tire_size: '23',\n tape_color: tape_color}\n end",
"def initialize(some_planets, name, solar_age)\n @planets = some_planets\n @name = name\n @solar_age = solar_age\n end",
"def lights_hash(n, lamps)\n hash = Hash.new { |h, k| h[k] = [] }\n \n lamps.each do |lamp|\n\n end\n\n hash\nend",
"def spares\n {\n chain: '10-speed',\n tire_size: '23',\n tape_color: tape_color\n }\n end",
"def animal_hash\n animal_hash = Hash.new\n\n @inventory.each do |animal|\n first_letter = animal.kind[0]\n if animal_hash[first_letter]\n animal_hash[first_letter] << animal\n else\n animal_hash[first_letter] = [animal]\n end\n end\n animal_hash\n end",
"def instance_variables_hash\n instance_variables.inject({}) do |acc, iv|\n acc[iv.to_s[1..-1]] = instance_variable_get(iv)\n acc\n end\n end",
"def create_planet(name, mass, year_length, diameter, number_of_moons, distance_from_sun)\n return Planet.new(name, mass, year_length, diameter, number_of_moons, distance_from_sun)\nend",
"def initialize_hash(num)\n (1..num).each_with_object(lights = {}) do |number, hash|\n hash[number] = false\n end\n lights\nend",
"def key_map\r\n hash = {}\r\n hash['name'] = name\r\n hash['address'] = address\r\n hash['city'] = city\r\n hash['region'] = region\r\n hash['postal_code'] = postal_code\r\n hash['unit_type'] = unit_type\r\n hash['unit_number'] = unit_number\r\n hash['country'] = country\r\n hash\r\n end",
"def spares\n {\n chain: \"10-speed\",\n tire_size: \"23\",\n tape_colour: tape_colour\n }\n end",
"def initialize (planets)\n @planets = planets\n @ranked_planets = []\n end",
"def hash\n instance_variables.map do |var|\n instance_variable_get(var).hash\n end.reduce(:^)\n end",
"def build_hash(ts)\n result = @data.map { |key, dps| { key => dps[ts] } if dps.key?(ts) }\n return if result.include?(nil)\n\n @parameters[ts] = result.reduce do |formula_map, parameter|\n formula_map.merge(parameter)\n end\n end",
"def add_initial_planets(solar_system)\n earth = Planet.new('Earth', 'blue-green', 5.972e24, 1.496e16, 'Only planet known to support life')\n cyborg = Planet.new('Cyborg', 'neon green', 10.993e24, 2.496e90, 'Humans have not yet discovered this planet' )\n mars = Planet.new('Mars', 'red', 9.972e24, 2.496e16, 'This planet was named after the Roman god of war')\n solar_system.add_planet(earth)\n solar_system.add_planet(cyborg)\n solar_system.add_planet(mars)\nend",
"def animal_hash\n hash = Hash.new\n\n @inventory.each do |animal|\n first_letter = animal.kind[0]\n if hash[first_letter]\n hash[first_letter] << animal\n else\n hash[first_letter] = [animal]\n end\n hash\n end\n\nend",
"def gen_planet(class_map)\n class_map[\"colour\"] = PLANET_COLOURS[class_map[\"type\"].downcase]\n text = \"//#{class_map[\"package\"]} class: #{class_map[\"name\"]}\n#{class_map[\"indexed_name\"]}.setValues({\n name: \\\"#{class_map[\"indexed_name\"]}\\\",\n geometry: new THREE.SphereGeometry(#{class_map[\"radius\"]+0.01}, 10, 10),\n material: new THREE.MeshLambertMaterial({emissive: 0x888888, color: #{class_map[\"colour\"]}, map: planet_texture}),\n origin: #{class_map[\"package\"]}, \n orbitradx: #{(Random.rand(2) == 0)? \"\" : \"-\"}#{class_map[\"orbit\"]}, \n orbitrady: #{(Random.rand(2) == 0)? \"\" : \"-\"}#{class_map[\"orbit\"]}, \n #{(Random.rand(2) == 0)? \"ysin: false\" : \"xsin:false\"},\n rotx: 0.01, \n roty: 0.01, \n rotz: 0.01,\n tfactor: #{1 + Random.rand}});\ncelestials[celestials.length] = #{class_map[\"indexed_name\"]};\\n\\n\"\n return text\nend",
"def build_system(name, planet)\n @planets[name] = planet\n end",
"def hash\n [id, title, image, image_type, servings, ready_in_minutes, license, source_name, source_url, spoonacular_source_url, aggregate_likes, health_score, spoonacular_score, price_per_serving, analyzed_instructions, cheap, credits_text, cuisines, dairy_free, diets, gaps, gluten_free, instructions, ketogenic, low_fodmap, occasions, sustainable, vegan, vegetarian, very_healthy, very_popular, whole30, weight_watcher_smart_points, dish_types, extended_ingredients, summary, wine_pairing].hash\n end",
"def hash\n [timing, plan, amount, quantity, billing, amount_incl_vat, compensation_method, partial_period_handling, start_date, cancel_change, add_ons, remove_add_ons].hash\n end",
"def hash_keys\n [:x, :y]\n end",
"def initialize (hash)\n @name = hash [:name]\n @color = hash [:color]\n @robots = hash [:robots]\n @moon_count = hash [:moon_count]\n @cats = hash [:cats]\n #@solar_rotation = solar_rotation .....I dont really understand what a solar rotation is.... it's confusing.....\n @distance_from_the_sun = hash [:distance_from_the_sun]\n end",
"def key_map\r\n hash = {}\r\n hash['total'] = total\r\n hash['values'] = values\r\n hash\r\n end",
"def game_hash\n # puts \"#2 World\"\n # binding.pry\n\n {\n home: {\n team_name: \"Brooklyn Nets\",\n colors: [\"Black\", \"White\"],\n players: [\n {\n player_name: \"Alan Anderson\",\n number: 0,\n shoe: 16,\n points: 22,\n rebounds: 12,\n assists: 12,\n steals: 3,\n blocks: 1,\n slam_dunks: 1\n }, {\n player_name: \"Reggie Evans\",\n number: 30,\n shoe: 14,\n points: 12,\n rebounds: 12,\n assists: 12,\n steals: 12,\n blocks: 12,\n slam_dunks: 7\n }, {\n player_name: \"Brook Lopez\",\n number: 11,\n shoe: 17,\n points: 17,\n rebounds: 19,\n assists: 10,\n steals: 3,\n blocks: 1,\n slam_dunks: 15\n }, {\n player_name: \"Mason Plumlee\",\n number: 1,\n shoe: 19,\n points: 26,\n rebounds: 12,\n assists: 6,\n steals: 3,\n blocks: 8,\n slam_dunks: 5\n }, {\n player_name: \"Jason Terry\",\n number: 31,\n shoe: 15,\n points: 19,\n rebounds: 2,\n assists: 2,\n steals: 4,\n blocks: 11,\n slam_dunks: 1\n }\n ]\n },\n away: {\n team_name: \"Charlotte Hornets\",\n colors: [\"Turquoise\", \"Purple\"],\n players: [\n {\n player_name: \"Jeff Adrien\",\n number: 4,\n shoe: 18,\n points: 10,\n rebounds: 1,\n assists: 1,\n steals: 2,\n blocks: 7,\n slam_dunks: 2\n }, {\n player_name: \"Bismak Biyombo\",\n number: 0,\n shoe: 16,\n points: 12,\n rebounds: 4,\n assists: 7,\n steals: 7,\n blocks: 15,\n slam_dunks: 10\n }, {\n player_name: \"DeSagna Diop\",\n number: 2,\n shoe: 14,\n points: 24,\n rebounds: 12,\n assists: 12,\n steals: 4,\n blocks: 5,\n slam_dunks: 5\n }, {\n player_name: \"Ben Gordon\",\n number: 8,\n shoe: 15,\n points: 33,\n rebounds: 3,\n assists: 2,\n steals: 1,\n blocks: 1,\n slam_dunks: 0\n }, {\n player_name: \"Brendan Haywood\",\n number: 33,\n shoe: 15,\n points: 6,\n rebounds: 12,\n assists: 12,\n steals: 22,\n blocks: 5,\n slam_dunks: 12\n }\n ]\n }\n }\n end",
"def hash\n [id, name, ticker, figi_ticker, ric, isin, sedol, exchange_mic, sponsor, type, description, inception_date, data_change_date, close_date, is_live_listed, legal_structure, intraday_nav_ticker, primary_ticker, primary_ticker_country_code, primary_listing_region, net_expense_ratio, asset_class, other_asset_types, market_cap_range, holds_only_nyse_stocks, holds_only_nasdaq_stocks, growth_value_tilt, growth_type, value_type, sector, industry, sub_industry, cross_sector_theme, natural_resources_type, excludes_financials, excludes_technology, us_or_excludes_us, developed_emerging, specialized_region, continent, latin_america_sub_group, europe_sub_group, asia_sub_group, specific_country, china_listing_location, us_state, real_estate, index_weighting_scheme, market_cap_weighting_type, fundamental_weighting_type, dividend_weighting_type, bond_type, government_bond_types, municipal_bond_region, municipal_vrdo, mortgage_bond_types, bond_tax_status, credit_quality, average_maturity, specific_maturity_year, bond_currency_denomination, laddered, zero_coupon, floating_rate, build_america_bonds, commodity_types, energy_type, agricultural_type, metal_type, inverse_leveraged, target_date_multi_asset_type, currency_hedged, currency_pair, social_environmental_type, clean_energy_type, dividend_type, regular_dividend_payor_type, holds_ml_ps, holds_preferred_stock, holds_closed_end_funds, quant_strategies_type, other_quant_models, hedge_fund_type, derivatives_based, holds_ad_rs, index_linked, includes_short_exposure, index_name, parent_index, index_family, broader_index_family, index_provider, fund_family, index_ticker, etn_issuing_bank, etn_maturity_date, livestock, dynamic_futures_roll, index_provider_code, single_category_designation, registered_countries, issuing_entity_country_code, ucits, replication_structure, domicile, base_currency, listing_currency, fund_listing_date, listing_country_code, listing_region, smartvs_traditional_beta, smartvs_traditional_beta_level2, income_category, etp_structure_type, month_end_assets, etf_portfolio_turnover, firstbridge_id, firstbridge_parent_id, number_of_holdings].hash\n end",
"def to_hash(limit = instance_variables)\n limit.each_with_object({}) do |iv, hash|\n ivn = to_ivar(iv)\n hash[ivn] = instance_variable_get(ivn)\n end\n end",
"def find_distance_between_planets(planet_1, planet_2)\n information_hash = {}\n information_hash[:planet_1] = @planets[planet_1.to_i].name\n information_hash[:planet_2] = @planets[planet_2.to_i].name\n distance = @planets[planet_1.to_i].distance_from_sun - @planets[planet_2.to_i].distance_from_sun\n information_hash[:distance] = distance.abs\n\n information_hash\n end",
"def store(kingdom, species)\n kingdom_hash= { kingdom[0] => species[0], kingdom[1] => species[1],}\n kingdom_hash.each {|key, value| puts \"#{key} #{value}\" }\nend",
"def hash\n @vector\n end",
"def hash\n [tire_pressure, rim, rim_diameter, rim_width, rim_offset, tire, tire_sizing_system, tire_construction, tire_width, tire_aspect_ratio, tire_diameter, tire_section_width, tire_is_82series, load_index, speed_index].hash\n end",
"def hash\n [date, net_asset_value, beta_vs_spy, trailing_one_month_return_split_and_dividend, trailing_one_month_return_split_only, trailing_one_year_return_split_and_dividend, trailing_one_year_return_split_only, trailing_one_year_volatility_annualized, trailing_three_year_annualized_return_split_and_dividend, trailing_three_year_annualized_return_split_only, trailing_three_year_volatility_annualized, trailing_five_year_annualized_return_split_and_dividend, trailing_five_year_annualized_return_split_only, trailing_five_year_volatility_annualized, trailing_ten_year_annualized_return_split_and_dividend, trailing_ten_year_annualized_return_split_only, inception_annualized_return_split_and_dividend, inception_annualized_return_split_only, calendar_year_5_return_split_and_dividend, calendar_year_5_return_split_only, calendar_year_4_return_split_and_dividend, calendar_year_4_return_split_only, calendar_year_3_return_split_and_dividend, calendar_year_3_return_split_only, calendar_year_2_return_split_and_dividend, calendar_year_2_return_split_only, calendar_year_1_return_split_and_dividend, calendar_year_1_return_split_only, calendar_year_to_date_return_split_and_dividend, calendar_year_to_date_return_split_only, etf].hash\n end",
"def hash\n [blur, glow, inner_shadow, outer_shadow, preset_shadow, soft_edge, reflection, fill_overlay].hash\n end",
"def make_variable_map variables\n map = {}\n\n variables.each { |variable, class_module|\n map[variable] = class_module.full_name\n }\n\n map\n end",
"def slots_hash(slots)\n node = slots.node\n direction = slots.direction\n\n from_slots = slots.each_with_object({}) do |slot, hash|\n if slot.get(:model).is_a?(Atlas::Slot::Elastic)\n hash[slot.carrier] = :elastic\n else\n hash[slot.carrier] = slot.share.to_f\n end\n end\n\n if slots.any?\n # Find any temporarily stored coupling carrier conversion.\n if cc_share = node.get(:\"cc_#{ direction }\")\n from_slots[:coupling_carrier] = cc_share\n end\n end\n\n from_slots\n end",
"def _brands_hash (brands,brand_stocks,brand_total_purchases,brand_total_sales)\n brand_ave_price = (brand_total_sales/brand_total_purchases).round(2)\n return {\n brand: brands,\n stock: brand_stocks.round(2),\n ave_price: brand_ave_price,\n sales: brand_total_sales.round(2)\n }\nend",
"def hash\n @points.inject(0) { |sum, point| sum += point.x + point.y }\n end",
"def hash\n code = 17\n code = 37 * code\n self.instance_variables.each do |v|\n code += self.instance_variable_get(v).hash\n end\n code\n end",
"def game_hash \n stats = {\n home: {\n team_name: \"Brooklyn Nets\",\n colors: ['Black', 'White'],\n players: [\n {'Alan Anderson' => { number: 0, shoe: 16, points: 22, rebounds: 12, assists: 12, steals: 3, blocks: 1, slam_dunks: 1}},\n {'Reggie Evans' => { number: 30, shoe: 14, points: 12, rebounds: 12, assists: 12, steals: 12, blocks: 12, slam_dunks: 7}},\n {'Brook Lopez' => { number: 11, shoe: 17, points: 17, rebounds: 19, assists: 10, steals: 3, blocks: 1, slam_dunks: 15}},\n {'Mason Plumlee' => { number: 1, shoe: 19, points: 26, rebounds: 11, assists: 6, steals: 3, blocks: 8, slam_dunks: 5}},\n {'Jason Terry' => { number: 31, shoe: 15, points: 19, rebounds: 2, assists: 2, steals: 4, blocks: 11, slam_dunks: 1}}\n ]\n },\n away: {\n team_name: \"Charlotte Hornets\",\n colors: ['Turquoise', 'Purple'],\n players: [\n {'Jeff Adrien' => { number: 4, shoe: 18, points: 10, rebounds: 1, assists: 1, steals: 2, blocks: 7, slam_dunks: 2}},\n {'Bismack Biyombo' => { number: 0, shoe: 16, points: 12, rebounds: 4, assists: 7, steals: 22, blocks: 15, slam_dunks: 10}},\n {'DeSagna Diop' => { number: 2, shoe: 14, points: 24, rebounds: 12, assists: 12, steals: 4, blocks: 5, slam_dunks: 5}},\n {'Ben Gordon' => { number: 8, shoe: 15, points: 33, rebounds: 3, assists: 2, steals: 1, blocks: 1, slam_dunks: 0}},\n {'Kemba Walker' => { number: 33, shoe: 15, points: 6, rebounds: 12, assists: 12, steals: 7, blocks: 5, slam_dunks: 12}}\n ]\n }\n }\nend",
"def export(k, v) make_var(k, v, true) end",
"def local_spares\n {}\n end",
"def local_spares\n {}\n end",
"def local_spares\n {}\n end",
"def hash\n [type, direction, shape, stops, linear_angle, is_scaled, tile_flip].hash\n end",
"def initialize(planets)\n @solar_system = planets\n end",
"def random_service_hash\n\t\tbelt \t\t= ['white', 'green', 'blue', 'red', 'black'].sample\n\t\tlocation \t= ['Los Angeles', 'USC', 'Southern California', 'Silicon Valley', 'San Francisco', 'Boston', 'United States'].sample\n\t\tprice \t\t= [*10..200].sample\n\t\tdesc \t\t= [ { title: 'Cheap Guitar Lessons', category: 'Music', tag: 'Guitar', headline: 'Experience professional teaching guitar'},\n\t\t\t\t\t\t{ title: 'Piano Lessons!', category: 'Music', tag: 'Piano', headline: 'Can teach beginners to experienced'},\n\t\t\t\t\t\t{ title: 'Rock and Roll!', category: 'Music', tag: 'Guitar', headline: 'Teaching rock and rock style guitar'},\n\t\t\t\t\t\t{ title: 'Dog Walking All Day', category: 'Errands', tag: 'Dog Walking', headline: 'I love spending time with dogs!'},\n\t\t\t\t\t\t{ title: 'How to Ride A Bike', category: 'Sports/Fitness', tag:'Biking', headline: 'Teaching you how to ride a bike!'}, \n\t\t\t\t\t\t{ title: 'BUAD Tutor Session', category: 'Education', tag: 'Tutoring', headline: 'Helping students with BUAD 425' },\n\t\t\t\t\t\t{ title: 'Car Washing Service', category: 'Errands', tag: 'Car Wash', headline: \"We've been doing this for a long time!\"} ].sample\n\t\thash \t\t= { belt: belt, location: location, price: price, desc: desc }\n\n\t\thash\n\tend",
"def key_map\n hash = {}\n hash['upc'] = self.upc\n hash['quantity'] = self.quantity\n hash\n end",
"def build_driver_hash(all_rides, all_drivers)\n all_rides.each_pair do |driver, data|\n all_drivers[driver] = 0\n end\n return all_drivers\nend",
"def initialize(name)\n @planets = []\n @name = name\n @constellation = nil\n @type = nil\n @age = 0\n end",
"def create\n\n new_hash = params.require(:planet).permit(:name, :image_url, :diameter, :mass, :life)\n new_planet = Planet.create(new_hash)\n redirect_to \"/planets/#{new_planet.id}\"\n end",
"def hash\n [compute, group_by, index, multi_compute, search].hash\n end",
"def generate_hash\n @groups.flatten.inject([]) {|hash, stone| hash << stone.to_s}.sort.hash\n end",
"def hash\n code = 17\n code = 37*code + @x.hash\n code = 37*code + @y.hash\n # Add lines like this for each significant instance variable\n code # Return the resulting code\n end",
"def hash\n [rank, suit].hash\n end",
"def game_hash\n game_hash = {home:{team_name:\"Brooklyn Nets\", colors:[\"Black\", \"White\"], players:{\"Alan Anderson\"=>{number: 0, shoe: 16, points: 22, rebounds: 12, assists: 12, steals: 3, blocks: 1, slam_dunks: 1},\n \"Reggie Evans\"=>{number: 30, shoe: 14, points: 12, rebounds: 12, assists: 12, steals: 12, blocks: 12, slam_dunks: 7},\n \"Brook Lopez\"=>{number: 11, shoe: 17, points: 17, rebounds: 19, assists: 10, steals: 3, blocks: 1, slam_dunks: 15},\n \"Mason Plumlee\"=>{number: 1, shoe: 19, points: 26, rebounds: 12, assists: 6, steals: 3, blocks: 8, slam_dunks: 5},\n \"Jason Terry\"=>{number: 31, shoe: 15, points: 19, rebounds: 2, assists: 2, steals: 4, blocks: 11, slam_dunks: 1}}},\n away:{team_name:\"Charlotte Hornets\", colors:[\"Turquoise\", \"Purple\"], players:{\"Jeff Adrien\"=>{number: 4, shoe: 18, points: 10, rebounds: 1, assists: 1, steals: 2, blocks: 7, slam_dunks: 2},\n \"Bismak Biyombo\"=>{number: 0, shoe: 16, points: 12, rebounds: 4, assists: 7, steals: 7, blocks: 15, slam_dunks: 10},\n \"DeSagna Diop\"=>{number: 2, shoe: 14, points: 24, rebounds: 12, assists: 12, steals: 4, blocks: 5, slam_dunks: 5},\n \"Ben Gordon\"=>{number: 8, shoe: 15, points: 33, rebounds: 3, assists: 2, steals: 1, blocks: 1, slam_dunks: 0},\n \"Brendan Haywood\"=>{number: 33, shoe: 15, points: 6, rebounds: 12, assists: 12, steals: 22, blocks: 5, slam_dunks: 12}}}}\n game_hash\nend",
"def create_helpers\n @currencies = Hash.new\n\n @pairs.each do |pair_name, pair_value|\n single_currencies = pair_name.split(\"-\")\n unless @currencies.key?(single_currencies[0])\n @currencies[single_currencies[0]] = Hash.new\n end\n unless @currencies.key?(single_currencies[1])\n @currencies[single_currencies[1]] = Hash.new\n end\n # Set if the currencies in the new pair are swapped\n @currencies[single_currencies[0]][single_currencies[1]] = true\n @currencies[single_currencies[1]][single_currencies[0]] = false\n end\n end",
"def make_hash\n variables = self.instance_variables\n attr_hash = {}\n \n variables.each do |var|\n attr_hash[\"#{var.slice(1..-1)}\"] = self.send(\"#{var.slice(1..-1)}\")\n end\n \n attr_hash\n end",
"def test_h\n {bruce: 4, kathy: 76, artur: 1, settrah: 100}\nend",
"def hash\n [accounts_date, reporting_period, currency, consolidated_accounts, audit_qualification, number_of_employees, turnover, cost_of_sales, sga_plus_other_net_costs, operating_profit, interest_receivable, interest_payable, pre_tax_profit, taxation, post_tax_profit, dividends_payable, retained_profits, intangible_assets, tangible_assets, investments_and_other_assets, fixed_assets, stock, trade_debtors, other_debtors, miscellaneous_current_assets, cash, current_assets, total_assets, bank_loans_and_overdrafts, trade_creditors, miscellaneous_current_liabilities, other_short_term_finances, current_liabilities, contingent_liabilities, other_long_term_finances, total_long_term_liabilities, total_liabilities, net_assets, equity_paid_up, revaluation_reserve, sundry_reserves, profit_and_loss_account_reserve, shareholder_funds, depreciation, amortisation_of_intangibles, ebitda, working_capital, capital_employed, wages_and_salaries, directors_emoluments, audit_fees, bank_overdraft_and_long_term_loans, net_cash_flow_from_operations, net_cash_flow_before_financing, net_cash_flow_from_financing, increase_in_cash, debtor_days, exports, gross_margin_percentage, operating_profit_margin_percentage, ebitda_margin_percentage, pre_tax_profit_margin_percentage, net_margin_percentage, return_on_assets_percentage, return_on_capital_employed_percentage, return_on_equity, current_ratio, cash_to_current_liabilities_ratio, cash_to_total_assets_percentage, liquidity_ratio, gearing_percentage_on_liability_basis, gearing_percentage_on_gross_debt_basis, gearing_percentage_on_net_debt_basis, debt_to_capital_percentage, inventory_turnover_ratio, cash_to_turnover_ratio, cash_to_turnover_percentage, days_inventory_outstanding, days_sales_outstanding, days_payable_outstanding, cash_conversion_cycle, revenue_per_employee, human_capital_value_added, interest_coverage_ratio, net_debt_to_ebitda_ratio, cfo_to_sales_ratio, auditor, joint_auditor, solicitor, accountant].hash\n end",
"def get_list_of_planets\n planets = get_space_bodies.select{|body| body[\"isPlanet\"] == true}\n end",
"def meets\n meets0 = Hash.new\n processed_clusters.each {|cluster| meets0[cluster.meet] = cluster}\n return meets0\n end",
"def sport_reg_exp (all_schedules)\n reg_exp_sports = Hash.new\n all_schedules.each do |current|\n reg_exp_sports[current.sport] = create_reg_exp current.sport\n end\n reg_exp_sports\nend",
"def _pack_ivars( obj )\n return_hash = {}\n vars = obj.aquatic? ? obj._storable_attributes : obj.instance_variables\n vars.each do |ivar_name|\n ivar = obj.instance_variable_get( ivar_name )\n return_hash[ivar_name] = _pack_object( ivar ) unless ivar.nil? \n end\n return_hash\n end",
"def hash\n [router_mode, matrix_id, router_dimension, speed_multiplier, area, speed_multiplier_area, traffic, departure, track, motorway, toll, trailers, weight, weight_per_axle, height, width, length, hazardous_goods, max_walk_distance, approach, snap, strict_restriction, cost_fixed, cost_distance_multiplier, cost_time_multiplier, cost_value_multiplier, cost_waiting_time_multiplier, cost_late_multiplier, start_point_id, end_point_id, capacities, sequence_timewindows, timewindow_id, timewindow, rest_ids, id, coef_setup, additional_setup, coef_service, additional_service, shift_preference, trips, value_matrix_id, duration, distance, maximum_ride_time, maximum_ride_distance, skills, unavailable_work_day_indices, unavailable_work_date, unavailable_index_ranges, unavailable_date_ranges, free_approach, free_return].hash\n end",
"def spares\n if style == :road\n { chain: '11-speed', tire_size: '23', tape_color: tape_color }\n else\n { chain: '11-speed', tire_size: '2.1', front_shock: front_shock }\n end\n end",
"def create_hash(&block); end",
"def create_hash(&block); end",
"def generate_vm_hash(vm_object, pool_name)\n pool_configuration = pool_config(pool_name)\n return nil if pool_configuration.nil?\n\n hostname = vm_object.summary.guest.hostName if vm_object.summary&.guest && vm_object.summary.guest.hostName\n boottime = vm_object.runtime.bootTime if vm_object.runtime&.bootTime\n powerstate = vm_object.runtime.powerState if vm_object.runtime&.powerState\n\n {\n 'name' => vm_object.name,\n 'hostname' => hostname,\n 'template' => pool_configuration['template'],\n 'poolname' => pool_name,\n 'boottime' => boottime,\n 'powerstate' => powerstate\n }\n end",
"def game_hash\n game_hash = {\n home: {\n team_name: \"Brooklyn Nets\",\n colors: [\"Black\", \"White\"],\n players: {\n \"Alan Anderson\" => {\n number: 0,\n shoe: 16,\n points: 22,\n rebounds: 12,\n assists: 12,\n steals: 3,\n blocks: 1,\n slam_dunks: 1\n },\n \"Reggie Evans\" => {\n number: 30,\n shoe: 14,\n points: 12,\n rebounds: 12,\n assists: 12,\n steals: 12,\n blocks: 12,\n slam_dunks: 7\n },\n \"Brook Lopez\" => {\n number: 11,\n shoe: 17,\n points: 17,\n rebounds: 19,\n assists: 10,\n steals: 3,\n blocks: 1,\n slam_dunks: 15\n },\n \"Mason Plumlee\" => {\n number: 1,\n shoe: 19,\n points: 26,\n rebounds: 11,\n assists: 6,\n steals: 3,\n blocks: 8,\n slam_dunks: 5\n },\n \"Jason Terry\" => {\n number: 31,\n shoe: 15,\n points: 19,\n rebounds: 2,\n assists: 2,\n steals: 4,\n blocks: 11,\n slam_dunks: 1\n }\n }\n },\n away: {\n team_name: \"Charlotte Hornets\",\n colors: [\"Turquoise\", \"Purple\"],\n players: {\n \"Jeff Adrien\" => {\n number: 4,\n shoe: 18,\n points: 10,\n rebounds: 1,\n assists: 1,\n steals: 2,\n blocks: 7,\n slam_dunks: 2\n },\n \"Bismack Biyombo\" => {\n number: 0,\n shoe: 16,\n points: 12,\n rebounds: 4,\n assists: 7,\n steals: 22,\n blocks: 15,\n slam_dunks: 10\n },\n \"DeSagna Diop\" => {\n number: 2,\n shoe: 14,\n points: 24,\n rebounds: 12,\n assists: 12,\n steals: 4,\n blocks: 5,\n slam_dunks: 5\n },\n \"Ben Gordon\" => {\n number: 8,\n shoe: 15,\n points: 33,\n rebounds: 3,\n assists: 2,\n steals: 1,\n blocks: 1,\n slam_dunks: 0\n },\n \"Kemba Walker\" => {\n number: 33,\n shoe: 15,\n points: 6,\n rebounds: 12,\n assists: 12,\n steals: 7,\n blocks: 5,\n slam_dunks: 12\n }\n }\n }\n }\nend",
"def game_hash\n game_hash = {\n home: {\n team_name: \"Brooklyn Nets\",\n colors: [\"Black\", \"White\"],\n players: {\n \"Alan Anderson\" => {\n number: 0,\n shoe: 16,\n points: 22,\n rebounds: 12,\n assists: 12,\n steals: 3,\n blocks: 1,\n slam_dunks: 1\n },\n \"Reggie Evans\" => {\n number: 30,\n shoe: 14,\n points: 12,\n rebounds: 12,\n assists: 12,\n steals: 12,\n blocks: 12,\n slam_dunks: 7\n },\n \"Brook Lopez\" => {\n number: 11,\n shoe: 17,\n points: 17,\n rebounds: 19,\n assists: 10,\n steals: 3,\n blocks: 1,\n slam_dunks: 15\n },\n \"Mason Plumlee\" => {\n number: 1,\n shoe: 19,\n points: 26,\n rebounds: 12,\n assists: 6,\n steals: 3,\n blocks: 8,\n slam_dunks: 5\n },\n \"Jason Terry\" => {\n number: 31,\n shoe: 15,\n points: 19,\n rebounds: 2,\n assists: 2,\n steals: 4,\n blocks: 11,\n slam_dunks: 1\n }\n }\n },\n away: {\n team_name: \"Charlotte Hornets\",\n colors: [\"Turquoise\", \"Purple\"],\n players: {\n \"Jeff Adrien\" => {\n number: 4,\n shoe: 18,\n points: 10,\n rebounds: 1,\n assists: 1,\n steals: 2,\n blocks: 7,\n slam_dunks: 2\n },\n \"Bismak Biyombo\" => {\n number: 0,\n shoe: 16,\n points: 12,\n rebounds: 4,\n assists: 7,\n steals: 7,\n blocks: 15,\n slam_dunks: 10\n },\n \"DeSagna Diop\" => {\n number: 2,\n shoe: 14,\n points: 24,\n rebounds: 12,\n assists: 12,\n steals: 4,\n blocks: 5,\n slam_dunks: 5\n },\n \"Ben Gordon\" => {\n number: 8,\n shoe: 15,\n points: 33,\n rebounds: 3,\n assists: 2,\n steals: 1,\n blocks: 1,\n slam_dunks: 0\n },\n \"Brendan Haywood\" => {\n number: 33,\n shoe: 15,\n points: 6,\n rebounds: 12,\n assists: 12,\n steals: 22,\n blocks: 5,\n slam_dunks: 12\n }\n }\n }\n }\nend",
"def game_hash\n game_hash = {\n home: {\n team_name: \"Brooklyn Nets\",\n colors: [\"Black\", \"White\"],\n players: {\n \"Alan Anderson\" => {\n number: 0,\n shoe: 16,\n points: 22,\n rebounds: 12,\n assists: 12,\n steals: 3,\n blocks: 1,\n slam_dunks: 1\n },\n \"Reggie Evans\" => {\n number: 30,\n shoe: 14,\n points: 12,\n rebounds: 12,\n assists: 12,\n steals: 12,\n blocks: 12,\n slam_dunks: 7\n },\n \"Brook Lopez\" => {\n number: 11,\n shoe: 17,\n points: 17,\n rebounds: 19,\n assists: 10,\n steals: 3,\n blocks: 1,\n slam_dunks: 15\n },\n \"Mason Plumlee\" => {\n number: 1,\n shoe: 19,\n points: 26,\n rebounds: 12,\n assists: 6,\n steals: 3,\n blocks: 8,\n slam_dunks: 5\n },\n \"Jason Terry\" => {\n number: 31,\n shoe: 15,\n points: 19,\n rebounds: 2,\n assists: 2,\n steals: 4,\n blocks: 11,\n slam_dunks: 1\n }\n }\n },\n away: {\n team_name: \"Charlotte Hornets\",\n colors: [\"Turquoise\", \"Purple\"],\n players: {\n \"Jeff Adrien\" => {\n number: 4,\n shoe: 18,\n points: 10,\n rebounds: 1,\n assists: 1,\n steals: 2,\n blocks: 7,\n slam_dunks: 2\n },\n \"Bismak Biyombo\" => {\n number: 0,\n shoe: 16,\n points: 12,\n rebounds: 4,\n assists: 7,\n steals: 7,\n blocks: 15,\n slam_dunks: 10\n },\n \"DeSagna Diop\" => {\n number: 2,\n shoe: 14,\n points: 24,\n rebounds: 12,\n assists: 12,\n steals: 4,\n blocks: 5,\n slam_dunks: 5\n },\n \"Ben Gordon\" => {\n number: 8,\n shoe: 15,\n points: 33,\n rebounds: 3,\n assists: 2,\n steals: 1,\n blocks: 1,\n slam_dunks: 0\n },\n \"Brendan Haywood\" => {\n number: 33,\n shoe: 15,\n points: 6,\n rebounds: 12,\n assists: 12,\n steals: 22,\n blocks: 5,\n slam_dunks: 12\n }\n }\n }\n }\nend",
"def list_planets\n counter = 1\n @planets.each_key do |planet|\n puts counter.to_s + \". \" + planet\n counter += 1\n end\nend",
"def hash\n [income_type, description, tax_rate, tax_amount, tax_amount_no_vat, withheld, total, vat_type].hash\n end",
"def list_planets\n x = \"Planets orbitting #{@star_name}\\n\"\n z = \"\"\n z = z + x\n l = 1\n while l <= @planets.length\n y = \"#{l}. #{@planets[l-1].name}\\n\"\n z += y\n l += 1\n end\n return z\n end",
"def add_planets\n get_list_of_planets.each {|planet| Planet.new(planet)} \n end",
"def the_hash\n puts put_in_hash(get_symbols, get_prices, 20)\nend",
"def game_hash\n game_hash = {\n home: {\n team_name: \"Brooklyn Nets\",\n colors: [\"Black\", \"White\"],\n players: {\n \"Alan Anderson\" => {\n number: 0, \n shoe: 16, \n points: 22, \n rebounds: 12, \n assists: 12, \n steals: 3, \n blocks: 1, \n slam_dunks: 1\n },\n \"Reggie Evans\" => {\n number: 30, \n shoe: 14, \n points: 12, \n rebounds: 12, \n assists: 12, \n steals: 12, \n blocks: 12, \n slam_dunks: 7\n }, \n \"Brook Lopez\" => {\n number: 11, \n shoe: 17, \n points: 17, \n rebounds: 19, \n assists: 10, \n steals: 3, \n blocks: 1, \n slam_dunks: 15\n },\n \"Mason Plumlee\" => {\n number: 1, \n shoe: 19, \n points: 26, \n rebounds: 12, \n assists: 6, \n steals: 3, \n blocks: 8, \n slam_dunks: 5\n },\n \"Jason Terry\" => {\n number: 31, \n shoe: 15, \n points: 19, \n rebounds: 2, \n assists: 2, \n steals: 4, \n blocks: 11, \n slam_dunks: 1\n }\n }\n },\n\n away: {\n team_name: \"Charlotte Hornets\",\n colors: [\"Turquoise\", \"Purple\"],\n players: {\n \"Jeff Adrien\" => {\n number: 4, \n shoe: 18, \n points: 10, \n rebounds: 1, \n assists: 1, \n steals: 2, \n blocks: 7, \n slam_dunks: 2\n },\n \"Bismak Biyombo\" => {\n number: 0, \n shoe: 16, \n points: 12, \n rebounds: 4, \n assists: 7, \n steals: 7, \n blocks: 15, \n slam_dunks: 10\n }, \n \"DeSagna Diop\" => {\n number: 2, \n shoe: 14, \n points: 24, \n rebounds: 12, \n assists: 12, \n steals: 4, \n blocks: 5, \n slam_dunks: 5\n },\n \"Ben Gordon\" => {\n number: 8, \n shoe: 15, \n points: 33, \n rebounds: 3, \n assists: 2, \n steals: 1, \n blocks: 1, \n slam_dunks: 0\n },\n \"Brendan Haywood\" => {\n number: 33, \n shoe: 15, \n points: 6, \n rebounds: 12, \n assists: 12, \n steals: 22, \n blocks: 5, \n slam_dunks: 12\n }\n }\n }\n }\nend",
"def collect_data(options)\n capsuleers.each do |capsuleer|\n self.planet_inputs[capsuleer.name] = {}\n\n capsuleer.colonies.each do |colony|\n next if options.has_key?(:system) &&\n !colony.name.upcase.include?(options[:system].upcase)\n self.planet_inputs[capsuleer.name][colony.name] = Hash.new(0)\n\n colony.unique_schematics_by_pin.each do |pin|\n self.planet_schematics[pin] = Entity::PlanetSchematic.retrieve(pin, eve_db)\n self.outputs[planet_schematics[pin].name] += 1\n inputs = planet_schematics[pin].inputs.uniq do |input|\n input.name\n end\n\n inputs.each do |input|\n self.inputs[input.name] += 1\n self.planet_inputs[capsuleer.name][colony.name][input.name] += 1\n end\n end\n end\n end\n end",
"def initialize(planets)\n @planets = planets\n #@age = rand(9999)\n end"
] |
[
"0.655195",
"0.6120683",
"0.5855577",
"0.58059615",
"0.5792365",
"0.5791664",
"0.5707559",
"0.56860614",
"0.5603455",
"0.5591035",
"0.55902445",
"0.5559945",
"0.5558671",
"0.5528472",
"0.55091715",
"0.5490801",
"0.5490801",
"0.5486575",
"0.5409635",
"0.5399172",
"0.53591746",
"0.5348828",
"0.53465647",
"0.5341889",
"0.5330822",
"0.5329411",
"0.5262647",
"0.52565855",
"0.5251771",
"0.52385366",
"0.5238228",
"0.5234868",
"0.5232722",
"0.5209554",
"0.5203982",
"0.5196071",
"0.5192456",
"0.5187604",
"0.5185696",
"0.517912",
"0.5174906",
"0.5166478",
"0.5161337",
"0.5154857",
"0.51510006",
"0.514969",
"0.5144292",
"0.5141425",
"0.51332855",
"0.5131375",
"0.51188815",
"0.5111499",
"0.51053697",
"0.51052094",
"0.50945324",
"0.5078225",
"0.5067508",
"0.506233",
"0.5061095",
"0.5060161",
"0.505739",
"0.5049389",
"0.5049389",
"0.5049389",
"0.50466704",
"0.50396746",
"0.50300384",
"0.5023287",
"0.5022458",
"0.5020608",
"0.50146717",
"0.5000802",
"0.4997351",
"0.4992591",
"0.49923274",
"0.49864218",
"0.49851027",
"0.49829093",
"0.49817556",
"0.49784625",
"0.4973456",
"0.4971581",
"0.4971182",
"0.4969236",
"0.49691483",
"0.4964791",
"0.49631825",
"0.49631825",
"0.49594003",
"0.4958371",
"0.49556383",
"0.49556383",
"0.49518716",
"0.49497947",
"0.49468517",
"0.4945383",
"0.49437505",
"0.4942226",
"0.49402606",
"0.49400175"
] |
0.5982115
|
2
|
Register one or more Interceptors which will be called before SMS is sent.
|
def register_interceptors(*interceptors)
interceptors.flatten.compact.each { |interceptor| register_interceptor(interceptor) }
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def register_interceptor(interceptor)\r\n delivery_interceptor = case interceptor\r\n when String, Symbol\r\n interceptor.to_s.camelize.constantize\r\n else\r\n interceptor\r\n end\r\n\r\n Sms.register_interceptor(delivery_interceptor)\r\n end",
"def register_preview_interceptors(*interceptors)\n interceptors.flatten.compact.each { |interceptor| register_preview_interceptor(interceptor) }\n end",
"def register( *objects )\n objects.each do |object|\n append_hook( :owner => object, \n :trigger => YesTrigger.new, \n :action => MethodAction.new(:handle) )\n end\n end",
"def register( *objects )\n objects.each do |object|\n append_hook( :owner => object,\n :trigger => YesTrigger.new,\n :action => MethodAction.new(:handle) )\n end\n end",
"def list_interceptors\n @interceptors.list\n end",
"def list_interceptors\n @interceptors.list\n end",
"def register_handlers\n @driver.on(:open, &method(:on_open))\n @driver.on(:message, &method(:on_message))\n @driver.on(:close, &method(:on_close))\n end",
"def add_to_instances\n # Store only those interceptions that are not marked to be used for existing methods only\n return if options[:existing_methods_only]\n\n interceptions_storage = context.instance_variable_get(:@interceptions_storage)\n unless interceptions_storage\n interceptions_storage = InterceptionsStorage.new\n context.instance_variable_set(:@interceptions_storage, interceptions_storage)\n end\n interceptions_storage << self\n end",
"def clear_interceptors\n raise ServerAlreadyStartedError if @started\n @interceptors.clear\n end",
"def register_events\n EventReactor.sub(:trade_cleared, &method(:log_trade_cleared))\n EventReactor.sub(:round_change, &method(:log_round_change))\n end",
"def clear_interceptors\n raise ServerAlreadyStartedError if @started\n\n @interceptors.clear\n end",
"def register_capabilities(methods); end",
"def add_handlers\n #endofmotd\n @bot.on Cinch::Constants::RPL_ENDOFMOTD do |event|\n handle_endofmotd event\n end\n\n @bot.on :privmsg do |event|\n handle_privmsg event\n end\n\n @bot.on :action do |event|\n handle_action event\n end\n\n @bot.handlers.each do |handler|\n handler.instance_eval do\n @execute_in_callback = false\n end\n end\n end",
"def use(interceptor_class, options = {})\n interceptors_mutex do\n @registry << {\n klass: interceptor_class,\n options: options\n }\n end\n end",
"def insert_interceptor_before(before_class, interceptor_class, opts = {})\n raise ServerAlreadyStartedError if @started\n\n @interceptors.insert_before(before_class, interceptor_class, opts)\n end",
"def interceptors_mutex(&block)\n @interceptors_mutex ||= begin\n require 'monitor'\n Monitor.new\n end\n @interceptors_mutex.synchronize(&block)\n end",
"def register_signal_handlers\n end",
"def register_events\n EventReactor.sub(:trade_cleared, &method(:trade_cleared))\n EventReactor.sub(:round_change, &method(:change_round))\n EventReactor.sub(:ask_posted, &method(:ask_posted))\n EventReactor.sub(:bid_posted, &method(:bid_posted))\n end",
"def register_capabilities methods\n @register_semaphore.synchronize do\n send_request 'client/registerCapability', {\n registrations: methods.select{|m| can_register?(m) and !registered?(m)}.map { |m|\n @registered_capabilities.add m\n {\n id: m,\n method: m,\n registerOptions: dynamic_capability_options[m]\n }\n }\n }\n end\n end",
"def initialize_inbound_handlers\n\t\t@inbound_handlers = []\n\tend",
"def register(*tracker)\n @trackers += tracker\n end",
"def register_actors(*actors)\n @act_metadata = ActMetadata.new if @act_metadata.nil?\n actors.each do |actor|\n actor.act_name = self.name\n @act_metadata.register_actor actor\n end\n end",
"def excon_middlewares\n [\n Excon::Middleware::CustomInstrumentor,\n Excon::Middleware::Mock,\n Excon::Middleware::Deadline,\n Excon::Middleware::ResponseParser,\n Excon::Middleware::Expects,\n Excon::Middleware::CustomIdempotent\n ]\n end",
"def enable!\n tracers.each(&:enable!)\n end",
"def register_signal_handlers\n HANDLED_SIGNALS.each do |sig|\n if ::Signal.list.include? sig.to_s\n trap(sig) { Thread.main[:signal_queue] << sig ; notice_signal }\n end\n end\n end",
"def add_interceptor\n if block_given?\n return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:addInterceptor, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::Vertx::SendContext)) })),::Vertx::EventBus)\n end\n raise ArgumentError, \"Invalid arguments when calling add_interceptor()\"\n end",
"def register_interrupt_handlers\n vm.mov_handler_to_addr 0, method(:syscall_handler)\n end",
"def register_curation_concern(*curation_concern_types)\n Array.wrap(curation_concern_types).flatten.compact.each do |cc_type|\n unless @registered_concerns.include?(cc_type)\n @registered_concerns << cc_type\n end\n end\n end",
"def register_initializers\n use Padrino::Logger::Rack\n use Padrino::Reloader::Rack if reload?\n use Rack::Flash if flash?\n @initializer_path ||= Padrino.root + '/config/initializers/*.rb'\n Dir[@initializer_path].each { |file| register_initializer(file) }\n end",
"def setup_default_handlers\n # Incoming events\n prepend_handler :incoming_msg, self.method(:r_msg)\n prepend_handler :incoming_act, self.method(:r_act)\n prepend_handler :incoming_notice, self.method(:r_notice)\n prepend_handler :incoming_ctcp, self.method(:r_ctcp)\n prepend_handler :incoming_ctcpreply, self.method(:r_ctcpreply)\n prepend_handler :incoming_mode, self.method(:r_mode)\n prepend_handler :incoming_join, self.method(:r_join)\n prepend_handler :incoming_part, self.method(:r_part)\n prepend_handler :incoming_kick, self.method(:r_kick)\n prepend_handler :incoming_quit, self.method(:r_quit)\n prepend_handler :incoming_nick, self.method(:r_nick)\n prepend_handler :incoming_miscellany, self.method(:r_miscellany)\n\n # Incoming numeric events here\n prepend_handler :incoming_welcome, self.method(:r_welcome)\n prepend_handler :incoming_bannedfromchan, self.method(:r_bannedfromchan)\n prepend_handler :incoming_badchannelkey, self.method(:r_badchannelkey)\n prepend_handler :incoming_nicknameinuse, self.method(:_nicknameinuse)\n prepend_handler :incoming_channelurl, self.method(:r_channelurl)\n prepend_handler :incoming_topic, self.method(:r_topic)\n prepend_handler :incoming_topicinfo, self.method(:r_topicinfo)\n prepend_handler :incoming_namreply, self.method(:_namreply)\n prepend_handler :incoming_endofnames, self.method(:r_endofnames)\n prepend_handler :incoming_motd, self.method(:r_motd)\n prepend_handler :incoming_motdstart, self.method(:r_motdstart)\n prepend_handler :incoming_endofmotd, self.method(:r_endofmotd)\n prepend_handler :incoming_invite, self.method(:r_invite)\n\n # Outgoing events\n prepend_handler :outgoing_begin_connection, self.method(:out_begin_connection)\n end",
"def register_global_listeners\n Wisper.clear\n Wisper.subscribe(AdminNotifier.new)\n Wisper.subscribe(SlackNotifications.new)\n Wisper.subscribe(UserEmails.new)\n end",
"def register(devices)\n @devices.merge! devices\n end",
"def register(devices)\n @devices.merge! devices\n end",
"def define_handler(*extensions, &block)\n @handlers += extensions.map { |ext| [ext, block] }\n end",
"def enable\n\t\t\t@last_request = nil\n\t\t\tBase.instance.add_observer(self)\n\t\tend",
"def register(client_id, message_handlers, options={})\n receiver = receiver(client_id)\n message_handler_names = []\n message_handlers = [message_handlers] unless message_handlers.is_a? Array\n message_handlers.each do |message_handler|\n if check(client_id, message_handler)\n handled_methods = message_handler.handled_methods || []\n handled_methods = [handled_methods] unless handled_methods.is_a? Array\n handled_methods_as_strings = []\n handled_methods.each do |method|\n handled_methods_as_strings << method.to_s\n (@registered_message_handlers_for_method[method.to_sym] ||= []) << message_handler\n end\n message_handler_name = message_handler.name.to_s\n @registered_message_handlers << message_handler\n @registered_message_handlers_by_fq_name[message_handler.fq_name] = message_handler\n message_handler.qsif = @qsif_public # Set the public service interface so that it is available in the message handler\n message_handler_names << message_handler_name\n notify(:type => :debug, :code => 5000, :receivers => receiver, :params => {:message_handler_name => message_handler_name, :handled_methods => handled_methods_as_strings.inspect, :modules => message_handler.modules.inspect, :message_handler_class => message_handler.class, :version => message_handler.version })\n end\n end\n notify(:type => :debug, :code => 5010, :receivers => receiver, :params => {:amount => @registered_message_handlers.size})\n end",
"def register_inbound_handler(handler)\n\t\t@inbound_handlers << handler\n\tend",
"def before_intercept(&block)\n @before_intercept = block if block_given?\n \n self\n end",
"def setup_signal_handlers\n # The Module declaration here will only close over local variables so we\n # need to assign self to a local variable to get access to the agent itself.\n clazz = self\n\n EM.attach(@signal_handler_pipe_reader, Module.new {\n define_method :receive_data do |_|\n\n handlers = clazz.instance_variable_get(:@signal_handlers)\n queue = clazz.instance_variable_get(:@signal_handler_queue)\n signal = queue.pop\n\n clazz.send(:logger).debug { \"Running signal handlers for: #{signal}\" }\n handlers[signal].each { |handler| handler.call(signal) }\n end\n })\n end",
"def register(*plugins)\n @@plugins += plugins\n end",
"def add_custom_handlers\n # Set up hooks\n @irc.on_msg self.method(:_in_msg)\n @irc.on_act self.method(:_in_act)\n @irc.on_invite self.method(:_in_invited)\n @irc.on_kick self.method(:_in_kick)\n @irc.saying_join self.method(:_out_join)\n end",
"def intercept!(type, args = {})\n return yield if @interceptors.none?\n\n i = @interceptors.pop\n return yield unless i\n\n i.send(type, **args) do\n if @interceptors.any?\n intercept!(type, args) do\n yield\n end\n else\n yield\n end\n end\n end",
"def test_callbacks_are_not_installed_again_if_they_have_already_been_installed\n multi = Curl::Multi.new\n request = MiniTest::Mock.new\n segment = MiniTest::Mock.new\n segment.expect :add_request_headers, nil, [MiniTest::Mock]\n request.expect :_nr_instrumented, true\n def multi.wrap_request(req)\n wrapped_request = MiniTest::Mock.new\n wrapped_request.expect :type, nil\n wrapped_request.expect :uri, nil\n wrapped_request.expect :method, nil\n [wrapped_request, nil]\n end\n NewRelic::Agent::Tracer.stub :start_external_request_segment, segment do\n multi.hook_pending_request(request)\n end\n request.verify\n segment.verify\n end",
"def register_signals\n trap(:INT) { debug \"Recieved INT\"; exit!}\n end",
"def enable(*observers, &block)\n set_enablement(true, observers, &block)\n end",
"def register_advice_methods!\n scope # force calculation of scope before aliasing methods.\n\n @mutex.synchronize do\n return self if @advice_methods_registered\n\n this = self\n mod_target.instance_eval do\n define_method(this.before_meth, &this.advice.before)\n define_method(this.after_meth, &this.advice.after)\n define_method(this.around_meth, &this.advice.around)\n end\n\n @advice_methods_registered = true\n end\n self\n end",
"def add(interactor)\n interactors << interactor\n end",
"def register(*extensions, &block)\n extensions.reject! { |e| self.extensions.include? e }\n super(*extensions, &block)\n end",
"def register(*extensions, &block)\n extensions.reject! { |e| self.extensions.include? e }\n super(*extensions, &block)\n end",
"def register_observer(observer, cmd_name=nil)\n codes= []\n if cmd_name\n codes << Protocol.find_cmd_by_name(cmd_name).code\n else\n codes+= CMDS_BY_CODE.keys\n end\n codes.each {|code|\n list= @observers[code]\n if list.nil?\n @observers[code]= list= []\n end\n list.push(observer)\n }\n end",
"def register_side_effect(side_effect)\n @side_effects << side_effect\n end",
"def method_missing(sym,*args, &block)\n if sym.to_s.match(/^(on|before|after)_/)\n register_handler(sym.to_s,args.first,&block)\n else\n super\n end\n end",
"def add_default_handlers\n # Puts (for debugging)\n @handlers[\"#{NAMESPACE}.puts\"] = Proc.new { |dialog, *arguments|\n puts(*arguments.map { |argument| argument.inspect })\n }\n RESERVED_NAMES << \"#{NAMESPACE}.puts\"\n\n # Error channel (for debugging)\n @handlers[\"#{NAMESPACE}.error\"] = Proc.new { |dialog, type, message, backtrace|\n Utils.log_error(type + ': ' + message, {:language => 'javascript', :backtrace => backtrace})\n }\n RESERVED_NAMES << \"#{NAMESPACE}.error\"\n end",
"def add_observer!(klass)\n super and define_callbacks(klass)\n end",
"def register(event_ids, handler_object = nil, &handler_proc)\n handler = handler_proc || handler_object\n\n if handler.nil? || !handler.respond_to?(:call)\n raise ArgumentError, \"Please pass either an object#call or a handler block\"\n end\n\n Array(event_ids).flatten.each do |id|\n @handlers[\n @resolver.transform(id).to_s\n ] << handler\n end\n\n nil\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 register_names\n register_attributes.collect {|attr| get_register(attr)}\n end",
"def register_message_encoders(&block)\n\n # Create the message decoder context and register all the message decoders to the environment context message handler.\n ctx = MessageEncoderContext.new $ctx.message_handler \n block.call ctx \nend",
"def before_write_processors\n @before_write_processors ||= []\n end",
"def decorates(*args)\n args.each do |name|\n __delegates << name\n end\n end",
"def register(*extensions, &block)\n start_registering_extension\n result = super\n stop_registering_extension\n result\n end",
"def register_agent(protocol, method)\n @agents[protocol] ||= []\n @agents[protocol] << method\n end",
"def method_missing(sym,*args, &block)\n if sym.to_s.match(/^(on|before|after)_/)\n register_handler(sym.to_s,args.first,&block)\n else\n super\n end\n end",
"def register_matchers(*matchers, handler)\n matchers.each do |matcher|\n @routes[matcher] << handler\n end\n end",
"def sms_side_effects\n old_observers = SmsCarrier::Sms.class_variable_get(:@@delivery_notification_observers)\n old_delivery_interceptors = SmsCarrier::Sms.class_variable_get(:@@delivery_interceptors)\n yield\n ensure\n SmsCarrier::Sms.class_variable_set(:@@delivery_notification_observers, old_observers)\n SmsCarrier::Sms.class_variable_set(:@@delivery_interceptors, old_delivery_interceptors)\n end",
"def initialize(*args, &block)\n @observing_procs = {}\n super(*args, &block)\n end",
"def allow_registration(method); end",
"def before_hook(method_name)\n hooks << method_name\n end",
"def enable(hook, *more_hooks)\n ([hook] + more_hooks).each { |h| @callbacks[h] ||= nil }\n end",
"def register_middleware(omniauth)\n raise NotImplementedError\n end",
"def registration_requests\n # TODO: generate a request for each supported version\n [RegisterRequest.new(challenge)]\n end",
"def included(_base)\n register_middleware :request, :desk_encode_dates, :EncodeDates\n register_middleware :request, :desk_encode_json, :EncodeJson\n register_middleware :request, :desk_oauth, :OAuth\n register_middleware :request, :desk_retry, :Retry\n register_middleware :response, :desk_parse_dates, :ParseDates\n register_middleware :response, :desk_parse_json, :ParseJson\n register_middleware :response, :desk_raise_error, :RaiseError\n register_middleware :response, :desk_follow_redirects, :FollowRedirects\n end",
"def before_report &block\n (@before_handlers ||= []) << block\n end",
"def register_message_bus\n @message_bus_listeners = []\n subscriptions = self.class.instance_variable_get :@message_bus_subscriptions\n subscriptions ||= []\n\n subscriptions.each do |subscription|\n @message_bus_listeners << Volt.current_app.message_bus.on(subscription[:event]) do |*params|\n case subscription[:callback]\n when Symbol\n send(subscription[:callback])\n when Proc\n instance_eval(&subscription[:callback])\n end\n end\n end\n end",
"def registered_messages\n registered_methods = registers.map { |_, meth| meth if !meth.is_a?(Proc) }.compact\n all_registrations = registers.keys + instance_methods(false) - registered_methods\n\n all_registrations.map(&:to_s)\n end",
"def register(*args)\n worker = attempt(*args)\n @initial << [args, worker]\n end",
"def register_observer(observer)\r\n delivery_observer = case observer\r\n when String, Symbol\r\n observer.to_s.camelize.constantize\r\n else\r\n observer\r\n end\r\n\r\n Sms.register_observer(delivery_observer)\r\n end",
"def register_handler(handler)\n handler.handled_events.each do |event_type|\n (event_handlers[event_type] ||= []) << handler\n Twitch::Bot::Logger.debug \"Registered #{handler} for #{event_type}\"\n end\n end",
"def list\n interceptors_mutex do\n @registry.map { |h| h[:klass] }\n end\n end",
"def add(*observer)\n if observer.respond_to?(:each)\n @observers = observer.each\n else\n @observers << observer\n end\n end",
"def register!\n return if @registered\n @registered = true\n\n self.behavior = :notify\n @subscriber = ActiveSupport::Notifications.subscribe(%r{^deprecation}) do |*args|\n queue.enqueue args\n end\n end",
"def register(events:, sync:, async:)\n events.each do |event|\n @rules[event].add_sync sync\n @rules[event].add_async async\n end\n end",
"def initialize(options = {})\n @options = options || {}\n @interceptors = options.fetch(:interceptor_registry, Gruf.interceptors)\n @interceptors = Gruf::Interceptors::Registry.new unless @interceptors.is_a?(Gruf::Interceptors::Registry)\n @services = []\n @started = false\n @stop_server = false\n @stop_server_cv = ConditionVariable.new\n @stop_server_mu = Monitor.new\n setup\n end",
"def registers; end",
"def register_preview_interceptor(interceptor)\n preview_interceptor = interceptor_class_for(interceptor)\n\n unless preview_interceptors.include?(preview_interceptor)\n preview_interceptors << preview_interceptor\n end\n end",
"def add_observer &observer\n observers << observer\n end",
"def advertise_services\n reg = Register.new(@identity, @registry.services, status_proc.call, self.tags, @shared_queue)\n RightLinkLog.info(\"SEND #{reg.to_s}\")\n @amq.fanout('registration', :no_declare => @options[:secure]).publish(@serializer.dump(reg))\n true\n end",
"def initialize(decorators = [])\n @decorators = decorators\n end",
"def register(*args, &block)\n h = Unobservable.handler_for(*args, &block)\n @handlers << h\n return h\n end",
"def register_signal_handlers\n # If we're the parent process, we mostly want to forward the signals on\n # to the child processes. It's just that sometimes we want to wait for\n # them and then exit\n trap('TERM') do\n contention_aware_handler { stop!('TERM', in_signal_handler=true); exit }\n end\n trap('INT') do\n contention_aware_handler { stop!('INT', in_signal_handler=true); exit }\n end\n safe_trap('HUP') { sighup_handler.call }\n safe_trap('QUIT') do\n contention_aware_handler { stop!('QUIT', in_signal_handler=true); exit }\n end\n safe_trap('USR1') do\n contention_aware_handler { stop!('KILL', in_signal_handler=true) }\n end\n begin\n trap('CONT') { stop('CONT', in_signal_handler=true) }\n trap('USR2') { stop('USR2', in_signal_handler=true) }\n rescue ArgumentError\n warn 'Signals USR2, and/or CONT not supported.'\n end\n end",
"def setup_signals\n @trapped_count ||= 0\n\n stopper = proc do\n @trapped_count += 1\n stop!\n\n # Reset count after 5 seconds\n EM.add_timer(5) { @trapped_count = 0 }\n end\n\n trap('INT') do\n stopper.call\n abort \"Multiple INT signals trapped; aborting!\" if @trapped_count > 1\n end\n\n trap('TERM') { stopper.call }\n\n unless !!RUBY_PLATFORM =~ /mswin|mingw/\n trap('QUIT') { stop! }\n trap('HUP') { restart }\n end\n end",
"def before_method(method)\n @@before_methods << method\n @@wrap_exclusions << method.to_sym # This method will not be wrapped.\n end",
"def instrument\n proc do\n ActiveSupport::Notifications.publish(\"start_middleware.coach\", middleware_event)\n\n ActiveSupport::Notifications.\n instrument(\"finish_middleware.coach\", middleware_event) { call }\n end\n end",
"def initialize(*loggers)\n # We don't really inherit from Logger\n #super(nil)\n\n @loggers = []\n loggers.each do |logger|\n next if logger.nil?\n\n attach(logger)\n end\n end",
"def enable()\n fail \"#{self} already enabled\" if @enabled\n @klasses.each_pair do |k,methods|\n methods.each_pair do |method_sym, (orig,blk)|\n new_meth = instrument_method(k,method_sym,orig,blk)\n k.class_eval do\n define_method method_sym, &new_meth\n end\n end\n end\n @enabled = true\n end",
"def register(*args)\n registry.register(*args)\n end",
"def spy_on *msgs\n msgs.each do |msg|\n spy msg\n end\n end",
"def initialize_sighandlers\n trap(:INT) do\n stop\n exit\n end\n end",
"def before(handler = nil, *guards, &block)\n client.register_filter :before, handler, *guards, &block\n end",
"def register_callback(c_when, method)\n callbacks[c_when] << method\n end"
] |
[
"0.58921146",
"0.5437073",
"0.54194987",
"0.5410355",
"0.53355217",
"0.53355217",
"0.53178066",
"0.5304436",
"0.5270519",
"0.52503604",
"0.52453095",
"0.5239487",
"0.52116627",
"0.51802504",
"0.51708525",
"0.5167625",
"0.51627654",
"0.5157047",
"0.51506746",
"0.51312304",
"0.5110133",
"0.5077376",
"0.50444585",
"0.50080603",
"0.49917343",
"0.49678275",
"0.49493107",
"0.4934628",
"0.49220827",
"0.4889456",
"0.48752275",
"0.48708913",
"0.48708913",
"0.48654893",
"0.4847335",
"0.48246804",
"0.4808046",
"0.48002326",
"0.47996807",
"0.47970882",
"0.47966656",
"0.4789571",
"0.47535458",
"0.47472858",
"0.47370163",
"0.47342914",
"0.47294828",
"0.47289222",
"0.47289222",
"0.47146735",
"0.47060904",
"0.4702084",
"0.47005066",
"0.46993935",
"0.46931818",
"0.4691888",
"0.4689578",
"0.46843112",
"0.46723685",
"0.46668977",
"0.46668187",
"0.46570417",
"0.46565953",
"0.46529913",
"0.46463722",
"0.464259",
"0.46286413",
"0.4607764",
"0.4605751",
"0.45749903",
"0.45565078",
"0.4554909",
"0.455146",
"0.45493773",
"0.4543424",
"0.45419994",
"0.45389953",
"0.4536916",
"0.4529266",
"0.4528237",
"0.45277423",
"0.45256677",
"0.45245695",
"0.45243818",
"0.45234385",
"0.45233336",
"0.45214087",
"0.4520279",
"0.4509764",
"0.45076835",
"0.45067134",
"0.4502071",
"0.45018178",
"0.44945952",
"0.44892016",
"0.44877002",
"0.44869655",
"0.44802204",
"0.44788343",
"0.4476224"
] |
0.70476365
|
0
|
Register an Observer which will be notified when SMS is delivered. Either a class, string or symbol can be passed in as the Observer. If a string or symbol is passed in it will be camelized and constantized.
|
def register_observer(observer)
delivery_observer = case observer
when String, Symbol
observer.to_s.camelize.constantize
else
observer
end
Sms.register_observer(delivery_observer)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def register_observer(observer)\n unless @@delivery_notification_observers.include?(observer)\n @@delivery_notification_observers << observer\n end\n end",
"def register_observer(observer, cmd_name=nil)\n codes= []\n if cmd_name\n codes << Protocol.find_cmd_by_name(cmd_name).code\n else\n codes+= CMDS_BY_CODE.keys\n end\n codes.each {|code|\n list= @observers[code]\n if list.nil?\n @observers[code]= list= []\n end\n list.push(observer)\n }\n end",
"def notify_observers(symbol, *args)\n @observers.each do |o|\n o.send(symbol, *args) if o.respond_to? symbol\n end\n end",
"def inform_observers(sms)\n @@delivery_notification_observers.each do |observer|\n observer.delivered_sms(sms)\n end\n end",
"def register_interceptor(interceptor)\r\n delivery_interceptor = case interceptor\r\n when String, Symbol\r\n interceptor.to_s.camelize.constantize\r\n else\r\n interceptor\r\n end\r\n\r\n Sms.register_interceptor(delivery_interceptor)\r\n end",
"def add_observer &observer\n observers << observer\n end",
"def add_observer(&observer)\n\t\t@observers << observer\n\tend",
"def add_observer(observer)\n end",
"def add_observer(observer)\n end",
"def add_observer(observer)\n @observers << observer\n end",
"def add_observer(name, obs)\n @observ_list[name] = obs\n end",
"def add_observer!(klass)\n super and define_callbacks(klass)\n end",
"def add_observer(observer) \n unless observer.respond_to? :update\n raise NoMethodError, \"observer, #{observer}, needs to respond to #update\" \n end\n LOG.debug \"#{self} is attempting to add an observer, #{observer}.\"\n @observers << observer\n LOG.debug \"#{observer} is now listening for events on #{self}.\"\n end",
"def add_observer(&block)\n super(Observer.new(block))\n end",
"def attach(observer)\n puts 'Subject: Attached an observer'\n @observers << observer\n end",
"def attach(observer)\n puts 'Subject: Attached an observer.'\n @observers << observer\n end",
"def attach_observer(observer)\n observer_broadcaster.add_observer(observer)\n end",
"def add(*observer)\n if observer.respond_to?(:each)\n @observers = observer.each\n else\n @observers << observer\n end\n end",
"def add_observer(observer)\n @conductor.observers << observer\n self\n end",
"def add_observer(o)\n @cpg.add_observer(o)\n end",
"def add_observer object, func = :update\n @sub_lock.synchronize do\n subscribers.fetch(channel) { |k|\n Thread.new {\n start_listener\n unwrap(connection).exec \"LISTEN #{channel}\"\n @observing.release\n }\n subscribers[k] = {}\n }[object] = func\n end\n\n @observing.await\n end",
"def subscribe(cls, &block)\n @subscribers[cls.name] = block\n end",
"def observe(obj)\n obj.add_observer self\n end",
"def register_message_bus\n @message_bus_listeners = []\n subscriptions = self.class.instance_variable_get :@message_bus_subscriptions\n subscriptions ||= []\n\n subscriptions.each do |subscription|\n @message_bus_listeners << Volt.current_app.message_bus.on(subscription[:event]) do |*params|\n case subscription[:callback]\n when Symbol\n send(subscription[:callback])\n when Proc\n instance_eval(&subscription[:callback])\n end\n end\n end\n end",
"def instantiate_observers\n return if @observers.blank?\n @observers.each do |observer|\n if observer.respond_to?(:to_sym) # Symbol or String\n observer.to_s.camelize.constantize.instance\n elsif observer.respond_to?(:instance)\n observer.instance\n else\n raise ArgumentError, \"#{observer} must be a lowercase, underscored class name (or an instance of the class itself) responding to the instance method. Example: Person.observers = :big_brother # calls BigBrother.instance\"\n end\n end\n end",
"def add_observer(observer=nil, func=:update, &block)\n if observer.nil? && block.nil?\n raise ArgumentError, 'should pass observer as a first argument or block'\n elsif observer && block\n raise ArgumentError.new('cannot provide both an observer and a block')\n end\n\n if block\n observer = block\n func = :call\n end\n\n begin\n @mutex.lock\n new_observers = @observers.dup\n new_observers[observer] = func\n @observers = new_observers\n observer\n ensure\n @mutex.unlock\n end\n end",
"def add_observer_to_observable(observer, observed, options)\n ReactiveObservers::Observer::Container.new(observer, observed, options).tap do |observer_container|\n observer_container.observed_klass.register_observer observer_container\n end\n end",
"def register(msg, callback)\n key = msg.kind_of?(Numeric) \\\n ? (\"%03d\" % msg) \\\n : msg.to_s.upcase\n @callbacks.add(key, callback)\n end",
"def subscribe(&onMessage) # block\n end",
"def add_observer(observer)\n super\n \n @observer_queues = {} unless defined? @observer_queues\n @observer_queues[observer]=Queue.new\n \n @observer_threads = {} unless defined? @observer_threads\n @observer_threads[observer]=Thread.new(observer){\n loop do\n arg=@observer_queues[observer].pop\n observer.update(*arg)\n end\n }\n end",
"def notify_observers(*args, &block)\n notify_to(observers, *args, &block)\n self\n end",
"def add_observer!(klass)\n\t\tsuper unless self.class.orbserved?(klass)\n\tend",
"def new_observer(model, &block)\n observer = Class.new(Mongoid::Observer) do\n attr_accessor :notifications\n\n def initialize\n super\n @notifications = []\n end\n end\n\n (class << observer; self; end).class_eval do\n define_method(:name) do\n \"#{model.name}Observer\"\n end\n end\n\n observer.observe(model)\n observer.class_eval(&block) if block_given?\n observer\n end",
"def notify_observers(*args)\n return unless changed?\n\n unwrap(connection).exec \"NOTIFY #{channel}, #{args}\"\n\n changed false\n end",
"def register(obj)\n if obj.is_a?(Observer) and not obj.nil? and not @observers.include?(obj) then\n @observers << obj\n @logger.debug \"Added #{obj} to observers\" if not self.logger.nil?\n else\n raise FileStoreException, \"Only instances of FileStore::Observer can be registered\"\n end\n end",
"def register_subscriber(protocol, block)\n @subscribers[protocol] ||= []\n @subscribers[protocol] << block\n end",
"def inform(msg)\n @observers.each do |o|\n o.notify msg, self\n end\n end",
"def notify_observers(*arg)\n __notify_observers(false, false, *arg)\n end",
"def register(class_name, &block)\n\n # Get the message class from the provided class name.\n class_name = class_name.camelize.concat \"Message\"\n message_class = Java::JavaClass.for_name(\"org.nova.net.messages.\".concat class_name)\n\n # Create the message encoder and register it to the handler.\n encoder = ProcMessageEncoder.new block\n @handler.register_encoder message_class, encoder\n end",
"def define_callbacks(klass)\n tap do |observer|\n observer_name = observer.class.name.underscore.gsub('/', '__')\n Mongoid::Callbacks::CALLBACKS.each do |callback|\n next unless respond_to?(callback)\n callback_meth = :\"_notify_#{observer_name}_for_#{callback}\"\n unless klass.respond_to?(callback_meth)\n klass.send(:define_method, callback_meth) do |&block|\n if value = observer.update(callback, self, &block)\n value\n else\n block.call if block\n end\n end\n klass.send(callback, callback_meth)\n end\n end\n end\n end",
"def subscribe_to_notifications(receive_data_srv)\n receive_data_srv.on_notification {|bytes|\n ary= bytes.scan(/../)\n bytes= ary.collect {|hex| hex.to_i(16)}\n cmd= Protocol.find_cmd_by_code(bytes.shift)\n list= @observers[cmd.code]\n unless list.nil?\n list.each { |observer|\n observer.observe(cmd, cmd.rs(bytes))\n }\n end\n }\n end",
"def create_observer\n MockObserver.new self\n end",
"def notify(msg)\n\n waiters, observers = @services.select { |n, s|\n s.respond_to?(:on_msg)\n }.sort_by { |n, s|\n n\n }.partition { |n, s|\n s.respond_to?(:wait_for)\n }\n\n (observers + waiters).each { |n, s| s.on_msg(msg) }\n end",
"def subscribe(message_class, process_method)\n debug_me{[ :message_class ]}\n raise ::SmartMessage::Errors::NotImplemented\n end",
"def sms=(arg)\n raise ArgumentError, \"sms expects a string, not a #{arg.class}\" unless arg.is_a?(String)\n @sms = arg\n end",
"def accept(observer)\n observer.on_next value\n end",
"def register(message_type, message_subtype = nil, &listener)\n _register(message_type, message_subtype, listener)\n end",
"def fregister(message_type, message_subtype = nil, &listener)\n _register(message_type, message_subtype , Funnel.wrap(listener))\n end",
"def register_monitored_class(klass)\n @monitored_classes << klass\n end",
"def notify(subscriber, *args, &block)\n if subscriber.respond_to? MESSAGE\n subscriber.public_send(MESSAGE, self, *args, &block)\n end\n end",
"def register!\n return if @registered\n @registered = true\n\n self.behavior = :notify\n @subscriber = ActiveSupport::Notifications.subscribe(%r{^deprecation}) do |*args|\n queue.enqueue args\n end\n end",
"def deliver\n #inform_interceptors\n if delivery_handler\n delivery_handler.deliver_sms(self) { do_delivery }\n else\n do_delivery\n end\n inform_observers\n self\n end",
"def register_subscriber(subscriber)\n @subscribers << subscriber\n end",
"def observe(observable, *args)\n options = args.last.is_a?(Hash) ? args.last : {}\n return if observable.nil?\n return if options[:ignore_frozen] && observable.frozen?\n unless observable.is_a?(Observable)\n # TODO refactor code to be more smart/polymorphic/automated and honor open/closed principle (e.g. for SomeClass, search if there is ObservableSomeClass)\n if observable.is_a?(Array)\n observable.extend(ObservableArray)\n elsif observable.is_a?(Hash)\n observable.extend(ObservableHash)\n else\n observable.extend(ObservableModel)\n end\n end\n args = compact_args(args)\n observable.add_observer(self, *args)\n ensure_registration_for!(observable, *args)\n end",
"def _register(mtype, msubtype, listener)\n @listeners[mtype] = {} unless @listeners.has_key? mtype\n @listeners[mtype][msubtype] = [] unless @listeners[mtype].has_key? msubtype\n @listeners[mtype][msubtype].push(listener)\n end",
"def register(subscriber)\n subscribers << subscriber\n end",
"def notify(msg, subject)\n end",
"def register_ctcp(msg, callback)\n @ctcp_callbacks.add(msg.to_s.upcase, callback)\n end",
"def unregister_observer(observer, cmd_name)\n cmd= Protocol.find_cmd_by_name(cmd_name)\n list= @observers[cmd.code]\n list.delete(observer) unless list.nil?\n end",
"def add_observers(new_observers)\n\t\tif new_observers.is_a?(Array)\n\t\t\tnew_observers.each { |new_observer| @observers << new_observer }\n\t\telse\n\t\t\t@observers << new_observers\n\t\tend\n\tend",
"def deliver_sms(sms) #:nodoc:\r\n ActiveSupport::Notifications.instrument(\"deliver.sms_carrier\") do |payload|\r\n set_payload_for_sms(payload, sms)\r\n yield # Let Sms do the delivery actions\r\n end\r\n end",
"def notify\n puts 'Subject: Notifying observers...'\n @observers.each { |observer| observer.update(self) }\n end",
"def activate_observer(client = isimud_client)\n create_queue(client)\n isimud_send_action_message(:update)\n end",
"def register(handler)\n conf = @config\n bot = self\n isaac = @bot\n\n @bot.register{|type, msg|\n begin\n $log.debug \"Received message: #{type} #{msg}\"\n handler.dispatch(type, msg, bot.clone_state(msg)) # TODO: send a binding?\n rescue Exception => e\n $log.warn e.to_s\n $log.debug e.backtrace.join(\"\\n\")\n end\n }\n end",
"def add_object_observer(object)\n @object_observers ||= []\n @object_observers.push(object)\n end",
"def register_receiver(target, source, options={})\n receivers[source] = target\n target.send(:extend, Communicator::ActiveRecordIntegration::ClassMethods)\n target.send(:include, Communicator::ActiveRecordIntegration::InstanceMethods)\n\n target.skip_remote_attributes(*options[:except]) if options[:except]\n Communicator.logger.info \"Registered #{target} as receiver for messages from #{source}\"\n \n target\n end",
"def subscribe(aSubscriber)\n subscribers << aSubscriber\n end",
"def option_observers\n block = proc { |observers| observers.split(',').each { |observer| save_option_value(\"task.observer.#{observer}\", nil) }; propagate_option('--observers', observers) }\n @cl_parser.on('--observers NAME1,NAME2', 'Enter a list of observers to use for this run.', &block)\n\n end",
"def test_queued_sendmsg\n t = 'foo'\n m1 = MessageMock.new('foo', 'foomsg')\n @t.sendmsg(m1)\n \n u = UserMock.new\n @t.subscribe(t, u)\n \n assert_equal(m1.data, u.data)\n assert_equal('MESSAGE', m1.command)\n \n u2 = UserMock.new\n @t.subscribe(t, u2) \n assert_equal('', u2.data)\n end",
"def watch_notification( notification_name, sender = nil, notification_center = NSNotificationCenter.defaultCenter )\n\n selector_name = \"handle_#{notification_name}:\"\n\n if block_given?\n\n # define a wrapper method that yields\n self.def_method_once selector_name do |notification|\n yield notification\n end\n\n elsif ! self.respond_to? selector_name\n \n self.def_method_once selector_name do |notification|\n # define a handle_* that sends to an on_*, working around compile-time wiring to selector implementation (breaking hotload)\n on_method = \"on_#{notification_name}:\"\n if self.respond_to? on_method\n self.send on_method, notification\n else\n # define the logging handler\n pe_log \"#{notification_name} received with #{notification.description}\"\n end\n end\n\n end\n\n notification_center.addObserver(self, selector:selector_name, name:notification_name, object:sender)\n \n pe_log \"#{self} registered for notification: #{notification_name} from sender #{sender}\"\n\n self\nend",
"def subscribe_on_next\n obs = RX::Observer.configure do |o|\n o.on_next yield\n end\n\n self.subscribe obs\n end",
"def register_monitor_callbacks params\n on_monitor do |data|\n next if data.is_a?(Hash) && data.keys == [\"id\"]\n callback(params[\"channel\"], data)\n end\n end",
"def on_message(&processor_block)\n raise \"Message processor already registered\" if @message_processor\n @message_processor = processor_block\n end",
"def send_notification(method, params); end",
"def notify_observers(method)\n self.class.observer_instances.inject(true) do |accum, obs|\n obs.update(method, self) && accum\n end\n end",
"def new; send_sms; end",
"def method_missing(sym,*args, &block)\n if sym.to_s.match(/^(on|before|after)_/)\n register_handler(sym.to_s,args.first,&block)\n else\n super\n end\n end",
"def notify(object,class_name,notification_name,sms = false,options)\n if options[:email]\n if options[:password].present?\n Email.send_welcome_email(object,class_name,notification_name,options[:password])\n else\n Email.send_email(object,class_name,notification_name)\n end\n end\n Sms.send_sms(object,class_name,notification_name) if sms\n end",
"def register_middleware(type, sym, cls)\n cls = DeskApi.const_get(type.capitalize).const_get(cls)\n if Faraday.respond_to?(:register_middleware)\n Faraday.register_middleware type, sym => cls\n else\n Faraday.const_get(type.capitalize).register_middleware sym => cls\n end\n end",
"def method_missing(sym,*args, &block)\n if sym.to_s.match(/^(on|before|after)_/)\n register_handler(sym.to_s,args.first,&block)\n else\n super\n end\n end",
"def notify\n @subscribers.each { |ident, (block,obj)| block.call(obj) }\n end",
"def on(name, &block)\n define_sending_method(name)\n define_receiving_method(name, &block)\n end",
"def register type, cls\n @@processors[type] = cls\n end",
"def register(cb_sym, meth, klass)\n self[klass.to_s.make_key][cb_sym] << meth\n end",
"def observed_class\n if observed_class_name = name[/(.*)Observer/, 1]\n observed_class_name.constantize\n else\n nil\n end\n end",
"def initialize( *args )\n\t\t\t@observers = []\n\t\t\tsuper\n\t\tend",
"def notify\n @observers.each { |observer| observer.update }\nend",
"def register(object)\n\t\t\traise TypeError, 'handle_packet not defined' if !object.respond_to?(:handle_packet)\n\t\t\t@registered << object\n\t\tend",
"def broadcast(msg, *args)\n subscribers.each do |subscr|\n next unless subscr.respond_to?(msg) || subscr.respond_to?(:accept_all)\n\n subscr.send(msg, runtime, *args)\n end\n end",
"def register_callback(c_when, method)\n callbacks[c_when] << method\n end",
"def initialize(consumer, channel, exchange_in, exchange_out)\n @consumer, @channel, @exchange_in, @exchange_out = consumer, channel, exchange_in, exchange_out\n @consumer.add_observer(self)\n @consumer.consumer_manager = self\n end",
"def register(const)\n return if registered?(const)\n\n validate_plugin!(const)\n\n @@extensions << const\n end",
"def notify_sms (c, order)\r\n\r\n # notify only if not already done! \r\n unless already_notified order\r\n #dump_order = MultiJson.dump order, :pretty => true\r\n \r\n # log order data\r\n @logger.info \"NEW ORDER: #{order[\"order_id\"]} (num products: #{order[\"num_products\"]}, \\\r\nprice: #{order[\"price\"]} #{order[\"currency_code\"]}, current state: #{order[\"current_state\"]})\" \r\n\r\n # format SMS text with order details \r\n message = compose_sms_with_order_details c, order\r\n\r\n # send SMS through Skuby API (interfacing Skebby Gateway)\r\n sms_sent = send_sms(message, @seller_cell_number, @logger) if @send_sms\r\n\r\n @logger.info \"SMS SENT:\\n#{message}\" # if sms_sent #logger.debug\r\n \r\n # if SMS TX is disable, mark as notified anyway (debug)\r\n set_notified! order if (sms_sent || !@send_sms)\r\n\r\n # return status (success/error)\r\n sms_sent\r\n else\r\n true\r\n end\r\nend",
"def broadcast_sync(meth, *args)\n @listeners.select { |listener| listener.class.ann(meth, :stem_sync) }.each { |listener| listener.respond meth, *args }\n end",
"def subscriber( name )\n raise NotImplementedError, \"please implement 'subscriber'\"\n end",
"def register_widget(widget)\n unless @widgets[widget.id]\n widget.add_observer(self)\n @widgets[widget.id] = widget.to_s\n end\n end",
"def register_message(msg_id, receiver, response_callback: :response_received, timeout_callback: :response_timeout)\n logger.debug(\"registering message #{msg_id}\")\n registered_messages[msg_id] = {:receiver => receiver, :response_callback => response_callback, :timeout_callback => timeout_callback, :registered_at => Time.now.utc}\n end",
"def remove_observer(observer)\n end",
"def remove_observer(observer)\n end",
"def remove_observer(observer)\n end"
] |
[
"0.64920133",
"0.6275205",
"0.6202513",
"0.61565375",
"0.59722304",
"0.5963348",
"0.59285307",
"0.5902843",
"0.5902843",
"0.58158433",
"0.5759751",
"0.56803155",
"0.56201535",
"0.550342",
"0.54893345",
"0.5482523",
"0.54738873",
"0.5463691",
"0.5428636",
"0.5395923",
"0.5298697",
"0.5269537",
"0.5263641",
"0.5243417",
"0.5214957",
"0.520098",
"0.5150385",
"0.51424605",
"0.5110257",
"0.51057404",
"0.5074498",
"0.50607216",
"0.5046446",
"0.50460756",
"0.50090736",
"0.496792",
"0.49444184",
"0.4942633",
"0.4923249",
"0.49224463",
"0.4905521",
"0.48815885",
"0.48802978",
"0.48477727",
"0.4832121",
"0.48286775",
"0.4799627",
"0.47914302",
"0.4778076",
"0.47540128",
"0.47406194",
"0.4737433",
"0.47325295",
"0.47189698",
"0.47000262",
"0.4684889",
"0.46804783",
"0.4679267",
"0.4679239",
"0.46779674",
"0.46708596",
"0.4628658",
"0.4615976",
"0.46068665",
"0.4592406",
"0.45817348",
"0.4566455",
"0.4565298",
"0.45491007",
"0.4542368",
"0.45353383",
"0.45345584",
"0.4522385",
"0.45150846",
"0.4512771",
"0.4508521",
"0.45030075",
"0.45010045",
"0.4500216",
"0.44966164",
"0.44953585",
"0.44890752",
"0.44857988",
"0.44853714",
"0.44784594",
"0.44582057",
"0.4454992",
"0.44516715",
"0.44502407",
"0.44420362",
"0.44372964",
"0.44310692",
"0.44272715",
"0.44253004",
"0.44200817",
"0.44184688",
"0.4410425",
"0.4409217",
"0.4409217",
"0.4409217"
] |
0.7881037
|
0
|
Register an Interceptor which will be called before SMS is sent. Either a class, string or symbol can be passed in as the Interceptor. If a string or symbol is passed in it will be camelized and constantized.
|
def register_interceptor(interceptor)
delivery_interceptor = case interceptor
when String, Symbol
interceptor.to_s.camelize.constantize
else
interceptor
end
Sms.register_interceptor(delivery_interceptor)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def insert_interceptor_before(before_class, interceptor_class, opts = {})\n raise ServerAlreadyStartedError if @started\n\n @interceptors.insert_before(before_class, interceptor_class, opts)\n end",
"def add_interceptor\n if block_given?\n return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:addInterceptor, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::Vertx::SendContext)) })),::Vertx::EventBus)\n end\n raise ArgumentError, \"Invalid arguments when calling add_interceptor()\"\n end",
"def use(interceptor_class, options = {})\n interceptors_mutex do\n @registry << {\n klass: interceptor_class,\n options: options\n }\n end\n end",
"def register_interceptors(*interceptors)\r\n interceptors.flatten.compact.each { |interceptor| register_interceptor(interceptor) }\r\n end",
"def register_middleware(type, sym, cls)\n cls = DeskApi.const_get(type.capitalize).const_get(cls)\n if Faraday.respond_to?(:register_middleware)\n Faraday.register_middleware type, sym => cls\n else\n Faraday.const_get(type.capitalize).register_middleware sym => cls\n end\n end",
"def register_observer(observer)\r\n delivery_observer = case observer\r\n when String, Symbol\r\n observer.to_s.camelize.constantize\r\n else\r\n observer\r\n end\r\n\r\n Sms.register_observer(delivery_observer)\r\n end",
"def before_intercept(&block)\n @before_intercept = block if block_given?\n \n self\n end",
"def register_preview_interceptor(interceptor)\n preview_interceptor = interceptor_class_for(interceptor)\n\n unless preview_interceptors.include?(preview_interceptor)\n preview_interceptors << preview_interceptor\n end\n end",
"def register(cb_sym, meth, klass)\n self[klass.to_s.make_key][cb_sym] << meth\n end",
"def strategy(name, *args, &block)\n ware = OmniAuth::Strategies.const_get(OmniAuth::Utils.camelize(name.to_s))\n Scrapple.middleware_stack.insert_before(App, ware, *args, &block)\n end",
"def register_fulfillment_processor mod\n uniq_code = mod.name\n return unless verify_uniq_fulfillment_processor(uniq_code)\n return unless verify_fulfillment_module(mod)\n install_fulfillment_processor(uniq_code, mod)\n end",
"def before(klass, meth_name, &block)\n intercept(klass, meth_name, :before, &block)\n end",
"def register(msg, callback)\n key = msg.kind_of?(Numeric) \\\n ? (\"%03d\" % msg) \\\n : msg.to_s.upcase\n @callbacks.add(key, callback)\n end",
"def enable(middleware, args={})\n m = middleware.new(args)\n self.middlewares.push({\n :condition => Proc.new { true }, \n :middleware => m\n })\n end",
"def register_middleware(omniauth)\n raise NotImplementedError\n end",
"def register(method, regex, options = {})\n options[:method] = method\n options[:regex] = regex\n registered << options\n end",
"def send_with_arg_register\n <<-CODE\n next_literal_into(msg.send_site);\n msg.recv = stack_pop();\n msg.block = stack_pop();\n msg.args = c->args;\n\n perform_send:\n\n msg.priv = c->call_flags;\n msg.klass = _real_class(state, msg.recv);\n\n c->call_flags = 0;\n\n cpu_send_message(state, c, &msg);\n CODE\n end",
"def register(class_name, &block)\n\n # Get the message class from the provided class name.\n class_name = class_name.camelize.concat \"Message\"\n message_class = Java::JavaClass.for_name(\"org.nova.net.messages.\".concat class_name)\n\n # Create the message encoder and register it to the handler.\n encoder = ProcMessageEncoder.new block\n @handler.register_encoder message_class, encoder\n end",
"def register_processor(*args, &block)\n register_preprocessor(*args, &block)\n end",
"def register_sms(register_sms_request, opts = {})\n register_sms_with_http_info(register_sms_request, opts)\n nil\n end",
"def fregister(message_type, message_subtype = nil, &listener)\n _register(message_type, message_subtype , Funnel.wrap(listener))\n end",
"def register(handler)\n conf = @config\n bot = self\n isaac = @bot\n\n @bot.register{|type, msg|\n begin\n $log.debug \"Received message: #{type} #{msg}\"\n handler.dispatch(type, msg, bot.clone_state(msg)) # TODO: send a binding?\n rescue Exception => e\n $log.warn e.to_s\n $log.debug e.backtrace.join(\"\\n\")\n end\n }\n end",
"def intercept(klass, meth_name, type, &block)\n orig_name = \"aop_orig_#{meth_name}\".to_sym\n meth_name = meth_name.to_sym\n @intercepted_methods ||= Hash.new do |h,k| \n # h[class_name] = hash\n h[k] = Hash.new do |h,k|\n # h[class_name][method_name] = hash\n h[k] = Hash.new do |h,k| \n # h[class_name][method_name][interception_type] = array\n h[k] = []\n end\n end\n end\n \n make_interception = !@intercepted_methods[klass].has_key?(meth_name)\n @intercepted_methods[klass][meth_name][type] << block\n method_chain = @intercepted_methods[klass][meth_name]\n \n if make_interception\n klass.class_eval do\n alias_method orig_name, meth_name\n define_method(meth_name) do |*args|\n method_chain[:before].each { |m| m.call(self, args) }\n # The result of the callcc block will either be the last line in the actual\n # ruby block, or it will be whatever is passed as arguments when calling the \n # +abort_continuation+ proc\n callcc do |abort_continuation|\n # First lambda in chain is the call to the original method\n call_lambda = lambda { send(orig_name, *args) }\n method_chain[:around].each do |m|\n # Make a chain of lambdas that calls the previouly defined\n # lambda, thus creating a chain of around blocks that will\n # all finally reach the original method block\n prev_call_lambda = call_lambda\n call_lambda = lambda {\n # If +prev_call_lambda+ is called, the next around block in\n # chain until the last one which corresponds to the original method call\n # if +abort_continuation+ is called, then this loop is aborted and the\n # callcc block returns whatever was passed as an argument to the proc call\n m.call(self, args, prev_call_lambda, abort_continuation)\n }\n end\n result = call_lambda.call\n method_chain[:after].each { |m| m.call(self, result, args) }\n result\n end\n end\n end\n end\n end",
"def insert_interceptor_after(after_class, interceptor_class, opts = {})\n raise ServerAlreadyStartedError if @started\n\n @interceptors.insert_after(after_class, interceptor_class, opts)\n end",
"def method_missing(sym,*args, &block)\n if sym.to_s.match(/^(on|before|after)_/)\n register_handler(sym.to_s,args.first,&block)\n else\n super\n end\n end",
"def maic_set_insert_handler(symbol)\n other = MA_COMMAND_INSERTS[symbol].other\n handler = case other\n when Symbol then method(other)\n when String then lambda { eval(other) }\n when TrueClass then method(:command_personal)\n else\n handler = method(:maic_command_insert)\n end\n @command_window.set_handler(symbol, handler)\n end",
"def method_missing(sym,*args, &block)\n if sym.to_s.match(/^(on|before|after)_/)\n register_handler(sym.to_s,args.first,&block)\n else\n super\n end\n end",
"def register(name, &block)\n\n # Create the message decoder and register it to the handler.\n decoder = ProcMessageDecoder.new block\n @handler.register_decoder name, decoder\n end",
"def register_processor(pattern, klass, replace_all: T.unsafe(nil)); end",
"def register_type(type, klass, method_name, &block)\n end",
"def register_callback(c_when, method)\n callbacks[c_when] << method\n end",
"def register(object)\n\t\t\traise TypeError, 'handle_packet not defined' if !object.respond_to?(:handle_packet)\n\t\t\t@registered << object\n\t\tend",
"def register(target, obj)\n end",
"def register(&block)\n extend Module.new(&block)\n end",
"def before_send(&block)\n @before_send = block if block_given?\n @before_send\n end",
"def intercept!(type, args = {})\n return yield if @interceptors.none?\n\n i = @interceptors.pop\n return yield unless i\n\n i.send(type, **args) do\n if @interceptors.any?\n intercept!(type, args) do\n yield\n end\n else\n yield\n end\n end\n end",
"def interceptable\n InterceptableView.new(self)\n end",
"def setup_middleware middleware_stack\n where = OpenCensus::Trace.configure.middleware_placement\n case where\n when Class\n middleware_stack.insert_before where, RackMiddleware\n when :begin\n middleware_stack.unshift RackMiddleware\n else\n middleware_stack.use RackMiddleware\n end\n end",
"def register type, cls\n @@processors[type] = cls\n end",
"def register_method(method, &block)\n self.class.register_method(method, &block)\n end",
"def register_agent(protocol, method)\n @agents[protocol] ||= []\n @agents[protocol] << method\n end",
"def initialize(matcher = nil, &intercept_block)\n define_method_missing(matcher, &intercept_block) unless matcher.nil?\n end",
"def register_preprocessor(mime_type, klass, &block)\n expire_index!\n\n if block_given?\n name = klass.to_s\n klass = Class.new(Processor) do\n @name = name\n @processor = block\n end\n end\n\n @preprocessors[mime_type].push(klass)\n end",
"def register(hook, obj = T.unsafe(nil), &blk); end",
"def before_method(method)\n @@before_methods << method\n @@wrap_exclusions << method.to_sym # This method will not be wrapped.\n end",
"def register_ctcp(msg, callback)\n @ctcp_callbacks.add(msg.to_s.upcase, callback)\n end",
"def register_command(klass)\n boot.register_command(klass) if boot\n end",
"def register_bundle_processor(mime_type, klass, &block)\n expire_index!\n\n if block_given?\n name = klass.to_s\n klass = Class.new(Processor) do\n @name = name\n @processor = block\n end\n end\n\n @bundle_processors[mime_type].push(klass)\n end",
"def register(const)\n return if registered?(const)\n\n validate_plugin!(const)\n\n @@extensions << const\n end",
"def register_command(klass)\n @command_classes << klass\n end",
"def register_command(klass)\n @command_classes << klass\n end",
"def register_preprocessor(mime_type, klass, &block)\n mutate_hash_config(:preprocessors, mime_type) do |processors|\n processors.push(wrap_processor(klass, block))\n processors\n end\n end",
"def register(byte, type)\n MAPPINGS[byte] = type\n end",
"def register(event = nil, &handler)\r\n \r\n @handler = handler\r\n @event_type = event\r\n \r\n @event_type = :any unless event\r\n \r\n if @event_type == :any\r\n handler.instance_eval(&handler)\r\n end\r\n \r\n end",
"def instrument\n proc do\n ActiveSupport::Notifications.publish(\"start_middleware.coach\", middleware_event)\n\n ActiveSupport::Notifications.\n instrument(\"finish_middleware.coach\", middleware_event) { call }\n end\n end",
"def register_shipping_processor mod\n @shipping_processors ||= {}\n uniq_code = mod.name\n return unless verify_uniq_shipping_processor uniq_code\n return unless verify_shipping_module mod\n install_shipping_processor uniq_code, mod\n end",
"def register_observer(observer, cmd_name=nil)\n codes= []\n if cmd_name\n codes << Protocol.find_cmd_by_name(cmd_name).code\n else\n codes+= CMDS_BY_CODE.keys\n end\n codes.each {|code|\n list= @observers[code]\n if list.nil?\n @observers[code]= list= []\n end\n list.push(observer)\n }\n end",
"def use(middleware)\n @middlewares << middleware\n end",
"def register(mime, klass, orm = ORM_ACTIVERECORD)\n k = @map[mime]\n if k\n k[orm] = klass\n else\n @map[mime] = { orm => klass }\n end\n end",
"def stub_twilio_request\n allow_any_instance_of(TwilioService).to receive(:send_message)\nend",
"def on_message(&processor_block)\n raise \"Message processor already registered\" if @message_processor\n @message_processor = processor_block\n end",
"def register_inbound_handler(handler)\n\t\t@inbound_handlers << handler\n\tend",
"def register(mutex)\n locks.add(mutex)\n end",
"def register extension = nil, &block\n if block_given?\n registered << block\n elsif extension\n registered << resolve_class(extension)\n end \n end",
"def register(message_type, message_subtype = nil, &listener)\n _register(message_type, message_subtype, listener)\n end",
"def register(actor, prefix = nil)\n @registry.register(actor, prefix)\n end",
"def decorate(klass) #:nodoc:\n registered.each do |plugin|\n name = plugin.name.split(/::/).last.gsub(/([A-Z])/, '_\\1').downcase.\n sub(/^_/, '')\n ivar = \"@#{name}\"\n\n klass.send(:define_method, name) do\n instance = instance_variable_defined?(ivar) &&\n instance_variable_get(ivar)\n\n instance ||= instance_variable_set(ivar, plugin.new(self))\n end\n end\n end",
"def register_receiver(target, source, options={})\n receivers[source] = target\n target.send(:extend, Communicator::ActiveRecordIntegration::ClassMethods)\n target.send(:include, Communicator::ActiveRecordIntegration::InstanceMethods)\n\n target.skip_remote_attributes(*options[:except]) if options[:except]\n Communicator.logger.info \"Registered #{target} as receiver for messages from #{source}\"\n \n target\n end",
"def register_side_effect(side_effect)\n @side_effects << side_effect\n end",
"def register_honeypot(data)\n raise NotImplementedError\n end",
"def register(key, callable)\n actions[key.to_sym] = callable\n end",
"def intercept(klass,mname,&blk)\n unless klass.class == Class || klass.class == Module\n fail \"first arg to intercept_method should be a class or module\"\n end\n mname = mname.to_sym\n old_method = klass.instance_method mname\n # old_method is unbound at this point\n\n# new_meth = instrument_method(klass,mname,old_method,blk)\n# klass.class_eval {define_method mname, &new_meth}\n @klasses[klass] = {} unless @klasses.key? klass \n @klasses[klass][mname] = [old_method,blk]\n @frame_skips[klass] = {} unless @frame_skips.key? klass\n @frame_skips[klass][mname] = 1\n end",
"def middleware(value = nil, &block)\n __define__(:middleware, value, block)\n end",
"def register(type, cls); end",
"def register(name)\n Assertion.register_macro name, self\n end",
"def remove_interceptor(klass)\n raise ServerAlreadyStartedError if @started\n @interceptors.remove(klass)\n end",
"def register(params)\n # @message = params[\"message\"]\n end",
"def inject(carrier, context: Context.current, setter: Context::Propagation.text_map_setter)\n @injector.inject(carrier, context, setter)\n rescue => e # rubocop:disable Style/RescueStandardError\n OpenTelemetry.logger.warn \"Error in Propagator#inject #{e.message}\"\n carrier\n end",
"def register_filter(mod); end",
"def insert_before(before, new_middleware)\n @mutex.synchronize do\n return if @disabled_middleware.include?(new_middleware)\n return if @middlewares.include?(new_middleware)\n\n if before.is_a? Array\n index = @middlewares.index {|el| before.include?(el)}\n else\n index = @middlewares.index(before)\n end\n\n @middlewares.insert index || @middlewares.length, new_middleware\n end\n end",
"def use ware, *args, &proc\n @middleware << {ware: ware, args: args, block: proc} if configurable?\n end",
"def remove_interceptor(klass)\n raise ServerAlreadyStartedError if @started\n\n @interceptors.remove(klass)\n end",
"def register_payment_processor mod\n @payment_processors ||= {}\n uniq_code = mod.name\n return unless verify_uniq_payment_processor uniq_code\n return unless verify_payment_module mod\n install_payment_processor uniq_code, mod\n end",
"def intercept_args(klass,mname,&blk)\n unless klass.class == Class || klass.class == Module\n fail \"first arg to intercept_method should be a class or module\"\n end\n mname = mname.to_sym\n unbound_method = klass.instance_method mname\n \n wrap = lambda do |old,*args|\n record_loc(klass,mname,blk.call(*args))\n old.call(*args)\n end\n\n @klasses[klass] = {} unless @klasses.key? klass \n @klasses[klass][mname] = [unbound_method,wrap]\n @frame_skips[klass] = {} unless @frame_skips.key? klass\n @frame_skips[klass][mname] = 4\n new_meth = instrument_method(klass,mname,unbound_method,wrap)\n klass.class_eval {define_method mname, &new_meth}\n end",
"def allow_registration(method); end",
"def register_hook(name, hook)\n hooks[name.to_s.downcase.strip.to_sym] << hook\n end",
"def sms=(arg)\n raise ArgumentError, \"sms expects a string, not a #{arg.class}\" unless arg.is_a?(String)\n @sms = arg\n end",
"def register(object); end",
"def inject(carrier, context, &setter)\n return carrier unless (correlations = context[ContextKeys.correlation_context_key]) && !correlations.empty?\n\n setter ||= default_setter\n setter.call(carrier, @correlation_context_key, encode(correlations))\n\n carrier\n end",
"def incoming(symbol, options = {})\n previous = class_variable_defined?(:@@internal) ?\n class_variable_get(:@@internal) :\n []\n\n attr = { handler: symbol, external_key: symbol }\n\n attr.store(:external_key, options[:as]) if options.has_key?(:as)\n\n class_variable_set(:@@internal, previous.push(attr))\n end",
"def register(processor)\n return false if @processors.include? processor\n @processors[processor] = true\n end",
"def use(middleware, *args, &block)\n @rack_middleware << [middleware, args, block]\n end",
"def register_instance 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_register_instance_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::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def decorate(method, *klasses)\n klasses.each do |klass|\n original_name = \"#{method}_before_#{klass}\".to_sym\n alias_method original_name, method\n define_method method do |*args|\n klass.new(send(original_name, *args))\n end\n end\n end",
"def register_bundle_processor(mime_type, klass, &block)\n mutate_hash_config(:bundle_processors, mime_type) do |processors|\n processors.push(wrap_processor(klass, block))\n processors\n end\n end",
"def interceptors_mutex(&block)\n @interceptors_mutex ||= begin\n require 'monitor'\n Monitor.new\n end\n @interceptors_mutex.synchronize(&block)\n end",
"def on_request( &block )\n @preprocessor = block\n end",
"def register_callable(modes: {}, header:, verbose: nil, interactive: nil, header_color: nil, row_color: nil, &b)\n modes = modes.map { |m| [m, true] }.to_h if modes.is_a? Array\n super(modes: modes.merge(verbose: verbose, interactive: interactive),\n header: header,\n header_color: header_color,\n row_color: row_color,\n &b)\n end",
"def register_proxy(proxy)\n @proxy_map[proxy.name] = proxy\n proxy.on_register\n end",
"def register(keyword, command)\n @aliases.register(keyword.to_sym) do\n lambda do |args|\n # directly execute shell commands\n if command.start_with?(\"!\")\n return Util::SafeExec.exec \"#{command[1..-1]} #{args.join(\" \")}\".strip\n end\n\n return CLI.new(command.split.concat(args), @env).execute\n end\n end\n end"
] |
[
"0.59021276",
"0.55795234",
"0.5575204",
"0.53699553",
"0.5249061",
"0.5235346",
"0.49543458",
"0.48993805",
"0.48193035",
"0.4788649",
"0.4740327",
"0.47201663",
"0.46990988",
"0.46858713",
"0.46667594",
"0.46568",
"0.4645143",
"0.46406376",
"0.46191972",
"0.4602056",
"0.4599937",
"0.45981762",
"0.456538",
"0.4560667",
"0.45477942",
"0.4526764",
"0.4513231",
"0.45100215",
"0.4490912",
"0.4483059",
"0.44742593",
"0.4472284",
"0.44318125",
"0.4425544",
"0.44201592",
"0.44140372",
"0.4408991",
"0.43985432",
"0.43955964",
"0.43924046",
"0.43843314",
"0.43754894",
"0.43724576",
"0.43580917",
"0.4352088",
"0.43469658",
"0.43423742",
"0.43336773",
"0.43197316",
"0.43159997",
"0.43159997",
"0.4310588",
"0.43096298",
"0.43046698",
"0.43036932",
"0.42880967",
"0.4280437",
"0.4265471",
"0.4265261",
"0.42541978",
"0.42522308",
"0.4247674",
"0.42453408",
"0.42429382",
"0.423945",
"0.4238079",
"0.42370445",
"0.42354023",
"0.4231422",
"0.42314214",
"0.4230473",
"0.42237097",
"0.42200103",
"0.42130476",
"0.42068583",
"0.42033175",
"0.41997027",
"0.4192821",
"0.41923213",
"0.4187649",
"0.41850168",
"0.41765356",
"0.4170158",
"0.4165193",
"0.41443753",
"0.414319",
"0.4143002",
"0.41375017",
"0.41345683",
"0.41292456",
"0.41182876",
"0.41159564",
"0.41153714",
"0.41124237",
"0.4105495",
"0.4100963",
"0.409863",
"0.40909836",
"0.40892476",
"0.40865996"
] |
0.7562432
|
0
|
Returns the name of current carrier. If this is an anonymous carrier, this method will return +anonymous+ instead.
|
def carrier_name
@carrier_name ||= anonymous? ? "anonymous" : name.underscore
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def carrier_name\r\n self.class.carrier_name\r\n end",
"def carrier_code\n @raw_data[:CarrierCode]\n end",
"def get_carrier\n return self.sendcmd(\"modem.get_carrier\")\n end",
"def carrier_named(str)\n format(str, @carrier)\n end",
"def carrier_named(str)\n format(str, carrier)\n end",
"def carrier_by_value(carrier)\n phone_carrier = case carrier.class.to_s\n when 'Symbol', 'String' then find_by_name(carrier)\n when \"#{self.class.to_s}\" then carrier\n when 'Fixnum' then find_by_id(carrier)\n else nil\n end\n end",
"def name\n [phone.brand, phone.model].join(\" \")\n end",
"def federation_brand_name\n return @federation_brand_name\n end",
"def payer_name\n if @payer_party\n @payer_party.name\n else\n @payer\n end\n end",
"def carrier_ip\n data[:carrier_ip]\n end",
"def receiver_name\n if self.has_registered_receiver?\n \"#{self.receiver.name}\"\n else\n self.to_receiver.name_and_email\n end\n end",
"def payer_name\n\t\tif payment_instrument_type == 'paypal_account'\n\t\t\treturn payer_first_name + \" \" + payer_last_name\n\t\telse\n\t\t\tif billing_last_name.nil? || billing_first_name.nil?\n\t\t\t\treturn \"Unspecified\"\n\t\t\telse\n\t\t\t\treturn billing_first_name + \" \" + billing_last_name\n\t\t\tend\n\t\tend\n\tend",
"def get_name\n \"#{@manufacturer} #{@model}\"\n end",
"def filer_name\n @filing.filer_name\n end",
"def sender_number\n if self.respond_to? :carrier\n return self[:number]\n else \n return self[:from]\n end\n end",
"def country_name\n cc = carmen_country\n\n cc ? \"#{cc.name}\" : ''\n end",
"def the_sender_name\n sender.full_name(false, created_at)\n end",
"def display_name\n self.device_name || \"#{vendor} #{model}\"\n end",
"def get_name()\n return @me.uname if @me.brother.nil?\n return @me.brother.full_name\n end",
"def other_party_name(current_user_id)\n return receiver.name if current_user_id == sender_id\n sender.name\n end",
"def display_device_name\n return @display_device_name\n end",
"def customer_name\n company.blank? ? full_name : \"#{company} (#{full_name})\"\n end",
"def customer_name\n company.blank? ? full_name : \"#{company} (#{full_name})\"\n end",
"def device_display_name\n return @device_display_name\n end",
"def device_display_name\n return @device_display_name\n end",
"def merchant_name\n\t\tm = Merchant.find_by_id(merchant_id)\n\t\treturn m.name\n\tend",
"def name\n @gapi[\"displayName\"]\n end",
"def device_name\n return @device_name\n end",
"def device_name\n return @device_name\n end",
"def device_name\n return @device_name\n end",
"def billing_name\n company.blank? ? full_name : \"#{full_name} (#{company})\"\n end",
"def name\n company.blank? ? full_name : \"#{company} (#{full_name})\"\n end",
"def brand_name\n product.brand_name\n end",
"def display_name\n name\n end",
"def brand\n cc_type\n end",
"def name\n @display_name || @name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def mailboxer_name\n return \"#{name}\"\n end",
"def current_company_name\n begin\n Client.find(current_subdomain).webname\n rescue\n \"\"\n end\n end",
"def sender_name\n @stanza.from.resource\n end",
"def brand_name\n maintenance_record_hub.try(:brand) || car.try(:brand_name)\n end",
"def derived_name\n return controller_name if respond_to?(:controller_name)\n return model_name.plural if respond_to?(:model_name)\n name ? name.underscore.pluralize : nil\n end",
"def gateway_name\n gateway[:name]\n end",
"def display_name\n NAME\n end",
"def display_name\n NAME\n end",
"def display_name\n name\n end",
"def display_name\n name\n end",
"def getName()\n\t\t\treturn @_name\n\t\tend",
"def current_zone_name\n zone = @master_zone\n return GameData::Zone.get(zone).map_name if zone\n UNKNOWN_ZONE\n end",
"def family_name\n get_attribute(Yoti::Attribute::FAMILY_NAME)\n end",
"def name_for_clearinghouse \n clearinghouse_customer_name || name\n end",
"def get_name\n return @m_name\n end",
"def get_name\n return @m_name\n end",
"def get_name\n return @m_name\n end",
"def get_name\n return @m_name\n end",
"def display_name\n return @display_name\n end",
"def client_name\r\n self.name.strip.upcase\r\n end"
] |
[
"0.8495651",
"0.68502456",
"0.66989446",
"0.65293354",
"0.6158759",
"0.60516113",
"0.5974905",
"0.5963875",
"0.5916474",
"0.5898807",
"0.58903426",
"0.5866937",
"0.57878906",
"0.57865316",
"0.57840097",
"0.5755189",
"0.57543296",
"0.568458",
"0.56831473",
"0.5657896",
"0.5652117",
"0.5650148",
"0.5650148",
"0.564908",
"0.564908",
"0.5648064",
"0.5608206",
"0.5591834",
"0.5591834",
"0.5591834",
"0.55855215",
"0.5582682",
"0.55669343",
"0.5542105",
"0.5536659",
"0.5503386",
"0.55014455",
"0.55014455",
"0.55014455",
"0.55014455",
"0.55014455",
"0.55014455",
"0.55014455",
"0.55014455",
"0.55014455",
"0.55014455",
"0.55014455",
"0.55014455",
"0.55014455",
"0.55014455",
"0.55014455",
"0.55014455",
"0.55014455",
"0.55014455",
"0.55014455",
"0.55014455",
"0.55014455",
"0.55014455",
"0.55014455",
"0.55014455",
"0.55014455",
"0.55014455",
"0.55014455",
"0.55014455",
"0.55014455",
"0.55014455",
"0.55014455",
"0.55014455",
"0.55014455",
"0.55014455",
"0.55014455",
"0.55014455",
"0.55014455",
"0.55014455",
"0.55014455",
"0.55014455",
"0.55014455",
"0.55014455",
"0.55014455",
"0.55014455",
"0.54941726",
"0.5490796",
"0.54715437",
"0.5463077",
"0.54551953",
"0.5448801",
"0.54438555",
"0.54438555",
"0.5433433",
"0.5433433",
"0.542284",
"0.5422077",
"0.5421748",
"0.5416117",
"0.541565",
"0.541565",
"0.541565",
"0.541565",
"0.5405454",
"0.5392591"
] |
0.8844491
|
0
|
Sets the defaults through app configuration: config.sms_carrier.default(from: "+886987654321") Aliased by ::default_options=
|
def default(value = nil)
self.default_params = default_params.merge(value).freeze if value
default_params
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def default_options\n {\n appid: app_id,\n device_id: device_id,\n locale: locale,\n ip: ip,\n offer_types: offer_types,\n timestamp: Time.now.to_i\n }\n end",
"def set_defaults!\n __load_config( DEFAULTS )\n end",
"def default(options = {})\n options.symbolize_keys!\n options.assert_valid_keys(:mailer_class, :mailer, :using, :batch_size)\n @defaults = options\n end",
"def default_options\n {\n name: '', # Name\n description: '', # Description\n type: 0, # 0 - Email, 1 - External script, 2 - SMS, 3 - Jabber, 100 - EzTexting\n smtp_server: '',\n smtp_helo: '',\n smtp_email: '', # Email address of Zabbix server\n exec_path: '', # Name of external script\n gsm_modem: '', # Serial device name of GSM modem\n username: '', # Jabber user name used by Zabbix server\n passwd: '' # Jabber password used by Zabbix server\n }\n end",
"def default_options\n {\n :description => '', # Name\n :type => 0, # 0 - Email, 1 - External script, 2 - SMS, 3 - Jabber, 100 - EzTexting\n :smtp_server => '',\n :smtp_helo => '',\n :smtp_email => '', # Email address of Zabbix server\n :exec_path => '', # Name of external script\n :gsm_modem => '', # Serial device name of GSM modem\n :username => '', # Jabber user name used by Zabbix server\n :passwd => '' # Jabber password used by Zabbix server\n }\n end",
"def set_default_options\n end",
"def set_defaults\n end",
"def set_defaults\n end",
"def set_defaults\n\n end",
"def set_defaults\n\n end",
"def set_defaults\n\n end",
"def set_defaults\n\n end",
"def set_defaults\n\n end",
"def set_defaults\n\n end",
"def defaults\n {\n # Database identifier, defaults to 'sqlite://<BILLTRAP_HOME>/.billtrap.db'\n 'database' => \"sqlite://#{BILLTRAP_HOME}/billtrap.db\",\n # Timetrap database, used to import Entries\n 'timetrap_database' => \"sqlite://#{ENV['HOME']}/.timetrap.db\",\n # We'll also need the round specifier\n 'round_in_seconds' => 900,\n\t\t\t\t# Path to invoice archive\n\t\t\t\t'billtrap_archive' => \"#{ENV['HOME']}/Documents/billtrap/invoices\",\n # Currency to use (see RubyMoney for codes)\n 'currency' => 'USD',\n # Default rate in the above currency\n 'default_rate' => '25.00',\n\t\t\t\t# Invoice numbering scheme\n # TODO possible values\n\t\t\t\t'invoice_number_format' => \"%Y%m%d_%{invoice_id}\",\n # Money formatter\n # See http://rubydoc.info/gems/money/Money/Formatting for options\n 'currency_format' => { :with_currency => true , :symbol => false},\n # Date output format\n 'date_format' => '%Y-%m-%d',\n\t\t\t\t# Due date in days\n\t\t\t\t'due_date' => 30,\n # Default invoice adapter to use when none is specified\n 'default_formatter' => 'serenity',\n # Serenity adapter: Path to invoice template\n 'serenity_template' => \"#{BILLTRAP_HOME}/.billtrap_template.odt\",\n }\n end",
"def defaults(attributes=nil)\n if attributes.nil? # Retrieve the default values\n @app.respond_to?(:mailer_defaults) ? @app.mailer_defaults.merge(@defaults) : @defaults\n else # updates the default values\n @defaults = attributes\n end\n end",
"def default_options\n { voice: 'en',\n pitch: 50,\n speed: 170,\n capital: 1,\n amplitude: 100,\n quiet: true }\n end",
"def default\n\t {\n\t appid: 157,\n\t device_id: '2b6f0cc904d137be2 e1730235f5664094b 831186',\n\t locale: 'de',\n\t ip: '109.235.143.113',\n\t offer_types: 112,\n\t timestamp: Time.now.to_i,\n\t format: FORMAT\n\t }\n\tend",
"def set_defaults\n self.emailing_sections.each do |section|\n section.set_defaults\n end\n end",
"def default\n config = get\n return true unless config\n configure(\"default router bgp #{config[:bgp_as]}\")\n end",
"def configDefaults(config)\n end",
"def make_default!\n ::Stripe::Customer.update(customer.processor_id, {invoice_settings: {default_payment_method: processor_id}}, stripe_options)\n end",
"def default_options\n {\n :name => nil,\n :key_ => nil,\n :hostid => nil,\n :delay => 60,\n :history => 60,\n :status => 0,\n :type => 7,\n :snmp_community => '',\n :snmp_oid => '',\n :value_type => 3,\n :data_type => 0,\n :trapper_hosts => 'localhost',\n :snmp_port => 161,\n :units => '',\n :multiplier => 0,\n :delta => 0,\n :snmpv3_securityname => '',\n :snmpv3_securitylevel => 0,\n :snmpv3_authpassphrase => '',\n :snmpv3_privpassphrase => '',\n :formula => 0,\n :trends => 365,\n :logtimefmt => '',\n :valuemapid => 0,\n :delay_flex => '',\n :authtype => 0,\n :username => '',\n :password => '',\n :publickey => '',\n :privatekey => '',\n :params => '',\n :ipmi_sensor => '',\n }\n end",
"def set_defaults\n if self.project.present?\n self.currency = self.project.account.account_setting.default_currency\n end\n \n self.quote_status = 0\n self.vat_rate = 20.0\n self.discount_percentage = 0.0\n self.new_quote = 1\n end",
"def default_contact_street\n Refinery::Setting.find_or_set(:street, \"Sesamestreet\")\n end",
"def default_options; end",
"def default_options; end",
"def default_options; end",
"def init_default_config\n configuration.project_id ||= Debugger.default_project_id\n configuration.credentials ||= Debugger.default_credentials\n configuration.service_name ||= Debugger.default_service_name\n configuration.service_version ||= Debugger.default_service_version\n end",
"def configuration_defaults(&block)\n @configuration_defaults = block\n end",
"def defaults_for( name, &block )\n ::Loquacious::Configuration.defaults_for(name, &block)\n end",
"def default_options\n recurly_settings = Settings.recurly\n {\n company_subdomain: recurly_settings.company_subdomain,\n default_currency: recurly_settings.default_currency\n }\n end",
"def default_options; {} end",
"def default_options\n @default_options ||= {}\n end",
"def default_message_options\n @default_message_options ||= {type: 'message'}\n end",
"def default_receipt_config\n c_hsh =['FeeReceiptStartingNumber','FeeReceiptPrefix']\n config = Configuration.get_multiple_configs_as_hash c_hsh\n [config[:fee_receipt_prefix], config[:fee_receipt_starting_number]]\n end",
"def default_settings\n {\n :ctrip_username => '',\n :ctrip_password => '',\n :ctrip_hotel_id => '',\n :ctrip_code_context => '',\n\n :ctrip_company_code => 'C',\n\n # 10 is for Channel Manager (see Ctrip Integration API Specification V2.2.pdf)\n # While 1 is for indifidual hotel.\n :ctrip_user_category => 10\n }\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 default_configuration!\n # Overwriting Sinatra defaults\n set :app_file, caller_files.first || $0 # Assume app file is first caller\n set :environment, Padrino.env\n set :raise_errors, true if development?\n set :logging, false # !test?\n set :sessions, true\n set :public, Proc.new { Padrino.root('public', self.uri_root) }\n # Padrino specific\n set :uri_root, \"/\"\n set :reload, development?\n set :app_name, self.to_s.underscore.to_sym\n set :default_builder, 'StandardFormBuilder'\n set :flash, defined?(Rack::Flash)\n set :authentication, false\n # Padrino locale\n set :locale_path, Proc.new { Dir[File.join(self.root, \"/locale/**/*.{rb,yml}\")] }\n set :auto_locale, false\n # Plugin specific\n set :padrino_mailer, defined?(Padrino::Mailer)\n set :padrino_helpers, defined?(Padrino::Helpers)\n end",
"def set_default\n cmd = \"{\\\"id\\\":8,\\\"method\\\":\\\"set_default\\\",\\\"params\\\":[]}\\r\\n\"\n request(cmd)\n end",
"def initialize_user_settings_defaults\n self.disabled_sports = []\n self.locale = 'en'\n self.device_ids = []\n end",
"def default(defaults)\n defaults.each do |key, value|\n self.settings[key] = value unless self.settings.key? key\n end\n end",
"def defaults!\n @badge_enabled = true\n @badge_position = 'top-left'\n @page_size = 25\n @webpacker_enabled = true\n end",
"def set_conf_default(conf)\n end",
"def set_conf_default(conf)\n end",
"def configure_default(defaults, key, *args)\n defaults[key] = args[0] unless args.empty?\n end",
"def default_options\n { }\n end",
"def set_defaults\n self.country ||= 'Sverige'\n end",
"def default_config\n {}\n end",
"def default_adapter_options=(_arg0); end",
"def default_adapter_options=(_arg0); end",
"def default_options=(opts); end",
"def default_config\n config = {}\n config['webhook_url'] = nil\n\n return config\n end",
"def set_sane_defaults\n self.connection_timeout ||= 20\n self.max_send_size = 0 if self.max_send_size.nil?\n self.send_delay = 0 if self.send_delay.nil?\n self.uri = '/' if self.uri.blank?\n self.method = 'GET' if self.method.blank?\n\n # Note that this doesn't cover the case where ssl is unset and\n # port is something other than a default. In that situtation,\n # we don't know what the user has in mind so we have to trust\n # that they're going to do something sane.\n if !(self.ssl) && self.port.nil?\n self.port = self.class::DEFAULT_PORT\n self.ssl = false\n elsif self.ssl && self.port.nil?\n self.port = self.class::DEFAULT_SSL_PORT\n elsif self.ssl.nil? && self.port == self.class::DEFAULT_PORT\n self.ssl = false\n elsif self.ssl.nil? && self.port == self.class::DEFAULT_SSL_PORT\n self.ssl = true\n end\n\n nil\n end",
"def merge_defaults(options = {})\n\t\t\tdefaults = {}\n\t\t\t# defaults[:character_name] = @charater_name if @charater_name\n\t\t\t# defaults[:guild_name]\t= @guild_name if @guild_name\n\t\t\tdefaults[:realm] \t\t\t\t\t= @realm \t\t\t\t\tif @realm\n\t\t\tdefaults[:locale] \t\t\t\t= @locale \t\t\t\tif @locale\n\t\t\tdefaults[:lang] \t\t\t\t\t= @lang \t\t\t\t\tif @lang\n\t\t\tdefaults[:caching] \t\t\t\t= @caching \t\t\t\tif @caching\n\t\t\tdefaults[:cache_timeout] \t= @cache_timeout \tif @cache_timeout\n\t\t\tdefaults[:debug] \t\t\t\t\t= @debug \t\t\t\t\tif @debug\n\t\t\tdefaults[:rate_limit] = @rate_limit if @rate_limit\n\t\t\t\n\t\t\t# overwrite defaults with any given options\n\t\t\tdefaults.merge!(options)\n\t\tend",
"def set_defaults\n default_user_agent = Config.user_agent || Typhoeus::USER_AGENT\n\n options[:headers] = {'User-Agent' => default_user_agent}.merge(options[:headers] || {})\n options[:headers]['Expect'] ||= ''\n options[:verbose] = Typhoeus::Config.verbose if options[:verbose].nil? && !Typhoeus::Config.verbose.nil?\n options[:maxredirs] ||= 50\n options[:proxy] = Typhoeus::Config.proxy unless options.has_key?(:proxy) || Typhoeus::Config.proxy.nil?\n end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def default!\n clear.merge!(defaults)\n end",
"def default_settings\n {}\n end",
"def default_values\n self.communication_email ||= self.email\n end",
"def initialize_defaults(method_name)\n @charset ||= self.class.default[:charset].try(:dup)\n @content_type ||= self.class.default[:content_type].try(:dup)\n @implicit_parts_order ||= self.class.default[:parts_order].try(:dup)\n @mime_version ||= self.class.default[:mime_version].try(:dup)\n\n @cc, @bcc, @reply_to, @subject, @from, @recipients = nil, nil, nil, nil, nil, nil\n\n @mailer_name ||= self.class.mailer_name.dup\n @template ||= method_name\n @mail_was_called = false\n\n @parts ||= []\n @headers ||= {}\n @sent_on ||= Time.now\n @body ||= {}\n end",
"def init_config()\n options_apply_filter(\"DEFAULT\")\n end",
"def default\n # setup default configuration\n @code_send_repeats = 10\n self.set_timer( frequency: 36_000, duty: 0.45 )\n self.indicator = false\n self.broadcasting_gap = 0.1 # seconds between each pulse\n usb_set_indicator_as_debug_light( wValue: 0 ) # turn off debugging light mode\n self # return self for nifty chaining\n end",
"def default_phone_numbers\n self.phone_numbers_by_country(nil)\n end",
"def defaults\n super\n end",
"def default_options\n DEFAULT_OPTIONS\n end",
"def default\n options[:default]\n end",
"def default_url_options(options = {})\n # use merge to keep current params\n options.merge({ locale: ((I18n.locale == I18n.default_locale) ? nil : I18n.locale) })\n #options.merge({ locale: I18n.locale})\n end",
"def default_config\n self.class.config[:default_config].nil? ? {} : {}.merge(self.class.config[:default_config])\n end",
"def set_defaults(options = T.unsafe(nil)); end",
"def default_configuration=(_arg0); end",
"def defaults(options = nil)\n @defaults ||= default_options\n if options\n @defaults = default_options.merge!(options)\n else\n @defaults\n end\n end",
"def defaults(options = nil)\n @defaults ||= default_options\n if options\n @defaults = default_options.merge!(options)\n else\n @defaults\n end\n end",
"def merge_defaults(options = {})\n\t\t\tdefaults = {}\n\t\t\t# defaults[:character_name] = @charater_name if @charater_name\n\t\t\t# defaults[:guild_name]\t= @guild_name if @guild_name\n\t\t\tdefaults[:realm] \t\t= @realm \t\tif @realm\n\t\t\tdefaults[:locale] \t= @locale \tif @locale\n\t\t\tdefaults[:lang] \t\t= @lang \t\tif @lang\n\t\t\tdefaults[:caching] \t= @caching \tif @caching\n\t\t\tdefaults[:debug] \t\t= @debug \t\tif @debug\n\t\t\t\n\t\t\t# overwrite defaults with any given options\n\t\t\tdefaults.merge!(options)\n\t\tend",
"def defaults\n @__defaults = Settingson::Store::Default.new( klass: self )\n\n if block_given?\n Rails.application.config.after_initialize do\n yield @__defaults\n end\n end\n\n @__defaults\n end",
"def default_billing_address(options={})\n unless self.billing_address\n self.build_billing_address(options.merge({\n :company_name => self.company_name, :academic_title_id => self.academic_title_id, :gender => self.gender,\n :first_name => self.first_name, :last_name => self.last_name,\n :street => self.business_address.street, :street_number => self.business_address.street_number,\n :note => self.business_address.note, :postal_code => self.business_address.postal_code,\n :city => self.business_address.city, :country_code => self.business_address.country_code,\n :email => self.email}))\n else\n self.billing_address\n end\n end",
"def defaults\n {\n client: nil,\n name: '',\n }\n end",
"def default_options\n # {}\n end",
"def default_sender\n DEFAULT_SENDER\n end",
"def set_default_values\n self.synced_with_gram = false\n end",
"def set_default_values\n self.synced_with_gram = false\n end",
"def setup_delivery\n method = @config.delivery['method'] || :smtp\n options = @config.delivery['options'] || {}\n\n options.keys.each do |key|\n options[(key.to_sym rescue key) || key] = options.delete(key)\n end\n\n options = Idid::Configuration::SMTP_DEFAULTS.merge options if method == :smtp\n options = Idid::Configuration::EXIM_DEFAULTS.merge options if method == :exim\n\n mail_defaults_for method, options\n end",
"def set_defaults\n self.mmr ||= 1500\n self.k_value ||= 40\n self.home_mmr ||= self.mmr\n self.away_mmr ||= self.mmr\n self.active ||= true\n self.total_games ||= 0\n end",
"def set_defaults\n self.subdomain ||= \"app\"\n end",
"def default_phone=(default_phone)\n\n if !default_phone.nil? && default_phone.to_s.length > 15\n fail ArgumentError, \"invalid value for 'default_phone', the character length must be smaller than or equal to 15.\"\n end\n\n @default_phone = default_phone\n end",
"def defaults!\n self.max_retries = 5\n self.retry_delay = 10\n end",
"def defaults!\n self.max_retries = 5\n self.retry_delay = 10\n end",
"def init_default_config\n configuration.project_id ||= (Cloud.configure.project_id || ErrorReporting::Project.default_project_id)\n configuration.credentials ||= Cloud.configure.credentials\n configuration.service_name ||= ErrorReporting::Project.default_service_name\n configuration.service_version ||= ErrorReporting::Project.default_service_version\n configuration.ignore_classes = Array(configuration.ignore_classes)\n end",
"def default_options\n { \"token_credential_uri\" => self.class::TOKEN_CREDENTIAL_URI,\n \"audience\" => self.class::AUDIENCE,\n \"scope\" => self.class::SCOPE }\n end",
"def configured_default\n @options[:default] || default_entry\n end",
"def default_config\n <<~CONFIG\n defaults: &defaults\n data_root: data\n candidates_root: zzz_candidates\n departed_root: zzz_departed\n project_root: projects\n editor: code\n feedback_polarity_default: positive\n meeting_location_default: alcove\n log_filename: log.adoc\n overview_filename: overview.adoc\n pto_default: vacation\n voip_meeting_default: Zoom\n\n development:\n # <<: *defaults\n data_root: data\n candidates_root: zzz_candidates\n departed_root: zzz_departed\n project_root: projects\n editor: code\n feedback_polarity_default: positive\n meeting_location_default: alcove\n log_filename: log.adoc\n overview_filename: overview.adoc\n pto_default: vacation\n voip_meeting_default: Zoom\n\n test:\n # <<: *defaults\n data_root: data\n candidates_root: zzz_candidates\n departed_root: zzz_departed\n project_root: projects\n editor: code\n feedback_polarity_default: positive\n meeting_location_default: alcove\n log_filename: log.adoc\n overview_filename: overview.adoc\n pto_default: vacation\n voip_meeting_default: Zoom\n\n production:\n # <<: *defaults\n data_root: data\n candidates_root: zzz_candidates\n departed_root: zzz_departed\n project_root: projects\n editor: code\n feedback_polarity_default: positive\n meeting_location_default: alcove\n log_filename: log.adoc\n overview_filename: overview.adoc\n pto_default: vacation\n voip_meeting_default: Zoom\n CONFIG\n end",
"def default_options\n {}\n end"
] |
[
"0.6775421",
"0.6588495",
"0.65129876",
"0.64122325",
"0.63508976",
"0.62678385",
"0.6261237",
"0.6261237",
"0.6217607",
"0.6217607",
"0.6217607",
"0.6217607",
"0.6217607",
"0.6217607",
"0.6184522",
"0.61431485",
"0.6136129",
"0.6120609",
"0.60916364",
"0.60627145",
"0.6053778",
"0.6002425",
"0.5960957",
"0.59363157",
"0.59200543",
"0.5919251",
"0.5919251",
"0.5919251",
"0.58775663",
"0.58745563",
"0.58672416",
"0.5865014",
"0.5839627",
"0.58269644",
"0.58200043",
"0.581482",
"0.5805248",
"0.57843834",
"0.57780737",
"0.5768724",
"0.575736",
"0.5751284",
"0.57500386",
"0.5745162",
"0.5745162",
"0.57436913",
"0.5724368",
"0.5722671",
"0.5716061",
"0.57114625",
"0.57114625",
"0.5710899",
"0.5709011",
"0.5686715",
"0.56819135",
"0.56666344",
"0.56655645",
"0.56655645",
"0.56655645",
"0.56655645",
"0.56655645",
"0.56655645",
"0.56655645",
"0.56655645",
"0.56655645",
"0.56655645",
"0.56618947",
"0.56574976",
"0.56528467",
"0.56459165",
"0.5641235",
"0.5640515",
"0.5639436",
"0.5629675",
"0.5625896",
"0.56244844",
"0.5618208",
"0.5617102",
"0.56149614",
"0.5590312",
"0.5589346",
"0.5589346",
"0.55888927",
"0.5588635",
"0.5583863",
"0.55769056",
"0.5576525",
"0.5573457",
"0.5567076",
"0.5567076",
"0.5563798",
"0.5563749",
"0.5562669",
"0.55614275",
"0.5561124",
"0.5561124",
"0.556092",
"0.55602396",
"0.55593646",
"0.5556171",
"0.5552339"
] |
0.0
|
-1
|
Wraps an SMS delivery inside of ActiveSupport::Notifications instrumentation. This method is actually called by the Sms object itself through a callback when you call :deliver on the Sms, calling +deliver_sms+ directly and passing a Sms will do nothing except tell the logger you sent the SMS.
|
def deliver_sms(sms) #:nodoc:
ActiveSupport::Notifications.instrument("deliver.sms_carrier") do |payload|
set_payload_for_sms(payload, sms)
yield # Let Sms do the delivery actions
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def deliver\n #inform_interceptors\n if delivery_handler\n delivery_handler.deliver_sms(self) { do_delivery }\n else\n do_delivery\n end\n inform_observers\n self\n end",
"def deliver!(sms = @sms) #:nodoc:\n raise \"no SMS object available for delivery!\" unless sms\n logger.info \"Sending SMS: #{sms} via #{sms.delivery}\" unless logger.nil?\n \n begin\n send(\"perform_delivery_#{sms.delivery}\", sms) if perform_deliveries\n rescue Exception => e \n raise e if raise_delivery_errors\n end\n \n logger.info \"SMS Sent!\" unless logger.nil?\n return sms\n end",
"def deliver(sms)\n new.deliver!(sms)\n end",
"def sms_side_effects\n old_observers = SmsCarrier::Sms.class_variable_get(:@@delivery_notification_observers)\n old_delivery_interceptors = SmsCarrier::Sms.class_variable_get(:@@delivery_interceptors)\n yield\n ensure\n SmsCarrier::Sms.class_variable_set(:@@delivery_notification_observers, old_observers)\n SmsCarrier::Sms.class_variable_set(:@@delivery_interceptors, old_delivery_interceptors)\n end",
"def inform_observers(sms)\n @@delivery_notification_observers.each do |observer|\n observer.delivered_sms(sms)\n end\n end",
"def deliver(sms)\n create_sms(sms).submit()\n end",
"def deliver\n Outbound.deliver(delivery_options.merge(:conditions => ['sms_service_provider_id = ?', self.provider_id]))\n end",
"def notify_sms (c, order)\r\n\r\n # notify only if not already done! \r\n unless already_notified order\r\n #dump_order = MultiJson.dump order, :pretty => true\r\n \r\n # log order data\r\n @logger.info \"NEW ORDER: #{order[\"order_id\"]} (num products: #{order[\"num_products\"]}, \\\r\nprice: #{order[\"price\"]} #{order[\"currency_code\"]}, current state: #{order[\"current_state\"]})\" \r\n\r\n # format SMS text with order details \r\n message = compose_sms_with_order_details c, order\r\n\r\n # send SMS through Skuby API (interfacing Skebby Gateway)\r\n sms_sent = send_sms(message, @seller_cell_number, @logger) if @send_sms\r\n\r\n @logger.info \"SMS SENT:\\n#{message}\" # if sms_sent #logger.debug\r\n \r\n # if SMS TX is disable, mark as notified anyway (debug)\r\n set_notified! order if (sms_sent || !@send_sms)\r\n\r\n # return status (success/error)\r\n sms_sent\r\n else\r\n true\r\n end\r\nend",
"def send_sms_message(text, to, from)\n deliver_message_via_carrier(text, to, from)\nend",
"def send_now(mnobj = nil, recipient_sms_numbers: nil, generated_text: nil, importance: nil, logger: nil)\n logger ||= Rails.logger\n\n importance ||= self.class.importance\n\n resp = []\n if recipient_sms_numbers\n logger.info 'Sending sms to a defined set of recipients'\n elsif mnobj\n logger.info \"Sending sms for #{mnobj.id}\"\n else\n raise FphsException, 'No message notification or recipient list set for SMS send'\n end\n\n recipient_sms_numbers ||= mnobj.recipient_sms_numbers\n generated_text ||= mnobj.generated_text\n\n raise FphsException, 'No recipients to SMS' unless recipient_sms_numbers&.present?\n\n recipient_sms_numbers.each do |sms_number|\n val = PhoneValidation.validate_sms_number_format sms_number, no_exception: true\n\n if val\n res = send_sms sms_number, generated_text, importance\n resp << { aws_sns_sms_message_id: res.message_id } if res\n else\n resp << { error: BadFormatMsg }\n end\n end\n\n resp.to_json\n end",
"def send_sms(number, subject, carrier, message)\n SMSMailer.sms_mailer(number, subject, carrier, message).deliver_now\n end",
"def send_sms!(msg)\n return false unless sms_alerts and phone_number_is_valid? and not mobile_carrier.blank?\n PersonMailer.send_sms(self, msg).deliver\n end",
"def deliver(params={})\n puts \"**** Message#deliver\" if params[:verbose]\n#puts \"**** Message#deliver response_time_limit=#{self.response_time_limit}\"\n save! if self.new_record?\n deliver_email() if send_email\n deliver_sms(:sms_gateway=>params[:sms_gateway] || default_sms_gateway) if send_sms\n end",
"def deliver_message(options)\n self.sms_service_provider||= default_service_provider\n\n # set the actual message if it differs; not a before_save to reduce the\n # overhead of checking for all commits\n self.actual_message = substituted_draft_message\n\n result = (self.sms_service_provider).send_sms(self)\n self.unique_id = result[:unique_id] if result.is_a?(Hash)\n \n result\n end",
"def deliver\n inform_interceptors\n if delivery_handler\n delivery_handler.deliver_mail(self) { do_delivery }\n else\n do_delivery\n end\n inform_observers\n self\n end",
"def deliver(numbers=@numbers, body=@body, message_id=nil, log=nil)\n # NB: message#deliver_sms currently sends numbers as a string, not an array.\n#puts \"**** Delivering Twilio with @background=#{@background}, numbers=#{numbers}\"\n if numbers.is_a? String\n @numbers = numbers.gsub(\"+\",\"\").split(/,\\s*/) # Convert to array so we can do \"each\"\n else\n @numbers = numbers\n end\n @body = body # ...\n raise('No phone numbers given') unless @numbers\n raise('No message body') unless @body\n # Use delivery system based on the parameter @background [i.e. background processing type]\n case @background\n when /iron/i\n @numbers.count > 1 ? deliver_ironworker : deliver_direct(message_id)\n when /dj|delay.*job/i\n @numbers.count > 1 ? deliver_delayed_job(message_id) : deliver_direct(message_id)\n else\n deliver_direct(message_id)\n end\n AppLog.create(:code => \"SMS.deliver.#{@gateway_name}\", :description=>\"background=#{@background || 'none'}, count = #{@numbers.count} messages\")\n super\n end",
"def deliver(message, options = {})\n options = options.reverse_merge default_options\n to = recipient.respond_to?(:call) ? recipient.call(message) : recipient\n message.body message.body.encode(options[:charset]) if options[:charset].presence\n ActionMailerSMSMailer.forward_sms(to, message, options.compact).deliver_now\n message.to\n end",
"def sms(body, to: nil, from: nil, method: nil, action: nil, status_callback: nil, **keyword_args)\n append(Sms.new(\n body,\n to: to,\n from: from,\n method: method,\n action: action,\n status_callback: status_callback,\n **keyword_args\n ))\n end",
"def deliver(message, *mobiles, **opts)\n attrs = {\n msg: message,\n numbers: numbers(mobiles),\n url_callback: callback\n }.merge(opts)\n rest.get(:sendsms, attrs)['data']\n end",
"def send_sms(sms, options={})\n send_to_phone(sms.phone_number, sms.actual_message, options)\n end",
"def deliver_now!\n processed_smser.handle_exceptions do\n message.deliver!\n end\n end",
"def deliver_now\n processed_smser.handle_exceptions do\n message.deliver\n end\n end",
"def deliver_message_via_carrier(text, to, from)\n SMS_CARRIER.deliver_message(text, to, from)\nend",
"def on_delivery_notification(&blk)\n @on_delivery_notification = blk\n end",
"def send_notifications(unituser, msg)\n user = unituser.user\n user.send_sms(msg)\n UserMailer.send_email(user, user.email, msg).deliver if user.contact_flags[1] == \"1\"\n UserMailer.send_email(user, user.email2, msg).deliver if user.contact_flags[3] == \"1\"\n end",
"def deliver(numbers=@numbers, body=@body)\n # NB: message#deliver_sms currently sends numbers as a string, not an array.\n if numbers.is_a? String\n @numbers = numbers.gsub(\"+\",\"\").split(/,\\s*/) # Convert to array so we can do \"each\"\n else\n @numbers = numbers\n end\n @body = body # ...\n raise('No phone numbers given') unless @numbers\n raise('No message body') unless @body\n iron_worker_client ||= IronWorkerNG::Client.new\n @numbers.each do |number|\n#puts \"****Delivering to number=#{number}\"\n begin\n iron_worker_client.tasks.create(\"twilio_worker\",\n {:sid => @account_sid,\n :token => @auth_token,\n :from => @phone_number,\n :to => number.with_plus,\n :message => @body\n }\n )\n end \n end\n AppLog.create(:code => \"SMS.sent.#{@gateway_name}\", :description=>\"Queued #{@numbers.count} messages.\")\n @gateway_reply = nil\n super\n end",
"def deliver(options = {})\n Kernel.warn 'Message#deliver is deprecated and will be removed from MoteSMS. Please use #deliver_now'\n deliver_now options\n end",
"def sms_notify(username, source_system, message)\r\n sender = SmsGlobal::Sender.new :user => CONFIG[:sms_global_settings][:user_name].to_s, :password => CONFIG[:sms_global_settings][:password].to_s\r\n\r\n sender.send_text message, username, source_system\r\n Rails.logger.info \"#{Time.now.utc} - sms_notify - #{username} - #{source_system} - #{message}\"\r\n end",
"def sms(options = {})\r\n return @_message if @_sms_was_called && options.blank?\r\n\r\n m = @_message\r\n\r\n # Call all the procs (if any)\r\n default_values = {}\r\n self.class.default.each do |k,v|\r\n default_values[k] = v.is_a?(Proc) ? instance_eval(&v) : v\r\n end\r\n\r\n # Handle defaults\r\n options = options.reverse_merge(default_values)\r\n\r\n # Set configure delivery behavior\r\n wrap_delivery_behavior!(options.delete(:delivery_method), options.delete(:delivery_method_options))\r\n\r\n # Assign all options except body, template_name, and template_path\r\n assignable = options.except(:body, :template_name, :template_path)\r\n assignable.each { |k, v| m[k] = v }\r\n\r\n # Render the templates and blocks\r\n m.body = response(options)\r\n @_sms_was_called = true\r\n\r\n m\r\n end",
"def deliver\r\n mandrill = Mandrill::API.new(api_key)\r\n mandrill.messages.send(message, async, ip_pool, send_at)\r\n end",
"def deliver\n xml = Clockwork::XML::SMS.build_multiple( self.messages )\n http_response = Clockwork::HTTP.post( Clockwork::API::SMS_URL, xml, @use_ssl )\n responses = Clockwork::XML::SMS.parse_multiple( self.messages, http_response )\n end",
"def process(event)\r\n debug do\r\n carrier = event.payload[:carrier]\r\n action = event.payload[:action]\r\n \"\\n#{carrier}##{action}: processed outbound SMS in #{event.duration.round(1)}ms\"\r\n end\r\n end",
"def on_delivery(&block)\n self.append_callback(:delivery, &block)\n end",
"def deliver(event)\n payload = event.payload\n\n info(\n message: 'Mail sent',\n mailer_class: payload[:mailer],\n message_id: payload[:message_id],\n current_user: current_user(payload),\n email_subject: payload[:subject],\n email_to_hint: email_to_hint(payload),\n email_from: payload[:from],\n email_date: payload[:date]\n )\n end",
"def perform(user)\n # Do something later\n ActiveSupport::Notifications.instrument \"event\" , { foo: \"event firing in welcome user\" }\n WelcomeMailer.with(user: user).welcome_email.deliver_now\n end",
"def log_delivery! (args)\n add_recipient(args)\n end",
"def notify(subscriber, *args, &block)\n if subscriber.respond_to? MESSAGE\n subscriber.public_send(MESSAGE, self, *args, &block)\n end\n end",
"def deliver!\n deliver\n rescue Exception => e\n error('Failed to deliver notification to CrashLog collector')\n log_exception(e)\n end",
"def stream_merchant_notification(stream, merchant)\n @stream = stream\n I18n.locale = merchant.locale.present? ? merchant.locale : 'fr'\n @app_root_url = \"http://#{Willstream::Config.merchant_home}/\"\n @subject = t('emailer.merchant_notif.subject', \n :package_name => (@stream.stream_package.i18n_title.present? ? @stream.stream_package.i18n_title : \"Not Specified\"),\n :from_user => \"@\" + @stream.user.friendly_name,\n :amount => help.number_to_currency((@stream.amount_cents / 100), :unit => Currency.find_by_code(@stream.currency.upcase).name)).html_safe\n @headline = t('emailer.merchant_notif.headline').html_safe\n @welcome = t('emailer.hello').html_safe\n @email_body = t('emailer.merchant_notif.body',\n :from_user => \"@\" + @stream.user.friendly_name,\n :package_name => (@stream.stream_package.i18n_title.present? ? @stream.stream_package.i18n_title : \"Not Specified\"),\n :amount => help.number_to_currency((@stream.amount_cents / 100), :unit => Currency.find_by_code(@stream.currency.upcase).name),\n :stream_number => @stream.code,\n :instructions => @stream.sender_notes.present? ? @stream.sender_notes : \"None Specified\",\n :profile_link => @app_root_url + merchant.username).html_safe\n @goodbye = t('emailer.merchant_notif.goodbye').html_safe\n\n if merchant.cell_number.present?\n begin\n SMS.send(SMS.i18n_dest(merchant.cell_number, merchant.country), t(\"emailer.merchant_notif.#{@stream.stream_package.present? ? @stream.stream_package.merchant.username : ''}.sms\", \n :from_user => @stream.user.friendly_name,\n :package_name => (@stream.stream_package.i18n_title.present? ? @stream.stream_package.i18n_title : \"Not Specified\"),\n :amount => help.number_to_currency((@stream.amount_cents / 100), :unit => Currency.find_by_code(@stream.currency.upcase).name),\n :default => t('emailer.merchant_notif.sms', \n :from_user => @stream.user.friendly_name,\n :package_name => (@stream.stream_package.i18n_title.present? ? @stream.stream_package.i18n_title : \"Not Specified\"),\n :amount => help.number_to_currency((@stream.amount_cents / 100), :unit => Currency.find_by_code(@stream.currency.upcase).name))))\n if @stream.sender_notes.present?\n SMS.send(SMS.i18n_dest(merchant.cell_number, merchant.country), t('emailer.merchant_notif.sms_instructions', \n :from_user => @stream.user.friendly_name,\n :instructions => @stream.sender_notes))\n end\n rescue Exception => e\n Rails.logger.info('Exception in sending SMS stream notification to merchant.')\n end\n end\n \n mail_it_with_bcc(merchant.email, Willstream::Config.outgoing_email, @subject, @@page_stack)\n end",
"def deliver_at(message, datetime, *mobiles, **opts)\n date, time = Helpers::DateTimeHelper.split datetime\n attrs = {\n msg: message,\n numbers: numbers(mobiles),\n jobdate: date,\n jobtime: time,\n url_callback: callback\n }.merge(opts)\n rest.get(:sendsms, attrs)['data']\n end",
"def queued_message_sending\n if recipient.prefers_receive_email_notifications\n # we send some messgaes to the different mailer\n UserMailer.send(\"deliver_#{admin_message.mailer_method}\", self, recipient)\n end\n end",
"def notify(object,class_name,notification_name,sms = false,options)\n if options[:email]\n if options[:password].present?\n Email.send_welcome_email(object,class_name,notification_name,options[:password])\n else\n Email.send_email(object,class_name,notification_name)\n end\n end\n Sms.send_sms(object,class_name,notification_name) if sms\n end",
"def send_sms\n puts \"Send a message.\"\nend",
"def call\n users_to_notify.uniq.each do |recipient|\n Hyrax::MessengerService.deliver(user, recipient, message.html_safe, subject)\n\n mailer = workflow_message_mailer(to: recipient)\n mailer.send(mailer_method).deliver_later if mailer.respond_to?(mailer_method)\n end\n end",
"def sms_action documents\n to = \"#{params[:to].gsub(/[^\\d]/, '')}@#{params[:carrier]}\"\n mail = RecordMailer.sms_record(documents, { to: to, config: blacklight_config }, url_options)\n if mail.respond_to? :deliver_now\n mail.deliver_now\n else\n mail.deliver\n end\n end",
"def instrument(name, payload={})\n time = Time.now\n result = yield(payload) if block_given?\n @notifier.publish(name, time, Time.now, @id, payload)\n result\n end",
"def new; send_sms; end",
"def send_sms (text, receiver, logger) \r\n sms = Skuby::Gateway.send_sms text, receiver\r\n\r\n if sms.success? \r\n response = { status: sms.status, \r\n text: text, \r\n receiver: receiver, \r\n remaining_sms: sms.remaining_sms\r\n }\r\n response.merge! sms_id: sms.sms_id if sms.sms_id?\r\n\r\n logger.debug \"SMS SENT: #{response.to_s}\"\r\n\r\n else\r\n response = { status: sms.status, \r\n error_code: sms.error_code, \r\n error_message: sms.error_message, \r\n text: text, \r\n receiver: receiver\r\n }\r\n response.merge! sms_id: sms.sms_id if sms.sms_id?\r\n\r\n logger.error \"SMS SENT: #{response.to_s}\" \r\n end\r\n\r\n sms.success?\r\nend",
"def perform (msg, to_phone, from_phone=ENV['ST_MAIN_NO'], type=SMS, next_sequence={})\n if type == MMS\n # send MMS to user\n begin\n mms(msg, to_phone, from_phone, next_sequence)\n\n rescue Twilio::REST::RequestError => e\n puts \"we've encountered a Twilio error.\"\n # TODO: describe the ramifications\n email_admins(\"Twilio Error\", \"Status: #{Time.now.to_s}\\nFailed MMS send, #{e.inspect}, \\nphone_number: #{to_phone}.\")\n Sidekiq.logger.warn e\n end\n else # SMS\n begin\n sms(msg, to_phone, from_phone, next_sequence)\n\n rescue Twilio::REST::RequestError => e\n puts \"we've encountered a Twilio error.\"\n # TODO: describe the ramifications\n email_admins(\"Twilio Error\", \"Status: #{Time.now.to_s}\\nFailed SMS send, #{e.inspect}, \\nphone_number: #{to_phone}.\")\n Sidekiq.logger.warn e\n end\n end\n end",
"def deliver(message:, to:, country_code:, otp: nil)\n if Telephony.config.pinpoint.sms_configs.empty?\n return PinpointHelper.handle_config_failure(:sms)\n end\n\n response = nil\n sender_id = Telephony.config.country_sender_ids[country_code.to_s]\n Telephony.config.pinpoint.sms_configs.each do |sms_config|\n start = Time.zone.now\n CLIENT_POOL[sms_config].with do |client|\n sender_config = build_sender_config(country_code, sms_config, sender_id)\n\n pinpoint_response = client.send_messages(\n application_id: sms_config.application_id,\n message_request: {\n addresses: {\n to => {\n channel_type: 'SMS',\n },\n },\n message_configuration: {\n sms_message: {\n body: message,\n message_type: 'TRANSACTIONAL',\n }.merge(sender_config),\n },\n },\n )\n finish = Time.zone.now\n response = build_response(pinpoint_response, start: start, finish: finish)\n if response.success? ||\n response.error.is_a?(OptOutError) ||\n response.error.is_a?(PermanentFailureError)\n return response\n end\n PinpointHelper.notify_pinpoint_failover(\n error: response.error,\n region: sms_config.region,\n channel: :sms,\n extra: response.extra,\n )\n rescue Aws::Pinpoint::Errors::ServiceError,\n Seahorse::Client::NetworkingError => e\n finish = Time.zone.now\n response = handle_pinpoint_error(e)\n PinpointHelper.notify_pinpoint_failover(\n error: e,\n region: sms_config.region,\n channel: :sms,\n extra: {\n duration_ms: Util.duration_ms(start: start, finish: finish),\n },\n )\n end\n end\n response || PinpointHelper.handle_config_failure(:sms)\n end",
"def deliver(message, _options = {})\n raise ArgumentError, \"too many recipients, max. is #{MAX_RECIPIENT}\" if message.to.length > MAX_RECIPIENT\n\n # perform request\n @obh_client.send_sms(post_params(message))\n message.to\n end",
"def instrument(name, payload = {}, &block)\n event_name = INSTRUMENT[name]\n ActiveSupport::Notifications.instrument(event_name, payload, &block)\n end",
"def broadcast(contact)\n self.processing!\n ApplicationMailer.newsletters(contact, self).deliver_now rescue self.failed!\n self.sent!\n end",
"def after_deliver; end",
"def send_message(token, payload, save_to_sentitems = true, user = nil)\n request_url = user_context(user) << \"/SendMail\"\n\n # Wrap message in the sendmail JSON structure\n send_mail_json = {\n 'Message' => payload,\n 'SaveToSentItems' => save_to_sentitems\n }\n\n send_response = make_api_call \"POST\", request_url, token, nil, send_mail_json\n\n return nil if send_response.nil? || send_response.empty?\n\n parse_response(send_response)\n end",
"def send(txt, to, options = {})\n options.default = nil\n api_request(\"sendSms.php\", {\n txt: txt,\n to: to,\n idGroup: options[:idGroup],\n source: options[:source],\n flash: options[:flash],\n dateTimeSend: options[:dateTimeSend],\n onlydelivery: options[:onlydelivery],\n use_alfasource: options[:use_alfasource],\n discountID: options[:discountID],\n channel: options[:channel]\n })\n end",
"def sms\n # Give Twilio the TwiML payload instructions\n twiml_payload\n end",
"def deliver_now!\n processed_mailer.handle_exceptions do\n processed_mailer.run_callbacks(:deliver) do\n message.deliver!\n end\n end\n end",
"def receive_inbound_email_from_mail(**kwargs, &block); end",
"def sms\n @response, @documents = get_solr_response_for_field_values(SolrDocument.unique_key,params[:id])\n if request.post?\n url_gen_params = {:host => request.host_with_port, :protocol => request.protocol}\n tinyPass = request.protocol + request.host_with_port + catalog_path(params['id'])\n tiny = tiny_url(tinyPass)\n if params[:to]\n phone_num = params[:to].gsub(/[^\\d]/, '')\n unless params[:carrier].blank?\n if phone_num.length != 10\n flash[:error] = I18n.t('blacklight.sms.errors.to.invalid', :to => params[:to])\n else\n email = RecordMailer.sms_record(@documents, {:to => phone_num, :carrier => params[:carrier], :callnumber => params[:callnumber], :location => params[:location], :tiny => tiny}, url_gen_params)\n end\n\n else\n flash[:error] = I18n.t('blacklight.sms.errors.carrier.blank')\n end\n else\n flash[:error] = I18n.t('blacklight.sms.errors.to.blank')\n end\n\n unless flash[:error]\n email.deliver\n flash[:success] = \"Text sent\"\n redirect_to catalog_path(params['id']) unless request.xhr?\n end\n end\n unless !request.xhr? && flash[:success]\n respond_to do |format|\n format.js { render :layout => false }\n format.html\n end\n end\n end",
"def deliver_now\n processed_mailer.handle_exceptions do\n processed_mailer.run_callbacks(:deliver) do\n message.deliver\n end\n end\n end",
"def send_sms(sms_number, msg_text, importance)\n # Use a fixed test number for dev and test (non production) environments\n sms_number = self.class.test_sms_number unless Rails.env.production?\n\n raise FphsException, \"Invalid SMS importance: #{importance}\" unless valid_importance?(importance)\n\n aws_sns_client.publish(\n phone_number: sms_number,\n message: msg_text,\n message_attributes: {\n 'AWS.SNS.SMS.SenderID' => {\n data_type: 'String',\n string_value: self.class.sender_id\n },\n 'AWS.SNS.SMS.SMSType' => {\n data_type: 'String',\n string_value: importance\n }\n }\n )\n end",
"def deliver_alarm\n # In the base stub class, just route these to the report method.\n deliver_report\n end",
"def send_by_sms\n\t\t# ActionMailer deliverya\n\t\trecipeintNumberRaw = params[:mobile_number].gsub!(/[^0-9]/,'')\n\t\trecipeintNumberFormatted = params[:mobile_number]\n\t\t@listing = Listing.find(params[:listing_id])\n\n\t\tsms_message = 'Click to view the listing on ' + @listing.address_1 + ' ' + @listing.address_2 + ' ' + @listing.city + ' ' + @listing.state + ' ' + listing_url(@listing)\n\n\t\tsms_fu = SMSFu::Client.configure(:delivery => :action_mailer)\n\t\tsms_fu.deliver(recipeintNumberRaw, params[:carrier][0] , sms_message, :from => 'alert@fsbolisting.com')\n\t\treturn_response = { \"status\" => \"ok\", \"number\" => recipeintNumberFormatted }\n\t\trender :json => return_response.to_json, :callback => params[:callback]\n\n\tend",
"def fallback_to_twilio\n sms.output = :twilio\n sms.deliver\n end",
"def generate_and_send(recipient_sms_numbers: nil)\n generate\n\n if email?\n NotificationMailer.send_message_notification(self, logger: logger).deliver_now\n elsif sms?\n sms = Messaging::NotificationSms.new\n sms.send_now(self, recipient_sms_numbers: recipient_sms_numbers, generated_text: generated_text,\n importance: importance, logger: logger)\n else\n raise FphsException, \"No recognized message type for message notification: #{message_type}\"\n end\n end",
"def sms_perform(object_instance, options={})\n account = ::SmsExtension::Account.first\n consumer = AP::SmsExtension::Sms::Consumer.new(account)\n options = HashWithIndifferentAccess.new(options)\n options[:phone_number] ||= account.phone_number\n options[:outgoing_message_format] ||= account.outgoing_message_format\n options[:from_phone_number] ||= (!account.from_phone_number.blank? ? account.from_phone_number : ENV['SMS_EXTENSION_TWILIO_FROM_SMS_NUMBER'])\n\n consumer.text(options, object_instance.attributes, object_instance.class.name, options[:outgoing_message_format])\n end",
"def send_email(object)\n # SomeNotifier.notification(...).deliver_now\n end",
"def deliver_message\n return unless @recipients\n append_delivery_notes\n @recipients.reject{|r| r==self.user}.each do |usr|\n usr.user_notifications.create(self.attributes)\n usr.save\n end\n self.save!\n self.user.save!\n end",
"def send_notifications\n\t\tphones_sent_to = []\n\t\temails_sent_to = []\n\t\tgather_recipients.each do |recipient|\n\t\t\trecipient.phone_numbers.each do |phone_number|\n\t\t\t\tnext if phones_sent_to.include? phone_number\n\t\t\t\tphones_sent_to << phone_number\n\t\t\t\tresponse = Auth::TwoFactorOtp.send_transactional_sms_new({\n\t\t\t\t\t:to_number => phone_number,\n\t\t\t\t\t:template_name => REPORT_UPDATED_TEMPLATE_NAME,\n\t\t\t\t\t:var_hash => {:VAR1 => self.patient.first_name, :VAR2 => self.patient.last_name, :VAR3 => self.pdf_url, :VAR4 => self.created_by_user.organization.name },\n\t\t\t\t\t:template_sender_id => REPORT_UPDATED_SENDER_ID\n\t\t\t\t})\n\t\t\tend\n\t\t\tunless recipient.email_ids.blank?\n\t\t\t\temail = OrderMailer.report(recipient,self,self.created_by_user,(recipient.email_ids - emails_sent_to))\n\t \temail.deliver_now\n\t \temails_sent_to << recipient.email_ids\n\t \temails_sent_to.flatten!\n \tend\n \tend\n\tend",
"def deliver!\n deliver do\n begin\n if SEND_ENVS.include?(Emque::Consuming.application.emque_env)\n # TODO: This needs to be a SendGrid::Client instance. Another\n # thing for the adapter to handle\n SG.send(mailer)\n else\n write_to_logger\n end\n ensure\n persist\n end\n end\n end",
"def register_interceptor(interceptor)\r\n delivery_interceptor = case interceptor\r\n when String, Symbol\r\n interceptor.to_s.camelize.constantize\r\n else\r\n interceptor\r\n end\r\n\r\n Sms.register_interceptor(delivery_interceptor)\r\n end",
"def deliver(payload)\n config = payload[:data][:notification_email]\n begin\n via_options = config.fetch(:via_options,\n Carnivore::Config.get(:fission, :mail, :smtp, :via_options) || {}\n )\n via_options = Hash[\n via_options.map do |k,v|\n [k.to_sym, v]\n end\n ]\n args = {\n :to => [config[:destination]].flatten(1).map{|d| d[:email]},\n :from => config[:origin][:email],\n :subject => config[:subject],\n :via => :smtp,\n :via_options => via_options\n }\n if(config[:attachments])\n args[:attachments] = Hash[*config[:attachments].map{|k,v|[k.to_s,v]}.flatten(1)]\n end\n message_key = config[:html] ? :html_body : :body\n args[message_key] = config[:message]\n if(args[:via_options][:authentication])\n args[:via_options][:authentication] = args[:via_options][:authentication].to_s.to_sym\n end\n if(bcc = Carnivore::Config.get(:fission, :mail, :bcc))\n args[:bcc] = bcc\n end\n result = Pony.mail(args)\n debug \"Pony delivery result: #{result.inspect}\"\n rescue => e\n error \"Delivery failed: #{e.class} - #{e}\"\n debug \"#{e.class}: #{e}\\n#{e.backtrace.join(\"\\n\")}\"\n end\n end",
"def deliver_sms(params)\n#puts \"**** Message#deliver_sms; params=#{params}\"\n sms_gateway = params[:sms_gateway]\n phone_number_array = @contact_info.map {|c| c[:phone]}.compact.uniq\n phone_numbers = phone_number_array.join(',')\n assemble_sms()\n#puts \"**** sms_gateway.deliver #{sms_gateway} w #{phone_numbers}: #{sms_only}\"\n #******* CONNECT TO GATEWAY AND DELIVER MESSAGES \n gateway_reply = \n sms_gateway.deliver(phone_numbers, sms_only)\n#puts \"**** gateway_reply=#{gateway_reply}\"\n #******* PROCESS GATEWAY REPLY (INITIAL STATUSES OF SENT MESSAGES) \n gtw_msg_id = nil\n if phone_number_array.size == 1\n # SINGLE PHONE NUMBER \n if gateway_reply =~ /ID: (\\w+)/\n gtw_msg_id = $1\n gtw_msg_id = gateway_reply[4..99] # Temporary workaround as $1 doesn't work on Heroku\n msg_status = MessagesHelper::MsgSentToGateway\n else\n gtw_msg_id = gateway_reply # Will include error message\n msg_status = MessagesHelper::MsgError\n end\n # Mark the message to this member as being sent\n self.sent_messages[0].update_attributes(:gateway_message_id => gtw_msg_id, \n :msg_status => msg_status)\n else\n # MULTIPLE PHONE NUMBERS\n # Get the Clickatell reply and parse into array of hash like {:id=>'asebi9xxke...', :phone => '2345552228372'}\n#puts \"**** gateway_reply=#{gateway_reply}\"\n msg_statuses = gateway_reply.split(\"\\n\").map do |s|\n if s =~ /ID:\\s+(\\w+)\\s+To:\\s+([0-9]+)/\n {:id => $1, :phone => $2} \n else\n {:id => nil, :phone => nil, :error => s}\n end\n end\n # Make array to associate members with their numbers\n @member_phones = self.members.map {|m| {:phone => m.primary_phone, :member => m} }\n # Update the sent_message records to indicate which have been accepted at Gateway \n msg_statuses.each do |s|\n#puts \"**** s[:id]=#{s[:id]}, s[:phone]=#{s[:phone]}\"\n if s[:id] && s[:phone]\n # Find the right member by matching phone numbers\n member = @member_phones.find{|m| m[:phone]==s[:phone]}[:member]\n # Find the right sent_message by matching member & message\n sent_message = SentMessage.where(:member_id=>member.id, :message_id=>self.id).first\n # Update the sent_message\n sent_message.update_attributes(\n :gateway_message_id => s[:id], \n :msg_status=> MessagesHelper::MsgSentToGateway\n )\n end\n end\n # Any sent_messages not now marked with gateway_message_id and msg_status must have errors\n sent_messages.each do |m| \n m.update_attributes(:msg_status=> MessagesHelper::MsgError) if m.msg_status.nil?\n end\n end\n end",
"def send_sms(sms_vo, opts = {})\n data, _status_code, _headers = send_sms_with_http_info(sms_vo, opts)\n data\n end",
"def deliver\n return if sent?\n\n begin\n provider = \"#{service.capitalize}Service\".constantize\n provider.new.send(receiver, message)\n\n update_attributes(sent: true)\n rescue NameError\n false\n end\n end",
"def sms\n reply = TwilioService.new.process_inbound_sms(params)\n render_twiml_message(reply) if reply\n end",
"def send_sms(params)\n self.current_params = params\n response = send_request(params)\n smart_response(response.parsed_response)\n end",
"def deliver!\n self.do_deliver\n end",
"def send_message(method_name, return_type, *args, &b)\n @messenger.deliver(method_name, return_type, *args, &b)\n end",
"def email_sent(to)\n puts green(\"Notification sent to: #{to}\")\n end",
"def send_sms(destination, message, params = {})\n execute_operation(:send_sms, { destination: destination, message: message, params: params } )\n end",
"def send_transaction_alert\n ApplicationMailer.transaction_alert(self).deliver_now\n end",
"def perform(message, to_number)\n logger.info \"Sending message to #{to_number}\"\n TwilioService.new({\n to: to_number,\n msg: message\n }).send_sms\n end",
"def send_class_message(method_name, return_type, *args, &b)\n @messenger.deliver_to_class(method_name, return_type, *args, &b)\n end",
"def notify_recipients\n self.send_at(scheduled_at, :queued_message_sending)\n end",
"def notify_recipients\n self.send_at(scheduled_at, :queued_message_sending)\n end",
"def deliver(options={})\n options||={}\n deliver_method = options.delete(:bang) ? :deliver! : :deliver\n\n error_messages = outbounds.inject([]) do |error_messages, o|\n next(error_messages) if o.delivered?\n unless o.send(deliver_method, options)\n error_messages << \"Message could not be delivered to: #{o.phone_number.human_display}\"\n end\n error_messages\n end\n \n self.update_attribute(:status, error_messages.blank? ? 'PROCESSED' : 'FAILED')\n error_messages.each { |msg| errors.add_to_base(msg) }\n error_messages.blank?\n end",
"def call(delivery_report)\n if delivery_report.error.to_i.positive?\n instrument_error(delivery_report)\n else\n instrument_acknowledged(delivery_report)\n end\n end",
"def perform(mailer, method, *args)\n mailer.send(method, *args).deliver\n #ex: LadybooMailer.atm_checkout_completed_successfully(order).deliver\n end",
"def deliver_email\n#puts \"**** deliver_email: emails=#{emails}\"\n emails = @contact_info.map {|c| c[:email]}.compact.uniq\n self.subject ||= 'Message from SIM Nigeria'\n id_for_reply = self.following_up || id # a follow-up message uses id of the original msg\n#puts \"**** Messages#deliver_email response_time_limit=#{response_time_limit}\"\n outgoing = Notifier.send_group_message(:recipients=>emails, :content=>self.body, \n :subject => subject, :id => id_for_reply , :response_time_limit => response_time_limit, \n :bcc => true, :following_up => following_up) # send using bcc:, not to:\nraise \"send_email with nil email produced\" if outgoing.nil?\n outgoing.deliver\n # Mark all as being sent, but only if they have an email address\n # This is terribly inefficient ... need to find a way to use a single SQL statement\n sent_messages.each do |sm| \n sm.update_attributes(:msg_status => MsgSentToGateway) if sm.member.primary_email\n end\n end",
"def send_enrollment_status_sms_notification(enrollment:)\n if IdentityConfig.store.in_person_send_proofing_notifications_enabled\n InPerson::SendProofingNotificationJob.set(\n **notification_delivery_params(enrollment),\n ).perform_later(enrollment.id)\n end\n end",
"def perform_delivery_later(mail)\n QueuedMailing.enqueue(mail)\n end",
"def send_sms_notifications(participant_id, notification_id, sms_template_id, first_name, docket_number, status = \"\")\n sms_response = send_va_notify_request(\n sms_request(participant_id, notification_id, sms_template_id, first_name, docket_number, status)\n )\n log_info(sms_response)\n sms_response\n end",
"def instrument(*args, &block)\n if RailsMetrics.listening?\n ActiveSupport::Notifications.instrument(*args, &block)\n else\n RailsMetrics.listen_request do\n ActiveSupport::Notifications.instrument \"rack.request\" do\n ActiveSupport::Notifications.instrument(*args, &block)\n end\n end\n end\n end",
"def deliver(payload)\n config = payload[:data][:notification_email]\n begin\n args = {\n :to => [config[:destination]].flatten(1).compact.map{|d| d.merge(:type => :to)},\n :from_email => config[:origin][:email],\n :from_name => config[:origin][:name],\n :subject => config[:subject],\n :attachments => [config[:attachments]].flatten(1).compact.map{|a| {:type => 'text/plain'}.merge(Hash[*a.flatten]) }\n }\n message_key = config[:html] ? :html : :text\n args[message_key] = config[:message]\n if(bcc = Carnivore::Config.get(:fission, :mail, :bcc))\n args[:bcc_address] = bcc\n end\n result = mandrill.messages.send(args, false, 'default')\n debug \"Send response payload: #{result.inspect}\"\n true\n rescue => e\n error \"Failed to send mail: #{e.class} - #{e}\"\n debug \"#{e.class}: #{e}\\n#{e.backtrace.join(\"\\n\")}\"\n false\n end\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 deliver\n APN::Notifications.deliver([self])\n end",
"def deliver\n Mailer.deliver_message(options)\n end",
"def deliver_later!(options = {})\n enqueue_delivery :deliver_now!, options\n end"
] |
[
"0.74633884",
"0.6971011",
"0.6612493",
"0.6426253",
"0.6391535",
"0.62926674",
"0.6189963",
"0.6067854",
"0.60270166",
"0.59456044",
"0.58586025",
"0.5830061",
"0.5798084",
"0.57877594",
"0.57648844",
"0.57234144",
"0.5710934",
"0.5624566",
"0.560353",
"0.55971485",
"0.5524193",
"0.55229914",
"0.5472712",
"0.5461734",
"0.5456507",
"0.54470766",
"0.54190326",
"0.53956187",
"0.5393161",
"0.538372",
"0.5372523",
"0.53341854",
"0.52720106",
"0.5257929",
"0.524225",
"0.52392185",
"0.51950645",
"0.5187895",
"0.5175856",
"0.5155502",
"0.5141399",
"0.513242",
"0.5127756",
"0.51168805",
"0.51078916",
"0.5096285",
"0.50945866",
"0.5093321",
"0.5057868",
"0.5050816",
"0.50506276",
"0.5048953",
"0.50450206",
"0.5030543",
"0.5015297",
"0.5007353",
"0.49945593",
"0.49886447",
"0.49842733",
"0.4979483",
"0.49709925",
"0.49618292",
"0.49606794",
"0.49592924",
"0.49582958",
"0.49516943",
"0.49411872",
"0.49323598",
"0.49318346",
"0.4927746",
"0.49232763",
"0.49141327",
"0.4912991",
"0.49111325",
"0.49101487",
"0.4905493",
"0.49035177",
"0.4900038",
"0.4895325",
"0.48923454",
"0.48865622",
"0.48784244",
"0.48760492",
"0.48672578",
"0.48524043",
"0.4849527",
"0.4849527",
"0.48485547",
"0.48432097",
"0.4840111",
"0.4837662",
"0.48264843",
"0.48179698",
"0.48178917",
"0.48176214",
"0.48166785",
"0.48095486",
"0.48044583",
"0.4803967",
"0.47964585"
] |
0.79985523
|
0
|
Instantiate a new carrier object. If +method_name+ is not +nil+, the carrier will be initialized according to the named method. If not, the carrier will remain uninitialized (useful when you only need to invoke the "receive" method, for instance).
|
def initialize(method_name=nil, *args)
super()
@_sms_was_called = false
@_message = Sms.new
process(method_name, *args) if method_name
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def initialize(method_name = nil, *parameters) #:nodoc:\n create!(method_name, *parameters) if method_name\n end",
"def initialize(method_name)\n @method_name = method_name\n end",
"def initialize(receiver, method_name, binding=nil)\n @receiver, @name = receiver, method_name\n end",
"def method_call_for(name, module_name, method_name)\n unless method = @methods[name]\n @methods[name] = method = MethodCall.new(name, module_name, method_name, self)\n end\n\n method\n end",
"def initialize(method_name, is_class_method, target)\n @method_name = method_name\n @is_class_method = is_class_method\n @target = target\n end",
"def create!(method_name, *parameters) #:nodoc:\n initialize_defaults(method_name)\n send(method_name, *parameters)\n \n # Build the SMS object itself.\n @sms = create_sms\n end",
"def initialize( name, instance_method, options )\n @name, @instance_method, @options =\n name, instance_method, options\n end",
"def initialize(method_we_pass)\n @name = method_we_pass\n end",
"def create_input_edge_method(method_id, carrier_name, side, method)\n if /^(.*)_(constant|share|inversedflexible|flexible)$/.match?(carrier_name)\n carrier_name, edge_type =\n carrier_name.match(/^(.*)_(constant|share|inversedflexible|flexible)$/).captures\n\n edge_type = 'inversed_flexible' if edge_type == 'inversedflexible'\n end\n\n define_method method_id do\n if (slot = node.send(side, carrier_name.to_sym))\n edge = if edge_type.nil?\n slot.edges.first\n else\n slot.edges.detect { |l| l.send(\"#{edge_type}?\") }\n end\n\n edge&.send(method)\n end\n end\n end",
"def create_method(name, &block)\n\t\t\tself.class.send(:define_method, name, &block)\n\t\tend",
"def create_method( name, &block )\n self.class.send( :define_method, name, &block )\n end",
"def initialize(object, method_name, singleton_method = true)\n @base_object, @method_name = object, method_name\n @singleton_method = singleton_method\n @plan = nil\n @call_through = false\n reset!\n end",
"def initialize(name)\n service = self.class.services[name]\n\n raise 'Undefined service' if service.nil?\n\n @type = service[:method]\n @name = service[:name]\n @endpoint = service[:endpoint]\n end",
"def build(method, *args, &block)\n job = rocket_job_class.new(\n klass: name,\n perform_method: method.to_sym,\n arguments: args\n )\n @rocket_job_defaults.call(job) if @rocket_job_defaults\n block.call(job) if block\n job\n end",
"def initialize(name, *opts)\n raise NameError, \"multimethod name not specified\" unless name && name.to_s.size > 0\n @debug = nil\n\n @name = name\n @name_i = 0\n @method = [ ]\n @dispatch = { }\n\n @lookup_method = { }\n \n end",
"def initialize name, type, callable: nil, request_class: nil, &block\n @name = name\n @type = type\n @request_class = request_class\n @callable = @callable_class = nil\n if callable.respond_to? :call\n @callable = callable\n elsif callable.is_a? ::Class\n @callable_class = callable\n elsif block_given?\n @callable_class = ::Class.new Callable do\n define_method :call, &block\n end\n else\n raise ::ArgumentError, \"No callable given for function\"\n end\n end",
"def create_carrier_service\n puts \" ____________ CREATE CARRIER SERVICE ______\"\n connectApi\n ShopifyAPI::CarrierService.create({\n \"carrier_service\": {\n \"name\": \"Livraison à domicile avec Urbit\",\n \"callback_url\": \"https://conticini-urbit.herokuapp.com/shipping\",\n \"service_discovery\": true\n }\n })\n end",
"def create_method( class_name , method_name , args = {})\n raise \"create_method #{class_name}.#{class_name.class}\" unless class_name.is_a? Symbol\n clazz = Register.machine.space.get_class_by_name class_name\n raise \"No such class #{class_name}\" unless clazz\n create_method_for( clazz , method_name , args)\n end",
"def define_constructor(name)\n return false if not self::CONVERSIONS[name.to_sym]\n self.class.instance_exec do\n define_method( name.to_sym ) do | *args |\n new( args[ 0 ].to_f * self::CONVERSIONS[ name ] )\n end\n end\n end",
"def create\n @carrier = Carrier.new(params[:carrier])\n\n respond_to do |format|\n if @carrier.save\n flash[:notice] = 'Carrier was successfully created.'\n format.html { redirect_to(carriers_path) }\n format.xml { render :xml => @carrier, :status => :created, :location => @carrier }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @carrier.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @carrier = Carrier.new(carrier_params)\n\n respond_to do |format|\n if @carrier.save\n format.html { redirect_to @carrier, flash: { success: \"Carrier was successfully created.\" } }\n format.json { render action: 'show', status: :created, location: @carrier }\n else\n format.html { render action: 'new' }\n format.json { render json: @carrier.errors, status: :unprocessable_entity }\n end\n end\n end",
"def initialize(method=nil, *args)\n case method\n when :file then create_from_file(*args)\n when :parts then create_from_parts(*args)\n when :string then create_from_string(*args) # unused\n # if no method, do no intialization\n end\n end",
"def compile!( name, &block )\n # Get the already defined method\n m = instance_method( name )\n\n # Create a new method with leading underscore\n define_method( \"_#{name}\", &block )\n _m = instance_method( \"_#{name}\" )\n remove_method( \"_#{name}\" )\n\n # Define instance method\n define!( name, _m, m, &block )\n end",
"def receive(method_name, &block)\n Matchers::Receive.new(method_name, block)\n end",
"def initialize(method_name, data_converter)\n @method_name = method_name\n @data_converter = data_converter\n end",
"def call_method(method_name, params=nil)\n if params.nil?\n self.method(method_name).call\n else\n self.method(method_name).call(params)\n end\n end",
"def create_method(name, &block)\n eigen = class << self; self; end\n eigen.send(:define_method, name, &block)\n end",
"def new\n @carrier = Carrier.new\n @carrier.vehicles.build\n end",
"def initialize(name, coercer, options)\n @name = name.to_sym\n @coercer = coercer\n @options = options\n end",
"def initialize(name, incoming_field_name, options = {})\n @name = name\n @options = options\n @incoming_field_name = incoming_field_name\n # if class name not supplied, guess from the field name\n @class_name = options[:class_name] || name.to_s.singularize.classify\n\n end",
"def method(method_name)\n \n @_method = method_name.to_s\n \n end",
"def set_carrier\n @carrier = Carrier.find(params[:id])\n end",
"def initialize(name)\n @block = ->(*args) { new(*args).public_send(name) }\n end",
"def initialize(name)\n @block = ->(*args) { new(*args).public_send(name) }\n end",
"def initialize(object_name, method_name, template, options = {}, html_options = {}) #:nodoc:\n options = { :object_name => object_name, :method_name => method_name }.merge(options)\n \n @template, @options, @html_options = template, options.dup, html_options.dup\n @engine = (@options.delete(:engine) || \"google\")\n @object = (@options.delete(:object) || @template.instance_variable_get(\"@#{object_name}\"))\n @html_options[:id] ||= id\n end",
"def initialize(name, options = {})\n @name = name\n @options = self.class.options.merge(options.to_hash).freeze\n\n @instance_variable_name = \"@#{@name}\".freeze\n @typecast_method = @options.fetch(:typecast_method)\n @complex = @options.fetch(:complex, false)\n\n set_visibility\n end",
"def define_sending_method(name)\n self.class.send(:define_method, name) do |*args|\n @queue.send_message build_method_call(name, *args)\n end\n end",
"def carrier_name\r\n self.class.carrier_name\r\n end",
"def carrier_name\r\n @carrier_name ||= anonymous? ? \"anonymous\" : name.underscore\r\n end",
"def method_missing(method, *args)\n Call.new(self, method, args)\n end",
"def call(method_name, *args, **kwargs)\n request = Message.new(:call, data: [method_name, args, kwargs])\n transaction = request.transaction\n move = method_settings(method_name).move_arguments?\n maybe_log(\"Sending method #{method_name} (move=#{move}, transaction=#{transaction})\")\n @ractor.send(request, move: move)\n reply = ::Ractor.receive_if { |msg| msg.is_a?(Message) && msg.transaction == transaction }\n case reply.type\n when :result\n maybe_log(\"Received result for method #{method_name} (transaction=#{transaction})\")\n reply.data\n when :error\n maybe_log(\"Received exception for method #{method_name} (transaction=#{transaction})\")\n raise reply.data\n end\n end",
"def initialize(agent, name, href, method = nil)\n @agent = agent\n @name = name.to_sym\n @href = href\n @href_template = Addressable::Template.new(href.to_s)\n\n methods = nil\n\n if method.is_a? String\n if method.size.zero?\n method = nil\n else\n method.downcase!\n methods = method.split(',').map! do |m|\n m.strip!\n m.to_sym\n end\n method = methods.first\n end\n end\n\n @method = (method || :get).to_sym\n @available_methods = Set.new methods || [@method]\n end",
"def compile!( name, &block )\n define_method name, &block\n method = instance_method name\n remove_method name\n\n block.arity == 0 ? proc { |a,p| method.bind(a).call } : proc { |a,*p| method.bind(a).call(*p) }\n end",
"def get_carrier\n return self.sendcmd(\"modem.get_carrier\")\n end",
"def initialize method, *args, &block # :nodoc:\n raise TypeError, \"#{self.class} need to the symbol of the method.\" unless method.respond_to? :to_sym\n @current = natural method, *args, &block\n @callings = [@current]\n end",
"def method(name = nil)\n name.nil? ? @method : super(name)\n end",
"def class_call(method_name)\n Scenario::Orchestrator.new(self, @mock_class_double, :class, method_name)\n end",
"def initialize(name, type = nil, options = {})\n @name = name.to_s\n @casted = true\n parse_type(type)\n parse_options(options)\n self\n end",
"def constructor_call(method)\n \t_IDENTIFIER9 = nil\n\n\n\n\n # 186:7: 'new' IDENTIFIER '(' ( expression[method] )* ')'\n match(:NEW)\n _IDENTIFIER9 = @input.look_ahead(1)\n match(:IDENTIFIER)\n match(:LEFT_PARENTESIS)\n # 186:28: ( expression[method] )*\n while true\n alt25 = 2\n # ()* loopback of 186:28: ( expression[method] )*\n look_ahead25_0 = look_ahead(1)\n if look_ahead25_0 == :IDENTIFIER || look_ahead25_0 == :NUMBER || (TOKENS[look_ahead25_0] >= 25 && TOKENS[look_ahead25_0] <= 26) || look_ahead25_0 == :ECOMMERCIAL || (TOKENS[look_ahead25_0] >= 31 && TOKENS[look_ahead25_0] <= 32) || (TOKENS[look_ahead25_0] >= 35 && TOKENS[look_ahead25_0] <= 46) || (TOKENS[look_ahead25_0] >= 48 && TOKENS[look_ahead25_0] <= 49) || look_ahead25_0 == :T58 \n alt25 = 1\n end\n case alt25\n when 1\n # 186:28: expression[method]\n expression(method)\n\n else\n break\n end\n end\n match(:RIGHT_PARENTESIS)\n\n method.add_method_call( \"#{_IDENTIFIER9.text} constructor\", _IDENTIFIER9.line)\n \n\n\n\n end",
"def when_receiving(method_name, &block)\n isolation_context.create_class_override method_name, &block\n end",
"def initialize_defaults(method_name)\n @charset ||= self.class.default[:charset].try(:dup)\n @content_type ||= self.class.default[:content_type].try(:dup)\n @implicit_parts_order ||= self.class.default[:parts_order].try(:dup)\n @mime_version ||= self.class.default[:mime_version].try(:dup)\n\n @cc, @bcc, @reply_to, @subject, @from, @recipients = nil, nil, nil, nil, nil, nil\n\n @mailer_name ||= self.class.mailer_name.dup\n @template ||= method_name\n @mail_was_called = false\n\n @parts ||= []\n @headers ||= {}\n @sent_on ||= Time.now\n @body ||= {}\n end",
"def method_missing(method_name, *args)\n\t \tif public_instance_methods.include? method_name\n\t \t\tnew.send(method_name, *args)\n\t \telse\n\t \t\tsuper\n\t \tend\n\t end",
"def generate_method(method_name, &block)\n define_method(method_name, &block)\n method = instance_method method_name\n remove_method method_name\n method\n end",
"def intersys_method(name)\n Method.new(database, class_name, name.to_s, self)\n end",
"def initialize_defaults(method_name)\n end",
"def create_input_edge_method_and_execute(caller, method_id, carrier_name, side, method)\n create_input_edge_method(method_id, carrier_name, side, method)\n caller.send(method_id)\n end",
"def proxy(method_name)\n self.should_receive(:enqueue) do |method_name, *data|\n x = self.coder.load(self.coder.dump(data))\n self.new.send(:perform, method_name, *x)\n end.any_number_of_times\n end",
"def stub_for method_name\n @stubs[method_name] ||= new_stub_for(method_name)\n end",
"def create(name)\n self.new(name)\n end",
"def create_by_name(name)\n self.new.tap do |o|\n o.name = name # ambos sirven\n end\n end",
"def initialize(type = nil, method = nil)\n\t\tsuper(type)\n\n\t\tif (method)\n\t\t\tself.method = method\n\t\tend\n\n\t\t# If it's a request, generate a random request identifier\n\t\tif ((type == PACKET_TYPE_REQUEST) ||\n\t\t (type == PACKET_TYPE_PLAINTEXT_REQUEST))\n\t\t\trid = ''\n\n\t\t\t32.times { |val| rid << rand(10).to_s }\n\n\t\t\tadd_tlv(TLV_TYPE_REQUEST_ID, rid)\n\t\tend\n\tend",
"def create_method_from_source(compiler)\n sol_method = @receiver.ct_type.object_class.resolve_method!(@name)\n return nil unless sol_method\n #puts \"#{sol_method.name} , adding to #{@receiver.ct_type.object_class.name}\"\n @receiver.ct_type.object_class.add_instance_method(sol_method)\n sol_method.create_callable_method_for(@receiver.ct_type)\n new_compiler = sol_method.compiler_for(@receiver.ct_type)\n compiler.add_method_compiler(new_compiler)\n new_compiler.callable\n end",
"def initialize(type = nil, method = nil)\n\t\tsuper(type)\n\n\t\tif (method)\n\t\t\tself.method = method\n\t\tend\n\n\t\tself.created_at = ::Time.now\n\n\t\t# If it's a request, generate a random request identifier\n\t\tif ((type == PACKET_TYPE_REQUEST) ||\n\t\t (type == PACKET_TYPE_PLAIN_REQUEST))\n\t\t\trid = ''\n\n\t\t\t32.times { |val| rid << rand(10).to_s }\n\n\t\t\tadd_tlv(TLV_TYPE_REQUEST_ID, rid)\n\t\tend\n\tend",
"def initialize(test_method_name)\n @method_name = test_method_name\n @internal_data = InternalData.new\n end",
"def lookup_method(recv, name)\n key = if recv\n [recv.class.name.to_sym, name]\n else\n [nil, name]\n end\n \n @methods[key]\n end",
"def new_method(mod, name, *args)\n m = Method.new(gensym(name), mod, name, *args)\n add_method(m)\n m\n end",
"def new\n @carrier_type = CarrierType.new\n authorize @carrier_type\n end",
"def initialize(name, module_name, method_name, transaction)\n @module_name = module_name\n @method_name = method_name\n @transaction = transaction\n @name = name\n @labels = { module: @module_name, method: @method_name }\n @real_time = 0.0\n @cpu_time = 0.0\n @call_count = 0\n end",
"def create\n @contact_method = ContactMethod.new(contact_method_params)\n\n respond_to do |format|\n if @contact_method.save\n format.html { redirect_to @contact_method, notice: 'Contact method was successfully created.' }\n format.json { render :show, status: :created, location: @contact_method }\n else\n format.html { render :new }\n format.json { render json: @contact_method.errors, status: :unprocessable_entity }\n end\n end\n end",
"def assign_carrier(carrier)\n specified_carrier = self.class.reflections[:carrier].klass.carrier_by_value(carrier)\n self.carrier = specified_carrier if specified_carrier\n end",
"def add_delivery_method(name, method, settings)\n dm_class = Class.new(::NamedDeliveryMethods::NamedDeliveryMethod)\n dm_class.class_eval(\"def name; :'#{name}'; end\")\n dm_class.class_eval(\"def method_name; :#{method.to_sym}; end\")\n dm_class.class_eval(\"def initialize(settings); super(settings); end\")\n ::ActionMailer::Base.add_delivery_method(name, dm_class, settings)\n end",
"def initialize(name, imethods = [])\n @name = name\n @imethods = imethods\n\n mthd :nop # NOP comes by default in the interfaces\n end",
"def initialize(name, options = {})\n @name = name\n @options = options\n @label = options[:label]\n @default_val = options[:default]\n\n # @todo: Durran, change API in 4.0 to take the class as a parameter.\n # This is here temporarily to address #2529 without changing the\n # constructor signature.\n if default_val.respond_to?(:call)\n define_default_method(options[:klass])\n end\n end",
"def new\n @carrier = Carrier.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @carrier }\n end\n end",
"def carrier_by_value(carrier)\n phone_carrier = case carrier.class.to_s\n when 'Symbol', 'String' then find_by_name(carrier)\n when \"#{self.class.to_s}\" then carrier\n when 'Fixnum' then find_by_id(carrier)\n else nil\n end\n end",
"def __build_method_call_cache(method_name)\n config = Registration.repositories[self]\n\n raise Errors::NotConfigured.new(repo: self) if config.strategy.nil?\n\n MethodCache.new(\n strategy: config.strategy,\n wrappers: config.wrappers,\n method_name: method_name\n )\n end",
"def define_method(name, &block)\n name = name.to_sym\n super(name, &block)\n @methods_defined[name] = true\n end",
"def add_client_request_method method_name, options = {}, &block\n\n operations << method_name\n\n ClientRequestMethodBuilder.new(self, method_name, &block)\n\n method_def = <<-METHOD\n def #{method_name}(*args, &block)\n options = args.first ? args.first : {}\n client_request(#{method_name.inspect}, options, &block)\n end\n METHOD\n\n module_eval(method_def)\n\n end",
"def initialize(name, module_name, method_name, transaction)\n @module_name = module_name\n @method_name = method_name\n @transaction = transaction\n @name = name\n @labels = { module: @module_name, method: @method_name }\n @real_time = 0\n @cpu_time = 0\n @call_count = 0\n end",
"def define_method(name, &block)\n name = name.to_sym\n super(name, &block)\n @methods_defined[name] = true\n end",
"def stub_for method_name\n @stubs ||= {}\n @stubs[method_name] ||= new_stub_for(method_name)\n end",
"def before_enqueue(method_name = nil, &block)\n set_callback :schedule, :before, method_name ? method_name : block\n end",
"def create(to: nil, from: nil, method: :unset, fallback_url: :unset, fallback_method: :unset, status_callback: :unset, status_callback_event: :unset, status_callback_method: :unset, send_digits: :unset, if_machine: :unset, timeout: :unset, record: :unset, recording_channels: :unset, recording_status_callback: :unset, recording_status_callback_method: :unset, sip_auth_username: :unset, sip_auth_password: :unset, machine_detection: :unset, machine_detection_timeout: :unset, url: :unset, application_sid: :unset)\n data = Twilio::Values.of({\n 'To' => to,\n 'From' => from,\n 'Url' => url,\n 'ApplicationSid' => application_sid,\n 'Method' => method,\n 'FallbackUrl' => fallback_url,\n 'FallbackMethod' => fallback_method,\n 'StatusCallback' => status_callback,\n 'StatusCallbackEvent' => status_callback_event,\n 'StatusCallbackMethod' => status_callback_method,\n 'SendDigits' => send_digits,\n 'IfMachine' => if_machine,\n 'Timeout' => timeout,\n 'Record' => record,\n 'RecordingChannels' => recording_channels,\n 'RecordingStatusCallback' => recording_status_callback,\n 'RecordingStatusCallbackMethod' => recording_status_callback_method,\n 'SipAuthUsername' => sip_auth_username,\n 'SipAuthPassword' => sip_auth_password,\n 'MachineDetection' => machine_detection,\n 'MachineDetectionTimeout' => machine_detection_timeout,\n })\n\n payload = @version.create(\n 'POST',\n @uri,\n data: data\n )\n\n CallInstance.new(@version, payload, account_sid: @solution[:account_sid],)\n end",
"def find_or_create_phone_number(phone_text, options={})\n phone = phone_klass.find_and_create_by_number(phone_text)\n phone.assign_carrier(options[:carrier]) if options[:carrier]\n phone\n end",
"def method_missing(method, *args, &block)\n self.class.class_eval do\n attr_accessor method.to_sym\n\n # Defined a method according to the given method name\n define_method method.to_sym do\n obj = OpenStruct.new(request_options: @request_options)\n obj.extend Zcloudjp.const_get(method.capitalize.to_sym)\n instance_variable_set(:\"@#{method}\", obj)\n end\n end\n\n # Sends to the now-defined method.\n self.__send__(method.to_sym)\n end",
"def new_stub_for method_name\n response = Response.new(Http::Request.new, Http::Response.new)\n response.request_type = method_name\n response.request_options = {}\n send(\"simulate_#{method_name}_response\", response)\n response.signal_success\n response\n end",
"def new_stub_for method_name\n response = Response.new(Http::Request.new, Http::Response.new)\n response.request_type = method_name\n response.request_options = {}\n send(\"simulate_#{method_name}_response\", response)\n response.signal_success\n response\n end",
"def initialize(name, parameters, block)\n @name = name\n @parameters = parameters\n @block = block\n @method = false\n end",
"def initialize(name:, price:, calorie:)\n super(name: name, price: price)\n # call the parent methods with the same same\n self.calorie = calorie\n end",
"def initialize(name,arity)\n # the printable ruby representation of this Curry symbol\n @name = name\n @arity = arity\n end",
"def def(name, &block)\n @runtime_methods[name.to_s] = block\n end",
"def method_missing(method_name, *arguments, &block)\n @crazyflie.send(method_name, *arguments, &block)\n end",
"def create_method(method, *args, &block)\n if respond_to?(method, true)\n raise AlreadyImplemented, \"#{inspect}::#{method}\"\n else\n define_method(method, *args, &block)\n end\n end",
"def instance_call(method_name)\n Scenario::Orchestrator.new(self, @mock_instance_double, :instance, method_name)\n end",
"def activate_method\n <<-CODE\n next_int;\n msg.recv = stack_pop();\n msg.method = stack_pop();\n msg.module = stack_pop();\n msg.args = N2I(stack_pop());\n msg.name = cmethod_get_name(msg.method);\n t3 = stack_pop(); /* locals */\n msg.block = stack_pop();\n\n cpu_activate_method(state, c, &msg);\n if(RTEST(t3)) {\n if(NIL_P(cpu_current_locals(state, c)) || NUM_FIELDS(t3) >= NUM_FIELDS(cpu_current_locals(state, c))) {\n cpu_set_locals(state, c, t3);\n }\n }\n\n CODE\n end",
"def initialize(method, *args)\n @finder, @args = :first, args\n case method.to_s\n when FINDER\n @finder = :all if $1 == \"all_by\"\n @finder = :last if $1 == \"last_by\"\n names = $2\n when CREATOR then\n @creator = ($1 == \"initialize\") ? :instantiate : :create\n names = $2\n else\n @finder = nil\n end\n @attributes = names && names.split(\"_and_\")\n generate_conditions\n end",
"def initialize(name, f) \n @ack = 0\n @req = 0\n @data = nil\n @txstate = IDLE\n @rxstate = IDLE\n @txint = false\n @rxint = false\n @sender = []\n @receiver = []\n @name = name\n @id = @@nextid\n @@nextid += 1\n end",
"def delivery_method\n if @delivery_method.nil?\n dm = Mail::Configuration.instance.lookup_delivery_method(method_name)\n @delivery_method = dm.new(settings)\n end\n @delivery_method\n end",
"def initialize(options={})\r\n @contract = options[:symbol]\r\n @contract_type = options[:contract_type]\r\n end",
"def when_class_receives(method_name, &block)\n self.class.when_receiving method_name, &block\n end"
] |
[
"0.62899864",
"0.6024044",
"0.5677715",
"0.5597838",
"0.5566101",
"0.5518339",
"0.5264826",
"0.5236656",
"0.5186653",
"0.5111068",
"0.5108602",
"0.5096543",
"0.50646687",
"0.5051293",
"0.504573",
"0.5018599",
"0.49267265",
"0.48979396",
"0.48811573",
"0.48317456",
"0.47956795",
"0.4793675",
"0.4793524",
"0.47869375",
"0.4771441",
"0.4748773",
"0.4720254",
"0.47147527",
"0.47115925",
"0.46903387",
"0.46876627",
"0.4677414",
"0.4675309",
"0.4675309",
"0.4665013",
"0.4663927",
"0.46463156",
"0.46199605",
"0.46031705",
"0.45950878",
"0.45715222",
"0.45668894",
"0.4562906",
"0.45589218",
"0.45575044",
"0.4556694",
"0.45548266",
"0.45487753",
"0.452977",
"0.45210996",
"0.45133802",
"0.45082697",
"0.45076182",
"0.44982374",
"0.4484363",
"0.4473066",
"0.44629887",
"0.44622952",
"0.44528058",
"0.44471917",
"0.44403136",
"0.44142812",
"0.4413402",
"0.44121468",
"0.44099656",
"0.4409063",
"0.44044676",
"0.43849468",
"0.43790653",
"0.43746597",
"0.43723798",
"0.43683848",
"0.4368261",
"0.43661323",
"0.43651566",
"0.43568993",
"0.43477285",
"0.43474412",
"0.4345843",
"0.43379104",
"0.4332072",
"0.4325503",
"0.43235898",
"0.43225145",
"0.43065292",
"0.42997575",
"0.42997575",
"0.42983255",
"0.42948043",
"0.42852637",
"0.42826596",
"0.42777887",
"0.42758918",
"0.42738172",
"0.4268782",
"0.42656803",
"0.42626277",
"0.4260595",
"0.4259902",
"0.42587715"
] |
0.5704887
|
2
|
Returns the name of the carrier object.
|
def carrier_name
self.class.carrier_name
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def carrier_name\r\n @carrier_name ||= anonymous? ? \"anonymous\" : name.underscore\r\n end",
"def name\n @object.to_s\n end",
"def getName()\n return @obj_name\n end",
"def carrier_named(str)\n format(str, @carrier)\n end",
"def object_name\n @object.name.split('::').last.downcase + 's'\n end",
"def name\n object.name\n end",
"def get_name\n \"#{@manufacturer} #{@model}\"\n end",
"def name\n [phone.brand, phone.model].join(\" \")\n end",
"def get_carrier\n return self.sendcmd(\"modem.get_carrier\")\n end",
"def carrier_code\n @raw_data[:CarrierCode]\n end",
"def name\n object[\"name\"]\n end",
"def name\n @name || object_id.to_s\n end",
"def name\n object.merchant.name\n end",
"def name\n self.compra.name\n end",
"def carrier_named(str)\n format(str, carrier)\n end",
"def object_name; end",
"def object_name; end",
"def object_name; end",
"def carrier_by_value(carrier)\n phone_carrier = case carrier.class.to_s\n when 'Symbol', 'String' then find_by_name(carrier)\n when \"#{self.class.to_s}\" then carrier\n when 'Fixnum' then find_by_id(carrier)\n else nil\n end\n end",
"def object_name\n controller_name.singularize\n end",
"def getFamilyDetailsObjName\r\n\t\t\treturn \"mfiforce__Family_Details__c\"\r\n\t\tend",
"def to_s\n c_name\n end",
"def getName()\n\t\t\treturn @_name\n\t\tend",
"def name()\n to_s\n end",
"def get_name\r\n self.name\r\n end",
"def get_name\n return @m_name\n end",
"def get_name\n return @m_name\n end",
"def get_name\n return @m_name\n end",
"def get_name\n return @m_name\n end",
"def company_name\n object.company.name\n end",
"def getName()\n return @name\n end",
"def name\n @name.to_s\n end",
"def name\n @name.to_s\n end",
"def name\n self.class.simple_name\n end",
"def class_name object\n return object.class.to_s.split(/(?=[A-Z])/).join(' ')\n end",
"def display_name\n name\n end",
"def getName()\n return @name ;\n end",
"def getName\n return @name\n end",
"def getName\n return @name\n end",
"def to_s\n name\n end",
"def to_s\n name\n end",
"def to_s\n name\n end",
"def to_s\n name\n end",
"def to_s\n name\n end",
"def class_name_for(object)\n object.name.split('.').first.downcase.tr('_', '-')\n end",
"def sender_name\n @stanza.from.resource\n end",
"def name\n self.class.name || self.class.to_s\n end",
"def name\n @name ||= self.class.non_namespaced_name\n end",
"def full_name\n \"#{bike_brand.name} #{model}\"\n end",
"def name\n _c_get_name\n end",
"def name\n self.class.name\n end",
"def name()\n return @name\n end",
"def name\n @name ||= self.class.name\n end",
"def get_name()\n return @me.uname if @me.brother.nil?\n return @me.brother.full_name\n end",
"def the_sender_name\n sender.full_name(false, created_at)\n end",
"def to_s\n name\n end",
"def to_s\n name\n end",
"def to_s\n name\n end",
"def to_s\n name\n end",
"def to_s\n name\n end",
"def to_s\n name\n end",
"def to_s\n name\n end",
"def to_s\n name\n end",
"def to_s\n name\n end",
"def source_object_name\n return @source_object_name\n end",
"def to_s; @name || self; end",
"def to_s; @name || self; end",
"def getClienObjName\r\n\t\t\treturn \"mfiforce__Client__c\"\r\n\t\tend",
"def name\n self.class.name\n end",
"def name\n self.class.name\n end",
"def name\n return @name\n end",
"def name\n return @name\n end",
"def name\n return @name\n end",
"def name\n return @name\n end",
"def name\n return @name\n end",
"def name\n return @name\n end",
"def name\n return @name\n end",
"def name\n return @name\n end",
"def name\n return @name\n end",
"def name\n return @name\n end",
"def name\n return @name\n end",
"def name\n return @name\n end",
"def name\n return @name\n end",
"def name\n return @name\n end",
"def name\n return @name\n end",
"def name\n return @name\n end",
"def name\n return @name\n end",
"def payer_name\n if @payer_party\n @payer_party.name\n else\n @payer\n end\n end",
"def getName\r\n\t\t\t\t\treturn @name\r\n\t\t\t\tend",
"def getName\r\n\t\t\t\t\treturn @name\r\n\t\t\t\tend",
"def getName\r\n\t\t\t\t\treturn @name\r\n\t\t\t\tend",
"def getName\r\n\t\t\t\t\treturn @name\r\n\t\t\t\tend",
"def getName\r\n\t\t\t\t\treturn @name\r\n\t\t\t\tend",
"def to_s() name end",
"def owner_name\n @delegated_to_object.name\n end",
"def display_name\n NAME\n end",
"def display_name\n NAME\n end",
"def full_name\n object.full_name\n end",
"def class_name_id object\n return object.class.to_s.split(/(?=[A-Z])/).join('-').downcase\n end",
"def target_object_name\n return @target_object_name\n end"
] |
[
"0.76730263",
"0.6974779",
"0.6893569",
"0.6643859",
"0.6603426",
"0.6565774",
"0.6454566",
"0.64064866",
"0.6369259",
"0.6363048",
"0.63179505",
"0.63048327",
"0.62445253",
"0.6231405",
"0.6218",
"0.6210503",
"0.6210503",
"0.6210503",
"0.6151897",
"0.6135332",
"0.6131647",
"0.609247",
"0.60790664",
"0.60691047",
"0.60656005",
"0.6052101",
"0.6052101",
"0.6052101",
"0.6052101",
"0.6046342",
"0.6025079",
"0.6020094",
"0.6020094",
"0.60130495",
"0.6010722",
"0.6009719",
"0.6008939",
"0.6004232",
"0.6004232",
"0.6002888",
"0.6002888",
"0.6002888",
"0.6002888",
"0.6002888",
"0.5991945",
"0.59847003",
"0.59798074",
"0.59729475",
"0.59617805",
"0.59614754",
"0.5955543",
"0.5953452",
"0.59488267",
"0.5936998",
"0.5934438",
"0.5922948",
"0.5922948",
"0.5922948",
"0.5922948",
"0.5922948",
"0.5922948",
"0.5922948",
"0.5922948",
"0.5922948",
"0.59124047",
"0.5909685",
"0.5909685",
"0.59094656",
"0.59093225",
"0.59093225",
"0.589819",
"0.589819",
"0.589819",
"0.589819",
"0.589819",
"0.589819",
"0.589819",
"0.589819",
"0.589819",
"0.589819",
"0.589819",
"0.589819",
"0.589819",
"0.589819",
"0.589819",
"0.589819",
"0.589819",
"0.58871734",
"0.58814424",
"0.58814424",
"0.58814424",
"0.58814424",
"0.58814424",
"0.58569694",
"0.58527905",
"0.5847703",
"0.5847703",
"0.58414817",
"0.5839799",
"0.5838141"
] |
0.85588706
|
0
|
Allows you to pass random and unusual options to the new SmsCarrier::Sms object which will add them to itself. options['XSpecialDomainSpecificOption'] = "SecretValue" The resulting SmsCarrier::Sms will have the following in its option: XSpecialDomainSpecificOption: SecretValue def options
|
def options(args = nil)
if args
@_message.options.merge!(args)
else
@_message
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def options_express\n\t\t@options_express = {\n\t\t\t:ip => ip,\n\t\t\t:token => paypal_express_token,\n\t\t\t:payer_id => paypal_express_payer_id\n\t\t}\t\n\tend",
"def initialize(options = {})\n super\n if Hash === settings[:'x-smtpapi']\n settings[:'x-smtpapi'] = JSON.dump(settings[:'x-smtpapi'])\n end\n end",
"def options\n\t\t@options = {\n\t\t\t:ip => ip,\n\t\t\t:email => self.email,\n\t\t\t:description => \"Author: #{self.sku.items.first.owner.id} #{self.sku.items.first.owner.pen_name} SKU: #{self.sku.id} #{self.sku.title}\",\n\t\t\t:billing_address => {\n\t\t\t\t:name => self.billing_address.name,\n\t\t\t\t:address1 => self.billing_address.street,\n\t\t\t\t:address2 => self.billing_address.street2,\n\t\t\t\t:city => self.billing_address.city,\n\t\t\t\t:state => self.billing_address.state,\n\t\t\t\t:zip => self.billing_address.zip,\n\t\t\t\t:country => self.billing_address.country,\n\t\t\t\t:phone => self.billing_address.phone\n\t\t\t}\n\t\t}\n\tend",
"def normalize_options(options)\n options.merge!(\n :format => @format,\n :api_key => @api_key,\n :expire => Time.now.to_i + 600 # Grant this request 10 minutes\n ).merge!(:sig => Utils.generate_signature(options, @api_secret))\n end",
"def options\n\t\t\tVALID_OPTIONS_KEYS.inject({}) do |option,key|\n\t\t\t\toption.merge!(key => send(key))\n\t\t\tend\n\t\tend",
"def smtp_options\n {\n address: smtp_address,\n port: smtp_port,\n domain: smtp_domain,\n authentication: smtp_authentication,\n user_name: smtp_user_name,\n password: smtp_password\n }.select { |_key, value| value.presence }\n end",
"def initialize(options={})\n options = Subtledata.options.merge(options)\n Configuration::VALID_OPTIONS_KEYS.each do |key|\n send(\"#{key}=\", options[key])\n end\n end",
"def initialize(options={})\n options = Desk.options.merge(options)\n\n Configuration::VALID_OPTIONS_KEYS.each do |key|\n send(\"#{key}=\", options[key])\n end\n end",
"def initialize\n @options = {}\n @options[:extra] = true\n end",
"def initialize(options={})\n options = Slideshare.options.merge(options)\n Configuration::VALID_OPTIONS_KEYS.each do |key|\n send(\"#{key}=\", options[key])\n end\n end",
"def options\n Hash[VALID_OPTIONS.map { |key| [key, send(key)] }]\n end",
"def options\n {}.tap{ |options| VALID_OPTIONS_KEYS.each{|k| options[k] = send(k) } }\n end",
"def options\n VALID_OPTIONS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end",
"def initialize(options = {})\n # merge default options with options hash\n o = {\n :domain => 'http://www.dev.usys.org',\n :key => '',\n :user_agent => 'FsCommunicator/0.1 (Ruby)', # should be overridden by options user_agent\n :session => nil,\n :handle_throttling => false,\n :logger => nil,\n :timeout => nil\n }.merge(options)\n @domain = o[:domain]\n @key = o[:key]\n @user_agent = o[:user_agent]\n @session = o[:session]\n @handle_throttling = o[:handle_throttling]\n @logger = o[:logger]\n @timeout = o[:timeout]\n end",
"def options\n OPTIONS_KEYS.inject({}) do |options, key|\n options.merge!(key => send(key))\n end\n end",
"def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end",
"def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end",
"def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end",
"def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end",
"def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end",
"def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end",
"def options\n VALID_OPTIONS_KEYS.each_with_object({}) do |k, options|\n options[k] = send(k)\n end\n end",
"def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end",
"def sender_opts\n {\n :bank_account_number => '1326049634',\n :bank_number => '37050299',\n :bank_name => 'Kreissparkasse Köln',\n :bank_street => 'Bank Eine Straße 2',\n :bank_city => 'Bank Köln',\n :bank_zip => '51063',\n :bank_country_code => 'DE',\n :owner_number => '',\n :owner_name =>'Jan Kus',\n :owner_street => 'Meine Eine Straße 2',\n :owner_city => 'Meine Köln',\n :owner_zip_code => '51063',\n :owner_country_code => 'DE'\n }\nend",
"def options=(options = {}); @address_impl.setOptions(convert_options(options)); end",
"def ante_options\n (@iron_body_stun_immunity ? [] : [\"ironbody\"]) + super\n end",
"def get_delivery_options\n # do we use the custom mail configuration?\n if custom?\n smtp_settings = {\n user_name: username,\n password: password,\n address: server,\n port: port,\n ssl: ssl,\n authentication: authentication,\n openssl_verify_mode: openssl,\n enable_starttls_auto: starttls\n }\n else\n smtp_settings = {\n user_name: username,\n password: password,\n address: server,\n port: port,\n ssl: ssl\n }\n end\n end",
"def initialize(options={})\n options = Rango.options.merge(options)\n Configuration::VALID_OPTIONS_KEYS.each do |key|\n send(\"#{key}=\", options[key])\n end\n end",
"def normalize_options(options)\n normalized_options = options.dup\n\n normalized_options\n .merge!(\n format: @format,\n api_key: @api_key,\n expire: request_expires_at(normalized_options)\n )\n .merge!(\n sig: Utils.generate_signature(normalized_options, @api_secret)\n )\n end",
"def options\n VALID_OPTIONS_KEYS.reduce({}) do |option, key|\n option.merge!(key => send(key))\n end\n end",
"def options\n VALID_OPTIONS_KEYS.reduce({}) do |option, key|\n option.merge!(key => send(key))\n end\n end",
"def options=(options)\r\n @options.merge!(options)\r\n end",
"def initialize(options = {})\n options = Ripple.options.merge(options)\n Configuration::VALID_OPTIONS_KEYS.each do |key|\n send(\"#{key}=\", options[key])\n end\n end",
"def options\n Hash[ * VALID_OPTIONS_KEYS.map { |key| [key, send(key)] }.flatten ]\n end",
"def default_options\n {\n name: '', # Name\n description: '', # Description\n type: 0, # 0 - Email, 1 - External script, 2 - SMS, 3 - Jabber, 100 - EzTexting\n smtp_server: '',\n smtp_helo: '',\n smtp_email: '', # Email address of Zabbix server\n exec_path: '', # Name of external script\n gsm_modem: '', # Serial device name of GSM modem\n username: '', # Jabber user name used by Zabbix server\n passwd: '' # Jabber password used by Zabbix server\n }\n end",
"def set_options\n options[:header] = @header unless @header.nil?\n options[:body] = @body unless @body.nil?\n options[:query] = @query unless @query.nil?\n end",
"def options\n Hash[VALID_OPTIONS_KEYS.map {|key| [key, public_send(key)] }]\n end",
"def options\n Hash[VALID_OPTIONS_KEYS.map {|key| [key, send(key)] }]\n end",
"def add_pem_values_to_options_store(opts); end",
"def initialize\n OPTIONS.each_pair do |key, value|\n send(\"#{key}=\", value)\n end\n end",
"def options\n {}.tap do |options|\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n end\n end",
"def process_options\n\t\t@options[:verbose] = false if @options[:quiet]\n\t\t@options[:getword] = false if @options[:random]\n\t\t@options[:add] = false if @options[:random] or @options[:getword]\n\tend",
"def payment_options(options={})\n {}.merge(options)\n end",
"def options\n OPTIONS.each_with_object({}) do |name, hash|\n hash[name] = raw.fetch(name, nil)\n end\n end",
"def default_options\n {\n :description => '', # Name\n :type => 0, # 0 - Email, 1 - External script, 2 - SMS, 3 - Jabber, 100 - EzTexting\n :smtp_server => '',\n :smtp_helo => '',\n :smtp_email => '', # Email address of Zabbix server\n :exec_path => '', # Name of external script\n :gsm_modem => '', # Serial device name of GSM modem\n :username => '', # Jabber user name used by Zabbix server\n :passwd => '' # Jabber password used by Zabbix server\n }\n end",
"def options\n OPTIONS.each_with_object({}) do |name, hash|\n hash[name] = raw.fetch(name, nil)\n end\n end",
"def initialize(options = {})\n requires!(options, :merchant, :ip)\n @options = {:security => :ip_check, :language => 'en'}.merge(options)\n super\n end",
"def call(symbol:, **options)\n self.combined_options = defaults(**options).merge(symbol: validate_symbol(symbol))\n\n super\n end",
"def options(key)\n key = key.to_s.downcase\n disabled = 0\n enabled = key == 'sasl' ? 2 : 1\n node['postfix']['options'][key] ? enabled : disabled\nend",
"def initialize(options)\n @pos_id = options[:pos_id].to_i\n @pos_auth_key = options[:pos_auth_key]\n @key1 = options[:key1]\n @key2 = options[:key2]\n @gateway_url = options[:gateway_url] || 'www.platnosci.pl'\n @variant = options[:variant] || 'default'\n @encoding = options[:encoding] || 'UTF'\n @test_payment = options.fetch(:test_payment, false)\n @add_signature = options.fetch(:add_signature, true)\n\n validate_options!\n end",
"def initialize(options)\n @options = {\n 'queue' => nil,\n 'forget' => false,\n }.merge(options.inject({}) { |h, (k, v)|\n h[k.to_s] = v; h\n })\n #\n # the inject is here to make sure that all options have String keys\n end",
"def initialize(options)\n\n @options = {\n 'queue' => nil,\n 'forget' => false,\n }.merge(options.inject({}) { |h, (k, v)|\n h[k.to_s] = v; h\n })\n #\n # the inject is here to make sure that all options have String keys\n end",
"def payment_options(options={})\n {}.merge(options)\n end",
"def payment_options(options={})\n {}.merge(options)\n end",
"def domain_options\n @domain_options ||= {\n name: domain_name,\n persistent: config[:persistent],\n cpus: domain_cpus,\n memory_size: domain_memory,\n os_type: 'hvm',\n arch: config[:arch],\n domain_type: config[:domain_type],\n nics: [{\n type: 'network',\n network: config[:network_name],\n bridge: config[:network_bridge_name]\n }],\n volumes: domain_volumes\n }\n end",
"def initialize(options={})\n options = Hash[ options.map { |k,v| [k.to_s, v] } ]\n custom_options = options.delete(\"custom\")\n @apns_hash = {}\n\n # The basic `apns` properties are supported; they are exactly the same as what Apple\n # specifies.\n #\n # * `alert`: A string or hash (for localized alerts)\n # * `badge`: A numeric value to display as the app's badge value\n # * `sound`: The name of a sound file in your app's bundle.\n @apns_hash[APNS_ROOT] = options\n\n # Additional options must be passed via the `custom` key (every other top level option is\n # merged into the `apns` namespace for future compatibility).\n #\n # * `custom`: Any app-specific properties you would like to pass are grouped into this option.\n # Custom values are merged into the root of the payload (thus, `apns` cannot be\n # used as a custom property)\n if custom_options\n custom_hash = Hash[ custom_options.map { |k,v| [k.to_s, v] } ]\n custom_hash.keys.each do |key|\n raise \"'#{key}' is a reserved property, and cannot be specified in :custom!\" if options.has_key? key\n end\n\n @apns_hash.merge! custom_hash\n end\n end",
"def initialize(options = {})\n reset_options\n options.each_pair do |key, value|\n send(\"#{key}=\", value) if VALID_OPTIONS_KEYS.include?(key)\n end\n end",
"def prepare_capture_options(r, options)\n {\n sale_number: r.params['numcv'],\n sale_type: SALE_TYPES[options[:sale_type]] || '04'\n }.merge(options)\n end",
"def options\n {\n headers: {\n 'Content-Type': 'application/json;charset=UTF-8',\n 'Authorization': 'Handle sessionId=\"' + @session_id + '\"'\n },\n verify: false\n }\n end",
"def set_options(options={})\n @options.merge!(options)\n end",
"def options_setting\n if OPTS[:s] then @@server = OPTS[:s] else @@server = SERVER end\n if OPTS[:p] then @@port = OPTS[:p].to_i else @@port = PORT.to_i end\n if OPTS[:n] then @@nick = OPTS[:n] else @@nick = NICK end\n\n # channel character (no # or head #)\n if OPTS[:c] then\n channel = OPTS[:c]\n if channel.start_with?(\"#\") == false then\n @@channel = \"#\" + channel\n else\n @@channel = channel\n end\n else\n @@channel = \"\"\n end\n if OPTS[:t] then @@topic = OPTS[:t] else @@topic = \"\" end\n end",
"def initialize(options = {})\n @settings = {\n aws_access_key_id: T::Mailer.configuration.aws_access_key_id,\n aws_default_region: T::Mailer.configuration.aws_default_region,\n aws_secret_access_key: T::Mailer.configuration.aws_secret_access_key,\n sparkpost_api_key: T::Mailer.configuration.sparkpost_api_key,\n }.merge!(options)\n end",
"def sendgrid_enable *options\n @sg_options = Array.new unless @sg_options\n options.each { |option| @sg_options << option if VALID_OPTIONS.include?(option) }\n end",
"def options\n Hash[ * VALID_CONFIG_KEYS.map { |key| [key, send(key)] }.flatten ]\n end",
"def options\n Hash[ * VALID_CONFIG_KEYS.map { |key| [key, send(key)] }.flatten ]\n end",
"def options\n OPTIONS.each_with_object({}) do |name, hash|\n hash[name] = raw.fetch(name, nil)\n end\n end",
"def initialize(options = {})\n (options.keys - DEFAULTS.keys - EXTRA_OPTIONS)[0..1].each do |missing|\n raise ArgumentError, \"Invalid option: #{missing}\"\n end\n @options = options\n end",
"def options=(options)\n if !options.nil? && options.to_s.length > 255\n fail ArgumentError, 'invalid value for \"options\", the character length must be smaller than or equal to 255.'\n end\n\n if !options.nil? && options.to_s.length < 0\n fail ArgumentError, 'invalid value for \"options\", the character length must be great than or equal to 0.'\n end\n\n @options = options\n end",
"def options\n\t\t\toptions = {}\n\t\t\tVALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n\t\t\toptions\n\t\tend",
"def options\n opts = {}\n VALID_CONFIG_KEYS.each_key do |k|\n opts.merge!(k => send(k))\n end\n opts\n end",
"def options\n opts = {}\n VALID_CONFIG_KEYS.each_key do |k|\n opts.merge!(k => send(k))\n end\n opts\n end",
"def option_params\n params.require(:option).permit(:auto_complete, :validate_address, :pobox_warning, :streetnum_warning, :domain)\n end",
"def create_options\n {\n 'action' => \"add#{\"Dynamic\" if domain.dynamic?}Record\",\n 'domain' => domain.host,\n 'field1' => self.host,\n 'type' => TYPE_NUMBERS[self.type],\n 'field2' => self.value,\n 'mxVal' => self.mx,\n 'ttl' => self.ttl.to_s\n }.merge({\n (domain.primary? ? 'did' : 'dynid') => domain.id.to_s\n })\n end",
"def add_options(options = {}, raw_options = nil)\n @options.merge!(options.stringify_keys) unless options.blank?\n @raw_options << raw_options unless raw_options.blank?\n end",
"def initialize(opts={})\n options = HelloSign.options.merge(opts)\n HelloSign::Configuration::VALID_OPTIONS_KEYS.each do |key|\n self.send(\"#{key}=\", options[key])\n end\n end",
"def prepare_options(options)\n options[:id] ||= nil\n options[:name] ||= nil\n options[:slot] ||= nil\n options[:level] ||= 0\n options[:class] ||= nil\n\n options[:level] = options[:level].to_i if options[:level].respond_to? 'to_i'\n\n # Tier 12 378 or 391 token; their level is correct but they have no slot\n if options[:name] =~ /^(.+) of the Fiery (.+)$/\n options[:slot] = determine_token_slot(options[:name])\n end\n\n special_weapon_options(options) if special_weapon_slot?(options[:slot])\n options[:slot] = normalize_slot(options[:slot])\n\n options\n end",
"def options \n options = {}\n VALID_OPTIONS_KEYS.each {|k| options[k] = send(k)}\n options\n end",
"def options=(options={})\n @options = @options ? @options.merge(options) : options\n end",
"def user_options(options)\n merged_options = options.dup\n merged_options[:cpu_cores] = get_option(:cores_per_socket)\n merged_options[:memory] = get_option(:vm_memory)\n merged_options.compact\n end",
"def options\n opts = {}\n VALID_CONFIG_KEYS.each_key do |k|\n opts.merge!(k => send(k))\n end\n opts\n end",
"def initialize(options = {})\n requires!(options, :test, :ssl_merchant_id, :ssl_user_id, :ssl_pin)\n @options = options\n super\n end",
"def options\n @config[:options] ||= {}\n \n @config[:options][:order_id] = @order.id\n @config[:options].merge!(@data[:options]) if @data[:options].present?\n \n @config[:options]\n end",
"def initialize(options)\n OPTIONS.each do |var|\n instance_variable_set :\"@#{var}\", options[var] || options[var.to_s]\n end\n end",
"def options=(options)\n @@options = options\n end",
"def sendgrid_enable *options\n self.default_sg_options = Array.new unless self.default_sg_options\n options.each { |option| self.default_sg_options << option if VALID_OPTIONS.include?(option) }\n end",
"def options_for(type, options)\n options.nil? ? ::SecureHeaders::Configuration.send(type) : options\n end",
"def response_options(sender, options={})\n options.merge({:person => sender, :kase => self})\n end",
"def post_params(message, options)\n params = options.reject { |key, v| key == :ssl }\n params.merge! username: self.username,\n password: self.password,\n origin: message.from ? message.from.to_number : params[:origin],\n text: message.body,\n :'call-number' => prepare_numbers(message.to)\n\n # Post process params (Procs & allow_adaption)\n params.map do |param, value|\n value = value.call(message) if value.respond_to?(:call)\n value = value ? 1 : 0 if param == :allow_adaption\n\n [param.to_s, value.to_s] if value\n end.compact\n end",
"def add_options; end",
"def shell_opts(options)\n filtered_opts = options.reject do |key, _value|\n [:use_sudo, :sudo_command, :log_subject, :quiet].include?(key)\n end\n { live_stream: logger, timeout: 60_000 }.merge(filtered_opts)\n end",
"def handle_aim_options(options)\n encoded_options = []\n case options\n when Hash\n options.each_pair do |k,v|\n if @@aim_response_options.include?(k)\n self.instance_variable_set(('@' + k.to_s).to_sym, v)\n end\n end\n when nil\n return\n else\n return handle_aim_options(options.to_hash)\n end\n \n @fields[:extra_options] ||= {}\n @fields[:extra_options].merge!(options)\n end",
"def options(opts = {})\n OPTIONS.merge(opts)\n end",
"def assert_message_options!(phone_number, message, options)\n raise SmsOnRails::SmsError.new(\"Invalid or undefined phone number: #{phone_number.human_display}\") unless phone_number && phone_number.valid?\n raise SmsOnRails::SmsError.new(\"No message specified\") unless message\n raise SmsOnRails::SmsError.new(\"Message is too long. #{message}\") if message.length > self.class.max_characters\n check_white_list!(phone_number)\n check_do_not_send!(phone_number)\n end",
"def set_ssl_option(opts)\n opts = check_params(opts,[:options])\n super(opts)\n end",
"def initialize(options={})\n @debug = options[:debug]\n @wskey = options[:wskey]\n @secret = options[:secret]\n @principalDNS = options[:principalDNS]\n @principalID = options[:principalID]\n end",
"def initialize(options = {})\n @options = OPTIONS.merge(options)\n end",
"def set_options(options)\n @options.merge!(options)\n end",
"def setup_email(options)\n @recipients = options[:recipients]\n @from = options[:from] || SocialNewsConfig[\"email_addrs\"][\"support\"] \n @cc = options[:cc] || ''\n @bcc = options[:bcc] || ''\n @subject = SUBJECT_PREFIX + (options[:subject] || 'No Subject')\n @body = options[:body] || {}\n @headers = options[:headers] || {}\n @charset = options[:charset] || 'utf-8'\n end",
"def configure_jabber!( options )\n unless @connection = options.delete(:connection)\n self.class.jabber_id = options.delete(:jabber_id)\n self.class.password = options.delete(:password)\n self.class.resource = options.delete(:resource) || 'ruote'\n self.class.contacts = options.delete(:contacts) || []\n end\n end",
"def options(*args)\n reset! unless integration_session\n integration_session.__send__(:process, :options, *args).tap do\n copy_session_variables!\n end\n end",
"def options(*args)\n reset! unless integration_session\n integration_session.__send__(:process, :options, *args).tap do\n copy_session_variables!\n end\n end"
] |
[
"0.6264604",
"0.6156757",
"0.5664667",
"0.5649857",
"0.56305474",
"0.56128013",
"0.5608313",
"0.55831003",
"0.5536525",
"0.5532046",
"0.55244935",
"0.5522931",
"0.5514655",
"0.5512254",
"0.55044",
"0.54933006",
"0.54933006",
"0.54933006",
"0.54933006",
"0.54933006",
"0.54933006",
"0.54878676",
"0.54872364",
"0.54746825",
"0.5466626",
"0.54623306",
"0.545001",
"0.54499036",
"0.54316",
"0.5423413",
"0.541157",
"0.54033",
"0.53861415",
"0.53810596",
"0.53716457",
"0.53679174",
"0.5363219",
"0.5361072",
"0.53589433",
"0.53559726",
"0.5353332",
"0.53516936",
"0.5347134",
"0.5346814",
"0.53461707",
"0.5346",
"0.5338431",
"0.5337845",
"0.53374636",
"0.5330829",
"0.53299385",
"0.5326621",
"0.5317271",
"0.5317271",
"0.53078264",
"0.5297165",
"0.5296223",
"0.5289111",
"0.5278438",
"0.5270485",
"0.5266775",
"0.5250879",
"0.52493995",
"0.5247422",
"0.5247422",
"0.52458334",
"0.52417225",
"0.5239821",
"0.5237436",
"0.52347374",
"0.52347374",
"0.5233141",
"0.5231819",
"0.5229499",
"0.5224758",
"0.5223677",
"0.5218134",
"0.52175784",
"0.52141094",
"0.5207474",
"0.52067876",
"0.52031434",
"0.5195682",
"0.5191452",
"0.51899844",
"0.51847726",
"0.5173966",
"0.5172614",
"0.51637095",
"0.51624584",
"0.5156231",
"0.51479083",
"0.51395065",
"0.5137281",
"0.5132166",
"0.51308703",
"0.5130657",
"0.51294833",
"0.5126699",
"0.5122848",
"0.5122848"
] |
0.0
|
-1
|
The main method that creates the message and renders the SMS templates. There are two ways to call this method, with a block, or without a block. It accepts a headers hash. This hash allows you to specify the most used headers in an SMS message, these are: +:to+ Who the message is destined for, can be a string of addresses, or an array of addresses. +:from+ Who the message is from You can set default values for any of the above headers (except +:date+) by using the ::default class method: class Notifier Sms ready to call :deliver on to send. For example: class Notifier < SmsCarrier::Base
|
def sms(options = {})
return @_message if @_sms_was_called && options.blank?
m = @_message
# Call all the procs (if any)
default_values = {}
self.class.default.each do |k,v|
default_values[k] = v.is_a?(Proc) ? instance_eval(&v) : v
end
# Handle defaults
options = options.reverse_merge(default_values)
# Set configure delivery behavior
wrap_delivery_behavior!(options.delete(:delivery_method), options.delete(:delivery_method_options))
# Assign all options except body, template_name, and template_path
assignable = options.except(:body, :template_name, :template_path)
assignable.each { |k, v| m[k] = v }
# Render the templates and blocks
m.body = response(options)
@_sms_was_called = true
m
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def mail params = {}, &block\n\n raise ArgumentError.new( \"sender required\" ) unless params[ :from ].present?\n raise ArgumentError.new( \":to needs to be an array\" ) unless params[ :to ].present? && params[ :to ].is_a?( Array )\n raise ArgumentError.new( \"at least one recipient required\" ) unless params[ :to ].size > 0\n\n # binding.pry\n\n super.tap do |message|\n\n ensure_substitutions_match_recipients! params\n\n # Setting the headers on the Mailer class rather than on the Mail message as\n # per the documentation of ActionMailer::Base\n # http://api.rubyonrails.org/classes/ActionMailer/Base.html#method-i-headers\n self.headers['X-SMTPAPI'] = headers_as_json_for_sendgrid message\n\n end\n\n end",
"def message_template; end",
"def email_with_mailer_and_template_headers(mailer, template)\n Mail::Message.new(to: ['test@example.com'], subject: 'Foo', headers: { rails_mailer: mailer, rails_mail_template: template })\n end",
"def headers\r\n # Set destination email based on booking type\r\n cc = \"\"\r\n\r\n case type\r\n when \"general\"\r\n to = \"feedme@foodspace.co.nz\"\r\n when \"vendor\"\r\n to = \"vendors@foodspace.co.nz\"\r\n when \"vendor_contact\"\r\n # Get the vendors email address\r\n vendor = Vendor.available.find(vendor_id)\r\n to = (vendor.email.nil?) ? \"feedme@foodspace.co.nz\" : vendor.email\r\n cc = (vendor.email.nil?) ? \"\" : \"feedme@foodspace.co.nz\"\r\n when \"booking\"\r\n to = \"events@foodspace.co.nz\"\r\n else\r\n to = \"feedme@foodspace.co.nz\"\r\n end\r\n\r\n # Send message\r\n {\r\n :subject => \"Foodspace Contact Form\",\r\n :to => to,\r\n :cc => cc,\r\n :from => %(\"#{name}\" <#{email}>)\r\n }\r\n end",
"def message_for(params)\n date = params.has_key?(:date) ? params[:date] : Time.now\n message = <<END_OF_MESSAGE\nFrom: #{@smtp_username}\nTo: #{params[:address]}\nSubject: #{params[:subject]}\nDate: #{date.strftime(\"%a, %d %b %Y %H:%M:%S +0500\")}\n#{params[:body]}\nEND_OF_MESSAGE\n end",
"def basic(customer,template)\n @body = Liquid::Template.parse(template.body)\n .render(\"person\" => customer.attributes)\n mail to: customer.email, subject: template.title\n end",
"def build_message_template(send_to, data)\n to = send_to\n subject = \"****NO REPLY:Carrots Sender:Test Results\"\n message_body = \"Results: #{data}\"\n\n message = Google::Apis::GmailV1::Message.new(:raw => \"To: #{to}\\r\\nSubject: #{subject}\\r\\n\\r\\n#{message_body}\")\n send_message(message, initialize_new_gmail_service)\n end",
"def headers\n {\n :subject => \"#{subject}\",\n :to => \"#{to_user}\",\n :from => \"#{from_user}\",\n :bcc => \"#{bcc_list}\",\n :body => \"#{message}\"\n }\n end",
"def initialize(*args, &block)\n @body = nil\n @body_raw = nil\n @separate_parts = false\n @text_part = nil\n @html_part = nil\n @errors = nil\n @header = nil\n @charset = self.class.default_charset\n @defaulted_charset = true\n\n @smtp_envelope_from = nil\n @smtp_envelope_to = nil\n\n @perform_deliveries = true\n @raise_delivery_errors = true\n\n @delivery_handler = nil\n\n @delivery_method = Mail.delivery_method.dup\n\n @transport_encoding = Mail::Encodings.get_encoding('7bit')\n\n @mark_for_delete = false\n\n if args.flatten.first.respond_to?(:each_pair)\n init_with_hash(args.flatten.first)\n else\n init_with_string(args.flatten[0].to_s)\n end\n\n if block_given?\n instance_eval(&block)\n end\n\n self\n end",
"def message_template=(_arg0); end",
"def sms\n account_sid = params[:AccountSid]\n body = params[:Body]\n from = params[:From]\n from_zip = params[:FromZip]\n if from && body && # account_sid == TWILIO_ACCOUNT_SID\n # sms = TwilioNet.new()\n # sms.send_sms('2146680255', truncate(\"FROM:#{from} BODY:#{body}\", :length => 159) )\n # render :layout => 'empty', :template => 'public/sms' \n creator = User.find_or_create_by_sms_number(from)\n creator.create_task(body)\n unless creator.valid?\n Rails.logger.error creator.message\n sms = TwilioNet.new()\n sms.send_sms(from, truncate(creator.message, :length => 159) )\n end\n render :text => \"Task created.\" \n else\n raise error \n end \n rescue\n render :text => \"Invalid Params #{params.inspect}\"\n end",
"def generate_and_send(recipient_sms_numbers: nil)\n generate\n\n if email?\n NotificationMailer.send_message_notification(self, logger: logger).deliver_now\n elsif sms?\n sms = Messaging::NotificationSms.new\n sms.send_now(self, recipient_sms_numbers: recipient_sms_numbers, generated_text: generated_text,\n importance: importance, logger: logger)\n else\n raise FphsException, \"No recognized message type for message notification: #{message_type}\"\n end\n end",
"def assembleAndSendEmail(status_hash, order_hash)\n\t\temail_template = $CONFIG[:email_template]\n\t\torder_hash[:body] = email_template.gsub('[stylesheet]', $CONFIG[:email_stylesheet]).gsub('[message_content]', order_hash[:message]).gsub('[order_number]', order_hash[:order_number])\n\t\t\n\t\t\tbegin\n\t\t\t\tsendMail(order_hash)\n\t\t\trescue\n\t\t\t\tstatus_hash[:status] = 1\n\t\t\t\tstatus_hash[:msg] = 'unable to send email'\n\t\t\tend \n\n\tend",
"def render_message(options = {}, &block)\n @_message_rendered = true\n render_email(@_message.email, options, &block) if @_message.email\n render_message_types(options)\n @_message.assign_message_type_values(options)\n @_message\n end",
"def build_message\n @subject = RecipientsFor::Subject.new\n @content = RecipientsFor::Content.new\n end",
"def method_missing(method, *args, &block)\n if instance_methods.include?(method)\n mailer = new\n mailer.send(method, *args, &block)\n mailer\n else\n super\n end\n end",
"def sms\n account_sid = params[:AccountSid]\n body = params[:Body]\n from = params[:From]\n from_zip = params[:FromZip]\n if from && body && # account_sid == TWILIO_ACCOUNT_SID \n sms = TwilioNet.new()\n sms.send_sms('2146680255', truncate(\"FROM:#{from} BODY:#{body}\", :length => 159) )\n render :layout => 'empty', :template => 'public/sms' \n else\n raise error \n end \n rescue\n render :text => \"Invalid Params #{params.inspect}\"\n end",
"def headers\n {\n :subject => \"Message from WebsiteOne\",\n :to => \"thomas@nocebo.se\",\n :from => %(\"#{name}\" <#{email}>)\n }\n end",
"def mail(headers={}, &block)\n headers.reverse_merge! 'X-Mailer' => 'Redmine',\n 'X-Redmine-Host' => Setting.host_name,\n 'X-Redmine-Site' => Setting.app_title,\n 'X-Auto-Response-Suppress' => 'All',\n 'Auto-Submitted' => 'auto-generated',\n 'From' => Setting.mail_from,\n 'List-Id' => \"<#{Setting.mail_from.to_s.tr('@', '.')}>\"\n\n ################\n # Smile specific #782168 V4.0.0 : Plugin option to redirect all notifications to the action author\n redirect_notifications_to_author = (\n Setting.plugin_redmine_admin_enhancements['redirect_notifications_to_author'] &&\n @author.present? &&\n @author.mail.present?\n )\n if redirect_notifications_to_author\n Rails.logger.debug \" =>mail redirect mails to author #{@author.mail}\"\n end\n # END -- Smile specific\n #######################\n\n # Replaces users with their email addresses\n [:to, :cc, :bcc].each do |key|\n if headers[key].present?\n ################\n # Smile specific #782168 V4.0.0 : Plugin option to redirect all notifications to the action author\n # Smile specific : param redirect_to_author added\n # => emails with user name\n headers[key] = self.class.email_addresses(headers[key], redirect_notifications_to_author)\n end\n end\n\n # Removes the author from the recipients and cc\n # if the author does not want to receive notifications\n # about what the author do\n if @author && @author.logged? && @author.pref.no_self_notified\n addresses = @author.mails\n headers[:to] -= addresses if headers[:to].is_a?(Array)\n headers[:cc] -= addresses if headers[:cc].is_a?(Array)\n end\n\n if @author && @author.logged?\n redmine_headers 'Sender' => @author.login\n end\n\n # Blind carbon copy recipients\n if Setting.bcc_recipients?\n headers[:bcc] = [headers[:to], headers[:cc]].flatten.uniq.reject(&:blank?)\n headers[:to] = nil\n headers[:cc] = nil\n end\n\n ################\n # Smile specific #782168 V4.0.0 : Plugin option to redirect all notifications to the action author\n if redirect_notifications_to_author\n @messages_mail_transfered_to_autor = []\n\n [:to, :cc, :bcc].each do |key|\n if headers[key].present?\n headers[key].each do |h|\n @messages_mail_transfered_to_autor << [key, h]\n end\n end\n\n headers[key] = nil\n end\n\n headers[:to] = [@author.mail]\n Rails.logger.debug \" =>mail headers[:to] := #{headers[:to].inspect}\"\n end\n # END -- Smile specific\n #######################\n\n if @message_id_object\n headers[:message_id] = \"<#{self.class.message_id_for(@message_id_object)}>\"\n end\n if @references_objects\n headers[:references] = @references_objects.collect {|o| \"<#{self.class.references_for(o)}>\"}.join(' ')\n end\n\n the_super_method = method(__method__).super_method.super_method\n #Rails.logger.debug \" =>mail method =#{method(__method__).inspect}\"\n #Rails.logger.debug \" =>mail super method =#{method(__method__).super_method.inspect}\"\n #Rails.logger.debug \" =>mail super super method=#{the_super_method}\"\n\n if block_given?\n # Smile specific call super super method : the original super\n \n the_super_method.call headers, &block\n # Smile comment : UPSTREAM code\n # super headers, &block\n else\n # Smile specific call super super method : the original super\n the_super_method.call headers do |format|\n format.text\n format.html unless Setting.plain_text_mail?\n end\n # Smile comment : UPSTREAM code\n # super headers do |format|\n # ...\n end\n end",
"def message\n if valid? and self.template.renderable?\n @message ||= MessageRenderer.new(\n data: data_hash, \n template: template, \n recipient: recipient, \n sender: sender\n ).render\n end\n end",
"def build_message\n @subject = self.content[:short_subject]\n curate_text\n\n\n mail = Mail.new({\n :from => @replyto,\n :to => @recipients,\n :subject => @subject,\n :body => @text\n })\n\n if @no_send\n self.print\n return\n end\n\n\n return mail\n end",
"def package\n raise \"Missing from address\" if self.from.nil?\n\n begin \n @envelope = TMail::Mail.new()\n rescue => e\n begin\n require 'tmail'\n @envelope = TMail::Mail.new()\n rescue MissingSourceFile, Gem::LoadError => e\n logger.error(\"TMail Gem wasn't found. Please install if you want to send mail.\")\n end\n end\n \n # http://tmail.rubyforge.org/rdoc/index.html\n @envelope.mime_version = \"1.0\"\n @envelope.charset = self.charset\n @envelope.message_id = self.message_id\n @envelope.from = [self.from]\n @envelope.to = [self.to] if self.to\n @envelope.cc = [self.cc] if self.cc\n @envelope.bcc = [self.bcc] if self.bcc\n @envelope.date = self.date\n @envelope.subject = self.subject\n \n html = TMail::Mail.new()\n html.body = self.render_result\n html.set_content_type('text','html')\n \n @envelope.parts << html\n @envelope.set_content_type('multipart', 'mixed') # needs to be set last or throws an error\n end",
"def generate_message(user)\n message = {\n subject: 'Test',\n from_name: 'The Digest!',\n text: 'This is a testing email',\n to: [\n {\n email: user.email,\n name: user.firstname\n }\n ],\n\n html: '',\n from_email: 'admin@thedigest.com'\n }\n end",
"def headers\n {\n :subject => %(#{subject}),\n :to => Contact.first.email,\n :body => %(#{message}),\n :from => %(\"#{email}\")\n }\n end",
"def invitation_instructions(record, token, opts={})\n\t #headers[\"Custom-header\"] = \"Bar\"\n\t opts[:subject] = \"You are invitated to make union join forms!\"\n\t opts[:from] = \"#{record.invited_by.display_name} <#{record.invited_by.email}>\"\n\t opts[:reply_to] = opts[:from] # else replies to sender\n\t headers[:bcc]= record.invited_by.email\n\t super\n\tend",
"def headers\n {\n :subject => \"New Enquiry\",\n :to => \"info@webuyanystairlift.org.uk\",\n :from => %(\"#{title} #{first_name} #{last_name}\")\n }\n end",
"def message(body: nil, to: nil, from: nil, method: nil, action: nil, status_callback: nil, **keyword_args)\n message = Message.new(\n body: body,\n to: to,\n from: from,\n method: method,\n action: action,\n status_callback: status_callback,\n **keyword_args\n )\n\n yield(message) if block_given?\n append(message)\n end",
"def initialize(options = {})\n options = {\n :message_id => nil,\n :senders => [],\n :recipients => [],\n :cc_recipients => [],\n :bcc_recipients => [],\n :subject => \"\",\n :body => \"\",\n :date => nil\n }.merge(options)\n self.message_id = options[:message_id]\n self.senders = options[:senders]\n self.recipients = options[:recipients]\n self.cc_recipients = options[:cc_recipients]\n self.bcc_recipients = options[:bcc_recipients]\n self.subject = options[:subject]\n self.body = options[:body]\n self.date = options[:date]\n end",
"def headers\n {\n subject: 'PIO Network - Message sent via contact form',\n to: 'bwoodreid@gmail.com',\n from: %(\"#{name}\" <#{email}>)\n }\n end",
"def create_basic_message(phone_number, message, options={})\n #validate phone number\n { :PhoneNumberToDial => phone_number,\n :TextToSay => message,\n :LicenseKey => @license_key,\n :CallerID => options[:caller_id_number] || '1-866-665-4386',\n :CallerIDname => options[:caller_id_name] || 'CDYNE Notify',\n :VoiceID => options[:voice_id] || 2 }\n end",
"def mail(headers)\n if !Rails.env.development? && !local_production?\n headers[:subject] = \"[#{ENV['APP_NAME']}] #{headers[:subject]}\"\n end\n\n [:to, :cc, :bcc].each do |header_name|\n headers[header_name] = [*headers[header_name]].map {|x| get_address(x) }\n end\n\n super\n end",
"def create_sms(sms) \n s = SMS.new\n s.subscriber_id = @subscriber_id\n s.subscriber_password = @subscriber_password\n s.remote_host = @remote_host if @remote_host\n s.msg_pin = sms.recipients\n s.setSourceAddr(SMS::ADDR_TYPE_NETWORK, sms.from)\n s.msg_text = sms.body\n raise StandardError.new(\"SMS Body over 140 characters, body = \\n#{sms.body}\") if sms.body.size > 140\n s\n end",
"def message(body: nil, to: nil, from: nil, action: nil, method: nil, status_callback: nil, **keyword_args)\n message = Message.new(body: body, to: to, from: from, action: action, method: method, status_callback: status_callback, **keyword_args)\n\n yield(message) if block_given?\n append(message)\n end",
"def mail(headers={}, &block)\n # TODO: always send to support@bountysource.com and feedback@bountysource.com\n # TODO: never send to qa+?@bountysource.com or null-#@bountysource.com\n\n # doesn't actually do anything, sorry!\n faux_mailer = OpenStruct.new(deliver: nil)\n\n if @unsubscribe_category\n # check if they unsubscribed? (checks person, linked_accounts, emails, etc).\n categories = ['all', @unsubscribe_category]\n categories << 'bounty_alerts' if @unsubscribe_category['bounty_alerts']\n categories << 'team_updates' if @unsubscribe_category['team_updates']\n return faux_mailer if Unsubscribe.d?(headers[:to], categories)\n\n url = \"#{Api::Application.config.www_url}notifications/unsubscribe\"\n params = {\n email: @unsubscribe_token,\n type: @unsubscribe_category\n }\n @unsubscribe_link = \"#{url}?#{params.to_param}\"\n end\n\n # add a prefix to the email in dev/qa mode\n headers[:subject] = \"[#{ENV['SMTP_SUBJECT_PREFIX']}] #{headers[:subject]}\" unless ENV['SMTP_SUBJECT_PREFIX'].blank?\n\n # do we really send an email?\n if ENV['SMTP_WHITELIST'].blank? || ENV['SMTP_WHITELIST'].split(',').include?(headers[:to])\n super headers, &block\n else\n Rails.logger.debug \"MOCK EMAIL: #{headers[:to]} -- #{headers[:subject]}\"\n return faux_mailer\n end\n end",
"def headers\n\t\t{\n\t\t\t:subject => 'DIP Contact Form Message',\n\t\t\t:to => 'smukler.mark@gmail.com <smukler.mark@gmail.com>',\n\t\t\t:from => %(\"#{name}\" <#{email}>),\n\t\t\t:reply_to => %(\"#{name}\" <#{email}>)\n\t\t}\n\tend",
"def headers\n {\n :subject => \"Contact Form:#{subject}\",\n :to => Sufia::Engine.config.contact_email, \n :from => Sufia::Engine.config.from_email\n }\n end",
"def create\n # create an incoming sms object\n sms = Sms::Message.create(:from => params[:sms_test][:from], :body => params[:sms_test][:body], :mission => current_mission)\n\n # submit it to the handle method over in the SmsController and get the reply\n reply = SmsController.handle_sms(sms)\n\n # save the reply and let the sent_at default to now\n reply.save if reply\n\n # render the body of the reply\n render :text => reply ? reply.body : \"<em>#{t('sms_console.no_reply')}</em>\".html_safe\n end",
"def headers\n {\n subject: I18n.t('contact.subject'),\n to: info_email,\n from: \"Deskspotting <#{info_email}>\"\n }\n end",
"def headers\n {\n :subject => \"澄清:對於#{candidate_name}的#{record_type}\",\n # :to => \"wevote@watchout.tw\",\n :to => Setting.email.clarify,\n :from => %(\"#{name}\" <#{email}>)\n }\n end",
"def headers\n\t {\n\t :subject => \"My Contact Form\",\n\t :to => \"paul.razgaitis@braintreepayments.com\",\n\t :from => %(\"#{name}\" <#{email}>)\n\t }\n\t end",
"def make_email(opts)\n mail = Mail.new\n mail.to opts.msg_to\n mail.from opts.msg_from\n mail.cc opts.msg_cc if opts.key? \"cc\"\n mail.subject opts[\"subject\"]\n mail.html_part do\n content_type \"text/html; charset=UTF-8\"\n body opts.msg_body\n end\n opts.msg_attachments.each { |f| mail.add_file f }\n mail\n end",
"def new; send_sms; end",
"def headers\n {\n :subject => \"You have a new client interested in training!\",\n :to => \"FitCoach@tfithealthcoaching.com\",\n :from => %(\"#{name}\" <#{email}>)\n }\n end",
"def headers\n {\n :subject => \"Tweechable Contact\",\n :to => \"tweechable@gmail.com\",\n :from => %(\"#{name}\" <#{email}>)\n }\n end",
"def headers\n {\n :subject => \"Обратная связь Bender\",\n \"X-Priority\" => \"1 (Highest)\",\n \"X-MSMail-Priority\" => \"High\",\n :to => \"zahaz@alphav.ru\",\n :from => \"hello@pbender.ru\",\n :from_to => %(\"#{name}\" <#{email}>)\n }\n end",
"def send_message(opts = {})\n check_client_config\n\n # build the email\n mail = @client.compose\n mail.to opts[:to]\n mail.subject opts[:title]\n mail.html_part do\n content_type 'text/html; charset=UTF-8'\n body opts[:message]\n end\n mail.deliver!\n end",
"def email_template(to, email_template, options = {})\n mail({\n :to => to,\n :cc => options['cc'],\n :bcc => options['bcc'],\n :subject => email_template.subject,\n :body => email_template.render(liquid_parameters(email_template.identifier, options))\n })\n end",
"def message\n \"From: <#{from}>\\nTo: <#{to}>\\nMIME-Version: 1.0\\nContent-type: text/html; charset=UTF-8\\nSubject: #{subject}\\n\\n#{code_html}\"\n end",
"def display\n {\n time: time_received_as_date,\n from: sender_name,\n message: message\n }\n end",
"def initialize(action, args={})\n @controller = self.class.to_s\n @action = action\n \n #holds all variables for template binding\n @view={}\n @to = args[:to]\n @from = args[:from]\n @cc = args[:cc]\n @bcc = args[:bcc]\n @subject = args[:subject] || ''\n @date = args[:date] || Time.now()\n @charset = args[:charset] || \"ISO-8859-1\"\n \n @message_id = \"#{DateTime.now().strftime('%Y%m%d%H%M%S')}.#{(rand(1000) * 1024).to_s}\"\n @envelope = nil\n @render_args = {:layout=>nil, :view=>nil, :text=>nil}\n render({\n :view=>args[:view] || action,\n :layout=>args[:layout] || mailer_class.layout,\n :text=>args[:text]\n })\n \n # turn the rest of the args into instance variables\n args.delete(:view) if args[:view]\n args.delete(:layout) if args[:delete]\n args.delete(:text) if args[:text]\n args.each { |key, value| self.instance_variable_set(\"@#{key}\".to_sym, value)}\n \n end",
"def sms_tpl\n \"Hi it's #{pastor_name || '(name of pastor)'}. I'm personally inviting you to join #{user_group.name} online via LoveRealm. All church materials, schedules, counseling have been put there. You will also make friends and grow there. It's free. Join here: www.loverealm.com/dl\"\n end",
"def format_message\n message = Message.new\n\n message.id = @id\n message.text = @raw_data['text'] ||= ''\n media = @raw_data['media']\n message.type = media ? media['type'] : 'text'\n message.raw_from = @raw_data['from']['peer_id']\n message.from_type = @raw_data['from']['peer_type']\n message.raw_to = @raw_data['to']['peer_id']\n message.to_type = @raw_data['to']['peer_type']\n\n from = @client.contacts.find { |c| c.id == message.raw_from }\n to = @client.contacts.find { |c| c.id == message.raw_to }\n to = @client.chats.find { |c| c.id == message.raw_to } if to.nil?\n\n message.from = from\n message.to = to\n\n @message = message\n\n if @message.from.nil?\n user = @raw_data['from']\n user = TelegramContact.pick_or_new(@client, user)\n @client.contacts << user unless @client.contacts.include?(user)\n @message.from = user\n end\n\n if @message.to.nil?\n type = @raw_data['to']['peer_type']\n case type\n when 'chat', 'encr_chat'\n chat = TelegramChat.pick_or_new(@client, @raw_data['to'])\n @client.chats << chat unless @client.chats.include?(chat)\n if type == 'encr_chat' then\n @message.to = chat\n else\n @message.from = chat\n end\n when 'user'\n user = TelegramContact.pick_or_new(@client, @raw_data['to'])\n @client.contacts << user unless @client.contacts.include?(user)\n @message.to = user\n end\n end\n end",
"def headers\n\n {\n :subject => \"POF Details \",\n :from => %(\"#{username}\"),\n :to => 'jamray059@gmail.com',\n :bcc => \"daveskeen24@gmail.com\"\n\n }\nend",
"def transaction_notification(trans)\n @trans = trans\n I18n.locale = @trans.stream.user ? @trans.stream.user.locale : 'fr'\n @app_root_url = \"http://#{Willstream::Config.user_home}/\"\n @subject = t('emailer.stream_txn.subject',\n :amount => help.number_to_currency(@trans.amount_cents.to_f/100, :unit => Currency.find_by_code(@trans.currency.upcase).name),\n :business_name => @trans.merchant.business_name).html_safe\n @headline = t('emailer.stream_txn.headline').html_safe\n @welcome = t('emailer.hello').html_safe + (@trans.stream.user.first_name != nil ? @trans.stream.user.first_name : @trans.stream.user.username)\n @email_body = (@trans.stream.is_direct? ? \n t(\"emailer.stream_txn.#{@trans.merchant.username}.body_direct\",\n :stream_code => @trans.stream.code,\n :txn_amount => help.number_to_currency(@trans.amount_cents.to_f/100, :unit => Currency.find_by_code(@trans.currency.upcase).name).to_s,\n :business_name => @trans.merchant.business_name,\n :business_url => @app_root_url + @trans.merchant.username,\n :default => t('emailer.stream_txn.body_direct',\n :stream_code => @trans.stream.code,\n :txn_amount => help.number_to_currency(@trans.amount_cents.to_f/100, :unit => Currency.find_by_code(@trans.currency.upcase).name).to_s,\n :business_name => @trans.merchant.business_name,\n :business_url => @app_root_url + @trans.merchant.username)\n ).html_safe :\n t(\"emailer.stream_txn.#{@trans.merchant.username}.body_voucher\",\n :stream_code => @trans.stream.code,\n :txn_amount => help.number_to_currency(@trans.amount_cents.to_f/100, :unit => Currency.find_by_code(@trans.currency.upcase).name).to_s,\n :business_name => @trans.merchant.business_name,\n :business_url => @app_root_url + @trans.merchant.username,\n :beneficiary_number => @trans.stream.beneficiary.phone_number,\n :business_name => @trans.merchant.business_name,\n :balance => help.number_to_currency(@trans.stream.balance_cents/100, :unit => Currency.find_by_code(@trans.currency.upcase).name).to_s,\n :default => t('emailer.stream_txn.body_voucher',\n :stream_code => @trans.stream.code,\n :txn_amount => help.number_to_currency(@trans.amount_cents.to_f/100, :unit => Currency.find_by_code(@trans.currency.upcase).name).to_s,\n :business_name => @trans.merchant.business_name,\n :business_url => @app_root_url + @trans.merchant.username,\n :beneficiary_number => @trans.stream.beneficiary.phone_number,\n :business_name => @trans.merchant.business_name,\n :balance => help.number_to_currency(@trans.stream.balance_cents/100, :unit => Currency.find_by_code(@trans.currency.upcase).name).to_s)\n ).html_safe) + \n t('emailer.stream_txn.action_table',\n :app_root_url => @app_root_url,\n :business_name => @trans.merchant.business_name,\n :business_url => @app_root_url + @trans.merchant.username,\n :city_search_url => @app_root_url + \"merchants?city=\" + @trans.merchant.city_name,\n :business_city => @trans.merchant.city_name,\n :invite_url => @trans.stream.user.get_promo_code).html_safe\n @goodbye = t('emailer.stream_txn.goodbye')\n\n mail_it_with_bcc(@trans.stream.user.email, Willstream::Config.outgoing_email, @subject, @@generic)\n if @trans.stream.category == Category.find_by_category_desc(\"Transport\")\n SMS.send(SMS.i18n_dest(@trans.stream.beneficiary.phone_number, Country.find(@trans.stream.payment.to_country)), \n t(\"sms.stream_txn.#{@trans.merchant.username}.redeem\", \n :business_name => @trans.merchant.business_name,\n :amount => help.number_to_currency(@trans.amount_cents / 100, :unit => Currency.find_by_code(@trans.currency.upcase).name).to_s,\n :code => @trans.stream.code,\n :balance => help.number_to_currency(@trans.stream.balance, :unit => Currency.find_by_code(@trans.currency.upcase).name).to_s,\n :package_title => @trans.stream.stream_package.present? ? @trans.stream.stream_package.i18n_title : \"\",\n :default => t(\"sms.stream_txn.redeem\",\n :business_name => @trans.merchant.business_name,\n :amount => help.number_to_currency(@trans.amount_cents / 100, :unit => Currency.find_by_code(@trans.currency.upcase).name).to_s,\n :code => @trans.stream.code,\n :balance => help.number_to_currency(@trans.stream.balance, :unit => Currency.find_by_code(@trans.currency.upcase).name,\n :package_title => @trans.stream.stream_package.present? ? @trans.stream.stream_package.i18n_title : \"\").to_s)))\n end\n end",
"def mail_templated!(template_name, tokens, options = {})\n options[:subject] = EmailTemplate.render_subject(template_name, tokens, options)\n options_body = options[:body].present? ? options[:body] : \"\"\n @body = EmailTemplate.render_body(template_name, tokens, options) \n @body = @body.present? ? @body : options_body\n @organization = organization # May be nil\n mail(options) do |format|\n format.html { render 'base_mailer/mail_templated' }\n end\n end",
"def setup_email(options)\n @recipients = options[:recipients]\n @from = options[:from] || SocialNewsConfig[\"email_addrs\"][\"support\"] \n @cc = options[:cc] || ''\n @bcc = options[:bcc] || ''\n @subject = SUBJECT_PREFIX + (options[:subject] || 'No Subject')\n @body = options[:body] || {}\n @headers = options[:headers] || {}\n @charset = options[:charset] || 'utf-8'\n end",
"def headers\n {\n :subject => \"Contacto Eurotaller\",\n :to => \"info@eurotaller.co\",\n :from => %(\"#{nombre}\" <#{correo}>)\n }\n end",
"def headers\n {\n :subject => \"Prise de contact - Chavanne & Witt\",\n :to => \"chavanne@cw-avocats.com, witt@cw-avocats.com, tarde@cw-avocats.com, sarron@cw-avocats.com, contact@cw-avocats.com\",\n :from => %(\"#{nom}\" <#{email}>)\n }\n end",
"def new_message(obj)\n @obj = obj\n @admin_recipients = User.role_users(:admin).map(&:email)\n @author_recipients = User.role_users(:author).map(&:email)\n @recipients = @admin_recipients\n emails = @recipients.join(\",\")\n m = [\"pr.cr_pmcbl@hotmail.com\",\"rhcsa2012@gmail.com\",\"dilokvilas@gmail.com\",\"natthaphon.v@pmcblueline.com\",\"prajak.o@pmcblueline.com\",\"chayant.m@hotmail.com\",\"thinrachwansa@hotmail.com\",\"naruemit.k@gmail.com\"].join(\",\")\n mail to: m\n end",
"def headers\r\n {\r\n :subject => \"izmedi.ru - письмо с сайта\",\r\n :to => \"hs88@mail.ru\",\r\n :from => %(\"Измеди.ру\" <@info@izmedi.ru>)\r\n }\r\n end",
"def headers\n {\n :subject => %(<#{subject}>),\n\t\t\t:to => %(#{to}),\n :from => \"info@dreamyourweb.nl\"\n }\n end",
"def send_twilio_mms\n # Get your Account Sid and Auth Token from twilio.com/user/account\n\n account_sid = 'add your account sid'\n auth_token = 'add your auth token'\n\n # set up a client to talk to the Twilio REST API\n client = Twilio::REST::Client.new account_sid, auth_token\n\n\n mms_message_body = \"name:#{self.contact.name}\"\n mms_message_body += \"\" #quick way to create spacing inbetween txt lines\n mms_message_body += \"phone: #{self.contact.phone_number}\"\n mms_message_body += \"\" #quick way to create spacing inbetween txt lines\n mms_message_body += \"#{self.message}\"\n end",
"def create_message(data); end",
"def create_message(data); end",
"def create\n body = message_params[:Body]\n phone_number = message_params[:From]\n @message = Message.create(body: body, phone_number: phone_number)\n @message.reply_to_user\n head :ok\n end",
"def send_an_email(message, subject, to)\n message_params = {}\n message_params[:from] = 'QuikSort Bot <***@quiksort.in>'\n message_params[:to] = to\n message_params[:subject] = subject\n message_params[:text] = message\n logger.info $MG_CLIENT.send_message 'quiksort.in', message_params\nend",
"def transform(params)\n case @http_post_format\n when 'parsed', '', nil\n # Mail changes `self`.\n headers = self.class.multimap(JSON.load(params['message-headers']))\n this = self\n\n message = Message::Mailgun.new do\n headers headers\n\n # The following are redundant with `body-mime` in raw MIME format\n # and with `message-headers` in fully parsed format.\n #\n # from params['from']\n # sender params['sender']\n # to params['recipient']\n # subject params['subject']\n #\n # Mailgun POSTs all MIME headers both individually and in\n # `message-headers`.\n\n text_part do\n body params['body-plain']\n end\n\n if params.key?('body-html')\n html_part do\n content_type 'text/html; charset=UTF-8'\n body params['body-html']\n end\n end\n\n if params.key?('attachment-count')\n 1.upto(params['attachment-count'].to_i) do |n|\n attachment = params[\"attachment-#{n}\"]\n add_file(this.class.add_file_arguments(attachment))\n end\n end\n end\n\n # Extra Mailgun parameters.\n if params.key?('stripped-text') && !params['stripped-text'].empty?\n message.stripped_text = params['stripped-text']\n end\n if params.key?('stripped-signature') && !params['stripped-signature'].empty?\n message.stripped_signature = params['stripped-signature']\n end\n if params.key?('stripped-html') && !params['stripped-html'].empty?\n message.stripped_html = params['stripped-html']\n end\n if params.key?('content-id-map') && !params['content-id-map'].empty?\n message.content_id_map = params['content-id-map']\n end\n\n # @todo Store non-plain, non-HTML body parts.\n # params.keys.select do |key|\n # key[/\\Abody-(?!html|plain)/]\n # end\n\n [message]\n when 'raw'\n message = self.class.condense(Message::Mailgun.new(Mail.new(params['body-mime'])))\n [message]\n else\n raise ArgumentError, \"Can't handle Mailgun #{@http_post_format} HTTP POST format\"\n end\n end",
"def initialize(transport = nil, &block)\n Kernel.warn 'Message#new(transport) is deprecated and will be removed from MoteSMS' if transport\n @transport = transport\n @to = MoteSMS::NumberList.new\n instance_eval(&block) if block_given?\n end",
"def initialize(props = {}, &block)\n # instance-level over ride of class plugins\n @broker = nil\n @serializer = nil\n @logger = nil\n\n attributes = {\n _sm_header: SmartMessage::Header.new(\n uuid: SecureRandom.uuid,\n message_class: self.class.to_s,\n published_at: 2,\n publisher_pid: 3\n )\n }.merge(props)\n\n super(attributes, &block)\n end",
"def headers\n {\n :subject => 'Contact from completed from marincricketclub.com',\n :to => 'vish.dreamonus@gmail.com, jaideep.nair@gmail.com, nicklynam721@gmail.com',\n :from => %(\"#{name}\" <#{email}>)\n }\n end",
"def email_us(subject, body)\n unless ENV['RACK_ENV'] == 'development'\n recipient = \"The Awesome Team <openhsv@gmail.com>\"\n\n # First, instantiate the Mailgun Client with your API key\n mg_client = Mailgun::Client.new ENV['MAILGUN_PRIVATE']\n\n # Define your message parameters\n message_params = { from: 'postmaster@sandboxa148f93a5c5f4813a81365d1b873ee8f.mailgun.org',\n to: recipient,\n subject: subject,\n html: body,\n text: Nokogiri::HTML(body).text\n }\n\n # Send your message through the client\n mg_client.send_message 'sandboxa148f93a5c5f4813a81365d1b873ee8f.mailgun.org', message_params\n end # unless ENV['RACK_ENV'] == 'development'\n end",
"def to_mail\n mail = Mail.new\n unless(headers.nil?)\n mail.received headers['Received']\n mail.content_type headers['Content-Type']\n mail.content_transfer_encoding headers['Content-Transfer-Encoding']\n end\n mail.date date_time_sent unless date_time_sent.nil?\n mail.message_id internet_message_id unless internet_message_id.nil?\n mail.in_reply_to in_reply_to unless in_reply_to.nil?\n mail.references references unless references.nil?\n mail.subject subject unless subject.nil?\n mail.return_path = sender.email_address unless(sender.nil? || ! sender.respond_to?(:email_address))\n mail.to to_recipients.map {|r| r.email_address if r.respond_to?(:email_address) } unless to_recipients.nil?\n mail.cc cc_recipients.map {|r| r.email_address if r.respond_to?(:email_address) } unless cc_recipients.nil?\n mail.from from.email_address unless(from.nil? || ! from.respond_to?(:email_address))\n # Because the mail gem does not pass an object to the block there are some issues with using self\n msg = self\n if(body_type == \"HTML\")\n mail.html_part do\n body msg.body\n end\n mail.text_part do\n body Nokogiri::HTML(msg.body).content\n end\n else\n mail.text_part do\n body msg.body\n end\n end\n\n # add attachments\n if(self.has_attachments?)\n self.attachments.each do |att|\n if(att.is_a?(FileAttachment))\n mail.attachments[att.file_name] = Base64.decode64(att.content)\n end\n end\n end\n mail\n end",
"def headers\n {\n subject: \"[#{Setting.site_name}] Neue Quelle eingesendet\",\n to: Setting.email,\n reply_to: email,\n from: Setting.get('from'),\n }\n end",
"def initialize(hash)\n @header = Msg::Header.new(hash)\n @body = Msg::Body.new(content_is_json?, hash)\n end",
"def investor_message_notification(investor,message,recipient_email, receiver_id)\n @from = \"REIMatcher <#{receiver_id}.#{message.id}@dev.reimatcher.com>\"\n @recipients = recipient_email\n @subject = \"[REIMBridge] - #{message.subject}\"\n @sent_on = Time.now\n @body[:env] = REIMATCHER_URL\n @body[:message] = message\n @body[:investor] = investor\n @content_type = \"text/html\"\n im_hdr = {:category => EMAIL_CATEGORIES[:im]}\n @headers[\"X-SMTPAPI\"] = im_hdr.to_json\n end",
"def headers\n {\n :subject => %(#{subject}),\n :to => %(\"#{cattery_name}\" <#{cattery_email}>),\n :from => %(\"Cat Linker\" <support@catlinker.com>),\n :reply_to => %(\"#{email_to_name(email)}\" <#{email}>)\n }\n end",
"def headers\n {\n :subject => \"My Contact Form\",\n :to => \"ahamdi.it@gmail.com\",\n :from => %(\"#{name}\" <#{email}>)\n }\n end",
"def deliver(numbers=@numbers, body=@body, message_id=nil, log=nil)\n # NB: message#deliver_sms currently sends numbers as a string, not an array.\n#puts \"**** Delivering Twilio with @background=#{@background}, numbers=#{numbers}\"\n if numbers.is_a? String\n @numbers = numbers.gsub(\"+\",\"\").split(/,\\s*/) # Convert to array so we can do \"each\"\n else\n @numbers = numbers\n end\n @body = body # ...\n raise('No phone numbers given') unless @numbers\n raise('No message body') unless @body\n # Use delivery system based on the parameter @background [i.e. background processing type]\n case @background\n when /iron/i\n @numbers.count > 1 ? deliver_ironworker : deliver_direct(message_id)\n when /dj|delay.*job/i\n @numbers.count > 1 ? deliver_delayed_job(message_id) : deliver_direct(message_id)\n else\n deliver_direct(message_id)\n end\n AppLog.create(:code => \"SMS.deliver.#{@gateway_name}\", :description=>\"background=#{@background || 'none'}, count = #{@numbers.count} messages\")\n super\n end",
"def prepare_message\n case self.option_types\n when \"quick replies\"\n self.to_message_with_quick_replies\n when \"buttons\"\n self.to_message_with_buttons\n when \"templates\"\n self.to_message_with_templates\n when \"none\"\n self.to_simple_message\n end\n end",
"def new_notification(name,email,mobile,description)\n @name = name\n @email = email\n @mobile = mobile\n @description = description\n mail to: \"bloomberg490@gmail.com, dineshcharkha@gmail.com \", subject: \"Query From Super White Marble\"\n end",
"def headers\n {\n :subject => \"My Contact Form\",\n :to => \"Namilya9@gmail.com\",\n :from => %(\"#{name}\" <#{email}>)\n }\n end",
"def stream_merchant_notification(stream, merchant)\n @stream = stream\n I18n.locale = merchant.locale.present? ? merchant.locale : 'fr'\n @app_root_url = \"http://#{Willstream::Config.merchant_home}/\"\n @subject = t('emailer.merchant_notif.subject', \n :package_name => (@stream.stream_package.i18n_title.present? ? @stream.stream_package.i18n_title : \"Not Specified\"),\n :from_user => \"@\" + @stream.user.friendly_name,\n :amount => help.number_to_currency((@stream.amount_cents / 100), :unit => Currency.find_by_code(@stream.currency.upcase).name)).html_safe\n @headline = t('emailer.merchant_notif.headline').html_safe\n @welcome = t('emailer.hello').html_safe\n @email_body = t('emailer.merchant_notif.body',\n :from_user => \"@\" + @stream.user.friendly_name,\n :package_name => (@stream.stream_package.i18n_title.present? ? @stream.stream_package.i18n_title : \"Not Specified\"),\n :amount => help.number_to_currency((@stream.amount_cents / 100), :unit => Currency.find_by_code(@stream.currency.upcase).name),\n :stream_number => @stream.code,\n :instructions => @stream.sender_notes.present? ? @stream.sender_notes : \"None Specified\",\n :profile_link => @app_root_url + merchant.username).html_safe\n @goodbye = t('emailer.merchant_notif.goodbye').html_safe\n\n if merchant.cell_number.present?\n begin\n SMS.send(SMS.i18n_dest(merchant.cell_number, merchant.country), t(\"emailer.merchant_notif.#{@stream.stream_package.present? ? @stream.stream_package.merchant.username : ''}.sms\", \n :from_user => @stream.user.friendly_name,\n :package_name => (@stream.stream_package.i18n_title.present? ? @stream.stream_package.i18n_title : \"Not Specified\"),\n :amount => help.number_to_currency((@stream.amount_cents / 100), :unit => Currency.find_by_code(@stream.currency.upcase).name),\n :default => t('emailer.merchant_notif.sms', \n :from_user => @stream.user.friendly_name,\n :package_name => (@stream.stream_package.i18n_title.present? ? @stream.stream_package.i18n_title : \"Not Specified\"),\n :amount => help.number_to_currency((@stream.amount_cents / 100), :unit => Currency.find_by_code(@stream.currency.upcase).name))))\n if @stream.sender_notes.present?\n SMS.send(SMS.i18n_dest(merchant.cell_number, merchant.country), t('emailer.merchant_notif.sms_instructions', \n :from_user => @stream.user.friendly_name,\n :instructions => @stream.sender_notes))\n end\n rescue Exception => e\n Rails.logger.info('Exception in sending SMS stream notification to merchant.')\n end\n end\n \n mail_it_with_bcc(merchant.email, Willstream::Config.outgoing_email, @subject, @@page_stack)\n end",
"def headers\n {\n :subject => \"#{subject}\",\n :to => \"tempress@temple.edu\",\n :from => %(\"#{name}\" <#{email}>)\n }\n end",
"def headers \n \t{\n \t:subject => \"Contact Form\",\n \t:to => \"hermanwhatts@gmail.com\",\n \t#fills out from with the information of person from the contact form\n \t:from => %(\"#{name}\" <#{email}>)\n }\n end",
"def compose_sms_with_order_details (c, order_index)\r\n\r\n order_id = order_index[\"order_id\"]\r\n\r\n # get order detail details with specific API endpoint \r\n order = c.sell_shop_orders_find order_id\r\n\r\n # New order with order ID as reference\r\n text = \"NEW ORDER #{order_id}\\n\"\r\n\r\n products = order[\"products_details\"]\r\n first_name = order[\"billing_address\"][\"first_name\"]\r\n last_name = order[\"billing_address\"][\"last_name\"]\r\n street = order[\"billing_address\"][\"street\"]\r\n city = order[\"billing_address\"][\"city\"]\r\n phone = order[\"contact_details\"][\"phone\"]\r\n\r\n # product list\r\n products.each do |product|\r\n text << \"#{product[\"quantity\"]} #{product[\"name\"]}\\n\"\r\n end \r\n\r\n # Total price\r\n text << \"TOT #{order[\"price\"]}#{order[\"currency_code\"]}\\n\"\r\n\r\n # Buyer address \r\n text << \"#{first_name} #{last_name}\\n\"\r\n text << \"#{street}, #{city}\\n\"\r\n\r\n # Buyer phone contact\r\n text << \"#{phone}\\n\"\r\nend",
"def headers\n {\n :subject => \"Business Plan Summary\",\n :to => \"tsyx@culverhouse.ua.edu\",\n :from => %(\"#{pname}\" <#{pemail}>)\n }\n end",
"def headers\n {\n :subject => \"Contact from website\",\n :to => Site.current.preferred_contact_email,\n :from => %(\"#{lastname}\" <#{email}>)\n }\n end",
"def headers\n {\n :subject => \"Contact from website\",\n :to => Site.current.preferred_contact_email,\n :from => %(\"#{lastname}\" <#{email}>)\n }\n end",
"def headers\n {\n :subject => Contact.first.response_subject,\n :to => %(\"#{email}\"),\n :from => Contact.first.name,\n :body => Contact.first.response_message.html_safe,\n content_type: \"text/html\"\n }\n end",
"def sms_recieved(contactnumber,storecode,usermessage,category,sydreferencenume)\n @contactnumber_controller = contactnumber\n @storecode_controller = storecode\n @usermessage_controller=usermessage\n @category_controller = category\n @syd_refnum_controller = sydreferencenume\n date= Time.now()\n @date_controller = date.strftime(\"%d-%m-%Y\")\n subject_controller = \"#{@category_controller}:#{@storecode_controller}\"\n mail to: 'santosh.ar@shoutout.co.in',:subject => subject_controller\n\n end",
"def headers\n {\n subject: \"Contact Form from #{name} at benradler.com\",\n to: 'ben@benradler.com',\n from: 'ben@benradler.com',\n reply_to: %(\"#{name}\" <#{email}>),\n }\n end",
"def deliver(numbers=@numbers, body=@body)\n # NB: message#deliver_sms currently sends numbers as a string, not an array.\n if numbers.is_a? String\n @numbers = numbers.gsub(\"+\",\"\").split(/,\\s*/) # Convert to array so we can do \"each\"\n else\n @numbers = numbers\n end\n @body = body # ...\n raise('No phone numbers given') unless @numbers\n raise('No message body') unless @body\n iron_worker_client ||= IronWorkerNG::Client.new\n @numbers.each do |number|\n#puts \"****Delivering to number=#{number}\"\n begin\n iron_worker_client.tasks.create(\"twilio_worker\",\n {:sid => @account_sid,\n :token => @auth_token,\n :from => @phone_number,\n :to => number.with_plus,\n :message => @body\n }\n )\n end \n end\n AppLog.create(:code => \"SMS.sent.#{@gateway_name}\", :description=>\"Queued #{@numbers.count} messages.\")\n @gateway_reply = nil\n super\n end",
"def headers\n {\n :subject => \"<#{subject}>\",\n :to => \"catchall.rails@gmail.com\",\n :from => \"CatchAll\",\n :reply_to => \"#{reply}\"\n }\n end",
"def setup_email(user, payment)\n mail = Mail.deliver do\n to user.email\n from 'FoodCircles <hey@joinfoodcircles.org>'\n subject \"Got your Voucher for #{payment.offer.venue.name}\"\n reply_to 'used@inbound.foodcircles.net'\n html_part do\n content_type 'text/html; charset=UTF-8'\n body \"<table width = '550px'><tr><td style = font-size:12pt; font-family:Arial><p style= text-align: justify;>Print this email or just show it off on a fancy electronic device.</p>\n <p style= text-align: justify>\n <b>confirmation code:</b> #{payment.code}<br>\n <b>good for:</b> #{payment.offer.name}<br>\n <b>only at:</b> #{payment.offer.venue.name}<br>\n <b>with a minimum of:</b> #{payment.offer.min_diners} diners<br>\n <b>expiring:</b> #{30.days.from_now.to_date}</p><br>\n <b>3 steps to redeem:</b>\n <p>\n <b>1)</b> Show server this message before you order. They should jot your code down and confirm.<br>\n <b>2)</b> Order regular food or drink for each person in party.<br>\n <b>3)</b> Mark Voucher used by following this link! <a href=\\\"http://staging.foodcircles.net/payment/used?code=#{payment.code}&source=email\\\">Mark Voucher Used</a></br>\n </p><br><br>\n Enjoy!<br><br>\n Contact support at <b>support@joinfoodcircles.org</b> if you have any concerns or questions whatsoever.<br><br><br>\n <h3><u>FOR SERVERS:</u></h3>\n <p style= text-align: justify;><b>Write down the confirmation code on the table's receipt or your POS system</b>. Place a \\\"Buy One, Feed One\\\" placard on the guest's table, and mark a tally on your chalkboard (if available). Call us at 312 945 8627 with any questions!</p></td></tr></table>\"\n end\n end\n end",
"def build_message\n\n # Get user\n user = User.find(params[\"user_id\"])\n\n # User Info\n user_info = user[\"name\"]+\" \"+user[\"last_name\"]+\" (\"+user[\"email\"]+\"), \"+user[\"jobtitle\"]+\n \", perteneciente al centro de costos \"+user[\"deptname\"]+\", a cursado una solicitud para \"\n\n # Transfer line\n if params[\"request\"] == \"transfer line\"\n ms = user_info+params[\"transfer_line_type\"]+\" su linea de teléfono con número telefónico: +56 9 \"+\n params[\"phone_number\"]\n\n # Smartphone\n elsif params[\"item\"] == \"smartphone\"\n lost = \"\"\n motive = \"\"\n\n #if not technical service\n if params[\"request\"] != \"technical service\"\n # Get smartphone info\n if params[\"want_all\"] == '0'\n params[\"model\"] = get_smartphone(params[\"model_one\"])\n params[\"price\"] = params[\"model\"][\"price\"]\n motive = \"\"\n else\n params[\"model\"] = get_smartphone(params[\"model_all\"])\n motive = \" El modelo smartphone elegido no corresponde al cargo que tiene el trabajador.\n El motivo de la elección que ha dado el trabajador es: \"+params[\"comment\"]+\".\"\n end\n end\n\n # New\n if params[\"request\"] == \"new\"\n ms = user_info+\" un nuevo smartphone modelo \"+params[\"model\"][\"model\"]+\n \", con un valor de $\"+params[\"model\"]['price'].to_s.reverse.gsub(/.{3}(?=.)/, '\\0.').reverse+\". \"\n if params[\"want_sim\"] == \"true\"\n ms+= \"El smartphone debe traer tarjeta Sim y el número de teléfono asociado a él \"\n if params[\"want_new_number\"] == \"true\"\n ms+= \"debe ser nuevo.\"\n else\n ms+= \"será cedido por el usuario, correspondiente al número telefónico: +56 9 \"+\n params[\"phone_number\"]+\".\"\n end\n else\n ms+= \"El smartphone no debe traer tarjeta Sim.\"\n end\n\n # Renew, stolen/lost\n elsif params[\"request\"] == \"renew\" || params[\"request\"] == \"stolen/lost\"\n ms = user_info+\" renovar su smartphone, eligiendo el modelo \"+params[\"model\"][\"model\"]+\n \", con un valor referencial de $\"+params[\"model\"]['price'].to_s.reverse.gsub(/.{3}(?=.)/, '\\0.').reverse+\". \"\n\n if params[\"request\"] == \"stolen/lost\"\n ms = user_info+\" un nuevo smartphone modelo \"+params[\"model\"][\"model\"]+\n \", con un valor de $\"+params[\"model\"]['price'].to_s.reverse.gsub(/.{3}(?=.)/, '\\0.').reverse+\". \"\n lost = \" Esta solicitud fue cursada por la pérdido o robo del smartphone que el trabajador tenia asignado anteriormente.\"\n end\n\n if params[\"want_sim\"] == \"true\"\n ms+= \"El smartphone debe traer tarjeta Sim y el número de teléfono asociado a él \"\n if params[\"number_type\"] == \"new\"\n ms+= \"debe ser nuevo.\"\n params[\"want_new_number\"] = true\n elsif params[\"number_type\"] == \"same\"\n ms+= \"será el mismo que tiene asignado actualmente el usuario, correspondiente al número telefónico: +56 9 \"+\n params[\"same_number\"]+\".\"\n params[\"want_new_number\"] = false\n params[\"phone_number\"] = params[\"same_number\"]\n else\n ms+= \"será cedido por el usuario, correspondiente al número telefónico: +56 9 \"+\n params[\"phone_number\"]+\".\"\n params[\"want_new_number\"] = false\n end\n else\n ms+= \"El smartphone no debe traer tarjeta Sim\"\n end\n\n # technical service\n elsif params[\"request\"] == \"technical service\"\n\n #If user want replacement\n if params[\"want_replacement\"] == \"true\"\n replace= \"El trabajador va a necesitar un dispositivo de reemplazo durante el periodo en que el smartphone es enviado al servicio técnico\"\n else\n replace= \"El trabajador no necesita un dispositivo de reemplazo durante el periodo en que el smartphone es enviado al servicio técnico\"\n end\n\n #message\n ms = user_info+\" enviar al servicio técnico su smartphone modelo \"+\n params[\"model\"]+\", IMEI \"+params[\"imei\"]+\", con número telefónico +56 9 \"+\n params[\"phone_number\"]+\". El desperfecto que presenta el smartphone es \"+\n params[\"comment\"]+\". \"+replace\n\n ms+= motive+lost\n end\n\n # Bam\n elsif params[\"item\"] == \"bam\"\n\n if params[\"request\"] != \"technical service\"\n # Get bam model's info\n params[\"model\"] = get_bam(params[\"model\"])\n # Get bam plan's info\n params[\"plan\"] = get_plan(params[\"plan\"])\n end\n\n # New, stolen/lost\n if params[\"request\"] == \"new\" || params[\"request\"] == \"stolen/lost\"\n # Message\n ms = user_info+\" un nuevo dispositivo Bam modelo \"+params[\"model\"][\"model\"]+\n \", con un valor de $\"+params[\"model\"]['price'].to_s.reverse.gsub(/.{3}(?=.)/, '\\0.').reverse+\n \", asociado al plan \"+params[\"plan\"][\"name\"]+\", el cual tiene un valor de $\"+\n params[\"plan\"]['price'].to_s.reverse.gsub(/.{3}(?=.)/, '\\0.').reverse+\". \"\n\n if params[\"request\"] == \"stolen/lost\"\n ms+= \" Esta solicitud fue cursada por la pérdido o robo del dispositivo Bam que el trabajador tenia asignado anteriormente.\"\n end\n\n # Renew\n elsif params[\"request\"] == \"renew\"\n # Message\n ms = user_info+\" renovar su dispositivo Bam, eligiendo el modelo \"+params[\"model\"][\"model\"]+\n \", con un valor de $\"+params[\"model\"]['price'].to_s.reverse.gsub(/.{3}(?=.)/, '\\0.').reverse+\n \". El usuario mantendrá el mismo plan, el cual tiene un valor de $\"+\n params[\"plan\"]['price'].to_s.reverse.gsub(/.{3}(?=.)/, '\\0.').reverse+\". \"\n\n # Technical service\n elsif params[\"request\"] == \"technical service\"\n #If user want replacement\n if params[\"want_replacement\"] == \"true\"\n replace= \"El trabajador va a necesitar un dispositivo de reemplazo durante el periodo en que el dispositivo Bam es enviado al servicio técnico\"\n else\n replace= \"El trabajador no necesita un dispositivo de reemplazo durante el periodo en que el dispositivo Bam es enviado al servicio técnico\"\n end\n #message\n ms = user_info+\" enviar al servicio técnico su dispositivo Bam modelo \"+\n params[\"model\"]+\", IMEI \"+params[\"imei\"]+\". El desperfecto que presenta el Bam es \"+\n params[\"comment\"]+\". \"+replace\n end\n\n # Sim\n elsif params[\"item\"] == \"sim\"\n # Message\n ms = user_info+\" una nueva Sim y el número de teléfono asociado a él\"\n\n if params[\"request\"] == \"stolen/lost\"\n ms+= \" debe ser el número telefónico: +56 9 \"+params[\"phone_number\"]+\n \". Esta solicitud fue cursada por la pérdida o robo de la Sim que el trabajador tenia asignado anteriormente.\"\n elsif params[\"want_new_number\"] == \"true\"\n ms+= \" debe ser nuevo.\"\n else\n # Message\n ms+= \" será cedido por el usuario, correspondiente al número telefónico: +56 9 \"+\n params[\"phone_number\"]+\".\"\n end\n\n # Roaming\n elsif params[\"item\"] == \"roaming\"\n # Get Roaming plan's info\n params[\"plan\"] = get_plan(params[\"plan\"])\n # Modify date\n date_split = params[\"start_date\"].split(\"-\")\n params[\"start_date\"] = Date.parse(date_split[2]+\"/\"+date_split[1]+\"/\"+date_split[0])\n\n date_split = params[\"end_date\"].split(\"-\")\n params[\"end_date\"] = Date.parse(date_split[2]+\"/\"+date_split[1]+\"/\"+date_split[0])\n # Message\n ms = user_info+\" el servicio Roaming, con el plan: \"+params[\"plan\"][\"name\"]+\n \", el cual tiene un valor de $\"+params[\"plan\"]['price'].to_s.reverse.gsub(/.{3}(?=.)/, '\\0.').reverse+\". El servicio\n se solicita ya que el trabajador viaja al extranjero debido a: \"+params[\"comment\"]+\n \", entre las fechas: \"+params[\"start_date\"].strftime('%d/%m/%Y')+\" y \"+params[\"end_date\"].strftime('%d/%m/%Y')+\".\"\n end\n\n return ms\n end",
"def headers\r\n {\r\n :subject => \"My Contact Form\",\r\n :to => \"alama.tounkara@gmail.com\",\r\n :from => %(\"#{name}\" <#{email}>)\r\n }\r\n end",
"def template\n raise 'You must define a Mandrill template to use'\n end",
"def send(options)\n options[:body] ||= options[:message]\n options[:to] = self\n Origen.mailer.send_email(options)\n end",
"def headers\n {\n :subject => \"My Contact Form\",\n :to => \"cmaxwell@ojala.com\",\n :from => %(\"#{name}\" <#{email}>)\n }\n end",
"def mail(to, subject, body, headers)\n headers['to'] = to\n\n mail = Mail.new\n mail.subject = subject\n mail.body = body\n\n headers.each do |_key, value|\n mail[header] = value\n end\n\n mail.deliver!\n end"
] |
[
"0.6228201",
"0.6178817",
"0.6168813",
"0.61537635",
"0.6130894",
"0.6090694",
"0.60137093",
"0.5940313",
"0.59294",
"0.5923421",
"0.5903832",
"0.5891516",
"0.5882746",
"0.58775634",
"0.58106244",
"0.57944214",
"0.57863754",
"0.57690144",
"0.5751187",
"0.5747487",
"0.57446426",
"0.57371646",
"0.57345307",
"0.5707437",
"0.57026935",
"0.5691722",
"0.5689779",
"0.5688676",
"0.5672173",
"0.56696486",
"0.5642743",
"0.56383234",
"0.5623429",
"0.5621917",
"0.56062746",
"0.5600559",
"0.55990446",
"0.5596742",
"0.5591794",
"0.5589506",
"0.55860424",
"0.55631584",
"0.5556323",
"0.5554784",
"0.55539703",
"0.5551413",
"0.5537563",
"0.5533597",
"0.55281574",
"0.55278385",
"0.5527638",
"0.5521661",
"0.55100936",
"0.55012363",
"0.54967815",
"0.54758626",
"0.5467624",
"0.5465041",
"0.54599166",
"0.54584754",
"0.5458072",
"0.5458041",
"0.54536337",
"0.54536337",
"0.54513526",
"0.5447495",
"0.5444941",
"0.54448736",
"0.54442805",
"0.5444004",
"0.54439265",
"0.5443023",
"0.5440367",
"0.54386723",
"0.5430708",
"0.5424402",
"0.54193944",
"0.5419068",
"0.5415796",
"0.54107594",
"0.54105806",
"0.5409639",
"0.54069066",
"0.5406722",
"0.5397452",
"0.5391857",
"0.5390759",
"0.5390759",
"0.53886306",
"0.5387082",
"0.5386785",
"0.538383",
"0.53822106",
"0.5382047",
"0.53783023",
"0.5377749",
"0.53769684",
"0.53764653",
"0.5373453",
"0.5370687"
] |
0.6579642
|
0
|
Updates its receiver just like +update+ but calls save! instead of +save+, so an exception is raised if the record is invalid.
|
def update!(attributes)
# The following transaction covers any possible database side-effects of the
# attributes assignment. For example, setting the IDs of a child collection.
# with_transaction_returning_status do
# assign_attributes(attributes)
# save!
# end
send_log "#{self.class}(#{self.id})\n -update!(attributes=#{attributes}) - new_record? #{self.new_record?}", BLUE, WHITE_BG
super
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update_record(record, model)\n raise_must_override\n end",
"def update_model(model, record)\n raise_must_override\n end",
"def save!\n create_or_update or raise RecordNotSaved\n end",
"def save!(*)\n create_or_update || raise(RecordNotSaved)\n end",
"def save_with_validation!()\n if valid?\n save_without_validation!()\n else\n raise RecordInvalid.new(self)\n end\n end",
"def update\n upsert do\n # NOTE:\n # 1. update ++then++ valid to set new values in @record to draw form.\n # 1. user_scoped may have joins so that record could be\n # ActiveRecord::ReadOnlyRecord so that's why access again from\n # model.\n @record = model.find(user_scoped.find(params[:id]).id)\n #upsert_files\n if !@record.update_attributes(permitted_params(:update))\n raise ActiveRecord::RecordInvalid.new(@record)\n end\n end\n end",
"def save!\n unless self.class.validators.empty?\n errors.clear\n self.class.validators.each do | validator | self.send(validator) end\n if errors.empty?\n _update!\n else\n raise(ValidationError, \"Could not save #{self.inspect} due to validation errors: \" + errors.each.join(';'))\n end\n else\n _update!\n end\n self\n end",
"def save!(options={})\n perform_validations(options) ? super : raise(RecordInvalid.new(self))\n end",
"def save(*)\n create_or_update\n rescue RecordInvalid\n false\n end",
"def save!\n raise \"#{self.inspect} failed to save\" unless self.save\n end",
"def update!\n self.save\n end",
"def before_update_save(record)\n record.save if record && record.valid?\n end",
"def silent_save\n if self.class.find(self.id)\n update\n else\n insert\n end\n end",
"def save!(**options, &block)\n create_or_update(**options, &block) || raise(RecordNotSaved.new(\"Failed to save the record\", self))\n end",
"def update\n check_fields\n sql = \"UPDATE #{table} SET #{to_update_record_str} WHERE id=#{@id}\"\n Database.transaction(sql)\n @log.debug \"Record[#{self}] is updated on Table[#{table}]\"\n end",
"def save!\n save ? self : raise(EntryNotSaved)\n end",
"def update\n validate_save_and_respond(update_change_set, :edit)\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 save(*)\n update_magic_properties\n clear_association_cache\n create_or_update\n end",
"def update!(raw: false)\n if valid? == false\n errors.full_messages.each do |msg|\n warn \"[#{parse_class}] warning: #{msg}\"\n end\n end\n response = client.update_object(parse_class, id, attribute_updates, session_token: _session_token)\n if response.success?\n result = response.result\n # Because beforeSave hooks can change the fields we are saving, any items that were\n # changed, are returned to us and we should apply those locally to be in sync.\n set_attributes!(result)\n end\n puts \"Error updating #{self.parse_class}: #{response.error}\" if response.error?\n return response if raw\n response.success?\n end",
"def update(bulk = false)\n caught = catch(:halt) do\n if self.new?\n save(bulk)\n else\n _run_update_callbacks do\n _run_save_callbacks do\n save_without_callbacks(bulk)\n end\n end\n end\n end\n end",
"def save!\n if !self.save\n raise Her::Errors::ResourceInvalid, self\n end\n self\n end",
"def save!(options = {})\n perform_validations(options) ? save_without_raising(options) : raise(RecordInvalid.new(self))\n end",
"def update_record(item = nil, no_raise: false, **prm)\n # noinspection RubyMismatchedReturnType\n super do |record, attr|\n unless administrator?\n org = current_org&.id or raise \"no org for #{current_user}\"\n discard = []\n if attr.key?((k = :org_id)) && (attr[k] != org)\n discard << k\n end\n if attr.key?((k = :email)) && ((acct = attr[k]) != record.account)\n if !acct.present? || !manager?\n discard << k\n elsif User.find_by(email: acct)&.org_id != org\n discard << k\n end\n end\n if (discarded = discard.presence && attr.except!(*discard)).present?\n Log.info do\n # noinspection RubyScope\n list = discarded.map { |k, v| \"#{k}=#{v.inspect}\" }.join(', ')\n \"#{__method__}: discarded: #{list} for #{current_user}\"\n end\n end\n end\n attr[:org_id] = nil if attr.key?(:org_id) && (attr[:org_id].to_i == 0)\n end\n end",
"def update\n record.assign_attributes(data)\n record.save! if record.changed?\n end",
"def update(options = {})\n run_callbacks :update do\n run_callbacks :save do\n # Check if record can be updated\n raise \"Cannot save a destroyed document!\" if destroyed?\n raise \"Calling #{self.class.name}#update on document that has not been created!\" if new?\n \n # Check if we can continue\n return false unless perform_validations(options)\n \n # perform update\n result = connection.update_relationship(self.id, self._to_database_hash)\n \n # if something goes wrong we receive a nil value and return false\n !result.nil?\n end\n end\n end",
"def update!(*)\n assert_source_saved 'The source must be saved before mass-updating the collection'\n super\n end",
"def update!(*)\n assert_source_saved 'The source must be saved before mass-updating the collection'\n super\n end",
"def save\n self.new_record ? self.create : self.update\n end",
"def _update_record(*args, &block)\n attributes_values = changes.map{|k, v| [k.to_sym, v.last]}.to_h\n\n if attributes_values.empty?\n rows_affected = 0\n else\n rows_affected = self.class.unscoped._update_record attributes_values, id, id_was\n end\n\n yield(self) if block_given?\n\n rows_affected\n end",
"def save(*args, &block)\n _superclass_instance_for_rw = superclass_instance_for_rw\n _subclass_instance_for_rw = subclass_instance_for_rw\n ActiveRecord::Base.transaction do\n _superclass_instance_for_rw.send(:create_or_update)\n _subclass_instance_for_rw.send(\"#{foreign_key_name}=\", _superclass_instance_for_rw.id)\n _subclass_instance_for_rw.send(:create_or_update)\n end\n self.id = _subclass_instance_for_rw.id\n _superclass_instance_for_rw.id.present? and _subclass_instance_for_rw.id.present?\n rescue ActiveRecord::RecordInvalid\n false\n end",
"def adjust_after_update\n # The record is in @record, do what you will, this precedes a save.\n end",
"def update\n if exists?\n if id\n if cache && !cache.includes?(self.class, id)\n msg = \"#{__FILE__}[#{__LINE__}] : #{model.class} : expected model with id #{id} to be in cache - cannot update\"\n Robe.logger.error(msg)\n raise DBError, msg\n end\n # TODO: unwind associations if update fails\n save_associations.to_promise_then do\n self.class.db.update_document_by_id(self.class.collection_name, to_db_hash)\n end.to_promise_then do\n cache.update(self) if cache\n self.to_promise\n end\n else\n msg = \"#{__FILE__}[#{__LINE__}] : #{model.class} : expected model from db to have id set - cannot update\"\n Robe.logger.error(msg)\n raise DBError, msg\n end\n else\n msg = \"#{__FILE__}[#{__LINE__}] : #{model.class} : cannot update model not loaded from db - it should be inserted\"\n Robe.logger.error(msg)\n raise DBError, msg\n end\n end",
"def update\n Model.test_for_invalid_status(:update, @model_status)\n\n clear_alerts; run_validation(:update)\n interface.update(@model_id, map_to_interface) unless @model_status == :error\n\n unless interface.id_ai\n @model_id = instance_variable_get( \"@#{interface.id_fld}\".to_sym )\n end\n\n self\n rescue Pod4::WeakError\n add_alert(:error, $!)\n self\n end",
"def update(work)\n super\n update_work_initial\n service.update_work ? update_work_succeeded : update_work_failed\n rescue StandardError => e\n update_work_failed\n errors(message(e))\n log(\"error while persisting work: #{e.message} : #{e.backtrace}\")\n end",
"def update!(**args)\n @exception = args[:exception] if args.key?(:exception)\n end",
"def update(*args) # args only necessary for delegation\n\t\tload_wrapped_object() # => @wrapped_object\n\t\t\n\t\t# delegate to wrapped object if :update is part of the contract\n\t\tif !@wrapped_object.nil? and @contract.include? :update\n\t\t\t# TODO: maybe memoize the invariant? could get bad if @contact is long\n\t\t\t\n\t\t\tprotect_runtime_errors do\n\t\t\t\t@wrapped_object.update *args\n\t\t\tend\n\t\tend\n\tend",
"def update\n validate_save_and_respond(load_change_set, :edit)\n end",
"def save!\n validate!\n create_or_update\n self\nend",
"def update(record)\n result = self.class.put(worksheet_url + \"/\" + record.id,\n :body => { \"fields\" => record.fields_for_update }.to_json,\n :headers => { \"Content-type\" => \"application/json\" }).parsed_response\n if result.present? && result[\"id\"].present?\n record.override_attributes!(result_attributes(result))\n record\n else # failed\n false\n end\n end",
"def save\n if self.id.nil?\n self.create\n else\n self.update\n end\n end",
"def update\n @dirty = true\n end",
"def _update(*)\n fail NotImplementedError\n end",
"def save(*)\n create_or_update\n end",
"def update\n @receiver = Receiver.find(params[:id])\n respond_to do |format|\n if @receiver.update_attributes(params[:receiver])\n @messages = {:success => \"El destinatario se ha actualizado correctamente\"}\n format.html { redirect_to new_receiver_path, notice: 'Receiver was successfully updated.' }\n format.json { head :no_content }\n else\n @messages = {:success => \"El destinatario no se ha actualizado, por favor, verifique los datos ingresados\"}\n format.html { render action: \"edit\" }\n format.json { render json: @receiver.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @receiver.update(receiver_params)\n redirect_to @receiver, notice: 'Receiver was successfully updated.'\n else\n render :edit\n end\n end",
"def update\n @update_success = @entry.update(entry_params)\n super\n end",
"def save!\n raise Cooler::InvalidObject unless save\n end",
"def update(*)\n assert_source_saved 'The source must be saved before mass-updating the collection'\n super\n end",
"def update(*)\n assert_source_saved 'The source must be saved before mass-updating the collection'\n super\n end",
"def update!(**args)\n @record = args[:record] if args.key?(:record)\n end",
"def update\n raise NotImplemented\n end",
"def update_state(record, bang)\n record.send(\"#{machine.attribute}=\", @options[:to])\n bang ? record.save! : record.save\n end",
"def update \n sneaker = find_sneaker\n # update! exceptions will be handled by the rescue_from ActiveRecord::RecordInvalid code\n sneaker.update(sneaker_params)\n render json: sneaker\n end",
"def update_entry\n current_entry.update(permitted_entry_params)\n current_entry.errors.empty?\n end",
"def save\n begin\n create_or_update\n rescue ActiveRecord::RecordInvalid\n false\n end\n end",
"def update\n active_menu(2)\n @receiver = Receiver.find(params[:id])\n\n respond_to do |format|\n if @receiver.update_attributes(params[:receiver])\n format.html { redirect_to @receiver, notice: 'Receiver was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @receiver.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_record_updates_event(record)\n # Decide if this is a new or updated record. Check both id_changed? and save_change_to_id? since we can't be sure\n # if we'll be in an after_save or after_commit callback\n new_rec = record.id_changed? || record.saved_change_to_id?\n rec_type = \"#{new_rec ? 'created' : 'updated'} #{ModelReference.record_type_to_ns_table_name(record.class).humanize.downcase}\"\n\n self.protocol_event = Rails.cache.fetch \"record_updates_protocol_events_#{sub_process.id}_#{rec_type}\" do\n sub_process.protocol_events.where(name: rec_type).first\n end\n\n return if protocol_event\n\n raise \"Bad protocol_event (#{rec_type}) for tracker #{record}. If you believe it should exist, \"\\\n 'check double spacing is correct in the definition for namespaced classes.'\n end",
"def update(...)\n assign_attributes(...)\n save\n end",
"def update_serial!\n update_serial\n save\n end",
"def after_update_save(record); end",
"def update\n flash[:success] = \"Record updated successfully.\"\n # call before actions created in the DSL\n if resource.before_actions[:update]\n resource.before_actions[:update].call(@record)\n end\n if @record.update(record_params)\n redirect_to polymorphic_path([app_kit, @record])\n else\n render 'edit'\n end\n end",
"def update(*args)\n update!(*args)\n rescue *exceptions\n false\n end",
"def update(*args)\n update!(*args)\n rescue *exceptions\n false\n end",
"def save!(*)\n super.tap do\n changes_applied\n end\n end",
"def update\n @relationship = Relationship.find(params[:id])\n begin\n save_result = @relationship.update_attributes(params[:relationship])\n rescue Exception => e\n set_errors(e)\n save_result = false\n end\n respond_to do |format|\n if save_result\n flash[:notice] = 'Relationship was successfully updated.'\n format.html { redirect_to(@relationship) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @relationship.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @title = t('view.sellers.edit_title')\n @seller = Seller.find(params[:id])\n\n respond_to do |format|\n if @seller.update_attributes(params[:seller])\n format.html { redirect_to @seller, notice: t('view.sellers.correctly_updated') }\n format.json { head :ok }\n else\n format.html { render action: 'edit' }\n format.json { render json: @seller.errors, status: :unprocessable_entity }\n end\n end\n rescue ActiveRecord::StaleObjectError\n redirect_to edit_seller_url(@seller), alert: t('view.sellers.stale_object_error')\n end",
"def save\n if self.send('id').nil?\n self.create\n else\n self.update\n end\n end",
"def update!(**args)\n @ending_record_id = args[:ending_record_id] if args.key?(:ending_record_id)\n @starting_record_id = args[:starting_record_id] if args.key?(:starting_record_id)\n @write_timestamp_us = args[:write_timestamp_us] if args.key?(:write_timestamp_us)\n end",
"def update!(*options)\n update(*options)\n save\n end",
"def update(uploaded_file)\n super\n record.save(raise_on_failure: true)\n end",
"def validate!\n raise ActiveRecord::RecordInvalid.new(self) unless valid?\n end",
"def save!(attributes = {})\n tap do\n unless save(attributes)\n raise RecordInvalid, errors.full_messages.join(\"; \")\n end\n end\n end",
"def update_instance!\n\t\tself.last_attempted = Time.now\n\t\tself.save\n\tend",
"def before_update_save(record); end",
"def update_partner\n\t\tpartner.update(partner_id: self.id) if partner\n\tend",
"def save!(*)\n super.tap do\n changes_applied\n end\n end",
"def update(model_data)\n end",
"def sneaky_update\n\n # Handle no changes.\n return true if changes.empty?\n\n # Here we have changes --> save them.\n pk = self.class.primary_key\n original_id = changed_attributes.has_key?(pk) ? changes[pk].first : send(pk)\n !self.class.where(pk => original_id).update_all(attributes).zero?\n end",
"def save\n validate\n\n if @id\n raise TwitterAds::NotFound.new(nil, 'Method PUT not allowed.', 404)\n else\n super\n end\n end",
"def update_record(attribute_names = attributes.keys)\n \n # Build a payload hash, but silently skip this operation if they are empty.\n payload_hash = attributes_for_update(attribute_names)\n return unless payload_hash.present?\n \n # Perform the operation and save the attributes returned by the remote.\n self.remote_attributes = self.class.identify(self).update_instance(payload_hash)\n \n # Return success.\n true\n end",
"def save\n if self.id.nil?\n self.insert\n else\n self.update\n end\n end",
"def handle_update\n obj = model.with_pk(normalized_type, request, request.id)\n model.set_fields(obj, :edit, request, model_params)\n model.hook(:before_update, request, obj)\n if model.save(obj)\n model.hook(:after_update, request, obj)\n request.set_flash_notice(\"Updated #{model.class_name}\")\n redirect(:edit, obj)\n else\n request.set_flash_now_error(\"Error Updating #{model.class_name}\")\n edit_page(obj)\n end\n end",
"def update(params)\n self.attributes = params\n save\n end",
"def update(params)\n self.attributes = params\n save\n end",
"def save(**options, &block)\n create_or_update(**options, &block)\n rescue ActiveRecord::RecordInvalid\n false\n end",
"def update\n begin\n saved = @address.update!(address_params)\n save_redirector saved, @address, \"Address was successfully updated.\"\n rescue ActiveRecord::RecordInvalid => e\n redirect_to edit_address_path(@address), notice: e.message\n end\n end",
"def update\n if note.update(note_params)\n successful_update\n else\n @errors = note.errors\n render_errors\n end\n end",
"def update(options = {}, &block)\n assign_attributes\n updated = with_callbacks(:update, :save) { entry.save }\n respond_options = options.reverse_merge(success: updated)\n respond_with(entry, respond_options, &block)\n end",
"def save\n self.save! rescue false\n end",
"def save!\n if !self.save\n raise ActiveService::Errors::ResourceInvalid.new(self)\n end\n self\n end",
"def update\n @video = Video.find(params[:id])\n\n # Transaction only if both succeed would the database call be committed.\n Video.transaction do\n\n # Exception catch block, but let it run through all the transaction until the last one.\n begin\n @video.update_attributes!(params[:video])\n rescue ActiveRecord::RecordInvalid => e\n # Run the second update anyway and let it catch all the incorrect entries.\n @video.asset.update_attributes!(params[:asset])\n # It would be rolled back anyway since we raise the exception again ourself.\n raise\n end\n @video.asset.update_attributes!(params[:asset])\n end\n\n\n respond_to do |format|\n if @video.save && @video.asset.save\n flash[:notice] = 'Video was successfully updated.'\n format.html { render :action => \"edit\" }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @video.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n fail_on_type_mismatch(data_params[:type])\n\n assign_record_attributes(queried_record, permitted_params_for(:update), data_params)\n\n execute_before_update_callbacks(queried_record)\n execute_before_save_callbacks(queried_record)\n\n fail RecordInvalidError.new(queried_record, engaged_field_aliases) if queried_record.errors.any?\n\n queried_record.save!\n\n execute_after_update_callbacks(queried_record)\n execute_after_save_callbacks(queried_record)\n\n render(\n json: queried_record,\n fields: query_params[:fields],\n include: query_params[:include]\n )\n end",
"def update(instance)\n raise NotImplementedError, 'Expected adapter to override `update`'\n end",
"def update\n @receiving_item = ReceivingItem.find(params[:id])\n\n respond_to do |format|\n if @receiving_item.update_attributes(params[:receiving_item])\n format.html { redirect_to(@receiving_item, :notice => 'Receiving item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @receiving_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def check_and_save(data)\n\n begin\n data.save!\n data\n rescue ActiveRecord::RecordInvalid\n data = data.refresh!\n data\n end\n \n end",
"def save\r\n do_without_exception(:save!)\r\n end",
"def handle_update(booking_data, room_data, property)\n bookingcom_room_reservation_id = room_data.xpath('./roomreservation_id').text();\n status = booking_data.xpath('./status').text();\n existing_booking = Booking.find_by_bookingcom_room_reservation_id(bookingcom_room_reservation_id)\n\n # do nothing if this xml handled before\n last_room_booking_xml = Nokogiri::XML(existing_booking.bookingcom_room_xml)\n\n puts \"#{bookingcom_room_reservation_id} #{status} #{EquivalentXml.equivalent?(last_room_booking_xml, room_data, opts = { :element_order => false, :normalize_whitespace => true })}\"\n puts last_room_booking_xml\n puts room_data\n\n # compare booking xml with the previously stored then do update\n if status == BookingcomBooking::TYPE_MODIFY and !EquivalentXml.equivalent?(last_room_booking_xml, room_data, opts = { :element_order => false, :normalize_whitespace => true })\n\n existing_booking.status = status\n existing_booking.booking_xml = booking_data.to_s\n existing_booking.bookingcom_room_xml = room_data.to_s\n\n existing_booking.guest_name = room_data.xpath('./guest_name').text();\n existing_booking.date_start = room_data.xpath('./arrival_date').text();\n existing_booking.date_end = room_data.xpath('./departure_date').text();\n existing_booking.amount = room_data.xpath('./totalprice').text()\n existing_booking.save\n end\n end",
"def update\n create_or_update\n end",
"def update!\n return if locked?\n set_eligibility\n if originator.present?\n originator.update_adjustment(self, source)\n end\n end"
] |
[
"0.67011845",
"0.656212",
"0.6325528",
"0.6268453",
"0.6085279",
"0.5977361",
"0.59665185",
"0.5933047",
"0.59068745",
"0.5894534",
"0.5867078",
"0.5847304",
"0.5760507",
"0.5753609",
"0.5734288",
"0.5721243",
"0.5717203",
"0.5695688",
"0.5691783",
"0.5690164",
"0.5670649",
"0.5662464",
"0.56622714",
"0.56575584",
"0.56566966",
"0.56339884",
"0.5633305",
"0.5633305",
"0.55972075",
"0.5595745",
"0.5592587",
"0.5574769",
"0.5573002",
"0.55552006",
"0.5553526",
"0.5537466",
"0.5526465",
"0.5513677",
"0.5509036",
"0.54907024",
"0.546794",
"0.5465425",
"0.5450693",
"0.5445981",
"0.54355097",
"0.5432764",
"0.54327554",
"0.5427732",
"0.54252785",
"0.54252785",
"0.5423978",
"0.5421722",
"0.5416449",
"0.54058075",
"0.54032767",
"0.5388532",
"0.5387032",
"0.53793204",
"0.5367243",
"0.5365384",
"0.53623277",
"0.5361409",
"0.536037",
"0.536037",
"0.53449774",
"0.53415096",
"0.5331572",
"0.5327097",
"0.53196234",
"0.53028107",
"0.529381",
"0.52828795",
"0.52820736",
"0.5277543",
"0.5272753",
"0.5271165",
"0.52686656",
"0.5268656",
"0.52620214",
"0.5261611",
"0.5260893",
"0.52511823",
"0.5241816",
"0.5234851",
"0.5234851",
"0.5234812",
"0.52307504",
"0.5220722",
"0.52097774",
"0.5202135",
"0.5200502",
"0.5194938",
"0.5189862",
"0.5188133",
"0.5182526",
"0.51780796",
"0.5174695",
"0.5160811",
"0.51601416",
"0.515939"
] |
0.51869404
|
94
|
GET /weapons/1 GET /weapons/1.json
|
def show
@weapon = Weapon.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @weapon }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @weapons = Weapon.all\n\n render json: @weapons\n end",
"def show\n @weapons_type = WeaponsType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @weapons_type }\n end\n end",
"def show\n render json: @weapon\n end",
"def index\n @weapons = Weapon.all\n end",
"def index\n @weapons = Weapon.all\n end",
"def set_api_v1_weapon\n @weapon = Weapon.find(params[:id])\n end",
"def show\n @weapon_kind = WeaponKind.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @weapon_kind }\n end\n end",
"def show\n @weapon = Weapon.find(params[:id])\n end",
"def index\n @weapons = Weapon.all\n render :json => @weapons, :include => :special_rules\n \n end",
"def index\n @weapons_types = WeaponsType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @weapons_types }\n end\n end",
"def show\n render json: @weapon_type\n end",
"def index\n @weapon_types = WeaponType.all\n\n render json: @weapon_types\n end",
"def new\n @weapon = Weapon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weapon }\n end\n end",
"def weapon\n fetch('supernatural.weapon')\n end",
"def show\n render :json => @weapon, :include => :special_rules\n end",
"def melee_weapon\n fetch('dnd.melee_weapons')\n end",
"def update\n @weapon = Weapon.find(params[:id])\n\n if @weapon.update(weapon_params)\n head :no_content\n else\n render json: @weapon.errors, status: :unprocessable_entity\n end\n end",
"def new\n @weapons_type = WeaponsType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weapons_type }\n end\n end",
"def new\n @weapon_kind = WeaponKind.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weapon_kind }\n end\n end",
"def destroy\n @weapon = Weapon.find(params[:id])\n @weapon.destroy\n\n respond_to do |format|\n format.html { redirect_to weapons_url }\n format.json { head :no_content }\n end\n end",
"def index\n @enemies = Enemy.find_by(name: params[:name])\n render json: @enemies\n end",
"def show\n render :json => @equipment_list, :include => [:weapons, :armours, :equipments]\n end",
"def show\n @weapon_info = WeaponInfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @weapon_info }\n end\n end",
"def index\n @ship_weapons = ShipWeapon.all\n end",
"def show\n @equipment = Equipment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @equipment }\n end\n end",
"def update\n @weapon = Weapon.find(params[:id])\n\n respond_to do |format|\n if @weapon.update_attributes(params[:weapon])\n format.html { redirect_to @weapon, notice: 'Weapon was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @weapon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n pet = BattlePet.find(params[:id])\n render json: pet, status: :ok\n end",
"def chose_weapon\n if @class == 'Water'\n chosen_weapon = Weapon.new \n return chosen_weapon.water_weapons\n end\n end",
"def set_weapon\n @weapon = Weapon.find(params[:id])\n end",
"def set_weapon\n @weapon = Weapon.find(params[:id])\n end",
"def set_weapon\n @weapon = Weapon.find(params[:id])\n end",
"def weapons_hash()\n return @weapons\n end",
"def create\n @weapon = Weapon.new(weapon_params)\n\n if @weapon.save\n render json: @weapon, status: :created, location: @weapon\n else\n render json: @weapon.errors, status: :unprocessable_entity\n end\n end",
"def getdifficulty\n @api.request 'getdifficulty'\n end",
"def game\n @level = Level.find(params[:id])\n\n @items = []\n @tools = []\n State.all.each do |state| \n if state.state_category.name == \"Tools\"\n @tools << state\n else\n @items << state\n end\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @level }\n end\n end",
"def index\n @weapon_types = WeaponType.all\n end",
"def index\n @equipment_lists = EquipmentList.all\n render :json => @equipment_lists, :include => [:weapons, :armours, :equipments]\n end",
"def find_hatchet\n HATCHET_ID.each do |id|\n weapon = character.equipment.get EquipmentConstants::WEAPON\n if weapon.id == id\n return HATCHET[id]\n end\n if character.inventory.contains id\n return HATCHET[id]\n end\n end\n return nil\nend",
"def index\n travels = Travel.where(:travel_category_id => @travel_category)\n # if weapon = params[:weapon]\n # travels = travels.where(name: weapon)\n # end\n\n respond_to do |format|\n #format.html { render :new }\n format.json { render json: travels, status: 200 }\n format.xml { render xml: travels, status: 200 }\n end\n\n # render json: travels, status: 200\n end",
"def update\n respond_to do |format|\n if @weapon.update(weapon_params)\n format.html { redirect_to @weapon, notice: \"Weapon was successfully updated.\" }\n format.json { render :show, status: :ok, location: @weapon }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @weapon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def ranged_weapon\n fetch('dnd.ranged_weapons')\n end",
"def show\n @skills = @warrior.skills\n @equipment_list = @warrior.equipment_lists\n @equipment = @warrior.equipments\n @armours = @warrior.armours\n @weapons = @warrior.weapons\n # render :json => @warrior, :include => [:skills, :equipment_lists, :equipments, :armours, :weapons]\n render json: {\n warrior: @warrior,\n skills: @skills,\n equipment: @equipment,\n weapons: @weapons,\n armours: @armours,\n status: 200}\n end",
"def update\n respond_to do |format|\n if @weapon.update(weapon_params)\n format.html { redirect_to @weapon, notice: 'Weapon was successfully updated.' }\n format.json { render :show, status: :ok, location: @weapon }\n else\n format.html { render :edit }\n format.json { render json: @weapon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @weapon.update(weapon_params)\n format.html { redirect_to @weapon, notice: 'Weapon was successfully updated.' }\n format.json { render :show, status: :ok, location: @weapon }\n else\n format.html { render :edit }\n format.json { render json: @weapon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @weapon_type = WeaponType.find(params[:id])\n\n if @weapon_type.update(weapon_type_params)\n head :no_content\n else\n render json: @weapon_type.errors, status: :unprocessable_entity\n end\n end",
"def swing_weapons(att_id)\n\t@swing = att_id\n\tweapon_power(@swing)\t\t\t\t\t\t\t\t\t\t# COUNT ATTACK ROLLS\n\tmulti_success(@swing, @attack_power[@swing],@swing_chance,@dice_faces) # RESOLVE ATTACK ROLLS (default is 5)\n # puts \"***********************\"\nend",
"def create\n @weapon = Weapon.new(params[:weapon])\n\n respond_to do |format|\n if @weapon.save\n format.html { redirect_to @weapon, notice: 'Weapon was successfully created.' }\n format.json { render json: @weapon, status: :created, location: @weapon }\n else\n format.html { render action: \"new\" }\n format.json { render json: @weapon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_batterie_by_building\n @battery = Battery.where(building_id: params[:building_id])\n respond_to do |format| \n format.json { render :json => @battery }\n end\n \n end",
"def fetch_weapons(doc)\n weapons = {}\n weapon_divs = doc.search(\"div.weapon_container\")\n weapon_divs.each do |weapon|\n weapon_stats = weapon/\"div.top\"\n name = (weapon_stats/\"div.title\").inner_html\n total = (weapon_stats/\"div:nth(4) div.number\").inner_html.gsub(\",\",\"\").to_i\n image = \"http://www.bungie.net#{(weapon_stats/\"div.overlay_img img\").first[:src]}\"\n weapons[[name, image]] = total\n end\n return weapons\n end",
"def show\n respond_to do |format|\n format.html { @player = Player.find(params[:id]) }\n format.json { render json: Player.find(params[:id]).as_json(:include => [:items, :spells]) }\n end\n end",
"def weapons_rack\n\t\t@components[ :weapons_rack ]\n\tend",
"def weapon; end",
"def weapon; end",
"def weapon; end",
"def getdifficulty\n request :getdifficulty\n end",
"def create\n @weapon = Weapon.new(weapon_params)\n\n respond_to do |format|\n if @weapon.save\n format.html { redirect_to @weapon, notice: 'Weapon was successfully created.' }\n format.json { render :show, status: :created, location: @weapon }\n else\n format.html { render :new }\n format.json { render json: @weapon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @weapon = Weapon.new(weapon_params)\n\n respond_to do |format|\n if @weapon.save\n format.html { redirect_to @weapon, notice: 'Weapon was successfully created.' }\n format.json { render :show, status: :created, location: @weapon }\n else\n format.html { render :new }\n format.json { render json: @weapon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @weapon = Weapon.new(weapon_params)\n\n respond_to do |format|\n if @weapon.save\n format.html { redirect_to @weapon, notice: \"Weapon was successfully created.\" }\n format.json { render :show, status: :created, location: @weapon }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @weapon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @damage = Damage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @damage }\n end\n end",
"def index\n @weapon_slots = WeaponSlot.all\n end",
"def destroy\n @weapon.destroy\n respond_to do |format|\n format.html { redirect_to weapons_url, notice: 'Weapon was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @weapon.destroy\n respond_to do |format|\n format.html { redirect_to weapons_url, notice: 'Weapon was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @weapon.destroy\n respond_to do |format|\n format.html { redirect_to weapons_url, notice: \"Weapon was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def getbatteries\n puts params\n buildid = params[\"buildingid\"]\n\n batteries = Battery.where(:building_id => buildid)\n\n puts batteries.inspect\n puts \"#################################################\"\n \n respond_to do |format|\n format.json { render json: batteries }\n end\n end",
"def show\n @ship = Ship.find(params[:id])\n @weapon = WeaponCard.find_by_ship_id(params[:id])\n @weapon_card = WeaponCard.new\n weapon_names = Weapon.all\n @weapon_names = {}\n weapon_names.each do |name|\n @weapon_names[name.name] = name.id\n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ship }\n format.js\n end\n end",
"def show\n @fleet = Fleet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fleet }\n end\n end",
"def show\n @energy_level = EnergyLevel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @energy_level }\n end\n end",
"def fetch\n result = WebApi.json!('ITFItems_440', 'GetPlayerItems', 1, { :SteamID => @steam_id64 })\n\n @items = []\n result[:items][:item].each do |item_data|\n unless item_data.nil?\n item = TF2Item.new(item_data)\n @items[item.backpack_position - 1] = item\n end\n end\n end",
"def get\n\t\t\t result = Status.find_by(windmillid: params[:windmillid]) \n \t\t\trender json: [result.as_json(only: [:status,:power,:gen,:frequency,:rotor,:wind,:pitch])]\n\tend",
"def get(params = {})\n client.get(\"/v1/shopping/hotels/#{@hotel_id}/hotel-offers\", params)\n end",
"def createWeapon\n weapon1 = Weapon.new(\"W1\",WeaponType::LASER,5)\n weapon2 = Weapon.new(\"W2\",WeaponType::MISSILE,7)\n weapon3 = Weapon.new(\"W3\",WeaponType::PLASMA,10)\n \n weapons = [weapon1,weapon2,weapon3]\n return weapons\n end",
"def find_hatchet\r\n HATCHET_ID.each do |id|\r\n weapon = character.equipment.get EquipmentConstants::WEAPON\r\n if weapon.id == id\r\n return HATCHET[id]\r\n end\r\n if character.inventory.contains id\r\n return HATCHET[id]\r\n end\r\n end\r\n return nil\r\n end",
"def show\n @texture = Texture.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @texture }\n end\n end",
"def difficulty\n request('getdifficulty')\n end",
"def update_weapon_stats\n weapons = fetch_weapons(@career)\n weapons = weapons.sort {|a,b| b[1] <=> a[1]}\n 5.times do |i|\n self[\"weapon#{i+1}_name\"] = weapons[i][0][0] rescue \"Not Enough Data\"\n self[\"weapon#{i+1}_url\"] = weapons[i][0][1] rescue \"http://www.bungie.net/images/halo3stats/weapons/unknown.gif\"\n self[\"weapon#{i+1}_num\"] = weapons[i][1] rescue 0\n end\n end",
"def index\n @equipos = Equipo.all\n render json: @equipos, status: :ok\n end",
"def destroy\n @weapon_kind = WeaponKind.find(params[:id])\n @weapon_kind.destroy\n\n respond_to do |format|\n format.html { redirect_to weapon_kinds_url }\n format.json { head :no_content }\n end\n end",
"def show\n @tower = Tower.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @tower }\n end\n end",
"def destroy\n @weapons_type = WeaponsType.find(params[:id])\n @weapons_type.destroy\n\n respond_to do |format|\n format.html { redirect_to weapons_types_url }\n format.json { head :no_content }\n end\n end",
"def update\n @weapons_type = WeaponsType.find(params[:id])\n\n respond_to do |format|\n if @weapons_type.update_attributes(params[:weapons_type])\n format.html { redirect_to @weapons_type, notice: 'Weapons type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @weapons_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @pet = Pet.find_by(id: params[:id])\n if @pet\n render json: @pet\n else\n render json: {}, status: 404\n end\n end",
"def weapons\n broadsword = header_for_id('F4 65 03 01')\n two_handed_sword = header_for_id('01 66 03 01')\n war_sword = header_for_id('02 66 03 01')\n daggers = header_for_id('1B 66 03 01')\n avengers = header_for_id('1C 66 03 01')\n filler_array = [broadsword] * 99 +\n [two_handed_sword] * 99 +\n [war_sword] * 99 +\n [daggers] * 99 +\n [avengers] * 99\n raise 'invalid length' unless filler_array.length == 5 * 99\n type = WEAPONS\n\n code_for_weapon_or_accessory(filler_array: filler_array, type: type)\n end",
"def index\n @warriors = Warrior.all\n render :json => @warriors, :include => [:skills, :equipment_lists,]\n\n end",
"def show\n @lab_equipment = LabEquipment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lab_equipment }\n end\n end",
"def show\n @energy = Energy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @energy }\n end\n end",
"def get_heroes\n heroes = []\n Hero.all.each do |hero|\n heroes << hero.to_json\n end\n heroes << Hero.first.to_json\n send_message({:action => \"get heroes list\", :status => game.status, :heroes => heroes})\n end",
"def show\n @potluck_item = PotluckItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @potluck_item }\n end\n end",
"def item(uuid)\n http.get \"/items/#{uuid}\"\n end",
"def show\n @equipcat = Equipcat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @equipcat }\n end\n end",
"def melee_weapon; end",
"def foods_units\n get('/foods/units.json')\n end",
"def index\n @textures = Texture.find(:all, :limit => 20, :order=> 'created_at desc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @textures }\n end\n end",
"def weapon_params\n params.require(:weapon).permit(:name, :description, :weapon_type)\n end",
"def index\n @games = Game.available\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end",
"def show\n @gethotel = Gethotel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gethotel }\n end\n end",
"def get_battery\n if params[:building].present?\n @batteries = Building.find(params[:building]).batteries\n else\n @batteries = Building.all\n end\n if request.xhr?\n respond_to do |format|\n format.json {\n render json: {batteries: @batteries}\n }\n end\n end\n end",
"def show\n @equipo= (set_equipo)\n render json: @equipo, status: :ok\n end",
"def show\n render \"api/v1/bounties/show\"\n end",
"def show\n @specie = Specie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @specie }\n end\n end",
"def show\n @lost_pet = LostPet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lost_pet }\n end\n end"
] |
[
"0.7620624",
"0.7189642",
"0.7102485",
"0.69799143",
"0.69799143",
"0.69689846",
"0.68149984",
"0.68138134",
"0.6691",
"0.66799194",
"0.66679573",
"0.66334397",
"0.6530178",
"0.6520478",
"0.64106685",
"0.63381404",
"0.63181996",
"0.6242265",
"0.61179525",
"0.6091401",
"0.604006",
"0.6008289",
"0.60064995",
"0.60048884",
"0.59785473",
"0.5926925",
"0.5913798",
"0.58974063",
"0.589717",
"0.589717",
"0.589717",
"0.5854937",
"0.5854366",
"0.5853749",
"0.58349884",
"0.5826115",
"0.58093923",
"0.5809114",
"0.5802826",
"0.5784658",
"0.5781554",
"0.5763499",
"0.57527095",
"0.57527095",
"0.5752367",
"0.57496256",
"0.57429063",
"0.57179207",
"0.5716547",
"0.5713353",
"0.5712574",
"0.570519",
"0.570519",
"0.570519",
"0.5691318",
"0.5687935",
"0.5687935",
"0.5660057",
"0.5646406",
"0.5631011",
"0.56266224",
"0.56266224",
"0.5620105",
"0.56166",
"0.5584904",
"0.5583759",
"0.55706733",
"0.55540335",
"0.5553397",
"0.5548873",
"0.553845",
"0.5532118",
"0.552787",
"0.5526422",
"0.552517",
"0.5518077",
"0.5508417",
"0.54988974",
"0.54960257",
"0.54931754",
"0.5491582",
"0.54867834",
"0.5476766",
"0.5475737",
"0.5473688",
"0.546754",
"0.5459941",
"0.5448724",
"0.5443437",
"0.54340506",
"0.5432706",
"0.54248315",
"0.54204226",
"0.5418659",
"0.5416696",
"0.5409803",
"0.54066336",
"0.5403539",
"0.53827375",
"0.5380074"
] |
0.7386189
|
1
|
GET /weapons/new GET /weapons/new.json
|
def new
@weapon = Weapon.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @weapon }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @weapons_type = WeaponsType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weapons_type }\n end\n end",
"def new\n @weapon_kind = WeaponKind.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weapon_kind }\n end\n end",
"def create\n @weapon = Weapon.new(params[:weapon])\n\n respond_to do |format|\n if @weapon.save\n format.html { redirect_to @weapon, notice: 'Weapon was successfully created.' }\n format.json { render json: @weapon, status: :created, location: @weapon }\n else\n format.html { render action: \"new\" }\n format.json { render json: @weapon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @weapon = Weapon.new(weapon_params)\n\n if @weapon.save\n render json: @weapon, status: :created, location: @weapon\n else\n render json: @weapon.errors, status: :unprocessable_entity\n end\n end",
"def new\n @equipment = Equipment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @equipment }\n end\n end",
"def create\n @weapon = Weapon.new(weapon_params)\n\n respond_to do |format|\n if @weapon.save\n format.html { redirect_to @weapon, notice: 'Weapon was successfully created.' }\n format.json { render :show, status: :created, location: @weapon }\n else\n format.html { render :new }\n format.json { render json: @weapon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @weapon = Weapon.new(weapon_params)\n\n respond_to do |format|\n if @weapon.save\n format.html { redirect_to @weapon, notice: 'Weapon was successfully created.' }\n format.json { render :show, status: :created, location: @weapon }\n else\n format.html { render :new }\n format.json { render json: @weapon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @weapon = Weapon.new(weapon_params)\n\n respond_to do |format|\n if @weapon.save\n format.html { redirect_to @weapon, notice: \"Weapon was successfully created.\" }\n format.json { render :show, status: :created, location: @weapon }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @weapon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @weapons_type = WeaponsType.new(params[:weapons_type])\n\n respond_to do |format|\n if @weapons_type.save\n format.html { redirect_to @weapons_type, notice: 'Weapons type was successfully created.' }\n format.json { render json: @weapons_type, status: :created, location: @weapons_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @weapons_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @weapon_info = WeaponInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @weapon_info }\n end\n end",
"def new\n @tower = Tower.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @tower }\n end\n end",
"def new\n @loot_type = LootType.new\n respond_with @loot_type\n end",
"def new\n @lost_pet = LostPet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lost_pet }\n end\n end",
"def new\n @equipo = Equipo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @equipo }\n end\n end",
"def new\n @tags_of_novel = TagsOfNovel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tags_of_novel }\n end\n end",
"def create\n @weapon_kind = WeaponKind.new(params[:weapon_kind])\n\n respond_to do |format|\n if @weapon_kind.save\n format.html { redirect_to @weapon_kind, notice: 'Weapon kind was successfully created.' }\n format.json { render json: @weapon_kind, status: :created, location: @weapon_kind }\n else\n format.html { render action: \"new\" }\n format.json { render json: @weapon_kind.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @weapon_type = WeaponType.new(weapon_type_params)\n\n if @weapon_type.save\n render json: @weapon_type, status: :created, location: @weapon_type\n else\n render json: @weapon_type.errors, status: :unprocessable_entity\n end\n end",
"def new\n @pot = Pot.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pot }\n end\n end",
"def new\n @specie = Specie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @specie }\n end\n end",
"def new\n @fleet = Fleet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fleet }\n end\n end",
"def new\n @potluck = Potluck.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @potluck }\n end\n end",
"def new\n @vegetable = Vegetable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vegetable }\n end\n end",
"def new\n @bowel_movement = BowelMovement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bowel_movement }\n end\n end",
"def new\n @bounty = Bounty.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @bounty }\n end\n end",
"def new\n @equipcat = Equipcat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @equipcat }\n end\n end",
"def new\n @monel = Monel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @monel }\n end\n end",
"def new\n @weight = Weight.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weight }\n end\n end",
"def new\n (kick and return) if not is_god?\n @team = Team.new\n @mode = :new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team }\n end\n end",
"def new\n @lost = Lost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lost }\n end\n end",
"def new\n @templete = Templete.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @templete }\n end\n end",
"def new\n @lab_equipment = LabEquipment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lab_equipment }\n end\n end",
"def create\n @weapon_type = WeaponType.new(weapon_type_params)\n\n respond_to do |format|\n if @weapon_type.save\n format.html { redirect_to @weapon_type, notice: 'Weapon type was successfully created.' }\n format.json { render :show, status: :created, location: @weapon_type }\n else\n format.html { render :new }\n format.json { render json: @weapon_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @item = Item.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n \n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end",
"def new\n @straddle = Straddle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @straddle }\n end\n end",
"def new\n @monkey = Monkey.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @monkey }\n end\n end",
"def new\n @level = Level.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @level }\n end\n end",
"def new\n @level = Level.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @level }\n end\n end",
"def new\n @level = Level.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @level }\n end\n end",
"def new\n #@gethotel = Gethotel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gethotel }\n end\n end",
"def new\n @lift = Lift.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lift }\n end\n end",
"def new\n @lector = Lector.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lector }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @item }\n end\n end",
"def new\n @ninja = Ninja.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ninja }\n end\n end",
"def new\n @food = Food.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @food }\n end\n end",
"def new\n @modifier = Modifier.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @modifier }\n end\n end",
"def new\n @inventoryitem = Inventoryitem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inventoryitem }\n end\n end",
"def new\n @fueltype = Fueltype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fueltype }\n end\n end",
"def new\n @damage = Damage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @damage }\n end\n end",
"def new\n @believer = Believer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @believer }\n end\n end",
"def new\n @mostsmalltrapeffectinventory = Mostsmalltrapeffectinventory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mostsmalltrapeffectinventory }\n end\n end",
"def new\n @thing = Thing.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @thing }\n end\n end",
"def new\n @beer = Beer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @beer }\n end\n end",
"def new\n @beer = Beer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @beer }\n end\n end",
"def new\n @mostsmallitemequipinventory = Mostsmallitemequipinventory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mostsmallitemequipinventory }\n end\n end",
"def new\n @vet = Vet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vet }\n end\n end",
"def new\n @entity = get_new()\n @verbindung = Verbindung.find(params[:verbindung_id])\n if !has_access_to_verbindung(@verbindung) then return end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entity }\n end\n end",
"def new\n @fooditem = Fooditem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @fooditem }\n end\n end",
"def new\n @pinglun = Pinglun.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pinglun }\n end\n end",
"def new\n @holding = Holding.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @holding }\n end\n end",
"def new\n @holding = Holding.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @holding }\n end\n end",
"def new\n @goat = Goat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @goat }\n end\n end",
"def new\n @volunteer = Volunteer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @volunteer }\n end\n end",
"def new\n @itemstable = Itemstable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @itemstable }\n end\n end",
"def new\n @vehicle = Vehicle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vehicle }\n end\n end",
"def new\n @variety = Variety.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @variety }\n end\n end",
"def new\n @entity = Entity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entity }\n end\n end",
"def new\n @monster = Monster.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @monster }\n end\n end",
"def new\n @equipament_type = EquipamentType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @equipament_type }\n end\n end",
"def new\n @item = Item.new\n @items = Item.all\n @tags = Tag.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end",
"def new\n @battle = Battle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @battle }\n end\n end",
"def new\n @room = Room.new\n\n render :json => @room \n end",
"def new\n @Love = Love.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @Love }\n end\n end",
"def new\n @equipamento = Equipamento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @equipamento }\n end\n end",
"def new\n @bottling = Bottling.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bottling }\n end\n end",
"def new\n @fortune = Fortune.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fortune }\n end\n end",
"def new\n @moose = Moose.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @moose }\n end\n end",
"def new\n @lei = Lei.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lei }\n end\n end",
"def new\n @thing = Thing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @thing }\n end\n end",
"def new\n @talent = Talent.new\n @types = Type.all\n \n respond_to do |format|\n format.html \n format.json { render :json => @talent }\n end\n end"
] |
[
"0.7845575",
"0.75163627",
"0.7183567",
"0.7163825",
"0.706204",
"0.7027837",
"0.7027837",
"0.6948872",
"0.6893723",
"0.68547326",
"0.6840513",
"0.67925453",
"0.6792377",
"0.67888635",
"0.6782877",
"0.6778225",
"0.6738559",
"0.6707748",
"0.6690493",
"0.6686553",
"0.6676164",
"0.66755146",
"0.66695756",
"0.6646041",
"0.66446036",
"0.66436976",
"0.6633223",
"0.6612569",
"0.6612446",
"0.6603428",
"0.65893763",
"0.6584659",
"0.6582736",
"0.65789235",
"0.65789235",
"0.65789235",
"0.65789235",
"0.65789235",
"0.65789235",
"0.65789235",
"0.65789235",
"0.65789235",
"0.65789235",
"0.65789235",
"0.65789235",
"0.65789235",
"0.65789235",
"0.65789235",
"0.65789235",
"0.65789235",
"0.65789235",
"0.65789235",
"0.65789235",
"0.6578679",
"0.6569911",
"0.6568084",
"0.65673673",
"0.6567133",
"0.65512985",
"0.654401",
"0.6527629",
"0.6518031",
"0.6518031",
"0.6516311",
"0.65115297",
"0.65096384",
"0.6504725",
"0.65022516",
"0.65017194",
"0.6496455",
"0.64957184",
"0.6482708",
"0.64756894",
"0.64756894",
"0.6469187",
"0.64663094",
"0.6457568",
"0.6456747",
"0.64564085",
"0.64563894",
"0.64563894",
"0.64536273",
"0.6449855",
"0.64483094",
"0.6446667",
"0.6446366",
"0.64457226",
"0.6443155",
"0.64427716",
"0.6431016",
"0.6426934",
"0.6421701",
"0.6420339",
"0.64199656",
"0.6419351",
"0.641616",
"0.641118",
"0.6406945",
"0.6406436",
"0.6405491"
] |
0.7992131
|
0
|
POST /weapons POST /weapons.json
|
def create
@weapon = Weapon.new(params[:weapon])
respond_to do |format|
if @weapon.save
format.html { redirect_to @weapon, notice: 'Weapon was successfully created.' }
format.json { render json: @weapon, status: :created, location: @weapon }
else
format.html { render action: "new" }
format.json { render json: @weapon.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @weapon = Weapon.new(weapon_params)\n\n if @weapon.save\n render json: @weapon, status: :created, location: @weapon\n else\n render json: @weapon.errors, status: :unprocessable_entity\n end\n end",
"def create\n @weapon = Weapon.new(weapon_params)\n\n respond_to do |format|\n if @weapon.save\n format.html { redirect_to @weapon, notice: \"Weapon was successfully created.\" }\n format.json { render :show, status: :created, location: @weapon }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @weapon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @weapon = Weapon.new(weapon_params)\n\n respond_to do |format|\n if @weapon.save\n format.html { redirect_to @weapon, notice: 'Weapon was successfully created.' }\n format.json { render :show, status: :created, location: @weapon }\n else\n format.html { render :new }\n format.json { render json: @weapon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @weapon = Weapon.new(weapon_params)\n\n respond_to do |format|\n if @weapon.save\n format.html { redirect_to @weapon, notice: 'Weapon was successfully created.' }\n format.json { render :show, status: :created, location: @weapon }\n else\n format.html { render :new }\n format.json { render json: @weapon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @weapon_type = WeaponType.new(weapon_type_params)\n\n if @weapon_type.save\n render json: @weapon_type, status: :created, location: @weapon_type\n else\n render json: @weapon_type.errors, status: :unprocessable_entity\n end\n end",
"def create\n @weapons_type = WeaponsType.new(params[:weapons_type])\n\n respond_to do |format|\n if @weapons_type.save\n format.html { redirect_to @weapons_type, notice: 'Weapons type was successfully created.' }\n format.json { render json: @weapons_type, status: :created, location: @weapons_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @weapons_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @weapons = Weapon.all\n\n render json: @weapons\n end",
"def weapon_params\n params.require(:weapon).permit(:name, :description, :weapon_type)\n end",
"def weapon_params\n params.require(:weapon).permit(:name, :cost, :range, :strength, :rarity)\n end",
"def create\n @weapon_type = WeaponType.new(weapon_type_params)\n\n respond_to do |format|\n if @weapon_type.save\n format.html { redirect_to @weapon_type, notice: 'Weapon type was successfully created.' }\n format.json { render :show, status: :created, location: @weapon_type }\n else\n format.html { render :new }\n format.json { render json: @weapon_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @weapon = Weapon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weapon }\n end\n end",
"def create\n @weapon_kind = WeaponKind.new(params[:weapon_kind])\n\n respond_to do |format|\n if @weapon_kind.save\n format.html { redirect_to @weapon_kind, notice: 'Weapon kind was successfully created.' }\n format.json { render json: @weapon_kind, status: :created, location: @weapon_kind }\n else\n format.html { render action: \"new\" }\n format.json { render json: @weapon_kind.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ship_weapon = ShipWeapon.new(ship_weapon_params)\n\n respond_to do |format|\n if @ship_weapon.save\n format.html { redirect_to @ship_weapon, notice: 'Ship weapon was successfully created.' }\n format.json { render :show, status: :created, location: @ship_weapon }\n else\n format.html { render :new }\n format.json { render json: @ship_weapon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @weapon_slot = WeaponSlot.new(weapon_slot_params)\n\n respond_to do |format|\n if @weapon_slot.save\n format.html { redirect_to @weapon_slot, notice: 'Weapon slot was successfully created.' }\n format.json { render :show, status: :created, location: @weapon_slot }\n else\n format.html { render :new }\n format.json { render json: @weapon_slot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @weapon = Weapon.find(params[:id])\n\n if @weapon.update(weapon_params)\n head :no_content\n else\n render json: @weapon.errors, status: :unprocessable_entity\n end\n end",
"def new\n @weapons_type = WeaponsType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weapons_type }\n end\n end",
"def weapon_params\n params.require(:weapon).permit(:datasheet_name, :name, :slot, :ranged, :melee, :primaryAddedMeleeStr, :secondaryAddedMeleeStr, :primaryMeleeRend, :secondaryMeleeRend, :firstShootAttacks, :firstShootAttacksD3, :firstShootAttacksD6, :secondShootAttacks, :secondShootAttacksD3, :secondShootAttacksD6, :thirdShootAttacks, :fourthShootAttacks, :firstRange, :secondRange, :thirdRange, :fourthRange, :firstShootAttacksDamageD3, :firstShootAttacksDamageD6, :secondShootAttacksDamageD3, :secondShootAttacksDamageD6, :points, :firstShootDamage, :secondShootDamage, :thirdShootDamage, :fourthShootDamage, :firstShootRend, :secondShootRend, :thirdShootRend, :fourthShootRend, :firstShootStrength, :secondShootStrength, :thirdShootStrength, :fourthShootStrength)\n end",
"def create\n @weapon_subtype = WeaponSubtype.new(weapon_subtype_params)\n\n respond_to do |format|\n if @weapon_subtype.save\n format.html { redirect_to @weapon_subtype, notice: 'Weapon subtype was successfully created.' }\n format.json { render :show, status: :created, location: @weapon_subtype }\n else\n format.html { render :new }\n format.json { render json: @weapon_subtype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_api_v1_weapon\n @weapon = Weapon.find(params[:id])\n end",
"def show\n render json: @weapon\n end",
"def index\n @weapons = Weapon.all\n end",
"def index\n @weapons = Weapon.all\n end",
"def index\n @weapon_types = WeaponType.all\n\n render json: @weapon_types\n end",
"def create_novel\n add_char_to_novel_svc = CharacterService::AddCharacterToNovel\n .new(params[:novel_id], params[:id])\n\n add_char_to_novel_svc.perform\n if add_char_to_novel_svc.errors?\n render json: add_char_to_novel_svc.errors,\n status: add_char_to_novel_svc.errors[:http_status]\n else\n render_ok\n end\n end",
"def index\n @weapons = Weapon.all\n render :json => @weapons, :include => :special_rules\n \n end",
"def update\n respond_to do |format|\n if @weapon.update(weapon_params)\n format.html { redirect_to @weapon, notice: \"Weapon was successfully updated.\" }\n format.json { render :show, status: :ok, location: @weapon }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @weapon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @weapon_kind = WeaponKind.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weapon_kind }\n end\n end",
"def createWeapon\n weapon1 = Weapon.new(\"W1\",WeaponType::LASER,5)\n weapon2 = Weapon.new(\"W2\",WeaponType::MISSILE,7)\n weapon3 = Weapon.new(\"W3\",WeaponType::PLASMA,10)\n \n weapons = [weapon1,weapon2,weapon3]\n return weapons\n end",
"def update\n @weapon_type = WeaponType.find(params[:id])\n\n if @weapon_type.update(weapon_type_params)\n head :no_content\n else\n render json: @weapon_type.errors, status: :unprocessable_entity\n end\n end",
"def create_weapons \n weapon = Weapon.create(name: 'Steel Sword', damage: 8, cost: 0, :merchant_id => self.id)\n # weapon.picture.attach(io: File.open('app/assets/images/weapons/steel sword.PNG'),\n # filename: 'steel sword.PNG')\n\n weapon1 = Weapon.create(name: 'Orcish Sword', damage: 15, cost: 15, :merchant_id => self.id )\n # weapon1.picture.attach(io: File.open('app/assets/images/weapons/orcish sword.PNG'),\n # filename: 'orcish sword.PNG')\n\n weapon2 = Weapon.create(name: 'Dawnbreaker', damage: 25, cost: 30, :merchant_id => self.id )\n # weapon2.picture.attach(io: File.open('app/assets/images/weapons/dawnbreaker.PNG'),\n # filename: 'dawnbreaker.PNG')\n end",
"def create\n @loot_type = LootType.new(loot_type_params)\n\n if @loot_type.save\n flash[:notice] = 'Loot type was successfully created.'\n respond_with @loot_type\n else\n render action: :new\n end\n end",
"def weapon_slot_params\n params.require(:weapon_slot).permit(:weapon_id, :ammo_slot_id, :character_id, :vehicle_id, :item_id)\n end",
"def index\n @weapons_types = WeaponsType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @weapons_types }\n end\n end",
"def update\n respond_to do |format|\n if @weapon.update(weapon_params)\n format.html { redirect_to @weapon, notice: 'Weapon was successfully updated.' }\n format.json { render :show, status: :ok, location: @weapon }\n else\n format.html { render :edit }\n format.json { render json: @weapon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @weapon.update(weapon_params)\n format.html { redirect_to @weapon, notice: 'Weapon was successfully updated.' }\n format.json { render :show, status: :ok, location: @weapon }\n else\n format.html { render :edit }\n format.json { render json: @weapon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @wod = Wod.new(wod_params)\n\n if @wod.save\n render json: @wod, status: :created\n else\n render json: @wod.errors, status: :unprocessable_entity\n end\n end",
"def set_weapon\n @weapon = Weapon.find(params[:id])\n end",
"def set_weapon\n @weapon = Weapon.find(params[:id])\n end",
"def set_weapon\n @weapon = Weapon.find(params[:id])\n end",
"def ship_weapon_params\n params.require(:ship_weapon).permit(:name, :description, :cost, :damage, :power, :mass, :hardpoint_use, :min_hull_class, :tech_level, :ap, :clumsy, :ammo_id, :phase_rating, :cloud)\n end",
"def destroy\n @weapon = Weapon.find(params[:id])\n @weapon.destroy\n\n respond_to do |format|\n format.html { redirect_to weapons_url }\n format.json { head :no_content }\n end\n end",
"def update\n @weapon = Weapon.find(params[:id])\n\n respond_to do |format|\n if @weapon.update_attributes(params[:weapon])\n format.html { redirect_to @weapon, notice: 'Weapon was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @weapon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n eqs = []\n puts params\n params[:boat][:equipments].each do |i|\n eqs << Equipment.find(i)\n end\n params[:boat][:equipments] = eqs\n @boat = Boat.new(params[:boat])\n\n respond_to do |format|\n if @boat.save\n format.html { redirect_to(@boat, :notice => 'Boat was successfully created.') }\n format.xml { render :xml => @boat, :status => :created, :location => @boat }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @boat.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @weapon_info = WeaponInfo.new(params[:weapon_info])\n\n respond_to do |format|\n if @weapon_info.save\n flash[:notice] = 'WeaponInfo was successfully created.'\n format.html { redirect_to(@weapon_info) }\n format.xml { render :xml => @weapon_info, :status => :created, :location => @weapon_info }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @weapon_info.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @weapon.destroy\n respond_to do |format|\n format.html { redirect_to weapons_url, notice: 'Weapon was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @weapon.destroy\n respond_to do |format|\n format.html { redirect_to weapons_url, notice: 'Weapon was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @weapon.destroy\n respond_to do |format|\n format.html { redirect_to weapons_url, notice: \"Weapon was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def melee_weapon\n fetch('dnd.melee_weapons')\n end",
"def show\n @weapon = Weapon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @weapon }\n end\n end",
"def create\n venture = Venture.new(venture_params)\n\n if venture.save \n render json: {venture: venture}, status: :created\n else\n render json: {status: 'Error', message: 'Venture not saved', data: venture.errors}, status: :unprocessable_entity\n end\n end",
"def create\n @equipment = Equipment.new(equipment_params)\n\n respond_to do |format|\n if @equipment.save\n format.html {\n if @equipment.is_kit?\n redirect_to new_equipment_sub_item_path(@equipment), notice: 'Please enter the items that make up this kit'\n else\n redirect_to @equipment, notice: 'Equipment was successfully created.'\n end\n }\n format.json { render :show, status: :created, location: @equipment }\n else\n format.html { render :new }\n format.json { render json: @equipment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n party = []\n (1..6).each do |p_number|\n level = params[:dungeon_instance][\"hero#{p_number}_level\"].to_i\n party << level if level > 0\n end\n\n dungeon = Dungeon.new\n dungeon.generate( params[:dungeon_instance][:size].to_i, party,\n encounters_difficulty: params[:dungeon_instance][:difficulty].to_sym )\n # p dungeon.to_json\n\n @dungeon_instance = DungeonInstance.new( dungeon_instance_params.merge( dungeon_data: dungeon.to_json ) )\n\n respond_to do |format|\n if current_user.dungeon_instances << @dungeon_instance\n format.html { redirect_to dungeon_instance_play_path( @dungeon_instance ), notice: 'Dungeon instance was successfully created.' }\n else\n format.html { redirect_to dungeon_instances_path, error: 'Dungeon instance was successfully created.' }\n end\n end\n end",
"def show\n render json: @weapon_type\n end",
"def create\n new_game = helpers.generate_game(params[\"game_name\"])\n\n slack_id = params[\"slack_id\"]\n\n response_url = params[\"response_url\"]\n\n @game = Game.new(new_game.new_game_data)\n\n if @game.save\n player = Player.exists?(slack_id: \"#{slack_id}\")\n if player\n player_records = Player.find_by(slack_id: \"#{slack_id}\")\n Rails.logger.info player_records[\"id\"].inspect\n render :json => {game_id: \"#{@game.id}\", player: \"#{player}\", player_id: \"#{player_records[\"id\"]}\"}\n else\n render :json => {game_id: \"#{@game.id}\", player: \"#{player}\"}\n end\n else\n render json: @game.errors, status: :unprocessable_entity\n end\n\n word_blanks = new_game.display_word_state\n\n HTTParty.post(response_url, \n {\n body: {\"text\" => \"#{word_blanks}\",\"response_type\" => \"in_channel\"}.to_json,\n headers: {\n \"Content-Type\" => \"application/json\"\n }\n }\n )\n \n end",
"def create\n @equipment = Equipment.new(equipment_params)\n\n respond_to do |format|\n if @equipment.save\n format.html { redirect_to @equipment, notice: 'Equipment was successfully created.' }\n format.json { render :show, status: :created, location: @equipment }\n else\n format.html { render :new }\n format.json { render json: @equipment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @wow = Wow.new(wow_params)\n\n respond_to do |format|\n if @wow.save\n format.html { redirect_to @wow, notice: 'Wow was successfully created.' }\n format.json { render :show, status: :created, location: @wow }\n else\n format.html { render :new }\n format.json { render json: @wow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n count = person_equipment_params[:count].to_i\n params = person_equipment_params.merge(count: 1)\n @person_equipments = []\n count.times do |i|\n @person_equipments << PersonEquipment.new(params)\n end\n @person_equipments.each(&:save)\n respond_to do |format|\n if @person_equipments.last.save\n format.html { redirect_to @person_equipments.last, status: 303 }\n format.json { redirect_to @person_equipments.last, status: 303 }\n else\n format.html { render :new }\n format.json { render json: @person_equipments.last.errors, status: :unprocessable_entity }\n end\n end\n end",
"def zombie_params\n params.require(:zombie).permit(:weapon, :kills, :brain)\n end",
"def battle_pet_params\n # TODO: FIXME\n params.require(:battle_pet).permit(:name, :traits => {})\n end",
"def create\n Log.add_info(request, params.inspect)\n\n raise(RequestPostOnlyException) unless request.post?\n\n SqlHelper.validate_token([params[:groups], params[:teams]])\n\n if params[:groups].blank?\n params[:equipment][:groups] = nil\n else\n params[:equipment][:groups] = '|' + params[:groups].join('|') + '|'\n end\n\n if params[:teams].blank?\n params[:equipment][:teams] = nil\n else\n params[:equipment][:teams] = '|' + params[:teams].join('|') + '|'\n end\n\n @equipment = Equipment.new(params.require(:equipment).permit(Equipment::PERMIT_BASE))\n\n begin\n @equipment.save!\n rescue => evar\n Log.add_error(request, evar)\n render(:controller => 'equipment', :action => 'edit')\n return\n end\n\n flash[:notice] = t('msg.register_success')\n\n list\n render(:action => 'list')\n end",
"def create\n @game = current_or_guest_user.games.create\n render json: @game, status: 201\n end",
"def create\n @equipment = Equipment.new(equipment_params)\n respond_to do |format|\n if @equipment.save\n format.html { redirect_to @equipment, notice: 'Equipment was successfully created.' }\n format.json { render action: 'show', status: :created, location: @equipment }\n flash[:error] = @equipment.errors.full_messages.join(' ')\n else\n format.html { render action: 'new' }\n format.json { render json: @equipment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @fleet = Fleet.new(params[:fleet])\n\n respond_to do |format|\n if @fleet.save\n format.html { redirect_to @fleet, notice: 'Fleet was successfully created.' }\n format.json { render json: @fleet, status: :created, location: @fleet }\n else\n format.html { render action: \"new\" }\n format.json { render json: @fleet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def unit_params\n params.require(:unit).permit(:libe, :amount, :points, :weapon)\n end",
"def create\n @tags_of_novel = TagsOfNovel.new(params[:tags_of_novel])\n\n respond_to do |format|\n if @tags_of_novel.save\n format.html { redirect_to @tags_of_novel, notice: 'Tags of novel was successfully created.' }\n format.json { render json: @tags_of_novel, status: :created, location: @tags_of_novel }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tags_of_novel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @weapons_type = WeaponsType.find(params[:id])\n\n respond_to do |format|\n if @weapons_type.update_attributes(params[:weapons_type])\n format.html { redirect_to @weapons_type, notice: 'Weapons type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @weapons_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #tags are sent to the controller as a string array\n #we'll create our own way to find the Tag objects\n tags = equipment_params[:tags]\n\n tags_object_collection = []\n\n tags.each do |tag|\n if tag == ''\n next\n end\n\n tag_obj = Tag.find(tag)\n\n if tag_obj != nil\n tags_object_collection.push(tag_obj)\n end\n end\n\n new_equipment_params = equipment_params.except(:tags)\n\n @equipment = Equipment.new(new_equipment_params)\n @equipment.tags = tags_object_collection\n\n respond_to do |format|\n if @equipment.save\n format.html { redirect_to equipment_index_path, notice: 'Equipment was successfully created.' }\n format.json { render json: @equipment, status: :created, location: @equipment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @equipment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n megam_rest.post_billedhistories(to_hash)\n end",
"def create\n json = ActiveSupport::JSON.decode(params[:player])\n @player = Player.new\n @player.gender = json[\"gender\"]\n @player.username = json[\"username\"]\n @player.uuid = json[\"uuid\"]\n @player.last_location = json[\"location\"]\n @player.player_monsters = [ PlayerMonster.new({ :nickname => json[\"starting_monster\"][\"nickname\"],\n :monster_id => json[\"starting_monster\"][\"id\"],\n :caught_location => json[\"location\"]\n }) ]\n if @player.save\n render :json => { :success => true, :player => @player } , :status => 200\n else\n render :json => { :success => false, :message => @player.errors } , :status => 400\n end\n end",
"def assign_wares\n create_weapons \n create_armors\n create_potions\n end",
"def swing_weapons(att_id)\n\t@swing = att_id\n\tweapon_power(@swing)\t\t\t\t\t\t\t\t\t\t# COUNT ATTACK ROLLS\n\tmulti_success(@swing, @attack_power[@swing],@swing_chance,@dice_faces) # RESOLVE ATTACK ROLLS (default is 5)\n # puts \"***********************\"\nend",
"def create\n post_params = {\n name: params[:name].downcase,\n units: params[:units] || 0\n }\n render json: Ingredient.create!(post_params), status: :created\n end",
"def pet_types\r\n BnetApi::make_request('/wow/data/pet/types')\r\n end",
"def create\n @equipo = Equipo.new(equipo_params)\n\n if @equipo.save\n render :show, status: :created, location: @equipo\n EquiposUsers.create(\n user_id: params[:capitan_name] ,\n equipo_id: @equipo.id\n )\n else\n render json: @equipo.errors, status: :unprocessable_entity\n end\n end",
"def create\n\n species = Faker::Games::Pokemon.name\n nickname = Faker::Name.first_name\n trainer = Trainer.find(params[:trainer_id])\n if trainer.pokemons.length < 6\n pokemon = Pokemon.create(nickname: nickname, species: species, trainer_id: params[:trainer_id])\n render json: pokemon\n else\n render json: {message: \"Pokemon cannot be created\"}, status: 400\n end\n end",
"def weapon; end",
"def weapon; end",
"def weapon; end",
"def weapon_type_params\n params[:weapon_type]\n end",
"def add_weapon(weapon)\n add_speed, add_strength, add_intelligence, add_health = weapon.get_attributes()\n @speed += add_speed\n @strength += add_strength\n @intelligence += add_intelligence\n @health += add_health\n end",
"def melee_weapon; end",
"def create\n @fleet = Fleet.new(fleet_params)\n\n respond_to do |format|\n if @fleet.save\n format.html { redirect_to @fleet, notice: 'Fleet was successfully created.' }\n format.json { render action: 'show', status: :created, location: @fleet }\n else\n format.html { render action: 'new' }\n format.json { render json: @fleet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @weapons_type = WeaponsType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @weapons_type }\n end\n end",
"def create\n @ty = Tie.new(ty_params)\n\n respond_to do |format|\n if @ty.save\n format.html { redirect_to @ty, notice: 'Tie was successfully created.' }\n format.json { render action: 'show', status: :created, location: @ty }\n else\n format.html { render action: 'new' }\n format.json { render json: @ty.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @diet = Diet.new(diet_params)\n @diet.user = @current_user\n\n if @diet.save\n render json: @diet, status: 201, location: @diet, root: true\n else\n render json: @diet.errors, status: 422\n end\n end",
"def create\n @skin_diet = SkinDiet.new(skin_diet_params)\n\n respond_to do |format|\n if @skin_diet.save\n format.html { redirect_to @skin_diet, notice: 'Skin diet was successfully created.' }\n format.json { render :show, status: :created, location: @skin_diet }\n else\n format.html { render :new }\n format.json { render json: @skin_diet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def weapons_hash()\n return @weapons\n end",
"def create\n dive = Dive.new(dive_params)\n if dive.save\n render json: dive\n else\n render json: {message: dive.errors}, status: 400\n end\n end",
"def weapons\n broadsword = header_for_id('F4 65 03 01')\n two_handed_sword = header_for_id('01 66 03 01')\n war_sword = header_for_id('02 66 03 01')\n daggers = header_for_id('1B 66 03 01')\n avengers = header_for_id('1C 66 03 01')\n filler_array = [broadsword] * 99 +\n [two_handed_sword] * 99 +\n [war_sword] * 99 +\n [daggers] * 99 +\n [avengers] * 99\n raise 'invalid length' unless filler_array.length == 5 * 99\n type = WEAPONS\n\n code_for_weapon_or_accessory(filler_array: filler_array, type: type)\n end",
"def create\n @user = User.find(params[:user_id])\n @water = @user.waters.create!(water_params)\n\n respond_to do |format|\n if @water.save\n format.html { redirect_to user_waters_path, notice: 'Water was successfully created.' }\n format.json { render :show, status: :created, location: @water }\n else\n format.html { render :new }\n format.json { render json: @water.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @character = Character.new(character_params)\n @character.give_class_benefits\n @character.give_race_benefits\n @character.level = 1\n \n respond_to do |format|\n if @character.save\n format.html { redirect_to @character, notice: 'Character was successfully created.' }\n format.json { render :show, status: :created, location: @character }\n else\n format.html { render :new }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @type = params[:type]\n item = params.require(:item)\n @mac = item.require(:machine)\n machine = Machine.check(@mac.permit(:mac))\n\n data = item.require(:data)\n @result = Array.new\n data.each do |d|\n @result << machine.wbgts.create(d.permit(:black, :dry, :wet, :humidity, :wbgt_data, :date, :beginning))\n end\n\n render :status => :created\n end",
"def pokemon_params\n params.require(:pokemon).permit(:name, :age, :enjoys)\n end",
"def create\n @equipo_torneos = EquiposTorneos.new(equipos_torneos_params)\n \n if @equipo_torneos.save\n \n else\n render json: @equipo_torneos.errors, status: :unprocessable_entity\n end\n end",
"def create_item()\n\n request_body = {\n 'name' => 'Milkshake',\n 'variations' => [\n {\n 'name' => 'Small',\n 'pricing_type' => 'FIXED_PRICING',\n 'price_money' => {\n 'currency_code' => 'USD',\n 'amount' => 400\n }\n }\n ]\n }\n\n response = Unirest.post CONNECT_HOST + '/v1/' + LOCATION_ID + '/items',\n headers: REQUEST_HEADERS,\n parameters: request_body.to_json\n\n if response.code == 200\n puts 'Successfully created item:'\n puts JSON.pretty_generate(response.body)\n return response.body\n else\n puts 'Item creation failed'\n puts response.body\n return nil\n end\nend",
"def destroy\n @weapons_type = WeaponsType.find(params[:id])\n @weapons_type.destroy\n\n respond_to do |format|\n format.html { redirect_to weapons_types_url }\n format.json { head :no_content }\n end\n end",
"def create\n @enemy = Enemy.new(enemy_params)\n\n respond_to do |format|\n if @enemy.save\n format.html { redirect_to @enemy, notice: \"Enemy was successfully created.\" }\n format.json { render :show, status: :created, location: @enemy }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @enemy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @enemies = Enemy.find_by(name: params[:name])\n render json: @enemies\n end",
"def show\n render :json => @weapon, :include => :special_rules\n end",
"def create\n @water = current_user.waters.build(water_params)\n\n respond_to do |format|\n if @water.save\n format.html { redirect_to @water, notice: 'Water was successfully created.' }\n format.json { render action: 'show', status: :created, location: @water }\n else\n format.html { render action: 'new' }\n format.json { render json: @water.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.727721",
"0.6872981",
"0.68676937",
"0.68676937",
"0.67620575",
"0.6574865",
"0.6567704",
"0.6530898",
"0.6409188",
"0.6345288",
"0.61694443",
"0.6140537",
"0.61349064",
"0.6081107",
"0.6062876",
"0.60300845",
"0.5990556",
"0.5892557",
"0.587066",
"0.58628786",
"0.5834465",
"0.5834465",
"0.5774088",
"0.5702616",
"0.56836057",
"0.56296253",
"0.56207883",
"0.5594312",
"0.55731857",
"0.55534315",
"0.55398375",
"0.553439",
"0.553097",
"0.55062765",
"0.55062765",
"0.550506",
"0.54909277",
"0.54909277",
"0.54909277",
"0.54832435",
"0.5480479",
"0.5464454",
"0.5459034",
"0.54360944",
"0.5419793",
"0.5419793",
"0.5416087",
"0.5409898",
"0.5409726",
"0.54005593",
"0.5397589",
"0.53750896",
"0.53727263",
"0.535843",
"0.5346772",
"0.5344456",
"0.53414875",
"0.53405696",
"0.5339868",
"0.53185725",
"0.5315304",
"0.531463",
"0.5296",
"0.52895045",
"0.52865416",
"0.52822435",
"0.5264486",
"0.5258253",
"0.5252082",
"0.52455354",
"0.5222875",
"0.5216479",
"0.5205015",
"0.5203273",
"0.5201032",
"0.51930416",
"0.51930416",
"0.51930416",
"0.5181532",
"0.51795065",
"0.5176124",
"0.5171113",
"0.51698476",
"0.51690596",
"0.5155756",
"0.51515675",
"0.5145648",
"0.51448625",
"0.5137793",
"0.5135225",
"0.51333517",
"0.5132345",
"0.5132169",
"0.51314515",
"0.51218563",
"0.5120334",
"0.5116882",
"0.5111854",
"0.5108934",
"0.5107894"
] |
0.6927277
|
1
|
PUT /weapons/1 PUT /weapons/1.json
|
def update
@weapon = Weapon.find(params[:id])
respond_to do |format|
if @weapon.update_attributes(params[:weapon])
format.html { redirect_to @weapon, notice: 'Weapon was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @weapon.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @weapon = Weapon.find(params[:id])\n\n if @weapon.update(weapon_params)\n head :no_content\n else\n render json: @weapon.errors, status: :unprocessable_entity\n end\n end",
"def set_api_v1_weapon\n @weapon = Weapon.find(params[:id])\n end",
"def update\n @weapon_type = WeaponType.find(params[:id])\n\n if @weapon_type.update(weapon_type_params)\n head :no_content\n else\n render json: @weapon_type.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @weapon.update(weapon_params)\n format.html { redirect_to @weapon, notice: \"Weapon was successfully updated.\" }\n format.json { render :show, status: :ok, location: @weapon }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @weapon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @weapon.update(weapon_params)\n format.html { redirect_to @weapon, notice: 'Weapon was successfully updated.' }\n format.json { render :show, status: :ok, location: @weapon }\n else\n format.html { render :edit }\n format.json { render json: @weapon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @weapon.update(weapon_params)\n format.html { redirect_to @weapon, notice: 'Weapon was successfully updated.' }\n format.json { render :show, status: :ok, location: @weapon }\n else\n format.html { render :edit }\n format.json { render json: @weapon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @weapons_type = WeaponsType.find(params[:id])\n\n respond_to do |format|\n if @weapons_type.update_attributes(params[:weapons_type])\n format.html { redirect_to @weapons_type, notice: 'Weapons type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @weapons_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @weapon_kind = WeaponKind.find(params[:id])\n\n respond_to do |format|\n if @weapon_kind.update_attributes(params[:weapon_kind])\n format.html { redirect_to @weapon_kind, notice: 'Weapon kind was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @weapon_kind.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @weapon_type.update(weapon_type_params)\n format.html { redirect_to @weapon_type, notice: 'Weapon type was successfully updated.' }\n format.json { render :show, status: :ok, location: @weapon_type }\n else\n format.html { render :edit }\n format.json { render json: @weapon_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_weapon\n @weapon = Weapon.find(params[:id])\n end",
"def set_weapon\n @weapon = Weapon.find(params[:id])\n end",
"def set_weapon\n @weapon = Weapon.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @weapon_slot.update(weapon_slot_params)\n format.html { redirect_to @weapon_slot, notice: 'Weapon slot was successfully updated.' }\n format.json { render :show, status: :ok, location: @weapon_slot }\n else\n format.html { render :edit }\n format.json { render json: @weapon_slot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @weapon_info = WeaponInfo.find(params[:id])\n\n respond_to do |format|\n if @weapon_info.update_attributes(params[:weapon_info])\n flash[:notice] = 'WeaponInfo was successfully updated.'\n format.html { redirect_to(@weapon_info) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @weapon_info.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ship_weapon.update(ship_weapon_params)\n format.html { redirect_to @ship_weapon, notice: 'Ship weapon was successfully updated.' }\n format.json { render :show, status: :ok, location: @ship_weapon }\n else\n format.html { render :edit }\n format.json { render json: @ship_weapon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @usertable = Usertable.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @usertable.update_attributes(params[:usertable])\r\n format.html { redirect_to @usertable, notice: 'Your mood 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: @usertable.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @fleet = Fleet.find(params[:id])\n\n respond_to do |format|\n if @fleet.update_attributes(params[:fleet])\n format.html { redirect_to @fleet, notice: 'Fleet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fleet.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 update\n @tags_of_novel = TagsOfNovel.find(params[:id])\n\n respond_to do |format|\n if @tags_of_novel.update_attributes(params[:tags_of_novel])\n format.html { redirect_to @tags_of_novel, notice: 'Tags of novel was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tags_of_novel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @weapon = Weapon.new(weapon_params)\n\n if @weapon.save\n render json: @weapon, status: :created, location: @weapon\n else\n render json: @weapon.errors, status: :unprocessable_entity\n end\n end",
"def update\n @animal.update(animal_params)\n respond_with(@shelter)\n end",
"def update\n respond_to do |format|\n if @fleet.update(fleet_params)\n format.html { redirect_to @fleet, notice: 'Fleet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @fleet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def weapon_params\n params.require(:weapon).permit(:name, :description, :weapon_type)\n end",
"def weapon_params\n params.require(:weapon).permit(:name, :cost, :range, :strength, :rarity)\n end",
"def update\n respond_to do |format|\n if @weapon_subtype.update(weapon_subtype_params)\n format.html { redirect_to @weapon_subtype, notice: 'Weapon subtype was successfully updated.' }\n format.json { render :show, status: :ok, location: @weapon_subtype }\n else\n format.html { render :edit }\n format.json { render json: @weapon_subtype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tower = Tower.find(params[:id])\n\n respond_to do |format|\n if @tower.update_attributes(params[:tower])\n format.html { redirect_to @tower, :notice => 'Tower was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @tower.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n url = 'https://casa-core.herokuapp.com/api/units/' + params[:id]\n query = {\n 'name' => params[:name]\n }\n response = HTTParty.put(url, :query => query, :headers => { \"Authorization\" => AUTH, \"Host\" => HOST})\n\n if response.code == 200\n redirect_to unit_path(params[:id]), notice: 'Unit was successfully updated.'\n else\n redirect_to unit_path(params[:id]), notice: 'Sheesh! Minor hiccup...run that again!'\n end\n end",
"def update\n @character.aasm_state = 'creation' if @character.aasm_state.nil?\n\n # Remove equipment with 0 quantity.\n if !@character.character_gears.nil?\n @character.character_gears.each do |cg|\n if cg.qty.nil? || cg.qty < 1\n @item = CharacterGear.find_by_id(cg.id)\n @item.destroy\n end\n end\n end\n\n if params[:update_specializations]\n if params[:character][:specialization_1] && !params[:character][:specialization_1].blank?\n set_experience_cost(@character.id, 'specialization', params[:character][:specialization_1], 1, 'up')\n end\n if params[:character][:specialization_2] && !params[:character][:specialization_2].blank?\n set_experience_cost(@character.id, 'specialization', params[:character][:specialization_2], 2, 'up')\n end\n if params[:character][:specialization_3] && !params[:character][:specialization_3].blank?\n set_experience_cost(@character.id, 'specialization', params[:character][:specialization_3], 3, 'up')\n end\n end\n\n # Update talents.\n if !params[:update_talents].nil?\n @talent_trees = Array.new\n unless @character.specialization_1.nil?\n @talent_trees << TalentTree.find_by_id(@character.specialization_1)\n end\n unless @character.specialization_2.nil?\n @talent_trees << TalentTree.find_by_id(@character.specialization_2)\n end\n unless @character.specialization_3.nil?\n @talent_trees << TalentTree.find_by_id(@character.specialization_3)\n end\n end\n\n # Update character skill entries for character to add in new skills created since the character was created.\n existing_skills = []\n @character.character_skills.each do |skill|\n existing_skills << skill.skill.id unless skill.skill.nil?\n end\n Skill.where(true).each do |skill|\n if !existing_skills.include?(skill.id)\n @character_skill = CharacterSkill.new()\n @character_skill.character_id = @character.id\n @character_skill.ranks = 0\n @character_skill.skill_id = skill.id\n @character_skill.save\n end\n end\n\n if !params[:character_characteristics].nil?\n ['brawn', 'agility', 'intellect', 'willpower', 'cunning', 'presence'].each do |stat|\n if params[:character][stat.to_sym].to_i > @character.race[stat]\n set_experience_cost(@character.id, stat, 0, params[:character][stat.to_sym].to_i, 'up')\n elsif params[:character][stat.to_sym].to_i < @character[stat]\n set_experience_cost(@character.id, stat, 0, (@character[stat] - params[:character][stat.to_sym].to_i), 'down')\n end\n end\n end\n\n respond_to do |format|\n if @character.update_attributes(character_params)\n if !params[:destination].nil?\n if params[:destination] == 'gear'\n flash[:success] = 'Character equipment updated'\n elsif params[:destination] == 'weapons'\n flash[:success] = 'Character weapons updated'\n format.html { redirect_to user_character_weapons_path(@character.user, @character) }\n elsif params[:destination] == 'armor'\n flash[:success] = 'Character armor updated'\n format.html { redirect_to user_character_armor_path(@character.user, @character) }\n elsif params[:destination] == 'talents'\n flash[:success] = 'Character talents updated'\n format.html { redirect_to user_character_talents_path(@character.user, @character) }\n elsif params[:destination] == 'skills'\n flash[:success] = 'Character career free skill ranks saved.'\n elsif params[:destination] == 'characteristics'\n flash[:success] = 'Characteristics updated'\n format.html { redirect_to user_character_path(@character.user, @character) }\n elsif params[:destination] == 'background'\n flash[:success] = 'Background saved'\n format.html { redirect_to user_character_background_path(@character.user, @character)}\n elsif params[:destination] == 'obligation'\n format.html { redirect_to user_character_obligation_path(@character.user, @character) }\n elsif params[:destination] == 'motivation'\n format.html { redirect_to user_character_motivation_path(@character.user, @character) }\n end\n else\n format.html { redirect_to user_character_path(@character.user, @character), notice: 'Character was successfully updated.' }\n end\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render json: Alien.update(params[\"id\"], params[\"alien\"])\n end",
"def create\n @weapon = Weapon.new(params[:weapon])\n\n respond_to do |format|\n if @weapon.save\n format.html { redirect_to @weapon, notice: 'Weapon was successfully created.' }\n format.json { render json: @weapon, status: :created, location: @weapon }\n else\n format.html { render action: \"new\" }\n format.json { render json: @weapon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @weapon = Weapon.find(params[:id])\n @weapon.destroy\n\n respond_to do |format|\n format.html { redirect_to weapons_url }\n format.json { head :no_content }\n end\n end",
"def update(id, attributes)\n # attributes = {name: 'chocolate and peanuts', calories: 10}\nend",
"def index\n @weapons = Weapon.all\n\n render json: @weapons\n end",
"def update\n @equipo = Equipo.find params[:id]\n if @equipo.update(equipo_params)\n render :show, status: :ok, location: @equipo\n else\n render json: @equipo.errors, status: :unprocessable_entity\n end\n end",
"def update\n tag = Tag.find_by_id(params[:id])\n if tag.update(params.permit(:name))\n render json: tag, status: :ok\n else\n respond_with tag.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @equipment_model.update(equipment_model_params)\n format.html { redirect_to @equipment_model, notice: t('.update_ok', item: @equipment_model.name) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @equipment_model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n params.require(%i[id units])\n retrieve_and_validate_put.update!(units: params[:units])\n head :no_content\n end",
"def update\n if @person.seat\n render json: {errors: 'Cannot update a seated person'}, status: 422\n else\n @person.update person_params\n render json: @person\n end\n end",
"def update\n if @diet.update(diet_params)\n head :no_content, status: 204\n else\n render json: @diet.errors, status: 422\n end\n end",
"def update\n @texture = Texture.find(params[:id])\n\n respond_to do |format|\n if @texture.update_attributes(params[:texture])\n format.html { redirect_to @texture, :notice => 'Texture was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @texture.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n if @player.update(player_params)\n flash[:notice] = 'Weapon Equiped'\n redirect_to levels_path\n end\n end",
"def create\n @weapon = Weapon.new(weapon_params)\n\n respond_to do |format|\n if @weapon.save\n format.html { redirect_to @weapon, notice: 'Weapon was successfully created.' }\n format.json { render :show, status: :created, location: @weapon }\n else\n format.html { render :new }\n format.json { render json: @weapon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @weapon = Weapon.new(weapon_params)\n\n respond_to do |format|\n if @weapon.save\n format.html { redirect_to @weapon, notice: 'Weapon was successfully created.' }\n format.json { render :show, status: :created, location: @weapon }\n else\n format.html { render :new }\n format.json { render json: @weapon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @weapon = Weapon.new(weapon_params)\n\n respond_to do |format|\n if @weapon.save\n format.html { redirect_to @weapon, notice: \"Weapon was successfully created.\" }\n format.json { render :show, status: :created, location: @weapon }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @weapon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fueltype = Fueltype.find(params[:id])\n\n respond_to do |format|\n if @fueltype.update_attributes(params[:fueltype])\n format.html { redirect_to @fueltype, notice: 'Fueltype was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fueltype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render json: Item.update(params[\"id\"], params[\"item\"])\n end",
"def update\n @bowler.update(bowler_params)\n respond_with(@bowler)\n end",
"def update\n @item = \"Vger::Resources::#{params[:item][:item_type]}\".constantize.find(params[:id])\n respond_to do |format|\n if @item.class.save_existing(params[:id], params[:item])\n format.html { redirect_to suitability_item_path(params[:id]), notice: 'Suitability Item was successfully updated.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @loot_type.update_attributes(loot_type_params)\n flash[:notice] = 'Loot type was successfully updated.'\n respond_with @loot_type\n else\n render action: :edit\n end\n end",
"def update\n @specie = Specie.find(params[:id])\n\n respond_to do |format|\n if @specie.update_attributes(params[:specie])\n format.html { redirect_to @specie, notice: 'Specie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @specie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @skill = Skill.find(params[:id])\n\n if @skill.update(skill_params)\n head :no_content\n else\n render json: @skill.errors, status: :unprocessable_entity\n end\n end",
"def set_weapon_type\n @weapon_type = WeaponType.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @wing.update(wing_params)\n @wing.floors.each { |f| f.touch }\n format.html { redirect_to @wing, notice: t('.update_ok', item: @wing.name) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @wing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @moose = Moose.find(params[:id])\n\n respond_to do |format|\n if @moose.update_attributes(params[:moose])\n format.html { redirect_to @moose, notice: 'Moose was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @moose.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n json_response(@food_item.update!(food_item_params))\n end",
"def update\n respond_to do |format|\n if @equipment.update(equipment_params)\n format.html { redirect_to @equipment, notice: 'Equipment was successfully updated.' }\n format.json { render :show, status: :ok, location: @equipment }\n else\n format.html { render :edit }\n format.json { render json: @equipment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @equipment.update(equipment_params)\n format.html { redirect_to @equipment, notice: 'Equipment was successfully updated.' }\n format.json { render :show, status: :ok, location: @equipment }\n else\n format.html { render :edit }\n format.json { render json: @equipment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @equipment.update(equipment_params)\n format.html { redirect_to @equipment, notice: 'Equipment was successfully updated.' }\n format.json { head :no_content }\n flash[:error] = @equipment.errors.full_messages.join(' ')\n else\n format.html { render action: 'edit' }\n format.json { render json: @equipment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @vehicle = Vehicle.find(params[:id])\n respond_to do |format|\n if @vehicle.update_attributes(params[:vehicle])\n format.html { redirect_to([@vehicle.fleet,@vehicle], :notice => 'Vehicle was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vehicle.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @upgrade_type = UpgradeType.find(params[:id])\n\n respond_to do |format|\n if @upgrade_type.update_attributes(params.require(:upgrade_type).permit(:cost, :name, :added_miles))\n format.html { redirect_to upgrade_types_url,\n notice: 'UpgradeType was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @upgrade_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @unit_fuel.update(unit_fuel_params)\n format.html { redirect_to @unit_fuel, notice: (t 'unit_fuels.title')+(t 'actions.updated') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @unit_fuel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @equipo = Equipo.find params[:id]\n if @equipo.update(equipo_params)\n render :show, status: :ok, location: @equipo\n else\n render json: @equipo.errors, status: :unprocessable_entity\n end\n end",
"def update\n @hero = Hero.find(params[:id])\n\n if @hero.update(hero_params)\n head :no_content\n else\n render json: @hero.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @bow.update(bow_params)\n format.html { redirect_to @bow, notice: 'Bow was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put!\n request! :put\n end",
"def update\n @damage = Damage.find(params[:id])\n\n respond_to do |format|\n if @damage.update_attributes(params[:damage])\n format.html { redirect_to @damage, notice: 'Damage was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @damage.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @straddle = Straddle.find(params[:id])\n\n respond_to do |format|\n if @straddle.update_attributes(params[:straddle])\n format.html { redirect_to @straddle, notice: 'Straddle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @straddle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @wow.update(wow_params)\n format.html { redirect_to @wow, notice: 'Wow was successfully updated.' }\n format.json { render :show, status: :ok, location: @wow }\n else\n format.html { render :edit }\n format.json { render json: @wow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n put :update\n end",
"def update\n respond_to do |format|\n if @equipo.update(equipo_params)\n format.html { redirect_to cliente_equipo_path, notice: 'El equipo se actualizó exitosamente.' }\n format.json { render :show, status: :ok, location: @equipo }\n else\n format.html { render :edit }\n format.json { render json: @equipo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n tags = equipment_params[:tags]\n\n tags_object_collection = []\n\n tags.each do |tag|\n if tag == ''\n next\n end\n\n tag_obj = Tag.find(tag)\n\n if tag_obj != nil\n tags_object_collection.push(tag_obj)\n end\n end\n\n new_equipment_params = equipment_params.except(:tags)\n\n @equipment = Equipment.find(params[:id])\n @equipment.tags = tags_object_collection\n\n respond_to do |format|\n if @equipment.update_attributes(new_equipment_params)\n format.html { redirect_to equipment_index_path, notice: 'Equipment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @equipment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @weapon = Weapon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @weapon }\n end\n end",
"def update\n @elector = Elector.find(params[:id])\n\n if @elector.update(elector_params)\n head :no_content\n else\n render json: @elector.errors, status: :unprocessable_entity\n end\n end",
"def update\n @contract = Contract.find(params[:id])\n @units = Unit.unsold(params[:tower_id])\n respond_to do |format|\n if @contract.update_attributes(params[:contract])\n format.html { redirect_to tower_contract_path(@contract.unit.tower, @contract), notice: 'Contract was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contract.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tier = Tier.find(params[:id])\n\n respond_to do |format|\n if @tier.update_attributes(params[:tier])\n format.html { redirect_to @tier, :notice => 'Tier was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @tier.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @vegetable = Vegetable.find(params[:id])\n\n respond_to do |format|\n if @vegetable.update_attributes(params[:vegetable])\n format.html { redirect_to(@vegetable, :notice => 'Vegetable was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vegetable.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @add_fuel.update(add_fuel_params)\n format.html { redirect_to @add_fuel, notice: (t 'add_fuels.title')+(t 'actions.updated') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @add_fuel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @vet = Vet.find(params[:id])\n\n respond_to do |format|\n if @vet.update_attributes(params[:vet])\n format.html { redirect_to @vet, notice: 'Vet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vibe.update(vibe_params)\n format.html { redirect_to @vibe, notice: 'Vibe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @vibe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @table = Table.find(params[:id])\n\n respond_to do |format|\n if @table.update_attributes(params[:table].permit(:name, :notes, :x, :y, :table_type, :guest_ids => []))\n format.html { redirect_to @table, notice: 'Table was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @table.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update\n @kitty = Kitty.find(params[:id])\n\n respond_to do |format|\n if @kitty.update_attributes(params[:kitty])\n format.html { redirect_to @kitty, notice: 'Kitty was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kitty.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n ingredient.update(ingredient_params)\n render json: ingredient\n end",
"def update\n @room = Room.find(params[:id])\n\n if @room.update_attributes(params[:room])\n head :ok\n else\n render :json => @room.errors, :status => :unprocessable_entity \n end\n end",
"def update\n @vehicle = Vehicle.find(params[:id])\n\n respond_to do |format|\n if @vehicle.update_attributes(params[:vehicle])\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @vehicle = Vehicle.find(params[:id])\n\n respond_to do |format|\n if @vehicle.update_attributes(params[:vehicle])\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @equipment_things_to_check.update(equipment_things_to_check_params)\n format.html { redirect_to @equipment_things_to_check, notice: 'Equipment things to check was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @equipment_things_to_check.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @health.update(health_params)\n format.html { redirect_to @health, notice: 'Health was successfully updated.' }\n format.json { render :show, status: :ok, location: @health }\n else\n format.html { render :edit }\n format.json { render json: @health.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @pet = Pet.find(params[:id])\n\n respond_to do |format|\n if @pet.update_attributes(params[:pet])\n format.html { redirect_to @pet, notice: 'Pet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @lab_equipment = LabEquipment.find(params[:id])\n\n respond_to do |format|\n if @lab_equipment.update_attributes(params[:lab_equipment])\n format.html { redirect_to @lab_equipment, notice: 'Lab equipment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lab_equipment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bounty.update(bounty_params)\n format.html { redirect_to @bounty, notice: 'Bounty was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bounty.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @swot.update(swot_params)\n format.html { redirect_to @swot, notice: 'Swot was successfully updated.' }\n format.json { render :show, status: :ok, location: @swot }\n else\n format.html { render :edit }\n format.json { render json: @swot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bowler.update(bowler_params)\n\n @bowler.record :update, current_user, selected_tournament\n \n format.html { redirect_to @bowler, notice: \"Bowler [#{@bowler.full_name}] was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bowler.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @novel = Novel.find(params[:id])\n\n respond_to do |format|\n if @novel.update_attributes(params[:novel])\n flash[:notice] = 'Novel was successfully updated.'\n format.html { redirect_to(@novel) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @novel.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @equipmentmodel.update(equipment_params)\n format.html { redirect_to @equipmentmodel, notice: 'Equipment model was successfully updated.' }\n format.json { render :show, status: :ok, location: @equipmentmodel }\n else\n format.html { render :edit }\n format.json { render json: @equipmentmodel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @room.hotel = Hotel.find_by_name(params[:room][:hotel])\n \n respond_to do |format|\n if @room.update(room_params)\n format.html { redirect_to crew_rooms_path, notice: 'Quarto atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @room }\n else\n format.html { render :edit }\n format.json { render json: @room.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_weapon(weapon)\n @weapon = weapon\n end",
"def update\n @shelter = Shelter.find(params[:id])\n\n if @shelter.update(shelter_params)\n head :no_content\n else\n render json: @shelter.errors, status: :unprocessable_entity\n end\n end",
"def update\n @energy = Energy.find(params[:id])\n\n respond_to do |format|\n if @energy.update_attributes(params[:energy])\n format.html { redirect_to @energy, notice: 'Energy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @energy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @stable = Stable.find(params[:id])\n\n respond_to do |format|\n if @stable.update_attributes(params[:stable])\n format.html { redirect_to @stable, notice: 'Stable was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stable.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.7508383",
"0.7056804",
"0.70372385",
"0.68401027",
"0.68264973",
"0.68264973",
"0.67953235",
"0.658942",
"0.6334765",
"0.6251913",
"0.6251913",
"0.6251913",
"0.6220673",
"0.619808",
"0.61721087",
"0.6110915",
"0.6085381",
"0.5924258",
"0.5892903",
"0.589166",
"0.5885448",
"0.58794314",
"0.5865547",
"0.5862117",
"0.58516914",
"0.58468026",
"0.5814115",
"0.57684404",
"0.57400733",
"0.57383305",
"0.57374305",
"0.5733888",
"0.57008296",
"0.57008153",
"0.5694148",
"0.56815743",
"0.56683695",
"0.56643975",
"0.5662794",
"0.56576717",
"0.56534517",
"0.56402576",
"0.56402576",
"0.56401",
"0.5634562",
"0.5619298",
"0.56013405",
"0.55933934",
"0.5577999",
"0.5577601",
"0.55762386",
"0.5575725",
"0.55707943",
"0.5564525",
"0.55600935",
"0.55573297",
"0.55573297",
"0.554934",
"0.5538781",
"0.55374116",
"0.5534752",
"0.55309886",
"0.5530077",
"0.55271184",
"0.55219626",
"0.55136204",
"0.5513296",
"0.54994994",
"0.549692",
"0.54949",
"0.54947895",
"0.5493596",
"0.5490152",
"0.5488095",
"0.54856324",
"0.5482313",
"0.54795593",
"0.54793876",
"0.54779327",
"0.54680973",
"0.5464044",
"0.5463498",
"0.5460334",
"0.5458198",
"0.54542196",
"0.54542196",
"0.5450301",
"0.5449955",
"0.5449758",
"0.54489833",
"0.54348886",
"0.54346865",
"0.5433476",
"0.542763",
"0.5425016",
"0.542081",
"0.54185116",
"0.54157513",
"0.54155135",
"0.5413263"
] |
0.7070163
|
1
|
DELETE /weapons/1 DELETE /weapons/1.json
|
def destroy
@weapon = Weapon.find(params[:id])
@weapon.destroy
respond_to do |format|
format.html { redirect_to weapons_url }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @weapons_type = WeaponsType.find(params[:id])\n @weapons_type.destroy\n\n respond_to do |format|\n format.html { redirect_to weapons_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @weapon.destroy\n\n head :no_content\n end",
"def destroy\n @weapon.destroy\n respond_to do |format|\n format.html { redirect_to weapons_url, notice: 'Weapon was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @weapon.destroy\n respond_to do |format|\n format.html { redirect_to weapons_url, notice: 'Weapon was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @weapon.destroy\n respond_to do |format|\n format.html { redirect_to weapons_url, notice: \"Weapon was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @weapon_type.destroy\n\n head :no_content\n end",
"def destroy\n @weapon_kind = WeaponKind.find(params[:id])\n @weapon_kind.destroy\n\n respond_to do |format|\n format.html { redirect_to weapon_kinds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @weapon_type.destroy\n respond_to do |format|\n format.html { redirect_to weapon_types_url, notice: 'Weapon type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ship_weapon.destroy\n respond_to do |format|\n format.html { redirect_to ship_weapons_url, notice: 'Ship weapon was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Item.delete(params[\"id\"])\n end",
"def destroy\n @weapon_info = WeaponInfo.find(params[:id])\n @weapon_info.destroy\n\n respond_to do |format|\n format.html { redirect_to(weapon_infos_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def destroy\n @weapon_slot.destroy\n respond_to do |format|\n format.html { redirect_to weapon_slots_url, notice: 'Weapon slot was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @equipment = Equipment.find(params[:id])\n @equipment.destroy\n\n respond_to do |format|\n format.html { redirect_to equipment_index_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @weapon_subtype.destroy\n respond_to do |format|\n format.html { redirect_to weapon_subtypes_url, notice: 'Weapon subtype was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n if @diet.nil?\n send_error_json(nil, \"Failed to delete\", 400)\n return\n end\n\n if @diet.destroy\n send_success_json(@diet.id, { diet_name: @diet.diet_name})\n else\n send_error_json(@diet.id, \"Delete error\", 400)\n end\n\n end",
"def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end",
"def destroy\n @api_v1_item.destroy\n render json: {message: 'deletado com sucesso'}\n end",
"def destroy\n @raid_boss_loot_item.destroy\n respond_to do |format|\n format.html { redirect_to raid_boss_loot_items_url, notice: 'Raid boss loot item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fleet.destroy\n respond_to do |format|\n format.html { redirect_to fleets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fleet = Fleet.find(params[:id])\n @fleet.destroy\n\n respond_to do |format|\n format.html { redirect_to fleets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vegetable = Vegetable.find(params[:id])\n @vegetable.destroy\n\n respond_to do |format|\n format.html { redirect_to vegetables_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @texture = Texture.find(params[:id])\n @texture.destroy\n\n respond_to do |format|\n format.html { redirect_to textures_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @animal = Animal.find(params[:id])\n @animal.destroy\n render json: { message: \"Congrats youve won\"}\n end",
"def destroy\n @goody = Goody.find(params[:id])\n @goody.destroy\n\n respond_to do |format|\n format.html { redirect_to goodies_url }\n format.json { head :no_content }\n end\n end",
"def delete!( opts = {} )\n http_action :delete, nil, opts\n end",
"def destroy\n self.auth_admin\n @hall = Hall.where(name: @item.location)\n @item.destroy\n respond_to do |format|\n format.html { redirect_to halls_path(@hall), notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @diet.destroy\n head :no_content, status: 200\n else\n render json: @diet.errors, status: 405\n end\n end",
"def destroy\n @game.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @loot_type.destroy\n respond_with @loot_type\n end",
"def destroy\n @bounty.destroy\n respond_to do |format|\n format.html { redirect_to bounties_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = @client.items.find(params[:id])\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully removed from Inventory.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @specific_equipment.destroy\n respond_to do |format|\n format.html { redirect_to specific_equipments_url, notice: 'Specific equipment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bow.destroy\n respond_to do |format|\n format.html { redirect_to bows_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @equipcat = Equipcat.find(params[:id])\n @equipcat.destroy\n\n respond_to do |format|\n format.html { redirect_to equipcats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @damage = Damage.find(params[:id])\n @damage.destroy\n\n respond_to do |format|\n format.html { redirect_to damages_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @wow.destroy\n respond_to do |format|\n format.html { redirect_to wows_url, notice: 'Wow was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @straddle = Straddle.find(params[:id])\n @straddle.destroy\n\n respond_to do |format|\n format.html { redirect_to straddles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client.delete(@name)\n end",
"def destroy\n render status: 200, json: @request_item.destroy\n end",
"def destroy(params = {})\n client.delete(\"#{endpoint(params)}/#{attributes[:id]}\")\n end",
"def destroy\n name = @bowler.full_name\n @bowler.record :destroy, current_user, selected_tournament\n @bowler.destroy\n respond_to do |format|\n format.html { redirect_to bowlers_url, notice: \"Bowler #{name} has been successfully deleted.\" }\n format.json { head :no_content }\n end\n end",
"def delete!\n request! :delete\n end",
"def destroy\n @energy = Energy.find(params[:id])\n @energy.destroy\n\n respond_to do |format|\n format.html { redirect_to energies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vibe.destroy\n respond_to do |format|\n format.html { redirect_to vibes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client.delete( name )\n end",
"def destroy\n @enemy.destroy\n respond_to do |format|\n format.html { redirect_to enemies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @energy_level = EnergyLevel.find(params[:id])\n @energy_level.destroy\n\n respond_to do |format|\n format.html { redirect_to energy_levels_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @equipment_things_to_check.destroy\n respond_to do |format|\n format.html { redirect_to equipment_things_to_checks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ninja = Ninja.find(params[:id])\n @ninja.destroy\n\n respond_to do |format|\n format.html { redirect_to ninjas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @equipment.destroy\n respond_to do |format|\n format.html { redirect_to equipment_index_url, notice: 'Equipment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @equipment.destroy\n respond_to do |format|\n format.html { redirect_to equipment_index_url, notice: 'Equipment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mostsmalltrapeffectinventory = Mostsmalltrapeffectinventory.find(params[:id])\n @mostsmalltrapeffectinventory.destroy\n\n respond_to do |format|\n format.html { redirect_to mostsmalltrapeffectinventories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reqdifficulty.destroy\n respond_to do |format|\n format.html { redirect_to reqdifficulties_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fueltype = Fueltype.find(params[:id])\n @fueltype.destroy\n\n respond_to do |format|\n format.html { redirect_to fueltypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tower = Tower.find(params[:id])\n @tower.destroy\n\n respond_to do |format|\n format.html { redirect_to towers_url }\n format.json { head :ok }\n end\n end",
"def delete(name)\n raise('wrong type: String required') unless name.is_a?(String)\n raise('wrong value: name must be valid') unless !name.nil? && !name.empty?\n\n @client.post({\n 'action' => 'del',\n 'object' => 'htpl',\n 'values' => name,\n }.to_json)\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 @equipment.destroy\n respond_to do |format|\n format.html { redirect_to equipment_index_url }\n format.json { head :no_content }\n flash[:error] = @equipment.errors.full_messages.join(' ')\n end\n end",
"def destroy\n @vet = Vet.find(params[:id])\n @vet.destroy\n\n respond_to do |format|\n format.html { redirect_to vets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @equipment_line_item.destroy\n respond_to do |format|\n format.html { redirect_to equipment_line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vegetable.destroy\n respond_to do |format|\n format.html { redirect_to vegetables_url, notice: 'Vegetable was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fixture = Fixture.find(params[:id])\n @fixture.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @humanidades1 = Humanidades1.find(params[:id])\n @humanidades1.destroy\n\n respond_to do |format|\n format.html { redirect_to humanidades1s_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Users.delete(params[\"id\"])\n end",
"def destroy\n @tags_of_novel = TagsOfNovel.find(params[:id])\n @tags_of_novel.destroy\n\n respond_to do |format|\n format.html { redirect_to tags_of_novels_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @itemstable = Itemstable.find(params[:id])\n @itemstable.destroy\n\n respond_to do |format|\n format.html { redirect_to itemstables_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @legs2.destroy\n respond_to do |format|\n format.html { redirect_to legs2s_url, notice: 'Legs2 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @hotel = Hotel.find(params[:id])\n @hotel.destroy\n\n respond_to do |format|\n format.html { redirect_to hoteles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @apiv1_item.destroy\n respond_to do |format|\n format.html { redirect_to apiv1_items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @uginuce.sheep.update status:'na farmi'\n @uginuce.destroy\n respond_to do |format|\n format.html { redirect_to uginuces_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n rid = params['id']\n if Aws.delete_recipe(rid) && Aws.delete_all_ingredients(rid)\n msg = {:notice => \"Recipe deleted!\"}\n render :json => msg\n else\n msg = {:notice => \"Error while deleting from DynamoDB!\"}\n render :json => msg\n end\n end",
"def destroy\n @lab_equipment = LabEquipment.find(params[:id])\n @lab_equipment.destroy\n\n respond_to do |format|\n format.html { redirect_to lab_equipments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fooditem = Fooditem.find(params[:id])\n @fooditem.destroy\n\n respond_to do |format|\n format.html { redirect_to fooditems_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n id = params[:id]\n @physical_rack = PhysicalRack.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @physical_rack.destroy\n\n respond_to do |format|\n format.html { redirect_to physical_racks_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @depot_fuel.destroy\n respond_to do |format|\n format.html { redirect_to depot_fuels_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @health_level.destroy\n\n respond_to do |format|\n format.html { redirect_to health_levels_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @monkey = Monkey.find(params[:id])\n @monkey.destroy\n\n respond_to do |format|\n format.html { redirect_to monkeys_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gethotel = Gethotel.find(params[:id])\n @gethotel.destroy\n\n respond_to do |format|\n format.html { redirect_to gethotels_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mueble.destroy\n respond_to do |format|\n format.html { redirect_to muebles_url, notice: 'Mueble was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n the_name = @equipment_model.name\n the_group = @equipment_model.equipment_group\n @equipment_model.destroy\n respond_to do |format|\n format.html { redirect_to equipment_group_path(the_group), status: 303, notice: t('.delete_ok', item: the_name) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @monster.destroy\n respond_to do |format|\n format.html { redirect_to monsters_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @health.destroy\n respond_to do |format|\n format.html { redirect_to healths_url, notice: 'Health was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @food = Food.find(params[:id])\n @food.destroy\n\n respond_to do |format|\n format.html { redirect_to foods_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @food = Food.find(params[:id])\n @food.destroy\n\n respond_to do |format|\n format.html { redirect_to foods_url }\n format.json { head :ok }\n end\n end",
"def destroy\r\n @usertable = Usertable.find(params[:id])\r\n @usertable.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to usertables_url }\r\n format.json { head :ok }\r\n end\r\n end",
"def destroy\n @three.destroy\n respond_to do |format|\n format.html { redirect_to threes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @battle.destroy\n respond_to do |format|\n format.html { redirect_to battles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @battle.destroy\n respond_to do |format|\n format.html { redirect_to battles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @diet_type.destroy\n respond_to do |format|\n format.html { redirect_to diet_types_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Post.delete(params[\"id\"])\n end",
"def destroy\n @unit.destroy\n respond_to do |format|\n format.html { redirect_to new_food_path }\n format.json { head :no_content }\n end\n end",
"def delete\n request(:delete)\n end",
"def destroy\n animal = Animal.find(params[:id])\n animal.destroy\n head 204\n end",
"def destroy\n @pet = Pet.find(params[:id])\n @pet.destroy\n\n respond_to do |format|\n format.html { redirect_to pets_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.7346109",
"0.73445624",
"0.7285096",
"0.7285096",
"0.7280427",
"0.7171071",
"0.70926833",
"0.70523924",
"0.69661045",
"0.68320554",
"0.68047464",
"0.6727977",
"0.67099714",
"0.66829544",
"0.6642405",
"0.66210496",
"0.6579506",
"0.6578651",
"0.6552099",
"0.6531495",
"0.648614",
"0.6464584",
"0.6464485",
"0.6464416",
"0.64436156",
"0.64375263",
"0.6428258",
"0.6410321",
"0.64042634",
"0.63936347",
"0.6385344",
"0.6378361",
"0.6373943",
"0.63729674",
"0.6370263",
"0.6368772",
"0.6366172",
"0.6363477",
"0.6361467",
"0.63601524",
"0.6357145",
"0.6357095",
"0.63539416",
"0.63527197",
"0.63513875",
"0.63405174",
"0.6333544",
"0.6330942",
"0.6324707",
"0.6324573",
"0.63202375",
"0.63195956",
"0.63195956",
"0.6313881",
"0.6313183",
"0.63106793",
"0.6309826",
"0.63070464",
"0.6306892",
"0.6306892",
"0.6306892",
"0.6306892",
"0.62968457",
"0.62915385",
"0.62891203",
"0.6287367",
"0.62873554",
"0.62843317",
"0.62826836",
"0.6282524",
"0.6280647",
"0.6279078",
"0.62781656",
"0.62759507",
"0.6275289",
"0.6275239",
"0.62732565",
"0.6268116",
"0.62680125",
"0.6261671",
"0.62609154",
"0.6260129",
"0.6257883",
"0.6252011",
"0.62518173",
"0.6249901",
"0.62481695",
"0.6247485",
"0.6246989",
"0.6246989",
"0.6244346",
"0.624222",
"0.62421215",
"0.62421215",
"0.6241319",
"0.62402683",
"0.6234943",
"0.6233391",
"0.6231011",
"0.6230701"
] |
0.75593835
|
0
|
Can take trains (one at a time)
|
def arrival(train)
@trains << train
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def trains\n currently_owned(Transaction::IS_TRAIN)\n end",
"def list_trains_on_station\n if @trains.empty? || @stations.empty?\n trains_or_stations_void\n else\n request = request_station\n station = getting(request, :approve_station_selection, :select_station)\n check_the_trains(station)\n end\n end",
"def trains\n @trains ||= init_trains\n end",
"def check_train_wagons\n passenger_trains_amount = 0\n cargo_amount = 0\n @trains.each_value do |train|\n train.type == 'cargo' ? cargo_amount += 1 : passenger_trains_amount += 1\n end\n passenger_matches(passenger_trains_amount) || cargo_matches(cargo_amount)\n end",
"def can_sell_train?(train)\n owner = train.owner\n return true unless railway?(owner)\n return true if owner == @qlb\n return true unless train_is_train?(train)\n\n if owner == @nwe && train.distance < 2\n true # nwe will always have a train besides a 1T\n elsif owner == @nwe\n owner.trains.count { |t| train_is_train?(t) && t.distance > 1 } > 1\n else\n owner.trains.count { |t| train_is_train?(t) } > 1\n end\n end",
"def transfer_trains(buyer, minor)\n return if minor.trains.empty?\n\n minor.trains.each do |t|\n t.operated = false\n t.buyable = true\n end\n\n transferred = @game.transfer(:trains, minor, buyer)\n @log << \"#{buyer.name} receives the trains: #{transferred.map(&:name).join(', ')}\"\n end",
"def route_trains(entity)\n entity.runnable_trains.map { |t| @subtrains[t] }.flatten\n end",
"def plan_trip (mta, start_station, end_station)\n\n # Check if the user is already at the destination\n if(start_station == end_station)\n puts \"You are already at your destination\\n\\n\"\n else\n # Find the station indexes\n stations = find_stations mta, start_station, end_station\n\n # Build the trip\n trip = [start_station]\n trip.push *build_trip(mta, stations)\n\n #Display the trip\n display_trip trip, stations[0]\n end\n\nend",
"def trains_type(type)\n @trains.select { |train| train.type == type }\n end",
"def touch_in(station)\n deduct(PENALTYFARE) if @in_joureny == true\n min_balance? ? (fail \"insufficent funds\") : @the_journey.start(station)\n @in_journey = true\n end",
"def trips \n trips_taken = Trip.all.select do |trip|\n trip.listing == self\n end\n end",
"def trains_going_direction(array_of_trains, desired_direction)\n\n #loop through array_of_trains\n\n array_of_trains.each do |train|\n if train[:direction] == desired_direction\n puts train\n end\n end\nend",
"def can_balance(list)\n\nend",
"def tour_available?\n self.tour_credits > 0 || self.tours_unlimited\n end",
"def link_to_station\n if @trains.empty? || @stations.empty?\n staions_or_trains_void\n else\n request = [\"Enter train number [#{@trains.keys.join(', ')}]: \"]\n train = getting(request, :approve_train_selection, :select_train)\n request = request_station\n station = getting(request, :approve_station_selection, :select_station)\n train_placed if station.arrive(train)\n end\n end",
"def must_buy_train?(entity)\n must_buy_power?(entity)\n end",
"def current_trains\n @trains\n end",
"def can_rent_truck?\n !license.expired? && age >= 60 && license.to_drive_truck?\n end",
"def travel_nodes_confirmed?\n self.previous_travel_node.present? &&\n self.previous_travel_node.confirmed? &&\n self.current_travel_node.present? &&\n self.current_travel_node.confirmed? #&&\n # self.next_travel_node.present? &&\n # self.next_travel_node.confirmed?\n end",
"def check_availability_of_passenger_wagons\n @trains.each do |train|\n train.each do |element|\n if element.class != Symbol\n return false if element.wagons.any? && element.type == 'passenger'\n end\n end\n end\n end",
"def make_a_trip\n end",
"def connect(ride)\n rr = ride.becomes(RideRequest)\n time_distance = (rr.time - self.time).abs < 15.minutes\n if self.freeSeats > 0 && time_distance && self.direction == rr.direction && self.toCity == rr.toCity && self.fromCity == rr.fromCity && self.office_id == rr.office_id\n self.ride_requests << rr\n rr.status = 'active'\n self.status = 'active'\n self.decrement(:freeSeats)\n if rr.save && self.save\n true\n else\n false\n end\n else\n puts 'Cannot connect ride'\n puts \"free seats: #{self.freeSeats > 0}\"\n puts \"time distance: #{time_distance}\"\n puts \"direction: #{self.direction == rr.direction}\"\n puts \"to city: #{self.toCity == rr.toCity}\"\n puts \"from city: #{self.fromCity == rr.fromCity}\"\n puts \"office: #{self.office_id == rr.office_id}\"\n false\n end\n end",
"def show_wagons_by_train\n if @trains.empty?\n trains_or_wagons_void\n else\n request = [\"Enter the train number: [#{@trains.keys.join(', ')}]: \"]\n getting(request, :approve_train_for_wagons_show, :show_wagon)\n end\n end",
"def only_one_ability_at_the_same_time\n unless self.player.trainings.not_finished.count == 0\n self.errors[:base] = I18n.t('training.errors.already_training')\n end\n end",
"def list_of_train_direction(direction,trains)\n train_list = []\n trains.each do |train|\n if direction == train[:direction]\n train_list << train[:train]\n end\n end\n return train_list\nend",
"def touch_in(station)\n raise 'Balance is insuffcient' if insufficient?\n @journey_log.start(station)\n end",
"def isValidWalk(walk)\r\n starting_point = []\r\n current_direction = 0\r\n distance_travelled = []\r\n if walk.size != 10\r\n false\r\n else\r\n walk.each do |direction|\r\n distance_travelled = move_player(distance_travelled, direction)\r\n end\r\n if distance_travelled == starting_point\r\n true\r\n else\r\n false\r\n end\r\n end\r\nend",
"def train_first(player1, player2, runs)\n separation\n tateti = Tateti.new\n p1 = 0\n p2 = 0\n ties = 0\n runs.times do\n loop do\n tateti = player1.play_to_learn(tateti, player2)\n break p1 += 1 if !tateti.winner.nil?\n break ties += 1 if tateti.tie?\n tateti = player2.play(tateti)\n break p2 += 1 if !tateti.winner.nil?\n break ties += 1 if tateti.tie?\n end\n tateti.empty_board\n end\n print_stats(player1, player2, runs, p1, p2, ties)\nend",
"def list_all_trains\n Train.all.sort{|a,b| a.destination <=> b.destination}.each.with_index(1) do |element, index|\n puts\"\\n\"\n puts \"#{index}: Destination: #{element.destination}\"\n puts \" Base time: #{element.event_time}\"\n puts \" Line: #{element.line}\"\n puts \" Direction: #{element.dir}\"\n puts \" Incoming Stations:\"\n element.station.each{|hash| puts \"Station: #{hash['station']}\\nWait Time: #{hash['waiting_time']}\\n-----------------------------------\\n\"}\n end\n puts \"\\nType 1 to restart and anything else to end:\\n\"\n get_end = gets.strip\n if get_end == '1'\n restart\n end\nend",
"def can_be_online\n nb_prob = 0\n can_online = true\n @virtualtest.problems.each do |p|\n can_online = false if !p.online?\n nb_prob = nb_prob + 1\n end\n redirect_to virtualtests_path if !can_online || nb_prob == 0\n end",
"def is_in_progress?\n self.id == self.device.trips.last.id && self.points.last.event != Point::IGNITION_OFF && (Time.now - self.points.last.occurred_at < Device::TRIP_REPORT_CUTOFF)\n end",
"def game_trains\n trains = build_train_list({\n '2' => 0,\n '3' => 0,\n '4' => 0,\n '5' => 0,\n '6' => 0,\n '7' => 0,\n '3T' => 0,\n 'U3' => 0,\n '2+2' => 0,\n '4T' => 0,\n '4+4E' => 0,\n })\n\n case @units.keys.sort.map(&:to_s).join\n when '1'\n add_train_list(trains, { '2' => 6, '3' => 4, '4' => 3, '5' => 4 })\n when '2'\n add_train_list(trains, { '2' => 5, '3' => 3, '4' => 2, '5' => 3, '6' => 2 })\n when '3'\n # extra 5/3T/U3 for minors\n add_train_list(trains, { '2' => 5, '3' => 3, '4' => 1, '5' => 3, '7' => 2, '3T' => 1, 'U3' => 1 })\n when '12'\n add_train_list(trains, { '2' => 7, '3' => 6, '4' => 4, '5' => 5, '6' => 2, '7' => 0 })\n when '23'\n # extra 5/3T/U3 for minors\n add_train_list(trains, { '2' => 5, '3' => 5, '4' => 4, '5' => 6, '7' => 2, '3T' => 1, 'U3' => 1 })\n else # all units\n # extra 5/3T/U3 for minors\n add_train_list(trains, { '2' => 7, '3' => 6, '4' => 5, '5' => 6, '6' => 2, '7' => 2, '3T' => 1, 'U3' => 1 })\n end\n\n add_train_list(trains, { '3T' => 2, 'U3' => 2 }) if @optional_rules.include?(:u3p)\n add_train_list(trains, { 'U3' => 1, '4T' => 1 }) if @regionals[1]\n add_train_list(trains, { '5' => 1 }) if @regionals[2]\n add_train_list(trains, { '4T' => 1 }) if @regionals[3]\n add_train_list(trains, { '5' => -1, '6' => 3, '7' => 2 }) if @kits[3]\n add_train_list(trains, { '5' => 1, '3T' => 1 }) if @kits[5]\n add_train_list(trains, { '2+2' => 1 }) if @kits[7]\n\n # handle K2\n if @kits[2]\n case @units.keys.sort.map(&:to_s).join\n when '1', '2'\n add_train_list(trains, { '3T' => 3, 'U3' => 1, '2+2' => 3, '4T' => 2, '4+4E' => 2 })\n add_train_list(trains, { '3' => -1, '4' => -1 }) if @kits[3]\n when '12'\n add_train_list(trains, { '3T' => 4, 'U3' => 2, '2+2' => 3, '4T' => 2, '4+4E' => 2 })\n add_train_list(trains, { '3' => -1, '4' => -1, '5' => -1 }) if @kits[3]\n when '23'\n add_train_list(trains, { '3T' => 4, 'U3' => 2, '2+2' => 3, '4T' => 2, '4+4E' => 2 })\n add_train_list(trains, { '3' => -1, '5' => -1 }) if @kits[3]\n when '123'\n add_train_list(trains, { '3T' => 5, 'U3' => 3, '2+2' => 3, '4T' => 2, '4+4E' => 2 })\n add_train_list(trains, { '3' => -1, '4' => -1, '5' => -1 }) if @kits[3]\n end\n end\n\n fix_train_availables(trains)\n\n trains\n end",
"def take_seat_volume_carriage\n return take_seat_volume_carriage_template('create_train') if @trains.empty?\n\n user_input = ask_choose('Train', '', @trains)\n user_train = @trains[user_input - 1]\n\n if user_train.carriages.empty?\n take_seat_volume_carriage_template('create_carriage', user_train)\n else\n take_seat_volume_carriage_core(user_train)\n end\n end",
"def take_passengers(n) \n return false if (n > 1 || n < 0)\n return true\n end",
"def check_availability_of_cargo_wagons\n @trains.each do |train|\n train.each do |element|\n if element.class != Symbol\n return false if element.wagons.any? && element.type == 'cargo'\n end\n end\n end\n end",
"def index\n @trips = policy_scope(Trip).belonging_to(@user.id).includes(flights: [:airline, :depart_airport_info, :arrive_airport_info]).decorate.reverse\n @show_controls = current_user.present? && @user.id == current_user.id\n end",
"def plan_trip(stop1, line1, stop2, line2)\n\n trains = {\n \"N\" => [\"Times Square\", \"34th\", \"28th\", \"23rd\", \"Union Square\", \"8th\"],\n \"L\" => [\"8th\", \"6th\", \"Union Square\", \"3rd\", \"1st\"],\n \"6\" => [\"Grand Central\", \"33rd\", \"28th\", \"23rd\", \"Union Square\", \"Astor Place\"]\n }\n\n transfer = \"Union Square\" #DEFAULT TRANSFER STATION\n if line1 != line2 && stop1 == \"Union Square\" #PREVENTS BOARDING THE WRONG TRAIN AT UNION SQUARE\n puts \"Just board the correct train.\"\n line1 = line2\n end\n if line1 == line2 #there may be a clearer way to do this, but this allows a single train line output\n transfer = stop2\n end\n\n route1 = trains[line1] #this is just for readability\n route2 = trains[line2]\n\n if route1.index(stop1) < route1.index(transfer) #this always fires, and is either the only or first segment\n first_path = route1[(route1.index(stop1) + 1)..(route1.index(transfer))]\n puts \"You must travel through the following stops on the #{line1} line: #{first_path.join(\", \")}.\"\n else\n uptown = route1.reverse()\n first_path = uptown[(uptown.index(stop1) + 1)..(uptown.index(transfer))]\n puts \"You must travel through the following stops on the #{line1} line: #{first_path.join(\", \")}.\"\n end\n if line2 == line1\n puts \"A total of #{first_path.length} stops.\"\n end\n\n if line1 != line2 #this only fires if there's a second line\n puts \"Transfer at Union Square.\"\n if route2.index(\"Union Square\") < route2.index(stop2)\n second_path = route2[(route2.index(\"Union Square\") + 1)..(route2.index(stop2))]\n puts \"You must continue through the following stops on the #{line2} line: #{second_path.join(\", \")}.\"\n else\n uptown = route2.reverse()\n second_path = uptown[(uptown.index(\"Union Square\") + 1)..(uptown.index(stop2))]\n puts \"You must continue through the following stops on the #{line2} line: #{second_path.join(\", \")}.\"\n end\n puts \"A total of #{first_path.length + second_path.length} stops.\"\n end\n\nend",
"def trains_containing(car)\n @trains.find_all do |train|\n train.cargo.keys.include?(car)\n end\n end",
"def arrivals(refresh = false)\n if tvs\n trains(:arrival, refresh)\n end\n end",
"def amount_trains(type_of_train)\n @trains.select { |train| train.type == type_of_train }\n end",
"def touch_in(station)\n fail \"Less than £1\" if @balance < MIN_BALANCE\n @in_journey = true\n @entry_station = station\n end",
"def trainer_only\n if logged_in?\n \t@trainer = Trainer.find_by(user_id: current_user.id.to_i)\n if @trainer.nil?\n \tredirect_to root_path, :alert => \"Access denied.\"\n else\n \tif @trainer.id.to_i != Protege.find_by(user_id: params[:id]).trainer_id.to_i\n \t\tredirect_to root_path, :alert => \"Nie masz dostępu do tej karty\"\n \tend\n end\n else\n redirect_to root_path, :alert => \"Access denied.\"\n end\n end",
"def check_ins\n check_in_responses\n end",
"def will_transfer(amount, *args)\n do_scheduled_transaction :transfer_out, amount, *args\n end",
"def train_players\n self.players.each(&:train)\n end",
"def tribes\n Tribe.all\n end",
"def can_wait_objection?\n seconds.count >= 2\n end",
"def trains_list\n @trains.each_with_index do |train, index|\n puts \"#{index}. Поезд номер #{train.num}\"\n end\n end",
"def train_second(player1, player2, runs)\n separation\n tateti = Tateti.new\n p1 = 0\n p2 = 0\n ties = 0\n runs.times do\n loop do\n tateti = player1.play(tateti)\n break p1 += 1 if !tateti.winner.nil?\n break ties += 1 if tateti.tie?\n tateti = player2.play_to_learn(tateti, player1)\n break p2 += 1 if !tateti.winner.nil?\n break ties += 1 if tateti.tie?\n end\n tateti.empty_board\n end\n print_stats(player1, player2, runs, p1, p2, ties)\nend",
"def buy_train(operator, train, price = nil)\n operator.spend(price || train.price, train.owner) if price != :free\n remove_train(train)\n train.owner = operator\n operator.trains << train\n @crowded_corps = nil\n\n close_companies_on_event!(operator, 'bought_train')\n end",
"def us_troops_available\n us_troop < coin_control_excess ? us_troop : coin_control_excess\n end",
"def plan\n super\n @trip.itineraries\n .find_by(trip_type: @outbound_trip_type, service: @outbound_service)\n .try(:select)\n @trip.save\n @trip\n end",
"def enable_pending_cops; end",
"def finished?\n @turns_allowed < 0\n end",
"def if_goal_reachable(num_gas_stand, course_distance, init_gas_amount, gas_stand_spot, gas_amounts)\n track = Track.new(init_gas_amount)\n gas_stand_spot.each_with_index do |dist, index|\n print \"index: #{index}, dist: #{dist}\\n\"\n track.run(dist - track.location)\n while track.check_gasoline_necessary\n if_successful = track.consume_gasoline\n print \"gasoline_necessary. consume gasoline_successful? #{if_successful}\\n\"\n return -1 unless if_successful\n end\n track.gasoline_right_provided(gas_amounts[index])\n end\n\n # From last gas stop to the goal\n track.run(course_distance - track.location)\n if track.check_gasoline_necessary\n if_successful = track.consume_gasoline\n return -1 unless if_successful\n end\n print \"gas_station_used: #{track.show_gas_station_used}\\n\"\n return track.count_gas_stand_used\nend",
"def trips\n Trip.all.select do |trip|\n trip.listing == self\n end\n\n end",
"def trips\n Trip.all.select do |trip|\n trip.listing == self\n end\n end",
"def index\n @trainings = student.trainings \n @user_profile = current_user.profile\n # authorize @trainings \n end",
"def plan_to_take_course?(course)\n taking_courses.where(:course_id => course).size >0\n end",
"def active?\n !self.trial_over? or self.paid?\n end",
"def can_begin\n redirect_to virtualtests_path if @no_new_submissions\n if current_user.sk.test_status(@virtualtest) != \"not_started\"\n redirect_to virtualtests_path\n elsif Takentest.where(:user => current_user.sk, :status => :in_progress).count > 0\n flash[:danger] = \"Vous avez déjà un test virtuel en cours !\"\n redirect_to virtualtests_path\n end\n end",
"def borrowed?\n return false if activities.empty?\n activities.take.borrowing? \n end",
"def request_trip\n\t\t@trip = Trip.find_by(_id: trip_params[:trip_id])\n\t\t# Check that the current user has not requested more than 3 trips, \n\t\t# That the user has not already requested this trip\n\t\t# and that the trip has available spaces and that the driver is not the requestor\n\t\tif current_user.trips_requested.size <= 5 && \n\t\t\t!(@trip.user_requests.include?(current_user._id)) && @trip.spaces > 0 && @trip.driver != current_user.id.to_s && !(current_user.trips_accepted.include?(@trip.id))\n\n\t\t\t@trip.user_requests << current_user._id\n\t\t\tcurrent_user.trips_requested << @trip._id.to_s\n\t\t\tcurrent_user.save!\n\t\t\t@trip.save!\n\t\t\trender json: {\n\t\t\t\tstatus: 'success',\n\t\t\t\ttrip: @trip\n\t\t\t}, status: 200\n\t\telse\n\t\t\t# Error handling\n\t\t\tif current_user.trips_requested.size > 5\n\t\t\t\trender json: {\n\t\t\t\t\tstatus: 'error',\n\t\t\t\t\tmessage: 'This user has requested too many requests!'\n\t\t\t\t}, status: 422\n\t\t\telsif @trip.user_requests.include?(current_user._id)\n\t\t\t\trender json: {\n\t\t\t\t\tstatus: 'error',\n\t\t\t\t\tmessage: 'You have already requested this trip!'\n\t\t\t\t}, status: 422\n\t\t\telsif @trip.spaces <= 0\n\t\t\t\trender json: {\n\t\t\t\t\tstatus: 'error',\n\t\t\t\t\tmessage: 'There is no more space in this trip!'\n\t\t\t\t}, status: 422\n\t\t\telsif @trip.driver == current_user.id.to_s\n\t\t\t\trender json: {\n\t\t\t\t\tstatus: 'error',\n\t\t\t\t\tmessage: 'You cannot request your own trip!'\n\t\t\t\t}, status: 422\n\t\t\telsif current_user.trips_accepted.include?(@trip.id)\n\t\t\t\trender json: {\n\t\t\t\t\tstatus: 'error',\n\t\t\t\t\tmessage: \"You've already been accepted on this trip!\"\n\t\t\t\t}, status: 422\n\t\t\telse\n\t\t\t\trender json: {\n\t\t\t\t\tstatus: 'error',\n\t\t\t\t\tmessage: 'Something went wrong...'\n\t\t\t\t}, status: 422\n\t\t\tend\n\t\tend\n\tend",
"def move_train\n if @trains.empty?\n puts 'There are no trains to move. Please, create one.'\n else\n selected_train = select_from_array(@trains)\n cases = { '1' => :run_next_station, '2' => :run_previous_station }\n puts \"Select action for #{selected_train}: move to next(1) or to previous(2) station\"\n action = gets.chomp.to_i\n\n selected_train.send(cases[action.to_s]) || incorrect_input\n end\n end",
"def approve_train_for_assign(number)\n if @trains[number.to_sym]\n { success: true }\n else\n { success: false, 'errors': 'There is no train or input is empty!' }\n end\n end",
"def safety_start_player_turn\n ai_done_tb if (@safety_tb+=1)> TM::Defaults::SafetyTimer &&TM.queues_empty?\n end",
"def do_something!\n @trains.each do |train|\n yield(train)\n end\n end",
"def take_passengers(n) \n return false if (n > 3 || n < 0)\n return true\n end",
"def trips\n Trip.all.select do |trip|\n trip.listing == self\n end\nend",
"def approve_train_selection_for_wagons(number)\n if check_wagons_for_train_type(number) && @trains[number.to_sym]\n { success: true }\n else\n { success: false, 'errors': 'No train or wagons of the required type!' }\n end\n end",
"def show_trains\n @trains.each do |train| \n puts train\n end\n end",
"def next_station_available?\n current_station_index != @route.stations.length - 1\n end",
"def walkthrough()\r\n choose_winner =false \r\n choose_winner= walkthrough_test( @turn[2])\r\n \r\n\t if choose_winner ==true\r\n\t return true\r\n\t else\r\n\t return false\r\n\t end \r\n \tend",
"def can_activate?\n self.person && self.person_match? && self.has_not_expired?\n end",
"def checkin\n end",
"def in_accessioning?\n (2..5).cover?(status)\n end",
"def can_make_reserves?\n !undergraduate? && !virginia_borrower?\n end",
"def throttles; end",
"def teaser_celebrity?\n true if twitter_followers && twitter_followers > 1000 || youtube_subscribers && youtube_subscribers > 1000 || instagram_followers && instagram_followers > 1000\n end",
"def simulate(lines,numTrains,passengers,simMonitor)\r\n p_threads = [] #ok\r\n t_threads = [] #ok\r\n stations = {}\r\n trains = {} \r\n \r\n init_lines = {}\r\n ret_lines = {}\r\n lines.each{|k,v|\r\n init_lines[k] = v[1..v.length-1]\r\n } \r\n lines.each{|k,v|\r\n ret_lines[k] = v[0..v.length-2].reverse\r\n }\r\n \r\n @lines = lines\r\n @passengers = passengers\r\n @numTrains = numTrains\r\n \r\n metro_lines = lines.keys #array of the metrolines. red, blue, yellow etc\r\n people = passengers.keys\r\n \r\n metro_lines.each{|i| #access the stations in each metroline\r\n station_names = lines[i]\r\n station_names.each{|j|\r\n if stations[j] == nil\r\n stations[j] = {} #hash for metroline\r\n end\r\n \r\n if stations[j][i] == nil\r\n stations[j][i] = {} #hash for trains at station (for line) CHECK IF POPULATED\r\n end\r\n stations[j][\"passenger\"] = {} #hash for passengers at station \r\n }\r\n }\r\n \r\n @stations = stations\r\n for i in 0...people.length\r\n itin = passengers[people[i]] \r\n first_stop = itin[0]\r\n stations[first_stop][\"passenger\"][people[i]] = true\r\n end \r\n \r\n @passengers.each{|p,val|\r\n @check[p] = false\r\n }\r\n \r\n @simMonitor = simMonitor\r\n @simMonitor.each{|a,b |\r\n @t_cond[a] = b.new_cond\r\n @p_cond[a] = b.new_cond\r\n }\r\n \r\n numTrains.each{|key,val|\r\n index = val\r\n begin\r\n @trains[key + \" \" + index.to_s] = {}\r\n index -= 1\r\n end until(index == 0)\r\n }\r\n\r\nindex = 0\r\n@trains.each{|key,val|\r\n index = index + 1\r\n t_threads.push(\r\n Thread.new do\r\n train_work(@lines, index , numTrains, @passengers, @stations, trains, key, @t_cond, @p_cond)\r\n \r\n if(passengers.empty?)\r\n train_work(ret_lines, index , numTrains, passengers, stations, trains, key, @t_cond, @p_cond)\r\n train_work(init_lines, index , numTrains, passengers, stations, trains, key, @t_cond, @p_cond) \r\n else \r\n until(!@check.values.include?(false))\r\n train_work(ret_lines, index , numTrains, passengers, stations, trains, key, @t_cond, @p_cond)\r\n train_work(init_lines, index , numTrains, passengers, stations, trains, key, @t_cond, @p_cond)\r\n end\r\n end\r\n end\r\n )\r\n }\r\n \r\n @check.each{|p, val|\r\n itinerary = @passengers[p]\r\n p_threads.push(\r\n Thread.new do\r\n passenger_work(itinerary, lines, p)\r\n @check[p] = true\r\n end\r\n \r\n )\r\n }\r\n \r\n \r\n p_threads.each{|x|\r\n x.join\r\n }\r\n t_threads.each{|x|\r\n x.join \r\n }\r\n \r\n end",
"def show_trains_by_station\n if @stations.empty?\n stations_void\n else\n request = [\"Enter station name: [#{@stations.keys.join(', ')}]: \"]\n getting(request, :approve_station_selection, :show_train)\n end\n end",
"def canMakeTreasureVisible(t)\n \n end",
"def singleTrip (start_station, end_station, line)\n start_index = MTA[line].index(start_station)\n end_index = MTA[line].index(end_station)\n\n if start_index < end_index\n stops = MTA[line][start_index ... end_index]\n num_stops = end_index - start_index\n end\n\n if end_index < start_index\n stops = MTA[line][end_index ... start_index]\n stops = stops.reverse\n num_stops = start_index - end_index\n\n end\n print = \"You must travel through the following stops on the #{line}: #{stops}\"\n # print = \"#{num_stops} in total\"\nend",
"def is_booking_possible?(member, tour)\n return false unless tour.current_bookings.to_i < tour.max_capacity\n return false unless tour.difficulty <= member.ability\n return false if member.tours.include?(tour)\n return true\n end",
"def trips \n Trip.all.select do |ti|\n ti.guest == self\n end\n end",
"def list_of_trains_based_on_direction\n #put puts a list of train stations based on the rail line chosen\n list_stations_from_direction(@get_line)\n\n #receives the input from user to select from an available list of stations based on a rail line\n get_station = gets.strip.to_i\n\n if !get_station.between?(1, @station.length)\n puts \"Lets try this again:\"\n list_of_trains_based_on_direction\n else\n list_trains_from_station_and_dir(get_station)\n end\n end",
"def train_wagon?(wagon)\n wagon.type == self.type\n end",
"def win?\n sleep(3)\n check_points\n end",
"def test_several_active\n result=[]\n at=Activity_tracker.new do\n result.push nil\n end\n 3.times do |i|\n at.active i\n end\n sleep at.timeout+at.tick_time\n assert result.size==3, 'result size is '+result.size.to_s\n end",
"def transfer_submitter\n basic\n can :create, Transfer\n can :confirm, Transfer\n end",
"def lock_movements?\n true\n end",
"def accessioned?\n (6..8).cover?(status)\n end",
"def stay_alive?(live_neighbors)\n live_neighbors == 2 || live_neighbors == 3\nend",
"def current_trains\n data = parse_json\n current_trains = []\n data['Trips'].each do |train|\n if !train['Position'].nil?\n train_number = train['Position']['Train']\n position = {lat: train['Position']['Lat'], long: train['Position']['Long']}\n end\n destination = train['Destination']\n stops = []\n train['Predictions'].each do |stop|\n stops << {stop: stop['Stop'], seconds: stop['Seconds']} # stop needs better name, maybe stop_name or name\n end\n current_trains << MbtaWrapper::Subway.new(train_number, destination, stops, position)\n end\n current_trains\n end",
"def do_turn\n return if @pw.my_planets.length == 0\n return if @pw.enemy_planets.length == 0\n return if @pw.not_my_planets.length == 0\n end",
"def check_wagons_for_train_type(number)\n @wagons[@trains[number.to_sym].type].any?\n end",
"def can_buy_depot_train?(entity)\n entity.cash >= @depot.upcoming.first.price\n end",
"def able_to_operate?(_entity, _train, _name)\n true\n end",
"def sampled_ineligible?\n sampled_persons_ineligibilities.count > 0\n end",
"def has_trialed?\n current_user.subscriptions.any? {|s| !s.canceled_at.nil? && s.canceled_at > s.created_at + 13.days }\n end"
] |
[
"0.6562159",
"0.6277997",
"0.6132191",
"0.59968495",
"0.5958699",
"0.58918655",
"0.58738065",
"0.56264275",
"0.56124353",
"0.55535334",
"0.55197066",
"0.54711455",
"0.5419702",
"0.5418781",
"0.5409581",
"0.5407284",
"0.5394797",
"0.53548205",
"0.5345095",
"0.5344221",
"0.53215915",
"0.53113115",
"0.52861565",
"0.5278356",
"0.5272299",
"0.52679354",
"0.52627194",
"0.52607167",
"0.52594554",
"0.5256235",
"0.52481425",
"0.52462596",
"0.5238002",
"0.5227751",
"0.52202535",
"0.52076095",
"0.5184319",
"0.51841784",
"0.51732117",
"0.5165401",
"0.51502705",
"0.5120022",
"0.51157653",
"0.5114347",
"0.5111962",
"0.51117736",
"0.508763",
"0.5085409",
"0.5077181",
"0.5063336",
"0.5059035",
"0.50552076",
"0.50540465",
"0.50429356",
"0.50366116",
"0.5033851",
"0.5033648",
"0.50320995",
"0.5029762",
"0.5024144",
"0.502001",
"0.5019072",
"0.5018697",
"0.50186944",
"0.5017387",
"0.50172836",
"0.5012034",
"0.50080633",
"0.50049555",
"0.4998083",
"0.49972644",
"0.499359",
"0.49920586",
"0.4991257",
"0.49830645",
"0.4980664",
"0.49730024",
"0.4970863",
"0.49693775",
"0.49599868",
"0.49565956",
"0.49540395",
"0.49490875",
"0.4945463",
"0.4944961",
"0.4943299",
"0.4940569",
"0.49347037",
"0.49325496",
"0.49201745",
"0.49199632",
"0.4917726",
"0.4917568",
"0.49144748",
"0.49143532",
"0.4913359",
"0.49117953",
"0.4901617",
"0.4899144",
"0.48946106"
] |
0.5557728
|
9
|
May return a list of all trains at a station currently in use.
|
def trains_list
@trains.each_with_index do |train, index|
puts "#{index}. Поезд номер #{train.num}"
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def list_trains_on_station\n if @trains.empty? || @stations.empty?\n trains_or_stations_void\n else\n request = request_station\n station = getting(request, :approve_station_selection, :select_station)\n check_the_trains(station)\n end\n end",
"def list_stations\n if @stations.empty?\n stations_void\n else\n stations_list\n end\n end",
"def stations_list\n @route.get_stations_list\n end",
"def stations\r\n return @stations\r\n end",
"def stations_list\n @route.stations_list\n end",
"def show_trains_by_station\n if @stations.empty?\n stations_void\n else\n request = [\"Enter station name: [#{@stations.keys.join(', ')}]: \"]\n getting(request, :approve_station_selection, :show_train)\n end\n end",
"def get_stations\n CF::Station.get(\"/lines/#{ACCOUNT_NAME}/#{self.title.downcase}/stations.json\")\n end",
"def get_all_stations\n url = 'radio/station'\n options = {query: {'alt': 'json', 'tier': 'aa', 'hl': 'en_US'}}\n\n make_post_request(url, options)\n end",
"def list_stations\n @stations.each_with_index { |station, i| puts \"#{i + 1} #{station.name}\" }\n end",
"def trains\n @trains ||= init_trains\n end",
"def stations\n [\n master_station,\n SLCStationReport.new(@fields[5..9], false),\n SLCStationReport.new(@fields[10..14], false),\n SLCStationReport.new(@fields[15..19], false),\n SLCStationReport.new(@fields[20..24], false),\n SLCStationReport.new(@fields[25..29], false)\n ]\n end",
"def trains\n currently_owned(Transaction::IS_TRAIN)\n end",
"def getRoutesFrom(station)\n routeList = @fromNodeMap[station]\n \n return routeList == nil ? [] : routeList\n end",
"def current_trains\n data = parse_json\n current_trains = []\n data['Trips'].each do |train|\n if !train['Position'].nil?\n train_number = train['Position']['Train']\n position = {lat: train['Position']['Lat'], long: train['Position']['Long']}\n end\n destination = train['Destination']\n stops = []\n train['Predictions'].each do |stop|\n stops << {stop: stop['Stop'], seconds: stop['Seconds']} # stop needs better name, maybe stop_name or name\n end\n current_trains << MbtaWrapper::Subway.new(train_number, destination, stops, position)\n end\n current_trains\n end",
"def list_stations\n Station.all.collect{|obj| obj.name}.sort\n end",
"def index\n @tollstations = Tollstation.all\n end",
"def list_all_trains\n Train.all.sort{|a,b| a.destination <=> b.destination}.each.with_index(1) do |element, index|\n puts\"\\n\"\n puts \"#{index}: Destination: #{element.destination}\"\n puts \" Base time: #{element.event_time}\"\n puts \" Line: #{element.line}\"\n puts \" Direction: #{element.dir}\"\n puts \" Incoming Stations:\"\n element.station.each{|hash| puts \"Station: #{hash['station']}\\nWait Time: #{hash['waiting_time']}\\n-----------------------------------\\n\"}\n end\n puts \"\\nType 1 to restart and anything else to end:\\n\"\n get_end = gets.strip\n if get_end == '1'\n restart\n end\nend",
"def index\n @stations = Station.all\n end",
"def getRoutesTo(station)\n routeList = @toNodeMap[station]\n \n return routeList == nil ? [] : routeList\n end",
"def get_stationList(uPos)\n stationList = []\n for n in @@networks\n resp = Net::HTTP.get_response(URI.parse(n)).body\n result = JSON.parse(resp)['network']['stations']\n (stationList << result).flatten!\n end\n stationList.sort! {|s1, s2| dist_user(s1, uPos) <=> dist_user(s2, uPos)}\n end",
"def stations\n stations = []\n CSV.foreach(LOCAL_DATA, :col_sep =>':') do |row|\n callsign, origin, destination, client = row[0].to_s, row[11].to_s, row[13].to_s, row[3].to_s\n for cs in @callsign\n stations << row if callsign[0...cs.length] == cs # && client == \"ATC\") unless @role == \"pilot\"\n # stations << row if (origin[0...icao.length] == icao || destination[0...icao.length] == icao) unless @role == \"atc\"\n end\n end\n stations\n end",
"def get_upstream_stations(origin_station)\n\t\t\n\t\tstarting_station = Bartstation.where(\"short_name = '#{origin_station}'\").pluck(\"id\")[0]\n\t\t\n\t\t# Find all the instances of the starting station\n\t\t# The station may appear on multiple routes\n\t\t\n\t\tstation_routes = {}\n\t\t\n\t\tBartroutestation.where(\"bartstation_id = #{starting_station}\").each do |routestation|\n\t\t\t\tstation_routes[routestation.bartroute_id] = routestation.route_station_sequence\n\t\tend\n\n\t\t# For each route that has the starting station:\n\t\t# Find the starting station \n\t\t# Find the next 5 stations in the reverse direction\n\t\t# (The stations are sequenced in the database to increment from the east \n\t\t# bay direction)\n\n\t\tupstream_stations = {}\n\t\tstation_routes.each do |station_route,station_sequence|\n\t\t\tbartroute_id = station_route\n\t\t\tbartstation_sequence = station_sequence\t\t\t\n\t\t\tupstream_stations[bartroute_id] = \n\t\t\t\tBartroutestation.where(\"bartroute_id = #{bartroute_id} AND \n\t\t\t\t\troute_station_sequence >= #{bartstation_sequence}\").order('route_station_sequence').take(6)\n\t\tend\n\n\t\t# Return the list of upstream stations for each route from the origin station\n\n\t\treturn upstream_stations\n\n\tend",
"def stations\n doc = request(@user, \"stations\")\n stations = []\n doc.xpath('//rss/channel/item').each do |node|\n stations << { :title => node.xpath('title').text.strip,\n :link => node.xpath('link').text.strip,\n :description => node.xpath('description').text.strip,\n :date => node.xpath('pubDate').text.strip,\n :artwork => node.xpath('pandora:stationAlbumArtImageUrl').text.strip,\n :songSeed_song => node.xpath('pandora:seeds/pandora:songSeed/pandora:song').text.strip,\n :songSeed_artist => node.xpath('pandora:seeds/pandora:songSeed/pandora:artist').text.strip,\n :composerSeed => node.xpath('pandora:seeds/pandora:composerSeed/pandora:composer').text.strip,\n :artistSeed => node.xpath('pandora:seeds/pandora:artistSeed/pandora:artist').text.strip}\n end\n stations\n end",
"def find_stations(&blk)\n sectors.inject([]) do |a, e|\n a.push(*e.stations.select(&(blk || TRUEBLOCK)))\n end\n end",
"def index\n @raiway_stations = RaiwayStation.all\n end",
"def index\n @stations = Station.all\n end",
"def index\n @station_infos = StationInfo.all\n end",
"def find_stations(mta, start_station, end_station)\n\n # Find the lines the stations are on\n lines = find_lines mta, start_station, end_station\n\n # Find the indexes on the found lines\n origin_index = mta[lines[0]].index(start_station)\n origin_union_index = mta[lines[0]].index(\"Union Square\")\n dest_union_index = mta[lines[1]].index(\"Union Square\")\n dest_index = mta[lines[1]].index(end_station)\n\n # Return an array of the results\n stations = [lines[0], origin_index, origin_union_index, lines[1], dest_union_index, dest_index]\nend",
"def get_station_names\n\n\t\t# Typhoeus is used to submit http requests\n\n\t\t response = Typhoeus.get(\"http://api.bart.gov/api/stn.aspx?cmd=stns&key=ZZLI-UU93-IMPQ-DT35\")\n\n\t\t # Extract the station names and short names\n\n\t\t response_XML = Nokogiri.XML(response.body)\n\n\t\t @station_names = {}\n\n\t\t # Create a hash list of the station names and abbreviations\n\t\t # node provides the full name of the station and next node is \n\t\t # the abbreviation\n\n\t\t response_XML.xpath(\"//stations/station/name\").each do |node|\n\t\t \t\t@station_names[node.text] = node.next.text\n\t\t end\n\n\t\t return @station_names\n\n\tend",
"def stations\n @stations ||= (exact_match? ? parse_station : parse_stations)\n end",
"def all_trips\n return Rideshare::Trip.find_trip_by_rider(@id)\n end",
"def lines_at_station(station)\r\n line_array = Array.new\r\n\r\n lines.each {|lines, stations|\r\n stations.each {|x| \r\n if x == station\r\n line_array.push(lines)\r\n end \r\n } \r\n }\r\n\r\n return line_array\r\n end",
"def nearby_station_ids\n @nearby_station_ids ||= self.nearby_stations.map { |s| s['id'] }\n end",
"def find_station_lines(station) #calling the relationship between the station and the station line\n station.station_lines\n end",
"def for_station(station_key)\n # STATIONS[station_key] can return either an array of RO keys or a single RO key\n [STATIONS[station_key]]\n .flatten\n .map(&RegionalOffice.method(:find!))\n end",
"def index\n @railway_stations = RailwayStation.all\n end",
"def stations\n ActiveModel::ArraySerializer.new(object.station, each_serializer: Api::V1::StationSerializer)\n end",
"def entrances(from={})\n params = {:lat => 0, :lon => 0, :radius => 500}.merge(from)\n StationEntrance.get_all(params)\n end",
"def index\n @asos_stations = AsosStation.all\n end",
"def stations_status\n Citibikenyc.stations_status\n end",
"def index\n @set_stations = SetStation.all\n end",
"def initialize_stations\r\n @stations = Array.new\r\n i = 0\r\n\r\n @lines.each {|line, stations|\r\n stations.each_with_index {|item, index|\r\n @stations.push(Station.new(item))\r\n if index == 0\r\n @stations.at(-1).set_train(@trains.at(i))\r\n i += 1\r\n end\r\n }\r\n }\r\n\r\n @stations = @stations.uniq { |s| s.station.to_s}\r\n end",
"def initialize_trains\r\n @trains = Array.new\r\n\r\n @lines.each {|line, stations|\r\n @trains.push(Train.new(line))\r\n }\r\n \r\n return @trains\r\n end",
"def index\n @main_stations = MainStation.all\n end",
"def current_trains\n @trains\n end",
"def index\n @train_routes = TrainRoute.includes(:departure_station, :arrival_station).all\n byebug\n end",
"def trainers\n trainer_locations = TrainerLocation.all.select {|trainer_location| trainer_location.location == self}\n trainer_locations.map {|trainer_location| trainer_location.trainer}\n end",
"def stations_on_line(code)\n Station.get_on_line(code)\n end",
"def info\n puts \"All stations:\"\n @stations.each.with_index(1) do |station|\n puts \"#{station.name}: \"\n station.show_trains(\"Cargo\")\n station.show_trains(\"Passenger\")\n end\n\n puts \"All routes:\"\n show_routes\n puts \"All trains:\"\n show_trains\n puts \"All wagons:\"\n show_wagons\n end",
"def index\n @line_station_2s = LineStation2.all\n end",
"def index\n @station_dailies = StationDaily.all\n end",
"def print_stations_and_trains\n show_all_trains_on_stations_header\n return show_empty_message_on_stations if Station.all.empty?\n\n Station.all.each do |station|\n show_name_of_station_header(station)\n show_empty_message_on_stations unless station.trains.any?\n\n station.each_train do |train|\n puts train\n train.each_carriage { |carriage| show_formatted_item(carriage) }\n end\n end\n end",
"def listings\n @listings = trips.select do |trip|\n trip.listings\n end\n end",
"def link_to_station\n if @trains.empty? || @stations.empty?\n staions_or_trains_void\n else\n request = [\"Enter train number [#{@trains.keys.join(', ')}]: \"]\n train = getting(request, :approve_train_selection, :select_train)\n request = request_station\n station = getting(request, :approve_station_selection, :select_station)\n train_placed if station.arrive(train)\n end\n end",
"def index\n @station_hours = StationHour.all\n end",
"def stations_status(options={})\n get(stations_path, options.merge(:updateOnly => true))\n end",
"def show_trains\n @trains.each do |train| \n puts train\n end\n end",
"def trades\n Client.current.get(\"#{resource_url}/trades\")\n end",
"def listings\n self.trips.map{|trip| trip.listing}\n end",
"def index\n @trainees = current_user.trainees\n end",
"def listings\n self.trips.map {|trip| trip.listing}.uniq\n end",
"def list_of_trains_based_on_direction\n #put puts a list of train stations based on the rail line chosen\n list_stations_from_direction(@get_line)\n\n #receives the input from user to select from an available list of stations based on a rail line\n get_station = gets.strip.to_i\n\n if !get_station.between?(1, @station.length)\n puts \"Lets try this again:\"\n list_of_trains_based_on_direction\n else\n list_trains_from_station_and_dir(get_station)\n end\n end",
"def get_available_station_graph\n station_list = []\n line_station_list = []\n station_index = 0\n line_station_index = 0\n single_line_station_index = 0\n junction_line_station_index = 0\n # Getting the adjacent staions of each available stations\n @stations.each do |line_stations|\n line_station_index = 0\n line_stations.each do |_line_station|\n adjacent_station = {}\n line_station_list = []\n if line_station_index.zero?\n adjacent_station.store(@stations[station_index][line_station_index + 1][0], @timeline[station_index][2])\n else\n adjacent_station[@stations[station_index][line_station_index - 1][0]] = @timeline[station_index][2] # assigning the time values for waiting\n if line_station_index < (@stations[station_index].length - 1)\n adjacent_station.store(@stations[station_index][line_station_index + 1][0], @timeline[station_index][2])\n end\n end\n single_line_station_index = 0\n # Getting the adjacent interchange staions of each available stations\n @stations.each do |junction_line_stations|\n unless single_line_station_index == station_index\n junction_line_station_index = 0\n junction_line_stations.each do |_single_line_station|\n if @stations[station_index][line_station_index][1] == @stations[single_line_station_index][junction_line_station_index][1]\n adjacent_station.store(@stations[single_line_station_index][junction_line_station_index][0], @timeline[single_line_station_index][3]) # assigning the time values for interchange\n end\n junction_line_station_index += 1\n end\n end\n single_line_station_index += 1\n end\n line_station_list.push([@stations[station_index][line_station_index][0], adjacent_station])\n station_list.push(line_station_list)\n line_station_index += 1\n end\n station_index += 1\n end\n station_list # The station list for the graph. formatted as [[[\"NS1\", {\"NS2\"=>12, \"EW24\"=>15}]]]\n end",
"def get_nearby_stops(lat, lon)\n # hit trimet api for stops near this location\n # https://developer.trimet.org/ws/V1/stops\n end",
"def list_of_train_direction(direction,trains)\n train_list = []\n trains.each do |train|\n if direction == train[:direction]\n train_list << train[:train]\n end\n end\n return train_list\nend",
"def trips\n RideShare::Trip.find_all_for_rider(@id)\n end",
"def trainings\n Namespace::Trainings.new(credentials: credentials)\n end",
"def routes_list\n Route.all.each.with_index(1) do |(route), index|\n puts \"#{index}. Маршрут: #{route.stations.first.name} - #{route.stations.last.name}\"\n end\n end",
"def current_station_index\n @route.stations.find_index(@current_station)\n end",
"def index\n @recordingstations = Recordingstation.all\n end",
"def all_trails\n # find all trails in this park\n ParkTrails.all.select do |pt|\n pt.park == self\n end.collect do |this_park|\n this_park.trail.name\n end\n end",
"def index\n @police_stations = PoliceStation.all\n end",
"def get_local_trails(params = {})\n allowed_keys = [:lat, :lon, :maxDistance, :maxResults, :sort, :minLength, :minStars]\n request_params = params.select { |k| allowed_keys.include?(k) }.merge(key: @private_key)\n\n request(\n http_method: :get,\n endpoint: \"get-trails\",\n params: request_params\n )\n end",
"def popular_starting_station\n Trip.popular_starting_station\n end",
"def find_user_stations\n stations = profile_user.stations.all(:limit => 5, :include => [:abstract_station])\n artist_ids = stations.map{|s| s.abstract_station.artist_id}\n Artist.find_all_by_id artist_ids\n rescue\n end",
"def view_current_trips\n @trips = Request.all\n @count = Request.count\n @trips.each do |trip|\n @curLoc = trip.currentLoc\n @destination = trip.destination\n end\n end",
"def arrivals(station, opts = {})\n ldbws.arrival_board(station, opts)\n end",
"def find_closest_stations\n\tuserLoc = [params[:lat], params[:lng]]\n\tbounds = Geokit::Bounds.from_point_and_radius(userLoc, 10) \n\t@stations = Station.in_bounds(bounds).all # get all stations within 10 miles\t\n\t@stations.each do |s| # calc distance\n\t\ts['distance'] = s.distance_from(userLoc, :units => :miles)\n\tend\n\t@stations.sort! { |a, b| a.distance <=> b.distance }\n\tputs \"num stations found: \" + @stations.size.to_s\n\trender :json => @stations.to_json\n\t#render :json => Station.find_all_by_stop_lat_and_stop_lng(params[:lat], params[:lng]).to_json #works\n\t#repond_with was not working, not sure why\n end",
"def sensors\n list = []\n each_sensor {|s| list << s}\n list\n end",
"def fetch_stations(state)\n\n scraper_logger.info(\"Fetching stations for #{state.name}\")\n\n doc = Nokogiri::HTML(open(state.url))\n doc.css('a').each do |s|\n\n Global::OBSERVATION_PRODUCT_CODE.each do |c|\n if s.attr('href').include?(c) and s.attr('href').include?(state.product_group)\n extract_station(s.attr('href'), state)\n end\n end\n\n end\n\n scraper_logger.info(\"Completed fetching stations for #{state.name}\")\n\n end",
"def listings\n self.trips.map do |ti|\n ti.listing \n end\n end",
"def get_all_thermal_blocks()\n zones = find_all_commands(\"ZONE\")\n end",
"def index\n @petrol_stations = PetrolStation.all\n end",
"def arrivals(refresh = false)\n if tvs\n trains(:arrival, refresh)\n end\n end",
"def listings\n trips.map {|trip| trip.listing}\nend",
"def trips\n arr = []\n Trips.all.each do |trip|\n if trip.listing == self\n arr << trip\n end\n end\n arr\n end",
"def index\n @weekly_schedules = current_user.trucks.map do |truck|\n truck.weekly_schedules\n end\n @all_schedules = @weekly_schedules.flatten\n end",
"def trips\n trips = RideShare::Trip.trips_by_rider(@id)\n if trips != nil\n return trips\n else\n return []\n end\n end",
"def index\n @tracs = Trac.all\n end",
"def trips\n @trips = Trip.all.select do |trip|\n trip.listing == self\n end\n end",
"def load_station_data\n data = Net::HTTP.get(URI.parse(stations_url))\n JSON.parse(data)[\"result\"]\n end",
"def all\n court_slots\n end",
"def trips\n Trip.all.select { |trip| trip.listing==self}\n end",
"def index\n @stations = Station.all\n\n render json: @stations\n end",
"def get_strawberries\n @all_strawberries\n end",
"def trips\n Trip.all.filter do |trip|\n trip.listing == self\n end\n end",
"def get_station_tracks(station_id, number_of_tracks = 25, recently_played = [])\n url = 'radio/stationfeed'\n options = {\n query: {'alt': 'json', 'include-tracks': 'true', 'tier': 'aa', 'hl': 'en_US'},\n headers: {'Content-Type': 'application/json'},\n body: {'contentFilter': 1,\n 'stations': [\n {\n 'numEntries': number_of_tracks,\n 'recentlyPlayed': recently_played.map { |rec| add_track_type rec},\n 'seed': { \n \"#{get_typename_from_id(station_id)}\": station_id, \n 'kind': 'sj#radioSeed', \n 'seedType': get_seed_type_from_id(station_id)\n }\n }\n ]}.to_json\n }\n\n res = make_post_request(url, options)\n return res['data']['stations']\n end",
"def clients\n trainers.map {|trainer| trainer.clients}.flatten\n end",
"def index\n @fire_stations = FireStation.all\n end",
"def station\n\trespond_with(@station = Station.find_all_by_stop_id(params[:stop_id]))\n end"
] |
[
"0.7824395",
"0.70303375",
"0.693891",
"0.6926481",
"0.6796568",
"0.6625474",
"0.6580129",
"0.65419567",
"0.6461296",
"0.6461236",
"0.6455939",
"0.64547074",
"0.6373118",
"0.6348109",
"0.63069975",
"0.62987155",
"0.6212069",
"0.6201019",
"0.62005323",
"0.61925745",
"0.611712",
"0.60887563",
"0.6070284",
"0.60408324",
"0.6016023",
"0.5991009",
"0.59147215",
"0.59118277",
"0.59079725",
"0.5900643",
"0.58715045",
"0.58593816",
"0.5816639",
"0.5792904",
"0.5790394",
"0.5788104",
"0.57638097",
"0.57209885",
"0.57136315",
"0.5695328",
"0.5659399",
"0.5657505",
"0.565674",
"0.56380373",
"0.5637653",
"0.5636073",
"0.56343085",
"0.55869603",
"0.5547036",
"0.55234575",
"0.5521768",
"0.5514027",
"0.551175",
"0.55046254",
"0.55024815",
"0.5494563",
"0.54872364",
"0.5471324",
"0.5470061",
"0.5417026",
"0.5406939",
"0.54014814",
"0.5376337",
"0.5364368",
"0.53561664",
"0.5355001",
"0.53520685",
"0.53510594",
"0.5331645",
"0.5319716",
"0.5317894",
"0.53141236",
"0.530556",
"0.5303597",
"0.52926546",
"0.5274738",
"0.52614385",
"0.5258683",
"0.5257109",
"0.5249151",
"0.52464694",
"0.52378553",
"0.52187645",
"0.5218564",
"0.5212384",
"0.5211446",
"0.520507",
"0.5203046",
"0.5202815",
"0.5201534",
"0.5196824",
"0.51963997",
"0.5190704",
"0.51788557",
"0.51741433",
"0.51710486",
"0.5159972",
"0.5139314",
"0.5137367",
"0.51285326"
] |
0.5606175
|
47
|
Can send trains (one at a time, while the train is removed from the list of trains located at the station).
|
def departure(train)
@trains.delete(train)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def list_trains_on_station\n if @trains.empty? || @stations.empty?\n trains_or_stations_void\n else\n request = request_station\n station = getting(request, :approve_station_selection, :select_station)\n check_the_trains(station)\n end\n end",
"def transfer_trains(buyer, minor)\n return if minor.trains.empty?\n\n minor.trains.each do |t|\n t.operated = false\n t.buyable = true\n end\n\n transferred = @game.transfer(:trains, minor, buyer)\n @log << \"#{buyer.name} receives the trains: #{transferred.map(&:name).join(', ')}\"\n end",
"def trains\n currently_owned(Transaction::IS_TRAIN)\n end",
"def move\n @route.stations[@index_current_station].recieve_train(self)\n @route.stations[@index_current_station - 1].send_train(self)\n end",
"def can_sell_train?(train)\n owner = train.owner\n return true unless railway?(owner)\n return true if owner == @qlb\n return true unless train_is_train?(train)\n\n if owner == @nwe && train.distance < 2\n true # nwe will always have a train besides a 1T\n elsif owner == @nwe\n owner.trains.count { |t| train_is_train?(t) && t.distance > 1 } > 1\n else\n owner.trains.count { |t| train_is_train?(t) } > 1\n end\n end",
"def arrival(train)\n @trains << train\n end",
"def link_to_station\n if @trains.empty? || @stations.empty?\n staions_or_trains_void\n else\n request = [\"Enter train number [#{@trains.keys.join(', ')}]: \"]\n train = getting(request, :approve_train_selection, :select_train)\n request = request_station\n station = getting(request, :approve_station_selection, :select_station)\n train_placed if station.arrive(train)\n end\n end",
"def add_train(train)\n trains << train\n end",
"def do_sendtrain(train)\n # send the train\n $threadLock.synchronize {\n\twhile $activeThreads >= $maxThreads\n\t\t$threadCond.wait($threadLock)\t# wait until there is one less thread\n\tend\n\t$activeThreads+=1\n\t$stderr.puts \"activeThreads=#{$activeThreads} GRAB\" if ThreadDebug\n }\n Thread.new {\n\t outputbuffer=[]\n \tbegin\n \t sleepTime=rand(0)*$timeoutTime\n\t $stderr.puts \"Sleeping #{sleepTime} s\" if ThreadDebug\n\t sleep(sleepTime)\t# sleep some random interval amount of time to not run over other threads\n\t responses = Scriptroute::send_train( train )\n\t responses.each { |response|\n\t next unless response.probe\t# this won't be set if the pcap buf overflowed\n\t dst = response.probe.packet.ip_dst\n\t if response.response\n\t r = response.response.packet\n\t icmp_src = r.ip_src\n\t icmp_id = r.ip_id.to_s\n\n\t high = (r.ip_id >> 8 ) & 0xFF\n\t low = r.ip_id & 0xFF\n\t swapped_id = (low << 8) + high\n\n\t resp_type = r.class.to_s.sub(/^Scriptroute::/,'')\n\t resp_type += \"_t=#{r.icmp_type}_c=#{r.icmp_code}\" if resp_type == \"Icmp\"\n\t arrive = response.response.time.to_f.to_s\n\t else\n\t icmp_src = '-'\n\t icmp_id = '-'\n\t resp_type= '-'\n\t arrive = '-'\n\t end\n\t # dst icmpsrc arrive id id(hostorder) type\n\t outputbuffer << sprintf(\"%16s %16s %20s %7s %7s %12s\\n\" % [\n\t\t dst,\n\t\t icmp_src,\n\t\t arrive,\n\t\t icmp_id,\n\t\t swapped_id,\n\t\t resp_type])\n\t }\n\t ensure\n\t $threadLock.synchronize {\n\t\toutputbuffer.each { |l|\t\t# flush output while we have the lock\n\t\t\tputs l\t\t\t# actually print the data\n\t\t}\n\t\t$activeThreads-=1\n\t\t$stderr.puts \"activeThreads=#{$activeThreads} RELEASE\" if ThreadDebug\n\t\traise \"Too many Thread deactivates\" unless $activeThreads>=0\n\t\t$threadCond.signal \t# tell another thread it's their turn to go\n\t }\n\t end\n }\n\nend",
"def move_train\n if @trains.empty?\n puts 'There are no trains to move. Please, create one.'\n else\n selected_train = select_from_array(@trains)\n cases = { '1' => :run_next_station, '2' => :run_previous_station }\n puts \"Select action for #{selected_train}: move to next(1) or to previous(2) station\"\n action = gets.chomp.to_i\n\n selected_train.send(cases[action.to_s]) || incorrect_input\n end\n end",
"def move_station(next_station_index)\n @route.stations[@cur_station_index].send_train(self)\n @route.stations[next_station_index].pass_train(self)\n @cur_station_index = next_station_index\n end",
"def buy_train(operator, train, price = nil)\n operator.spend(price || train.price, train.owner) if price != :free\n remove_train(train)\n train.owner = operator\n operator.trains << train\n @crowded_corps = nil\n\n close_companies_on_event!(operator, 'bought_train')\n end",
"def touch_in(station)\n deduct(PENALTYFARE) if @in_joureny == true\n min_balance? ? (fail \"insufficent funds\") : @the_journey.start(station)\n @in_journey = true\n end",
"def move_forward\n position.depart_train(self)\n @current_station += 1 if @route.stations[@current_station] != @route.stations.last\n position.add_train(self)\n end",
"def trains\n @trains ||= init_trains\n end",
"def transmissions; end",
"def transmissions; end",
"def show_trains_by_station\n if @stations.empty?\n stations_void\n else\n request = [\"Enter station name: [#{@stations.keys.join(', ')}]: \"]\n getting(request, :approve_station_selection, :show_train)\n end\n end",
"def connect(ride)\n rr = ride.becomes(RideRequest)\n time_distance = (rr.time - self.time).abs < 15.minutes\n if self.freeSeats > 0 && time_distance && self.direction == rr.direction && self.toCity == rr.toCity && self.fromCity == rr.fromCity && self.office_id == rr.office_id\n self.ride_requests << rr\n rr.status = 'active'\n self.status = 'active'\n self.decrement(:freeSeats)\n if rr.save && self.save\n true\n else\n false\n end\n else\n puts 'Cannot connect ride'\n puts \"free seats: #{self.freeSeats > 0}\"\n puts \"time distance: #{time_distance}\"\n puts \"direction: #{self.direction == rr.direction}\"\n puts \"to city: #{self.toCity == rr.toCity}\"\n puts \"from city: #{self.fromCity == rr.fromCity}\"\n puts \"office: #{self.office_id == rr.office_id}\"\n false\n end\n end",
"def move_train_by_route\n return action_no_trains_on_route unless @trains.any?(&:route)\n\n available_trains_on_route = @trains.select(&:route)\n\n user_input = ask_choose('Train',\n 'on Route to move',\n available_trains_on_route)\n user_train = @trains[user_input - 1]\n\n show_current_station(user_train)\n\n user_input = ask_direction_to_move_train(user_train)\n move_train_on_user_input(user_input, user_train)\n end",
"def plan_trip (mta, start_station, end_station)\n\n # Check if the user is already at the destination\n if(start_station == end_station)\n puts \"You are already at your destination\\n\\n\"\n else\n # Find the station indexes\n stations = find_stations mta, start_station, end_station\n\n # Build the trip\n trip = [start_station]\n trip.push *build_trip(mta, stations)\n\n #Display the trip\n display_trip trip, stations[0]\n end\n\nend",
"def move_train_forward_by_route\n if @routes.empty? || @trains.empty?\n routes_or_trains_void\n else\n request = [\"Enter train number [#{@trains.keys.join(', ')}]: \"]\n train = getting(request, :approve_train_for_assign, :select_train)\n train_moved_forward_by_route if train.move_train_forward\n end\n end",
"def list_all_trains\n Train.all.sort{|a,b| a.destination <=> b.destination}.each.with_index(1) do |element, index|\n puts\"\\n\"\n puts \"#{index}: Destination: #{element.destination}\"\n puts \" Base time: #{element.event_time}\"\n puts \" Line: #{element.line}\"\n puts \" Direction: #{element.dir}\"\n puts \" Incoming Stations:\"\n element.station.each{|hash| puts \"Station: #{hash['station']}\\nWait Time: #{hash['waiting_time']}\\n-----------------------------------\\n\"}\n end\n puts \"\\nType 1 to restart and anything else to end:\\n\"\n get_end = gets.strip\n if get_end == '1'\n restart\n end\nend",
"def touch_in(station)\n raise 'Balance is insuffcient' if insufficient?\n @journey_log.start(station)\n end",
"def updateStation()\n uri=URI.parse(ViaggiatrenoURLs.STATION_INFO)\n response = Net::HTTP.post_form(uri,{\"stazione\" => @stationFrom, \"lang\" => \"IT\"})\n doc = Nokogiri::HTML(response.body)\n\n doc.xpath(XPathMatchInfo.XPATH_STATION).each do |x|\n \n StringUtils.remove_newlines_tabs_and_spaces(x)\n\n train_number_complete = x.xpath(XPathMatchInfo.XPATH_TRAIN_NUMBER()).to_s\n train_destination = x.xpath(XPathMatchInfo.XPATH_TRAIN_DESTINATION()).to_s\n train_schedule =x.xpath(XPathMatchInfo.XPATH_TRAIN_SCHEDULED()).to_s\n train_description = \"#{train_number_complete} #{train_destination} #{train_schedule}\"\n \n train_number=train_number_complete.match(\"[0-9]+\")[0]\n \n @trains[train_number]=train_description\n @destinations.push(train_destination)\n ### TODO #### #@trains[train_number][description]=train_description\n end\n end",
"def next_station_available?\n current_station_index != @route.stations.length - 1\n end",
"def add_train(train)\n @trains << train\n end",
"def show_wagons_by_train\n if @trains.empty?\n trains_or_wagons_void\n else\n request = [\"Enter the train number: [#{@trains.keys.join(', ')}]: \"]\n getting(request, :approve_train_for_wagons_show, :show_wagon)\n end\n end",
"def game_trains\n trains = build_train_list({\n '2' => 0,\n '3' => 0,\n '4' => 0,\n '5' => 0,\n '6' => 0,\n '7' => 0,\n '3T' => 0,\n 'U3' => 0,\n '2+2' => 0,\n '4T' => 0,\n '4+4E' => 0,\n })\n\n case @units.keys.sort.map(&:to_s).join\n when '1'\n add_train_list(trains, { '2' => 6, '3' => 4, '4' => 3, '5' => 4 })\n when '2'\n add_train_list(trains, { '2' => 5, '3' => 3, '4' => 2, '5' => 3, '6' => 2 })\n when '3'\n # extra 5/3T/U3 for minors\n add_train_list(trains, { '2' => 5, '3' => 3, '4' => 1, '5' => 3, '7' => 2, '3T' => 1, 'U3' => 1 })\n when '12'\n add_train_list(trains, { '2' => 7, '3' => 6, '4' => 4, '5' => 5, '6' => 2, '7' => 0 })\n when '23'\n # extra 5/3T/U3 for minors\n add_train_list(trains, { '2' => 5, '3' => 5, '4' => 4, '5' => 6, '7' => 2, '3T' => 1, 'U3' => 1 })\n else # all units\n # extra 5/3T/U3 for minors\n add_train_list(trains, { '2' => 7, '3' => 6, '4' => 5, '5' => 6, '6' => 2, '7' => 2, '3T' => 1, 'U3' => 1 })\n end\n\n add_train_list(trains, { '3T' => 2, 'U3' => 2 }) if @optional_rules.include?(:u3p)\n add_train_list(trains, { 'U3' => 1, '4T' => 1 }) if @regionals[1]\n add_train_list(trains, { '5' => 1 }) if @regionals[2]\n add_train_list(trains, { '4T' => 1 }) if @regionals[3]\n add_train_list(trains, { '5' => -1, '6' => 3, '7' => 2 }) if @kits[3]\n add_train_list(trains, { '5' => 1, '3T' => 1 }) if @kits[5]\n add_train_list(trains, { '2+2' => 1 }) if @kits[7]\n\n # handle K2\n if @kits[2]\n case @units.keys.sort.map(&:to_s).join\n when '1', '2'\n add_train_list(trains, { '3T' => 3, 'U3' => 1, '2+2' => 3, '4T' => 2, '4+4E' => 2 })\n add_train_list(trains, { '3' => -1, '4' => -1 }) if @kits[3]\n when '12'\n add_train_list(trains, { '3T' => 4, 'U3' => 2, '2+2' => 3, '4T' => 2, '4+4E' => 2 })\n add_train_list(trains, { '3' => -1, '4' => -1, '5' => -1 }) if @kits[3]\n when '23'\n add_train_list(trains, { '3T' => 4, 'U3' => 2, '2+2' => 3, '4T' => 2, '4+4E' => 2 })\n add_train_list(trains, { '3' => -1, '5' => -1 }) if @kits[3]\n when '123'\n add_train_list(trains, { '3T' => 5, 'U3' => 3, '2+2' => 3, '4T' => 2, '4+4E' => 2 })\n add_train_list(trains, { '3' => -1, '4' => -1, '5' => -1 }) if @kits[3]\n end\n end\n\n fix_train_availables(trains)\n\n trains\n end",
"def remove_station_from_route(route)\n available_stations = route.stations.select do |item|\n item != route.stations.first && item != route.stations.last\n end\n\n unless available_stations.empty?\n return remove_station_from_route_core(available_stations, route)\n end\n\n show_info_for_action('removing Station from Route')\n show_info_you_need_at_least('1 Station in Route', 0)\n\n add_station_to_route_advanced(route)\n manage_stations_in_route\n end",
"def simulate(lines,numTrains,passengers,simMonitor)\r\n p_threads = [] #ok\r\n t_threads = [] #ok\r\n stations = {}\r\n trains = {} \r\n \r\n init_lines = {}\r\n ret_lines = {}\r\n lines.each{|k,v|\r\n init_lines[k] = v[1..v.length-1]\r\n } \r\n lines.each{|k,v|\r\n ret_lines[k] = v[0..v.length-2].reverse\r\n }\r\n \r\n @lines = lines\r\n @passengers = passengers\r\n @numTrains = numTrains\r\n \r\n metro_lines = lines.keys #array of the metrolines. red, blue, yellow etc\r\n people = passengers.keys\r\n \r\n metro_lines.each{|i| #access the stations in each metroline\r\n station_names = lines[i]\r\n station_names.each{|j|\r\n if stations[j] == nil\r\n stations[j] = {} #hash for metroline\r\n end\r\n \r\n if stations[j][i] == nil\r\n stations[j][i] = {} #hash for trains at station (for line) CHECK IF POPULATED\r\n end\r\n stations[j][\"passenger\"] = {} #hash for passengers at station \r\n }\r\n }\r\n \r\n @stations = stations\r\n for i in 0...people.length\r\n itin = passengers[people[i]] \r\n first_stop = itin[0]\r\n stations[first_stop][\"passenger\"][people[i]] = true\r\n end \r\n \r\n @passengers.each{|p,val|\r\n @check[p] = false\r\n }\r\n \r\n @simMonitor = simMonitor\r\n @simMonitor.each{|a,b |\r\n @t_cond[a] = b.new_cond\r\n @p_cond[a] = b.new_cond\r\n }\r\n \r\n numTrains.each{|key,val|\r\n index = val\r\n begin\r\n @trains[key + \" \" + index.to_s] = {}\r\n index -= 1\r\n end until(index == 0)\r\n }\r\n\r\nindex = 0\r\n@trains.each{|key,val|\r\n index = index + 1\r\n t_threads.push(\r\n Thread.new do\r\n train_work(@lines, index , numTrains, @passengers, @stations, trains, key, @t_cond, @p_cond)\r\n \r\n if(passengers.empty?)\r\n train_work(ret_lines, index , numTrains, passengers, stations, trains, key, @t_cond, @p_cond)\r\n train_work(init_lines, index , numTrains, passengers, stations, trains, key, @t_cond, @p_cond) \r\n else \r\n until(!@check.values.include?(false))\r\n train_work(ret_lines, index , numTrains, passengers, stations, trains, key, @t_cond, @p_cond)\r\n train_work(init_lines, index , numTrains, passengers, stations, trains, key, @t_cond, @p_cond)\r\n end\r\n end\r\n end\r\n )\r\n }\r\n \r\n @check.each{|p, val|\r\n itinerary = @passengers[p]\r\n p_threads.push(\r\n Thread.new do\r\n passenger_work(itinerary, lines, p)\r\n @check[p] = true\r\n end\r\n \r\n )\r\n }\r\n \r\n \r\n p_threads.each{|x|\r\n x.join\r\n }\r\n t_threads.each{|x|\r\n x.join \r\n }\r\n \r\n end",
"def check_train_wagons\n passenger_trains_amount = 0\n cargo_amount = 0\n @trains.each_value do |train|\n train.type == 'cargo' ? cargo_amount += 1 : passenger_trains_amount += 1\n end\n passenger_matches(passenger_trains_amount) || cargo_matches(cargo_amount)\n end",
"def edit_train_wagons\n cases = { 1 => :add_wagon_to_train, 2 => :remove_wagon_from_train }\n if @trains.empty?\n puts 'There are no trains yet.'\n return\n end\n puts 'Select action with train: add wagon(1), remove wagon(2)'\n action = gets.chomp.to_i\n send(cases[action.to_s]) || incorrect_input\n end",
"def fix_train_availables(tlist)\n phase_list = %w[1 2 3]\n phase_list << '3a' if @units[2] && !@kits[3]\n phase_list.concat(%w[4 4a]) if @kits[3]\n tlist.each do |h|\n h.delete(:available_on) if h[:available_on] && !phase_list.include?(h[:available_on])\n end\n end",
"def move_by_route(forward = true)\n return unless exist_train_route?\n depart_from_station\n\n train_start_speed_kmh = 5\n train_regular_speed_kmh = 60\n\n move train_start_speed_kmh\n move train_regular_speed_kmh\n move train_start_speed_kmh\n\n arrive_to_station forward\n brake\n end",
"def touch_in(station)\n fail \"Less than £1\" if @balance < MIN_BALANCE\n @in_journey = true\n @entry_station = station\n end",
"def can_send?\n !sent?\n end",
"def move_back\n position.depart_train(self)\n @current_station -= 1 if @route.stations[@current_station] != @route.stations.first\n position.add_train(self)\n end",
"def in_transit?\n status.sent?\n end",
"def trains_type(type)\n @trains.select { |train| train.type == type }\n end",
"def step(kind, name)\r\n progress = false\r\n if kind == :train\r\n curr_station = locate_train(name)\r\n\r\n index = station_index(curr_station, name)\r\n #check if need to update rev\r\n if curr_station.station == lines[name].last\r\n curr_station.train.set_rev(true)\r\n end\r\n if curr_station.station == lines[name].first\r\n curr_station.train.set_rev(false)\r\n end\r\n \r\n if curr_station.train.rev? == false\r\n next_station = lines[name][index+1]\r\n else\r\n next_station = lines[name][index-1]\r\n end\r\n\r\n stations.each {|station|\r\n if (station.to_s == next_station) && station.train.nil?\r\n station.set_train(curr_station.train)\r\n curr_station.remove_train\r\n progress = true\r\n Log.train_moves(name, curr_station.station, next_station)\r\n break\r\n end\r\n }\r\n\r\n if progress == false \r\n conflincting_train = (stations.select {|e| e.station == next_station}).first.train.to_s\r\n puts \"Train \" + curr_station.train.get_train + \" cannot advance, \" + conflincting_train + \" train at \" + next_station \r\n end \r\n elsif kind == :passenger\r\n person = nil\r\n # Find passenger object\r\n passengers.each {|x|\r\n if x.passenger == name\r\n person = x\r\n end\r\n }\r\n\r\n stations.each {|x|\r\n if x.passengers.include? person\r\n if !(x.train.nil?)\r\n if x.train.get_train == person.plan[x.station]\r\n x.train.add_passenger(person)\r\n x.remove_passenger(person)\r\n person.delete_pair(x.station)\r\n progress = true\r\n Log.passenger_boards(person.passenger,x.train.get_train,x.station) \r\n end\r\n end\r\n elsif !(x.train.nil?) \r\n if (x.train.passengers.include? person) && (person.plan.has_key?(x.station))\r\n x.add_passenger(person)\r\n x.train.remove_passenger(person)\r\n if (person.plan)[x.station].nil?\r\n person.delete_pair(x.station)\r\n end\r\n progress = true\r\n Log.passenger_exits(person.passenger, x.train.get_train, x.station)\r\n end\r\n end\r\n }\r\n else\r\n puts \"Error, kind type not recognized.\"\r\n end\r\n\r\n return progress\r\n end",
"def train_players\n self.players.each(&:train)\n end",
"def list_of_trains_based_on_direction\n #put puts a list of train stations based on the rail line chosen\n list_stations_from_direction(@get_line)\n\n #receives the input from user to select from an available list of stations based on a rail line\n get_station = gets.strip.to_i\n\n if !get_station.between?(1, @station.length)\n puts \"Lets try this again:\"\n list_of_trains_based_on_direction\n else\n list_trains_from_station_and_dir(get_station)\n end\n end",
"def go_to_the_next_station!\n gain_speed\n current_station.send_out(self) if current_station\n self.current_station_id += 1\n current_station.take(self) if current_station\n stop\n end",
"def create\n @offer = Offer.create(params[:offer])\n @start_time=@offer.on_station_time\n @start_station=@offer.on_station\n @matching_trains=Train.where(\"schedule-> '#{@start_time}' = '#{@start_station}'\")\n @train_id=@matching_trains.first.id\n @stop_time=@matching_trains.first.schedule.key(@offer.off_station)\n\n\n\n respond_to do |format|\n if @offer.update_attributes(:train_id=>@train_id, :off_station_time=>@stop_time)\n format.html { redirect_to @offer, notice: 'Offer was successfully created.' }\n format.json { render json: @offer, status: :created, location: @offer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def need_to_transfer(starting_line, starting_station, ending_line, ending_station)\n transfer_stop_num =\n count_stops(starting_station, \"Union Square\", starting_line) +\n count_stops(\"Union Square\", ending_station, ending_line)\nend",
"def only_one_ability_at_the_same_time\n unless self.player.trainings.not_finished.count == 0\n self.errors[:base] = I18n.t('training.errors.already_training')\n end\n end",
"def list_of_train_direction(direction,trains)\n train_list = []\n trains.each do |train|\n if direction == train[:direction]\n train_list << train[:train]\n end\n end\n return train_list\nend",
"def detach_wagon\n if @trains.empty?\n trains_void\n else\n request = [\"Enter train number [#{@trains.keys.join(', ')}]: \"]\n getting(request, :approve_train_selection, :detach_wagon!)\n wagon_detached\n end\n end",
"def check_availability_of_passenger_wagons\n @trains.each do |train|\n train.each do |element|\n if element.class != Symbol\n return false if element.wagons.any? && element.type == 'passenger'\n end\n end\n end\n end",
"def trains_list\n @trains.each_with_index do |train, index|\n puts \"#{index}. Поезд номер #{train.num}\"\n end\n end",
"def attach_wagon\n if @trains.empty? || @wagons['passenger'].empty? && @wagons['cargo'].empty?\n trains_or_wagons_void\n elsif !check_train_wagons\n wagons_type_void\n else\n request = [\"Enter train number [#{@trains.keys.join(', ')}]: \"]\n getting(request, :approve_train_selection_for_wagons, :attach_wagon!)\n wagon_attached\n end\n end",
"def initialize(station)\r\n @station = station\r\n @train = nil\r\n @passengers = Array.new\r\n end",
"def remove_station(station)\n # remove station object if isn't last or first station\n if station != @stations.first && station != @stations.last\n @stations.delete(station)\n else\n puts \"You can't first or last station!\"\n end\n end",
"def remove_passenger(train: nil)\n train ||= choose_train\n return unless train\n\n car = trains[train].cars.last\n return (puts 'No cars in the train') if car.nil?\n\n car.remove_passenger\n rescue RuntimeError => e\n puts e.message\n end",
"def move_train_backward_by_route\n if @routes.empty? || @trains.empty?\n routes_or_trains_void\n else\n request = [\"Enter the train number [#{@trains.keys.join(', ')}]: \"]\n train = getting(request, :approve_train_for_assign, :select_train)\n train_moved_backward if train.move_train_backward\n end\n end",
"def list_stations\n if @stations.empty?\n stations_void\n else\n stations_list\n end\n end",
"def depart_train(train)\n @trains.delete(train)\n end",
"def sendable?\n at?(:active)\n end",
"def block_method(&block)\n if @train_list.empty?\n puts \"No trains on the station\"\n elsif block_given?\n @train_list.each do |train|\n block.call(train)\n end\n else\n puts \"No blocks\"\n end\n end",
"def trigger_connected_call_forward_if_necessary\n if self.active_changed? && self.hunt_group.hunt_group_members.count > 0\n # deactive CallForward\n #\n if self.hunt_group.hunt_group_members.where(:active => false).count == self.hunt_group.hunt_group_members.count\n self.hunt_group.call_forwards.where(:active => true).each do |x|\n x.update_attributes({:active => false})\n end\n end\n\n # active CallForward\n #\n if self.hunt_group.hunt_group_members.where(:active => true).count > 0\n self.hunt_group.call_forwards.where(:active => false).each do |x|\n x.update_attributes({:active => true})\n end\n end\n end\n end",
"def train_route_params\n params.require(:train_route).permit(:departure_station_id, :arrival_station_id, :train)\n end",
"def current_trains\n data = parse_json\n current_trains = []\n data['Trips'].each do |train|\n if !train['Position'].nil?\n train_number = train['Position']['Train']\n position = {lat: train['Position']['Lat'], long: train['Position']['Long']}\n end\n destination = train['Destination']\n stops = []\n train['Predictions'].each do |stop|\n stops << {stop: stop['Stop'], seconds: stop['Seconds']} # stop needs better name, maybe stop_name or name\n end\n current_trains << MbtaWrapper::Subway.new(train_number, destination, stops, position)\n end\n current_trains\n end",
"def move_forward\n raise 'Это последняя станция' if @stations[@index + 1].nil?\n\n @stations[@index].departure(self)\n @index += 1\n @current_station = @stations[@index]\n @stations[@index].arrival(self)\n end",
"def initialize_stations\r\n @stations = Array.new\r\n i = 0\r\n\r\n @lines.each {|line, stations|\r\n stations.each_with_index {|item, index|\r\n @stations.push(Station.new(item))\r\n if index == 0\r\n @stations.at(-1).set_train(@trains.at(i))\r\n i += 1\r\n end\r\n }\r\n }\r\n\r\n @stations = @stations.uniq { |s| s.station.to_s}\r\n end",
"def enable_tx; @disabled_tx -= 1 end",
"def route_trains(entity)\n entity.runnable_trains.map { |t| @subtrains[t] }.flatten\n end",
"def accept\n @proxy_deposit_request.transfer!(params[:reset])\n if params[:sticky]\n current_user.can_receive_deposits_from << @proxy_deposit_request.sending_user unless\n current_user.can_receive_deposits_from.include? @proxy_deposit_request.sending_user\n end\n redirect_to hyrax.transfers_path, notice: \"Transfer complete\"\n end",
"def trainer_only\n if logged_in?\n \t@trainer = Trainer.find_by(user_id: current_user.id.to_i)\n if @trainer.nil?\n \tredirect_to root_path, :alert => \"Access denied.\"\n else\n \tif @trainer.id.to_i != Protege.find_by(user_id: params[:id]).trainer_id.to_i\n \t\tredirect_to root_path, :alert => \"Nie masz dostępu do tej karty\"\n \tend\n end\n else\n redirect_to root_path, :alert => \"Access denied.\"\n end\n end",
"def trains_by_direction(train_list, direction)\n trains_north = train_list.select do |trains|\n trains[:direction] == direction\n end\n\n trains_north.map! do |trains|\n trains[:train]\n end\n\n trains_north.each do |name|\n puts \" -#{name}\"\n end\nend",
"def stations_list\n @route.get_stations_list\n end",
"def stations_list\n @route.stations_list\n end",
"def plan_trip(stop1, line1, stop2, line2)\n\n trains = {\n \"N\" => [\"Times Square\", \"34th\", \"28th\", \"23rd\", \"Union Square\", \"8th\"],\n \"L\" => [\"8th\", \"6th\", \"Union Square\", \"3rd\", \"1st\"],\n \"6\" => [\"Grand Central\", \"33rd\", \"28th\", \"23rd\", \"Union Square\", \"Astor Place\"]\n }\n\n transfer = \"Union Square\" #DEFAULT TRANSFER STATION\n if line1 != line2 && stop1 == \"Union Square\" #PREVENTS BOARDING THE WRONG TRAIN AT UNION SQUARE\n puts \"Just board the correct train.\"\n line1 = line2\n end\n if line1 == line2 #there may be a clearer way to do this, but this allows a single train line output\n transfer = stop2\n end\n\n route1 = trains[line1] #this is just for readability\n route2 = trains[line2]\n\n if route1.index(stop1) < route1.index(transfer) #this always fires, and is either the only or first segment\n first_path = route1[(route1.index(stop1) + 1)..(route1.index(transfer))]\n puts \"You must travel through the following stops on the #{line1} line: #{first_path.join(\", \")}.\"\n else\n uptown = route1.reverse()\n first_path = uptown[(uptown.index(stop1) + 1)..(uptown.index(transfer))]\n puts \"You must travel through the following stops on the #{line1} line: #{first_path.join(\", \")}.\"\n end\n if line2 == line1\n puts \"A total of #{first_path.length} stops.\"\n end\n\n if line1 != line2 #this only fires if there's a second line\n puts \"Transfer at Union Square.\"\n if route2.index(\"Union Square\") < route2.index(stop2)\n second_path = route2[(route2.index(\"Union Square\") + 1)..(route2.index(stop2))]\n puts \"You must continue through the following stops on the #{line2} line: #{second_path.join(\", \")}.\"\n else\n uptown = route2.reverse()\n second_path = uptown[(uptown.index(\"Union Square\") + 1)..(uptown.index(stop2))]\n puts \"You must continue through the following stops on the #{line2} line: #{second_path.join(\", \")}.\"\n end\n puts \"A total of #{first_path.length + second_path.length} stops.\"\n end\n\nend",
"def singleTrip (start_station, end_station, line)\n start_index = MTA[line].index(start_station)\n end_index = MTA[line].index(end_station)\n\n if start_index < end_index\n stops = MTA[line][start_index ... end_index]\n num_stops = end_index - start_index\n end\n\n if end_index < start_index\n stops = MTA[line][end_index ... start_index]\n stops = stops.reverse\n num_stops = start_index - end_index\n\n end\n print = \"You must travel through the following stops on the #{line}: #{stops}\"\n # print = \"#{num_stops} in total\"\nend",
"def trains_going_direction(array_of_trains, desired_direction)\n\n #loop through array_of_trains\n\n array_of_trains.each do |train|\n if train[:direction] == desired_direction\n puts train\n end\n end\nend",
"def send_pending; end",
"def allowed_to_ship_data?\n return false if (Time.now.to_i - self.synced_at) < 43200\n return true\n end",
"def direction(compass, trainlist)\n nsew = []\n\n trainlist.each do |train|\n if train[:direction] == compass\n nsew << train[:train]\n end\n end\n return nsew\nend",
"def fill_train(train)\n 120.times { train.board(active_passenger, station) }\n end",
"def trainer_only\n\t\t\tif logged_in?\n\t\t\t\tif Trainer.find_by(user_id: current_user.id.to_i).nil?\n\t\t\t\t\tredirect_to root_path, :alert => \"Odmowa dostępu111\"\n\t\t\t\telsif !active_trainer?\n\t\t\t\t\tredirect_to root_path, :alert => \"Odmowa dostępu, musisz byc aktywnym trenerem\" \n\t\t\t\tend\n\n\t\t\telse\n\t\t\t\tredirect_to root_path, :alert => \"Odmowa dostępu\"\n\t\t\tend\n\t\tend",
"def arrivals(refresh = false)\n if tvs\n trains(:arrival, refresh)\n end\n end",
"def last_station?\n @current_station_index == @route.stations.count - 1\n end",
"def consists_of_params\n params.require(:consists_of).permit(:station_ID, :train_ID, :stop_number)\n end",
"def initialize (start_num, train_direction, line, speed = 1)\r\n @start_num = start_num #station start number integer\r\n @start_point = line.stations[@start_num].station_name #start station name string\r\n @train_direction = train_direction #direction string\r\n @station_arr = line.stations_names #list of line names array of string\r\n @distances = line.distances #list of distances of line array of integer\r\n @station_index = @start_num #current station index integer\r\n @line_name = line.line_name #line name string\r\n @timetable = {} #timetable for this train hash of array of interger\r\n @speed = speed\r\n \r\n @@all_trains.push(self) #array of train objects array of obj\r\n\r\n #if first station - change direction\r\n if(@station_index == 0)\r\n case line.direction #check line direction\r\n when 'NS'\r\n @train_direction = 'S'\r\n when 'EW'\r\n @train_direction = 'E'\r\n end\r\n end\r\n \r\n #if last station - change direction\r\n if(@station_index == (@station_arr.length - 1))\r\n case line.direction #check line direction\r\n when 'NS'\r\n @train_direction = 'N'\r\n when 'EW'\r\n @train_direction = 'W'\r\n end\r\n end\r\n \r\n # print \"Train created - #{@start_point} - #{@train_direction}\\n\"\r\n end",
"def next_train(station, destinations, opts = {})\n ldbws.next_departures_with_details(station, destinations, opts)\n end",
"def broadcast_check_for_hunts!\n @account.self_and_all_descendant_customers.find_each do |customer|\n ServiceRunnerJob.perform_later(\n \"DeviceBroadcasts::Customer\",\n customer,\n { type: \"hunts\", payload: {} }.to_json\n )\n end\n end",
"def send_unwhitelist_request\n\n Rails.logger.info(\"user_kyc_detail id:: #{@user_kyc_detail_id} - making private ops api call\")\n r = Request::OpsApi::Whitelist.new.whitelist({\n whitelister_address: api_data[:client_whitelist_detail_obj].whitelister_address,\n contract_address: api_data[:client_whitelist_detail_obj].contract_address,\n address: api_data[:address],\n phase: api_data[:phase],\n gasPrice: EstimatedGasPrice::CurrentPrice.new.fetch\n })\n # Rails.logger.info(\"Whitelist API Response: #{r.inspect}\")\n\n unless r.success?\n get_client_whitelist_detail_obj.mark_client_eth_balance_low if GlobalConstant::ClientWhitelistDetail.low_balance_error?(r.error)\n return r\n end\n\n @kyc_whitelist_log = KycWhitelistLog.create!({\n client_id: @client_id,\n ethereum_address: api_data[:address],\n client_whitelist_detail_id: api_data[:client_whitelist_detail_obj].id,\n phase: api_data[:phase],\n transaction_hash: r.data[:transaction_hash],\n nonce: r.data[:nonce],\n gas_price: r.data[:gas_price],\n next_timestamp: Time.now.to_i + GlobalConstant::KycWhitelistLog.expected_transaction_mine_time,\n status: GlobalConstant::KycWhitelistLog.pending_status,\n failed_reason: 0\n })\n\n success\n end",
"def delete_station(station)\n @stations.delete(station)\n end",
"def update_transferplayer?\r\n # Abort loop if player isn't place moving\r\n unless $game_temp.player_transferring\r\n return true\r\n end\r\n # Run place move\r\n transfer_player\r\n return false\r\n end",
"def route=(route)\n @current_station&.send_train(self)\n\n @route = route\n @current_station = route.first\n @current_station.add_train(self)\n end",
"def add_passenger(train: nil)\n train ||= choose_train\n return unless train\n\n car = trains[train].cars.last\n return (puts 'No cars in the train') if car.nil?\n\n car.add_passenger\n rescue RuntimeError => e\n puts e.message\n end",
"def in_journey?\n @entry_station != nil\n end",
"def stations\n stations = []\n CSV.foreach(LOCAL_DATA, :col_sep =>':') do |row|\n callsign, origin, destination, client = row[0].to_s, row[11].to_s, row[13].to_s, row[3].to_s\n for cs in @callsign\n stations << row if callsign[0...cs.length] == cs # && client == \"ATC\") unless @role == \"pilot\"\n # stations << row if (origin[0...icao.length] == icao || destination[0...icao.length] == icao) unless @role == \"atc\"\n end\n end\n stations\n end",
"def validate_route_deletion!\n unless route.stations.find { |station| station.name == station_name }\n raise 'Unexisting station'\n end\n if station_name == route.stations.first\n raise 'First station can not be deleted'\n end\n return false unless station_name == route.stations.last\n raise 'Last station can not be deleted'\n end",
"def touch_in(station, journey = Journey.new)\n raise 'Balance is insuffcient' if insufficient?\n @current_journey = journey\n @current_journey.add_entry_journey(station)\n end",
"def create\n flag = true\n item = Item.find(params[:trades][:item_id])\n offer = Item.find(params[:trades][:offer_id])\n passive_trade = PassiveTrade.find(params[:trades][:passive_trade_id])\n if !item.live? or !offer.live? \n flag = false\n end\n t = Trade.where(:item_id => item.id, :offer_id => offer.id).where(\"status != 'REJECTED' and status != 'DELETED'\") unless (flag == false)\n if t.present?\n flag = false\n end\n if flag \n t = Trade.where(:item_id => offer.id, :offer_id => item.id)\n if t.present?\n flag = false\n end\n if flag and current_user and current_user.id == offer.user_id\n trade = Trade.new(params[:trades])\n trade.status = 'ACTIVE'\n trade.save\n\n passive_trade.trade_comments.each do |tc|\n tc.trade_id = trade.id\n tc.save\n end\n passive_trade.trade_terms.each do |tt|\n tt.trade_id = trade.id\n tt.save\n end\n passive_trade.transactions.each do |t|\n t.trade_id = trade.id\n t.save\n end\n\n redirect_location = trade_path(trade)\n \n # if (InfoAndSetting.sm_on_o_made and item.user.notify_received_offer)\n # # Send mail if offer accepted\n # TradeMailer.offer_made_offerer(offer.id,offer.user.id,item.id,item.user.id).deliver\n # TradeMailer.offer_made_owner(offer.id,offer.user.id,item.id,item.user.id).deliver\n # end\n end\n # When user moves back rejected offer to offers\n # if flag and params[:undo_reject] == \"true\"\n # t = Trade.where(:item_id => item.id, :offer_id => offer.id).where(\"status = 'REJECTED'\").first\n # if t.present?\n # t.status = \"DELETED\"\n # t.save\n # end\n # trade = Trade.new(params[:trade])\n # trade.status = 'ACTIVE'\n # trade.save\n # redirect_location = trade_offers_item_path(item) +\"?back_to_offer=true\"\n # else\n # redirect_location = my_offers_item_path(item)\n # session[:offered_item] = offer.title\n # end\n elsif t.present?\n redirect_location = trade_path(t.first)\n else\n redirect_location = passive_trade_path(passive_trade)\n # session[:offered_item] = offer.title\n end\n \n redirect_to redirect_location\n \n # respond_to do |format|\n # if @trade.save\n # format.html { redirect_to @trade, notice: 'Trade was successfully created.' }\n # format.json { render json: @trade, status: :created, location: @trade }\n # else\n # format.html { render action: \"new\" }\n # format.json { render json: @trade.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def find_tails\n transfers = calculate_transfers_range(transfers_number, false)\n return if transfers.nil?\n departure_from = arrival + MIN_TRANSFER_DURATION\n departure_to = arrival + MAX_TRANSFER_DURATION\n\n tracks = Track.where(\n :departure => (departure_from..departure_to),\n :origin_id => destination_id,\n :transfers_number => transfers\n )\n tracks.each do |t|\n Track.join_tracks(self, t)\n end\n end",
"def notify_travellers\n if current_user.nil?\n trip = session[:trip]\n else\n trip = Trip.find(params[:id])\n end\n\n drivers = []\n passengers = []\n\n trip.travellers.each do |t|\n if t.type == 'Driver'\n drivers << t\n else\n passengers << t\n end\n end\n\n trip_output_data = params[:data]\n\n drivers.each { |driver| DriverMailer.trip_email(trip, driver, trip_output_data, current_user).deliver_now }\n passengers.each { |passenger| PassengerMailer.trip_email(trip, passenger, trip_output_data, current_user).deliver_now }\n\n render json: {message: 'Emails were successfully sent.'}\n end",
"def tick\n exchange_market_codes = self.exchange_markets.pluck(:code)\n\n api.marketdata['return']['markets'].each do |market|\n next unless exchange_market_codes.include? market[1]['marketid']\n\n exchange_market = self.exchange_markets.find_by(code: market[1]['marketid'])\n Trades::CryptsyWorker.perform_async(exchange_market.id, market[1]['recenttrades'])\n #Orders::CryptsyWorker.perform_async(exchange_market.id, market[1]['sellorders'], market[1]['buyorders'])\n end\n end",
"def delete_station_in_route\n if @routes.empty?\n routes_void\n else\n request = [\"Enter route name [#{@routes.keys.join(', ')}]: \"]\n route = getting(request, :approve_route_selection, :select_route)\n request = [\"Enter station name [#{all_stations(route)}]: \"]\n station = getting(request, :approve_station_for_route, :select_station)\n station_deleted if route.delete_station(station)\n end\n end"
] |
[
"0.6386513",
"0.62325746",
"0.6177805",
"0.5990064",
"0.5900681",
"0.58220434",
"0.5757583",
"0.568733",
"0.5662197",
"0.5625975",
"0.5621492",
"0.54829425",
"0.54636014",
"0.54334444",
"0.541536",
"0.5385499",
"0.5385499",
"0.5379937",
"0.53464854",
"0.53431845",
"0.5340136",
"0.533498",
"0.5311456",
"0.52806413",
"0.5245341",
"0.52204275",
"0.52092177",
"0.5205624",
"0.5197824",
"0.5176965",
"0.51492167",
"0.51380205",
"0.5125899",
"0.5122304",
"0.51150423",
"0.5099528",
"0.50802577",
"0.5079708",
"0.50734204",
"0.5067526",
"0.5062266",
"0.5058143",
"0.50533015",
"0.5051943",
"0.50145835",
"0.50119436",
"0.50065356",
"0.5005459",
"0.50029737",
"0.49982673",
"0.49964264",
"0.49791196",
"0.49751863",
"0.49698848",
"0.4905267",
"0.48991498",
"0.48904857",
"0.48877755",
"0.48775387",
"0.48718834",
"0.48452312",
"0.48428896",
"0.48274904",
"0.48255056",
"0.48203343",
"0.4799537",
"0.47987193",
"0.4796997",
"0.4794092",
"0.47899395",
"0.4768918",
"0.47676107",
"0.4766985",
"0.47665006",
"0.47537944",
"0.47497633",
"0.47373992",
"0.4735302",
"0.4715997",
"0.4715433",
"0.47127104",
"0.47095755",
"0.47012857",
"0.47007087",
"0.46998262",
"0.46979836",
"0.4692344",
"0.4692322",
"0.4682993",
"0.46775252",
"0.46728224",
"0.46712726",
"0.46492457",
"0.46423596",
"0.46417776",
"0.4633889",
"0.46322843",
"0.4630458",
"0.4624383",
"0.46231505"
] |
0.4692161
|
88
|
Can return the list of trains at the station by type (see below): number of freight, passenger
|
def trains_type(type)
@trains.select { |train| train.type == type }
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def list_trains_on_station\n if @trains.empty? || @stations.empty?\n trains_or_stations_void\n else\n request = request_station\n station = getting(request, :approve_station_selection, :select_station)\n check_the_trains(station)\n end\n end",
"def amount_trains(type_of_train)\n @trains.select { |train| train.type == type_of_train }\n end",
"def show_trains_by_station\n if @stations.empty?\n stations_void\n else\n request = [\"Enter station name: [#{@stations.keys.join(', ')}]: \"]\n getting(request, :approve_station_selection, :show_train)\n end\n end",
"def get_trains_by_type(train_class)\n @trains.select { |train| train.class == train_class }\n end",
"def get_trains_by_type(train_class)\n @trains.select { |train| train.class == train_class }\n end",
"def trains_list\n @trains.each_with_index do |train, index|\n puts \"#{index}. Поезд номер #{train.num}\"\n end\n end",
"def list_stations\n @stations.each_with_index { |station, i| puts \"#{i + 1} #{station.name}\" }\n end",
"def list_all_trains\n Train.all.sort{|a,b| a.destination <=> b.destination}.each.with_index(1) do |element, index|\n puts\"\\n\"\n puts \"#{index}: Destination: #{element.destination}\"\n puts \" Base time: #{element.event_time}\"\n puts \" Line: #{element.line}\"\n puts \" Direction: #{element.dir}\"\n puts \" Incoming Stations:\"\n element.station.each{|hash| puts \"Station: #{hash['station']}\\nWait Time: #{hash['waiting_time']}\\n-----------------------------------\\n\"}\n end\n puts \"\\nType 1 to restart and anything else to end:\\n\"\n get_end = gets.strip\n if get_end == '1'\n restart\n end\nend",
"def get_type_trophies(type)\n trophies = []\n @knights.each do |knight|\n knight.trophies.each do |trophy|\n packet = [knight.id, trophy] \n trophies << packet if trophy.type == type\n end\n end\n return trophies\n end",
"def stations\n [\n master_station,\n SLCStationReport.new(@fields[5..9], false),\n SLCStationReport.new(@fields[10..14], false),\n SLCStationReport.new(@fields[15..19], false),\n SLCStationReport.new(@fields[20..24], false),\n SLCStationReport.new(@fields[25..29], false)\n ]\n end",
"def return_trains_by_type(type)\n (@trains_list.map { |a| a if a.type == type }).compact\n end",
"def list_of_train_direction(direction,trains)\n train_list = []\n trains.each do |train|\n if direction == train[:direction]\n train_list << train[:train]\n end\n end\n return train_list\nend",
"def stations_list\n @route.stations_list\n end",
"def stations_list\n @route.get_stations_list\n end",
"def list_stations\n if @stations.empty?\n stations_void\n else\n stations_list\n end\n end",
"def list_of_trains_based_on_direction\n #put puts a list of train stations based on the rail line chosen\n list_stations_from_direction(@get_line)\n\n #receives the input from user to select from an available list of stations based on a rail line\n get_station = gets.strip.to_i\n\n if !get_station.between?(1, @station.length)\n puts \"Lets try this again:\"\n list_of_trains_based_on_direction\n else\n list_trains_from_station_and_dir(get_station)\n end\n end",
"def popular_starting_station\n Trip.popular_starting_station\n end",
"def show_train(name)\n selected_station = select_station(name)\n selected_station.each_train do |train|\n puts \"Train number: #{train.number}\"\n puts \"Train type: #{train.type}\"\n puts \"Train speed: #{train.speed}\"\n puts \"Wagons list: #{train.wagons.size}\"\n end\n end",
"def info\n puts \"All stations:\"\n @stations.each.with_index(1) do |station|\n puts \"#{station.name}: \"\n station.show_trains(\"Cargo\")\n station.show_trains(\"Passenger\")\n end\n\n puts \"All routes:\"\n show_routes\n puts \"All trains:\"\n show_trains\n puts \"All wagons:\"\n show_wagons\n end",
"def stations\r\n return @stations\r\n end",
"def show_trains(attr = :number)\r\n trains_arr = trains_select(attr)\r\n raise ArgumentError, '=> Поездов нет' if trains_arr.empty?\r\n\r\n trains_arr.each.with_index(1) do |t, i|\r\n puts \"#{i}. #{train_info(t)}, маршрут #{route_info(t.route)}\"\r\n end\r\n rescue ArgumentError => e\r\n puts e.message\r\n end",
"def active_trains\n data = parse_json\n data['Trips'].length\n end",
"def print_stations_and_trains\n show_all_trains_on_stations_header\n return show_empty_message_on_stations if Station.all.empty?\n\n Station.all.each do |station|\n show_name_of_station_header(station)\n show_empty_message_on_stations unless station.trains.any?\n\n station.each_train do |train|\n puts train\n train.each_carriage { |carriage| show_formatted_item(carriage) }\n end\n end\n end",
"def current_trains\n data = parse_json\n current_trains = []\n data['Trips'].each do |train|\n if !train['Position'].nil?\n train_number = train['Position']['Train']\n position = {lat: train['Position']['Lat'], long: train['Position']['Long']}\n end\n destination = train['Destination']\n stops = []\n train['Predictions'].each do |stop|\n stops << {stop: stop['Stop'], seconds: stop['Seconds']} # stop needs better name, maybe stop_name or name\n end\n current_trains << MbtaWrapper::Subway.new(train_number, destination, stops, position)\n end\n current_trains\n end",
"def index\n @tollstations = Tollstation.all\n end",
"def get_stations\n CF::Station.get(\"/lines/#{ACCOUNT_NAME}/#{self.title.downcase}/stations.json\")\n end",
"def trains\n @trains ||= init_trains\n end",
"def quantity_of_type(word_type)\n trains.count {|train| train.type == word_type}\n end",
"def trainers\n trainer_locations = TrainerLocation.all.select {|trainer_location| trainer_location.location == self}\n trainer_locations.map {|trainer_location| trainer_location.trainer}\n end",
"def show_wagons_by_train\n if @trains.empty?\n trains_or_wagons_void\n else\n request = [\"Enter the train number: [#{@trains.keys.join(', ')}]: \"]\n getting(request, :approve_train_for_wagons_show, :show_wagon)\n end\n end",
"def list_stations\n Station.all.collect{|obj| obj.name}.sort\n end",
"def get_all_stations\n url = 'radio/station'\n options = {query: {'alt': 'json', 'tier': 'aa', 'hl': 'en_US'}}\n\n make_post_request(url, options)\n end",
"def stations\n doc = request(@user, \"stations\")\n stations = []\n doc.xpath('//rss/channel/item').each do |node|\n stations << { :title => node.xpath('title').text.strip,\n :link => node.xpath('link').text.strip,\n :description => node.xpath('description').text.strip,\n :date => node.xpath('pubDate').text.strip,\n :artwork => node.xpath('pandora:stationAlbumArtImageUrl').text.strip,\n :songSeed_song => node.xpath('pandora:seeds/pandora:songSeed/pandora:song').text.strip,\n :songSeed_artist => node.xpath('pandora:seeds/pandora:songSeed/pandora:artist').text.strip,\n :composerSeed => node.xpath('pandora:seeds/pandora:composerSeed/pandora:composer').text.strip,\n :artistSeed => node.xpath('pandora:seeds/pandora:artistSeed/pandora:artist').text.strip}\n end\n stations\n end",
"def init_train_types\n @train_types ||= @config.fetch('trains').map do |train|\n major_allowance, minor_allowance = train.fetch('type').split('+')\n TrainType.new(\n Integer(major_allowance),\n Money.new(train.fetch('face_value')),\n minor_station_allowance: minor_allowance\n )\n end\n end",
"def initialize_trains\r\n @trains = Array.new\r\n\r\n @lines.each {|line, stations|\r\n @trains.push(Train.new(line))\r\n }\r\n \r\n return @trains\r\n end",
"def stations\n stations = []\n CSV.foreach(LOCAL_DATA, :col_sep =>':') do |row|\n callsign, origin, destination, client = row[0].to_s, row[11].to_s, row[13].to_s, row[3].to_s\n for cs in @callsign\n stations << row if callsign[0...cs.length] == cs # && client == \"ATC\") unless @role == \"pilot\"\n # stations << row if (origin[0...icao.length] == icao || destination[0...icao.length] == icao) unless @role == \"atc\"\n end\n end\n stations\n end",
"def init_trains\n init_train_types\n @config.fetch('trains').flat_map do |train_type|\n Array.new(train_type.fetch('count')) do\n create_train(train_type)\n end\n end\n end",
"def game_trains\n trains = build_train_list({\n '2' => 0,\n '3' => 0,\n '4' => 0,\n '5' => 0,\n '6' => 0,\n '7' => 0,\n '3T' => 0,\n 'U3' => 0,\n '2+2' => 0,\n '4T' => 0,\n '4+4E' => 0,\n })\n\n case @units.keys.sort.map(&:to_s).join\n when '1'\n add_train_list(trains, { '2' => 6, '3' => 4, '4' => 3, '5' => 4 })\n when '2'\n add_train_list(trains, { '2' => 5, '3' => 3, '4' => 2, '5' => 3, '6' => 2 })\n when '3'\n # extra 5/3T/U3 for minors\n add_train_list(trains, { '2' => 5, '3' => 3, '4' => 1, '5' => 3, '7' => 2, '3T' => 1, 'U3' => 1 })\n when '12'\n add_train_list(trains, { '2' => 7, '3' => 6, '4' => 4, '5' => 5, '6' => 2, '7' => 0 })\n when '23'\n # extra 5/3T/U3 for minors\n add_train_list(trains, { '2' => 5, '3' => 5, '4' => 4, '5' => 6, '7' => 2, '3T' => 1, 'U3' => 1 })\n else # all units\n # extra 5/3T/U3 for minors\n add_train_list(trains, { '2' => 7, '3' => 6, '4' => 5, '5' => 6, '6' => 2, '7' => 2, '3T' => 1, 'U3' => 1 })\n end\n\n add_train_list(trains, { '3T' => 2, 'U3' => 2 }) if @optional_rules.include?(:u3p)\n add_train_list(trains, { 'U3' => 1, '4T' => 1 }) if @regionals[1]\n add_train_list(trains, { '5' => 1 }) if @regionals[2]\n add_train_list(trains, { '4T' => 1 }) if @regionals[3]\n add_train_list(trains, { '5' => -1, '6' => 3, '7' => 2 }) if @kits[3]\n add_train_list(trains, { '5' => 1, '3T' => 1 }) if @kits[5]\n add_train_list(trains, { '2+2' => 1 }) if @kits[7]\n\n # handle K2\n if @kits[2]\n case @units.keys.sort.map(&:to_s).join\n when '1', '2'\n add_train_list(trains, { '3T' => 3, 'U3' => 1, '2+2' => 3, '4T' => 2, '4+4E' => 2 })\n add_train_list(trains, { '3' => -1, '4' => -1 }) if @kits[3]\n when '12'\n add_train_list(trains, { '3T' => 4, 'U3' => 2, '2+2' => 3, '4T' => 2, '4+4E' => 2 })\n add_train_list(trains, { '3' => -1, '4' => -1, '5' => -1 }) if @kits[3]\n when '23'\n add_train_list(trains, { '3T' => 4, 'U3' => 2, '2+2' => 3, '4T' => 2, '4+4E' => 2 })\n add_train_list(trains, { '3' => -1, '5' => -1 }) if @kits[3]\n when '123'\n add_train_list(trains, { '3T' => 5, 'U3' => 3, '2+2' => 3, '4T' => 2, '4+4E' => 2 })\n add_train_list(trains, { '3' => -1, '4' => -1, '5' => -1 }) if @kits[3]\n end\n end\n\n fix_train_availables(trains)\n\n trains\n end",
"def trains_by_direction(train_list, direction)\n trains_north = train_list.select do |trains|\n trains[:direction] == direction\n end\n\n trains_north.map! do |trains|\n trains[:train]\n end\n\n trains_north.each do |name|\n puts \" -#{name}\"\n end\nend",
"def trains\n currently_owned(Transaction::IS_TRAIN)\n end",
"def initialize_stations\r\n @stations = Array.new\r\n i = 0\r\n\r\n @lines.each {|line, stations|\r\n stations.each_with_index {|item, index|\r\n @stations.push(Station.new(item))\r\n if index == 0\r\n @stations.at(-1).set_train(@trains.at(i))\r\n i += 1\r\n end\r\n }\r\n }\r\n\r\n @stations = @stations.uniq { |s| s.station.to_s}\r\n end",
"def find_station_lines(station) #calling the relationship between the station and the station line\n station.station_lines\n end",
"def first_departure_time(list, time)\n\n trains_at_11 = list.select do |trains|\n trains[:departure] == time\n end\n\n trains_at_11.map! do |train|\n train[:train]\n end\nend",
"def find_stations(si, ei, line) # si is short for start index and ei is short for end index\n if ei >= si\n line_stop_count = ei - si\n passing_stations = line[(si+1)..ei].join(\", \")\n else\n line_stop_count = si - ei\n passing_stations = line[(ei)..(si-1)].reverse.join(\", \")\n end\n return {:num_stops => line_stop_count, :stops => passing_stations}\nend",
"def check_train_wagons\n passenger_trains_amount = 0\n cargo_amount = 0\n @trains.each_value do |train|\n train.type == 'cargo' ? cargo_amount += 1 : passenger_trains_amount += 1\n end\n passenger_matches(passenger_trains_amount) || cargo_matches(cargo_amount)\n end",
"def direction(compass, trainlist)\n nsew = []\n\n trainlist.each do |train|\n if train[:direction] == compass\n nsew << train[:train]\n end\n end\n return nsew\nend",
"def car_seats(car_type, seat_type)\n print(car_type)\n Car.where(type: car_type, train_id: self.id).sum(\"#{seat_type}_seats\")\n end",
"def passenger_trains_with_wagons\n trains = Hash[@trains.map do |key, value|\n [key.to_sym, value] if value.wagons.any? && value.type == 'passenger'\n end\n ]\n trains.keys.join(', ')\n end",
"def show\n\n trip = Trip.find(params[:id])\n\n departureOrder = LineStation.find_by_station_id(trip.departureStation_id).order\n arrivalOrder = LineStation.find_by_station_id(trip.arrivalStation_id).order\n\n lineStations = LineStation.where(:order => departureOrder..arrivalOrder)\n lineStations = lineStations.where(:line_id => trip.line_id)\n if departureOrder < arrivalOrder\n lineStations.order('order ASC')\n else\n lineStations.order('order DESC')\n end\n\n times = Array.new\n currentTime = trip.beginTime\n lineStations.each do |ls|\n \n station = Station.find(ls.station_id)\n train = Train.find(trip.train_id)\n\n times << { :station => station, :time => currentTime.strftime('%H:%M') }\n\n timeElapsed = ls.distance.to_f / train.velocity\n currentTime = currentTime + timeElapsed.hours\n end\n\n render :json => { :trip => trip, :times => times }\n\n end",
"def number_of_rides(drivers)\n driver_list = []\n drivers.each do |driver|\n result = 0\n driver[:trips].each do |trip|\n details = trip[:details]\n result += details.length\n end\n driver_list << { driver_id: driver[:driver_id], count: result }\n end\n return driver_list\nend",
"def arrival(train)\n @trains << train\n end",
"def show_trains\n @trains.each do |train| \n puts train\n end\n end",
"def next_train(station, destinations, opts = {})\n ldbws.next_departures_with_details(station, destinations, opts)\n end",
"def user_flights_by_type\n #find key value pairs of aviation_type => flights.count\n result = @current_user.flights.group(:aviation_type).count\n render json: [{name: 'Number of Flights', data: result}]\n end",
"def index\n @raiway_stations = RaiwayStation.all\n end",
"def list_types\n user = current_user\n if !params[:distance].nil? and params[:distance].to_i > 0\n distance = params[:distance].to_i\n else\n distance = 30\n end\n if !params[:latitude].blank? \n latitude = params[:latitude].to_f\n else\n latitude = user.latitude\n end\n if !params[:longitude].blank? \n longitude = params[:longitude].to_f\n else\n longitude = user.longitude\n end\n\n if !params[:latitude].blank? and !params[:longitude].blank? \n user.latitude = latitude\n user.longitude = longitude\n user.save\n end\n\n result = Venue.collect_network_types(current_user, latitude, longitude, distance)\n \n render json: success(result)\n end",
"def flight_segment_tally\n all_flights.length\n end",
"def index\n @stations = Station.all\n end",
"def updateStation()\n uri=URI.parse(ViaggiatrenoURLs.STATION_INFO)\n response = Net::HTTP.post_form(uri,{\"stazione\" => @stationFrom, \"lang\" => \"IT\"})\n doc = Nokogiri::HTML(response.body)\n\n doc.xpath(XPathMatchInfo.XPATH_STATION).each do |x|\n \n StringUtils.remove_newlines_tabs_and_spaces(x)\n\n train_number_complete = x.xpath(XPathMatchInfo.XPATH_TRAIN_NUMBER()).to_s\n train_destination = x.xpath(XPathMatchInfo.XPATH_TRAIN_DESTINATION()).to_s\n train_schedule =x.xpath(XPathMatchInfo.XPATH_TRAIN_SCHEDULED()).to_s\n train_description = \"#{train_number_complete} #{train_destination} #{train_schedule}\"\n \n train_number=train_number_complete.match(\"[0-9]+\")[0]\n \n @trains[train_number]=train_description\n @destinations.push(train_destination)\n ### TODO #### #@trains[train_number][description]=train_description\n end\n end",
"def index\n @trip_types = TripType.all\n end",
"def link_to_station\n if @trains.empty? || @stations.empty?\n staions_or_trains_void\n else\n request = [\"Enter train number [#{@trains.keys.join(', ')}]: \"]\n train = getting(request, :approve_train_selection, :select_train)\n request = request_station\n station = getting(request, :approve_station_selection, :select_station)\n train_placed if station.arrive(train)\n end\n end",
"def trades_count\n trades.count\n end",
"def calculate_stations\n total=($start-$end).abs\n p \"total of stations of your trip is #{total}\"\n end",
"def stations_on_line(code)\n Station.get_on_line(code)\n end",
"def listings\n self.trips.map do |ti|\n ti.listing \n end\n end",
"def trips\n get '/gtfs/trips'\n end",
"def plan_trip (first_l, first_s, last_l, last_s)\n# Get the program to work for a single line:\n# Different way to do global use $\n stations = [ ]\n start = $train_lines[first_l.to_s].index(first_s.to_s)\n finish = $train_lines[last_l.to_s].index(last_s.to_s)\n\n# 2.7.2 :012 > $train_lines.values\n# => [[\"Times Square\", \"34th\", \"28th\", \"23rd\", \"Union Square\", \"8th\"], [\"8th\", \"6th\", \"Union Square\", \"3rd\", \"1st\"], [\"Grand Central\", \"33rd\", \"28th\", \"23rd\", \"Union Square\", \"Astor Place\"]]\n# 2.7.2 :013 > $train_lines.keys\n# => [\"lineN\", \"lineL\", \"line6\"]\n\n if start < finish\n stations = $lineN[start..finish]\n elsif\n stations = $lineN[finish..start].reverse\n end\n\n return stations\n\nend",
"def initialize(station)\r\n @station = station\r\n @train = nil\r\n @passengers = Array.new\r\n end",
"def get_station_data(qty = 10)\n filter = { zip: @zip, limit: qty}\n EnergyService.new(filter).get_stations[:fuel_stations]\n end",
"def stops_from_union(station, line)\n\n\tnum_stops = line.index(station) - line.index(\"Union Square\")\n\tnum_stops.abs\nend",
"def index\n @prestationtypes = Prestationtype.all\n end",
"def index\n @stations = Station.all\n end",
"def get_station_names\n\n\t\t# Typhoeus is used to submit http requests\n\n\t\t response = Typhoeus.get(\"http://api.bart.gov/api/stn.aspx?cmd=stns&key=ZZLI-UU93-IMPQ-DT35\")\n\n\t\t # Extract the station names and short names\n\n\t\t response_XML = Nokogiri.XML(response.body)\n\n\t\t @station_names = {}\n\n\t\t # Create a hash list of the station names and abbreviations\n\t\t # node provides the full name of the station and next node is \n\t\t # the abbreviation\n\n\t\t response_XML.xpath(\"//stations/station/name\").each do |node|\n\t\t \t\t@station_names[node.text] = node.next.text\n\t\t end\n\n\t\t return @station_names\n\n\tend",
"def create_train\n puts 'What type of train do you want to create: 1 - passenger or 2 - cargo:'\n type = gets.chomp.to_i\n puts 'Enter the number of train: '\n number = gets.chomp\n\n case type\n when 1\n self.trains << PassengerTrain.new(number)\n puts \"Passenger train was created with number: #{number}\"\n when 2\n self.trains << CargoTrain.new(number)\n puts \"Cargo train was created with number: #{number}\"\n else\n puts 'Something goes wrong..'\n end\n end",
"def get_available_station_graph\n station_list = []\n line_station_list = []\n station_index = 0\n line_station_index = 0\n single_line_station_index = 0\n junction_line_station_index = 0\n # Getting the adjacent staions of each available stations\n @stations.each do |line_stations|\n line_station_index = 0\n line_stations.each do |_line_station|\n adjacent_station = {}\n line_station_list = []\n if line_station_index.zero?\n adjacent_station.store(@stations[station_index][line_station_index + 1][0], @timeline[station_index][2])\n else\n adjacent_station[@stations[station_index][line_station_index - 1][0]] = @timeline[station_index][2] # assigning the time values for waiting\n if line_station_index < (@stations[station_index].length - 1)\n adjacent_station.store(@stations[station_index][line_station_index + 1][0], @timeline[station_index][2])\n end\n end\n single_line_station_index = 0\n # Getting the adjacent interchange staions of each available stations\n @stations.each do |junction_line_stations|\n unless single_line_station_index == station_index\n junction_line_station_index = 0\n junction_line_stations.each do |_single_line_station|\n if @stations[station_index][line_station_index][1] == @stations[single_line_station_index][junction_line_station_index][1]\n adjacent_station.store(@stations[single_line_station_index][junction_line_station_index][0], @timeline[single_line_station_index][3]) # assigning the time values for interchange\n end\n junction_line_station_index += 1\n end\n end\n single_line_station_index += 1\n end\n line_station_list.push([@stations[station_index][line_station_index][0], adjacent_station])\n station_list.push(line_station_list)\n line_station_index += 1\n end\n station_index += 1\n end\n station_list # The station list for the graph. formatted as [[[\"NS1\", {\"NS2\"=>12, \"EW24\"=>15}]]]\n end",
"def train(origin, destination, date)\n\turl = \"http://ojp.nationalrail.co.uk/service/timesandfares/#{origin}/#{destination}/#{date}/0900/dep\"\n\txml = Nokogiri::HTML(open(url).read)\n\t#get prices\n\tprice_string = xml.css('.opsingle').inner_html\n\tprice_string.gsub!(/\\s+/, \"\")\n\tprices = price_string.scan(/£\\d*.\\d*/)\n\t\n\t#get durations\n\tduration_string = xml.css('.dur').inner_html\n\tduration_string.gsub!(/\\s+/, \"\")\n\tduration_string.gsub!(/<abbrtitle=\"hours\">h<\\/abbr>/, \":\")\n\tduration_string.gsub!(/<abbrtitle=\"minutes\">m<\\/abbr>/, \",\")\n\tduration_string.gsub!(/^.*>/, \"\")\n\tduration_string = duration_string.split(',')\n\tdurations = Array.new\n\tduration_string.each do |d|\n\t\thours = d[0, d.index(':')]\n\t\tmins = d[d.index(':')+1, d.length]\n\t\tif mins[0,1] == \"0\"\n\t\t\tmins = mins[1,1]\n\t\tend\n\t\tdurations.push(Integer(hours)*60 + Integer(mins))\n\tend\n\tresults = Array.new\n\t\tprices.count().times do |count|\n\t\t \tpair = [prices[count][1,prices[count].length], durations[count]] #rather messy way of taking out the £ at the last minute!\n\t\t\tresults.push(pair)\n\t\tend\n\treturn results, url\nend",
"def stations\n @stations ||= (exact_match? ? parse_station : parse_stations)\n end",
"def index\n search = TripSearch.new(search_params)\n trips = Trip.apply_scopes(\n search.start_location,\n search.driver_name,\n search.rider_name\n )\n\n render json: trips\n end",
"def number_of_fights\n BoxingSchedules::Fight.all\n end",
"def index\n return render json: {message: 'Public users cannot list tours'}, status: 403 if current_user.public?\n @tours = TourServices::TourFilterApi.new(user: current_user,\n status: params[:status],\n type: params[:type],\n vehicle_type: params[:vehicle_type],\n latitude: params[:latitude],\n longitude: params[:longitude],\n distance: params[:distance],\n page: params[:page],\n per: per).tours\n render json: @tours, status: 200, each_serializer: ::V1::TourSerializer, scope: {user: current_user}\n end",
"def trips\n RideShare::Trip.find_all_for_rider(@id)\n end",
"def lineN_stations \n puts \"The list of stations for line N: \"\n puts \"[0] - Time Square\"\n puts \"[1] - 34th\"\n puts \"[2] - 28th\"\n puts \"[3] - 23rd\"\n puts \"[4] - Union Square\"\n puts \"[5] - 8th\"\nend",
"def index\n @line_station_2s = LineStation2.all\n end",
"def stats\n # nb of flight last 30days\n @nb_flights_30d = Flight.where('created_at > ?', 30.days.ago).count\n # top 3 longest flights\n @longest_flight = Flight.all.order('length desc').limit(3)\n end",
"def station_times(name, mins)\n ier = IERailGet.new(\"getStationDataByNameXML_withNumMins?StationDesc=#{name}&NumMins=#{mins}\", \"arrayofobjstationdata\", \"objstationdata\")\n \n ier.response.map { |sd| StationData.new(sd) }\n end",
"def number_of_listings(start_datetime, end_datetime, sale_lease, type)\n filter = filter_listings(start_datetime, end_datetime, sale_lease, type)\n filter.count\n end",
"def slots_based_on_type(staff:, type:, date:)\n case type\n when :central_office\n 11\n when :video\n staff.stc4\n when :travel\n (date.monday? || date.friday?) ? staff.stc2 : staff.stc3\n end\n end",
"def slots_based_on_type(staff:, type:, date:)\n case type\n when :central_office\n 11\n when :video\n staff.stc4\n when :travel\n (date.monday? || date.friday?) ? staff.stc2 : staff.stc3\n end\n end",
"def get_upstream_stations(origin_station)\n\t\t\n\t\tstarting_station = Bartstation.where(\"short_name = '#{origin_station}'\").pluck(\"id\")[0]\n\t\t\n\t\t# Find all the instances of the starting station\n\t\t# The station may appear on multiple routes\n\t\t\n\t\tstation_routes = {}\n\t\t\n\t\tBartroutestation.where(\"bartstation_id = #{starting_station}\").each do |routestation|\n\t\t\t\tstation_routes[routestation.bartroute_id] = routestation.route_station_sequence\n\t\tend\n\n\t\t# For each route that has the starting station:\n\t\t# Find the starting station \n\t\t# Find the next 5 stations in the reverse direction\n\t\t# (The stations are sequenced in the database to increment from the east \n\t\t# bay direction)\n\n\t\tupstream_stations = {}\n\t\tstation_routes.each do |station_route,station_sequence|\n\t\t\tbartroute_id = station_route\n\t\t\tbartstation_sequence = station_sequence\t\t\t\n\t\t\tupstream_stations[bartroute_id] = \n\t\t\t\tBartroutestation.where(\"bartroute_id = #{bartroute_id} AND \n\t\t\t\t\troute_station_sequence >= #{bartstation_sequence}\").order('route_station_sequence').take(6)\n\t\tend\n\n\t\t# Return the list of upstream stations for each route from the origin station\n\n\t\treturn upstream_stations\n\n\tend",
"def print_stations_en_route\n\n start_station_sym = @start_station.gsub(\" \", \"_\").to_sym\n\n end_station_sym = @end_station.gsub(\" \", \"_\").to_sym\n\n start_line_sym = @start_line.to_sym\n\n end_line_sym = @end_line.to_sym\n \n if start_line_sym == :victoria\n start_line_sym_index = 0\n elsif start_line_sym == :bakerloo\n start_line_sym_index = 0\n elsif start_line_sym == :central\n start_line_sym_index = 0\n end\n\n stations_on_start_line = Tube.new.lines.values_at(start_line_sym)\n stations_on_end_line = Tube.new.lines.values_at(end_line_sym)\n \n stations_start = stations_on_start_line[start_line_sym_index]\n\n start_index = stations_start.find_index(start_station_sym) \n\n if start_line_sym != end_line_sym\n\n intersection = (stations_on_start_line[0] & stations_on_end_line[0])[0] \n\n start_int_index = stations_on_start_line[0].index(intersection)\n stops_between = (start_index.to_i - start_int_index.to_i).abs \n\n end_index = stations_on_end_line[0].find_index(end_station_sym)\n\n end_int_index = stations_on_end_line[0].index(intersection)\n between = (end_index.to_i - end_int_index.to_i).abs\n\n stations_on_first = stations_on_start_line[0][start_index, (start_int_index - 1)]\n stations_on_second = stations_on_end_line[0][end_int_index, (end_index + 1)]\n\n number_of_stops = (end_index - start_index).abs\n\n puts \"\\nThere are #{number_of_stops} stations till your final destination\"\n\n stations_en_route = stations_on_first + stations_on_second\n \n print_stations_en_route = stations_en_route.join(\", \").gsub(\"_\", \" \").split.map(&:capitalize).join(\" \")\n\n puts \"\\nThe stations en route are #{print_stations_en_route}\"\n\n else\n\n end_index = stations_start.find_index(end_station_sym)\n\n number_of_stops = ((end_index.to_i - start_index.to_i).abs + 1)\n\n puts \"\\nThere are #{number_of_stops} stations till your final destination\"\n #Use indexes to print stations between and including\n #\n stations_en_route = stations_start.slice(start_index..end_index)\n #Generate list and make print print ready\n #\n print_stations_en_route = stations_en_route.join(\", \").gsub(\"_\", \" \").split.map(&:capitalize).join(\" \")\n\n puts \"\\nThe stations en route are #{print_stations_en_route}\"\n\n end\n end",
"def lineL_stations \n puts \"The list of stations for line L: \"\n puts \"[0] - 8th\"\n puts \"[1] - 6th\"\n puts \"[2] - Union Square\"\n puts \"[3] - 3rd\"\n puts \"[4] - 1st\"\nend",
"def tfl_journey_planner\n Tube.display_lines\n get_start_line\n Station.list_all_stations(@start_line)\n get_start_station\n Tube.display_lines\n get_end_line\n get_end_station\n print_stations_en_route\n end",
"def show\n update_datetime_of_query\n @date_in_question = datetime_of_query.to_date\n\n beginning = datetime_of_query.beginning_of_day\n\n @station = Station.find(params[:id])\n @clockwise_travels = @station.departures.includes(:train).\n where(:depart_at => beginning...beginning+1).\n where('trains.clockwise' => true).order('depart_at')\n\n @counterclockwise_travels = @station.departures.includes(:train).\n where(:depart_at => beginning...beginning+1).\n where('trains.clockwise' => false).order('depart_at')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @station }\n end\n end",
"def slots_based_on_type(staff:, type:, date:)\n case type\n when HearingDay::REQUEST_TYPES[:central]\n 11\n when HearingDay::REQUEST_TYPES[:video]\n staff.stc4\n when HearingDay::REQUEST_TYPES[:travel]\n (date.monday? || date.friday?) ? staff.stc2 : staff.stc3\n end\n end",
"def routes_list\n Route.all.each.with_index(1) do |(route), index|\n puts \"#{index}. Маршрут: #{route.stations.first.name} - #{route.stations.last.name}\"\n end\n end",
"def index\n @railway_stations = RailwayStation.all\n end",
"def singleTrip (start_station, end_station, line)\n start_index = MTA[line].index(start_station)\n end_index = MTA[line].index(end_station)\n\n if start_index < end_index\n stops = MTA[line][start_index ... end_index]\n num_stops = end_index - start_index\n end\n\n if end_index < start_index\n stops = MTA[line][end_index ... start_index]\n stops = stops.reverse\n num_stops = start_index - end_index\n\n end\n print = \"You must travel through the following stops on the #{line}: #{stops}\"\n # print = \"#{num_stops} in total\"\nend",
"def get_stationList(uPos)\n stationList = []\n for n in @@networks\n resp = Net::HTTP.get_response(URI.parse(n)).body\n result = JSON.parse(resp)['network']['stations']\n (stationList << result).flatten!\n end\n stationList.sort! {|s1, s2| dist_user(s1, uPos) <=> dist_user(s2, uPos)}\n end",
"def largest_train\n trains.map { |train| train.type.major_station_allowance }.max\n end",
"def index\n @station_infos = StationInfo.all\n end"
] |
[
"0.68424284",
"0.6778056",
"0.6342554",
"0.6283103",
"0.6283103",
"0.62027794",
"0.6158821",
"0.61308414",
"0.59996545",
"0.5978338",
"0.5971476",
"0.59548247",
"0.5944395",
"0.591398",
"0.58937263",
"0.5870441",
"0.58124983",
"0.5801478",
"0.5786857",
"0.5760002",
"0.5750971",
"0.5747692",
"0.57265687",
"0.57003117",
"0.56917256",
"0.56792486",
"0.5661449",
"0.56508076",
"0.56349796",
"0.55864954",
"0.5579354",
"0.5578126",
"0.55741596",
"0.5531185",
"0.5521429",
"0.551925",
"0.55180925",
"0.54901135",
"0.54750174",
"0.5472274",
"0.5457758",
"0.54509234",
"0.5426369",
"0.5421166",
"0.54177296",
"0.5417449",
"0.54141253",
"0.5399922",
"0.53973067",
"0.53938586",
"0.5390393",
"0.53817606",
"0.53701824",
"0.5354411",
"0.5337434",
"0.53336",
"0.5319231",
"0.5315898",
"0.53119844",
"0.53099716",
"0.5295639",
"0.52940756",
"0.5293912",
"0.5290199",
"0.52879006",
"0.52839595",
"0.52824366",
"0.52808666",
"0.52797127",
"0.52706844",
"0.5268596",
"0.5263379",
"0.5262847",
"0.5261655",
"0.5260419",
"0.52561677",
"0.52561665",
"0.5251323",
"0.5236813",
"0.5236022",
"0.5230032",
"0.52273124",
"0.5223028",
"0.5222852",
"0.5222494",
"0.5209404",
"0.5209298",
"0.5209298",
"0.5204729",
"0.51937425",
"0.5188631",
"0.5185612",
"0.51840794",
"0.51645064",
"0.51599425",
"0.5149952",
"0.51461107",
"0.5138533",
"0.5132153",
"0.512324"
] |
0.66560495
|
2
|
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.system_mailer.info.subject
|
def provide_course(user, host, course )
@host = host
@course = course
@user = user
@subject = I18n.t('mailer.subject.provide_course')
mail to: user.email, subject: @subject do |format|
format.html
format.text
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def message_subject=(value)\n @message_subject = value\n end",
"def subject (recipient)\n subject_variables = alert_variables[:subject].dup\n subject_variables.merge!(recipient_details(recipient))\n subject = \"#{I18n.t(\"#{recipient_type.to_s}_subject_#{alert_name.to_s}\", subject_variables)}\"\n subject\n end",
"def subject\n @subject ||= Envelope::MessageTools.normalize(message.subject || '')\n end",
"def subject\n self['subject'] || msg['subject']\n end",
"def subject\n @mail.subject\n end",
"def translate(mapping, key)\n I18n.t(:\"#{mapping.name}_subject\", :scope => [:devise, :mailer, key],\n :default => [:subject, key.to_s.humanize])\n end",
"def formatted_subject(text)\n name = PersonMailer.global_prefs.app_name\n label = name.blank? ? \"\" : \"[#{name}] \"\n \"#{label}#{text}\"\n end",
"def subject=(subject); @message_impl.setSubject subject; end",
"def subject() self.headers[\"Subject\"] || \"[NO SUBJECT]\" end",
"def subject\n @subject ||= \"(sans sujet)\"\n if @no_header_subject.nil?\n \"#{header_subject}#{@subject}\"\n else\n @subject\n end\n end",
"def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end",
"def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end",
"def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end",
"def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end",
"def subject=(string)\n set('Subject', string)\n end",
"def translate(mapping, key)\n I18n.t(:\"notifications_subject\", :scope => [:eventifier, :notifications, key],\n :default => [:subject, key.to_s.humanize])\n end",
"def subject_for(template, attributes = {})\n subject = EmailTemplate.subject_for(template)\n subject = I18n.t(\"email_templates.#{template}.default_subject\") if subject.nil?\n subject = \"No Subject\" if subject.nil?\n Florrick.convert(subject, add_default_attributes(attributes))\n end",
"def message_subject\n return @message_subject\n end",
"def subject_name=(value)\n @subject_name = value\n end",
"def subject\n self['subject']\n end",
"def subject_name\n return @subject_name\n end",
"def subject\n message.subject\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def setSubject(subject)\n @fields['subject'] = subject\n self\n end",
"def setSubject(subject)\n @fields['subject'] = subject\n self\n end",
"def setSubject(subject)\n @fields['subject'] = subject\n self\n end",
"def setSubject(subject)\n @fields['subject'] = subject\n self\n end",
"def subject=(value)\n @subject = value\n end",
"def subject=(value)\n @subject = value\n end",
"def subject=(value)\n @subject = value\n end",
"def subject=(value)\n @subject = value\n end",
"def subject=(value)\n @subject = value\n end",
"def subject=(value)\n @subject = value\n end",
"def subject; @message_impl.getSubject; end",
"def get_email_subject(email_type)\n email_subject = email_type\n case(email_type)\n when \"welcome\"\n email_subject = \"Welcome to Aspera Files\"\n when \"reset\"\n email_subject = \"Password Reset\"\n end\n return email_subject\n end",
"def email_subject\n sponsor_name = @config.plan.sponsor_name\n display_date = @date.to_s()\n if @config.div_id.present?\n email_subject = \"Payroll report for #{sponsor_name} for division #{@config.division_name}: #{display_date}\"\n else\n email_subject = \"Payroll report for #{sponsor_name}: #{display_date}\"\n end\n return email_subject\n end",
"def subject_name\n subject_full_name\n end",
"def subject\n @options.fetch(:subject) { \"Invitation\" }\n end",
"def set_subject(subject)\n\t\tend",
"def getEmailDefaults(subject, toEmail, ccEmail = nil)\n if Rails.env.eql? 'development'\n subject = \"[BASL-DEV] #{subject}\"\n toEmail = 'paigepon@gmail.com'\n ccEmail = toEmail\n else\n subject = \"[BASL] #{subject}\"\n end\n mailInfo = {\n :to => toEmail,\n :subject => subject,\n :cc => ccEmail\n }\n mailInfo\n end",
"def email_subject(form)\n \"#{form.type_of_enquiry} - #{reference}\"\n end",
"def get_subject_name\n subject_name = subject_header.text.sub! 'Subject:', ''\n subject_name = subject_name.strip!\n subject_name\n end",
"def choose_subject(action, params = {})\n scope = [:mailers, mailer_name, action]\n key = :subject\n experiment_name = \"#{mailer_name}_mailer_#{action}_subject\".to_sym\n if experiment_active?(experiment_name)\n scope << key\n key = ab_test(experiment_name)\n end\n params.merge!(scope: scope)\n I18n.t(key, params)\n end",
"def subject\n @subject=EzCrypto::Name.new(@cert.subject) unless @subject\n @subject\n end",
"def SetSubject(subject)\n\t\t#Subject of document\n\t\t@subject = subject\n\tend",
"def deliver_invitation(options = {})\n super(options.merge(subject: _('A Data Management Plan in %{application_name} has been shared with you') % {application_name: Rails.configuration.branding[:application][:name]}))\n end",
"def email_subject(&blk)\n @email_subject_block = blk if blk\n @email_subject_block\n end",
"def get_subject\n\t\tend",
"def subject\n title \n end",
"def subject_alternative_name\n extensions[R509::Cert::Extensions::SubjectAlternativeName]\n end",
"def subject_titles\n @subject_titles ||= sw_subject_titles\n end",
"def data_subject=(value)\n @data_subject = value\n end",
"def headers\n {\n subject: I18n.t('contact.subject'),\n to: info_email,\n from: \"Deskspotting <#{info_email}>\"\n }\n end",
"def subject(options = {})\n options = { :capitalize => true, :case => Grammar::Case::SUBJECT }.merge(options)\n pronoun_or_noun(@subject, @audience, options)\n end",
"def set_subject_and_message(form, subject, message)\n raise Impostor::MissingTemplateMethodError.new(\"set_subject_and_message must be implemented\")\n end",
"def headers\n { subject: \"#{I18n.t('cms.contact_form.subject_prefix')}: #{reason}: #{subject}\",\n to: Account.current.preferred_support_email,\n from: Account.current.preferred_support_email,\n reply_to: %(\"#{name}\" <#{email}>) }\n end",
"def custom_mail( user, subject, title, contents )\n @user = user\n @host = GogglesCore::AppConstants::WEB_MAIN_DOMAIN_NAME\n @contents = contents\n @title = title\n #subject: \"[#{ GogglesCore::AppConstants::WEB_APP_NAME }@#{ @host }] #{ subject }\",\n mail(\n subject: \"#{ subject } [#{GogglesCore::AppConstants::WEB_APP_NAME}]\",\n to: user.email,\n date: Time.now\n )\n end",
"def set_title\n @title = t(:message_2, :scope => [:controller, :exams])\n end",
"def headers\n {\n :subject => \"Contact Form:#{subject}\",\n :to => Sufia::Engine.config.contact_email, \n :from => Sufia::Engine.config.from_email\n }\n end",
"def headers\n {\n :subject => %(#{subject}),\n :to => Contact.first.email,\n :body => %(#{message}),\n :from => %(\"#{email}\")\n }\n end",
"def subject_names\n @subject_names ||= sw_subject_names\n end",
"def headers\n { subject: \"#{site_name} contact form\", to: site_email, from: email }\n end",
"def normalize_subject_name\n self.subject = subject.downcase.titleize\n end",
"def headers\n {\n :subject => \"#{subject}\",\n :to => \"tempress@temple.edu\",\n :from => %(\"#{name}\" <#{email}>)\n }\n end",
"def email_us(subject, body)\n unless ENV['RACK_ENV'] == 'development'\n recipient = \"The Awesome Team <openhsv@gmail.com>\"\n\n # First, instantiate the Mailgun Client with your API key\n mg_client = Mailgun::Client.new ENV['MAILGUN_PRIVATE']\n\n # Define your message parameters\n message_params = { from: 'postmaster@sandboxa148f93a5c5f4813a81365d1b873ee8f.mailgun.org',\n to: recipient,\n subject: subject,\n html: body,\n text: Nokogiri::HTML(body).text\n }\n\n # Send your message through the client\n mg_client.send_message 'sandboxa148f93a5c5f4813a81365d1b873ee8f.mailgun.org', message_params\n end # unless ENV['RACK_ENV'] == 'development'\n end",
"def headers\n {\n :subject => %(<#{subject}>),\n\t\t\t:to => %(#{to}),\n :from => \"info@dreamyourweb.nl\"\n }\n end",
"def ezm_subject_and_status(message)\r\n if message.receiver_deleted?\r\n message.subject + \" (Deleted)\" \r\n elsif message.read_at.nil?\r\n message.subject + \" (Unread)\" \r\n else \r\n message.subject\r\n end\r\n end",
"def title\r\n fail \"There are no messages yet\" if self.messages.size == 0\r\n\r\n @messages[0].subject.size == 0 ? \"No title\" : @messages[0].subject\r\n end",
"def compose_email\n @title = t 'conclusion_draft_review.send_by_email'\n end",
"def subject\n @subject\n end",
"def subject\n map_field(:subject)&.map { |a| a.gsub(/ \\$[a-z] /, '--') }\n end",
"def subject(*extra)\n subject = \"\"\n subject << \"#{@project.name} | \" if @project\n subject << extra.join(' | ') if extra.present?\n subject\n end",
"def translation_scope\n \"mailers.#{mailer_name.tr(\"/\", \".\").sub(\"_mailer\", \"\")}.#{action_name}\"\n end",
"def default_sender_address\n address = Mail::Address.new(Gitlab.config.gitlab.email_from)\n address.display_name = \"GitLab\"\n address\n end",
"def subject(*args)\n subject = \"#{Settings['application']['name']} | \"\n subject << args.join(' ') if args.present?\n subject\n end",
"def mmm_test_subj_call\n ->(candidate) { I18n.t('email.test_monthly_mail_subject_initial_input', candidate_account_name: candidate.account_name) }\n end",
"def konsalt_mail params\n build_params params\n send_email t('emails.konsalta_mail.subject')\n end",
"def setup_email(user)\n @recipients = user.email\n @body[:user] = user\n @from = FROM_EMAIL\n @subject = case ENV['RAILS_ENV'] \n when 'development': \"[YourApp Development] \"\n when 'staging': \"[YourApp Staging] \"\n else \"[YourApp] \"\n end\n @sent_on = Time.now\n headers \"Reply-to\" => FROM_EMAIL\n end",
"def subject\n @subject\n end",
"def subject\n @subject\n end",
"def default_i18n_subject(interpolations = {})\n ''\n end",
"def headers\n {\n :subject => \"澄清:對於#{candidate_name}的#{record_type}\",\n # :to => \"wevote@watchout.tw\",\n :to => Setting.email.clarify,\n :from => %(\"#{name}\" <#{email}>)\n }\n end",
"def subject\n subject = self.read_attribute(:subject)\n begin\n Rfc2047.decode subject if subject\n rescue Rfc2047::Unparseable\n return subject\n end\n end",
"def headers\r\n {\r\n :subject => \"izmedi.ru - письмо с сайта\",\r\n :to => \"hs88@mail.ru\",\r\n :from => %(\"Измеди.ру\" <@info@izmedi.ru>)\r\n }\r\n end",
"def headers\n {\n subject: \"[#{Setting.site_name}] Neue Quelle eingesendet\",\n to: Setting.email,\n reply_to: email,\n from: Setting.get('from'),\n }\n end",
"def subject\n return @subject\n end",
"def subject\n return @subject\n end",
"def subject\n return @subject\n end",
"def subject\n return @subject\n end",
"def subject\n return @subject\n end",
"def subject\n return @subject\n end",
"def set_subject\n @subject = Subject.friendly.find(params[:id])\n end",
"def header(to, from, subject)\n @mail[:to] = to\n @mail[:from] = from\n @mail[:subject] = subject\n end",
"def welcome_email(resource)\n \n @resource = resource\n\n mail :to => @resource.email, :from => \"email@domain.com\", :subject => \"Subject line\"\n \n end"
] |
[
"0.7526513",
"0.7352996",
"0.72834325",
"0.72603995",
"0.7136496",
"0.70399773",
"0.6931514",
"0.68924624",
"0.6881371",
"0.6786234",
"0.67808723",
"0.6779901",
"0.6758667",
"0.67564535",
"0.6742295",
"0.6664095",
"0.6662977",
"0.66543335",
"0.66125125",
"0.65540534",
"0.6506302",
"0.64819235",
"0.6470586",
"0.6470586",
"0.6470586",
"0.6470586",
"0.6470586",
"0.6470586",
"0.6470586",
"0.6470586",
"0.646005",
"0.646005",
"0.646005",
"0.646005",
"0.64533705",
"0.64533705",
"0.64533705",
"0.64533705",
"0.64533705",
"0.64533705",
"0.64453685",
"0.6340008",
"0.63030916",
"0.6279584",
"0.625615",
"0.62096375",
"0.6204873",
"0.6158915",
"0.61535543",
"0.6133583",
"0.61213535",
"0.61020154",
"0.6096942",
"0.6056879",
"0.6037584",
"0.59993035",
"0.593029",
"0.5919625",
"0.58854175",
"0.5841777",
"0.5840564",
"0.58364207",
"0.58089936",
"0.5798387",
"0.57974875",
"0.5747887",
"0.5745808",
"0.5737568",
"0.5719519",
"0.5707028",
"0.56988895",
"0.5689714",
"0.568699",
"0.5686215",
"0.5680267",
"0.56770045",
"0.56678784",
"0.566082",
"0.56473523",
"0.56470436",
"0.5640619",
"0.56329924",
"0.5630745",
"0.5628968",
"0.5623628",
"0.56162375",
"0.56162375",
"0.5613102",
"0.55892825",
"0.5567723",
"0.5549525",
"0.55484724",
"0.5543311",
"0.5543311",
"0.5543311",
"0.5543311",
"0.5543311",
"0.5543311",
"0.5542841",
"0.5541307",
"0.55384094"
] |
0.0
|
-1
|
Opens google analytics for given date range
|
def analytics_day(start_date=nil, end_date=nil)
start_date = start_date ? Date.parse("#{start_date}/2010") : Date.today
start_date = start_date.strftime("%Y%m%d")
end_date ||= start_date
"https://www.google.com/analytics/reporting/?reset=1&id=14680769&pdr=#{start_date}-#{end_date}"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_data(startdate, enddate)\n\t\t\n\t\tdate_range = @analytics::DateRange.new(start_date: startdate, end_date: enddate)\n\t\torder_by = @analytics::OrderBy.new(field_name: 'ga:pageviews', sort_order: 'DESCENDING')\n\t\t# metric = @analytics::Metric.new(expression: 'ga:sessions')\n\t\t# metric = @analytics::Metric.new(expression: ['ga:sessions', 'ga:uniquePageviews'])\n\t\t# metric = @analytics::Metric.new\n\t\t# metric.expression = ['ga:sessions', 'ga:uniquePageviews']\n\t\t\n\t\tmetrics = ['ga:pageviews', 'ga:users', 'ga:bounces', 'ga:sessions',\n\t\t\t\t 'ga:avgTimeOnPage', 'ga:newUsers', 'ga:goal1ConversionRate', 'ga:goal1Completions'\n\t\t\t\t ]\n\n\t\t# metrics = ['ga:totalEvents'\n\t\t# \t\t ]\t\t \n\n\n\t\tmetric_type = Array.new\n\t\tmetrics.each do |m|\n\t\t\tmetric = @analytics::Metric.new\n\t\t\tmetric.expression = m\n\t\t\tmetric_type.push(metric)\n\t\tend\n\n\t\tdimensions = ['ga:pagePath', 'ga:pageTitle', 'ga:hostname' ]\n\t\t# dimensions = ['ga:pagePath', 'ga:eventCategory']\n\t\tdimension_type = Array.new\n\t\tdimensions.each do |d|\n\t\t\tdimension = @analytics::Dimension.new\n\t\t\tdimension.name = d\n\t\t\tdimension_type.push(dimension)\n\t\tend\n\n\n\t\t# dimension = @analytics::Dimension.new(name: 'ga:pagePath')\n\n\t\t# dimension_filters = @analytics::DimensionFilterClause.new(\n\t # filters: [\n\t # @analytics::DimensionFilter.new(\n\t # dimension_name: 'ga:pagePath',\n\t # operator: \"IN_LIST\",\n\t # expressions: ['/archives/69839', '/archives/54087', '/archives/68924', '/archives/58437', '/archives/65171', '/archives/64435', '/archives/61533', '/archives/68924',\n\t # \t\t\t\t'/archives/65086', '/archives/64736', '/archives/55244', '/archives/68211'\n\t # ]\n\t # )\n\t # ]\n\t # )\n\n\t\trequest = @analytics::GetReportsRequest.new(\n \t\t\treport_requests: [@analytics::ReportRequest.new(\n \t\t\tview_id: @view_id, \n \t\t\tmetrics: metric_type, \n \t\t\tdimensions: dimension_type,\n \t\t\t# dimension_filter_clauses: [dimension_filters],\n \t\t\t# dimensions: [dimension], \n \t\t\tdate_ranges: [date_range],\n \t\t\torder_bys: [order_by],\n \t\t\tpageSize: 10000\n \t\t\t)]\n\t\t)\n\t\tresponse = @client.batch_get_reports(request)\n\t\tmessageHash = {}\n\n\t\t# handling error \n\t\tif !response.reports.first.data.rows then\n\t\t\t\n\t\t\tkey = \"message\"\n\t\t\tmessageHash[key.to_sym] = \"no data\"\n\t\t \treturn messageHash\n\t\tend\n\n\n\t\tdata_from_google = response.reports.first.data.rows\n\n\t\tkey_array = dimensions + metrics\n\n\t\t# get rid of 'ga:'\n\t\tkey_array.each_with_index do |k, index| \n\t\t\tkey_array[index] = k.gsub(\"ga:\",\"\")\n\t\tend\n\n\t\tkey_array.push('id')\n\t\tkey_array.push('clickCount')\n\n\t\tset_ga_data_array = Array.new\n\n\n\t\tdata_from_google.each_with_index do |r, index|\n\n\t\t\tdatahash = {}\n\t\t\ti = 0;\n\n\t\t\t# setup dimension part\n\t\t\tr.dimensions.each do |d|\n\t\t\t\tdatahash[key_array[i]] = d\n\t\t\t\ti += 1\n\t\t\tend\n\n\t\t\t# setup metrics part\n\t\t\tr.metrics.first.values.each do |m|\n\t\t\t\tdatahash[key_array[i]] = m\n\t\t\t\ti += 1\n\t\t\tend\n\n\t\t\t\n\t\t\t# get aticle data from db\n\t\t\tarticleArr = set_article_data(datahash['hostname'], datahash['pagePath'], startdate, enddate)\n\n\t\t\t# setup id, mcv\n\t\t\tarticleArr.each do |a|\n\t\t\t\tdatahash[key_array[i]] = a\n\t\t\t\ti += 1\n\t\t\tend\n\n\t\t\tset_ga_data_array.push(datahash)\n\n\t\t\t#datahash sample -> { \"pagePath\": \"/archives/69839\", ... , \"goal1Completions\": \"23\", \"id\": 4, \"clickCount\": 0 },\n\t\tend\n\t\t\n\t\treturn set_ga_data_array\n\tend",
"def campaigns_daily_report show_id, date_range, format\n \n params = {\n :show_id => show_id,\n :date_range => date_range,\n :format => format\n }\n \n response = connection.do_get(construct_url(\"analytics\", \"request_campaigns_daily_report\"), params)\n \n # Convert to a hash\n return parse_token_response(response)\n end",
"def report_range(start_date, end_date)\n @start_date = start_date\n @end_date = end_date\n end",
"def send_request_to_google_analytics(utm_url)\n options = {\n \"method\" => \"GET\",\n \"user_agent\" => ENV[\"HTTP_USER_AGENT\"],\n \"header\" => \"Accepts-Language: #{ENV[\"HTTP_ACCEPT_LANGUAGE\"]}\"\n }\n if $cgi[\"utmdebug\"] == \"\"\n OpenURI::open_uri(utm_url, options)\n else\n OpenURI::open_uri(utm_url, options) {|f| warn f.read }\n end\nend",
"def track!(*args)\n begin\n opts = args.extract_options!\n data = { v: 1, tid: Setting.google_analytics, cid: opts[:session] || SecureRandom.uuid[0,32], t: :pageview, dp: \"/#{self.code}\", dh: \"mycolor.today\", dt: self.title }\n data[:dr] = opts[:referrer] if opts[:referrer].present?\n data[:uid] = opts[:user] if opts[:user].present?\n resp = RestClient.post( 'http://www.google-analytics.com/collect', data )\n rescue\n nil\n end\n end",
"def get_campaign_analytics_with_http_info(application_id, campaign_id, range_start, range_end, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementApi.get_campaign_analytics ...'\n end\n # verify the required parameter 'application_id' is set\n if @api_client.config.client_side_validation && application_id.nil?\n fail ArgumentError, \"Missing the required parameter 'application_id' when calling ManagementApi.get_campaign_analytics\"\n end\n # verify the required parameter 'campaign_id' is set\n if @api_client.config.client_side_validation && campaign_id.nil?\n fail ArgumentError, \"Missing the required parameter 'campaign_id' when calling ManagementApi.get_campaign_analytics\"\n end\n # verify the required parameter 'range_start' is set\n if @api_client.config.client_side_validation && range_start.nil?\n fail ArgumentError, \"Missing the required parameter 'range_start' when calling ManagementApi.get_campaign_analytics\"\n end\n # verify the required parameter 'range_end' is set\n if @api_client.config.client_side_validation && range_end.nil?\n fail ArgumentError, \"Missing the required parameter 'range_end' when calling ManagementApi.get_campaign_analytics\"\n end\n allowable_values = [\"1 hour\", \"1 day\", \"1 week\", \"1 month\", \"1 year\"]\n if @api_client.config.client_side_validation && opts[:'granularity'] && !allowable_values.include?(opts[:'granularity'])\n fail ArgumentError, \"invalid value for \\\"granularity\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/v1/applications/{applicationId}/campaigns/{campaignId}/analytics'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s)).sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'rangeStart'] = range_start\n query_params[:'rangeEnd'] = range_end\n query_params[:'granularity'] = opts[:'granularity'] if !opts[:'granularity'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'InlineResponse20020' \n\n # auth_names\n auth_names = opts[:auth_names] || ['management_key', 'manager_auth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementApi#get_campaign_analytics\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def set_api_by_date(startdate, enddate, hostname)\n\n\t\t# setup date range\n\t\tdate_range = @analytics::DateRange.new(start_date: startdate, end_date: enddate)\n\n\t\t# set metircs data. 10 metrices are allowed per one request\n\t\tmetrics = ['ga:pageviews', 'ga:users', 'ga:bounces', 'ga:sessions',\n\t\t\t\t 'ga:avgTimeOnPage', 'ga:newUsers', 'ga:goal1ConversionRate', 'ga:goal1Completions'\n\t\t\t\t ]\n\n\t\t# make new array and put metric type data in the array\n\t\tmetric_type = Array.new\n\t\tmetrics.each do |m|\n\t\t\tmetric = @analytics::Metric.new\n\t\t\tmetric.expression = m\n\t\t\tmetric_type.push(metric)\n\t\tend\n\n\t\t\n\t\t# if startdate == enddate then\n\t\t# \tdimension = @analytics::Dimension.new(name: 'ga:hour')\n\t\t# \torder_by = @analytics::OrderBy.new(field_name: 'ga:hour', sort_order: 'ASCENDING')\n\t\t# else\n\t\t# \tdimension = @analytics::Dimension.new(name: 'ga:date')\n\t\t# \torder_by = @analytics::OrderBy.new(field_name: 'ga:date', sort_order: 'ASCENDING')\n\t\t# end\n\n\n\t \t# set dimensions, dimension_filters by hostname. if hostname is total, then set only hour or date in dimension\n\n\t \tif hostname == 'total'\n\t\t\tif startdate == enddate then\n\t\t\t\tdimensions = ['ga:hour']\n\t\t\telse\n\t\t\t\tdimensions = ['ga:date']\n\t\t\tend\t \t\t\n\t \telse\n\t \t\tif startdate == enddate then\n\t\t\t\tdimensions = ['ga:hour', 'ga:hostname']\n\t\t\telse\n\t\t\t\tdimensions = ['ga:date', 'ga:hostname']\n\t\t\tend\t\n\t \t\tdimension_filters = @analytics::DimensionFilterClause.new(\n\t\t filters: [\n\t\t @analytics::DimensionFilter.new(\n\t\t dimension_name: 'ga:hostname',\n\t\t not: false,\n\t\t operator: \"IN_LIST\",\n\t\t expressions: [hostname]\n\t\t )\n\t\t ]\n\t\t )\n\t \tend\n\n\t \tdimension_type = Array.new\n\t\tdimensions.each do |d|\n\t\t\tdimension = @analytics::Dimension.new\n\t\t\tdimension.name = d\n\t\t\tdimension_type.push(dimension)\n\t\tend\t\t\t\n\n\t\t#set order_bys\n\t\torder_by = @analytics::OrderBy.new(field_name: dimensions[0], sort_order: 'ASCENDING')\n\n\n\t\t# setup request with the data i set up above to google analytics server\n\t\trequest = @analytics::GetReportsRequest.new(\n \t\t\treport_requests: [@analytics::ReportRequest.new(\n \t\t\tview_id: @view_id, \n \t\t\tmetrics: metric_type,\n \t\t\tdimensions: dimension_type,\n \t\t\tdimension_filter_clauses: [dimension_filters],\n \t\t\tdate_ranges: [date_range],\n \t\t\torder_bys: [order_by]\n \t\t\t)]\n\t\t)\n\n\t\t# send request and get the result in the response\n\t\tresponse = @client.batch_get_reports(request)\n\n\t\t# make new array for the total data. it will has datahash and dropdwnhash, datahash is for total data and\n\t\t# the other is for hourly/daily data. key would be time(00,01,02,...) or date(i.e. 5/20.5/21,...). \n\t\tset_total_array = Array.new\n\n\t\t# this data is mcv and it is from database\n\t\ttotal_clicks_count = set_total_article(startdate, enddate)\n\n\n\t\t# getting total data part start\n\n\t\ttotal_data = response.reports.first.data.totals\n\t\tkey_array = metrics\n\t\t# get rid of 'ga:'\n\t\tkey_array.each_with_index do |k, index| \n\t\t\tkey_array[index] = k.gsub(\"ga:\",\"\")\n\t\tend\n\n\t\ttotal_data.each do |t|\n\t\t\tdatahash = {}\n\n\t\t\tt.values.each_with_index do |v, index|\n\t\t\t\tdatahash[key_array[index]] = v\t\n\t\t\tend\n\t\t\tdatahash['mcv'] = total_clicks_count\n\t\t\tset_total_array.push(datahash)\n\t\tend\n\t\t# datahash sample -> { \"pageviews\": \"11\", \"users\": \"22\", \"bounces\": \"33\", ... , \"mcv\": 0 }\n\n\t\t# getting total data part end\n\n\t\t# getting daily or hourly data part start\n\t\tdropdwnhash = {}\n\n\t\tdata_from_google = response.reports.first.data.rows\n\t\t\n\t\tdata_from_google.each do |r|\n\t\t\tvhash = {}\n\t\t\t# key would be hour or date\n\t\t\tkey = r.dimensions.first\n\n\t\t\t# vhash is the data such as pageview, users and so on for specific time or date\n\t\t\tr.metrics.first.values.each_with_index do |v, index|\n\t\t\t\tvhash[key_array[index]] = v\n\t\t\tend\n\n\t\t\tif startdate == enddate\n\t\t\t\tkey = key + \":00\"\n\t\t\tend\n\t\t\t\n\t\t\tdropdwnhash[key.to_sym] = vhash\n\t\tend\n\n\t\t# dropdwnhash sample (hour) -> \"00:00\": { \"pageviews\": \"534\", \"users\": \"478\", \"bounces\": \"432\", ... }, \"01:00\": { ... }\n\t\t# dropdwnhash sample (date) -> \"20200608\": { \"pageviews\": \"534\", \"users\": \"478\", \"bounces\": \"432\", ... }, \"20200609\": { ... }\n\n\t\tset_total_array.push(dropdwnhash)\n\n\t\t# getting daily or hourly data part end\n\n\t\treturn set_total_array\n\tend",
"def query(options={})\n from = parse_date(options[:from]).strftime('%Y-%m-%d')\n to = parse_date(options[:to]).strftime('%Y-%m-%d')\n\n response = Client.instance.request(:data,\n 'start-date' => from,\n 'end-date' => to,\n 'ids' => \"ga:#{@profile_id}\",\n 'metrics' => @metrics.join(','),\n 'dimensions' => @dimensions.join(','))\n \n\n headers = column_headers(response['columnHeaders'])\n group(response['rows'], headers)\n end",
"def send_event(params = {})\n RestClient.get(\n 'http://www.google-analytics.com/collect',\n params: params,\n timeout: 4,\n open_timeout: 4\n )\n return true\n rescue RestClient::Exception\n return false\n end",
"def activities_in_date_range(from_date, to_date)\n from_date = format_date from_date\n to_date = format_date to_date\n\n @dealing_platform.gather \"history/activity/#{from_date}/#{to_date}\", :activities, AccountActivity\n end",
"def activity_on_date_range(activity, start, finish)\n get(\"/user/#{@user_id}/activities/#{activity}/date/#{format_date(start)}/#{format_date(finish)}.json\")\n end",
"def default_date_range\n \"#{Hyrax.config.analytics_start_date},#{Time.zone.today}\"\n end",
"def genAnalytics\n %{<script type=\"text/javascript\">\n var gaJsHost = ((\"https:\" == document.location.protocol) ? \"https://ssl.\" : \"http://www.\");\n document.write(unescape(\"%3Cscript src='\" + gaJsHost + \"google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E\"));\n </script>\n <script type=\"text/javascript\">\n try {\n var pageTracker = _gat._getTracker(\"UA-10612400-1\");\n pageTracker._trackPageview();\n } catch(err) {}</script>}\nend",
"def get_ga_data(yesterday, view_id, ga_key)\n\t\t\n\t\tdate_range = @analytics::DateRange.new(start_date: yesterday, end_date: yesterday)\n\t\torder_by = @analytics::OrderBy.new(field_name: 'ga:pageviews', sort_order: 'DESCENDING')\n\t\t\n\t\tmetrics = ['ga:pageviews', 'ga:users', 'ga:newUsers', 'ga:bounces', 'ga:sessions', 'ga:timeOnPage']\n\n\t\tmetric_type = Array.new\n\t\tmetrics.each do |m|\n\t\t\tmetric = @analytics::Metric.new\n\t\t\tmetric.expression = m\n\t\t\tmetric_type.push(metric)\n\t\tend\n\n\t\tdimensions = ['ga:dateHour', 'ga:pagePath']\n\t\tdimension_type = Array.new\n\t\tdimensions.each do |d|\n\t\t\tdimension = @analytics::Dimension.new\n\t\t\tdimension.name = d\n\t\t\tdimension_type.push(dimension)\n\t\tend\n\n\t\trequest = @analytics::GetReportsRequest.new(\n \t\t\treport_requests: [@analytics::ReportRequest.new(\n \t\t\tview_id: view_id, \n \t\t\tmetrics: metric_type,\n \t\t\tdimensions: dimension_type,\n \t\t\t# dimension_filter_clauses: [dimension_filters],\n \t\t\tdate_ranges: [date_range],\n \t\t\torder_bys: [order_by],\n \t\t\tpage_size: 100_000\n \t\t\t)]\n\t\t)\n\t\tresponse = @client.batch_get_reports(request)\n\n\t\t# handling error \n\t\tif !response.reports.first.data.rows then\n\t\t \treturn\n\t\tend\n\n\n\t\tdata_from_google = response.reports.first.data.rows\n\t\t\n\t\t\n\t\tset_ga_data_array = Array.new\n\n\n\t\tdata_from_google.each_with_index do |r, index|\n\n\t\t\t# dimensions = ['ga:dateHour', 'ga:pagePath']\n\t\t\t# metrics = ['ga:pageviews', 'ga:users', 'ga:newUsers', 'ga:bounces', 'ga:sessions', 'ga:avgTimeOnPage']\n\t\t\tdatahash = {}\n\n\t\t\turls_rm_params = r.dimensions[1].split(/\\?/)[0]\n\n\t\t\tarticle = Article.select(:id).find_by(article_url: urls_rm_params)\n\t\t\tnext if !article\n\n\t\t\tarticle_arr = set_ga_data_array.each_with_index.select{|a, index| a['article_id'] == article.id && a['date_hour'] == r.dimensions[0]}\n\n\t\t\tif !article_arr.empty?\n\t\t\t\tarticle_index = article_arr.first[1]\n\t\t\t\tset_ga_data_array[article_index]\n\t\t\t\t\n\t\t\t\tpage_view = set_ga_data_array[article_index]['page_view'].to_i\n\t\t\t\tpage_view_temp = r.metrics.first.values[0].to_i\n\t\t\t\tset_ga_data_array[article_index]['page_view'] = page_view + page_view_temp\n\n\t\t\t\tuser = set_ga_data_array[article_index]['user'].to_i\n\t\t\t\tuser_temp = r.metrics.first.values[1].to_i\n\t\t\t\tset_ga_data_array[article_index]['user'] = user + user_temp\t\t\t\t\n\n\t\t\t\tnew_user = set_ga_data_array[article_index]['new_user'].to_i\n\t\t\t\tnew_user_temp = r.metrics.first.values[2].to_i\n\t\t\t\tset_ga_data_array[article_index]['new_user'] = new_user + new_user_temp\n\n\t\t\t\tbounce = set_ga_data_array[article_index]['bounce'].to_i\n\t\t\t\tbounce_temp = r.metrics.first.values[3].to_i\n\t\t\t\tset_ga_data_array[article_index]['bounce'] = bounce + bounce_temp\n\n\t\t\t\tsession = set_ga_data_array[article_index]['session'].to_i\n\t\t\t\tsession_temp = r.metrics.first.values[4].to_i\n\t\t\t\tset_ga_data_array[article_index]['session'] = session + session_temp\n\n\t\t\t\tavg_time_on_page = set_ga_data_array[article_index]['avg_time_on_page'].to_i\n\t\t\t\tavg_time_on_page_temp = r.metrics.first.values[5].to_i\n\t\t\t\tset_ga_data_array[article_index]['avg_time_on_page'] = avg_time_on_page + avg_time_on_page_temp\n\n\t\t\telse\n\n\t\t\t\tdatahash['article_id'] = article.id\n\n\t\t\t\tdatahash['date_hour'] = r.dimensions[0]\n\n\t\t\t\tpage_view = r.metrics.first.values[0]\n\t\t\t\tdatahash['page_view'] = page_view\n\n\t\t\t\tuser = r.metrics.first.values[1]\n\t\t\t\tdatahash['user'] = user\n\n\t\t\t\tnew_user = r.metrics.first.values[2]\n\t\t\t\tdatahash['new_user'] = new_user\n\n\t\t\t\tbounce = r.metrics.first.values[3]\n\t\t\t\tdatahash['bounce'] = bounce\n\n\t\t\t\tsession = r.metrics.first.values[4]\n\t\t\t\tdatahash['session'] = session\n\n\t\t\t\tavg_time_on_page = r.metrics.first.values[5]\n\t\t\t\tdatahash['avg_time_on_page'] = avg_time_on_page\n\n\t\t\t\tdatahash['created_at'] = Time.zone.now\n\t\t\t\tdatahash['updated_at'] = Time.zone.now\n\n\n\t\t\t\tset_ga_data_array.push(datahash)\n\t\t\tend\n\t\tend\n\n\t\t# avg time on page setup (avt t.o.p in ga doesn't fit to our site so we need to calculate by ourselves)\n\t\t# avg.time on page = time on page / pageviews\n\t\tset_ga_data_array.each do |ga|\n\t\t\ttime_on_page = ga['avg_time_on_page'].to_i\n\t\t\tpv = ga['page_view'].to_i\n\n\t\t\tif time_on_page != 0 && pv != 0\n\t\t\t\tbegin\n\t\t\t\t\tga['avg_time_on_page'] = time_on_page/pv\n\t\t\t\trescue StandardError => e\n\t\t\t\t\tputs e\n\t\t\t\t\tga['avg_time_on_page'] = 0\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\n\t\treturn set_ga_data_array\n\tend",
"def ga_statistics(start_date, object)\n path = polymorphic_path(object)\n profile = Hyrax::Analytics.profile\n unless profile\n Hyrax.logger.error(\"Google Analytics profile has not been established. Unable to fetch statistics.\")\n return []\n end\n profile.hyrax__pageview(sort: 'date',\n start_date: start_date,\n end_date: Date.yesterday,\n limit: 10_000)\n .for_path(path)\n end",
"def episode_daily_report show_id, episode_id, date_range, format\n \n params = {\n :show_id => show_id,\n :date_range => date_range,\n :id => episode_id,\n :format => format\n }\n \n response = connection.do_get(construct_url(\"analytics\", \"request_episode_daily_report\"), params)\n \n # Convert to a hash\n return parse_token_response(response)\n end",
"def set_grid date\n @grid = DailyTrackingsGrid.new(params.fetch(:daily_trackings_grid, {}).merge(has_ads_group: @campaign.has_ads_group?)) do\n @campaign.daily_trackings.where(:date => date).page(params[:page])\n end\n end",
"def google_analytics\n html = ''\n ga_acc = @opts[:code] || @opts[:ga_acc]\n if ga_acc && ga_acc != '/'\n html << %(\n <!-- Google analytics. -->\n<script type=\"text/javascript\">\n (function(i,s,o,g,r,a,m){\n if (typeof(eu_cookies_allowed) === \"function\" && !eu_cookies_allowed() ) return;\n\n i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),\n m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n })(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n\n if (typeof(ga) === \"function\") {\n ga('create', '#{ga_acc}', 'auto');\n ga('send', 'pageview')\n }\n</script>\n)\n end\n\n ga4_acc = @opts[:code4] || @opts[:ga4_acc]\n if ga4_acc && ga4_acc != '/'\n html << %(\n <!-- Global site tag (gtag.js) - Google Analytics -->\n <script async src=\"https://www.googletagmanager.com/gtag/js?id=#{ga4_acc}\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', '#{ga4_acc}');\n</script>)\n end\n\n html.html_safe\nend",
"def get_campaign_analytics(application_id, campaign_id, range_start, range_end, opts = {})\n data, _status_code, _headers = get_campaign_analytics_with_http_info(application_id, campaign_id, range_start, range_end, opts)\n data\n end",
"def getSales_logBy_date( from_date, to_date)\n params = Hash.new\n params['from_date'] = from_date\n params['to_date'] = to_date\n return doCurl(\"get\",\"/sales_log/by_date\",params)\n end",
"def fb_google_analytics(uacct, options={})\n options = options.dup\n tag \"fb:google-analytics\", stringify_vals(options.merge(:uacct => uacct))\n end",
"def download_data_range(entity, start_date, end_date)\n # custom by API, returning a sample result file\n 'output/entity_1_1529588678.csv'\n end",
"def daily_statistics start_on = Date.today, end_on = Date.today, local_time_zone = true\n self.get_statistics('ox.publisherDailyStatistics', start_on, end_on, local_time_zone)\n end",
"def generate_request_url\n # analytics base url\n analytics_url = \"https://api.ibmaspera.com/analytics/v2/organizations/#{ORGANIZATION_ID}/\"\n # resource within analytics application\n analytics_resource = 'transfers'\n # query parameters\n start_time = CGI.escape('2019-01-19T23:00:00Z')\n stop_time = CGI.escape('2019-01-26T23:00:00Z')\n limit = 3\n parameters = \"?start_time=#{start_time}&stop_time=#{stop_time}&limit=#{limit}\"\n # print what the request url will look like\n puts \"\\n\\nanalytics_url: #{analytics_url + analytics_resource + parameters}\"\n analytics_url + analytics_resource + parameters\nend",
"def add_google_info(access_token)\n if self.google_id.blank?\n if self.start_time.present? && self.title.present?\n google_event = Google::Event.search_by_date_range(\n access_token,\n self.start_time,\n (self.start_time + 1.minutes),\n self.google_calendar_id\n )\n if !google_event['error'] && items = google_event['data']['items']\n event = items.select{|item| item['title'] == self.title}.first\n if event\n self.details = event['details']\n self.google_id = event['id']\n end\n end\n end\n end\n end",
"def generate_igive_report(start_date = nil, end_date = nil)\r\n report_lines = []\r\n report_events(start_date, end_date) do |event, review_count|\r\n report_lines.push [event.affiliate_user.affiliate_unique_id, event.event_type, event.created_at.strftime('%D %H:%M'), (review_count == max_events ? 5 : 0)].join(\",\")\r\n end\r\n report_lines.join(\"\\n\")\r\n end",
"def index\n @search_googles = SearchGoogle.all\n \n term_date = Date.parse((Date.today - 5).to_s)\n \n while term_date < (Date.today)\n google_url = \"http://rank.ezme.net/?mode=recmd\" + \"3\" + \"&day=\" + term_date.to_s\n\n google_crawler = SES.new(\"google\", term_date)\n\n google_crawler.Scraper(google_url)\n\n term_date += 1\n end\n end",
"def bulk_delivery_report(fromdate, todate)\n\tconfigure({fromdate: fromdate, todate: todate})\n\tself.class.get(\"/mis.aspx\", @options) \n\tend",
"def daily_statistics start_on = Date.today, end_on = Date.today, local_time_zone = true\n self.get_statistics('ox.bannerDailyStatistics', start_on, end_on, local_time_zone)\n end",
"def new_with_date_range(begin_date, end_date)\n report = new\n report.set_date_range(begin_date, end_date)\n report\n end",
"def get_date_range(project_id, query_id, date_range_id)\n get \"projects/#{project_id}/queries/#{query_id}/date-range/#{date_range_id}\"\n end",
"def between(date_range)\n merge(between: date_range)\n end",
"def between(date_range)\n merge(between: date_range)\n end",
"def sleep_logs_by_date_range(start_date, end_date, options = {})\n path = \"/sleep/date/#{iso_date(start_date)}/#{iso_date(end_date)}\"\n sleep_default_version!(options)\n get_json(path_user_version(path, options))\n end",
"def reports(from_id, start_date = nil, end_date = nil)\n params = []\n\n if from_id\n params << \"from_id=#{from_id}\"\n end\n\n if start_date and not end_date\n raise 'must include both start_date and end_date'\n end\n if end_date and not start_date\n raise 'must include both start_date and end_date'\n end\n\n if start_date and end_date\n params << \"start_date=#{start_date.strftime('%FT%T.%L%z')}\"\n params << \"end_date=#{end_date.strftime('%FT%T.%L%z')}\"\n end\n\n query = \"#{@endpoint}?\"\n\n if params.size > 0\n query << params.join('&')\n end\n\n get query\n end",
"def execute\n uri = URI.parse(\"https://analyticsreporting.googleapis.com/v4/reports:batchGet\")\n https = Net::HTTP.new(uri.host, uri.port)\n https.use_ssl = true\n # https.set_debug_output($stdout)\n request = Net::HTTP::Post.new(uri.request_uri,\n \"Content-Type\" => \"application/json\",\n \"Authorization\" => \"Bearer #{access_token}\")\n request.body = query.to_json\n Response.new(https.request(request))\n end",
"def specified_period\n @range = [@start_date, @end_date]\n end",
"def retrieve_date_range\n \t@all = false\n \tif params[:daily_summary][:from].nil? && params[:daily_summary][:to].nil?\n\t @free_period = false\n\t @from, @to = nil, nil\n\t if params[:daily_summary][:period_type] == '1' || (params[:daily_summary][:period_type].nil? && !params[:daily_summary][:period].nil?)\n\t case params[:daily_summary][:period].to_s\n\t when 'today'\n\t @from = @to = Date.today\n\t when 'yesterday'\n\t @from = @to = Date.yesterday\n\t when 'current_week'\n\t @from = Date.today.beginning_of_week(:sunday)\n\t @to = @from + 6\n\t when 'last_week'\n\t @from = Date.today - 7 - (Date.today.cwday - 1)%7\n\t @to = @from + 6\n\t when 'last_2_weeks'\n\t @from = Date.today - 14 - (Date.today.cwday - 1)%7\n\t @to = @from + 13\n\t when '7_days'\n\t @from = Date.today - 7\n\t @to = Date.today\n\t when 'current_month'\n\t @from = Date.civil(Date.today.year, Date.today.month, 1)\n\t @to = (@from >> 1) - 1\n\t when 'last_month'\n\t @from = Date.civil(Date.today.year, Date.today.month, 1) << 1\n\t @to = (@from >> 1) - 1\n\t when '30_days'\n\t @from = Date.today - 30\n\t @to = Date.today\n\t when 'current_year'\n\t @from = Date.civil(Date.today.year, 1, 1)\n\t @to = Date.civil(Date.today.year, 12, 31)\n\t when 'all'\n\t @all = true\n\t end\n\t elsif params[:free_period] || params[:daily_summary][:period_type] == '2' || (params[:daily_summary][:period_type].nil? && (!params[:daily_summary][:date_from].nil? || !params[:daily_summary][:date_to].nil?))\n\t begin; @from = params[:daily_summary][:date_from].to_s.to_date unless params[:daily_summary][:date_from].blank?; rescue; end\n\t begin; @to = params[:daily_summary][:date_to].to_s.to_date unless params[:daily_summary][:date_to].blank?; rescue; end\n\t @free_period = true\n\t else\n\t # default\n\t end\n\n\t @from, @to = @to, @from if @from && @to && @from > @to\n\telse\n \t @from = params[:daily_summary][:from]\n \t @to = params[:daily_summary][:to]\n end\n end",
"def find_events_in_range(start_min, start_max,options = {})\n options[:max_results] ||= 25\n options[:order_by] ||= 'lastmodified' # other option is 'starttime'\n formatted_start_min = start_min.strftime(\"%Y-%m-%dT%H:%M:%S\")\n formatted_start_max = start_max.strftime(\"%Y-%m-%dT%H:%M:%S\")\n query = \"?start-min=#{formatted_start_min}&start-max=#{formatted_start_max}&recurrence-expansion-start=#{formatted_start_min}&recurrence-expansion-end=#{formatted_start_max}\"\n query = \"#{query}&orderby=#{options[:order_by]}&max-results=#{options[:max_results]}\"\n event_lookup(query)\n end",
"def set_time_range\n begin_date = Date.strptime(params[:begin_date], '%Y-%m-%d') rescue User.minimum(:created_at) rescue Date.new(2015)\n end_date = Date.strptime(params[:end_date], '%Y-%m-%d') rescue Time.zone.today\n @stats_time_range = (begin_date.beginning_of_day)..(end_date.end_of_day)\n end",
"def google_analytics(options = {})\n @link_params['utm_medium'] = 'email'\n options.each {|kv| @link_params[\"utm_#{kv[0]}\"] = kv[1]}\n end",
"def get_total_ga_info(startdate, enddate, hostname)\n\t\tputs 'totla data'\n\t\tset_total_by_date = Array.new\n\n\t\tformatted_startdate = DateTime.parse(startdate)\n\t\tformatted_enddate = DateTime.parse(enddate)\n\t\t\n\n\t\t# index 0 -> total data, index 1 -> data by date or hour\n\t\tcurrent_arr = set_api_by_date(startdate, enddate, hostname)\n\t\tcurrent_data = current_arr[0]\n\t\tcurrent_linechart_data = current_arr[1]\n\t\t\n\t\t# get compare dates\n\t\tif startdate == enddate then\n\t\t\tcompare_startdate = (formatted_startdate - 1.day).strftime(\"%Y-%m-%d\")\n\t\t\tcompare_enddate = (formatted_enddate - 1.day).strftime(\"%Y-%m-%d\")\n\t\telse\n\t\t\tdiff = (formatted_enddate - formatted_startdate).to_i + 1\n\t\t\tcompare_startdate = (formatted_startdate - diff.days).strftime(\"%Y-%m-%d\")\n\t\t\tcompare_enddate = (formatted_enddate - diff.days).strftime(\"%Y-%m-%d\")\n\t\tend\t\n\n\t\t# index 0 -> total data, index 1 -> data by date or hour\n\t\tcompare_arr = set_api_by_date(compare_startdate, compare_enddate, hostname)\n\t\tcompare_data = compare_arr[0]\n\t\tcompare_linechart_data = compare_arr[1]\n\t\t\n\n\t\tset_total_by_date.push(current_data)\n\t\tset_total_by_date.push(compare_data)\n\t\tset_total_by_date.push(current_linechart_data)\n\t\tset_total_by_date.push(compare_linechart_data)\n\n\t\treturn set_total_by_date\n\tend",
"def reports\n\n \t if params[\"from_date\"].present? and params[\"to_date\"].present?\n @date=params[:from_date]\n @data=JSON.parse RestClient.get $api_service+\"/claims/data_report?from_date=#{params[\"from_date\"]}&to_date=#{params[\"to_date\"]}\"\n elsif params[:date]\n @data=JSON.parse RestClient.get $api_service+\"/claims/data_report?from_date=#{params[\"date\"]}&to_date=#{params[\"date\"]}\"\n @date=params[:date]\n else \n @date=Date.today \n @data=JSON.parse RestClient.get $api_service+'/claims/data_report'\n end\n\n end",
"def analytics_for(url)\n UrlAnalytics.new(url).collect_data\n end",
"def ga_fire_event(event_data)\n @ga_tracker.send(HitBuilders::EventBuilder.new\n .set_category(event_data[:category])\n .set_action(event_data[:action])\n .set_label(event_data[:label])\n .build())\n end",
"def create_event data\n return unless Analytics::GoogleAnalytics.enabled?\n\n GoogleAnalyticsEventJob.perform_later data\n end",
"def getSales_logBy_countryBy_date( from_date, country, action_type)\n params = Hash.new\n params['from_date'] = from_date\n params['country'] = country\n params['action_type'] = action_type\n return doCurl(\"get\",\"/sales_log/by_country/by_date\",params)\n end",
"def show\n number_of_days = 6\n data_table = GoogleVisualr::DataTable.new\n data_table.new_column('string', 'Year')\n data_table.new_column('number', 'Visits')\n data_table.add_rows(number_of_days+1)\n number_of_days.downto(0) do |i|\n day = Time.now - i.days\n column = number_of_days-i\n activities = @restroom.activities.on_date(day)\n data_table.set_cell(column, 0, day.strftime(\"%-m/%-d\"))\n data_table.set_cell(column, 1, activities.size)\n end\n\n opts = { :width => 800, :height => 480, :title => \"#{@restroom.name} Daily Visits\", :hAxis => { :title => 'Date', :titleTextStyle => {:color => 'red'}} }\n @chart = GoogleVisualr::Interactive::ColumnChart.new(data_table, opts)\n end",
"def set_work_site_planner\n #@work_site_planner = WorkSitePlanner.find(params[:id])\n\n @event = Event.find(params[:id]) \n @event.date_range = @event.start.to_date.to_s + \" To \"+ (@event.end.to_date - 1.day).to_s \n\n Rails.logger.debug(\"-------#{@event.inspect}\")\n end",
"def get_app_traffic(start_date, end_date)\n total_vc = Array.new\n while start_date.next_week < end_date\n total_vc.push get_all_viewcounts(start_date.utc, start_date.next_week.utc)\n start_date = start_date.next_week\n end\n total_vc\n end",
"def get_metrics_date(date)\n get_metrics_date_range(date, date)\n end",
"def create_new_report(campaign_id,start_date,end_date)\n new_report_info={ CampaignID: campaign_id, StartDate: start_date, EndDate: end_date}\n res=api_call('CreateNewReport',new_report_info)[:data]\n end",
"def ga_tracker(include_ga_tracker=Rails.env.production?)\n @ga_tracker = include_ga_tracker\n end",
"def date_range\n @date_range ||= start_at..end_at\n end",
"def track_event(action)\n\t\t\tif params['ga_tracking_id'] and params['ga_client_id']\n\t\t\t\ttracker = Staccato.tracker(params['ga_tracking_id'], params['ga_client_id'], ssl: true, document_hostname: params['ga_hostname'])\n\t\t\t\ttracker.event(category: 'support', action: action, value: 1)\n\t\t\tend\n\t\tend",
"def update_date_range(project_id, query_id, date_range_id, opts = {})\n put \"projects/#{project_id}/queries/#{query_id}/date-range/#{date_range_id}\", opts\n end",
"def reports\n start_date = params[:start_date]\n if (start_date.nil?)\n @date_arr = Order.all\n else\n end_date = params[:end_date]\n @date_arr = []\n Order.all.each do |order|\n if (order.date.strftime(\"%Y-%m-%d\").to_date >= start_date.to_date && order.date.strftime(\"%Y-%m-%d\").to_date <= end_date.to_date)\n @date_arr.push(order)\n end\n end\n end\n end",
"def index\n start_date = params[:index][:start_date].to_date.beginning_of_day\n end_date = params[:index][:end_date].to_date.end_of_day\n \n if start_date > end_date\n flash[:date_discover] = \"La fecha inicial debe ser menor a la final\"\n redirect_to report_index_url\n else \n @discovers = Discover.where(:created_at => start_date..end_date)\n \n respond_to do |format|\n format.html\n format.xlsx\n format.json\n end\n end\n end",
"def run_staggered( uri, from, to, step )\n \n # Create a query\n query = RDTQuery.new( uri )\n \n # Create a silent version of MechReporter\n m = MechReporter.new( false )\n \n # Create a blank Sheet\n ret = RubyExcel::Workbook.new.add 'Report'\n \n # Run the report, stepping through the dates until the end\n ( from..to ).each_slice( step ) { |range| puts \"Running date range #{ range.first.strftime( '%d/%m/%y' ) } - #{ range.last.strftime( '%d/%m/%y' ) }\"; ret << m.run( query.set_dates( range.first, range.last ) ); internal_puts ret.maxrow.to_s + ' lines' }\n \n # Return the combined data\n ret\n \n end",
"def index\n @google_analytics = if current_manager\n GoogleAnalytic.where(organization_id: current_manager.organization_id).newest_first\n else\n GoogleAnalytic.newest_first\n end\n end",
"def find_events_in_range(start_min, start_max, options = {})\n formatted_start_min = encode_time(start_min)\n formatted_start_max = encode_time(start_max)\n query = \"?timeMin=#{formatted_start_min}&timeMax=#{formatted_start_max}#{parse_options(options)}\"\n event_lookup(query)\n end",
"def user_earnings_from_brand(ga_user_id, ga_brand_id, start_date, end_date)\n\n request = {report_requests:[\n {metrics:[{expression: \"ga:metric2\"}],\n dimensions:[{name:\"ga:dimension1\"},{name:\"ga:dimension3\"}],\n date_ranges:[{start_date: start_date, end_date: end_date}],\n view_id:\"ga:141580290\",\n filters_expression: \"ga:dimension1==#{ga_user_id},ga:dimension3==#{ga_brand_id}\"\n }]}\n\n results = ga_request(request)\n\n json = JSON.parse(results.to_json)[\"reports\"][0][\"data\"][\"totals\"][0][\"values\"][0]\n\n return json\n\n end",
"def statistics start_on = Date.today, end_on = Date.today, local_time_zone = true\n daily_statistics start_on, end_on, local_time_zone\n end",
"def set_work_search_blog\n @event = Event.find(params[:id]) \n @event.date_range = @event.start.to_date.to_s + \" To \"+ (@event.end.to_date - 1.day).to_s \n end",
"def start(start_date, end_date)\n self.start_date = start_date\n self.end_date = end_date\n self.active = true\n issues.each do |issue|\n log_activity(issue, 'start', issue.estimate)\n end\n save\n end",
"def track_page_view()\n time_stamp = Time.now.to_s\n domain_name = ENV[\"SERVER_NAME\"]\n domain_name ||= \"\"\n\n #Get the referrer from the utmr parameter, this is the referrer to the\n #page that contains the tracking pixel, not the referrer for tracking\n #pixel.\n document_referer = $cgi[\"utmr\"]\n if document_referer != \"\" && document_referer != \"0\"\n document_referer = \"-\"\n else\n document_referer = CGI.unescape(document_referer)\n end\n\n document_path = $cgi[\"utmp\"]\n document_path ||= \"\"\n document_path = CGI.unescape(document_path)\n\n account = $cgi[\"utmac\"]\n user_agent = ENV[\"HTTP_USER_AGENT\"]\n user_agent ||= \"\"\n\n #Try and get visitor cookie from the request.\n cookie = $cgi.cookies[COOKIE_NAME]\n\n guid_header = ENV[\"HTTP_X_DCMGUID\"]\n guid_header ||= ENV[\"HTTP_X_UP_SUBNO\"]\n guid_header ||= ENV[\"HTTP_X_JPHONE_UID\"]\n guid_header ||= ENV[\"HTTP_X_EM_UID\"]\n\n visitor_id = get_visitor_id(guid_header, account, user_agent, cookie)\n\n utm_gif_location = \"http://www.google-analytics.com/__utm.gif\"\n\n #Construct the gif hit url.\n utm_url = utm_gif_location + \"?\" +\n \"utmwv=\" + GA_VERSION +\n \"&utmn=\" + get_random_number +\n \"&utmhn=\" + CGI::escape(domain_name) +\n \"&utmr=\" + CGI::escape(document_referer) +\n \"&utmp=\" + CGI::escape(document_path) +\n \"&utmac=\" + account +\n \"&utmcc=__utma%3D999.999.999.999.999.1%3B\" +\n \"&utmvid=\" + visitor_id +\n \"&utmip=\" + get_ip(ENV[\"REMOTE_ADDR\"])\n\n send_request_to_google_analytics(utm_url)\n\n #Finally write the gif data to the response.\n write_gif_data(utm_url, time_stamp, visitor_id)\nend",
"def covering(date_range)\n merge(covering: date_range)\n end",
"def open\n return start_date <= Time.now.to_date && end_date >= Time.now.to_date\n end",
"def user_count_in_last_90_days\n return if ga_tracking_code.blank?\n\n ga_reporting_api = GoogleAnalytics::Reporting.new(ga_tracking_code)\n\n updated_user_count = ga_reporting_api.send_request\n\n update(google_analytics_user_count: updated_user_count)\n rescue GoogleAnalytics::BadResponseError => e\n errors.add(:base, e.message)\n false\n rescue Google::Apis::ClientError => e\n errors.add(:base, 'Check your product tracking code - is it correct?')\n false\n end",
"def report_period_to_range\n daily_report = false\n range = case self\n when 'this_month'\n daily_report = true\n (Date.today.beginning_of_month..Date.today)\n when 'last_month'\n daily_report = true\n (1.month.ago.to_date.beginning_of_month..1.month.ago.to_date.end_of_month)\n when 'last_6_months'\n (5.months.ago.to_date.beginning_of_month..Date.today).select {|d| d.day == 1}\n when 'this_year'\n (Date.today.beginning_of_year..Date.today).select {|d| d.day == 1}\n end\n [range, daily_report]\n end",
"def create_date_range(project_id, query_id, opts = {})\n post \"projects/#{project_id}/queries/#{query_id}/date-range\", opts\n end",
"def report\n @urls = Redirect.joins(:redirect_histories).group(:id).order('COUNT(redirect_histories.id) DESC').all\n # @urls = Redirect.joins(:redirect_histories).all\n # If before date\n if !params[:date_before].blank?\n @urls = @urls.where('redirect_histories.created_at <= ?', params[:date_before])\n end\n # If after date\n if !params[:date_after].blank?\n @urls = @urls.where('redirect_histories.created_at >= ?', params[:date_after])\n end\n end",
"def region_sales(start_date, end_date, options={})\n options.merge!({:basic_auth => @auth})\n url = \"/sales/regions/#{start_date}/#{end_date}\" \n self.class.get(url, options)\n end",
"def get_account_activity(start_date, end_date, options = {})\n submit GetAccountActivity.new(options.merge(:start_date => start_date, :end_date => end_date))\n end",
"def index\n current_year = DateTime.now.year\n date_registration_opens = DateTime.new(current_year, 1, 1)\n date_registration_closes = DateTime.new(current_year+1, 1, 1)\n @camps = Camp.where(\"(start_date >= ? AND start_date < ?)\", date_registration_opens, date_registration_closes).all\n end",
"def incident_list_url\n # pagerduty does not like the edt time zone\n # &time_zone=#{@time_zone}\"\n\n # I am not clear what setting the urgency filter to \"high,low\" does but when I take it out, it\n # removed 75% of the incidents. Keeping it in for now but a candidate to actually figure out\n # what is going on.\n \n \"https://#{ReportScraper.config.host}/api/v1/reports/raw/incidents.csv?since=#{@start_at}&until=#{@end_at}&filters[urgency]=high%2Clow&rollup=daily\"\n end",
"def assign_date_coverage\n cov_interval = Dataset::DateCoverageService.params_to_interval params\n params[PARAMS_KEY]['date_coverage'] = cov_interval ? cov_interval.edtf : \"\"\n end",
"def google_analytics_stats(video)\n client_opts = JSON.parse(session[\"google-auth-client\"])\n auth_client = Signet::OAuth2::Client.new(client_opts)\n\n analytics = Google::Apis::AnalyticsV3::AnalyticsService.new\n\n # TODO figure out how to handle timeout\n begin\n results = analytics.get_ga_data(\"ga:103055258\",\n \"2015-05-29\",\n \"yesterday\",\n \"ga:newusers,ga:transactions,ga:transactionRevenue,ga:goal4Completions\",\n dimensions: \"ga:sourceMedium\",\n filters: \"ga:sourceMedium==#{video.ga_source_medium}\",\n options:{ authorization: auth_client }\n )\n rescue StandardError => e\n puts \"Error Calling Google API for Analytics v3: #{e}\"\n # This would be the best place to redirect, but having a problem actually execution after redirect.\n # return redirect_to \"/oauthredirect\"\n end\n\n return results\n end",
"def by_date\n @page_title = \"Expenses [by Date]\"\n @expenses = @current_user.expenses.find(:all)\n\n # attempt to find expenses by a date range\n if !(params[:start].nil? and params[:finish].nil?)\n begin\n @expenses = @current_user.expenses.find(:all, :conditions => {\n :created_at => params[:start].to_date .. params[:finish].to_date\n })\n # capture invalid or nil date ranges\n rescue\n flash[:error] = \"Invalid dates in date range.\"\n @expenses = nil\n end\n end\n\n respond_to do |format|\n format.html # by_date.html.erb\n format.xml { render :xml => @expenses }\n format.iphone do # by_date.iphone.erb\n @panel_title = @page_title\n render :layout => false\n end\n end\n end",
"def retrieve_date_range_14\n @free_period = false\n @from, @to = nil, nil\n\n if params[:period_type] == '1' || (params[:period_type].nil? && !params[:period].nil?)\n case params[:period].to_s\n when 'today'\n @from = @to = Date.today\n when 'yesterday'\n @from = @to = Date.today - 1\n when 'current_week'\n @from = Date.today - (Date.today.cwday - 1)%7\n @to = @from + 6\n when 'last_week'\n @from = Date.today - 7 - (Date.today.cwday - 1)%7\n @to = @from + 6\n when '7_days'\n @from = Date.today - 7\n @to = Date.today\n when 'current_month'\n @from = Date.civil(Date.today.year, Date.today.month, 1)\n @to = (@from >> 1) - 1\n when 'last_month'\n @from = Date.civil(Date.today.year, Date.today.month, 1) << 1\n @to = (@from >> 1) - 1\n when '30_days'\n @from = Date.today - 30\n @to = Date.today\n when 'current_year'\n @from = Date.civil(Date.today.year, 1, 1)\n @to = Date.civil(Date.today.year, 12, 31)\n end\n elsif params[:period_type] == '2' || (params[:period_type].nil? && (!params[:from].nil? || !params[:to].nil?))\n begin; @from = params[:from].to_s.to_date unless params[:from].blank?; rescue; end\n begin; @to = params[:to].to_s.to_date unless params[:to].blank?; rescue; end\n @free_period = true\n else\n # default\n end\n\n @from, @to = @to, @from if @from && @to && @from > @to\n end",
"def top_urls_between_date(start_date, end_date)\n top_urls_between_date_query(start_date, end_date)\n .all\n .group_by { |pv| pv[:date_visited] }\n .collect do |_, grouped_by_date_visited|\n grouped_by_date_visited.first\n end\n end",
"def booked_date_range\n { from: :start_date, to: :end_date }\n end",
"def metrics(campaign_ids = [], start_time = nil, end_time = nil)\n params = { campaignId: campaign_ids }\n if start_time\n params[:startTime] = start_time.to_date.strftime(Iterable::DATE_FORMAT)\n params[:endTime] = end_time.to_date.strftime(Iterable::DATE_FORMAT)\n end\n Iterable.request(conf, '/campaigns/metrics', params).get\n end",
"def readings\n\tstart_date, end_date = query_user_for_date_range\nend",
"def from_google\n @calendars = get_calendar(current_user).to_a\n @calendar_days = @calendars.group_by {|e| \n if e.start.date_time != nil \n e.start.date_time.strftime(\"%Y-%m-%d\").to_time\n end\n }\n @today = Time.now.strftime(\"%Y-%m-%d\").to_time\n @tomorrow = Time.now.tomorrow.strftime(\"%Y-%m-%d\").to_time\n end",
"def events_from_big_query_for_repo_in_date_range(owner_name, repo_name, start_date_string, end_date_string)\n return @events if @events\n\n query_string = events_query_string(owner_name, repo_name, start_date_string, end_date_string)\n\n json = fetch_query(query_string)\n @events = json\n\n # clear_event_memoizations\n end",
"def dfp_date_used()\n @credential_handler.include_in_user_agent(\"DfpDate\")\n end",
"def ga_ad_click(advertiser, ad_name, link)\n adv = advertiser.blank? ? \"\" : advertiser\n adv_name = ad_name.blank? ? \"\" : ad_name\n #adv_link = link.blank? ? \"\" : link\n category = adv + \" - Ad Data\"\n action = adv_name + \" - Clicks\"\n\n adv_link = request.url\n result = \"_gaq.push(['_trackEvent', '\" + category + \"', '\" + action + \"', '\" + adv_link +\"']);\"\n\n # Tell rails not to escape output.\n result.html_safe\n end",
"def index\n user = User.find params[:user_id]\n @events = !params.has_key?(:show_all) ? user.event : Event.scoped\n @events = @events.between(Days.firstDay(params[:curDate]), Days.lastDay(params[:curDate])) unless\n params[:curDate].nil?\n @events = @events.opened if params[:showClosed].nil? || !params[:showClosed]\n if !params[:show_date].nil?\n date = params[:show_date].is_a?(String) ? DateTime.parse(params[:show_date]) : params[:show_date]\n date_start = date.beginning_of_day\n date_finish = date.end_of_day\n @events = @events.between(date_start, date_finish) unless params[:show_date].nil?\n end\n #puts @events[1].start unless params[:show_date].nil?\n respond_to do |format|\n format.html {render :html => @events}\n format.json {render :json => @events}\n format.xml {render :xml => @events}\n end\n end",
"def ping_google_analytics()\n # Trying to get some metrics for usage, just comment out if you don't want it.\n Kitchenplan::Log.info 'Sending a ping to Google Analytics to count usage'\n require 'Gabba'\n Gabba::Gabba.new(\"UA-46288146-1\", \"github.com\").event(\"Kitchenplan\", \"Run\", ENV['USER'])\n end",
"def ping_google_analytics()\n # Trying to get some metrics for usage, just comment out if you don't want it.\n Kitchenplan::Log.info 'Sending a ping to Google Analytics to count usage'\n require 'gabba'\n Gabba::Gabba.new(\"UA-46288146-1\", \"github.com\").event(\"Kitchenplan\", \"Run\", ENV['USER'])\n end",
"def init\n @from_day = params[:from].nil? ? Time.parse(\"2013-09-01\") : Time.parse(params[:from])\n @to_day = params[:to].nil? ? Time.now : Time.parse(params[:to]) + (60 * 60 * 24 - 1)\n @visits = Visit.asc(:time_in).where(\"this.time_in >= #{@from_day.to_i} && this.time_in <= #{@to_day.to_i}\")\n end",
"def generate_standard_report(start_date = nil, end_date = nil)\r\n report_lines = ['Affiliate Unique ID,Event Type,Timestamp,First Review?,Program Name']\r\n report_events(start_date, end_date) do |event|\r\n report_lines.push event.report_line\r\n end\r\n report_lines.join(\"\\n\")\r\n end",
"def go_to_date_link(user)\n\t\tdynamic_range\n\t\t@base_path = root_path+\"users/#{user.id}/scrapbook/#{@destination}\"\n\tend",
"def create_occurrences\n if (from_date && to_date)\n current_date = from_date\n #this does not include the final date, could change so it does\n while (current_date < to_date)\n\n occurrence_end = current_date + event_length\n\n if(current_date.wday == recurring_day) #in case start date is not the right day of week\n occurrence_date.create( {start: current_date, end: occurrence_end})\n end\n\n case frequency\n when \"weekly\"\n current_date = current_date + 7.days\n if (recurring_day)\n current_date = current_date.beginning_of_week + recurring_day\n end\n when \"monthly\" ## need option to select which month month\n current_date = current_date + 1.month\n if(recurring_day && recurring_day_order)\n beginning_of_month= current_date.beginning_of_month\n current_date = week_day_of_month(beginning_of_month, recurring_day, recurring_day_order)\n end\n when \"daily\"\n current_date = current_date.next_day\n else\n console.log(\"not a valid frequency\")\n end\n end\n end\n end",
"def analytics_clicks(engine_id, options={})\n document_type_id = options.delete(:document_type_id)\n if document_type_id\n get(\"engines/#{engine_id}/document_types/#{document_type_id}/analytics/clicks.json\", options)\n else\n get(\"engines/#{engine_id}/analytics/clicks.json\", options)\n end\n end",
"def city_openings(start_date, end_date)\n openings(start_date, end_date)\n end",
"def index\n @datetimes = current_user.datetimes.where [\"DATE(start) = DATE(?)\", Time.now]\n\n if params[:new_tracking_info]\n @desired_activity_name = params[:new_tracking_info][:activity_name]\n end\n\n self.prepare_tracking_data\n\n @tags = current_user.datetimes.tag_counts_on(:tags)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @datetimes }\n end\n end",
"def report_range=(value)\n @report_range = value\n end",
"def google_analytics_include_tag(tracking_id, host)\n javascript_tag(<<-Javascript)\n (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),\n m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n })(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n\n ga('create', '#{tracking_id}', '#{host}');\n ga('send', 'pageview');\n Javascript\n end"
] |
[
"0.63572794",
"0.6313685",
"0.60575753",
"0.59435356",
"0.5846436",
"0.58456767",
"0.58207065",
"0.58202654",
"0.5750075",
"0.5693158",
"0.5683875",
"0.56447446",
"0.5629932",
"0.5623933",
"0.5623061",
"0.56173193",
"0.55412436",
"0.5487006",
"0.54596186",
"0.5445153",
"0.53991324",
"0.5395198",
"0.5390711",
"0.53825337",
"0.5370372",
"0.53609186",
"0.53420675",
"0.5337648",
"0.5325537",
"0.5306204",
"0.5296489",
"0.5292229",
"0.5292229",
"0.52454025",
"0.52437526",
"0.52407974",
"0.52379006",
"0.5228695",
"0.5227241",
"0.5218047",
"0.52169895",
"0.51954055",
"0.5191467",
"0.5177886",
"0.5169436",
"0.515227",
"0.5147569",
"0.5127434",
"0.51062286",
"0.50882107",
"0.50859225",
"0.5081956",
"0.5076068",
"0.5064574",
"0.5057331",
"0.50544465",
"0.5043818",
"0.50402987",
"0.50336915",
"0.5032573",
"0.5031376",
"0.50215954",
"0.5009528",
"0.50049615",
"0.49898",
"0.4984825",
"0.4982708",
"0.49785691",
"0.49766728",
"0.49766237",
"0.496862",
"0.49665037",
"0.49653128",
"0.4964462",
"0.49551246",
"0.49518666",
"0.49392644",
"0.49373046",
"0.4926078",
"0.49206808",
"0.49175113",
"0.4910462",
"0.49093327",
"0.4908947",
"0.490589",
"0.4904553",
"0.49024826",
"0.48976865",
"0.4896466",
"0.48945764",
"0.4891812",
"0.4884867",
"0.48810238",
"0.4878961",
"0.48781836",
"0.48779723",
"0.4877143",
"0.4876171",
"0.4874615",
"0.48732585"
] |
0.7239136
|
0
|
GET /resource/sign_up def new super end POST /resource def create super end GET /resource/edit def edit super end PUT /resource
|
def update
@user = User.find(current_user.id)
successfully_updated = if needs_password?(@user, params)
@user.update_with_password(params.require(:user).permit(:city, :email, :image, :mobile, :name, :current_password, :password, :password_confirmation))
# Rails 3: @user.update_with_password(params[:user])
else
# remove the virtual current_password attribute update_without_password
# doesn't know how to ignore it
params[:user].delete(:current_password)
params[:user].delete(:password)
params[:user].delete(:password_confirmation)
@user.update_without_password(params.require(:user).permit(:city, :email, :image, :mobile, :name))
# Rails 3: @user.update_without_password(params[:user])
end
if successfully_updated
set_flash_message :notice, :updated
# Sign in the user bypassing validation in case his password changed
sign_in @user, :bypass => true
redirect_to after_update_path_for(@user)
else
render "edit"
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def sign_up(resource_name, resource)\n end",
"def create\n build_resource(configure_sign_up_params)\n resource.save\n if resource.persisted?\n if resource.active_for_authentication?\n set_flash_message! :notice, :signed_up\n # To avoid login comment out sign_up method\n # sign_up(resource_name, resource)\n respond_to do |format|\n format.json { \n render json: resource # , location: after_sign_up_path_for(resource)\n }\n format.html {respond_with resource, location: after_sign_up_path_for(resource)}\n end\n else\n set_flash_message! :notice, :\"signed_up_but_#{resource.inactive_message}\"\n expire_data_after_sign_in!\n respond_to do |format|\n format.json { \n render json: resource # , location: after_inactive_sign_up_path_for(resource)\n }\n format.html {respond_with resource, location: after_inactive_sign_up_path_for(resource)}\n end\n end\n else\n clean_up_passwords resource\n set_minimum_password_length\n respond_to do |format|\n format.json { render json: { error_messages: resource.errors.full_messages.join(', ') }, status: 422 }\n format.html {respond_with resource}\n end\n end\n end",
"def sign_up(resource_name, resource)\n redirect_to users_url\n end",
"def create\n build_resource sign_up_params\n\n if resource.save\n Notifier.notify_superusers_of_access_request(resource).deliver\n if resource.active_for_authentication?\n set_flash_message :notice, :signed_up if is_navigational_format?\n sign_in(resource_name, resource)\n respond_with resource, :location => after_sign_up_path_for(resource)\n else\n set_flash_message :notice, :\"signed_up_but_#{resource.inactive_message}\" if is_navigational_format?\n expire_session_data_after_sign_in!\n respond_with resource, :location => after_inactive_sign_up_path_for(resource)\n end\n else\n clean_up_passwords resource\n respond_with resource\n end\n end",
"def create\n build_resource(sign_up_params)\n\n resource.save\n yield resource if block_given?\n if resource.persisted?\n if resource.active_for_authentication?\n set_flash_message! :notice, :signed_up\n # sign_up(resource_name, resource)\n # respond_with resource, location: after_sign_up_path_for(resource)\n\n # mailer\n AccountMailer.account_email(resource).deliver\n\n # devise override\n # (サインアップしたユーザーでログインせずadminページにリダイレクト)\n redirect_to admin_path\n\n else\n set_flash_message! :notice, :\"signed_up_but_#{resource.inactive_message}\"\n expire_data_after_sign_in!\n respond_with resource, location: after_inactive_sign_up_path_for(resource)\n end\n else\n clean_up_passwords resource\n set_minimum_password_length\n respond_with resource\n end\n end",
"def create\n build_resource(sign_up_params)\n resource.save\n if resource.persisted?\n if resource.active_for_authentication?\n # set_flash_message! :notice, :signed_up\n # To avoid login comment out sign_up method\n # sign_up(resource_name, resource)\n render json: resource # , location: after_sign_up_path_for(resource)\n else\n # set_flash_message! :notice, :\"signed_up_but_#{resource.inactive_message}\"\n expire_data_after_sign_in!\n render json: resource # , location: after_inactive_sign_up_path_for(resource)\n end\n else\n clean_up_passwords resource\n set_minimum_password_length\n respond_with resource\n end\n end",
"def create\n build_resource\n #build_resource(sign_up_params)\n resource.email = resource_params[:email]\n # ^^ ref https://github.com/RailsApps/rails-prelaunch-signup/commit/ec01a952b56ccf49b4dfa4d529caea22b4dbdae8\n\n if resource.save\n if resource.active_for_authentication?\n sign_in(resource_name, resource)\n (render(partial: 'thankyou', layout: false) && return) if request.xhr?\n respond_with resource, location: after_sign_up_path_for(resource)\n else\n expire_data_after_sign_in!\n (render(partial: 'thankyou', layout: false) && return) if request.xhr?\n respond_with resource, location: after_inactive_sign_up_path_for(resource)\n end\n else\n clean_up_passwords resource\n render action: :new, layout: !request.xhr?\n end\n end",
"def create\n build_resource(configure_sign_up_params)\n resource.save\n if resource.persisted?\n if resource.active_for_authentication?\n # set_flash_message! :notice, :signed_up\n # To avoid login comment out sign_up method\n # sign_up(resource_name, resource)\n render json: resource # , location: after_sign_up_path_for(resource)\n else\n # set_flash_message! :notice, :\"signed_up_but_#{resource.inactive_message}\"\n expire_data_after_sign_in!\n render json: resource # , location: after_inactive_sign_up_path_for(resource)\n end\n else\n clean_up_passwords resource\n set_minimum_password_length\n render json: { error_messages: resource.errors.full_messages.join(', ') }, status: 422\n end\n end",
"def create\n build_resource(sign_up_params)\n\n resource.save\n render_resource(resource)\n end",
"def sign_up(resource_name, resource)\n # sign_in(resource_name, resource)\n end",
"def create\n build_resource(sign_up_params)\n\n respond_to do |format|\n if resource.save\n format.html { redirect_to admin_root_path, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end \n\n if resource.save\n if resource.active_for_authentication?\n set_flash_message :notice, :signed_up if is_navigational_format?\n sign_up(resource_name, resource)\n respond_with resource, :location => after_sign_up_path_for(resource)\n else\n set_flash_message :notice, :\"signed_up_but_#{resource.inactive_message}\" if is_navigational_format?\n expire_session_data_after_sign_in!\n respond_with resource, :location => after_inactive_sign_up_path_for(resource)\n end\n else\n clean_up_passwords resource\n respond_with resource\n end\n end",
"def sign_up(resource_name, resource)\n # DO NOT sign_in(resource_name, resource)\n end",
"def create\n build_resource(sign_up_params)\n resource.save\n if resource.persisted?\n if resource.active_for_authentication?\n sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n flash[:notice] = 'Registration Successful.'\n render json: { after_sign_in_path: after_sign_in_path_for(User) }\n else\n expire_data_after_sign_in!\n render json: { error: 'Something went wrong' }, status: 422\n end\n else\n clean_up_passwords resource\n set_minimum_password_length\n render json: { error: resource.errors.full_messages.join('<br>') }, status: 422\n end\n end",
"def create\n build_resource(sign_up_params)\n resource_saved = resource.save\n yield resource if block_given?\n if resource_saved\n if resource.active_for_authentication?\n set_flash_message :notice, :signed_up if is_flashing_format?\n #sign_up(resource_name, resource)\n sign_up(resource_name, resource) if !employee_signed_in?\n respond_with resource, location: after_sign_up_path_for(resource)\n else\n set_flash_message :notice, :\"signed_up_but_#{resource.inactive_message}\" if is_flashing_format?\n expire_data_after_sign_in!\n respond_with resource, location: after_inactive_sign_up_path_for(resource)\n end\n else\n clean_up_passwords resource\n #set_minimum_password_length\n respond_with resource\n end\n end",
"def sign_up(resource_name, resource)\n true\n end",
"def create\n build_resource\n if resource.save\n log_event(\"signed up\")\n if resource.active_for_authentication?\n set_flash_message :notice, :signed_up if is_navigational_format?\n sign_in(resource_name, resource)\n respond_with resource, :location => after_sign_up_path_for(resource)\n else\n set_flash_message :notice, :\"signed_up_but_#{resource.inactive_message}\" if is_navigational_format?\n expire_session_data_after_sign_in!\n respond_with resource, :location => after_inactive_sign_up_path_for(resource)\n end\n else\n clean_up_passwords resource\n respond_with resource\n end\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n flash[:notice] = \"Sign up successfully.\"\n end",
"def create\n\t\tcheck_recaptcha\n\t\tbuild_resource(sign_up_params)\n\t\tresource.m_client = self.m_client\n\t \tresource.set_client_authentication\n\t resource.save\n\t yield resource if block_given?\n\t if resource.persisted?\n\t if resource.active_for_authentication?\n\t set_flash_message! :notice, :signed_up\n\t sign_up(resource_name, resource)\n\t respond_with resource, location: after_sign_up_path_for(resource)\n\t else\n\t set_flash_message! :notice, :\"signed_up_but_#{resource.inactive_message}\"\n\t expire_data_after_sign_in!\n\t respond_with resource, location: after_inactive_sign_up_path_for(resource)\n\t end\n\t else\n\t clean_up_passwords resource\n\t set_minimum_password_length\n\t respond_with resource\n\t end\n\n\tend",
"def create\n build_resource(sign_up_params)\n\n resource.save\n yield resource if block_given?\n if resource.persisted?\n if resource.active_for_authentication?\n set_flash_message! :notice, :signed_up\n sign_up(resource_name, resource)\n respond_with resource, location: after_sign_up_path_for(resource)\n else\n set_flash_message! :notice, :\"signed_up_but_#{resource.inactive_message}\"\n expire_data_after_sign_in!\n respond_with resource, location: after_inactive_sign_up_path_for(resource)\n end\n else\n clean_up_passwords resource\n set_minimum_password_length\n redirect_to new_matcher_registration_path, notice: error_al_registrar(resource)\n end\n end",
"def sign_up(resource_name, resource)\n true\n end",
"def sign_up(resource_name, resource)\n true\n end",
"def sign_up(resource_name, resource)\r\n # Create an account for this user.\r\n account = Account.create(name: \"#{resource.email}'s account\")\r\n \r\n # Sign in the user (from the original Devise::RegistrationsController).\r\n sign_in(resource_name, resource)\r\n end",
"def create\n build_resource(sign_up_params)\n\n resource.save\n yield resource if block_given?\n if resource.persisted?\n if resource.active_for_authentication?\n sign_up(resource_name, resource)\n render status: 200\n else\n expire_data_after_sign_in!\n respond_with resource, location: after_inactive_sign_up_path_for(resource)\n end\n else\n clean_up_passwords resource\n set_minimum_password_length\n render status: 400\n end\n end",
"def create\n build_resource(sign_up_params)\n\n resource_saved = resource.save\n yield resource if block_given?\n if resource_saved\n if resource.active_for_authentication?\n set_flash_message :notice, :signed_up if is_flashing_format?\n sign_up(resource_name, resource)\n respond_with resource, location: after_sign_up_path_for(resource)\n else\n set_flash_message :notice, :\"signed_up_but_#{resource.inactive_message}\" if is_flashing_format?\n expire_data_after_sign_in!\n redirect_to :new_user_session, flash: {notice: \"Seu registro foi efetuado com sucesso! Por favor aguarde a aprovação do admnistrador!\"}\n end\n else\n clean_up_passwords resource\n @validatable = devise_mapping.validatable?\n if @validatable\n @minimum_password_length = resource_class.password_length.min\n end\n respond_with resource\n end\n # redirect_to :back, flash: {error: \"Oops, something went wrong. Please try again\"}\n end",
"def sign_up(resource_name, resource)\r\n sign_in(resource_name, resource)\r\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def create\n # Modified the super class to allow for ip address on sign_up\n build_resource(sign_up_params)\n resource.sign_up_ip = request.env['REMOTE_ADDR']\n resource.save\n yield resource if block_given?\n if resource.persisted?\n if resource.active_for_authentication?\n set_flash_message! :notice, :signed_up\n sign_up(resource_name, resource)\n respond_with resource, location: after_sign_up_path_for(resource)\n else\n set_flash_message! :notice, :\"signed_up_but_#{resource.inactive_message}\"\n expire_data_after_sign_in!\n respond_with resource, location: after_inactive_sign_up_path_for(resource)\n end\n else\n clean_up_passwords resource\n set_minimum_password_length\n respond_with resource\n end\n\n if @teacher.persisted?\n @teacher.submit_signup\n end\n cookies[:is_signed_in] = teacher_signed_in?\n cookies[:signed_in_type] = 'teacher'\n if teacher_signed_in?\n cookies[:name] = current_teacher.first_name\n end\n end",
"def create\n build_resource(sign_up_params)\n if resource.save\n\n save_image_attribute!(sign_up_params[:profile_image] || sign_up_params[:profile_image_name], params[:remove_profile_image])\n\n child = (auth_user && auth_user.is_a?(Child)) ? auth_user : (params[:child_id] ? User.find_by_id(params[:child_id]) : nil)\n if child.is_a?(Child)\n connect_parent_and_child!(resource, child)\n end\n if resource.active_for_authentication?\n set_flash_message :notice, :signed_up if is_navigational_format?\n sign_up(resource_name, resource)\n\n else\n set_flash_message :notice, :\"signed_up_but_#{resource.inactive_message}\" if is_navigational_format?\n expire_session_data_after_sign_in!\n end\n respond_to do |format|\n format.json { render :json => {:success => true, :user => resource.json_attributes} }\n format.html { redirect_to(user_locations_path(initial_reg: params[:initial_reg], child_id: params[:child_id] ) ) }\n end\n else\n clean_up_passwords resource\n logger.info \" Errors: #{resource.errors.full_messages}\"\n respond_to do |format|\n format.json { render :json => {:success => false, :errors => resource.errors.messages} }\n format.html { params[:initial_reg] ? redirect_to(user_locations_url) : redirect_to(edit_user_registration_path) }\n end\n end\n end",
"def create\r\n build_resource(sign_up_params)\r\n\r\n resource.save\r\n yield resource if block_given?\r\n if resource.persisted?\r\n if resource.active_for_authentication?\r\n set_flash_message! :notice, :signed_up\r\n sign_up(resource_name, resource)\r\n\r\n user_details = Api::V1::UserSerializer.new(resource)\r\n articles = ActiveModel::Serializer::CollectionSerializer.new(Article.all.to_a, serializer: Api::V1::ArticleSerializer)\r\n\r\n render json: { user: user_details, articles: articles }, status: :created\r\n else\r\n set_flash_message! :notice, :\"signed_up_but_#{resource.inactive_message}\"\r\n expire_data_after_sign_in!\r\n respond_with resource, location: after_inactive_sign_up_path_for(resource)\r\n end\r\n else\r\n clean_up_passwords resource\r\n set_minimum_password_length\r\n respond_with resource\r\n end\r\n end",
"def create\n build_resource(sign_up_params)\n\n resource.save\n yield resource if block_given?\n if resource.persisted?\n if resource.active_for_authentication?\n set_flash_message! :notice, :signed_up\n sign_up(resource_name, resource)\n # respond_with resource, location: after_sign_up_path_for(resource)\n render 'users/registrations/finish_registration'\n # redirect_to(controller: \"custom_registration\", action: \"index\") and return\n else\n set_flash_message! :notice, :\"signed_up_but_#{resource.inactive_message}\"\n expire_data_after_sign_in!\n # respond_with resource, location: after_inactive_sign_up_path_for(resource)\n render 'users/registrations/finish_registration'\n # redirect_to(controller: \"custom_registration\", action: \"index\") and return\n end\n else\n clean_up_passwords resource\n set_minimum_password_length\n respond_with resource\n end\n end",
"def create\n \n build_resource(sign_up_params)\n\n #this is a private function to check params\n if check_some_validations\n redirect_to new_user_registration_path\n else #the next part taken form Devise on github\n resource.save\n yield resource if block_given?\n\n if resource.persisted?\n if resource.active_for_authentication?\n set_flash_message! :notice, :signed_up\n sign_up(resource_name, resource)\n respond_with resource, location: after_sign_up_path_for(resource)\n else\n set_flash_message! :notice, :\"signed_up_but_#{resource.inactive_message}\"\n expire_data_after_sign_in!\n respond_with resource, location: after_inactive_sign_up_path_for(resource)\n end\n else\n clean_up_passwords resource\n set_minimum_password_length\n respond_with resource\n end\n end\n end",
"def create\n build_resource(sign_up_params)\n resource_saved = resource.save\n yield resource if block_given?\n if resource_saved\n if resource.active_for_authentication?\n set_flash_message :notice, :signed_up\n sign_in(resource_name, resource)\n else\n set_flash_message :notice, :\"signed_up_but_#{resource.inactive_message}\"\n expire_data_after_sign_in!\n end\n\n @redirect_to_path = request.referer\n \n respond_to do |format|\n format.js { render 'registrations/success_registration' }\n end\n else\n # Errors occurred while registration\n clean_up_passwords resource\n @validatable = devise_mapping.validatable?\n \n @minimum_password_length = resource_class.password_length.min if @validatable\n\n respond_to do |format|\n format.js { render 'registrations/error_registration' }\n end\n end\n end",
"def create\n build_resource(sign_up_params)\n resource.name = params[:user][:name] if not params[:user][:name].blank?\n resource_saved = resource.save\n yield resource if block_given?\n if resource_saved\n if resource.active_for_authentication?\n set_flash_message :alert, :signed_up if is_flashing_format?\n sign_up(resource_name, resource)\n\n if request.referer && resource\n if request.referer.to_s.include? ('courses/activate')\n redirect_to '/courses/activate'\n return\n end\n end\n\n respond_with resource, location: after_sign_up_path_for(resource)\n else\n set_flash_message :alert, :\"signed_up_but_#{resource.inactive_message}\" if is_flashing_format?\n expire_data_after_sign_in!\n respond_with resource, location: after_inactive_sign_up_path_for(resource)\n end\n else\n set_flash_message :alert, :invalid_email if is_flashing_format?\n clean_up_passwords resource\n @validatable = devise_mapping.validatable?\n if @validatable \n @minimum_password_length = resource_class.password_length.min\n set_flash_message :alert, :invalid_email if is_flashing_format?\n end\n respond_with resource\n end\n end",
"def create\n build_resource(sign_up_params)\n\n if resource.save\n if resource.active_for_authentication?\n set_flash_message :notice, :signed_up if is_navigational_format?\n sign_up(resource_name, resource)\n if SystemConfiguration.count == 0 && @user.global_role_id == GlobalRole::ADMINISTRATOR_ID\n flash[:notice] += \" Please set up your system configuration now.\"\n respond_with resource, :location => edit_system_configuration_path\n else\n respond_with resource, :location => after_sign_up_path_for(resource)\n end \n else\n set_flash_message :notice, :\"signed_up_but_#{resource.inactive_message}\" if is_navigational_format?\n expire_session_data_after_sign_in!\n if SystemConfiguration.count == 0 && @user.global_role_id == GlobalRole::ADMINISTRATOR_ID\n flash[:notice] += \" Please set up your system configuration now.\"\n respond_with resource, :location => edit_system_configuration_path\n else\n respond_with resource, :location => after_inactive_sign_up_path_for(resource)\n end \n end\n else\n clean_up_passwords resource\n respond_with resource\n end\n end",
"def devise_create_new_rails_user\n build_resource(sign_up_params)\n\n resource.save\n\n yield resource if block_given?\n if resource.persisted?\n if resource.active_for_authentication?\n set_flash_message :notice, :signed_up if is_flashing_format?\n sign_up(resource_name, resource)\n respond_with resource, location: after_sign_up_path_for(resource)\n else\n set_flash_message :notice, :\"signed_up_but_#{resource.inactive_message}\" if is_flashing_format?\n expire_data_after_sign_in!\n respond_with resource, location: after_inactive_sign_up_path_for(resource)\n end\n else\n clean_up_passwords resource\n set_minimum_password_length\n respond_with resource\n end\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def new\n @sign_up = SignUp.new\n end",
"def signup\n end",
"def signup\n end",
"def create\n user = build_resource\n\n if user.save\n set_flash_message :notice, :signed_up\n sign_in('user', user)\n respond_with user, :location => after_sign_up_path_for(user)\n else\n clean_up_passwords user\n respond_with user\n end\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource) unless current_user_is_admin?\n end",
"def set_sign_up\n @sign_up = SignUp.find(params[:id])\n end",
"def set_sign_up\n @sign_up = SignUp.find(params[:id])\n end",
"def create\n if params[:user][:password].blank?\n password = SecureRandom.base64(10)\n params[:user][:password] = password\n params[:user][:password_confirmation] = password\n end\n\n # Copied from devise-4.6.1/app/controllers/devise/registrations_controller.rb\n build_resource(sign_up_params)\n\n resource.save\n yield resource if block_given?\n if resource.persisted?\n if resource.active_for_authentication?\n set_flash_message! :notice, :signed_up\n # sign_up(resource_name, resource)\n # respond_with resource, location: after_sign_up_path_for(resource)\n else\n set_flash_message! :notice, :\"signed_up_but_#{resource.inactive_message}\"\n expire_data_after_sign_in!\n # respond_with resource, location: after_inactive_sign_up_path_for(resource)\n end\n\n resource.send_account_created_instructions\n else\n clean_up_passwords resource\n set_minimum_password_length\n # respond_with resource\n end\n @users = User.order(:last_name, :first_name)\n @user = current_user\n\n if @user.nil?\n redirect_to :root, notice: \"You have been signed up. Please check your email to set a password and complete your registration.\"\n else\n render :index\n end\n end",
"def create\n build_resource sign_up_params\n\n resource.save\n yield resource if block_given?\n if resource.persisted?\n if resource.active_for_authentication?\n set_flash_message! :notice, :signed_up\n sign_up resource_name, resource\n if invitation_param && invitation_param != ''\n invitation = Invitation.find_by(token: invitation_param)\n invitation.update! user: current_user\n end\n if participate_param && participate_param != ''\n game = Game.find_by(id: participate_param)\n Invitation.create! user: current_user, game: game if game\n end\n respond_with resource, location: after_sign_up_path_for(resource)\n else\n set_flash_message! :notice,\n :\"signed_up_but_#{resource.inactive_message}\"\n expire_data_after_sign_in!\n respond_with resource,\n location: after_inactive_sign_up_path_for(resource)\n end\n else\n clean_up_passwords resource\n set_minimum_password_length\n respond_with resource\n end\n end",
"def create\n if resource.active_invitation? && !resource.new_record?\n # The user record already existed\n if resource.update(sign_up_params)\n resource.accept_invitation\n\n # Follow the standard Devise logic to sign in\n set_flash_message! :notice, :signed_up\n sign_up(resource_name, resource)\n respond_with resource, location: after_sign_up_path_for(resource)\n else\n # Follow the standard Devise failed registration logic\n clean_up_passwords resource\n set_minimum_password_length\n respond_with resource\n end\n elsif !Rails.configuration.x.recaptcha.enabled || verify_recaptcha(action: 'register')\n\n # Devise doesn't set a flash message for some reason if its going to fail\n # so do it here\n super do |user|\n flash[:alert] = _('Unable to create your account!') unless user.valid?\n\n # Attach the Shib eppn if this is part of an SSO account creation\n hash = session.fetch('devise.shibboleth_data', {})\n if hash.present? && user.valid?\n user.attach_omniauth_credentials(scheme_name: 'shibboleth',\n omniauth_hash: hash)\n end\n end\n else\n flash[:alert] = _('Invalid security check! Please make sure your browser is up to date and then try again')\n end\n end",
"def new\n super\n @title = \"Sign up\"\n logger.debug \"\\n\\t RegistrationsController#new \\n\\n\"\n end",
"def create\n build_resource(sign_up_params)\n\n if resource.save\n yield resource if block_given?\n\n set_flash_message :notice, 'actioncontroller.admin.created' if is_flashing_format?\n #sign_up(resource_name, resource)\n respond_with resource, :location => after_sign_up_path_for(resource)\n\n else\n clean_up_passwords resource\n respond_with resource\n end\n end",
"def create\n\t\tbuild_resource(sign_up_params)\n\t\t@company = Company.new\n\t\t# companies params\n\n\t\t@company.company_name = params[ :company_name ]\n\t\t@company.contact_first_name = params[ :contact_first_name ]\n\t\t@company.contact_last_name = params[ :contact_last_name ]\n\t\t@company.contact_last_m_name = params[ :contact_last_m_name ]\n\t\t@company.contact_employement = params[ :contact_employement ]\t\n\t\t@company.website = params[ :website ]\n\t\t@company.foundation_date = params[ :foundation_date ]\n\t\t@company.rfc = params[ :rfc ]\n\n\t\t# we company type value, since enum is an int and we get a string...\n\t\tif params[ :category ] == \"matriz\"\n\t\t\t@company.category = 0\n\t\telse\n\t\t\t@company.category = 1\n\t\tend\n\n\n\t\tif @company .save\n\t\t\tresource.roleable = @company\n\t\t\tresource.save\n\n\t\t\tyield resource if block_given?\n\t\t\tif resource.persisted?\n\t\t\t\tif resource.active_for_authentication?\n\t\t\t\t\tset_flash_message! :notice, :signed_up\n\t\t\t\t\tsign_up(resource_name, resource)\n\t\t\t\t\trespond_with resource, location: after_sign_up_path_for(resource)\n\t\t\t\telse\n\t\t\t\t\tset_flash_message! :notice, :\"signed_up_but_#{resource.inactive_message}\"\n\t\t\t\t\texpire_data_after_sign_in!\n\t\t\t\t\trespond_with resource, location: after_inactive_sign_up_path_for(resource)\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tclean_up_passwords resource\n\t\t\t\tset_minimum_password_length\n\t\t\t\trespond_with resource\n\t\t\tend\n\t\telse\n\t\t\trender :new\n\t\tend\n\tend",
"def create\n # Slight modification of the devise create function\n build_resource(sign_up_params)\n resource.save\n resource.add_role params[:role]\n\n yield resource if block_given?\n if resource.persisted?\n if resource.active_for_authentication?\n set_flash_message! :notice, :signed_up\n else\n set_flash_message! :notice, :\"signed_up_but_#{resource.inactive_message}\"\n expire_data_after_sign_in!\n end\n else\n clean_up_passwords resource\n set_minimum_password_length\n end\n \n # Gather all users so table can be rendered\n @users = User.all\n render \"manage\"\n end",
"def create\n build_resource(registration_params)\n\n #Find the email entered by the guest in the User table in the database \n @userTemp = User.where(email: resource.email).first\n \n #If user doesn't exist\n if @userTemp.nil?\n\n \t#Save it in the database\n\t if resource.save\n\t set_flash_message :notice, :signed_up\n\t sign_up(resource_name, resource)\n\t respond_with resource, :location => after_sign_up_path_for(resource)\n\t else\n\t #clean_up_passwords\n\t respond_with resource\n\t end\n\telse\n\t\t#If user already exists, go to registration url and show an error message\n\t\tredirect_to new_user_registration_url, :flash => { :error => \"Email already registered! Please Sign Up using another email!\" }\n\tend\n\n end",
"def sign_up\n NexaasID::Resources::SignUp.new(api_token, config)\n end",
"def sign_up_params\n params.require(resource_name).permit(\n :name,\n :email,\n :profile,\n :password,\n :password_confirmation\n )\n end",
"def create\n user = User.new(sign_up_params)\n user.save!\n\n # Check if active for authentication.\n # If it needs mail confirmation, etc.., return false.\n if resource.active_for_authentication?\n # Validate params for authorize.\n if pre_auth.authorizable?\n # TODO: Fase 2, activate below flow.\n # if skip_authorization? || matching_token?\n # auth = authorization.authorize\n # redirect_to auth.redirect_uri\n # else\n # render :new\n # end\n\n # TODO: Fase 2, remove below process.\n result = authorization.authorize\n render json: result.auth, status: 201\n else\n # TODO: Fase 2, return error view.\n render json: pre_auth.error_response.body, status: 400\n end\n else\n render json: \"mail okuttayo\", status: 201\n end\n end",
"def create\n build_resource\n\n resource = User.create(filtered_params)\n #resource.genPassword # auto gen password\n password = ('0'..'z').to_a.shuffle.first(8).join\n resource.password = password\n\n if resource.save\n sign_up(resource_name, resource)\n UserMailer.sign_up_confirmation_mail(resource, password).deliver\n render json: { success: true, user: resource}, status: 200\n else\n # send 406 - resource not acceptable due to validation issues\n render json: { success: false, errors: resource.errors.full_messages }, status: 406\n end\n\n begin\n #return render json: { status: 200, success: true, user: resource}\n #begin\n # sign_up(resource_name, resource)\n #rescue\n # return render json: { status: 401, success: false}\n #end\n #rescue\n # return render json: { status: 500, success: false, info: resource.errors.full_messages}\n end\n\n #if resource.save\n # if resource.active_for_authentication?\n # sign_up(resource_name, resource)\n # return render json: { status: 200, success: true, user: resource}\n # else\n # expire_session_data_after_sign_in!\n # return render json: { status: 200, success: true, user: resource}\n # end\n #else\n # clean_up_passwords resource\n # # @TODO correct error code\n # return render json: { status: 401, success: false}\n #end\n\n end",
"def create\n build_resource(sign_up_params)\n if resource.save\n expire_session_data_after_sign_in!\n respond_with resource, :location => after_inactive_sign_up_path_for(resource)\n else\n clean_up_passwords resource\n if resource.errors[:email].include?(I18n.t(\"errors.messages.taken\"))\n user = User.where(email: resource.email).first\n if user.active_for_authentication?\n # Send mail that already registered and ready to log in\n user.already_active_user_mail\n elsif user.invitation_token.nil?\n # Is not invited yet? tell him that he is already on the\n # waiting list\n user.already_waiting_mail\n else\n # Probably didn't get the invitation mail. Resend!\n user.re_invite!(:selfrequest)\n end\n resource.errors.clear\n end\n respond_with resource, :location => after_inactive_sign_up_path_for(resource)\n end\n end",
"def new_user\n\t\t@resource = User.new\n\t\t@resource_name = 'user'\n\tend",
"def client_sign_up\n\n end",
"def create\n build_resource\n @users = User.find(:all, :include => :roles) \n debugger\n if resource.save\n if resource.active_for_authentication?\n sign_in(resource_name, resource)\n (render(:partial => 'newuser', :locals => {:user => resource.id}, :layout => false) && return) if request.xhr?\n respond_with resource, :location => after_sign_up_path_for(resource)\n else\n expire_session_data_after_sign_in!\n (render(:partial => 'newuser', :locals => {:user => resource.id}, :layout => false) && return) if request.xhr?\n respond_with resource, :location => after_inactive_sign_up_path_for(resource)\n end\n else\n clean_up_passwords resource\n render :action => :new, :layout => !request.xhr?\n end\n end",
"def create\n build_resource(sign_up_params)\n resource_name.to_s.eql?(\"worker\") && set_attributes_for_worker\n resource_name.to_s.eql?(\"admin\") && set_teams_attributes_for_admin\n resource_saved = resource.save\n yield resource if block_given?\n\n if resource_saved\n redirect_to admins_path, notice: \"#{resource.name.humanize} as #{resource_name.to_s} successfully registered.\"\n else\n clean_up_passwords resource\n @validatable = devise_mapping.validatable?\n @minimum_password_length = resource_class.password_length.min if @validatable\n respond_with resource\n end\n end",
"def sign_up\n @user = User.new(user_params)\n if @user.save\n sign_in(@user)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(signup_params)\n if @user.save\n sign_in @user\n respond_to do |format|\n \tformat.json { render json: @user }\n end\n else\n # render :new\n end\n end",
"def create\n self.resource = warden.authenticate(auth_options)\n if self.resource\n sign_in(resource_name, self.resource)\n render json: {}\n else\n render json: {msg: \"Email или пароль указаны неверно\"}, status: 401\n end\n end",
"def create\n @user = User.new(sign_up_params)\n\t\t@user.permission = 0\n respond_to do |format|\n if @user.save\n format.html { redirect_to url_for({controller: :users, action: :sign_in, id: 0}), notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sign_up\n user = User.new(user_params); user.id = SecureRandom.uuid # genrating secure uuid token\n if user.save\n image_url = \"\"\n image_url = url_for(user.profile_photo) if user.profile_photo.attached?\n render json: { email: user.email, first_name: user.first_name, last_name: user.last_name, profile_photo: image_url, \"UUID\" => user.id, \"Authentication\" => user.authentication_token }, status: 200\n else\n render json: user.errors.messages, status: 400\n end\n rescue StandardError => e # rescue if any exception occurr\n render json: { message: \"Error: Something went wrong... #{e}\" }, status: 400\n end",
"def signup\n @user = User.new\n end",
"def signup\n @user = User.new\n end",
"def signup!(params)\n self.email = params[:user][:email]\n self.name = params[:user][:name]\n self.password = params[:user][:password]\n #save_without_session_maintenance\n end",
"def create\n self.resource = User.find_by(email: sign_in_params[:email])\n\n if resource.persisted?\n if resource.valid_password?(sign_in_params[:password])\n sign_in(resource_name, resource) # Update sign in record with Devise method.\n\n payload = {\n sub: resource.id.to_str,\n iat: Time.now.to_i,\n exp: Time.now.to_i + 24 * 60 * 60,\n }\n\n token = JwtService.encode(payload: payload)\n\n response['Authorization'] = token\n render json: { current_user: resource }\n else\n # binding.pry\n render json: { errors: \"Incorrect username or password.\" }\n end\n else\n # binding.pry\n render json: { errors: resource.errors.messages }\n end\n\n end",
"def create\n @sign_up = SignUp.new(params[:sign_up])\n\t@referer ||= request.env['HTTP_REFERER']\n\t@sign_up.ip_address = request.remote_ip\n @sign_up.user_agent = request.env['HTTP_USER_AGENT']\n @sign_up.referer = @referer\n\n respond_to do |format|\n if @sign_up.save\n format.html { render :action => \"thanks\", :notice => 'Sign up was successful.' }\n #redirect_to :thanks\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @sign_up.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n # super\n self.resource = warden.authenticate!(auth_options)\n set_flash_message!(:notice, :signed_in)\n \n if resource\n user = resource\n sign_in(resource_name, resource)\n else\n user = User.find_by_email(params[:user][:email])\n sign_in(user, scope: :user) \n end\n \n profile = Profile.new\n profile.app_name = ''\n profile.desc = ''\n profile.tel = ''\n profile.app_email = ''\n user.profile = profile\n profile.save\n\n yield resource if block_given?\n render status: :ok, json: {\"user\": user, \"token\": user.token(user.id)}\n # respond_with resource, location: after_sign_in_path_for(resource)\n end",
"def create\n @sign_up_user = SignUpUser.new(sign_up_user_params)\n # @sign_up_user = SignUpUser.new(user_params)\n\n respond_to do |format|\n if @sign_up_user.save\n format.html { redirect_to @sign_up_user, notice: 'Sign up user was successfully created.' }\n format.json { render action: 'show', status: :created, location: @sign_up_user }\n else\n format.html { render action: 'new' }\n format.json { render json: @sign_up_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def signup_info\n end",
"def after_sign_up_path_for(resource)\n super(resource)\n end",
"def after_sign_up_path_for(resource)\n super(resource)\n end",
"def create\n\t\t# check first if captcha is needed (not a user / captcha is disabled)\n\t\tif (!current_user && Rails.application.config.captcha)\n\t\t\tif (!verify_recaptcha)\n\t\t\t\tbuild_resource\n\t\t clean_up_passwords resource\n\t\t flash.now[:alert] = \"There was an error with the recaptcha code below. Please re-enter the code.\" \n\t\t flash.delete :recaptcha_error\n\t\t render :new\n\t\t return\n\t\t\tend\n\t\tend\n\n\t\t\n\t\tbuild_resource(sign_up_params)\n\n\n\t\t# now verify this user can create such user under this account\n\t\tauthorize! :create, resource\n\n\t\tresource.roles << [:account_admin, :user, (params[:roles] == 'Agency' ? :agency : :creditor)]\n\t\t\n\t\t# now we create the accout to connect the user to\n\t\tif resource.has_role? :agency\n\t\t\tnew_account = Agency.new(name: resource.name)\t\n\t\telse\n\t\t\tnew_account = Creditor.new(name: resource.name)\n\t\tend\n\n\t\tnew_account.resolve_address\n\t\tnew_account.users << resource\n\t\t\n\t\tif new_account.save\n\t\t\tif resource.active_for_authentication?\n\t\t\t\tset_flash_message :notice, :signed_up if is_navigational_format?\n\t\t\t\tsign_up(resource_name, resource)\n\t\t\t\trespond_with resource, :location => after_sign_up_path_for(resource)\n\t\t\telse\n\t\t\t\tset_flash_message :notice, :\"signed_up_but_#{resource.inactive_message}\" if is_navigational_format?\n\t\t\t\texpire_session_data_after_sign_in!\n\t\t\t\trespond_with resource, :location => after_inactive_sign_up_path_for(resource)\n\t\t\tend\n\t else\n\t\t\tclean_up_passwords resource\n\t\t\trespond_with resource\n\t end\n\tend",
"def create\n self.resource = warden.authenticate!(auth_options)\n if resource.save\n p \"resource could save!\"\n p \"============================\"\n respond_to do |format|\n format.html {\n yield resource if block_given?\n if resource.active_for_authentication?\n set_flash_message :notice, :signed_up if is_flashing_format?\n sign_up(resource_name, resource)\n respond_with resource, :location => after_sign_up_path_for(resource)\n else\n set_flash_message :notice, :\"signed_up_but_#{resource.inactive_message}\" if is_flashing_format?\n expire_data_after_sign_in!\n respond_with resource, :location => after_inactive_sign_up_path_for(resource)\n end\n }\n format.js {\n flash[:notice] = \"Created account, signed in.\"\n render :template => \"remote_content/devise_success_sign_up.js.erb\"\n flash.discard\n sign_in(resource_name, resource)\n }\n end\n else\n p \"resource could not save\"\n p \"============================\"\n respond_to do |format|\n format.html {\n clean_up_passwords resource\n respond_with resource\n }\n format.js {\n flash[:alert] = @user.errors.full_messages.to_sentence\n render :template => \"remote_content/devise_errors.js.erb\"\n flash.discard\n }\n end\n end\n end",
"def create\n ret = super\n sign_in(resource.type.underscore, resource.type.constantize.send(:find, resource.id)) unless resource.type.nil?\n ret\n end",
"def signup!(params)\n self.username = params[:user][:username]\n self.email = params[:user][:email]\n save_without_session_maintenance\n end",
"def signup!(params)\n self.username = params[:user][:username]\n self.email = params[:user][:email]\n save_without_session_maintenance\n end",
"def sign_up\n @user = User.new\n end",
"def after_sign_up_path_for(resource)\n super(resource)\nend"
] |
[
"0.73094225",
"0.7143316",
"0.7139352",
"0.7093727",
"0.70841634",
"0.70673263",
"0.70468694",
"0.7030183",
"0.7023876",
"0.70186096",
"0.69935054",
"0.68971246",
"0.6887406",
"0.68824106",
"0.68538487",
"0.6840544",
"0.68178946",
"0.678085",
"0.6775286",
"0.67693114",
"0.67522794",
"0.67522794",
"0.674342",
"0.67292756",
"0.6705626",
"0.67041856",
"0.66873246",
"0.66873246",
"0.66873246",
"0.66873246",
"0.66873246",
"0.66873246",
"0.66873246",
"0.66873246",
"0.66873246",
"0.66873246",
"0.66873246",
"0.66873246",
"0.66873246",
"0.66873246",
"0.66873246",
"0.66873246",
"0.66873246",
"0.66873246",
"0.66873246",
"0.66822094",
"0.6681146",
"0.6658116",
"0.6650117",
"0.66221964",
"0.66102046",
"0.6600783",
"0.656057",
"0.6548698",
"0.6533945",
"0.65074515",
"0.6476828",
"0.6476828",
"0.6451938",
"0.6443574",
"0.63903385",
"0.63903385",
"0.6356583",
"0.63310057",
"0.63278073",
"0.6288284",
"0.6263418",
"0.62581813",
"0.6235311",
"0.62229204",
"0.6214051",
"0.6169716",
"0.6137899",
"0.6118071",
"0.60997146",
"0.6062427",
"0.6062006",
"0.60617286",
"0.60550195",
"0.6027077",
"0.6021032",
"0.60055876",
"0.6002151",
"0.5991716",
"0.59869874",
"0.59869874",
"0.5958886",
"0.5954261",
"0.5939777",
"0.59377027",
"0.59364736",
"0.5935886",
"0.5934189",
"0.5934189",
"0.59286183",
"0.59280765",
"0.5921258",
"0.5917678",
"0.5917678",
"0.5915225",
"0.590679"
] |
0.0
|
-1
|
Lambda needed for number of files scanned, which will be displayed to update user
|
def increase_by(i)
start = 0
lambda { start += i }
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def total_views_per_file_path\n iterate_over_file_paths.group_by { |x| x }.map { |k, v| [k, v.count] }\n end",
"def parse_remaining_files; end",
"def file_count\n source_dir = Item.new(Path.new(params[:source]))\n type = params[:type]\n\n response = {}\n response[:source_dir] = source_dir\n file_count = source_dir.path.file_count(file_type: type)\n \n if file_count\n response[:msg] = \"Success\"\n response[:file_count] = file_count\n else\n response[:msg] = \"Fail\"\n end\n render json: response\n end",
"def total_filesize_count(folder_name)\n\n # You will fill in something here. Remember that the method only\n # gets the folder name, not the folder handle. So the method needs\n # to first create the corresponding handle object.\n\nend",
"def report(count)\n puts \"#{$count} html files were processed to #{Dir.getwd}/pages.csv\"\nend",
"def number_of_files\n\t\tassets.length\n\tend",
"def number_of_documents_from_caseflow\n count = Document.where(file_number: veteran_file_number).size\n (count != 0) ? count : number_of_documents\n end",
"def num_files_total\n command_string = 'find '+@install_root+' | wc -l'\n inspec.bash(command_string).stdout.split(\"\\n\")[0].strip.to_i\n end",
"def instance_count\n repository.files(:pattern => /.rb/).map do |file|\n content = repository.read(file)\n count_calls(:def,content)\n end.sum\n end",
"def misc_directory_file_count\n self.directory_listings.non_primary_data.map {|d| d.files.size}.reduce(0, :+)\n end",
"def count_layer_check_files\n %w[01 02 03].map do |number|\n folder = File.join('data', 'layer_check', \"build-#{number}\")\n puts \"CHECK #{folder}\"\n num_states = 0\n LayerPartInfoName.glob(folder).each do |layer_part_info|\n info_string = File.read(File.join(folder, layer_part_info.to_s))\n info = JSON.parse(info_string)\n num_states += info['num_states'].to_i\n end\n puts number_with_comma(num_states)\n puts num_states / (30.0 * 24 * 3600)\n num_states\n end\nend",
"def count\n coverable_files.size\n end",
"def filter \n # get files contained in the list and also in db\n # ==> files to eliminate\n count = 0\n f = @files.values.flatten(1)\n saved = @current_source.schema.filter_files f\n @files.keys.each do |folder|\n files = @files[folder]\n ocount = files.size\n files -= saved\n ncount = files.size\n @files[folder] = files\n Logger.<<(__FILE__,\"INFO\",\"Filtering (#{folder}) : #{ocount} => #{ncount}\")\n count += ncount\n end\n return count\n end",
"def primary_data_file_count\n study_file_count = self.study_files.primary_data.size\n directory_listing_count = self.directory_listings.primary_data.map {|d| d.files.size}.reduce(0, :+)\n study_file_count + directory_listing_count\n end",
"def max_files; end",
"def num_files_owned_by_user(in_user_name)\n command_string = 'find '+@install_root+' -user '+in_user_name+' | wc -l'\n inspec.bash(command_string).stdout.split(\"\\n\")[0].strip.to_i\n end",
"def added_files\n file_stats.count { |file| file.status == :added }\n end",
"def proc_count()\n @proc_cnt\n end",
"def total_file_count\n self.study_files.non_primary_data.count + self.primary_data_file_count\n end",
"def file_counter\n Dir.glob(File.join(\"Goal/\", '**', '*')).select { |file| File.file?(file) }.count + 1\nend",
"def total_unique_views_per_file_path\n iterate_unique_views.group_by { |x| x }.map { |k, v| [k, v.count] }\n end",
"def word_count_a_file(file_path)\nend",
"def get_file_count_from_response(response)\n response.values.map {|entry| entry[:total_files]}.reduce(&:+)\nend",
"def count\n cnt = 0\n begin\n if block_given?\n scanner = htable.getScanner(filtered_scan)\n scanner.each do |result|\n cnt += 1 if yield(Result.send(:new, result))\n end\n else\n scanner = htable.getScanner(filtered_scan_minimum)\n scanner.each { cnt += 1 }\n end\n ensure\n scanner.close if scanner\n end\n cnt\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 uploaded_images_count\n fog_storage = get_fog_storage\n bucket = get_bucket\n \n directory = fog_storage.directories.get(bucket)\n \n images_count = 0 \n \n directory.files.each do |file|\n \n if ( file.key.to_s.start_with? \"uploads/quiz/#{quiz_id}/quiz_question_images/\")\n images_count += 1\n end \n end\n \n return images_count\n end",
"def user_count; end",
"def archive_file_count\n Dir.glob('*', base: mounted_path).length\n end",
"def count\n dir = '/Users/zzygis/lab/tekstai/stenogramos/'\n Dir.foreach(dir) do |f_sn|\n current_dir = dir + f_sn + '/'\n if current_dir =~ /\\d+/ then\n Dir.foreach(dir + f_sn) do |f_sp| \n yield f_sn, current_dir + f_sp if f_sp.include? '.txt'\n end\n end\n end\nend",
"def count; end",
"def count; end",
"def count; end",
"def signups_count\n if File.exists?('./tmp/signup')\n Dir['./tmp/signup/*'].count\n else\n 0\n end\nend",
"def count\n end",
"def count\n end",
"def test_run_num_files\n\t\tf = FolderWalker.new(\"./TestFolders/\")\n\t\tf.run\n\t\tassert_equal(6,f.files.length)\n\tend",
"def counters\n {\n files: files_count,\n apps: apps_count,\n workflows: workflows_count,\n jobs: jobs_count,\n members: members_count,\n }\n end",
"def count_total_lines files\n files.each do |f, k|\n lines_output = `wc -l #{f.to_s}`\n if $? != 0 then\n raise 'Error in counting total lines.'\n end\n lines_count = lines_output.strip.split(' ')[0].to_i\n k['total_lines'] = lines_count\n end\n return files\n end",
"def user_song_uploads_total\r\n self.user_song_uploads.count\r\n end",
"def append_file_count(files)\n file_size = files.size\n\n label_count =\n (file_size == 0 || file_size > 1) ? \"#{file_size} files\" : '1 file'\n\n @label = \"#{@label} (#{label_count})\"\n end",
"def dir_file_count\n directory = APP_CONFIG['import_maps_sftp_path']\n count = Dir[File.join(directory, '**')].count { |file| File.file?(file) }\n\n return count\n end",
"def request_count=(_arg0); end",
"def request_count; end",
"def file_watcher; end",
"def file_watcher; end",
"def file_count\n return unless exists?\n Dir.glob(folder_pathname.join(\"**\")).count do |file|\n File.file?(file)\n end\n end",
"def filestotal\r\n\t\t\t`#{BITS::BITSADMIN} /getfilestotal {#{@id}}`\r\n\t\tend",
"def upload_files\n # Get list of files do be added\n number_of_files = 0\n paths = []\n Find.find(START_DIR) do |path|\n if FileTest.directory?(path)\n next\n else\n paths.push(path)\n number_of_files += 1\n end\n end\n\n puts \"Uploading #{number_of_files} files.\"\n paths.each do |path|\n upload path\n end #do\n puts \"#{number_of_files} files uploaded.\"\nend",
"def scan_now\n #Check for add/modify\n scan_dir(@directory)\n \n # Check for removed files\n if @on_remove.respond_to?( :call )\n @known_file_stats.each_pair{ |path,stats|\n next if File.file?( path )\n stats[:path] = path\n @on_remove.call( stats )\n @known_file_stats.delete(path)\n }\n end\n \n @scanned_once = true\n end",
"def count\n `wc -l < #{filepath}`.to_i - 1\n end",
"def sizeOnDisk(someFile)\n #get directory\n #size of file in directories\n #add\n return Dir.glob(File.join(someFile, '**', '*')).map{|f| File.size(f)}.inject(:+)\nend",
"def counters\n return {} if object.guest?\n\n {\n files: files_private_count,\n folders: folders_private_count,\n apps: apps_private_count,\n workflows: workflows_count,\n jobs: jobs_count,\n assets: assets_count,\n notes: notes_count,\n }\n end",
"def bundleTimestampFileCount(dest_folder,new_timestamp,max_count)\n ts=new_timestamp\n fileCount=0\n deletedFileList=\"\"\n @files = Dir.glob(dest_folder+\"**/**\")\n for file in @files\n if(fileCount>max_count)\n ts=ts+60\n fileCount=0\n end\n if file.to_s().end_with?(\"searchDB.sql\") \n File.utime(new_timestamp, new_timestamp, file)\n elsif file.to_s().end_with?(\"Deleted_List.list\")\n deletedFileList=file \n else\n File.utime(ts, ts, file)\n fileCount=fileCount+1\n end\n end \n File.utime(ts, ts, deletedFileList)\nend",
"def getTorrentFileCount(infoHash)\n return @rpc.call('d.get_size_files', infoHash)\n end",
"def modified_files\n file_stats.count { |file| file.status == :modified }\n end",
"def watchable_files; end",
"def page_count\n file_groups\n @highest_page_count\n end",
"def filesize; end",
"def processor_count; end",
"def processor_count; end",
"def count\n run.count\n end",
"def count_number_of_lines(change_to_dir)\n Dir.chdir(change_to_dir)\n puts Dir.pwd.blue \n content = Dir.glob(\"*\")\n cur_dirs = []\n content.each do |file|\n file = \"#{Dir.pwd}/#{file}\"\n\n if File.directory?(file)\n cur_dirs << file\n else\n n = File.readlines(file).size\n print \"#{file} \"\n print \" #{n} lines\\n\".green\n end\n end\n cur_dirs.each do |dir| \n count_number_of_lines(dir)\n end\n\nend",
"def count_with_file(filename)\n return if ::ServiceMock.disable_stubs\n yield self if block_given?\n content = File.open(filename, 'rb') { |file| file.read }\n count(content)\n end",
"def file_stats\n\t\ttest_parser = PbfParser.new(file)\n\t\tunless test_parser.nodes.empty?\n\t\t\t@n_count+= test_parser.nodes.size\n\t\tend\n\t\tunless test_parser.ways.empty?\n\t\t\t@w_count+= test_parser.ways.size\n\t\tend\n\t\tunless test_parser.relations.empty?\n\t\t\t@r_count+= test_parser.relations.size\n\t\tend\n\t\twhile test_parser.next\n\t\t\tunless test_parser.nodes.empty?\n\t\t\t\t@n_count+= test_parser.nodes.size\n\t\t\tend\n\t\t\tunless test_parser.ways.empty?\n\t\t\t\t@w_count+= test_parser.ways.size\n\t\t\tend\n\t\t\tunless test_parser.relations.empty?\n\t\t\t\t@r_count+= test_parser.relations.size\n\t\t\tend\n\t\tend\n\t\tputs \"=============================================================\"\n\t\tputs \"Nodes: #{n_count}, Ways: #{w_count}, Relations: #{r_count}\\n\"\n\t\tputs \"=============================================================\\n\"\n\tend",
"def size\n @file_list.size\n end",
"def regular_files\n quarter_months.collect(&:regular_files).sum.to_i\n end",
"def count\n @count ||= begin\n Grim.processor.count(@path)\n end\n end",
"def compute_count\n @compute_count||=0\n end",
"def define_method_count\n repository.files.map do |file|\n content = repository.read(file)\n content.to_s.scan(/define_method/).size\n end.sum\n end",
"def count_errors files\n ActiveRecord::Base.connection_pool.with_connection do \n @repo.code_reviews.each do |review|\n if files.has_key?(review.file_path)\n files[review.file_path]['total_errors'] += 1\n error_lines = (review.line_end - review.line_begin) + 1\n files[review.file_path]['lines_with_error'] += error_lines\n review.code_category.each do |category|\n files[review.file_path]['categories'][category.name]['total_errors'] += 1\n files[review.file_path]['categories'][category.name]['lines_with_error'] += error_lines\n end\n end\n end\n end\n return files\n end",
"def file_count(path, ext = 'scss')\n file_list(path, ext).length\n end",
"def send_count\n repository.files.map do |file|\n content = repository.read(file)\n content.to_s.scan(/send/).size\n end.sum\n end",
"def file_watcher=(_arg0); end",
"def file_watcher=(_arg0); end",
"def size\n @files.size\n end",
"def line_count\n `wc -l public/HelloWorld.txt`.to_i\n end",
"def CountFiles\n\t\tchildrenFiles = []\n\t\tcwd = File.dirname(__FILE__) # get parent directory from our script\n\t\tchildrenFiles = Dir.glob(cwd + '/**/*').select{ |e| File.file? e }\n\n\t\tchildrenFiles.each do |file|\n\t\t\tif File.extname(file).empty?\n\t\t\t\t@count += 1\n\t\t\t\t@files.push(file)\n\t\t\tend\n\t\tend\n\tend",
"def size; file_log.size(file_rev); end",
"def total_count(file)\n file_obj = File.new(file,'r')\n file_obj.readlines.size\n end",
"def flay_count filename\n count = `flay #{filename}|grep #{filename}|wc -l`\n return count.chomp.to_i\n end",
"def count\n each.count\n end",
"def update_limit_check(final_book_zip,prod_folder) \n book_size=File.size(final_book_zip)\n accepted_size=(book_size*@max_update_limit.to_i())/100\n update_size=0\n @files = Dir.glob(prod_folder+\"**/**\")\n for file in @files\n if !File::directory?(file )\n if file.to_s()!=final_book_zip\n update_size= update_size+File.size(file)\n end\n end\n end \n if update_size>accepted_size\n delete_update_folder(update_size-accepted_size,prod_folder,final_book_zip)\n end\nend",
"def counting\n puts \"hard to do right\"\n end",
"def count\n @count ||= begin\n ARGV.each { |a| task a.to_sym do ; end }\n Integer(ARGV[1]) rescue 0 >0 ? ARGV[1].to_i : 10\n end\n @count\n end",
"def process_images(data, image_count, max_image_count)\n data.each do |image|\n return image_count if image_count >= max_image_count\n print_image(image)\n image_count += 1\n end\n image_count\nend",
"def count_objects(key)\n\n puts \"Bucket: #{@bucket_name} - key: #{key}\\n\"\n\n files = @client.buckets[@bucket_name].\n objects.with_prefix(key)\n\n count = 0\n files.each do |o|\n count += 1\n end\n puts \"Count of files in #{@bucket_name}/#{key}: #{count}\"\n return count\n end",
"def count_documents_function\n \"function(keys, values) {\n return values.length;\n }\"\n end",
"def total_upload_mass\n number_to_human_size(self.works.all.sum(:file_size))\n end",
"def fi_scan\n FileObj.all.each do |fo|\n fd = File.open(fo.abs_path)\n if dirty?(fo, fd)\n\t\t\t\twarn\n\t\t\t\tnotify_admin fo if CONFIG['notify_admin']\n\t\t\telse\n\t\t\t\tclean\n\t\t\tend\n puts fo.abs_path\n end\n end",
"def countItems( dir )\n if $options[:verbose]\n STDOUT.puts \"DEBUG: Counting files in [#{dir}]\"\n end\n\n count = 0\n Dir.foreach( dir ) do |item|\n next if item == \".\" or item == \"..\"\n count += 1\n fullPath = File.join( dir, item )\n count += countItems( fullPath ) if File.directory? fullPath\n end\n return count\nend",
"def countItems( dir )\n if $options[:verbose]\n STDOUT.puts \"DEBUG: Counting files in [#{dir}]\"\n end\n\n count = 0\n Dir.foreach( dir ) do |item|\n next if item == \".\" or item == \"..\"\n count += 1\n fullPath = File.join( dir, item )\n count += countItems( fullPath ) if File.directory? fullPath\n end\n return count\nend",
"def file_count(dir_path)\n Dir.entries(dir_path).count - 2\n end",
"def main()\n res = @s.execute_get(@s.url_for(\"var/search/needsprocessing.json\"))\n unless res.code == '200'\n raise \"Failed to retrieve list to process [#{res.code}]\"\n end\n\n process_results = JSON.parse(res.body)['results']\n log \"processing #{process_results.size} entries\"\n unless process_results.size > 0\n return\n end\n\n # Create some temporary directories.\n Dir.mkdir DOCS_DIR unless File.directory? DOCS_DIR\n Dir.mkdir PREV_DIR unless File.directory? PREV_DIR\n Dir.mkdir PDFS_DIR unless File.directory? PDFS_DIR\n\n # Create a temporary file in the DOCS_DIR for all the pending files and outputs all the filenames in the terminal.\n Dir.chdir DOCS_DIR\n queued_files = process_results.collect do |result|\n FileUtils.touch result['_path']\n end\n\n log \" \"\n log \"Starts a new batch of queued files: #{queued_files.join(', ')}\"\n\n Dir['*'].each do |id|\n FileUtils.rm_f id\n log \"processing #{id}\"\n\n begin\n meta_file = @s.execute_get @s.url_for(\"p/#{id}.json\")\n unless meta_file.code == '200'\n raise \"Failed to process: #{id}\"\n end\n\n meta = JSON.parse meta_file.body\n mime_type = meta['_mimeType']\n given_extension = meta[\"sakai:fileextension\"]\n extension = determine_file_extension_with_mime_type(mime_type, given_extension)\n filename = id + extension\n log \"with filename: #{filename}\"\n\n if ignore_processing?(mime_type) || extension.eql?('')\n if extension.eql?('')\n log \"ignoring processing of #{filename}, no preview can be generated for files without a known mime type\"\n log \"The file's original extension was #{given_extension}, and it's mime type is #{mime_type}\"\n else\n log \"ignoring processing of #{filename}, no preview can be generated for #{mime_type} files\"\n end\n else\n # Making a local copy of the file.\n content_file = @s.execute_get @s.url_for(\"p/#{id}\")\n unless ['200', '204'].include? content_file.code\n raise \"Failed to process file: #{id}, status: #{content_file.code}\"\n end\n File.open(filename, 'wb') { |f| f.write content_file.body }\n\n if process_as_image? extension\n extension = output_extension extension\n page_count = 1\n filename_thumb = 'thumb' + extension\n\n content = resize_and_write_file filename, filename_thumb, 900\n post_file_to_server id, content, :normal, page_count, extension\n\n content = resize_and_write_file filename, filename_thumb, 180, 225\n post_file_to_server id, content, :small, page_count, extension\n\n FileUtils.rm_f DOCS_DIR + \"/#{filename_thumb}\"\n else\n begin\n # Check if user wants autotagging\n user_id = meta[\"sakai:pool-content-created-for\"]\n user_file = @s.execute_get @s.url_for(\"/system/me?uid=#{user_id}\")\n unless user_file.code == '200'\n raise \"Failed to get user: #{uid}\"\n end\n user = JSON.parse(user_file.body)\n if user[\"user\"][\"properties\"][\"isAutoTagging\"] != \"false\"\n # Get text from the document\n Docsplit.extract_text filename, :ocr => false\n text_content = IO.read(id + \".txt\")\n terms = extract_terms(text_content)\n tags = \"\"\n terms.each_with_index do |t, i|\n tags += \"- #{t}\\n\"\n terms[i] = \"/tags/#{t}\"\n end\n # Generate tags for document\n @s.execute_post @s.url_for(\"p/#{id}\"), {':operation' => 'tag', 'key' => terms}\n log \"Generate tags for #{id}, #{terms}\"\n admin_id = \"admin\"\n origin_file_name = meta[\"sakai:pooled-content-file-name\"]\n if not terms.nil? and terms.length > 0 and user[\"user\"][\"properties\"][\"sendTagMsg\"] and user[\"user\"][\"properties\"][\"sendTagMsg\"] != \"false\"\n msg_body = \"We have automatically added the following tags for #{origin_file_name}:\\n\\n #{tags}\\n\\nThese tags were created to aid in the discoverability of your content.\\n\\nRegards, \\nThe Sakai Team\"\n @s.execute_post(@s.url_for(\"~#{admin_id}/message.create.html\"), {\n \"sakai:type\" => \"internal\",\n \"sakai:sendstate\" => \"pending\",\n \"sakai:messagebox\" => \"outbox\",\n \"sakai:to\" => \"internal:#{user_id}\",\n \"sakai:from\" => \"#{admin_id}\",\n \"sakai:subject\" => \"We've added some tags to #{origin_file_name}\",\n \"sakai:body\" => msg_body,\n \"_charset_\" => \"utf-8\",\n \"sakai:category\" => \"message\"\n })\n log \"sending message from #{admin_id} user to #{user_id}\"\n end\n end\n rescue Exception => msg\n log \"failed to generate document tags: #{msg}\", :warn\n end\n\n # Generating image previews of the document.\n if only_first_page? extension\n Docsplit.extract_images filename, :size => '1000x', :format => :jpg, :pages => 1\n else\n Docsplit.extract_images filename, :size => '1000x', :format => :jpg\n end\n\n # Skip documents with a page count of 0, just to be sure.\n next if Dir[id + '_*'].size == 0\n\n Dir.mkdir PREV_DIR + \"/#{id}\" unless File.directory? PREV_DIR + \"/#{id}\"\n\n # Moving these previews to another directory: \"PREVS_DIR/filename/index.jpg\".\n Dir[id + '_*'].each_with_index do |preview, index|\n FileUtils.mv \"#{id}_#{index + 1}.jpg\", \"#{PREV_DIR}/#{id}/#{index}.jpg\"\n end\n\n Dir.chdir PREV_DIR + \"/#{id}\"\n page_count = Dir[\"*\"].size\n\n # Upload each preview and create+upload a thumbnail.\n for index in (0..page_count - 1)\n filename_p = \"#{index}.jpg\"\n # Upload the generated preview of this page.\n nbytes, content = File.size(filename_p), nil\n File.open(filename_p, \"rb\") { |f| content = f.read nbytes }\n post_file_to_server id, content, :large, index + 1\n\n # Generate 2 thumbnails and upload them to the server.\n filename_thumb = File.basename(filename_p, '.*') + '.normal.jpg'\n content = resize_and_write_file filename_p, filename_thumb, 700\n post_file_to_server id, content, :normal, index + 1\n\n filename_thumb = File.basename(filename_p, '.*') + '.small.jpg'\n content = resize_and_write_file filename_p, filename_thumb, 180, 225\n post_file_to_server id, content, :small, index + 1\n end\n\n FileUtils.remove_dir PREV_DIR + \"/#{id}\"\n end\n # Pass on the page_count\n @s.execute_post @s.url_for(\"p/#{id}\"), {\"sakai:pagecount\" => page_count, \"sakai:hasPreview\" => \"true\"}\n\n # Change to the documents directory otherwise we won't find the next file.\n Dir.chdir DOCS_DIR\n end\n\n #SAKAI TO PDF\n # We check if mimetype is sakaidoc\n if(mime_type == \"x-sakai/document\")\n if (File.exist?(\"../wkhtmltopdf\"))\n # Go to PDF Dir\n Dir.chdir PDFS_DIR\n\n #delay in secs\n $delay = \"20\"\n\n #filename with extension\n filename_p = id + \".pdf\"\n\n # We parse the structure data to var structure (we do not need the rest)\n structure = JSON.parse meta['structure0']\n\n # Create var and add beginning of code line to run\n line = \"../wkhtmltopdf \"\n\n # Go through structure and add the pagelink for each page id\n structure.each do |page|\n link = \"content#l=\" + page[0] + \"&p=\" + id\n link = @s.url_for(link)\n link = \"'\" + link + \"' \"\n line += link\n end\n\n # Fetch cookie value to get access to all content\n # USERNAME PASSWORD SERVER\n $username = \"admin\"\n auth = \"../auth.sh \" + $username + \" \" + $pw + \" \" + $preview_referer\n cookietoken = `#{auth}`\n\n # Append end of line containing arguments for print css, delay and authentication\n line += filename_p + \" --print-media-type --redirect-delay \" + $delay + \"000 --cookie 'sakai-trusted-authn' \" + cookietoken\n\n # Run the command line (run wkhtmltopdf)\n `#{line}`\n\n # We read the content from the pdf in the PDF directory\n content = open(filename_p, 'rb') { |f| f.read }\n\n # We post it to server through this function\n post_pdf_to_server id, content\n @s.execute_post @s.url_for(\"p/#{id}\"), {\"sakai:processing_failed\" => \"false\"}\n #Change dir\n Dir.chdir DOCS_DIR\n else\n @s.execute_post @s.url_for(\"p/#{id}\"), {\"sakai:processing_failed\" => \"true\"}\n log \"PDF Converter (wkhtmltopdf) not present in directory\"\n log \"Cannot convert Sakai document to PDF\"\n log \"Continuing without conversion\"\n end\n end\n rescue Exception => msg\n # Output a timestamp + the error message whenever an exception is raised\n # and flag this file as failed for processing.\n log \"error generating preview/thumbnail (ID: #{id}): #{msg.inspect}\\n#{msg.backtrace.join(\"\\n\")}\", :warn\n @s.execute_post @s.url_for(\"p/#{id}\"), {\"sakai:processing_failed\" => \"true\"}\n ensure\n # No matter what we flag the file as processed and delete the temp copied file.\n @s.execute_post @s.url_for(\"p/#{id}\"), {\"sakai:needsprocessing\" => \"false\"}\n FileUtils.rm_f DOCS_DIR + \"/#{filename}\"\n end\n end\n\n FileUtils.remove_dir PDFS_DIR\n FileUtils.remove_dir PREV_DIR\n FileUtils.remove_dir DOCS_DIR\nend",
"def stat() end",
"def count_changes events, change_counter\n method_events(events).select {|e| e.status != :deleted }\n .group_by(&:method_name)\n .map {|_,es| change_counter.call(es) }\n .reduce(0.0, :+)\nend",
"def number_of_nodes_edited_by_new_mappers\n \t\tnodes_by_new_mappers = Node_Query.new(analysis_window: aw, constraints: {'user' => {'$in' => aw.new_contributors}}).run\n {'Nodes Edited by New Mappers' => nodes_by_new_mappers.first[:objects].length }\n \tend",
"def number_of_nodes_edited_by_new_mappers\n \t\tnodes_by_new_mappers = Node_Query.new(analysis_window: aw, constraints: {'user' => {'$in' => aw.new_contributors}}).run\n {'Nodes Edited by New Mappers' => nodes_by_new_mappers.first[:objects].length }\n \tend",
"def count_public_repos\n @top_ten.each do |user|\n public_repos = self.class.get(\"/users/#{user[0]}/repos?q=visibility:public+created:\\>\\=2015-01-01T00:00:00-07:00\").parsed_response\n user << public_repos.length\n end\n end",
"def get_total_length(filenames)\n shell_formatted_filenames = Shellwords.join filenames\n res = `afinfo -b #{shell_formatted_filenames}` # total info\n length = 0\n res.lines{|l| length = length + l.split.first.to_f if l.split.first.to_f}\n length\n end",
"def file_stats\n @stats = @ff.get_stats\n end",
"def count\n load\n @result_count\n end"
] |
[
"0.6182283",
"0.61806554",
"0.6175058",
"0.61569154",
"0.60688233",
"0.5996847",
"0.5982496",
"0.5973599",
"0.59651846",
"0.59515804",
"0.5921781",
"0.58880675",
"0.5874029",
"0.5843044",
"0.58203965",
"0.58097774",
"0.57933515",
"0.57842255",
"0.57836914",
"0.5776995",
"0.5771241",
"0.5769793",
"0.573324",
"0.5717444",
"0.5710408",
"0.56906056",
"0.56867987",
"0.5684611",
"0.568215",
"0.56666356",
"0.56666356",
"0.56666356",
"0.56598294",
"0.5653704",
"0.5653704",
"0.5647316",
"0.5631535",
"0.5630939",
"0.5614812",
"0.56080127",
"0.56021863",
"0.559066",
"0.5589312",
"0.55548775",
"0.55548775",
"0.55538595",
"0.5545606",
"0.5544004",
"0.55027395",
"0.54890305",
"0.54875046",
"0.5471397",
"0.54664034",
"0.5452357",
"0.5451047",
"0.5448733",
"0.54442966",
"0.54382104",
"0.5420375",
"0.5420375",
"0.54179657",
"0.54159325",
"0.54147166",
"0.5414477",
"0.54134536",
"0.5407215",
"0.540694",
"0.5406656",
"0.5406463",
"0.54018134",
"0.5392235",
"0.53918004",
"0.5362655",
"0.5362655",
"0.53571725",
"0.5350106",
"0.5347933",
"0.5342504",
"0.5340065",
"0.5336141",
"0.532555",
"0.5316733",
"0.5310284",
"0.53100413",
"0.5306053",
"0.52995634",
"0.5297915",
"0.52978516",
"0.52976674",
"0.52861506",
"0.52861506",
"0.52838886",
"0.5278949",
"0.527814",
"0.52774185",
"0.52771235",
"0.52771235",
"0.52658725",
"0.5261941",
"0.5260285",
"0.52586156"
] |
0.0
|
-1
|
Builds an array of FileName Objects (array of files), and prints to console how many files scanned iterates through each item in the cwd, determines if it's a file if it's a file push it to the an array of FileName objects and print every time it scans another 100 items or it's a directory, cd into dir and recursively call itself
|
def buildArray(localObjCache, increase)
localDirContents=[] #Array of all items in the cwd
localDirContents=Dir[Dir.pwd+"/*"] #Builds the array of items in cwd
localDirContents.each do |item|
if File.file?(item)
fileObj = FileName.new(item)
localObjCache.push(fileObj)
n = increase.call #printing every 100 files scanned
if n % 100 == 0
puts n
end
elsif File.directory?(item)
Dir.chdir(item)
buildArray(localObjCache, increase)
end
end
return localObjCache
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def run_through_directory\n@file_array = []\n Dir.foreach('text_files') do |item|\n next if item == '.' or item == '..'\n @file_array << item\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 scan\n results = []\n dirs.each do |dir|\n files_in_dir = Dir.glob(File.join(dir,'**','*'))\n results.concat(files_in_dir)\n end\n @known_files = results\n end",
"def build_file_list\n puts_and_logs 'Finding files...'\n file_list = []\n config[:source].each do |entry|\n if File.directory?(entry)\n populate_list_of_files_from_directory(file_list, entry) \n next\n end\n if File.file?(entry)\n populate_list_of_files_from_file(file_list, entry) \n next\n end\n logger.warn \"\\\"#{entry}\\\" is neither a directory nor a regular file. Ignored...\"\n end\n logger.debug(file_list)\n file_list\n end",
"def scan(dir,match=/\\.cha$/)\n files = []\n if not dir.split('/').pop =~ /^\\./ and File.directory?(dir)\n Dir.foreach(dir) do |file|\n path = File.join(dir,file)\n \n if File.directory?(path)\n# puts \"SCANNING #{path}\"\n scan(path,match).each { |pair| files.push pair }\n elsif file =~ match\n files.push path\n end\n end\n end\n\n return files\nend",
"def process\n # here is a starting directory\n main_dir = '/home/john/code/ruby/files'\n # let's go to the directory we want\n Dir.chdir(main_dir)\n #print the present working directory (pwd)\n puts Dir.pwd\n # glob is stolen from Perl - list all the \n # matches for the wildcard pattern \"*\"\n listing = Dir.glob(\"*\")\n # put out the list\n puts listing.inspect\n\n\n #let's process the subdirectories and discard other files\n listing.each do |f|\n if File.directory? f\n processDirectory f\n else\n puts \"ignoring file: \" + f\n end\n end\n\n puts @power.inspect\nend",
"def scan_dirs\n @scan_files = Array.new\n Dir.entries(@scan_dir).each do |scan|\n next if File.directory?(@scan_dir + '/' + scan)\n @scan_files << @scan_dir + '/' + scan\n end\n end",
"def find_files\n find_files_recursive(@build_result_dir, '')\n end",
"def count_number_of_lines(change_to_dir)\n Dir.chdir(change_to_dir)\n puts Dir.pwd.blue \n content = Dir.glob(\"*\")\n cur_dirs = []\n content.each do |file|\n file = \"#{Dir.pwd}/#{file}\"\n\n if File.directory?(file)\n cur_dirs << file\n else\n n = File.readlines(file).size\n print \"#{file} \"\n print \" #{n} lines\\n\".green\n end\n end\n cur_dirs.each do |dir| \n count_number_of_lines(dir)\n end\n\nend",
"def findPaths (conf)\n puts aktTime()+' collecting files...'\n STDOUT.flush #write out immediately\n\tconf[:saveDirs].each do |d|\n\t\tif File.directory?(d)\n\t\t\tDir.chdir(d)\n\t\t\tgetFiles(conf)\n\t\telse\n\t\t\tputs \"\\nWarning: Directory: \\n\"+d+\" **not** found !\"\n\t\tend\n\tend\nend",
"def walk\n FileTreeProfiler.monitor_report(:profile, :dir, path)\n @children = []\n Dir.foreach(path) do |entry|\n next if (entry == '..' || entry == '.')\n full_path = ::File.join(path, entry)\n if ::File.directory?(full_path)\n children.push DirFile.new(self, entry)\n else\n children.push DataFile.new(self, entry)\n end\n end\n end",
"def takeFilesNames\nDir['result*.*'].each do |file_name|\n @files_names.push(file_name)\nend\nend",
"def scan_dir (dirname)\n log \"*** Inspect: \" + dirname\n Dir.foreach(dirname) do |filename|\n path_cand = File.join(dirname , filename)\n if File.directory?(path_cand)\n #exams directories\n if (filename != \".\" && filename != \"..\")\n unless @filter_dir.index(filename)\n #directory not filtered\n @explore_dir.push(path_cand)\n @dir_list << path_cand\n end\n end\n else\n # file to be listed\n unless file_is_filtered?(path_cand)\n # file is not filtered\n #p path_cand\n if file_has_admitted_extension?(path_cand)\n @result_list.push(path_cand)\n end\n end\n end #file.directory?\n end\n next_dir = @explore_dir.pop\n scan_dir(next_dir) if next_dir \n end",
"def scan_dir (dirname)\n log \"*** Inspect: \" + dirname\n Dir.foreach(dirname) do |filename|\n path_cand = File.join(dirname , filename)\n if File.directory?(path_cand)\n #exams directories\n if (filename != \".\" && filename != \"..\")\n unless @filter_dir.index(filename)\n #directory not filtered\n @explore_dir.push(path_cand)\n @dir_list << path_cand\n end\n end\n else\n # file to be listed\n unless file_is_filtered?(path_cand)\n # file is not filtered\n @result_list.push(path_cand)\n end\n end #file.directory?\n end\n next_dir = @explore_dir.pop\n scan_dir(next_dir) if next_dir \n end",
"def CountFiles\n\t\tchildrenFiles = []\n\t\tcwd = File.dirname(__FILE__) # get parent directory from our script\n\t\tchildrenFiles = Dir.glob(cwd + '/**/*').select{ |e| File.file? e }\n\n\t\tchildrenFiles.each do |file|\n\t\t\tif File.extname(file).empty?\n\t\t\t\t@count += 1\n\t\t\t\t@files.push(file)\n\t\t\tend\n\t\tend\n\tend",
"def process()\n scan_dir('.', '.')\n end",
"def LoteDeCarga()\n print \" #=============================================================================#\\n\"\n print \"\\tLote de carga en ejecucion...\\n\"\n print \" #-----------------------------------------------------------------------------#\\n\"\n print \"\\tDetectando Cuits...\\n\"\n print \" #-----------------------------------------------------------------------------#\\n\"\n aux = []\n cont = 0\n Dir.chdir(\"C:\\\\SFTP\\\\Tickets\")\n Dir.foreach('.') do |item|\n next if item == '.' or item == '..'\n if File.directory?(item)\n print \"\\tCuit encontrado -> \" + item + \"...\\n\"\n aux[cont] = item\n cont += 1\n end\n end\n return aux\nend",
"def find_files(recusive,sort)\n ext_list = $config[\"series\"][\"media_extentions\"].gsub(/,/,\"|\")\n files = [] \n if File.directory? sort\n Find.find(sort) do |path|\n next if File.dirname(path) != sort and not recusive\n next if File.directory? path\n next if File.basename(path) =~ /^\\./\n next if path !~ /#{ext_list}$/\n files << path\n end\n else\n log(\"error: source directory of \\\"#{sort}\\\" does not exist!\")\n exit 2\n end\n files\nend",
"def files(rootDir)\n Dir.foreach(rootDir) do |dir|\n if dir != \".\" && dir != \"..\"\n puts \"Processing \" + dir\n Dir.foreach(rootDir + \"/\" + dir) do |file|\n if file != \".\" && file != \"..\"\n open(rootDir + \"/\" + dir + \"/\" + file) do |f|\n yield(f)\n end\n end\n end\n end\n end\nend",
"def run_loop(path, report, actionfilter = nil, testcasefilter = nil)\n\n result = begin\n mList = File.file?(path) ? path : path+'.rb'\n mList = Dir.entries(path).select do |x|\n x[0..0] != '.' && ( (x=~ /\\.rb$/) || File.directory?(File.join(path,x)))\n end.map do |x|\n File.join(path,x)\n end if File.directory?(path)\n [*mList].sort! do |a, b|\n case a <=> b\n when -1,1\n case File.file?(a) && File.file?(b)\n when true\n case File.basename(a)\n when /setup/\n -1\n when /teardown/\n 1\n else\n case File.basename(b)\n when /setup/\n 1\n when /teardown/\n -1\n else\n a<=>b\n end\n end\n when false\n if(File.file?(a))\n -1\n else\n 1\n end\n end\n when 0\n 0\n end\n end\n rescue\n result = [path]\n end\n\n #llogger = CLogger.new(path)\n result.each do |x|\n begin\n if(File.directory?(x))\n report = run_loop(x, report, actionfilter, testcasefilter)\n else\n next if (not File.exist?(x))\n next if (testcasefilter && (not testcasefilter.include?(x)))\n puts \"Executing testcase: #{x}\"\n report.testcase += 1\n llogger = CLogger.new(x)\n report = processor(x, report, llogger, actionfilter)\n end\n rescue\n puts $!\n end\n end\n\n if block_given?\n yield report\n else\n report\n end\nend",
"def getfiles path\n\nDir.foreach(path) do |f|\nname=File.basename f\npathn= @to_path + name\n\t\nfilepath =path +\"/\"+ f\n\nputs filepath\n if File.directory? filepath and name != '..' and name != '.' and name != 'new' \n\n Dir.chdir filepath\nstr = Dir.pwd\ngetfiles str\n\nDir.chdir('..')\nelsif File.file? f and name != 'app.rb' \n\tf1 = File.open(f, \"r:binary\")\nf2 = File.open(pathn, \"a:binary\")\n while (b = f1.getc)!= nil do\n \tf2.putc b\nend\n \nf2.close\n\n\nend\n\nend\nend",
"def parse_dir(dir, depth)\n\n # Identify method entry\n debug_print \"#{ self } : #{ __method__ }\\n\"\n\n # Error check on input\n if Watson::FS.check_dir(dir)\n debug_print \"Opened #{ dir } for parsing\\n\"\n else\n print \"Unable to open #{ dir }, exiting\\n\"\n return false\n end\n\n debug_print \"Parsing through all files/directories in #{ dir }\\n\"\n\n # [review] - Shifted away from single Dir.glob loop to separate for dir/file\n # This duplicates code but is much better for readability\n # Not sure which is preferred?\n\n\n # Remove leading . or ./\n _glob_dir = dir.gsub(/^\\.(\\/?)/, '')\n debug_print \"_glob_dir: #{_glob_dir}\\n\"\n\n\n # Go through directory to find all files\n # Create new array to hold all parsed files\n _completed_files = Array.new()\n Dir.glob(\"#{ _glob_dir }{*,.*}\").select { |_fn| File.file?(_fn) }.sort.each do |_entry|\n debug_print \"Entry: #{_entry} is a file\\n\"\n\n\n # [review] - Warning to user when file is ignored? (outside of debug_print)\n # Check against ignore list, if match, set to \"\" which will be ignored\n @config.ignore_list.each do |_ignore|\n if _mtch = _entry.match(_ignore)\n _entry = ''\n break\n end\n end\n\n # If the resulting entry (after filtering) isn't empty, parse it and push into file array\n unless _entry.empty?\n debug_print \"Parsing #{ _entry }\\n\"\n _completed_files.push(parse_file(_entry))\n end\n\n end\n\n\n # Go through directory to find all subdirs\n # Create new array to hold all parsed subdirs\n _completed_dirs = Array.new()\n Dir.glob(\"#{ _glob_dir }{*, .*}\").select { |_fn| File.directory?(_fn) }.sort.each do |_entry|\n debug_print \"Entry: #{ _entry } is a dir\\n\"\n\n # Check if entry is in ignore list\n _skip = false\n\n @config.ignore_list.each do |_ignore|\n if mtch = _entry.match(_ignore)\n _skip = true\n end\n end\n\n debug_print \"#{ _entry } was not on ignorelist, adding\\n\"\n\n # If directory is on the ignore list then skip\n next if _skip == true\n\n ## Depth limit logic\n # Current depth is depth of previous parse_dir (passed in as second param) + 1\n _cur_depth = depth + 1\n debug_print \"Current Folder depth: #{ _cur_depth }\\n\"\n\n # If Config.parse_depth is 0, no limit on subdir parsing\n if @config.parse_depth == 0\n debug_print \"No max depth, parsing directory\\n\"\n _completed_dirs.push(parse_dir(\"#{ _entry }/\", _cur_depth))\n\n # If current depth is less than limit (set in config), parse directory and pass depth\n elsif _cur_depth < @config.parse_depth.to_i + 1\n debug_print \"Depth less than max dept (from config), parsing directory\\n\"\n _completed_dirs.push(parse_dir(\"#{ _entry }/\", _cur_depth))\n\n # Else, depth is greater than limit, ignore the directory\n else\n debug_print \"Depth greater than max depth, ignoring\\n\"\n end\n\n # Add directory to ignore list so it isn't repeated again accidentally\n @config.ignore_list.push(_entry)\n end\n\n\n # [review] - Not sure if Dir.glob requires a explicit directory/file close?\n\n # Create hash to hold all parsed files and directories\n _structure = Hash.new()\n _structure[:curdir] = dir\n _structure[:files] = _completed_files\n _structure[:subdirs] = _completed_dirs\n _structure\n end",
"def create_list_of_files\n @path=find_repository_and_basepath\n @table.window.setTitle(@path)\n files=[]\n Find.find(@path) do |file|\n # we don't want any files from a repository in the list \n next if file=~/(\\.hg|\\.svn|\\.git|\\.pyc)/ \n\n # neither do we want dotfiles in the list\n next if File.basename(file)=~/^\\./ \n \n # file matches, add it to the resulting list\n files << file if FileTest.file?(file)\n\n # wir bauen hier mal einen kleinen Idiotentest ein. Wenn wir mehr\n # als 10000 Dateien gefunden haben dann sind wir vermtl. in einem \n # falschen Verzeichniss und brechen die Suche ab.\n if files.length>10000\n NSRunInformationalAlertPanel('Large directory found!',\n \"Gathered more than 10k files from directory '#{@path}', aborting search!\",'OK',nil,nil)\n NSApp.stop(self)\n raise 'error'\n end\n end\n #@files=files.sort_by { |match| File.basename(match) }\n @files=files.sort\n end",
"def find_sauce_files(cwd=@opts[:basedir], depth=@opts[:search_depth], file_ext=@opts[:sauce_file_extension])\n files = []\n (0..depth).each do |i|\n prefix = \"*/\"*i\n files << Dir.glob(File.join(cwd, \"#{prefix}*#{file_ext}\"))\n end\n return files.flatten.uniq\n end",
"def scan!\n Dir.chdir(@path) do\n Find.find('.') do |file|\n next if file == '.'\n\n # ignore the ./\n file = file[2..-1]\n name = File.basename(file)\n\n # ignore certain files/directories\n Find.prune if IGNORE.include?(name)\n\n if File.directory?(file)\n @directories << file\n elsif File.file?(file)\n src = File.join(@path,file)\n\n case File.extname(name)\n when '.erb'\n # erb template\n if name.start_with?('_')\n # partial template\n template_dir = File.dirname(file)\n template_name = name[1..-1].chomp('.erb').to_sym\n\n @includes[template_dir][template_name] = src\n else\n dest = file.chomp('.erb')\n\n @templates[dest] = src\n end\n else\n # static file\n @files[file] = src\n end\n end\n end\n end\n end",
"def walk(start)\n Dir.foreach(start) do |x|\n path = File.join(start, x)\n if x.match(/^(\\..*)$/)\n next\n elsif File.directory?(path)\n walk(path)\n else\n if m = x.match(/^([\\sA-Za-z\\-!',\\(\\)]*)\\s(\\d{2,3}).*\\.([A-Za-z0-9]*)$/)\n title = m[1]\n issue = m[2]\n ext = m[3]\n elsif\n title = x\n ext = File.extname(path)\n end\n size = File.size(path)\n path = path[7..-1] #cut off the \"public/\" part of the path\n if ext == \"cbr\" || ext == \"cbz\"\n title_id = Title.find_or_create_by!(name: title).id\n if !Comic.exists?(full_path: path)\n Comic.create(full_path: path, title_id: title_id, issue_number: issue, extension: ext, size: size)\n end\n end\n end\n end\nend",
"def walk(start)\n Dir.foreach(start) do |x|\n path = File.join(start, x)\n if x == \".\" or x == \"..\"\n next\n elsif File.directory?(path)\n walk(path)\n else\n if m = x.match(/^([\\sA-Za-z\\-!',\\(\\)]*)\\s(\\d{2,3}).*\\.([A-Za-z0-9]*)$/)\n title = m[1]\n issue = m[2]\n ext = m[3]\n elsif\n title = x\n ext = File.extname(path)\n end\n size = File.size(path)\n path = path[7..-1] #cut off the \"public/\" part of the path\n if ext == \"cbr\" || ext == \"cbz\"\n title_id = title_exist(title)\n if !Comic.exists?(full_path: path)\n Comic.create(full_path: path, title_id: title_id, issue_number: issue, extension: ext, size: size)\n end\n end\n end\n end\nend",
"def files\n i = 0\n @@arr_path.each do |path|\n if path.include?(params[:fold])\n # Remove path from current path\n @@arr_path = @@arr_path[0..i]\n @path = ''\n\n @@arr_path.each do |e| # Put path from array to @path\n @path = @path + e + ' >> '\n end\n @@temp_path = @path\n\n # Get content: folders, file, count\n @content = BrowsingFile.bind_folder params[:fold]\n @file = BrowsingFile.bind_files params[:fold]\n\n render 'index' # Reload index page\n return\n end\n i += 1\n end\n end",
"def get_folder_list\n\n ################################\n # \n # prep: list\n #\n ################################\n #ref __FILE__ http://stackoverflow.com/questions/37101151/what-does-file-program-name-mean-in-ruby\n path = Pathname.new(__FILE__)\n# path = Pathname.new('.')\n \n #ref https://ruby-doc.org/stdlib-2.1.0/libdoc/pathname/rdoc/Pathname.html\n p \"path.dirname => #{path.dirname}\"\n \n dpath = path.dirname\n# dpath = \"c:/works_2\"\n \n #ref http://stackoverflow.com/questions/1899072/getting-a-list-of-folders-in-a-directory\n Dir.chdir(dpath)\n# Dir.chdir(\"c:/works_2\")\n# Dir.chdir(path.dirname)\n# Dir.chdir('/destination_directory')\n# list = Dir.glob('*').select\n# list = Dir.glob('*').select {|f| File.directory? f}\n files = Dir.glob('*').select {|f| File.file? f}\n dirs = Dir.glob('*').select {|f| File.directory? f}\n \n puts\n puts \"[#{__LINE__}] directory => #{dpath}\" \n \n puts\n puts \"[#{__LINE__}] folders ....\"\n p dirs\n \n puts\n puts \"[#{__LINE__}] files ....\"\n p files.sort\n# p files\n \n# p files.methods.sort\n \n# p __FILE__\n \n# target_directory = \n# \n# Dir.chdir('/destination_directory')\n## Dir.chdir('/destination_directory')\n# \n# list = Dir.glob('*').select {|f| File.directory? f}\n# \n# p list\n \n ################################\n # \n # file: write data\n #\n ################################\n time_label = get_time_label(\"serial\")\n \n fname = \"directory_list.#{time_label}.txt\"\n \n f = File.new(fname, \"w\")\n \n # header\n f.write(\"program file path = #{FILE_PATH}\")\n f.write(\"\\n\")\n f.write(\"version = #{VERSION}\")\n f.write(\"\\n\")\n \n f.write(\"list file created at = #{time_label}\")\n f.write(\"\\n\")\n \n f.write(\"dir path = #{dpath}\")\n f.write(\"\\n\")\n f.write(\"dirs = #{dirs.size}\")\n f.write(\"\\n\")\n f.write(\"files = #{files.size}\")\n f.write(\"\\n\")\n f.write(\"\\n\")\n \n # data: dirs\n f.write \"<directories> #{dirs.size}\"\n f.write \"\\n\"\n \n dirs.each do |elem|\n \n f.write(elem)\n f.write(\"\\n\")\n \n end\n \n f.write(\"\\n\")\n f.write(\"\\n\")\n \n # data: files\n f.write \"<files> #{files.size}\"\n f.write \"\\n\"\n\n files.each do |elem|\n \n f.write(elem)\n f.write(\"\\n\")\n \n end\n \n f.close\n \n puts \"[#{__LINE__}] file written => #{fname}\"\n \nend",
"def findFlacFiles()\nflacdirs = Array.new\nDir.foreach(\".\") { |file| \\\n if(File.directory?(file))\n Dir.foreach(file) { |subfile| \\\n if(!subfile[-5..-1].nil?)\n if(subfile[-5..-1] == \".flac\")\n flacdirs << file + \"/\"\n break\n end\n end\n }\n end\n }\n return flacdirs;\nend",
"def GetEnemyDirs()\n\n directories = Dir.entries($enemy_folder)\n\n for i in 0...directories.length do\n\n if not directories[i].include? \".\" then\n $current_folder = $enemy_folder + directories[i]\n GetEnemies($current_folder)\n end\n\n end\n\n ExtractIDs()\nend",
"def process_result_dirs(parent_dir)\n # get all the result dirs in the parent dir\n results_dirs = Dir.glob(\"#{parent_dir}/*/\").sort\n puts \"processing #{results_dirs.length} results directories...\"\n\n # process each result dir\n results_dirs.each do |dir|\n dirname = File.basename(dir)\n puts \"processing results dir: #{dirname}\"\n\n csv_path = \"#{dir}#{dirname}.csv\"\n puts \"csv_path: #{csv_path}\"\n\n # create a summary csv with the headings and last 2 rows\n heading = \"<h1>#{dirname}</h1>\"\n table = extract_table_from_results_csv(csv_path)\n @tables += heading + table unless table.nil?\n end\nend",
"def scan\n glob = File.join(\"**\", Command::FILENAME)\n\n commands = load_path.flat_map do |path|\n path = Pathname.new(path)\n\n path.glob(glob).map do |file|\n root = file.dirname\n name = root.relative_path_from(path)\n name = name.to_s.tr(File::SEPARATOR, Command::SEPARATOR)\n build(name, root.to_s)\n end\n end\n\n commands.sort_by(&:name)\n end",
"def scandir(dir)\n\tfilecount = 0\n\twordcount = 0\n\thist = {}\n\t$part.each{|p| hist[p] = {}}\n\tDir::glob(\"#{dir}/**/*.{tex,txt,doc,docx,pdf}\").each {|fname|\n\t\t$stderr.print \">>>> #{fname}\\n\"\n\t\tbegin\n \t\t\twordcount += mkhist(fname, hist)\n \t\t\tfilecount += 1\n \t\trescue\n \t\tend\n \t}\n \treturn hist, filecount, wordcount\nend",
"def enumerate_files search_path\n Enumerator.new do |e|\n Dir\n .glob(search_path)\n .each do |filename|\n if File.file?(filename)\n $stderr.puts \"Reading #{filename}\" if $verbose\n File.open filename do |file|\n e.yield file.read()\n end\n end\n end\n end\nend",
"def upload_files\n # Get list of files do be added\n number_of_files = 0\n paths = []\n Find.find(START_DIR) do |path|\n if FileTest.directory?(path)\n next\n else\n paths.push(path)\n number_of_files += 1\n end\n end\n\n puts \"Uploading #{number_of_files} files.\"\n paths.each do |path|\n upload path\n end #do\n puts \"#{number_of_files} files uploaded.\"\nend",
"def getFilesInDirCompiler(path)\n files = []\n #search for all of the files in the directory\n Dir.foreach(path) do |filename|\n #dont include parent files\n next if filename == '.' || filename == '..'\n\n #dont include files that are not jack files\n next unless filename.to_s.include?(\"jack\")\n\n #push the file to the list\n files.push(path+\"/\"+filename)\n end\n\n return files\nend",
"def files\n @files = []\n Find.find(@path) do |path|\n if File.directory? path\n if File.basename(path)[0] == ?.\n Find.prune # don't look any further into this directory.\n else\n next\n end\n else\n @files << path\n end\n end\n @files.size\n end",
"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 countItems( dir )\n if $options[:verbose]\n STDOUT.puts \"DEBUG: Counting files in [#{dir}]\"\n end\n\n count = 0\n Dir.foreach( dir ) do |item|\n next if item == \".\" or item == \"..\"\n count += 1\n fullPath = File.join( dir, item )\n count += countItems( fullPath ) if File.directory? fullPath\n end\n return count\nend",
"def countItems( dir )\n if $options[:verbose]\n STDOUT.puts \"DEBUG: Counting files in [#{dir}]\"\n end\n\n count = 0\n Dir.foreach( dir ) do |item|\n next if item == \".\" or item == \"..\"\n count += 1\n fullPath = File.join( dir, item )\n count += countItems( fullPath ) if File.directory? fullPath\n end\n return count\nend",
"def scanDir(dirname, matchfn, callfn, recurse)\n\tDir.foreach(dirname) do |filename|\n\t\tfullfilename = dirname + \"/\" + filename;\n\t\tif File.directory?(fullfilename)\n\t\t\tif recurse && filename != \".\" && filename != \"..\"\t\t# don't infinite loop kthx\n\t\t\t\tscanDir(fullfilename, matchfn, callfn, recurse)\n\t\t\tend\n\t\telsif matchfn.call(filename)\n\t\t\tcallfn.call(fullfilename)\n\t\tend\n\tend\nend",
"def findNewFlowcells()\n @newFC = Array.new\n\n dirList = Dir.entries(@instrDir)\n\n dirList.each do |dirEntry|\n if !dirEntry.eql?(\".\") && !dirEntry.eql?(\"..\") &&\n File::directory?(@instrDir + \"/\" + dirEntry) &&\n isAvailableForCleaning(@instrDir + \"/\" + dirEntry)\n @newFC << dirEntry\n\n puts dirEntry.slice(/[0-9A-Za-z]+$/).gsub(/^[AB]/, \"\") + \" \" + @instrDir + \"/\" + dirEntry\n end\n end \n end",
"def make_inventory\n Dir.glob('**/*').sort.each {|f| puts f}\nend",
"def ls(path) \n ary = Array.new\n Dir.chdir(path) {\n Dir.glob(\"*\").each {|dir|\n ary.push(dir)\n }\n }\n return ary\nend",
"def explore(dir)\n\tterminate if $interrupted\n\tDir.new(dir).each do |node|\n\t\tnode_path = dir + '/' + node\n\t\tif File.directory?(node_path) && !File.symlink?(node_path) && node[0,1] != '.'\n\t\t\texplore node_path\n\t\telsif File.file?(node_path) && node[0] != '.'\n\t\t\tif greppable node_path\n\t\t\t\tif node =~ /#{ARGV[0]}/\n\t\t\t\t\tputs colorize(node_path, 'yellow')\n\t\t\t\t\tStats['name_matches'] += 1\n\t\t\t\tend\n\t\t\t\tgrep_file node_path unless Opts['names']\n\t\t\t\tStats['files_grepped'] += 1\n\t\t\telse\n\t\t\t\tStats['nodes_skipped'] += 1\n\t\t\tend\n\t\telse\n\t\t\tStats['nodes_skipped'] += 1\n\t\tend\n\tend\nend",
"def print_dirties()\n num_dirs = Dir.glob('./*/').size() -2 #exclude . and ..\n count = 0\n output = \"\"\n dirties_found = false\n Dir.glob('./*/').each() do |dir|\n count += 1\n next if dir == '.' or dir == '..'\n\n print \"Examining directories...#{count}/#{num_dirs}\\r\" if !$verbose\n count += 1\n\n if(File.directory?(dir) and File.exists?(dir + '/.git'))\n Dir.chdir dir\n\n status = `git status`\n if (status.index('nothing to commit, working directory clean') == nil)\n dirties_found = true\n output += \"\\n------------------------------\\n#{dir}\\n------------------------------\\n\"\n output += status + \"\\n\"\n end\n Dir.chdir '..'\n end\n end # dir loop\n\n if(dirties_found)\n puts output\n else\n puts \"All working directories clean\"\n end\nend",
"def initialize root_dir\n find_files root_dir\n end",
"def scan_dirs(paths)\n paths.each do |dir_obj|\n dir_obj = File::expand_path(dir_obj)\n Find.find(dir_obj) do |ent|\n dir_ent = DirEntity.new(ent)\n # get SHA 256 if it's a file\n if File.ftype(ent) == 'file'\n dir_ent.file_hash = Digest::SHA256.file(ent) \n else\n dir_ent.is_dir = true\n end\n # stat both files and directories to be stored.\n stat = File::Stat.new(ent)\n dir_ent.perms = sprintf(\"%o\", stat.mode)\n dir_ent.owner, dir_ent.group = stat.uid, stat.gid \n\n dir_ent.report\n dir_ent.print_json\n @fsys_objects << dir_ent.create_json\n end\n end\n end",
"def getEmptyCats(env, tenant)\n \n #chage productsPerCatDir name for the rest of the files\n productsPerCatDir = File.dirname(__FILE__) + '/ProductIDsPerCat/'\n emptyCategoryDir = File.dirname(__FILE__) + '/EmptyCategories/' + tenant + \"_emptyCategories_\" + $TodayDate + \".txt\"\n\n \n emptyCategoryCounter = 0;\n \n puts \"Looking for empty categories\"\n \n Dir[productsPerCatDir + tenant + '_productIDs_' + '*_' + $TodayDate + '.txt'].each {|productsPerCatFile|\n File.open(productsPerCatFile) {|cat|\n if(cat.read.count(\"\\n\") == 0) then\n \n emptyCatID = productsPerCatFile.scan(/productIDs_(.*?)__/)[0][0]\n if (isLeaf(tenant, emptyCatID) == true) then\n \n emptyCategoryCounter = emptyCategoryCounter + 1\n \n open(emptyCategoryDir , 'a') do |emptyCategoryDirFile|\n emptyCategoryDirFile << emptyCatID + \"\\n\"\n end\n end\n else\n open(emptyCategoryDir , 'a') \n\n end\n }\n \n }\n\nputs \"Done. \" + emptyCategoryCounter.to_s + \" empty categories found.\"\n \nend",
"def count\n dir = '/Users/zzygis/lab/tekstai/stenogramos/'\n Dir.foreach(dir) do |f_sn|\n current_dir = dir + f_sn + '/'\n if current_dir =~ /\\d+/ then\n Dir.foreach(dir + f_sn) do |f_sp| \n yield f_sn, current_dir + f_sp if f_sp.include? '.txt'\n end\n end\n end\nend",
"def sort_files\n # Iterate thru files in @download_path\n cd(@download_path) do\n Find.find(pwd) do |path_to_file|\n @current_file_path = path_to_file\n next if @current_file_path == pwd # don't include the download folder as one of the files\n update_progress\n @file_directory, @file_name = File.split(@current_file_path)\n next if @file_name[0..0] == \".\" # skip any files/directories beginning with .\n # Stop searching this file/directory if it should be skipped, otherwise process the file\n should_skip_folder? ? Find.prune : process_download_file\n end\n end\n end",
"def scan_directories_for_txtfiles fitNesseRoot, type=\"all\"\n\t\n\tfolder = case type\n\t\twhen \"regression\"\n\t\t\t\"RegressionSuite\"\n\t\twhen \"scenario\"\n\t\t\t\"ScenarioLib\"\n\t\twhen \"component\"\n\t\t\t\"*Components\"\n\t\twhen \"all\"\n\t\t\t\"**\"\n\t\telse\n\t\t\traise Exception, \"Need regression, component, scenario, all or none as an argument.\"\n\t\tend\n\n\t# Putting the Dir.glob search in a block will return the working directory\n\t# to it's original location - important for loading new classes and modules.\n\tDir.chdir(fitNesseRoot + \"./LearnMainline/BbLearnTests/\") {\n\t\tDir.glob(\"./**/\" + folder + \"/**/content.txt\") { |f| \n\t\t\t#puts File.expand_path(f)\n\t\t\tyield File.expand_path(f) #Can remove this and return an array instead. \n\t\t}\t\n\t}\n\n\t# We also have the ability to pass this up as an array of files. I can't decide if holding an array\n\t# is better than keeping the search open and yeilding one file at a time. \nend",
"def make_test_dirs_with_files(parent, count)\n unless count > NUMBER_OF_DIRECTORIES\n Dir.mkdir(parent + \"directory#{count}/\")\n # puts parent + \"/directory#{count}\"\n\n for i in 1..FILES_PER_DIRECTORY_X\n File.open(parent + \"directory#{count}/\" + \"filex#{i}.txt\", 'w+').chmod(0331)\n # puts parent + \"/directory#{count}/\" + \"filex#{i}.txt\"\n end\n\n for i in (FILES_PER_DIRECTORY_X + 1)..(FILES_PER_DIRECTORY + FILES_PER_DIRECTORY_X)\n File.open(parent + \"directory#{count}/\" + \"file#{i}.txt\", 'w+').chmod(0224)\n # puts parent + \"/directory#{count}/\" + \"file#{i}.txt\"\n end\n\n make_test_dirs_with_files(parent + \"directory#{count}/\", (count + 1))\n\n end\n\n end",
"def get_files(src)\n files = Array.new\n if File.directory? src\n Find.find(src) do |path|\n next if File.directory? path\n files.push path\n end\n else\n log(\"error: source directory of \\\"#{src}\\\" does not exist!\")\n exit 2\n end\n files.reverse\nend",
"def scan_directory(path, options, name=nil)\n\n data = {}\n Dir.foreach(path) do |filename|\n\n # Check to see if we should skip this file. We skip invisible files (starts with \".\") and ignored files.\n next if (filename[0] == '.')\n next if (filename == '..' || filename == '.')\n next if options.ignore_files.include? filename\n\n full_path = File.join(path, filename)\n if File.directory?(full_path)\n\n # This item is a directory. Check to see if we should ignore this directory.\n next if options.ignore_dir.include? filename\n\n # Loop through the method again.\n position = get_directory_display_order(full_path)\n data.store(\"#{'%04d' % position}-\" + filename.gsub(' ', '%20'), scan_directory(full_path, options, filename))\n\n else\n # This item is a file.\n if !options.ext_whitelist.empty?\n\n # Skip any whitelisted extensions.\n next unless options.ext_whitelist.include? File.extname(filename)\n end\n\n original_path = path.sub(/^#{app.config[:source]}/, '') + '/' + filename\n\n # Get this resource so we can figure out the display order\n this_resource = resource_from_value(original_path)\n position = get_file_display_order(this_resource)\n\n data.store(\"#{'%04d' % position}-\" + filename.gsub(' ', '%20'), original_path.gsub(' ', '%20'))\n end\n end\n\n # Return this level's data as a hash sorted by keys.\n return Hash[data.sort]\n end",
"def find_files_in_dir dir\n unless dir.exist?\n warn \"Can't find files in dir %s as it doesn't exist!\",\n dir.relative_path_from(project.path + '..').to_s\n return []\n end\n Dir.chdir dir do\n Dir['**/*'].map { |path| Pathname(path) }\n end\n end",
"def scan()\n scanDir() ;\n scanLogs() ;\n end",
"def collect_in_dir directory, recursive = true\n if not File.readable? directory\n puts \"#{directory} not readable. Skipping.\" if @verbose\n else\n directory += \"/\" if not directory.end_with? \"/\"\n if File.directory? directory\n files = Dir.entries directory\n files.reject! {|d| d.match /^\\.{1,2}$/} # ignore parent and self links\n files.map! { |f| directory + f }\n files.each do |fname|\n if File.directory?(fname) and recursive\n collect_in_dir fname\n elsif not File.readable? fname\n puts \"#{fname} not readable.Skipping.\" if @verbose\n elsif File.file? fname and File.extname(fname) == @extension # if no directory\n pkg_info = parse_pkg fname\n @files[fname] = pkg_info if pkg_info\n end\n end\n end\n end\n end",
"def test_list(path)\n if File.basename(path) =~ /^\\W/\n [] # skip .hiddens and such\n elsif File.directory?(path) then\n puts \"Looking for tests in #{path}\"\n Dir.entries(path).\n collect { |entry| test_list(File.join(path,entry)) }.\n flatten.\n compact\n elsif path =~ /\\.rb$/\n puts \"Found #{path}\"\n [path]\n #[path[/\\S+\\/(\\S+)$/,1]]\n end\nend",
"def traverse_files\n result = []\n paths = config[:paths].select { |p| File.exist?(p) }\n if paths.empty?\n log_warn \"search.paths #{config[:paths].inspect} do not exist\"\n return result\n end\n Find.find(*paths) do |path|\n is_dir = File.directory?(path)\n hidden = File.basename(path).start_with?('.')\n not_incl = config[:include] && !path_fnmatch_any?(path, config[:include])\n excl = path_fnmatch_any?(path, config[:exclude])\n if is_dir || hidden || not_incl || excl\n Find.prune if is_dir && (hidden || excl)\n else\n result << yield(path)\n end\n end\n result\n end",
"def process_dir( dir )\n #puts \"Scanning #{dir}\"\n Dir.foreach( dir ) do |entry|\n if entry.start_with?('.')\n next\n end\n path = \"#{dir}/#{entry}\"\n if Dir.exist?(path)\n process_dir(path)\n elsif entry.end_with?( '.rb' )\n process_file( path )\n end\n end\n end",
"def directory_entries\n entries.select{ |f| File.directory?(File.join(path,f)) }\n #dirs = ::Dir.glob(\"#{path}/\")\n #dirs.collect{ |f| f.chomp('/') }\n end",
"def scanDir()\n suffix = \".config.json\"\n Dir.glob(\"#{@logBaseDir}/*/*#{suffix}\") {|path|\n #basename = File.basename(path, \".config.json\") ;\n basename = path.gsub(/^#{@logBaseDir}\\//,'').gsub(/#{suffix}$/,'') ;\n p [:basename, basename] ;\n @basenameList.push(basename) ;\n }\n @basenameList.sort!() ;\n return @basenameList ;\n end",
"def find_files(base_dir, flags); end",
"def get_files(dir)\r\n\t\r\n\t\t\tfiles = Dir.glob(dir)\r\n\t\t\tdir_path = dir.chomp(\"*\")\r\n\r\n\t\t\tfor file in files\r\n\t\t\t\tunless File.directory?(file)\r\n\t\t\t\t\tif @ext.include?(File.extname(file))\r\n\t\t\t\t\t\tread_lines file\r\n\t\t\t\t\t\t@num_files = @num_files+1\r\n\t\t\t\t\tend\r\n\t\t\t\t\t\r\n\t\t\t\telse\r\n\t\t\t\t\tget_files file+\"/*\"\r\n\t\t\t\tend\r\n\r\n\t\t\tend\r\n\t\tend",
"def find(dirs); end",
"def foreach\n find_files.each do |file|\n yield(@build_result_dir, file)\n end\n end",
"def parse_files\r\n ln_count = 0\r\n\r\n settings.file_order.each do |f|\r\n out = make_file(\"tmp.press\")\r\n\r\n ln_count += parse_lines(f, out)\r\n\r\n out.close\r\n tmp_files << out\r\n end\r\n\r\n ln_count\r\n end",
"def processDir( dirPath )\n return if not File.directory?( dirPath )\n\n puts File.basename( dirPath ) + \"/\"\n\n Dir.foreach( dirPath ) do | content |\n next if content == \".\" or content == \"..\"\n\n contentPath = dirPath + \"/\" + content\n next if File.symlink?( contentPath )\n\n if File.directory?( contentPath )\n processDir contentPath\n elsif File.file?( contentPath )\n fork do\n flacFile = FlacFile.new contentPath\n flacFile.normalize\n end\n end\n end\n\n Process.waitall\nend",
"def files_in(dir)\n Dir.chdir(dir) do\n Dir.glob('**/*').select { |f| File.file?(f) }\n end\nend",
"def all_files_in(dir_name)\n Nanoc::FilesystemTools.all_files_in(dir_name)\n end",
"def readDirectoryFiles(directory,formats)\n files=[]\n Dir.chdir(directory){\n for i in 0...formats.length\n Dir.glob(formats[i]){|f| files.push(f) }\n end\n }\n return files\nend",
"def each_file_in_tree\n self.directories_in_tree.find_each do |directory|\n next if directory.nil?\n directory.cfs_files.find_each do |cfs_file|\n next if cfs_file.nil?\n\n yield cfs_file if block_given?\n end\n end\n end",
"def sortFilesFromDirs array, dir #array is elements in current directory: dir\n\n #temp arrays to hold files vs dirs\n dirs = Array.new\n files = Array.new\n\n array.each do |elem|\n\n #path to current entity interested in\n currentPath = dir + \"/\" + elem\n #puts \"currentPath: \" + currentPath\n\n #is dir or no?\n if Dir.exist? currentPath\n dirs << elem\n else\n files << elem\n end\n\n end\n\n #puts \"dirs: \" + dirs.to_s\n #puts \"files: \" + files.to_s\n \n #return concatenated array\n return dirs + files\n\n end",
"def files_to_analyze\n require 'find'\n ignore_dirs = ['.git','bin','test','assets','lib','log','vendor','tmp','img', 'images', 'uploads', 'fonts']\n ignore_files = Regexp.union(/^\\..*$/i, /^.*(.md)$/i, /^.*(.json)$/i, /^.*(.yml)$/i, /^.*(.log)$/i, /^.*(.png)$/i, /^.*(.jpg)$/i, /^.*(.jpeg)$/i)\n final_files = []\n # for every file in repository - keep the files to process\n Find.find('.') do |path|\n path_name = File.basename(path)\n if FileTest.directory?(path)\n if ignore_dirs.include?(path_name)\n Find.prune\n else\n next\n end\n else\n if path_name.match(ignore_files)\n next\n else\n path.gsub!(/^\\.\\//, '')\n final_files.push(path)\n end\n end\n end\n return final_files\n end",
"def GetEnemyPrototypes()\n\n folder_contents = Dir.entries($enemy_prototypes_folder)\n\n for i in 0...folder_contents.length do\n\n if not folder_contents[i] == \".\" and not folder_contents[i] == \"..\" then\n $enemy_prototypes << $enemy_prototypes_folder + '/' + folder_contents[i]\n end\n\n end\n\n\nend",
"def each_file(&bl)\n unpack do |dir|\n Pathname(dir).find do |path|\n next if path.to_s == dir.to_s\n pathstr = path.to_s.gsub(\"#{dir}/\", '')\n bl.call pathstr unless pathstr.blank?\n end\n end\n end",
"def find_files(levels=[\"0\"],up_to=300)\n\tarr = []\n\tnames = []\n\t(0...up_to).each do |i|\n\t\tlevels.each do |j|\n\t\t\tif (File.exists?(\"../scraper_and_data/scraped_genomes/level_\" + j + \"/\"+i.to_s))\n\t\t\t\tarr << \"../scraper_and_data/scraped_genomes/level_\" + j + \"/\"+i.to_s\n\t\t\t\tnames << i.to_s\n\t\t\tend\n\t\tend\n\tend\n\treturn arr,names\nend",
"def file_list tree_root=nil\n tree_root ||= self.tree_root\n file_list = []\n current_dir = tree_root\n visit_entries self.files do |type, name|\n case type\n when :directory\n current_dir = current_dir + \"/\" + name\n when :file\n file_list.push(current_dir + \"/\" + name)\n else\n throw \"BAD VISIT TYREE TYPE. #{type}\"\n end\n end\n file_list\n end",
"def generate_size_indexed_list(list)\n result = {}\n list.each{|item|\n if File.directory?(item)\n Dir.glob(File.join(item, \"**/*\")){|filename|\n if File.file?(filename) != true\n next\n end\n\n $stdout.puts \"Scanning: #{filename}\"\n\n file_size = File.stat(filename).size\n\n if result.has_key?(file_size) == false\n result[file_size] = []\n end\n result[file_size].push(filename)\n }\n else\n $stderr.puts \"#{item.inspect} is not a directory.\"\n exit 1\n end\n }\n\n return result\nend",
"def findFilesCommand(baseDir)\n #N Without path prefix, wouldn't work if 'find' is not on path, without baseDir, wouldn't know which directory to start, without '-type f' would list more than just directories, without -print, would not print out the values found (or is that the default anyway?)\n return [\"#{@pathPrefix}find\", baseDir, \"-type\", \"f\", \"-print\"]\n end",
"def find_files dir = test_dir\n glob file_pattern(dir)\n end",
"def GetEnemies(folder)\n folder_contents = Dir.entries(folder)\n\n\n for i in 0...folder_contents.length do\n\n if folder_contents[i] != \".\" and folder_contents[i] != \"..\" and not folder_contents[i].include? \".fson\" then\n $enemies << folder_contents[i]\n $enemy_images << [File.basename(folder_contents[i], '.cfg'), 0]\n GetEnemyRects(folder + '/' + folder_contents[i])\n GetEnemyImages(folder + '/' + folder_contents[i])\n end\n\n\n end\n\nend",
"def initialize_directory_structure # rubocop:disable Metrics/MethodLength\n result = []\n\n %w[day hour minute].each do |unit|\n @intervals[unit].reverse.each do |i|\n dir = File.join(@to_dir, \"#{unit}s_ago\", i.to_s)\n FileUtils.mkdir_p(dir)\n fname = File.join(dir, @tarfile)\n $stderr << fname << \"\\n\"\n result << SnapshotFile.new(fname, unit)\n end\n end\n\n result\n end",
"def scan_dir(from_dir, to_dir)\n Dir.foreach(from_dir) do |file|\n from_path = from_dir + File::SEPARATOR + file\n to_path = to_dir + File::SEPARATOR + file\n if file =~ /^\\./\n next\n elsif FileTest.directory?(from_path)\n scan_dir(from_path, to_path) \n elsif file =~ /\\.java$/\n File.makedirs(to_dir)\n output_file = to_path.sub(/\\.java$/, '.cs')\n print \"Translating #{from_path} to #{output_file}\\n\"\n transmogrify(from_path, output_file)\n else\n File.makedirs(to_dir)\n print \"Copying #{from_path} to #{to_path}\\n\"\n File.copy(from_path, to_path)\n end\n end\nend",
"def printDepthFirst()\n # println(\"printDepthFirst\");\n # # // global fileCounter\n # @fileCounter = 0;\n # printRealDepthFirst(0,-1);\n # println(fileCounter+\" files\");\n end",
"def dir_list(path, bases, paging)\n items = paging[:items]\n page = paging[:page]\n offset = paging[:offset]\n raise 'Disabling paging is not supported for a directory listing' if paging[:disable_paging]\n\n max_items = 1000\n\n child_paths, total = FileSystems::Combined.directory_list(path, items, offset, max_items)\n\n children = child_paths.map { |full_path|\n if FileSystems::Combined.directory_exists?(full_path)\n dir_info(full_path, bases)\n else\n raise 'File should exist' unless FileSystems::Combined.file_exists?(full_path)\n\n file_info(full_path)\n end\n }\n\n paging[:total] = total\n paging[:warning] = \"Only first #{max_items} results are available\" if total >= max_items\n\n children\n end",
"def count_files_for_each_dir(path, dirs)\n dirs.each do |dir|\n \n num = 0\n # count flag\n\n Dir.entries(File.join(path, dir)).each do |file|\n num = (num + 1) if file.to_s!=\".\" and file.to_s!=\"..\" and file.to_s!=\".DS_Store\"\n end\n \n # print result\n puts \"#{dir} : #{num}\"\n end\nend",
"def retrieve_files_in_main_dir\n ensure_file_open!\n @file.glob('*').map do |entry|\n next if entry.directory?\n\n entry_file_name = Pathname.new(entry.name)\n [entry_file_name, entry.get_input_stream(&:read)]\n end.compact.to_h\n end",
"def each_file(&bl)\n unpack do |dir|\n Pathname.new(dir).find do |path|\n next if path.to_s == dir.to_s\n pathstr = path.to_s.gsub(\"#{dir}/\", '')\n bl.call pathstr unless pathstr.blank?\n end\n end\n end",
"def findPdfFiles(file, srcDir, destDir) \n\n # puts \"looking at: #{srcDir}/#{file}\";\n\n srcFile = \"#{srcDir}/#{file}\";\n destFile = \"#{destDir}/#{file}\";\n\n if (File.directory?(srcFile)) then\n system(\"mkdir #{destFile}\");\n Dir.entries(srcFile).sort().each() { | aFile |\n next if (aFile =~ /^\\.$/);\n next if (aFile =~ /^\\.\\.$/);\n next if (aFile =~ /^\\.svn$/);\n next if (aFile =~ /^target$/);\n findPdfFiles(aFile, srcFile, destFile);\n }\n else \n if (srcFile =~ /\\.pdf/) then\n convertPdf(file, srcDir, destDir);\n elsif (srcFile =~ /SD2-18_VPNServiceModel\\.xls/) then\n copyFileToTarget(file, srcDir, destDir);\n end\n end\n\nend",
"def parse_files (path = '.', parent_id = 0)\n\n full_path = root_path().join(path)\n\n Dir.foreach(full_path) {|file_name|\n\n if file_name == '.' || file_name == '..'\n next\n end\n\n program_file = program_files.build()\n program_file.name = file_name\n program_file.path = Pathname.new(path).join(file_name).to_s\n program_file.parent_id = parent_id\n\n if File.ftype(full_path.join(file_name)) == 'directory'\n program_file.file_type = :dir\n program_file.save\n parse_files Pathname.new(path).join(file_name), program_file.id\n else\n program_file.file_type = :file\n program_file.save\n end\n }\n end",
"def findNewFlowcells()\n @newFC = Array.new\n\n dirList = Dir.entries(@instrDir)\n\n dirList.each do |dirEntry|\n if !dirEntry.eql?(\".\") && !dirEntry.eql?(\"..\") &&\n File::directory?(@instrDir + \"/\" + dirEntry) &&\n !@fcList.key?(dirEntry.strip)\n @newFC << dirEntry\n end\n end \n end",
"def findNewFlowcells()\n @newFC = Array.new\n\n dirList = Dir.entries(@instrDir)\n\n dirList.each do |dirEntry|\n if !dirEntry.eql?(\".\") && !dirEntry.eql?(\"..\") &&\n File::directory?(@instrDir + \"/\" + dirEntry) &&\n !@fcList.key?(dirEntry.strip)\n @newFC << dirEntry\n end\n end \n end",
"def exploreFiles( target, results = Array[] )\n # First, check if the target is a directory\n if isDirectory( target )\n # Okay, target is a directory, get all the entries inside the\n # directory and iterate over them\n Dir.entries( target ).each do |path|\n fullPath = \"#{target}/#{path}\"\n # We are now iterating over each of the directory entries. Ignore\n # paths that do NOT end with .ti, they are not Titanium class files\n # and we do not want to create documentation for them.\n\n # However, if a path is a directory, iterate over that too\n if path != \".\" and path != \"..\"\n if isDirectory fullPath\n results = exploreFiles( fullPath, results )\n elsif File.extname( path ) == \".ti\"\n # Alright! The path is marked as a Titanium class file via the .ti ext.\n # Lets begin parsing for functions and comments.\n results.push fullPath\n end\n end\n end\n\n return results\n else\n raise \"Failed to generate documentation. Cannot explore #{target}, is a file\"\n end\nend",
"def tree\n # Caution: use only for small projects, don't use in root.\n @title = 'Full Tree'\n # @files = `zsh -c 'print -rl -- **/*(#{@sorto}#{@hidden}M)'`.split(\"\\n\")\n @files = Dir['**/*']\n message \"#{@files.size} files.\"\nend",
"def all_files() = path.glob('**/*').select(&:file?).map(&:to_s)",
"def analyze_dirs(dir_to_analyze, parent)\n\n\n # bootstrap case\n # don't create an entry for the root because there's nothing to link to yet, scan the subdirs\n if (dir_to_analyze == self.target_volume)\n # puts \"Dir to analyze is the target volume\"\n # run on all child dirs, not this dir\n Dir.entries(dir_to_analyze).reject {|d| d.start_with?('.')}.each do |name|\n # puts \"\\tentry: >#{file}<\"\n full_path = File.join(dir_to_analyze, name)\n if (Dir.exist?(full_path) && !File.symlink?(full_path))\n # puts \"Contender: >#{full_path}<\"\n analyze_dirs(full_path, self.dir_tree)\n end\n end\n return\n end\n\n # use \"P\" to help prevent following any symlinks\n cmd = \"du -sxkP \\\"#{dir_to_analyze}\\\"\"\n puts \"\\trunning #{cmd}\"\n output = `#{cmd}`.strip().split(\"\\t\")\n # puts \"Du output:\"\n # pp output\n size = output[0].to_i \n size_gb = \"#{'%.0f' % (size.to_f / 1024 / 1024)}\"\n # puts \"Size: #{size}\\nCapacity: #{self.diskhash['/']['capacity']}\"\n\n # Occupancy as a fraction of total space\n # occupancy = (size.to_f / self.capacity.to_f)\n\n # Occupancy as a fraction of USED space\n occupancy = (size.to_f / self.used.to_f)\n\n occupancy_pct = \"#{'%.0f' % (occupancy * 100)}\"\n capacity_gb = \"#{'%.0f' % (self.capacity.to_f / 1024 / 1024)}\"\n \n # if this dir contains more than 5% of disk space, add it to the tree\n\n if (dir_to_analyze == self.target_dir)\n # puts \"Dir to analyze is the target dir, space used outside this dir..\"\n # account for space used outside of target dir\n other_space = self.used - size\n other_space_gb = \"#{'%.0f' % (other_space / 1024 / 1024)}\"\n parent.children.push(DirNode.new(parent, self.target_volume, 'Other Space', other_space_gb))\n end\n \n \n if (occupancy > self.threshold_pct)\n # puts \"Dir contains more than 5% of disk space: #{dir_to_analyze} \\n\\tsize:\\t#{size_gb} / \\ncapacity:\\t#{capacity_gb} = #{occupancy_pct}%\"\n puts \"Dir contains more than 5% of used disk space: #{dir_to_analyze} \\n\\tsize:\\t\\t#{size_gb} / \\n\\toccupancy:\\t#{self.used_gb} = #{occupancy_pct}% of used space\"\n\n # puts \"Dir to analyze (#{dir_to_analyze}) is not the target dir (#{self.target_dir})\"\n dirs = dir_to_analyze.split('/')\n \n short_dir = dirs.pop().gsub(\"'\",\"\\\\\\\\'\")\n full_parent = dirs.join('/')\n if (dir_to_analyze == self.target_dir || full_parent == self.target_volume)\n # puts \"Either this dir is the target dir, or the parent is the target volume, make parent the full target volume\"\n short_parent = self.target_volume.gsub(\"'\",\"\\\\\\\\'\")\n else\n # puts \"Neither this dir or parent is the target dir, making parent short\"\n short_parent = dirs.pop().gsub(\"'\",\"\\\\\\\\'\")\n end\n \n\n this_node = DirNode.new(parent, dir_to_analyze, short_dir, size_gb)\n parent.children.push(this_node)\n\n # run on all child dirs\n Dir.entries(dir_to_analyze).reject {|d| d.start_with?('.')}.each do |name|\n full_path = File.join(dir_to_analyze, name)\n # don't follow any symlinks\n if (Dir.exist?(full_path) && !File.symlink?(full_path))\n # puts \"Contender: >#{full_path}<\"\n analyze_dirs(full_path, this_node)\n end\n end\n \n end # occupancy > threshold\n \n end",
"def scan_dirs(indir)\n @acs_dirs = {}\n Dir.chdir(indir)\n all_dirs = Dir.glob('*').select { |f| File.directory? f }\n all_dirs.each do |subdir|\n @acs_dirs[subdir] = HRRTACSDir.new(File.join(indir, subdir))\n @acs_dirs[subdir].create_hrrt_files\n end\n end"
] |
[
"0.68762404",
"0.6591346",
"0.6549699",
"0.6525785",
"0.65008914",
"0.6456145",
"0.64399177",
"0.6364088",
"0.6328656",
"0.6282633",
"0.6266714",
"0.626177",
"0.6255684",
"0.62280965",
"0.6217155",
"0.6205192",
"0.6200233",
"0.61635053",
"0.61617696",
"0.61573184",
"0.6133623",
"0.6116015",
"0.611551",
"0.61025417",
"0.6048085",
"0.60478526",
"0.6033097",
"0.6022737",
"0.5984077",
"0.5961195",
"0.595594",
"0.5953235",
"0.5935671",
"0.59163356",
"0.5912239",
"0.59086496",
"0.59050465",
"0.5886943",
"0.58510387",
"0.58211875",
"0.58211875",
"0.5817809",
"0.5808274",
"0.5803859",
"0.5798431",
"0.57951784",
"0.5786409",
"0.57756346",
"0.57698315",
"0.5766702",
"0.5761444",
"0.57427067",
"0.5738703",
"0.57196623",
"0.5711654",
"0.5706533",
"0.57014656",
"0.5697592",
"0.564327",
"0.5643225",
"0.5641004",
"0.563563",
"0.56335926",
"0.5633542",
"0.56334364",
"0.5630024",
"0.56293446",
"0.5625556",
"0.56226724",
"0.5621544",
"0.5614164",
"0.5613467",
"0.56074893",
"0.56038296",
"0.5585908",
"0.5581088",
"0.55673367",
"0.5564697",
"0.55645925",
"0.5560642",
"0.5559871",
"0.55560684",
"0.5548758",
"0.5548112",
"0.55436724",
"0.55435765",
"0.5542314",
"0.5535514",
"0.553509",
"0.5533965",
"0.55295706",
"0.5523934",
"0.55152637",
"0.55152345",
"0.5515095",
"0.5513341",
"0.5506555",
"0.55015606",
"0.5497852",
"0.54891646"
] |
0.81003904
|
0
|
Compares each fileObj's md5sum against all But first, if it's empty write to push it to a blanks array However, if equal create a hash of the files and
|
def findDups(objArray, dupsHashArray, emptyFileArray)
objArray.each_with_index do |obj, idx1|
if obj.is_empty?
emptyFileArray.push(obj.fileName)
next
end
objArray.each_with_index do |obj2, idx2|
next if idx1 >= idx2
if obj.md5 === obj2.md5
foundDupHash= {:filePath => obj.fileName, :duplicatePath => obj2.fileName}
dupsHashArray.push(foundDupHash)
end
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def digest_md5(*files)\n files.flatten.collect { |file| \n File.exists?(file) ? Digest::MD5.hexdigest(File.read(file)) : nil\n }\n end",
"def create_chksum_manifest\n chksum_manifest = {}\n files = Dir['*'].select{ |f| File.file? f }\n files.each do |file|\n chksum_manifest[file] = Digest::MD5.file(file).hexdigest\n end\n chksum_manifest\n end",
"def digest_sha1(*files)\n files.flatten.collect { |file| \n File.exists?(file) ? Digest::SHA1.hexdigest(File.read(file)) : nil\n }\n end",
"def find_similar_files\n \"SELECT * FROM files \n WHERE md5 = md5 AND sha1 = sha1 AND size = size\n GROUP BY md5, sha1, size\"\n end",
"def same_files?(*files)\n images = files.map { |fname| Digest::MD5.digest(File.binread(fname)) }\n images.all? { |img| img == images[0] }\nend",
"def find_duplicates(hash, i = 0, largest_duplicates = [[], []])\n # Array of files with same size. Will return [key, value]\n files_with_same_size_1 = hash.max_by(i+2){|key, value| value.length }[i]\n files_with_same_size_2 = hash.max_by(i+2){|key, value| value.length }[i+1]\n\n # Array of files with identical MD5. Quite enough to search for identical files\n files_with_same_hash = ArrayToMD5(files_with_same_size_1).max_by{|key, value| value.length }\n\n if largest_duplicates[1].length < files_with_same_hash[1].length\n largest_duplicates = files_with_same_hash\n end\n\n if largest_duplicates[1].length > files_with_same_size_2[1].length\n return largest_duplicates\n else\n find_duplicates(hash, i+1, largest_duplicates)\n end\nend",
"def files_digest(paths)\n self.digest(paths.map { |path| self.file_digest(path) })\n end",
"def compare\n\t\t\t\n\t\t\tDir.foreach(@folder1) do |item|\n\t\t\t\tbegin\n \t\t\t\tnext if item == '.' or item == '..'\n \t\t\t\tfullfilename = File.expand_path(@folder1, item)\n \t\t\t\tthe_hash = Digest::MD5.hexdigest(File.read(File.join(File.expand_path(@folder1), item)))\n \t\t\t\titem = item.downcase\n \t\t\t\tfiledata = FileHashResults.new(item, the_hash, nil)\n \t\t\t\t@filehash[item] = filedata\n \t\t\trescue\n \t\t\t #puts \"Skipped:#{item.inspect}\"\n \t\t\tend\n\t\t\tend\n\n\t\t\tDir.foreach(@folder2) do |item|\n\t\t\t begin\n \t\t\t\tnext if item == '.' or item == '..'\n \t\t\t\tthe_hash = Digest::MD5.hexdigest(File.read(File.join(@folder2, item)))\n \t\t\t\titem = item.downcase\n if(@filehash[item]==nil)\n \t\t\t\t\tfiledata = FileHashResults.new(item, nil, the_hash)\n \t\t\t\t\t@filehash[item] = filedata\n \t\t\t\t\tnext\n \t\t\t\tend\n \t\t\t\t@filehash[item.downcase].file_hash2 = the_hash\n \t\t\trescue\n #puts \"Skipped:#{item.inspect}\"\n end\t\n\t\t\tend\n\t\tend",
"def get_md5sum(file)\n get_sum(file, 'md5')\n end",
"def digest_sha2(*files)\n files.flatten.collect { |file| \n File.exists?(file) ? Digest::SHA2.hexdigest(File.read(file)) : nil\n }\n end",
"def md5_list\n @list + '_MD5'\n end",
"def file_md5\n Digest::MD5.file(self).hexdigest\n end",
"def files_digest(paths)\n digest(paths.map { |path| file_digest(path) })\n end",
"def find_md5(dir, excludes)\n found = []\n (Dir.entries(dir) - %w[. ..]).map { |e| File.join(dir, e) }.each do |path|\n if File.directory?(path)\n unless exclude?(excludes, path)\n found += find_md5(path, excludes)\n end\n elsif File.file?(path)\n if (file = new(path))\n unless exclude?(excludes, file.path)\n file.md5 = Digest::MD5.file(file.path).hexdigest\n found << file\n end\n end\n end\n end\n found\n end",
"def digestmd5(file2md5)\n if not ::File.exists?(file2md5)\n raise \"File #{file2md5} does not exists!\"\n else\n require 'digest/md5'\n chksum = nil\n chksum = Digest::MD5.hexdigest(::File.open(file2md5, 'rb') { |f| f.read })\n return chksum\n end\n end",
"def contents_hash(paths)\n return if paths.nil?\n\n paths = paths.compact.select { |path| File.file?(path) }\n return if paths.empty?\n # rubocop:disable GitHub/InsecureHashAlgorithm\n paths.sort\n .reduce(Digest::XXHash64.new, :file)\n .digest\n .to_s(16) # convert to hex\n # rubocop:enable GitHub/InsecureHashAlgorithm\n end",
"def md5; Digest::MD5.file(fname).hexdigest; end",
"def checksums; end",
"def digest\n Digest::MD5.file(file).hexdigest\n end",
"def append_md5(file, digest, hashless: false)\n return file if hashless\n\n [[file.split(ex = File.extname(file)).first, digest].join('-'), ex].join\n end",
"def load_checksums(dobj)\n log ' - load_checksums()'\n dobj.object_files.each { |file| file.provider_md5 = file.md5 }\n end",
"def verifyMD5sum\n\n oldMD5sum = ''\n \n self.audioMD5sum if ! @audioMD5sum # compute MD5sum if it's not computed yet\n\n base = @basename.sub( /(.)\\.[^.]+$/ , '\\1') # remove suffix from audio-file\n base += '.md5' # add new suffix .md5\n md5name = File.join(@dirname,base)\n \n # if a MD5-file doesn't exist, we should create one and return TRUE ...\n if File.exists?(md5name)\n File.open( md5name ,\"r\") { |f| \n oldname,oldMD5sum = f.readline.split # read old MD5-sum\n }\n else\n oldMD5sum = self.writeMD5sum # create MD5-file and return true..\n end\n @audioMD5sum == oldMD5sum\n \n end",
"def validate_image_md5sum\n result = true\n if upload_md5sum.present? && save_to_temp_file\n sum = File.open(upload_temp_file) do |f|\n Digest::MD5.hexdigest(f.read)\n end\n if sum == upload_md5sum\n result = true\n else\n errors.add(:image, :validate_image_md5_mismatch.\n t(actual: sum.split.first, expect: upload_md5sum))\n result = false\n end\n end\n result\n end",
"def get_file_hash(fullPath)\n contents = File.read(fullPath)\n fileHash = Digest::MD5.hexdigest(contents)\n return fileHash\nend",
"def writeMD5sum\n base = @basename.sub( /(.)\\.[^.]+$/ , '\\1')\n base += '.md5'\n File.open( File.join(@dirname,base) ,\"w\") { |f| \n f.printf(\"%s %s\\n\", File.join(@dirname,@basename), audioMD5sum ) # computes it if nil\n }\n @audioMD5sum\n end",
"def hash\n Digest::MD5.hexdigest(abs_filepath)[0..5]\n end",
"def compute_checksums data\n\n digest = OpenSSL::Digest::Digest.new('sha256')\n tree_digest = OpenSSL::Digest::Digest.new('sha256')\n tree_parts = []\n\n until data.eof?\n\n chunk = data.read(1024 * 1024) # read 1MB\n tree_parts << tree_digest.update(chunk).digest\n tree_digest.reset\n\n digest.update(chunk)\n\n end\n\n data.rewind\n\n [digest.to_s, compute_tree_hash(tree_parts)]\n\n end",
"def fetch_md5\n # Create a hash digest for the current file.\n digest = Digest::MD5.new\n File.open(@path, 'r') do |handle|\n while buffer = handle.read(1024)\n digest << buffer\n end\n end\n digest\n end",
"def calculate_checksum()\n # Don't calculate, if a checksum was already provided.\n if not self.checksum.nil?\n return\n end\n\n # Create an array of process strings, sort, and md5\n process_strings = []\n self.os_processes.each do |p|\n\n # Begin string with process name.\n process_string = p.name.to_s\n\n # Append sorted files.\n file_strings = []\n p.process_files.each do |f|\n if (f.event == \"Delete\" ||\n f.file_content.nil? ||\n f.file_content.md5 == \"UNKNOWN\" ||\n f.file_content.sha1 == \"UNKNOWN\")\n file_string = f.name.to_s\n else\n file_string = f.file_content.md5.to_s + f.file_content.sha1.to_s\n end\n file_string += f.event.to_s\n file_strings << file_string\n end\n process_string += file_strings.sort.join(\"\")\n\n # Append sorted registries.\n registry_strings = []\n p.process_registries.each do |rk|\n registry_string = rk.name.to_s\n registry_string += rk.event.to_s\n registry_string += rk.value_name.to_s\n # XXX: Does not currently include value name or value type.\n registry_strings << registry_string\n end\n process_string += registry_strings.sort.join(\"\")\n process_strings << process_string\n end\n\n # Calculate the corresponding checksum.\n if process_strings.size == 0\n # If the fingerprint is empty, then generate a random checksum.\n self.checksum = Digest::MD5.hexdigest(rand.to_s)\n else\n self.checksum = Digest::MD5.hexdigest(process_strings.sort.join(\"\"))\n end\n end",
"def all_chunk_hashes\n\t\t\n\t\tbegin\n\t\t\t@all_chunk_map = \"\"\n\t\t\t0.upto(num_chunks-1) { |i|\n\t\t\t\t@all_chunk_map += sha1_chunk(i)\n\t\t\t}\n\n\t\tend unless @all_chunk_map\n\t\t@all_chunk_map\n\tend",
"def md5_sum(file_name)\n dst_path = \"#{self.path}#{file_name}\"\n cmd = self.class.curr_host == host ?\n \"find #{dst_path.shellescape} -type f -exec md5sum {} \\\\; | awk '{print $1}' | sort | md5sum\" :\n \"ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \\\"find #{dst_path.shellescape} -type f -exec md5sum {} \\\\; | awk '{print \\\\$1}' | sort | md5sum\\\"\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n r.to_s[0..31]\n end",
"def md5_sum(file_name)\n dst_path = \"#{self.path}#{file_name}\"\n cmd = self.class.curr_host == host ?\n \"find #{dst_path.shellescape} -type f -exec md5sum {} \\\\; | awk '{print $1}' | sort | md5sum\" :\n \"ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \\\"find #{dst_path.shellescape} -type f -exec md5sum {} \\\\; | awk '{print \\\\$1}' | sort | md5sum\\\"\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n r.to_s[0..31]\n end",
"def hash\r\n # TODO what if file is empty?\r\n @hash ||= Digest::SHA1.file(File.join(@directory, @filename)).hexdigest\r\n end",
"def md5sum_file(file)\n return `md5sum #{file}`\n end",
"def checksum\n @checksum ||= begin\n if empty?\n EMPTY_CHECKSUM\n else\n ::Digest::MD5.hexdigest(children.map(&:checksum).join)\n end\n end.to_s\n end",
"def needs_md5sums\n false\n end",
"def file_hashes\n @file_hashes ||= file_field_sets.map do |file_field_set|\n instantiation_fields, file_fields = file_field_set.partition do |field|\n instantiation_header?(field.header)\n end\n\n file_hash = fields_to_hash(file_fields)\n file_hash['files'] = [fields_to_hash(instantiation_fields)]\n\n file_hash\n end\n end",
"def md5\n @md5 ||= digest(path, :md5)\n end",
"def file_remote_digestmd5(file_name)\n data = read_file(file_name)\n chksum = nil\n if data\n chksum = Digest::MD5.hexdigest(data)\n end\n return chksum\n end",
"def md5sum(path)\n digest, buf = Digest::MD5.new, \"\"\n File.open(path) do |f|\n while f.read(4096, buf)\n digest.update(buf)\n end\n end\n digest.hexdigest\n end",
"def digest\n Digest::MD5.digest(blob)\n end",
"def check_digests(streamer_response:, file_model:)\n out = streamer_response\n upload = file_model\n if out[:response].nil? || out[:response][:checksum].nil?\n raise FileError, \"Error streaming file to Zenodo. No md5 digest returned:\\n#{out[:response]}\\nFile:#{upload.inspect}\"\n end\n\n if out[:response][:checksum] != \"md5:#{out[:digests]['md5']}\"\n raise FileError, \"Error MD5 digest doesn't match zenodo:\\nResponse: #{out[:response][:checksum]}\\nCalculated: md5:#{out[:digests]['md5']}\"\n end\n\n return unless upload.digest_type.present? && upload.digest.present? && out[:digests][upload.digest_type] != upload.digest\n\n raise FileError, \"Error #{upload.digest_type} digest doesn't match database value:\\nCalculated:#{out[:digests][upload.digest_type]}\\n\" \\\n \"Database: #{upload.digest}\"\n end",
"def sha256(files)\n sha = Digest::SHA2.new\n files.each do |f|\n next if File.directory?(f)\n\n content = File.binread(f)\n # work around possible git checkout issues by removing CR and LF from the file\n content.gsub!(\"\\n\", \"\")\n content.gsub!(\"\\r\", \"\")\n sha << content\n end\n sha.hexdigest\n end",
"def calculate_unique_hash\n unique = ''\n unique += self.content if self.content.present?\n unique += self.summary if self.summary.present?\n unique += self.title if self.title.present?\n self.unique_hash = Digest::MD5.hexdigest unique\n end",
"def file_ids_hash\n if @file_ids_hash.blank?\n # load the file sha's from cache if possible\n cache_file = File.join(self.path,'.loopoff')\n if File.exists?(cache_file)\n @file_ids_hash = YAML.load(File.read(cache_file))\n else\n # build it\n @file_ids_hash = {}\n self.loopoff_file_names.each do |f|\n @file_ids_hash[File.basename(f)] = Grit::GitRuby::Internal::LooseStorage.calculate_sha(File.read(f),'blob')\n end\n # write the cache\n File.open(cache_file,'w') do |f|\n f.puts YAML.dump(@file_ids_hash) \n end\n end \n end\n @file_ids_hash\n end",
"def check_files_similarity(files, extension)\n duplicates = {}\n files.each_with_index do |f1, index|\n next if f1 == nil || index == files.length - 1\n ((index + 1)..(files.length - 1)).each do |j|\n next if files[j] == nil\n f2 = files[j]\n break if @options[\"s\"][:value] == 1 && f1[:size] != f2[:size]\n next if Algorithms.levenshtein(f1[:name], f2[:name]) > @options[\"l\"][:value]\n begin\n result = compare_files(f1, f2)\n rescue => e\n @show.call \"\\t[Not treated]:\\n\\t\\t - #{f1[:path]} \\n\\t\\t - #{f2[:path]} \\n\\t\\t => #{e}\"\n end\n next if result == nil\n f3 = f2.clone\n f3[:similarity] = result\n if (@options[\"p\"][:value] == 100 && result == 100) || (result >= @options[\"p\"][:value])\n # remove one of the file 100% duplicated\n # 2 files 100% duplicated will also be duplicated with other files\n # if sim(a,b) == 100 && sim(a, c) == 100 so sim(a, c) == 100\n files[j] = nil if @options[\"p\"][:value] == 100 && result == 100\n if duplicates.key?(f1[:path])\n duplicates[f1[:path]] << [f3[:path], result]\n else\n duplicates[f1[:path]] = [[f3[:path], result]]\n end\n end\n end\n end\n @show.call \"Process[#{Process.pid}]: Extension #{extension.name} processed!\"\n duplicates\n end",
"def md5?; @md5; end",
"def applicable_owners_files_hash\n return @applicable_owners_files_hash if !@applicable_owners_files_hash.nil?\n\n # Make hash of (directory => [files in that directory in this commit]) pairs\n\n puts \"changed files: #{changed_files.inspect}\"\n\n affected_dirs_hash = changed_files.collect_to_reverse_hash do |file|\n File.dirname(file)\n end\n\n puts \"affected_dirs_hash: #{affected_dirs_hash.inspect}\"\n\n affected_dirs = affected_dirs_hash.keys\n\n # Make hash of owners file => [file1, file2, file3]\n res = affected_dirs.inject(Hash.new) do |hash, dir|\n owner = find_owners_file(dir)\n\n # If there's no OWNERS file for this dir, just skip it\n if owner.nil?\n return hash\n end\n\n data = {\n :owner_data => owner,\n :files => affected_dirs_hash[dir]\n }\n\n key = owner[:path]\n\n if (hash.include?(key))\n combined_data = hash[key]\n combined_data[:files] = combined_data[:files] + data[:files]\n\n hash[key] = combined_data\n else\n hash[key] = data\n end\n hash\n end \n\n @applicable_owners_files_hash = res\n end",
"def checksum!\n # Get a deep copy of hash to compare with\n @_original_hash = Marshal.load(Marshal.dump(to_hash))\n # create a copy of basic elements\n base = self.reject { |k,_| ['_id', '_rev', 'couchrest-hash'].include? k.to_s }\n\n result = nil\n\n flatten =\n lambda {|r|\n (recurse = lambda {|v|\n if v.is_a?(Hash) || v.is_a?(CouchRest::Document)\n v.to_a.map{|v| recurse.call(v)}.flatten\n elsif v.is_a?(Array)\n v.flatten.map{|v| recurse.call(v)}\n else\n v.to_s\n end\n }).call(r)\n }\n self['couchrest-hash'] = Digest::MD5.hexdigest(flatten.call(base).sort.join(''))\n end",
"def git_checksum_hash(tree, prefix=nil)\n\n tree.contents.each do |obj|\n if obj.class == Grit::Blob\n item = [prefix, obj.name].join\n @currenthash[item] = Digest::MD5.hexdigest(obj.data)\n #puts \"#{item} : \" + @currenthash[item]\n else\n git_checksum_hash(obj, [prefix, obj.name, \"/\"].join)\n end\n end\n\n return @currenthash\n end",
"def manifested_files\n manifest_files.inject([]) do |acc, mf|\n files = File.open(mf) { |io|\n io.readlines.map do |line|\n _digest, path = line.chomp.split(/\\s+/, 2)\n decode_filename(path)\n end\n }\n\n (acc + files).uniq\n end\n end",
"def manifested_files\n\n manifest_files.inject([]) do |acc, mf|\n\n files = open(mf) do |io|\n\n io.readlines.map do |line|\n digest, path = line.chomp.split /\\s+/, 2\n path\n end\n\n end\n\n (acc + files).uniq\n end\n\n end",
"def md5sum\n @md5sum ||= Digest::MD5.hexdigest(self.to_checksum_string)\n end",
"def find_dups(hash)\n open(\"dups.txt\", 'w') do |f|\n f.puts '=== Identical Files ===' \n hash.each_value do |a|\n next if a.length == 1\n a.each { |fname| f << (\"\\t\" + fname) }\n f << \"\\n\\n\"\n end\n end\nend",
"def consistent?\n\n manifest_files.each do |mf|\n\n # get the algorithm implementation\n File.basename(mf) =~ /^manifest-(.+).txt$/\n\n algo = case $1\n when /sha1/i\n Digest::SHA1\n when /md5/i\n Digest::MD5\n else\n :unknown\n end\n\n # Check every file in the manifest\n open(mf) do |io|\n\n io.each_line do |line|\n expected, path = line.chomp.split /\\s+/, 2\n file = File.join(bag_dir, path)\n\n if File.exist? file\n actual = algo.file(file).hexdigest\n\n if expected != actual\n errors.add :consistency, \"expected #{file} to have #{algo}: #{expected}, actual is #{actual}\"\n end\n\n end\n end\n\n end\n\n end\n\n errors.on(:consistency).nil?\n end",
"def get_md5(fname)\n Digest::MD5.hexdigest(File.read(fname))\nend",
"def compare_list(attrs={})\n match = true\n # assume linux\n md5sum = \"md5sum\"\n md5sum = \"md5\" if node.platform == \"freebsd\"\n\n attrs['compare_list'].each do |src_file, dst_file|\n src = `#{md5sum} #{Chef::Config[:file_cache_path]}/#{attrs['src_dir']}/#{src_file}`.split(/\\s+/)\n dst = `#{md5sum} #{attrs['prefix']}/#{dst_file}`.split(/\\s+/)\n if (src[0] != dst[0]) || src[0].nil? || dst[0].nil?\n p \"#{src_file} #{attrs['prefix']}/#{dst_file}\"\n p \"#{src[0]} #{dst[0]}\"\n match = false\n end\n end\n return match\nend",
"def md5_hash(data)\n md5 = Digest::MD5.new\n md5 << data\n md5.hexdigest\n end",
"def staged\n @files.select { |k, f| f.sha_index != \"0000000000000000000000000000000000000000\" && f.type != nil }\n end",
"def calculate_checksum(file)\n @lookup_checksums[file] = Digest::MD5.hexdigest(File.read(file, mode: \"rb\")) rescue \"\"\n end",
"def compute_changed_and_risk_files(params)\n commit_hash, file_arr = commit_info(params)\n changed_file_freq = file_arr.flatten!.each_with_object(Hash.new(0)) {|file, freq_acc| freq_acc[file] += 1}\n changed_g2_files = []\n changed_file_freq.select {|file, freq| changed_g2_files << file if freq > 2}\n risk_files = changed_g2_files.dup\n rf = risk_files.each_with_object({}) do |file, acc|\n author_set = Set.new\n commit_hash.each do |file_arr, author|\n acc[file] = (author_set << author ) if file_arr.include? (file)\n end\n end\n rf.delete_if {|_file, author_arr| author_arr.length < 2}\n {\n \"changed_files\" => changed_g2_files,\n \"risk_files\" => rf\n }\n end",
"def md5\n Digest::MD5.file(@path).to_s\n end",
"def create_md5(file, new_file)\n stdout = `md5 -q \"#{file}\" > \"#{new_file}.tif.md5\"`\n puts stdout\nend",
"def bear_digests()\n @stomach.empty?()\n end",
"def all\n file.to_a.map { |row| empty?(row.to_hash) }.compact\n end",
"def recursive_checksum(_path, hash_class, _bit_size, file_object, debugmode, samefolder)\n begin\n # When the file is a directory be recursive\n if File.directory? _path\n # Object to hand the directory\n directory_object = Dir.open _path\n base_path = File.expand_path _path\n # Process all files in directory\n directory_object.each_child do |child|\n # Child to be processed\n child_path = File.join base_path, child\n\n recursive_checksum child_path, hash_class, _bit_size,file_object, debugmode, samefolder\n end\n else\n # path to be used\n if samefolder\n # use ./ for base example ./filename.txt\n file_path = _path.sub(samefolder, './')\n else\n # use complete path to file\n file_path = File.expand_path _path\n end\n # When it is aa file write directly to file_object or print it\n content = \"#{file_path},#{checksum _path, hash_class, _bit_size}\"\n # Debug mode prints every file hash\n if debugmode\n puts content\n end\n # If the user use -o to output\n if file_object\n file_object.write \"#{content}\\n\"\n end\n end\n rescue\n nil\n end\n\nend",
"def find_same_files\n # loop over find_similar_files groups\n # diff -b file1 file2\n end",
"def generate_md5(hash, keys)\n data = keys.map{|key|\n extract_key(hash, key)\n }\n Digest::MD5.hexdigest( keys_flat data )\n end",
"def check( chksum_manifest )\n new_chksum_manifest = create_chksum_manifest\n changed = []\n chksum_manifest.each do |file,chksum|\n changed << file if chksum != new_chksum_manifest[file]\n end\n if changed.empty?\n chksum_manifest = new_chksum_manifest\n else\n raise ChecksumError, changed\n end\n end",
"def md5 path\n return unless File.file?(path)\n self.md5s[path] ||= Digest::MD5.file(path).hexdigest[0...8]\n end",
"def load_checksums\n result = []\n\n @pkgdb.query(\"select md5, sha1, sha256 from checksums where basename = '#{@basename}' and mtime = '#{@mtime.iso8601}' and suitename = '#{@suitename}'\").each do |row|\n result = row\n end\n result\n end",
"def chkall\n (1..@@pow2_N).to_a.each do |i|\n h = sha32b(\"#{i}\")\n @allhash[h] = 0 if !@allhash[h]\n @allhash[h] += 1\n end\n @allhash.size\n end",
"def send_hashes(event)\n levels = MappackLevel.where('mappack_id > 0')\n count = levels.count\n res = levels.each_with_index.select{ |l, i|\n dbg(\"Hashing level #{i} / #{count}...\", newline: false, pad: true)\n !l.compare_hashes\n }.map{ |map, i| map.name }\n event << \"There are #{res.size} levels with differing hashes:\"\n res.size <= 20 ? event << format_block(res.join(\"\\n\")) : send_file(event, res.join(\"\\n\"))\nrescue => e\n lex(e, \"Error getting hash discrepancies.\", event: event)\nend",
"def ingest_file_hashes(to_save, uploader, skip_validations, obj, parent)\n \n x_file_hashes = []\n obj.hashes.each do |i|\n x2 = self.parse_sub_obj(to_save, uploader, skip_validations, i, parent)\n next if x2.blank?\n \n x_file_hashes << x2\n end\n x_file_hashes\n end",
"def tag_manifested_files\n tagmanifest_files.inject([]) do |acc, mf|\n files = File.open(mf) { |io|\n io.readlines.map do |line|\n _digest, path = line.chomp.split(/\\s+/, 2)\n path\n end\n }\n (acc + files).uniq\n end\n end",
"def altered_files; (modified + added + removed).sort; end",
"def createMD5Hash(data)\n\t\treturn Digest::MD5.digest(data)\n\tend",
"def hash( *strs )\n return Digest::MD5.hexdigest( strs.join )\n end",
"def unmd5(hash)\n # search one: lowercase search\n lower = \"a\"\n # search two: ascii brute force\n gen = all_ascii\n \n loop {\n break lower if md5(lower) == hash\n lower.next!\n \n cur = gen.next\n break cur if md5(cur) == hash\n }\nend",
"def hash (site)\n\t#hash_in_hash = Array.new\n\t#hash_in_hash = {\"URL\" => \"MD5_Digest\"}\n\topen (site) do |s|\n\t\tresponse = s.read\n\t\tdigest = Digest::MD5.hexdigest(response)\n\t\t#string1 = site + \" - \" + digest + \"\\n\"\n\t\t#file2 = File.open(\"/Users/ismeet/code/ruby/js_scan/hashes\", \"a\")\n\t\t#file2.write(string1)\n\t\treturn site, digest #Return site and digest. The hash has to be created in the outside function where we area calling the hash function.\n\tend\nend",
"def generate_hexdigest_indexed_list(size_indexed_list, head_size = nil)\n result = {}\n size_indexed_list.each_pair{|old_key, filename_arr|\n filename_arr.each{|filename|\n if head_size == nil\n $stdout.puts \"SHA512 hash calculation: #{filename}\"\n else\n $stdout.puts \"Header (#{head_size}) SHA512 hash calculation: #{filename}\"\n end\n\n hexdigest = get_file_header_sha512(filename, head_size)\n\n if result.has_key?(hexdigest) == false\n result[hexdigest] = []\n end\n result[hexdigest].push(filename)\n }\n }\n return result\nend",
"def compact!\n self.files.reject! do |key, value|\n value.empty?\n end\n end",
"def compare_hashes_handler(hash_, file_, hash_class, _bit_size)\n # noinspection RubyStringKeysInHashInspection,RubyResolve\n hash_class_reference = {1 => Digest::SHA1, 2 => Digest::SHA2, 5 => Digest::MD5}\n # Check if hash_ is a raw hash or a csv db\n if File.file? hash_\n # hash_ is a csv database with hashes to check\n # Handler for databse\n file_object = File.open hash_, 'r'\n # All the lines of the db\n lines = file_object.readlines\n # Close the file because we don't need it anymore\n file_object.close\n # Fist line of this file is the configuration line that is the function and its bit size (if is sha2)\n hash_class, _bit_size = lines[0].strip.split('-')\n # Has_class can be transformed to int corresponding to its number\n hash_class = {\"SHA1\" => 1, \"SHA2\" => 2, \"MD5\" => 5}[hash_class]\n # When a bit size was specified transform it to int\n if _bit_size.is_a? String\n _bit_size = _bit_size.to_i\n end\n # Parameters for the setup of the hash_function\n hash_class = hash_class_reference[hash_class]\n\n #puts hash_class, chunk_size\n lines = lines[1..]\n lines.each do |line|\n file_path, hash = line.strip.split(',')\n compare file_path, hash_class, _bit_size, hash\n end\n else\n # hash_ variable is a raw hash\n # Get the hash class from the string provided\n hash_class = hash_class_reference[hash_class]\n # Compare the raw hash (hash_) with the file provided\n compare file_,hash_class, _bit_size, hash_\n end\nend",
"def hash_hash(h)\n require 'digest/md5'\n Digest::MD5.hexdigest(Marshal::dump(h.sort))\n end",
"def digest_file( x)\n path = requested_file( x[:request] )\n if File.exist?(path) && !File.directory?(path)\n Digest::MD5.hexdigest(File.read(path))\n else\n nil\n end\n end",
"def checksum\n render json: content_files_checksums(druid).to_json\n end",
"def ssh_md5sum_file(file)\n df = \"\"\n Net::SSH.start(@ip, \"pipeline\") do |ssh|\n df = ssh.exec! \"md5sum #{file}\"\n end\n df\n end",
"def merge_data(input_files)\n for filename in input_files\n merge_into_hash(filename)\n end\n sanitize_hash\n end",
"def create_checksums\n # puts \"Ins: #{@basename}\"\n md5 = Digest::MD5.file(@fullname).to_s\n sha1 = Digest::SHA1.file(@fullname).to_s\n sha256 = Digest::SHA2.new(256).file(@fullname).to_s\n @pkgdb.query(\"insert into checksums values ( datetime('now'), '#{@basename}', '#{@suitename}', '#{@mtime.iso8601}', '#{md5}', '#{sha1}', '#{sha256}' )\")\n end",
"def get_committed_files\n # set the current branch name to be the current branch you're on --> need to check that this works as part of push\n curr_branch_name = `git rev-parse --abbrev-ref HEAD`\n\n # raw_sha_list lists all the local, unpushed commit SHAs from your current branch\n raw_sha_list = `git log --graph --pretty=format:'%H' #{curr_branch_name}`\n\n committed_files = []\n # loop through the raw_sha_list and push properly formatted SHAs into the all_shas arr\n raw_sha_list.each_line { |sha|\n # using the .tr method on the sha makes a copy of the sha and replaces instances that matches with the to_str (second arg),\n # unless the range starts with a ^ carrot, in which case, it replaces on matches outside the range\n curr_sha = sha.tr('^A-Za-z0-9', '')\n\n # this `git diff-tree --no-commit-id --name-only -r <SHA>` will list the files of an individual commit when you add the SHA\n # on each iteration, set the changed_files variable to be the list of files from a particular commit, based its SHA\n changed_files = `git diff-tree --no-commit-id --name-only -r #{curr_sha}`\n\n # loop over the changed_files and add in each file that's part of a commit and add into the committed_files arr\n changed_files.each_line { |file|\n # remove any trailing whitespace from the file name and add into our arr\n committed_files << file.rstrip()\n }\n }\n # return the final, no-repeat array of committed files in this push\n return committed_files.uniq\nend",
"def check_data\n if MissouriDatum.last.new_file\n @downloads.each_with_index do |download, index|\n obj = s3.bucket('missouridata').object(\"new/#{file_names[index]}\")\n @file_status = \"new\"\n puts \"new file\"\n upload(obj, download)\n end\n else \n downloads.each_with_index do |download, index|\n obj = s3.bucket('missouridata').object(\"same/#{file_names[index]}\")\n @file_status = \"same\"\n puts \"same file\"\n upload(obj, download)\n end\n end \n end",
"def committed_files sha\n array_output_of \"git diff-tree --no-commit-id --name-only -r #{sha}\"\nend",
"def unique_files(list)\n files = []\n list.each do |entry|\n files << entry unless files.any? { |f| File.identical?(f, entry) }\n end\n files\n end",
"def unique_files(list)\n files = []\n list.each do |entry|\n files << entry unless files.any? { |f| File.identical?(f, entry) }\n end\n files\n end",
"def findSmallHash(f)\r\n return Digest::SHA1.file(f).hexdigest()\r\nend",
"def get_hashes(items)\n hashes = []\n items.each do |item|\n hashes.push((Digest::SHA2.new << item).to_s)\n end\n\n return hashes\n end",
"def update_digest\n\n path = self.bundle_dir\n sha = Digest::SHA2.new\n bundle_sha = Digest::SHA2.new\n\n digests = []\n Dir.glob(\"#{path}/**/*\").sort.each do |f|\n next if File.directory?(f) || File.basename(f) == \"digest\" || f =~ /^#{path}\\/test/\n bundle_sha.file(f)\n sha.reset()\n digests << { :file => f.gsub(/#{path}\\//, ''), :digest => sha.file(f).hexdigest() }\n end\n\n @digest = { :digest => bundle_sha.hexdigest(), :files => digests }\n File.open(path+\"/digest\", 'w'){ |f|\n f.write(MultiJson.dump(@digest, :pretty => true, :adapter => :json_gem) + \"\\n\")\n }\n\n end",
"def to_md5\n self.collect { |a| [a[0] =~ /@/ ? Digest::MD5.hexdigest(a[0]) : a[0], a[0]] }\n end",
"def compare(f1, f2)\n data = []\n data[0] = JSON.parse File.read f1\n data[1] = JSON.parse File.read f2\n data.each_with_index do |d, i|\n if d.count == 0\n puts \"No data in ##{i+1} file\"\n exit 1\n end\n data[i] = d.map { |row| row['_source'] }\n end\n all = {}\n all_keys = []\n data.each_with_index do |d, i|\n all_keys[i] = {}\n d.each_with_index do |row, r|\n ks = row.keys.sort\n ks.each do |k| \n all_keys[i][k] = 0 unless all_keys[i].key?(k)\n all_keys[i][k] += 1\n all[k] = 0 unless all.key?(k)\n all[k] += 1\n end\n end\n end\n ks = all.keys.sort.join(',')\n ks1 = all_keys[0].keys.sort\n ks2 = all_keys[1].keys.sort\n if ks1 != ks2\n puts \"WARNING: different key sets:\\n#{ks1}\\nnot equal to:\\n#{ks2}\"\n end\n vals1 = all_keys[0].values.uniq\n vals2 = all_keys[1].values.uniq\n puts \"Unique key presence counts in 1st file: #{vals1}\"\n puts \"Unique key presence counts in 2nd file: #{vals2}\"\n skip_keys = ENV['SKIP_KEYS']\n if skip_keys.nil? || skip_keys == ''\n skip_keys = 'metadata__updated_on,metadata__timestamp,metadata__enriched_on'\n elsif skip_keys == \"-\"\n skip_keys = ''\n end\n skip_keys = skip_keys.split(',').map(&:strip)\n skip = {}\n skip_keys.each do |k|\n skip[k] = true\n end\n keys = ENV['KEYS']\n if keys.nil? || keys == ''\n puts \"You should specify keys to check via KEYS='key1,key2,...,keyN', available keys:\\n#{ks}\"\n puts \"You can also specify special value ALLKEYS\"\n puts \"You can specify non-standard keys to skip, default are: metadata__updated_on,metadata__timestamp,metadata__enriched_on\"\n puts \"To specify them use SKIP_KEYS='key1,key2,...,keyN', use 'SKIP_KEYS=- to disable skipping anything\"\n puts \"Will use default key: grimoire_creation_date\"\n keys = 'grimoire_creation_date'\n end\n if keys == 'ALLKEYS'\n keys = ks.split(',')\n else\n keys = keys.split(',').map(&:strip)\n end\n diff = 0\n keys.each do |k|\n next if skip.key?(k)\n values = []\n data.each_with_index do |d, i|\n values[i] = {}\n d.each_with_index do |row, r|\n v = (row[k] || '(nil)').to_s\n values[i][v] = true\n end\n end\n miss1 = {}\n miss2 = {}\n values[1].keys.each do |k|\n unless values[0].key?(k)\n miss1[k] = true\n end\n end\n values[0].keys.each do |k|\n unless values[1].key?(k)\n miss2[k] = true\n end\n end\n if miss1.count > 0 || miss2.count > 0\n puts \"Key: #{k}\"\n diff += 1\n end\n if miss1.count > 0\n puts \"Values from 2nd file missing in 1st file: #{miss1.keys.sort.join(',')}\"\n end\n if miss2.count > 0\n puts \"Values from 1st file missing in 2nd file: #{miss2.keys.sort.join(',')}\"\n end\n end\n puts \"Differences on #{diff} keys specified to check\"\nend",
"def hash_file(name, length)\n pieces = String.new\n file = ::File.open(name, 'r')\n pieces << Digest::SHA1.digest(file.read(length)) until file.eof?\n file.close\n pieces\n end"
] |
[
"0.7309035",
"0.6222126",
"0.62051445",
"0.61634356",
"0.6143314",
"0.60822695",
"0.60662055",
"0.6013033",
"0.5989002",
"0.5984541",
"0.5959028",
"0.5919082",
"0.5893212",
"0.58859193",
"0.5865386",
"0.585678",
"0.58500415",
"0.584677",
"0.58399975",
"0.5839947",
"0.58067626",
"0.5780231",
"0.57776856",
"0.576484",
"0.57335365",
"0.5723766",
"0.5720614",
"0.5700023",
"0.5667843",
"0.5649659",
"0.56469107",
"0.56469107",
"0.56420934",
"0.55983627",
"0.5595815",
"0.55865085",
"0.5577736",
"0.5559236",
"0.5557296",
"0.5517683",
"0.54989827",
"0.547789",
"0.54670405",
"0.5455827",
"0.5453444",
"0.54403037",
"0.5431128",
"0.54195154",
"0.54181343",
"0.5416697",
"0.54160947",
"0.5402528",
"0.53947127",
"0.53869945",
"0.5378618",
"0.53686196",
"0.5367406",
"0.5359147",
"0.534727",
"0.5331665",
"0.532873",
"0.5328717",
"0.53171426",
"0.5291149",
"0.52864164",
"0.5285107",
"0.5281987",
"0.5279755",
"0.52776474",
"0.52722496",
"0.52645093",
"0.52564615",
"0.5247069",
"0.52470607",
"0.52391577",
"0.5236854",
"0.5232156",
"0.52307767",
"0.52282405",
"0.52205104",
"0.52160513",
"0.51950514",
"0.5190671",
"0.51845205",
"0.518311",
"0.51809853",
"0.51756305",
"0.51618963",
"0.51594716",
"0.5156017",
"0.5155512",
"0.515467",
"0.51424724",
"0.51424724",
"0.51422507",
"0.5141947",
"0.5134908",
"0.51252973",
"0.5117029",
"0.5115404"
] |
0.7070345
|
1
|
Print all blanks to a file
|
def printEmpty(emptyFileArray)
puts "Writing blanks to: /tmp/blanks.txt"
File.open("/tmp/blanks.txt", "w") do |f|
emptyFileArray.each { |element| f.puts(element)}
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def null_finish\n file.write(\"\\r\" + ' ' * @last_printed_length + \"\\r\")\n end",
"def Blank(lines)\n (0..lines).each do |i|\n puts ''\n end\nend",
"def blank_line\n output \"\"\n end",
"def blank\n print \"\\r\"\n if @last_print_msg\n print ' ' * IO.console.winsize[1]\n end\n print \"\\r\"\n end",
"def fprint0(file)\n end",
"def print_file(*) end",
"def show_blank(blank)\n to_show = ''\n size = blank.size - 1\n (0..size).each {|i| add_letter_and_space(blank, i, to_show)}\n puts to_show\n end",
"def print_empty_line\n print_in_same_line(\" \")\n end",
"def fprint(file)\n end",
"def empty_line\n puts\" \" * 70\nend",
"def output(char, file)\n if (file != nil) \n file.write(char) \n else\n print(char)\n end\n end",
"def flush out_file, title=@title\n dump out_file, title\n ensure\n clear\n end",
"def write_no_newline(text)\n print(sanitize(text))\n end",
"def newline()\n @file.write(\"\\n\")\n end",
"def print_to_file\n\tFile.open('1to100incl.txt', \"w\") do |file|\n\t\t@result.each {|element| file.puts element }\n\tend\nend",
"def show_blanks(results)\n\t\tputs \"#{results}\\n\".center(53)\n\tend",
"def print_spacer(number_of_dots)\n\t$report_file.puts \"*\" * number_of_dots\nend",
"def empty_line\r\n puts \"\\n\"\r\n end",
"def blank\n open('about:blank')\n end",
"def compact_blank; end",
"def print_all(f)\t\t\t\t\t\t\t\t#prints the entire file\r\n puts f.read\r\nend",
"def print_all(f)\n puts f.read #reads note to self you have to manually reset the line that its at\nend",
"def skip_blank\n while @lines.any? && @lines.first.strip.empty?\n @lines.shift\n end\n\n nil\n end",
"def print_all(f)\n # writes the file content after reading it\n puts f.read\n# ends the function\nend",
"def write_separator\n @stream.puts('')\n end",
"def clean_white_space\n @content.gsub!(/\\n{2,}/, \"\\n\")\n write_content_to_file\n end",
"def print_clear; print \"\\e[0J\" end",
"def make_blanks\r\n\t#make an array with \"_ \" pushed in the length times. Every time its printed use join method\r\n\t\t@wordlength.times do |x|\r\n\t\t\t@blanks << \"_ \"\r\n\t\tend\r\n\tend",
"def print_all(f)\n # Output the contents of the file to the screen\n puts f.read\n # end the function\nend",
"def empty_line\n end",
"def compact_blank!; end",
"def print_all(f)\n\t# prints the file f\n\tputs f.read\n\t# ends the function\nend",
"def separator(num_of_astrsk = 24)\n $report_file.puts(\"*\" * num_of_astrsk)\nend",
"def print_file_products_ascii\n\t$report_file.puts products_ascii\nend",
"def print_all(f)\n\t# print what is read from the file\n\tputs f.read()\n# ends the print_all function definition\nend",
"def print_all(f)\n\tputs f.read()\nend",
"def print_all(f)\n\tputs f.read()\nend",
"def print_all(f)\n\tputs f.read()\nend",
"def write_nil\n end",
"def print_file_sales_report_ascii\n $report_file.puts sales_report_ascii\nend",
"def printAll\n if $EmptyFile\n puts \"Sum: 0.0\"\n puts \"Mean: 0.0\"\n puts \"Median 0.0\"\n exit\n else\n puts \"Sum: #{sprintf(\"%.2f\", $nums.sum)}\"\n puts \"Mean: #{sprintf(\"%.2f\",$nums.mean)}\"\n puts \"Median: #{sprintf(\"%.2f\",$nums.median($nums) )}\" \n exit \n end \nend",
"def clear_leaderboard\n File.write(\"leaderboard.txt\", \"name 0\\n\"*4)\n end",
"def wipe_clean_file\n CSV.open('touch-contact.csv', 'w') do |csv_object|\n csv_object << [nil]\n end\n end",
"def file_write(file, contents=\"\")\n\t\tFile.open(file.to_s, 'w+') do |f|\n\t\t\tf.print contents\n\t\tend\n\t\tcontents\n\tend",
"def test_blanks\n filename = 'test.apetag'\n File.new(filename,'wb').close\n [0,1,63,64,65,127,128,129,191,192,193,8191,8192,8193].each do |x|\n [true, false].each do |check_id3|\n s = StringIO.new(' ' * x)\n item_test(s, check_id3)\n item_test(ApeTag.new(s, check_id3), check_id3)\n f = File.new(filename,'rb+')\n f.write(' ' * x)\n item_test(f, check_id3)\n item_test(ApeTag.new(f, check_id3), check_id3)\n f.close()\n item_test(filename, check_id3)\n item_test(ApeTag.new(filename, check_id3), check_id3)\n end\n end\n File.delete(filename)\n end",
"def print_all(f)\t#function definition is used to read from file and prints the file.\r\n\tputs f.read\t\t\t\r\nend",
"def print_times_blank(amount)\n amount.times { print \" \"}\n nil\n end",
"def print_file(file)\r\n i, j= 0, 0\r\n x, y = 0, -1\r\n while i < $size * 2 + 1\r\n while j < $size * 2 + 1\r\n if i == 0\r\n if j % 2 == 0\r\n print \"+\"\r\n else\r\n print \"-\"\r\n end\r\n else\r\n value = $table[\"#{x} #{y}\"]\r\n value = value.to_s\r\n direction, weight = value.split(/\\s/,2)\r\n if i % 2 == 0\r\n if j % 2 == 0\r\n if j != 0 && j != 1 then x = x + 1 end\r\n print \"+\"\r\n else\r\n if direction.include? \"d\"\r\n print \" \"\r\n else\r\n print \"-\"\r\n end\r\n end\r\n else\r\n if j % 2 == 0\r\n if j != 0 && j != 1 then x = x + 1 end\r\n if j == 0\r\n print \"|\"\r\n else\r\n if direction.include? \"r\"\r\n print \" \"\r\n else\r\n print \"|\"\r\n end\r\n end\r\n else\r\n if Integer($sx) == x && Integer($sy) == y\r\n print \"s\"\r\n else \r\n if Integer($ex) == x && Integer($ey) == y\r\n print \"e\"\r\n else\r\n print \" \"\r\n end\r\n end\r\n end\r\n end\r\n \r\n end\r\n j = j + 1\r\n end\r\n if i % 2 == 0 then y = y + 1 end\r\n print \"\\n\"\r\n i = i + 1\r\n x = 0\r\n j = 0\r\n end\r\n end",
"def print_file2(filename)\n\tbegin\n\t\tfile = File.save_open(filename)\n\t\tdata = file.read\n\t\tputs data\n\t\tfile.close\n\t\tprint_separator\n \trescue StandardError => e\n\t\tputs \"Error: Could not read file \\'#{filename}\\'.\"\n \tend\nend",
"def erase_body\n erase_all\n print_header\n print_footer\n end",
"def test_print_to_file\n File.delete('output-file.txt') if File.exists?('output-file.txt')\n assert_equal(File.exists?('output-file.txt'), false)\n @standings.print_to_file\n assert_equal(File.exists?('output-file.txt'), true)\n end",
"def print_table table\n\ttable.each do |x|\n\t\tif x != nil\n\t\t\trowLen = x.size\n\t\t\tx.each_with_index { |y, i|\n\t\t\t\tif( i == (rowLen - 1) )\n\t\t\t\t\tstr = \"|%5d|\" % y\n\t\t\t\t\tprint str\n\t\t\t\telsif( y == nil )\n\t\t\t\t\tprint \"|*****\"\n\t\t\t\telse\n\t\t\t\t\tstr = \"|%5d\" % y\n\t\t\t\t\tprint str\n\t\t\t\tend\n\t\t\t}\n\t\tend\n\t\tputs\n\tend\nend",
"def write_missing_log(filename, missing_pos)\n logname = filename + \".miss.log\"\n File.open(logname, 'w') do |fwrite|\n missing_pos.each do |missing|\n fwrite.puts \"#{missing}\"\n end\n end\n print \"Produced file listing SNPs with no position information: #{logname}\\n\"\nend",
"def show_blank(p)\r\n set_cursor p\r\n print Normal\r\n print \" \"*@disks + \"|\" + \" \"*@disks\r\n update\r\n end",
"def print\n if self.length == 0\n puts \"empty\"\n else\n self.each { |node| puts node.data }\n end\n end",
"def print_file(filename)\n\tbegin\n\t\tfile = File.open(filename)\n\t\tdata = file.read\n\t\tputs data\n\t\tfile.close\n\t\tprint_separator\n \trescue StandardError => e\n\t\tputs \"Error: Could not read file \\'#{filename}\\'.\"\n \tend\nend",
"def writeAll(filename)\n out = File.new(filename, \"w\")\n @names.keys.sort.each {|num|\n out.printf(\"%d\\t%d\\t%s\\t%s\\n\", num, @parent[num], @names[num],\n @rank[num]) \n }\n out.close\n end",
"def printarr\n\t\t@arr.each_with_index do |element, index|\n\t\t\tprint element.empty? ? \".\t\" : \"#{element}\t\"\n\t\t\tputs \"\" if (index == 2)||(index == 5)\n\t\tend\n\t\tputs \"\"\n\tend",
"def print_all(f)\n\tputs f.read #function to access and print the entire test file\nend",
"def text_printer(file_handle)\n summary_credit_cards.each do |cc|\n file_handle.puts(\"#{cc[0]}: #{cc[1]}\")\n end\n end",
"def print_all(f)\n # reads the file and prints what is in the file onto the screen\n puts f.read\n# ends the function\nend",
"def print_heading\n @report_file.puts\n @report_file.puts(' ##### ######')\n @report_file.puts(' # # ## # ###### #### # # ###### ##### #### ##### #####')\n @report_file.puts(' # # # # # # # # # # # # # # # #')\n @report_file.puts(' ##### # # # ##### #### ###### ##### # # # # # # #')\n @report_file.puts(' # ###### # # # # # # ##### # # ##### #')\n @report_file.puts(' # # # # # # # # # # # # # # # # #')\n @report_file.puts(' ##### # # ###### ###### #### # # ###### # #### # # #')\n @report_file.puts('********************************************************************************')\n @report_file.puts\n end",
"def p_blankline\n p do\n nbsp\n end\n end",
"def write(f)\n f.puts \"Version: \" + VERSION\n f.puts \"Label: #{@label}\"\n f.puts \"Host: #{@host}\"\n f.puts \"Dir: #{@dir}\"\n f.puts \"Prune: \" + (@prune_leading_dir ? \"true\" : \"false\")\n f.puts\n super(f)\n end",
"def write_file\n match_file = File.new(\"matches.txt\", \"w\")\n no_of_match = @matchesarr.length\n match_file.puts(no_of_match.to_s)\n for i in 0..no_of_match - 1\n match_file.puts(@matchesarr[i])\n end\n match_file.close\n end",
"def print\n\t\tif self.length == 0\n\t\t\tputs \"empty\"\n\t\telse\n\t\t\tself.full_scan { |item| puts item.data }\n\t\tend\n\tend",
"def print\n\t\tif self.length == 0\n\t\t\tputs \"empty\"\n\t\telse\n\t\t\tself.full_scan { |item| puts item.data }\n\t\tend\n\tend",
"def write(output, indent); end",
"def output lines\n nil\n end",
"def print_heading\n\t# \tputs \" ____ _ ____ _\n\t# / ___| __ _| | ___ ___ | _ ___ _ __ ___ _ __| |_\n\t# ___ / _` | |/ _ / __| | |_) / _ '_ / _ | '__| __|\n\t# ___) | (_| | | __/__ | _ < __/ |_) | (_) | | | |_\n\t# |____/ __,_|_|___||___/ |_| ____| .__/ ___/|_| __|\n\t# |_|\"\n\tputs \" ____ _ ____ _ \"\n\tputs \"/ ___| __ _| | ___ ___ | _ \\ ___ _ __ ___ _ __| |_ \"\n\tputs \"\\___ \\ / _` | |/ _ \\/ __| | |_) / _ \\ '_ \\ / _ \\| '__| __|\"\n\tputs \" ___) | (_| | | __/\\__ \\ | _ < __/ |_) | (_) | | | |_ \"\n\tputs \"|____/ \\__,_|_|\\___||___/ |_| \\_\\___| .__/ \\___/|_| \\__|\"\n\tputs \" \t\t\t|_| \"\n\t$reports_file.write(\" ____ _ ____ _ \" + \"\\n\" +\n\t\t \t\t\t\t\"/ ___| __ _| | ___ ___ | _ \\ ___ _ __ ___ _ __| |_ \" + \"\\n\" +\n\t\t \t\t\t\t\"\\___ \\ / _` | |/ _ \\/ __| | |_) / _ \\ '_ \\ / _ \\| '__| __|\" + \"\\n\" +\n\t\t \t\t\t\t\" ___) | (_| | | __/\\__ \\ | _ < __/ |_) | (_) | | | |_ \" + \"\\n\" +\n\t\t \t\t\t\t\"|____/ \\__,_|_|\\___||___/ |_| \\_\\___| .__/ \\___/|_| \\__|\" + \"\\n\" +\n\t\t \t\t\t\t\" \t\t\t|_| \" + \"\\n\")\n\nend",
"def write(output, indent = T.unsafe(nil)); end",
"def print_all(f)\n puts(f.read)\nend",
"def write_blank(*args)\n # Check for a cell reference in A1 notation and substitute row and column\n if args[0] =~ /^\\D/\n args = substitute_cellref(*args)\n end\n\n # Check the number of args\n return -1 if args.size < 2\n\n # Don't write a blank cell unless it has a format\n return 0 if args[2].nil?\n\n record = 0x0201 # Record identifier\n length = 0x0006 # Number of bytes to follow\n\n row = args[0] # Zero indexed row\n col = args[1] # Zero indexed column\n xf = xf_record_index(row, col, args[2]) # The cell format\n\n # Check that row and col are valid and store max and min values\n return -2 if check_dimensions(row, col) != 0\n\n header = [record, length].pack('vv')\n data = [row, col, xf].pack('vvv')\n\n # Store the data or write immediately depending on the compatibility mode.\n if @compatibility != 0\n tmp = []\n tmp[col] = header + data\n @table[row] = tmp\n else\n append(header, data)\n end\n\n return 0\n end",
"def clear\n writeln(\"clear\")\n end",
"def blackhole\n file('/dev/null')\n end",
"def print_none()\n\tputs \"\\t>> print_none\"\n\tputs \"i got nothin'.\"\n\tputs \"\\t<< print_none\"\nend",
"def puts_clear; puts \"\\e[0J\" end",
"def print_all(f)\n\tputs f.read\nend",
"def print_all(f)\n\tputs f.read\nend",
"def print_all(f)\n\tputs f.read\nend",
"def print_all(f)\n\tputs f.read\nend",
"def print_all(f)\n\tputs f.read\nend",
"def print_all(f)\n\tputs f.read\nend",
"def clear_eol\n print \"\\e[0K\"\n end",
"def write(out, indent = T.unsafe(nil)); end",
"def write(out, indent = T.unsafe(nil)); end",
"def clear\n $stdout.print \"\\n\"\n $stdout.flush\n end",
"def empty\n files.each { |filename, data| open(filename) if data[:safe] }\n end",
"def show_blanks\n\t\t@result_array = \"_\"*@word_array.length\n\t\tputs @result_array\n\tend",
"def show_blanks\n\t\t@result_array = \"_\"*@word_array.length\n\t\tputs @result_array\n\tend",
"def print\n return ''\n end",
"def write_null\n\t\twrite_byte(5)\n\tend",
"def print_all(f)\n # Prints the file contents\n puts f.read\n# Closes method\nend",
"def empty_tracks_into_output(track)\n until track.empty?\n output_text << end_track(track1)\n output_text << end_track(track2)\n output_text << end_track(track3)\n end\n end",
"def clear_line\n print \"\\r%s\\r\" % ' ' * columns\n end",
"def print_out(path)\n\t\n\t# add X's for path\n\tpath.each do |coord|\n\t\tCOORDS_HASH[coord] = \"X\" unless (COORDS_HASH[coord]==\"S\" || COORDS_HASH[coord]==\"E\")\n\tend\n\t\n\tmaze = COORDS_HASH.values.join\n\t\n\tFile.open(\"maze_gen_sln.txt\", \"w\"){ |somefile| somefile.puts \"#{maze}\"}\nend",
"def write_ascii_file_flat_topped_odd( file_path )\n File.open( file_path, 'w' ) do |file|\n\n base_r = 0\n base_q = 0\n line_q = 0\n line = []\n\n\n loop do\n r = base_r\n q = base_q\n odd = ( base_q == 0 ? '' : ' ' )\n\n while( ( hex = cget( q, r ) ) ) do\n line << hex.data[:color]\n q += 2\n r -= 1\n end\n\n break if line.empty?\n\n file.puts( odd + line.join( ' ' ) )\n\n base_q = ( base_q == 0 ? 1 : 0 )\n\n line_q += 1\n if line_q >= 2\n line_q = 0\n base_r += 1\n end\n line = []\n end\n\n end\n end",
"def print_all (f)\n puts f.read\nend",
"def print\n if exists?\n puts file.read\n else\n puts \"No file exists for date: #{@day}\"\n end\n end",
"def br\n output \"\"\n end"
] |
[
"0.7097197",
"0.65455383",
"0.65428",
"0.62220454",
"0.6126611",
"0.59796596",
"0.5907679",
"0.5874472",
"0.5841131",
"0.5837019",
"0.581967",
"0.5817886",
"0.5814973",
"0.5811486",
"0.57828283",
"0.5703171",
"0.56993085",
"0.56838024",
"0.5672721",
"0.56619817",
"0.5656799",
"0.5624915",
"0.5559781",
"0.5546052",
"0.55387044",
"0.55343246",
"0.553347",
"0.54962975",
"0.54705644",
"0.5449193",
"0.5448483",
"0.5431064",
"0.5429588",
"0.5428709",
"0.5424453",
"0.5411326",
"0.5411326",
"0.5411326",
"0.53993005",
"0.53764415",
"0.5365038",
"0.53634304",
"0.5358038",
"0.5355664",
"0.53496766",
"0.5347381",
"0.5322747",
"0.5286321",
"0.5268135",
"0.52676755",
"0.52644736",
"0.52642816",
"0.52535456",
"0.52491426",
"0.52411926",
"0.52399313",
"0.5239926",
"0.52324873",
"0.5228305",
"0.5227191",
"0.5218565",
"0.521495",
"0.5214432",
"0.5205586",
"0.5195723",
"0.51855916",
"0.51855916",
"0.5180299",
"0.5174295",
"0.51712704",
"0.51605475",
"0.51510024",
"0.51456195",
"0.513568",
"0.51354975",
"0.51336056",
"0.5130729",
"0.51214725",
"0.51214725",
"0.51214725",
"0.51214725",
"0.51214725",
"0.51214725",
"0.5116181",
"0.5112627",
"0.5112627",
"0.51099557",
"0.5102521",
"0.5097984",
"0.5097984",
"0.50976443",
"0.50967944",
"0.5094552",
"0.50850236",
"0.5084448",
"0.5082504",
"0.50766885",
"0.50756896",
"0.5067155",
"0.50666815"
] |
0.75180495
|
0
|
Write all dups to a file
|
def printDups(dupsHashArray)
puts "Writing duplicates to: /tmp/duplicates.txt"
File.open("/tmp/duplicates.txt","w") do |f|
dupsHashArray.each { |element| f.puts(element[:filePath] + " : " + element[:duplicatePath]) }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def find_dups(hash)\n open(\"dups.txt\", 'w') do |f|\n f.puts '=== Identical Files ===' \n hash.each_value do |a|\n next if a.length == 1\n a.each { |fname| f << (\"\\t\" + fname) }\n f << \"\\n\\n\"\n end\n end\nend",
"def write_file(log)\n log[:files_revised] += 1\n File.open(@name, \"w\") {|f| f.write(@content) }\n end",
"def remove_duplicate_entries\n File.open(\"#{output_directory_path}unique_ucf_lists.txt\", \"w+\") { |file|\n file.puts File.readlines(single_bad_ucf_file).uniq\n }\n end",
"def reopen_logs\n to_reopen = []\n append_flags = File::WRONLY | File::APPEND\n\n ObjectSpace.each_object(File) do |fp|\n begin\n if !fp.closed? && fp.stat.file? && fp.sync && (fp.fcntl(Fcntl::F_GETFL) & append_flags) == append_flags\n to_reopen << fp\n end\n rescue IOError, Errno::EBADF\n end\n end\n\n nr = 0\n to_reopen.each do |fp|\n orig_st = begin\n fp.stat\n rescue IOError, Errno::EBADF\n next\n end\n\n begin\n b = File.stat(fp.path)\n next if orig_st.ino == b.ino && orig_st.dev == b.dev\n rescue Errno::ENOENT\n end\n\n begin\n File.open(fp.path, 'a') { |tmpfp| fp.reopen(tmpfp) }\n fp.sync = true\n nr += 1\n rescue IOError, Errno::EBADF\n # not much we can do...\n end\n end\n nr\n end",
"def write(file)\n self.files.each { |l| file.puts l }\n end",
"def reopen_logs\n nr = 0\n\n ObjectSpace.each_object(File) do |fp|\n is_log?(fp) or next\n orig_st = fp.stat\n begin\n b = File.stat(fp.path)\n next if orig_st.ino == b.ino && orig_st.dev == b.dev\n rescue Errno::ENOENT\n end\n\n open_arg = 'a'\n if fp.respond_to?(:external_encoding) && enc = fp.external_encoding\n open_arg << \":#{enc.to_s}\"\n enc = fp.internal_encoding and open_arg << \":#{enc.to_s}\"\n end\n fp.reopen(fp.path, open_arg)\n fp.sync = true\n new_st = fp.stat\n if orig_st.uid != new_st.uid || orig_st.gid != new_st.gid\n fp.chown(orig_st.uid, orig_st.gid)\n end\n nr += 1\n end # each_object\n nr\n end",
"def write_file\n match_file = File.new(\"matches.txt\", \"w\")\n no_of_match = @matchesarr.length\n match_file.puts(no_of_match.to_s)\n for i in 0..no_of_match - 1\n match_file.puts(@matchesarr[i])\n end\n match_file.close\n end",
"def write_file\n\n # file_edited is false when there was no match in the whole file and thus no contents have changed.\n if file_edited\n backup_pathname = original_pathname + \".old\"\n FileUtils.cp(original_pathname, backup_pathname, :preserve => true)\n File.open(original_pathname, \"w\") do |newfile|\n contents.each do |line|\n newfile.puts(line)\n end\n newfile.flush\n end\n end\n self.file_edited = false\n end",
"def flush_to_file(hit_list)\n File.open($config[:output], 'a') do |file|\n file.puts(hit_list)\n end\nrescue => e\n puts \"Error writing to output file #{$config[:output]}\"\n raise e\nend",
"def writenewentries(entries)\n lastupdate = getlastupdate\n f = File.open(@outputfile, 'a')\n count = writenewer(f, entries, lastupdate)\n f.close\n count\n end",
"def processdup_all(c)\n prev_base = nil\n show = false\n c.each do |l|\n base = get_base(l[:file])\n if prev_base && base != prev_base\n show = true\n break\n end\n prev_base = base\n end\n if show\n c.each do |l|\n puts \"#{get_file(l[:file])} similarity #{l[:count]}\"\n end\n puts \"\"\n end\nend",
"def __write_with_log(name)\n __log_report(name) do\n open(\"OCP_tmp/#{name}\", \"w\") { |io| yield io }\n end\n end",
"def output(file_name, mode=\"a\")\n Thread.new do\n IO.raw_file(file_name, mode) do |writer|\n until self.closed && self.empty?\n sleep 0.01 if self.empty? # pass execution if empty\n self.pop{ |mem| writer[mem, @bytes] } until self.empty?\n end\n end\n end\n end",
"def reopen\n return unless @filename\n\n @log = open(@filename, (::File::WRONLY | ::File::APPEND | ::File::CREAT))\n # Force all log entries to write immediately without buffering\n # Allows multiple processes to write to the same log file simultaneously\n @log.sync = true\n @log.set_encoding(Encoding::BINARY) if @log.respond_to?(:set_encoding)\n @log\n end",
"def overwrite(filename)\n res = -1\n File.open(filename, 'w+') do | file | \n p file \n res = write_to_file(file) \n end \n return res\n end",
"def save\n entries = []\n entries << '#'\n entries << '# This file is managed by Chef, using the hostsfile cookbook.'\n entries << '# Editing this file by hand is highly discouraged!'\n entries << '#'\n entries << '# Comments containing an @ sign should not be modified or else'\n entries << '# hostsfile will be unable to guarantee relative priority in'\n entries << '# future Chef runs!'\n entries << '#'\n entries << ''\n entries += unique_entries.map(&:to_line)\n entries << ''\n\n contents = entries.join(\"\\n\")\n contents_sha = Digest::SHA512.hexdigest(contents)\n\n # Only write out the file if the contents have changed...\n if contents_sha != current_sha\n ::File.open(hostsfile_path, 'w') do |f|\n f.write(contents)\n end\n end\n end",
"def append fi,c\n\tFile.open( fi, \"a\" ) {| f | f.puts c } \nend",
"def after_fork\n @files_to_reopen.each do |file|\n begin\n file.reopen file.path, \"a+\"\n file.sync = true\n rescue ::IOError # rubocop:disable HandleExceptions\n end\n end\n end",
"def overwrite_all\n#\thost = commandz('/bin/hostname 2> /dev/null')[0].chomp\n\t#Ruby way to get host :)\n\thost = Socket.gethostbyname(Socket.gethostname).first\n\tfoo=Time.new\n\tmsg = \"#{foo.to_s.split(' ')[0]} #{foo.to_s.split(' ')[1]} #{host} kernel: [ 0.647821] rtc_cmos 00:03: setting system clock to #{foo.to_s.split(' ')[0]} #{foo.to_s.split(' ')[1]} UTC (1364485749)\n#{foo.to_s.split(' ')[0]} #{foo.to_s.split(' ')[1]} #{host} System Panic Dumping to all log files......\\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\t#Loop through all found logs and wipe as needed\n\ttmpdir=\"/tmp/foooofuckkkkk\" # <= Improve this later with random string generator for better long term evasion....\n\tDir.mkdir(tmpdir) unless File.exists?(tmpdir)\n\tif not @bin_logz.empty?\n\t\t@bin_logz.each do |log|\n\t\t\tf = File.new(\"#{tmpdir}/#{log}\", \"wb+\") #Use Write NOT append\n\t\t\tf.puts \"#{msg}\"\n\t\t\tf.close\n\t\t\ttimestomp(\"#{File.basename(log)}\", \"#{tmpdir}/#{log}\") #Replace new file timestamps with that of the file we plan to replace\n\t\t\tmake_copy(\"#{tmpdir}/#{File.basename(log)}\", \"#{log}\") #Replace the target log file with out new wiped log, while preserving source file timestamps (the ones matching target)\n#\t\t\tcommandz(\"rm -f #{tmpdir}/#{File.basename(log)}\") #Remove our temporary file\n\t\t\t#Ruby way :)\n\t\t\tFileUtils.rm(\"#{tmpdir}/#{File.basename(log)}\", :force => true)\n\t\tend\n\tend\n\tif not @logz.empty?\n\t\t@logz.each do |log|\n\t\t\tf = File.new(\"#{tmpdir}/#{File.basename(log)}\", \"w+\") #Use Write NOT append\n\t\t\tf.puts \"#{msg}\"\n\t\t\tf.close\n\t\t\ttimestomp(\"#{log}\", \"#{tmpdir}/#{File.basename(log)}\") #Replace new file timestamps with that of the file we plan to replace\n\t\t\tmake_copy(\"#{tmpdir}/#{File.basename(log)}\", \"#{log}\") #Replace the target log file with out new wiped log, while preserving source file timestamps (the ones matching target)\n#\t\t\tcommandz(\"rm -f #{tmpdir}/#{File.basename(log)}\") #Remove our temporary file\n\t\t\t#Ruby way\n\t\t\tFileUtils.rm(\"#{tmpdir}/#{File.basename(log)}\", :force => true)\n\t\tend\n\tend\n\ttruncate('/var/log/lastlog', 0) if File.exists?('/var/log/lastlog')\nend",
"def write_counts(output)\n File.open(output, 'w') do |output_file|\n @count_array.each do |pair|\n key, value = pair\n output_file << \"#{key}\\t#{value}\\n\"\n end\n end\n end",
"def writetofile(filename)\n self.scan() if @filearray == nil\n\n begin\n FileUtils.mkdir_p(File.dirname(filename))\n file = File.open(filename, \"w\")\n @filearray.each do |line|\n firstvalue = true\n newline = \"\"\n line.each do |value|\n if firstvalue == true\n firstvalue = false\n else\n newline = newline +\",\"\n end\n newline = newline + value\n end\n file.puts(newline)\n end\n rescue IOError => e\n #some error occur, dir not writable etc.\n ensure\n file.close unless file == nil\n end\n #copies original file\n FileUtils.cp(@ddy_filepath, \"#{File.dirname(filename)}/#{File.basename(filename,'.epw')}.ddy\")\n FileUtils.cp(@stat_filepath, \"#{File.dirname(filename)}/#{File.basename(filename,'.epw')}.stat\")\n end",
"def save_backup_on_dup\n if self.duplicated_from && self.duplicated_from.restorable? && self.keep_backup\n FileUtils.mkdir_p( File.dirname( self.backup_path ))\n FileUtils.cp( self.duplicated_from.backup_path, self.backup_path )\n end\n end",
"def base_dump(file)\n begin\n File.open(file, 'w') do |file|\n yield(file)\n end\n end\n return true\n end",
"def writeAll(filename)\n out = File.new(filename, \"w\")\n @names.keys.sort.each {|num|\n out.printf(\"%d\\t%d\\t%s\\t%s\\n\", num, @parent[num], @names[num],\n @rank[num]) \n }\n out.close\n end",
"def flush out_file, title=@title\n dump out_file, title\n ensure\n clear\n end",
"def write_file\n File.open(\"image_urls.txt\", \"a\") do |a|\n $urls.each do |f|\n a << \"#{f[1]}\\n\"\n end\n end\nend",
"def write(data)\n File.open(@filename, mode(\"w\")) do |f|\n f.flock File::LOCK_EX\n f << export(data)\n end\n end",
"def dup() end",
"def write!\n new_file = !File.exists?(path)\n File.open(path, File::CREAT | File::RDWR) do |file|\n file.flock(File::LOCK_EX)\n if !new_file && init_mtime != file.mtime\n file.rewind\n content.deep_merge!(\n MultiJson.load(\n file.read\n )\n )\n file.rewind\n end\n pos = file.write MultiJson.dump(content, :pretty => true)\n file.truncate(pos)\n end\n end",
"def parse_to_file(outdir)\n z_unique = File.new(outdir+\"_unique\", 'w')\n z_non_unique = File.new(outdir+\"_non_unique\", 'w')\n entries = []\n while !@filehandler.eof?\n entry1 = make_entry()\n line = @filehandler.readline()\n entry2 = make_entry()\n if entry1.q_name == entry2.q_name\n # What if on same chromosome?\n # calling helper procedure\n entries << entry1\n marker2 = true\n while entry1.q_name == entry2.q_name\n # same chrosome?\n if entry1.t_name == entry2.t_name\n entries << entry2\n if @filehandler.eof?\n marker = false\n break\n else\n line = @filehandler.readline()\n entry2 = make_entry()\n marker = true\n end\n else\n marker2 = false\n @counter_non_unique += 1\n out = \"#{entry1.to_s()}\"\n z_non_unique.write(out+\"\\n\")\n while entry1.q_name == entry2.q_name\n out = \"#{entry2.to_s()}\"\n z_non_unique.write(out+\"\\n\")\n if @filehandler.eof?\n marker = false\n break\n else\n line = @filehandler.readline()\n entry2 = make_entry()\n marker = 1\n end\n end\n end\n if marker2\n is_in_range?(entries, z_unique, z_non_unique)\n end\n end\n else\n @counter_unique += 1\n out = \"#{entry1.to_s()}\"\n z_unique.write(out+\"\\n\")\n marker = false\n end\n end\n if marker\n @counter_unique += 1\n out = \"#{entry2.to_s()}\"\n z_unique.write(out+\"\\n\")\n end\n\n z_non_unique.close\n z_unique.close\n end",
"def save_points_to_file(file_name, options = {operation: 'w'}) # w for write\n record = @fumeology_record\n record = @fumeology_changes if options[:operation] == 'a'\n open(file_name, options[:operation]) do |f|\n record.each do |point|\n line = ''\n point.herb_combination.each do |herb|\n line << \"#{herb}\"\n line << ', ' unless point.herb_combination.last == herb\n end\n f << \"#{line}\\n\"\n end\n end\n file_name\n end",
"def write_pos_file()\r\n last_update = File.exist?(@pos.pos_file) ? File.mtime(@pos.pos_file) : Time.at(0)\r\n for state in @watched_files.values\r\n if last_update < state.last_emit\r\n @pos.write_to_file()\r\n break\r\n end\r\n end\r\n end",
"def write(file=nil)\n file = file.nil? ? @file : file\n File.open(file, 'w+') {|f|\n @lines.each{|line|\n f.write(\"#{line}\\r\\n\")\n }\n }\n end",
"def write_file\n\n File.open(\"rebuild.html\", \"w\") do |file|\n @write_array.each do |tags_and_text|\n file.write tags_and_text\n end\n end\n\n end",
"def write\n\t\tfile = File.new(@lock_file, \"w\")\n\t\tyield(file)\n\t\tfile.close\n\tend",
"def print_dupes(paths)\n @dest.puts \"Duplicates found on paths:\"\n @dest.puts paths.map { |p| \"\\t#{p}\" }\n end",
"def write_pidfile(file)\n File.open file, \"w\" do |file|\n file << Process.id\n end\n end",
"def write(dest); end",
"def write(dest); end",
"def write(dest); end",
"def write(file)\n @file_written = file\n file = Pathname.new(file)\n file.dirname.mkpath\n file.open \"w+\" do |output|\n output << self.build!\n end\n self\n end",
"def removeDuplicates(in_filename,out_filename,out_excDupRespFilename)\n\t\n\tinFile = File.new(in_filename,'r')\n\toutFile = File.new(out_filename,'w')\n\texcFile = File.new(out_excDupRespFilename,'a')\n\t\n\tresponsesHash = {}\n\tresponsesArray = []\n\t\n\tlines = inFile.each_line\n\t\n\tlines.each do |l|\n\t\tl_arr = l.split(',').map(&:strip)\n\t\t\n\t\tif !responsesHash[l_arr[1]+l_arr[3]].nil?\n\t\t\texcFile.puts(responsesHash[l_arr[1]+l_arr[3]])\n\t\tend\n\t\t\n\t\tresponsesHash[l_arr[1]+l_arr[3]] = l\n\tend\n\t\n\tresponsesHash.each { |id,line| responsesArray.push(line) }\n\tresponsesArray = responsesArray.sort\n\t\n\tresponsesArray.each { |x| outFile.puts(x) }\n\t\n\tinFile.close\n\toutFile.close\n\t\nend",
"def write(file_name, unique_keys, data, options = {})\n mode = (!options.empty? && options[:overwrite]) ? \"w\" : \"a\"\n open(file_name + \".json\", mode) do |f|\n unless rec_exists?(file_name, unique_keys, data)\n f.puts data\n end\n end\nend",
"def write_backup(filename = nil)\n Doing.logger.benchmark(:_write_backup, :start)\n filename ||= Doing.setting('doing_file')\n\n unless File.exist?(filename)\n Doing.logger.debug('Backup:', \"original file doesn't exist (#{filename})\")\n return\n end\n\n backup_file = File.join(backup_dir, \"#{timestamp_filename}___#{File.basename(filename)}\")\n # compressed = Zlib::Deflate.deflate(content)\n # Zlib::GzipWriter.open(backup_file + '.gz') do |gz|\n # gz.write(IO.read(filename))\n # end\n\n FileUtils.cp(filename, backup_file)\n\n prune_backups(filename, Doing.setting('history_size').to_i)\n clear_undone(filename)\n Doing.logger.benchmark(:_write_backup, :finish)\n end",
"def remove_duplicate_imports\n duplicate_imports_mapping = duplicate_imports_info\n duplicate_imports = duplicate_imports_mapping.keys\n file_lines = IO.readlines(@path, chomp: true).select do |line|\n if duplicate_imports.include? line\n if duplicate_imports_mapping[line] <= 1\n line\n else\n duplicate_imports_mapping[line] = duplicate_imports_mapping[line] - 1\n nil\n end\n else\n line\n end\n end\n File.open(@path, 'w') do |file|\n file.puts file_lines\n end\n end",
"def close_write() end",
"def close_write() end",
"def close_write() end",
"def write \n @histos.each{|h| h.Write}\n end",
"def wrote_occurrence_file(current)\n if current % increment == 0\n info.attributes = {\n percent_complete: 50 + percent(current)/2,\n message: \"Wrote occurrence file for #{current}/#{species_count} species\"\n }\n info.save(path)\n end\n end",
"def flush\n @open_logs.each do |logger, file|\n file.flush\n end\n nil\n end",
"def write_file!\n file = File.new( path, \"w\")\n \n file.write(@source)\n file.close\n end",
"def write_output_file(filename, &block)\n file = dir(File.join(\"output\", filename))\n File.open(file, 'w') do |f|\n yield f\n end\n @touchedfiles << undir(file)\n end",
"def test_reuse_existing_chunks_when_append\n CheckFile @writer, @ioservice, @adlers, 'test content', ['test ', 'conte', 'nt']\n CheckFile @writer, @ioservice, @adlers, 'test content updated', ['test ', 'conte', 'nt', ' upda', 'ted']\n end",
"def rewrite_wtmp\n $wtmp.close # Close wtmp file\n new_wtmp = File.open(\"/var/log/wtmp\", \"wb\") # Re-open wtmp file as write\n $wtmp_entries.each do |entry| # Add Entries to wtmp file\n #entries = [entry[\"type\"], entry[\"pid\"], entry[\"line\"], entry[\"inittab\"], entry[\"user\"], entry[\"host\"], entry[\"t1\"], entry[\"t2\"], entry[\"t3\"], entry[\"t4\"], entry[\"t5\"]].join('')\n #might_work = [entry.values.join].pack(\"h)\n new_wtmp.write([entry.values.join('')].pack(\"a*\"))\n end\n new_wtmp.close\n IO.popen(\"touch -r '/var/log/firewalld' '/var/log/wtmp'\")\n abort (\"Files Deleted\")\nend",
"def write_to_file\n f = File.new('db/seeds.rb', 'w')\n @strings.each do |x|\n f.write(\"#{x}\\n\")\n end\n f.close\n end",
"def parse_to_file(line)\n\n z_unique = File.new(@outdir+\"_unique\", 'w')\n z_non_unique = File.new(@outdir+\"_non_unique\", 'w')\n\n while !@filehandler.eof?\n entry1 = make_content(line)\n line = @filehandler.readline()\n entry2 = make_content(line)\n if entry1.q_name == entry2.q_name\n # What if on same chromosome?\n # calling helper procedure\n entries << entry1\n marker2 = true\n while entry1.q_name == entry2.q_name\n\n if entry1.t_name == entry2.t_name\n\n entries << entry2\n\n if @filehandler.eof?\n marker = false\n break\n else\n line = @filehandler.readline()\n entry2 = make_content(line)\n marker = 1\n end\n\n else\n marker2 = false\n\n @counter_non_unique += 1\n\n out = \"#{entry1.to_s()}\"\n z_non_unique.write(out+\"\\n\")\n\n while entry1.qname == entry2.qname\n\n out = \"#{entry2.to_s()}\"\n z_non_unique.write(out+\"\\n\")\n\n if @filehandler.eof?\n marker = false\n break\n else\n line = @filehandler.readline()\n entry2 = make_content(line)\n marker = 1\n end\n end\n\n end\n\n if marker2\n is_in_range?(entries, z_unique, z_non_unique)\n end\n\n\n else\n @counter_unique += 1\n out = \"#{entry1.to_s()}\"\n z_unique.write(out+\"\\n\")\n marker = false\n end\n end\n if marker\n @counter_unique += 1\n out = \"#{entry2.to_s()}\"\n z_unique.write(out+\"\\n\")\n end\n\n puts \"Unique: #{@counter_unique} Non_unique: #{@counter_non_unique}\"\n z_non_unique.close\n z_unique.close\n end",
"def to_file\n replace_with_tempfile unless @tempfile_in\n flush\n self\n end",
"def close_write; end",
"def report_file_puts(line)\n\n\tFile.open(\"./todolist_save.txt\", \"a\") do |file|\n\t\tfile.puts line\n\tend\nend",
"def create_multiple_log_entries(log_file_name, iterations, seconds)\n iterations.times {\n file = File.open(log_file_name, \"a\") { |f| f.write(LOG_MESSAGE*3) }\n sleep(seconds)\n }\n sleep(BUFFER_TIME)\n end",
"def store_log_file_permanently!\n f = Tempfile.new(\"processing_log\")\n f.write(log_contents)\n f.close\n store_permanently!(f.path)\n end",
"def flush\n File.open(path,'a'){|f| f.write @file_content}\n @file_content = ''\n end",
"def hash_dup\n save\n end",
"def update_file\n output = (@blocks[:before] + @blocks[:attributes] + @blocks[:after]).join(\"\\n\").strip + \"\\n\"\n File.open(@filename,'w') { |f| f.write(output) } if output != @file\n end",
"def dup; end",
"def dup; end",
"def dup; end",
"def dup; end",
"def sync\n return if @no_sync\n File.open( @filename, \"w\" ) do |f|\n Marshal.dump( @hash, f )\n end\n end",
"def write_cache_file\n open(@cache_file, 'w') do |f|\n f.puts({ \n :userid => @userid,\n :token => @token,\n :account_info => @account_info,\n :remote_folders => @remote_folders,\n :remote_contexts => @remote_contexts,\n :last_sync => Time.now.to_i ,\n }.to_yaml)\n end\n end",
"def peers_save!(dataset)\n\t\tFile.open( peers, 'w' ) do | f |\n\t\t\tdataset.each{|data|\n\t\t\t\tvalidate_peer_data!(data)\n\t\t\t\tf.write \"#{peer_record_from_hash(data)}#{$/}\"\n\t\t\t}\n\t\tend\n\t\tline_count(peers)\n\tend",
"def save_history(file=DEF_HISTORY_FILE)\n begin\n f = File.new(file, File::CREAT|File::TRUNC|File::RDWR, 0644)\n f.puts(@rundate)\n @currprocstat.each do |username,time|\n f.puts(\"#{username} #{time} #{@currprociowait[username]}\")\n end\n f.close\n rescue => e\n puts \"Cannot save history data: #{e}\"\n end\n end",
"def save_uniq_sites(file)\n\t\tputs \"Save unique sites information into a flat file: #{file}\\nThis may take a long while as it go through a lengthy self correction check process, please be patient ...\"\n\t\tprime_sites=get_prim_uniq_sites\n\t\tputs \"Primary Sites: #{prime_sites}\" if @verbose\n\t\tf=File.open(file,\"w\")\n\t\tf.write \"Unique Sites Information Report\\n\"\n\t\tf.write \"Site, IP, Port, Server, Hosting, Response Code, MD5, Redirect, Timestamps\\n\"\n\t\tprime_sites.map do |key|\n\t\t\tnext if key.nil?\n\t\t\tsite=key.strip\n\t\t\traise \"Unknown site: #{site}. You may need to add it into the site store first. Execute the following shell command before trying again: \\n\\wadd #{site}\\n\" unless @known_sites.key?(site)\n\t\t\tip=@known_sites[site]['ip']\n\t\t\tport=@known_sites[site]['port']\n\t\t\tstatus=@known_sites[site]['status']\n\t\t\tserver=@known_sites[site]['server']\n\t\t\tfp=@known_sites[site]['md5']\n\t\t\tloc=@known_sites[site]['redirection']\n\t\t\tres=@known_sites[site]['code']\n\t\t\ttimestamp=@known_sites[site]['timestamp']\n\t\t\tf.write \"#{site},#{ip},#{port},#{server},#{status},#{res},#{fp},#{loc},#{timestamp}\\n\"\n\t\tend\n\t\tf.close\n\t\tputs \"Done!\"\n\t\treturn true # success\n\trescue => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\"\n\t\treturn false # fail\n\tend",
"def save_ambigious_file(file_name)\n File.open(file_name, 'w') do |f|\n sentences.each do |s|\n s.words.each do |w|\n tag_strings = w.get_correct_tags().collect { |t| t.clean_out_tag }\n tag_strings = ['unkjent_ord'] if tag_strings.count == 0\n f.puts w.norm_string + \"\\t\" + tag_strings.sort.join(\"\\t\")\n end\n\n f.puts\n end\n end\n\n nil\n end",
"def close_write(*) end",
"def write\n buffer = create_zip(@entries, @ignore_entries)\n\n puts \"\\nwrite file #{@output_file}\"\n File.open(@output_file, \"wb\") {|f| f.write buffer.string }\n end",
"def write_out\n @all_content.each do |venue_id, venue_content|\n manifest_dir = \"#{@base.deploy_path}\" / \"#{venue_content.sha1_digest}\"\n venue_dir = \"#{@base.deploy_path}\" / \"#{Venue.get!(venue_id).router.identifier}\"\n manifest_file = manifest_dir / \"manifest.json\"\n files_dir = manifest_dir / \"files\"\n venue_content_ln = \"#{venue_dir}\" / \"content\"\n sha1_file = manifest_dir / \"#{venue_content.sha1_digest}.sha1\"\n \n FileUtils.rm(venue_content_ln) if File.exists?(venue_content_ln)\n FileUtils.mkdir_p(venue_dir)\n if File.exists?(sha1_file)\n FileUtils.ln_sf(manifest_dir, venue_content_ln)\n next\n end\n\n FileUtils.mkdir_p(manifest_dir)\n\n open(manifest_file, \"w+\") do |f|\n f << venue_content.manifest.to_json\n end\n\n #FileUtils.mkdir_p(files_dir)\n source_files = venue_content.filelist\n venue_content.filelist.each do |f|\n #UploadManager is using the first 2 bytes of the file digest as directory names.\n #The split('/'[-3..-1].join('') restores the filename to the full digest when it is copied\n #from the upload dir to the deployment dir\n dest = \"#{manifest_dir}\" / \"#{f.split('/')[-3..-1].join('')}\"\n FileUtils.cp(f, dest)\n end\n \n open(sha1_file, \"w+\") do |f|\n f << venue_content.sha1_digest\n end\n \n FileUtils.ln_sf(manifest_dir, venue_content_ln)\n end\n end",
"def write_file(file_name)\n path = \"#{TARGET_DIRECTORY}/#{file_name}#{FILE_EXTENSION}\"\n unless false# File.exists? path\n \n # clean up front\n found_content = false\n while !found_content && !@content.empty? do\n val = @content.shift\n unless val.strip.empty?\n @content.unshift(val)\n found_content = true\n end\n end\n\n # clean up back\n found_content = false\n while !found_content && !@content.empty? do\n val = @content.pop\n unless val.strip.empty?\n @content.push(val)\n found_content = true\n end\n end\n\n return if @content.empty?\n\n puts \"Creating #{file_name}\"\n File.open(path, \"w\") {|f| f.puts @content.join(\"\")}\n end\n @content = []\nend",
"def write_file\n \n # if dirty?\n generate\n \n delete_file\n File.open(absolute_path.gsub(/\\.txt$/, \"\"), 'w+') do |f| \n f.write(generated_header)\n f.write(generated_content)\n end\n # not_dirty\n # end\n end",
"def write\n Jekyll::Commands::Doctor.conflicting_urls(self)\n each_site_file do |item|\n item.write(dest) if regenerator.regenerate?(item)\n end\n regenerator.write_metadata\n Jekyll::Hooks.trigger :site, :post_write, self\n nil\n end",
"def write_to_file(f)\n return f.write(self.buffer)\n end",
"def write_file(p, file)\n File.open(browse_file(p, file), 'w') { |fh| fh.print yield }\n end",
"def writeFile\n\n\toutputFile = File.new(\"./rules\", \"w\")\n\n\t@i = 1\n\t@@rulesArray.each do |rule|\n\t\toutputFile.puts \"#{@i}-#{rule.fetch('src_ip')}/#{rule.fetch('src_netmask')}:#{rule.fetch('src_port')} #{rule.fetch('dest_ip')}/#{rule.fetch('dest_netmask')}:#{rule.fetch('dest_port')} #{rule.fetch('protocol')} #{rule.fetch('action')}\"\n\t\t@i += 1\n\tend\n\n\toutputFile.close\n\n\tputs \"Rules Saved!\"\nend",
"def write(path, colorize = false)\n end",
"def write_nt_fa(file)\n File.open(file, 'w') do |f|\n self.dna_hash.each do |k,v|\n f.puts k\n f.puts v\n end\n end\n end",
"def save\n n_cmds = Setting[:histsize] > size ? size : Setting[:histsize]\n\n File.open(Setting[:histfile], \"w\") do |file|\n n_cmds.times { file.puts(pop) }\n end\n\n clear\n end",
"def write_pid_file\n\t\texit(1) if File.exists?(\"#{RAILS_ROOT}/log/async-worker.#{PID_SUFFIX}.pid\")\n open(\"#{RAILS_ROOT}/log/async-worker.#{PID_SUFFIX}.pid\", \"w\") {|f| f << Process.pid << \"\\n\"}\n at_exit { File.unlink(\"#{RAILS_ROOT}/log/async-worker.#{PID_SUFFIX}.pid\") if read_pid_file == Process.pid }\n end",
"def write_survivors(output_file)\n open(output_file, 'a') { |f|\n f.puts \"#{@generation} #{@all_persons.size}\\n\"\n }\n end",
"def write_and_flush(bucket)\n File.open(bucket, 'a+') do |o|\n @buffer[bucket].each do |v|\n o.write(v)\n end\n end\n clear_buffer!\n end",
"def test_no_duplicated_file\n #emulate the saving of a file whose content is 'test content'\n @writer.save_file('test content')\n #an exception should be raised by ioservice if file is attempted to be saved twice\n assert_nothing_thrown do\n @writer.save_file('test content')\n end\n end",
"def to_file( f )\n buf = [ MAGIC, VERSION, @timestamp.to_i, @analyses.length() \n ].pack(PFORMAT)\n f.write(buf)\n\n @analyses.each do |a|\n a.to_file(f)\n end\n end",
"def dump_to_file(filename, &block)\n old_stdout = $stdout\n File.open(filename, 'w') do |fo|\n $stdout = fo\n yield\n end\n $stdout = old_stdout\n end",
"def write_out(rows)\n File.open(file_name, 'w') do |f|\n f.puts rows\n end\n end",
"def save_cidrs_to_file!(file_cidrs=@cidr_seeds)\n\t\tputs \"Saving the current cidrs cache table from memory to file: #{file_cidrs} ...\" if @verbose\n\t\ttimestamp=Time.now\n\t\tf=File.open(file_cidrs, 'w')\n\t\tf.write \"# Local cidrs file created by Wmap::CidrTracker.save method at: #{timestamp}\\n\"\n\t\tf.write \"Network CIDR, CIDR RIPE Reference Text, CIDR NETNAME\\n\"\n\t\t@known_cidr_blks_asce_index.map do |key|\n\t\t\tref=get_cidr_ref(key)\n\t\t\tnetname=get_cidr_netname(key)\n\t\t\tf.write \"#{key},#{ref},#{netname}\\n\"\n\t\tend\n\t\tf.close\n\t\tputs \"CIDR cache table is successfully saved: #{file_cidrs}\"\n\t#rescue => ee\n\t#\tputs \"Exception on method #{__method__}: #{ee}\" if @verbose\n\tend",
"def file_write(file, content)\n \n instructions = \"echo #{content.inspect} >> #{file}\"\n r = @ssh ? @ssh.exec!(instructions) : `#{instructions}`\n puts 'r: ' + r.inspect if @debug\n \n @results[:file_write] = r\n\n end",
"def file_update\n File.open(\"fasta_files/#{@fasta_file_name}\", \"a\") do |file|\n file.puts \"\\n\"\n file.puts \"Most Frequent Sequences\"\n most_frequent_seq(range = 10).each do |seq|\n file.puts \"Sequence Count: #{seq.last}\"\n file.puts \"Sequence: #{seq.first}\"\n file.puts \"\\n\"\n end\n end\n end",
"def file_write(file, contents=\"\")\n\t\tFile.open(file.to_s, 'w+') do |f|\n\t\t\tf.print contents\n\t\tend\n\t\tcontents\n\tend",
"def write!\n # 1. skip if file already exists.\n if output_file_already_exists?\n RSpec::Scaffold.log(\"- #{@output_file} - already exists\", :puts)\n return\n end\n\n # 2. ensure parent directories exist\n FileUtils.makedirs(@output_file.parent)\n\n # 3. write to file\n File.open(@output_file, 'wb') do |f| # 'wb' originally\n f << @output_text\n end\n\n RSpec::Scaffold.log(\"+ #{@output_file}\")\n\n return @output_file.to_s\n end",
"def write\n File.open(@file, 'a') do |w| \n w.write(\"\\n\"+ @name + \" \" + @path)\n end\n end"
] |
[
"0.66661114",
"0.632595",
"0.59438217",
"0.5790082",
"0.5757605",
"0.5696864",
"0.5665927",
"0.56114036",
"0.5498036",
"0.5468797",
"0.54248947",
"0.5416237",
"0.5406858",
"0.5397021",
"0.53969204",
"0.53860706",
"0.53577125",
"0.53319633",
"0.53247267",
"0.53167874",
"0.5301649",
"0.52872825",
"0.5255951",
"0.5243472",
"0.5205554",
"0.5178729",
"0.5166429",
"0.5164429",
"0.5159237",
"0.5158948",
"0.5153857",
"0.51223904",
"0.51053613",
"0.5098495",
"0.50898194",
"0.50804585",
"0.5077439",
"0.5072632",
"0.5072632",
"0.5072632",
"0.50575525",
"0.5057489",
"0.5051544",
"0.5044304",
"0.5042702",
"0.50377196",
"0.50377196",
"0.50377196",
"0.50363547",
"0.5035211",
"0.5033113",
"0.5026023",
"0.5019456",
"0.501751",
"0.50060123",
"0.49985468",
"0.49971083",
"0.49843296",
"0.49666867",
"0.49646616",
"0.49616274",
"0.49563777",
"0.4954819",
"0.49531513",
"0.49517268",
"0.49418637",
"0.49418637",
"0.49418637",
"0.49418637",
"0.49409997",
"0.49383885",
"0.4938294",
"0.4934219",
"0.4934171",
"0.49327472",
"0.49259385",
"0.4919466",
"0.49138212",
"0.49088776",
"0.49084392",
"0.49010012",
"0.4895299",
"0.48929515",
"0.48882192",
"0.48881426",
"0.48866615",
"0.4885887",
"0.487358",
"0.4871616",
"0.48686823",
"0.4865733",
"0.48616287",
"0.4859737",
"0.48391122",
"0.48338777",
"0.48311698",
"0.48200652",
"0.48196754",
"0.48191682",
"0.48157024"
] |
0.6451853
|
1
|
Use callbacks to share common setup or constraints between actions.
|
def set_background
@background = Background.find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] |
[
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] |
0.0
|
-1
|
Never trust parameters from the scary internet, only allow the white list through.
|
def background_params
params.require(:background).permit(:name)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] |
[
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",
"0.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] |
0.0
|
-1
|
this method jpins to strings together and prints to the screen
|
def get_info_from_user
puts "Enter some random text"
random_stuff = gets
in_one_line = "This is what you just wrote: " + random_stuff.chomp
puts in_one_line
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def stringOutput\n\t\tend",
"def stringOutput\n\t\tend",
"def display\n to_s.split(\"\\n\")\n .map { |line| line.split('').join(' ') }\n .join(\"\\n\")\n end",
"def to_s\n r = \"##### ##### ##### ##### #####\\n\"\n (0..2).each { |y|\n (0..2).each { |x|\n r += get_print_char(x,y, '.') + \" \"\n }\n r += (\" \" * 5)\n (0..2).each { |x|\n r += get_print_char(x,y, nil, \" \", \" \") + \" \"\n }\n r += \"\\n\"\n }\n r += '##### ##### ##### ##### #####'\n end",
"def to_s\r\n self.each do |r|\r\n puts r.each { |p| p }.join(\" \")\r\n end\r\n end",
"def outtoconsole(things)\n\tsep = \" -> \"\n\tprint things.join(sep).to_s + \"\\n\"\nend",
"def print\n @cell_board.each do |row|\n string_row_separator = '-'\n string_row = '|'\n row.each do |element|\n string_row += \" #{element.to_s} |\"\n string_row_separator += '----'\n end\n puts string_row\n puts string_row_separator\n end\n end",
"def drawToSTDOUT\n for r in (0..6).step(3) do\n print \"+-----++-----++-----+\\n\"\n print \"| \\\\\"+@table[r].getTop.to_s+\"/ || \\\\\"+@table[r+1].getTop.to_s+\"/ || \\\\\"+@table[r+2].getTop.to_s+\"/ |\\n\"\n print \"|\"+@table[r].getLeft.to_s+\" × \"+@table[r+1].getRight.to_s+\"||\"+@table[r+2].getLeft.to_s+\" × \"+@table[r].getRight.to_s+\"||\"+@table[r+1].getLeft.to_s+\" × \"+@table[r+2].getRight.to_s+\"|\\n\"\n print \"| /\"+@table[r].getBottom.to_s+\"\\\\ || /\"+@table[r+1].getBottom.to_s+\"\\\\ || /\"+@table[r+2].getBottom.to_s+\"\\\\ |\\n\"\n print \"+-----++-----++-----+\\n\"\n end\n end",
"def display\n puts \"#{@board.join(\" \")}\"\n end",
"def print *textarray\n create_window unless @win\n show unless @visible\n c = 1\n textarray.each_with_index { |s, i| \n @win.printstring i+@row_offset, c+@col_offset, \"%-*s\" % [@w-(@col_offset*2)-c, s], @color_pair\n }\n @win.wrefresh\n end",
"def outtoconsole(things)\n\tsep = \", \"\n\tthings = [things]\n\tprint things.join(sep).to_s + \"\\n\"\nend",
"def outtoconsole(things)\n\tsep = \", \"\n\tthings = [things]\n\tprint things.join(sep).to_s + \"\\n\"\nend",
"def outtoconsole(things)\n\tsep = \", \"\n\tthings = [things]\n\tprint things.join(sep).to_s + \"\\n\"\nend",
"def outtoconsole(things)\n\tsep = \", \"\n\tthings = [things]\n\tprint things.join(sep).to_s + \"\\n\"\nend",
"def to_s\n for i in 0..@max_row - 1\n for j in 0..@max_column - 1\n print \"| \" + @board[i][j] + \" \"\n end\n\n puts \"|\"\n end\n end",
"def print_out_line\n\t\t\t#p ['id', id, 'ctd', ctd]\n\t\t\t#p rcp.results.zip(rcp.results.map{|r| send(r)})\n\t\t\tname = @run_name\n\t\t\tname += \" (res: #@restart_id)\" if @restart_id\n\t\t\tname += \" real_id: #@real_id\" if @real_id\n\t\t\tbeginning = sprintf(\"%2d:%d %-60s %1s:%2.1f(%s)\", @id, @job_no, name, @status.to_s[0,1], @run_time.to_f / 60.0, @nprocs.to_s)\n\t\t\tif @status == :Incomplete and @completed_timesteps\n\t\t\t\tbeginning += sprintf(\" %d steps \", @completed_timesteps)\n\t\t\telsif @percent_complete\n \t\t\t\tbeginning+=sprintf(\" %3s%1s \", percent_complete, \"%\")\n\t\t\tend\n\t\t\tif ctd\n\t\t\t\t#beginning += sprintf(\"Q:%f, Pfusion:%f MW, Ti0:%f keV, Te0:%f keV, n0:%f x10^20\", fusionQ, pfus, ti0, te0, ne0)\n\t\t\tend\n\t\t\tbeginning += \" ---#{@comment}\" if @comment\n\t\t\tbeginning\n\t\tend",
"def display\n array = stringify_rows\n print_line_seperator\n array.each do |row|\n puts \"|\" << row.join( \"|\" ) << \"|\"\n print_line_seperator\n end\nend",
"def display\n puts \" #{@cells[0]} \" + \"|\" + \" #{@cells[1]} \" + \"|\" + \" #{@cells[2]} \"\n puts \"-----------\"\n puts \" #{@cells[3]} \" + \"|\" + \" #{@cells[4]} \" + \"|\" + \" #{@cells[5]} \"\n puts \"-----------\"\n puts \" #{@cells[6]} \" + \"|\" + \" #{@cells[7]} \" + \"|\" + \" #{@cells[8]} \"\n end",
"def to_s\n soup = @@boards_templates[1].to_s.scan(/...../)\n soup.each {|x| puts \"#{x}\\n\"} \n end",
"def to_s\n puts \"board goes here\"\n @board.each do |row|\n puts \"#{row}\"\n end\n # see_me = \" \"\n # @board.each {|r| see_me += r + \"\\n\" }\n end",
"def display\n @board.each { |x| \n puts x.join(\" \")\n }\n end",
"def to_s\n result = ''\n namelists.each do |namelist|\n result += \"\\n&#{namelist}\\n\"\n result += @to_write[namelist].join('')\n result += \"\\n/ ! end of #{namelist} namelist\\n\"\n end\n result.sub(\"\\n\\n\\n\", \"\\n\\n\")\n end",
"def to_text\n text = \"\"\n @board_of_stone.each{|row|\n row.each{|stone|\n text << stone.to_s\n }\n text << \"\\n\"\n }\n return text\n end",
"def to_str\n puts (@board[:h1] + ' ' + @board[:a1] + ' ' + @board[:b1] + ' ' + @board[:c1])\n puts (@board[:h2] + ' ' + @board[:a2] + ' ' + @board[:b2] + ' ' + @board[:c2])\n puts (@board[:h3] + ' ' + @board[:a3] + ' ' + @board[:b3] + ' ' + @board[:c3])\n puts (@board[:h0] + ' ' + @board[:ha] + ' ' + @board[:hb] + ' ' + @board[:hc])\n sleep 1\n end",
"def out(*args) print(*(args + [\"\\r\\n\"])) end",
"def to_s\n\t\tputs \"{#{@nombre} => Proteínas: #{@proteinas} Carbohidratos: #{@carbohidratos} Lípidos: #{@lipidos} GEI: #{@gei} Terreno usado: #{@terrenousado}}\"\n\tend",
"def print_out_line\n #p ['id', id, 'ctd', ctd]\n #p rcp.results.zip(rcp.results.map{|r| send(r)})\n name = @run_name\n name += \" (res: #@restart_id)\" if @restart_id\n name += \" real_id: #@real_id\" if @real_id\n beginning = sprintf(\"%2d:%d %-60s %1s:%2.1f(%s) %3s%1s\", @id, @job_no, name, @status.to_s[0,1], @run_time.to_f / 60.0, @nprocs.to_s, percent_complete, \"%\")\n if ctd and fusionQ\n beginning += sprintf(\"Q:%f, Pfusion:%f MW, Ti0:%f keV, Te0:%f keV, n0:%f x10^20\", fusionQ, pfus, ti0, te0, ne0)\n end\n beginning += \" ---#{@comment}\" if @comment\n beginning\n end",
"def to_s\n\t\t@tam_alto.times do |i|\n\t\t\t@tam_ancho.times do |j|\n\t\t\t\tprint @plano[i][j].to_s + \" \"\n\t\t\tend\n\t\t\tprint \"\\n\"\n\t\tend\n\tend",
"def to_s\n \"#{get_titulo} #{get_porcentaje}\\n#{get_conjunto_platos}\\nV.C.T. | % #{get_vct} | #{get_proteinas} - #{get_grasas} - #{get_hidratos}\" \n end",
"def display\r\n puts \" #{cells[0]} | #{cells[1]} | #{cells[2]} \"\r\n puts \"-----------\"\r\n puts \" #{cells[3]} | #{cells[4]} | #{cells[5]} \"\r\n puts \"-----------\"\r\n puts \" #{cells[6]} | #{cells[7]} | #{cells[8]} \"\r\n end",
"def print()\n str = start_date.to_s + \" \" + end_date.to_s + \" \" + comment.to_s\n end",
"def display\n\t\tr_str = \"Message: \"\n\t\t(@length / 5).times { |i| r_str += \"#{@string[(i * 5)...(i * 5) + 5]} \" }\n\t\tputs r_str\n\tend",
"def print_temp\n print to_string\n end",
"def basic_output()\n temp_string = String.new()\n\n if (@utype != \"\")\n temp_string = temp_string + \"#{@utype} = \"\n end\n temp_string = temp_string + @commandName\n temp_string = temp_string + \"\\n\"\n @keywordPairs.each {|array| temp_string = temp_string + \"\\t#{array[0]} = #{array[1]}\\n\" }\n temp_string = temp_string + \"..\\n\"\n\n temp_string = temp_string + \"$Parents\\n\"\n @parents.each do |array|\n temp_string = temp_string + \"$\\t#{array.utype} = #{array.commandName}\\n\"\n end\n temp_string = temp_string + \"..\\n\"\n\n temp_string = temp_string + \"$Children\\n\"\n @children.each {|array| temp_string = temp_string + \"$\\t#{array.utype} = #{array.commandName}\\n\" }\n temp_string = temp_string + \"..\\n\"\n\n end",
"def output\n\t\tif @@message_box.length < 5 \n\t\t\t(5 - @@message_box.length).times { @@message_box << \"\\n\" }\n\t\tend\n\t\tputs @@message_box[0] \n\t\tputs @@message_box[1]\n\t\tputs @@v_row.join \n\t\tputs @@message_box[2]\n\t\tputs @@message_box[3]\n\t\tputs @@message_box[4]\n\tend",
"def print_out_line\n name = @run_name\n name += \" (res: #@restart_id)\" if @restart_id\n name += \" real_id: #@real_id\" if @real_id\n beginning = sprintf(\"%2d:%d %-60s %1s:%2.1f(%s) %3s%1s\", @id, @job_no, name, @status.to_s[0,1], @run_time.to_f / 60.0, @nprocs.to_s, percent_complete, \"%\")\n if ctd\n #beginning += sprintf(\"Q:%f, Pfusion:%f MW, Ti0:%f keV, Te0:%f keV, n0:%f x10^20\", fusionQ, pfus, ti0, te0, ne0)\n end\n beginning += \" ---#{@comment}\" if @comment\n beginning\n end",
"def obabelOutput(name, smiles)\n insert = %Q_> <id>\\n#{smiles}\\n\\n> <Name>\\n#{name}\\n\\n$$$$_\n response = %x_obabel -:\"#{smiles}\" -osdf --gen2D_.rstrip.split(/\\n/)\n response[-1] = insert\n return response.join(\"\\n\")\nend",
"def print_result\n puts @cells.map{ |row| row.map{ |cell| (cell.determine? ? cell.number : '?').to_s.rjust(length.to_s.length) }.join() }.join(\"\\n\")\n end",
"def display\n puts \"#{@cell[0..2].join(\" | \")}\"\n puts \"---------\"\n puts \"#{@cell[3..5].join(\" | \")}\"\n puts \"---------\"\n puts \"#{@cell[6..8].join(\" | \")}\"\n \n end",
"def display\n\t\tputs \" #{cells[0]} | #{cells[1]} | #{cells[2]} \"\n\t\tputs \"-----------\"\n\t\tputs \" #{cells[3]} | #{cells[4]} | #{cells[5]} \"\n\t\tputs \"-----------\"\n\t\tputs \" #{cells[6]} | #{cells[7]} | #{cells[8]} \"\n\tend",
"def to_s\n \" | | \\n\" + \n \" #{self.board[0]} | #{self.board[1]} | #{self.board[2]} \\n\" +\n \" _ _ _|_ _ _|_ _ _\\n\" +\n \" | | \\n\" + \n \" #{self.board[3]} | #{self.board[4]} | #{self.board[5]} \\n\" +\n \" _ _ _|_ _ _|_ _ _\\n\" +\n \" | | \\n\" +\n \" #{self.board[6]} | #{self.board[7]} | #{self.board[8]} \\n\" +\n \" | | \\n\" \n end",
"def to_s\n\t\tstr = \"\"\n\t\t\n\t\t@sequence.each { |path_step|\n\t\t\tstr += \"Visit room: #{path_step.room.id}\"\n\t\t\t\n\t\t\tstr += \" via #{path_step.door.sformat}\" if path_step.door\n\t\t\t\n\t\t\tstr += \" and set #{path_step.ls.sformat}\" unless path_step.ls_trivial?\n\t\t\t\n\t\t\tstr += \"\\n\"\n\t\t}\n\t\t\n\t\tstr\n\tend",
"def render\n puts \" #{(0..7).to_a.join(' ')}\"\n (0..7).each do |row|\n puts \"#{row} #{print_row(@board.grid[row] , row).join('|')}\"\n puts\n end\n end",
"def printable_display(numbers)\n numbers.each { |i| puts i.join('') }\n end",
"def to_s\n @board.each do |row|\n puts row.join(\" \")\n end \n end",
"def print\n result = \"\"\n messages.each do |message|\n result += Thimbl::Utils.parse_time( message['time'] ).strftime( '%Y-%m-%d %H:%M:%S' )\n result += \" #{message['address']}\"\n result += \" > #{message['text']}\"\n result += \"\\n\"\n end\n \n return result\n end",
"def display!\n escaped = self.map(&:to_json)\n puts(\"[\" + escaped.join(\",\") + \"],\\n\\n\") || $stdout.flush\n self.clear\n end",
"def display\n puts \" #{@cells[0]} | #{@cells[1]} | #{@cells[2]} \"\n puts \"-----------\"\n puts \" #{@cells[3]} | #{@cells[4]} | #{@cells[5]} \"\n puts \"-----------\"\n puts \" #{@cells[6]} | #{@cells[7]} | #{@cells[8]} \"\n end",
"def display\n puts \" #{@cells[0]} | #{@cells[1]} | #{@cells[2]} \"\n puts \"-----------\"\n puts \" #{@cells[3]} | #{@cells[4]} | #{@cells[5]} \"\n puts \"-----------\"\n puts \" #{@cells[6]} | #{@cells[7]} | #{@cells[8]} \"\n end",
"def output(o);printf o;end",
"def show_board\n @display.each do |row|\n puts row.join(' ')\n end\n end",
"def printer\n puts \" \" + @bio\n end",
"def display\n puts \" #{self.cells[0]} | #{self.cells[1]} | #{self.cells[2]} \"\n puts \"-----------\"\n puts \" #{self.cells[3]} | #{self.cells[4]} | #{self.cells[5]} \"\n puts \"-----------\"\n puts \" #{self.cells[6]} | #{self.cells[7]} | #{self.cells[8]} \"\n end",
"def display\n puts @o\n puts @a\n puts @b\n puts @c\n puts @d\n puts @e\n puts @f\n puts @g\n puts @h\n puts @i\n puts \" \"\n end",
"def print_board \n for i in 0..@players.length-1\n lane = (' |'*(@length))\n lane[@player_positions[i]*2] = @players[i] #It doesnt matter if the player reached goal, it will auto extend the string by one.\n puts lane\n end\n end",
"def print\n displayBoard = []\n @board.each_with_index { |elem, index|\n if index % @columns == 0\n displayBoard.push(\"\\n\")\n end\n displayBoard.push(elem)\n }\n puts displayBoard.join\n end",
"def output\n\tputs \" #{@array_map[0][0]} | #{@array_map[0][1]} | #{@array_map[0][2]} \" \n\tputs \"------------\"\n\tputs \" #{@array_map[1][0]} | #{@array_map[1][1]} | #{@array_map[1][2]} \"\n\tputs \"------------\"\n\tputs \" #{@array_map[2][0]} | #{@array_map[2][1]} | #{@array_map[2][2]} \"\n\tend",
"def display\t\n \tstring = \"\\n +-----------------------+\".green\n \t@matrix.each_index{ |i|\n \tstring += \"\\n |\".green\n v = @matrix[i]\n \tv.each_index{|j|\n \t\tif (v[j] != 0)\n \t\t\tstring += \" \" + v[j].to_s\n \t\telse \n \t\t\tstring += \" .\"\n \t\tend\n \t\t\t\t\n \t\tif (j == 2 || j == 5 || j == 8)\n \t\t\tstring += \" |\".green\n \t\tend\n \t\t}\n \t\tif (i == 2 || i == 5)\n \t\t\tstring += \"\\n |-------+-------+-------|\".green\n \t\tend\n \t}\n \tstring += \"\\n +-----------------------+\".green\n\tend",
"def print(text)\n @output += %(#{text}\\n)\n puts text\n end",
"def view\n @board.each { |row| puts row.join('') }\n end",
"def display\n puts \" #{cells[0]} | #{cells[1]} | #{cells[2]} \"\n puts \"-----------\"\n puts \" #{cells[3]} | #{cells[4]} | #{cells[5]} \"\n puts \"-----------\"\n puts \" #{cells[6]} | #{cells[7]} | #{cells[8]} \"\n end",
"def display\n puts \" #{cells[0]} | #{cells[1]} | #{cells[2]} \"\n puts \"-----------\"\n puts \" #{cells[3]} | #{cells[4]} | #{cells[5]} \"\n puts \"-----------\"\n puts \" #{cells[6]} | #{cells[7]} | #{cells[8]} \"\n end",
"def display\n puts \" #{cells[0]} | #{cells[1]} | #{cells[2]} \"\n puts \"-----------\"\n puts \" #{cells[3]} | #{cells[4]} | #{cells[5]} \"\n puts \"-----------\"\n puts \" #{cells[6]} | #{cells[7]} | #{cells[8]} \"\n end",
"def display\n puts \" #{cells[0]} | #{cells[1]} | #{cells[2]} \"\n puts \"-----------\"\n puts \" #{cells[3]} | #{cells[4]} | #{cells[5]} \"\n puts \"-----------\"\n puts \" #{cells[6]} | #{cells[7]} | #{cells[8]} \"\n end",
"def to_text\n \n output_res=[]\n \n if @seq_rejected\n output_res<< \"[#{@tuple_id},#{@order_in_tuple}] Sequence #{seq_name} had the next actions: \".bold.underline + \" REJECTED: #{@seq_rejected_by_message}\".red \n # puts @seq_name.bold + bold + ' REJECTED BECAUSE ' +@seq_rejected_by_message.bold if @seq_rejected \n else\n output_res<< \"[#{@tuple_id},#{@order_in_tuple}] Sequence #{seq_name} had the next actions: \".bold.underline \n \n end\n \n n=1\n withMessage = [\"ActionIsContaminated\",\"ActionVectors\",\"ActionBadAdapter\",\"ActionLeftAdapter\",\"ActionRightAdapter\"] \n color = red\n \n @actions.sort!{|e,f| e.start_pos<=>f.start_pos}.each do |a| \n a_type=a.action_type\n color = a.apply_decoration(\" EXAMPLE \") \n color2 =a.apply_decoration(\" #{a_type.center(8)} \") \n \n reversed_str = '' \n \n if a.reversed\n reversed_str = \" REVERSED \".bold \n end\n \n output_res<< \" [#{n}] \".bold + color2+ \" #{a.title} \".ljust(24).reset + \" [ \" + \" #{a.start_pos+1}\".center(6) + \" , \" + \"#{a.end_pos+1}\".center(6) + \" ]\" + clear.to_s + \"#{a.message}\".rjust(a.message.size+8) + reversed_str\n \n n +=1 \n end\n \n pos = 0\n res = '' \n \n @seq_fasta_orig.each_char do |c|\n \n @actions.each do |a|\n c= a.decorate(c,pos) \n \n end \n \n res += c\n \n pos += 1\n end \n \n output_res<< res\n \n if SHOW_QUAL and @seq_qual_orig\n res = '' \n pos=0 \n output_res<< ''\n @seq_fasta_orig.each_char do |c2|\n c=@seq_qual_orig[pos].to_s+' '\n @actions.each do |a|\n c= a.decorate(c,pos) \n\n end \n res += c\n pos += 1\n end\n \n output_res<< res\n end\n \n if SHOW_FINAL_INSERTS \t\t \n output_res<< \"INSERT ==>\"+get_inserts.join(\"\\nINSERT ==>\")\n output_res<< \"=\"*80\n end\n # puts @seq_name.bold + bold + ' rejected because ' +@seq_rejected_by_message.bold if @seq_rejected \n\n return output_res\n end",
"def render\n\t\tprint \"cl1 cl2 cl3 cl4 cl5 cl6 cl7 cl8 cl9 c10\\n\"\n\t\t(0..9).each do |row|\n\t\t\t(0..9).each do |col|\n\t\t\t\tif @grid[row][col].is_flagged\n\t\t\t\t\tprint \"FLG\"\n\t\t\t\telsif @grid[row][col].is_hidden\n\t\t\t\t\tprint \" \"\n\t\t\t\telsif @grid[row][col].surrounding_bombs > 0\n\t\t\t\t\tprint \" #{@grid[row][col].surrounding_bombs} \"\n\t\t\t\telsif @grid[row][col].has_bomb\n\t\t\t\t\tprint \"POW\"\t\t\t\t\t\n\t\t\t\telse print \"xxx\"\n\t\t\t\tend\n\t\t\t\tprint \"|\" unless col == 9\n\t\t\t\tprint \"row#{row + 1}\\n\" if col == 9\n\t\t\tend\n\t\tend\n\tend",
"def display\n\n puts \" #{cells[0]} | #{cells[1]} | #{cells[2]} \"\n puts \"-----------\"\n puts \" #{cells[3]} | #{cells[4]} | #{cells[5]} \"\n puts \"-----------\"\n puts \" #{cells[6]} | #{cells[7]} | #{cells[8]} \"\n\n end",
"def displayInfo(text)\n puts \"( - ) #{text}\"\n end",
"def show_board\n \tputs \"-\"*16\n \tputs \"| #{@case_array[0].symbol} | #{@case_array[1].symbol} | #{@case_array[2].symbol} |\"\n \tputs \"-\"*16\n \tputs \"| #{@case_array[3].symbol} | #{@case_array[4].symbol} | #{@case_array[5].symbol} |\"\n \tputs \"-\"*16\n \tputs \"| #{@case_array[6].symbol} | #{@case_array[7].symbol} | #{@case_array[8].symbol} |\"\n \tputs \"-\"*16\n\tend",
"def to_s\n puts \"---------------------------------------\"\n row = @slots.each_slice(9) { |slice| puts \"| \" + slice.join(\" | \") + \" |\"}\n puts \"---------------------------------------\"\n end",
"def display\n puts \" #{@cells[0]} | #{@cells[1]} | #{@cells[2]} \"\n puts \"-----------\"\n puts \" #{@cells[3]} | #{@cells[4]} | #{@cells[5]} \"\n puts \"-----------\"\n puts \" #{@cells[6]} | #{@cells[7]} | #{@cells[8]} \"\nend",
"def show\n\t puts \"\t#{@spaces[0]} #{@spaces[1]} #{@spaces[2]}\"\n\t puts \"\t#{@spaces[3]} #{@spaces[4]} #{@spaces[5]}\"\n\t puts \"\t#{@spaces[6]} #{@spaces[7]} #{@spaces[8]}\"\n\tend",
"def to_s\n\t\tprint @edition + \":\"\n\t\tcontents.length.times do |i|\n\t\t\tarticle = @contents[i]\n\t\t\tprint \"\\n\\t- \"\n\t\t\tprint article.to_s\n\t\tend\n\t\tprint \"\\n\\n\"\n\tend",
"def display(i,j)\n \t print \"\\e[H\"\n\t puts \" \" + \"_\" * (@width * 2 - 1)\n\t \n\t @grid.each_with_index do |row,y|\n\t print \"|\"\n\t\t row.each_with_index do |cell,x|\n\t\t # \n\t\t\t # Color gray if empty, red if \"current\" cursor\n\t\t\t #\n\t\t\t if cell == 0\n\t\t\t print \"\\e[47m\" \n\t\t\t elsif x == i and y == j\n \t\t\t print \"\\e[41m\"\n\t\t\t end\n\n\t\t\t # render \"bottom\" using \"S\" switch\n\t\t\t print( (@grid[y][x] & @@S != 0) ? \" \" : \"_\" )\n\t\t\t \n\t\t\t # render \"side\" using \"E\" switch\n\t\t\t if @grid[y][x] & @@E != 0\n\t\t\t print( ( ( @grid[y][x] | @grid[y][x+1] ) & @@S != 0 ) ? \" \" : \"_\" )\n\t\t\t else\n\t\t\t print \"|\"\n\t\t\t end\n\n\t\t\t # \n\t\t\t # Stop coloring\n\t\t\t #\n\t\t\t if cell == 0 or ( x == i and y == j )\n\t\t\t print \"\\e[m\" \n\t\t\t end\n\t\t end\n\t\t puts\n\t end\n\tend",
"def to_s\n Array(render).map(&:to_s).join(\"\\n\")\n end",
"def output\n output = ''\n\n visible.each_with_index do |line, y_index|\n output << Vedeu::Geometry::Position.new((by + y_index), bx).to_s\n output << line.to_s\n end\n\n output << cursor.to_s\n\n output\n end",
"def print\n puts @text\n end",
"def to_s\n puts \"#{name} is a #{species} and plays with #{toys.join(\" \")}: \"\n end",
"def display\n @board.each_slice(9) do |row|\n puts row.join(\",\")\n end\n end",
"def to_s\n text = ''\n\n text << \"#{@keyword}:#{name_output_string}\"\n text << \"\\n#{description_output_string}\" unless no_description_to_output?\n text << \"\\n\" unless steps.empty? || no_description_to_output?\n text << \"\\n#{steps_output_string}\" unless steps.empty?\n\n text\n end",
"def pan_string()\n pan_body().join(',') + \".\"\n end",
"def output_for items\n output = \"\"\n items.each_with_index do |item, position|\n output += \"#{position + 1}) #{item.type.capitalize}: #{item.details}\\n\"\n end\n output # Return the output to print (well, put) it\n end",
"def show()\n\t\tputs (' \t|\t' + ' \t|\t')\n\t\tputs (@@board[7] + '\t|\t' + @@board[8] + '\t|\t' + @@board[9])\n\t\tputs ('------------------------------------')\n\t\tputs (@@board[4] + '\t|\t' + @@board[5] + '\t|\t' + @@board[6])\n\t\tputs (' \t|\t' + ' \t|\t')\n\t\tputs ('------------------------------------')\n\t\tputs (@@board[1] + '\t|\t' + @@board[2] + '\t|\t' + @@board[3])\n\t\tputs (' \t|\t' + ' \t|\t')\n\tend",
"def display_board\n seperator = \"-----------\"\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts seperator\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts seperator\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\nend",
"def show_board\n \n puts \" 1 2 3\"\n puts \" a #{@A1.content} | #{@A2.content} | #{@A3.content}\"\n puts \" ---------\"\n puts \" b #{@B1.content} | #{@B2.content} | #{@B3.content}\"\n puts \" ---------\"\n puts \" c #{@C1.content} | #{@C2.content} | #{@C3.content}\"\n\n end",
"def show_board_game(current_game)\n puts \"#{current_game.players[0].name.capitalize} #{current_game.players[0].avatar} #{current_game.players[0].symbol} \\u{1F19A} #{current_game.players[1].name.capitalize} #{current_game.players[1].avatar} #{current_game.players[1].symbol}\"\n puts \"\"\n for i in 0..2 do\n puts \"----------------\"\n for j in 0..2 do\n print \"| #{current_game.board.boardcase[i][j].content} \"\n end\n puts \"|\"\n end\n puts \"----------------\"\n end",
"def tprint(string)\n @window.addstr(string)\n end",
"def output\n # adds header to beginning of main array then joins all elements with a blank space\n (@main.unshift(@header)).join(' ')\n end",
"def to_s\n\t\ts = \"\"\n\n\t\t@cells.each_with_index do |cell, i|\n\t\t\ts += cell.name\n\t\t\ts += (i + 1) % 3 == 0 ? \"\\n\" : \" | \"\n\t\tend\n\n\t\ts\n\tend",
"def display_board\n\t\tputs \"\\n\\n\"\n\t\tprint \"|\\u2460 |\\u2461 |\\u2462 |\\u2463 |\\u2464 |\\u2465 |\\u2466 |\"\n\t\t@board.plastic.reverse.each do |row|\n\t\t\tprint \"\\n|\"\n\t\t\trow.each {|x| print \"#{x.to_c} |\"} \t\t\t\n\t\tend\n\t\tputs \"\"\n\tend",
"def print *s\n s.each do |_|\n Lib.g_application_command_line_print self.ffi_pointer, _.to_s+\"\\n\"\n end\n end",
"def print_track\n clear_screen!\n puts \"RACE! GO FAST!!!111one\"\n liner = \"________________\"\n @length.times do\n liner += \"__\"\n end\n puts liner\n @players.times do |x_position|\n print \"Player #{x_position} \"\n @length.times do |y_position|\n print @track[x_position][y_position] + \"|\"\n end\n puts \"| FINISH\"\n end\n puts liner\n end",
"def to_s\n puts @line1\n puts @line2\n puts \"#{city}, #{state}, #{zip}\"\n end",
"def print_output()\n\t#print \"$array= \\n\"\n\t$array.each { |i| i.each {\n\t\t\t\t\t |j|\n\t\t\t\t\t case j\n\t\t\t\t\t when 4\n\t\t\t\t\t \tprint \"•\"\n\t\t\t\t\t when 3\n\t\t\t\t\t \tprint \"x\"\n\t\t\t\t\t when 2\n\t\t\t\t\t \tprint \"*\"\n\t\t\t\t\t when 1\n\t\t\t\t\t \tprint \"█\"\n\t\t\t\t\t when 0\n\t\t\t\t\t \tprint \" \"\n\t\t\t\t\t end }\n\t\t\t\t print \"\\n\"}\nend",
"def to_s\n @out.join\n end",
"def out(*args); to_s(*args); end",
"def display_character_blah\n \n puts \"Name: #{name}\"\n puts \"Bio: #{description}\"\n end",
"def printBoard\n\t\tprint(\"#{@field[0].value} | #{@field[1].value} | #{@field[2].value}\\n---------\\n#{@field[3].value} | #{@field[4].value} | #{@field[5].value}\\n---------\\n#{@field[6].value} | #{@field[7].value} | #{@field[8].value}\")\n\tend",
"def display_quick\r\n s = ''\r\n for i in @me.keys\r\n s << \" <b>#{i}.</b><br/>\" # country\r\n for j in @me[i].keys\r\n s << \" <b>#{j}:</b><br/>\" if not j == 'unknown' # state\r\n for k in @me[i][j].keys\r\n s << \" #{k}<br/>\" if not k == 'unknown' # county\r\n for l in @me[i][j][k].keys\r\n s << (\" \" + (l == 'unknown' ? \"<i>repository not given</i>\" : \" #{l}\") + \"<br/>\") if not l == nil # repository\r\n s << \" \" + @me[i][j][k][l].keys.collect{|m| \r\n (\"#{@me[i][j][k][l][m]} \" +\r\n case m # the count\r\n when 'female'\r\n \"♀\"\r\n when 'male'\r\n \"♂\"\r\n when 'gynadropmorph'\r\n \"[♀♂]\"\r\n else\r\n \"unknown sex\"\r\n end)}.join(\",\") \r\n s << \"<br/>\" \r\n end\r\n end\r\n end\r\n end\r\n s.html_safe\r\n end",
"def print_info\n puts \"#{ @name } is the #{ @position } planet from the sun.\\nIt is a #{ @type } planet that is #{ @diameter } miles wide.\\n#{ @name } has #{ @moons } moons.\"\n end",
"def to_s\n string = (\"#{@name}\\tproteinas:#{@proteins}\\tglúcidos:#{@glucids}\\tlípidos:#{@fats}\")\n # puts string\n # return string\n end"
] |
[
"0.66156185",
"0.66156185",
"0.64604497",
"0.64210224",
"0.63958246",
"0.6366173",
"0.6295643",
"0.6204997",
"0.6189268",
"0.6180986",
"0.611861",
"0.611861",
"0.611861",
"0.611861",
"0.6116211",
"0.6099918",
"0.6098071",
"0.6088893",
"0.6085352",
"0.6064517",
"0.6062601",
"0.6061847",
"0.60546887",
"0.60350937",
"0.6024205",
"0.6018594",
"0.6010184",
"0.60095733",
"0.6002329",
"0.5997554",
"0.59953344",
"0.59911823",
"0.59902734",
"0.59800303",
"0.59754527",
"0.5971473",
"0.59522307",
"0.5948784",
"0.5944536",
"0.59339976",
"0.59285635",
"0.5928386",
"0.5923973",
"0.5923595",
"0.5923277",
"0.5922288",
"0.5920251",
"0.5917115",
"0.5917115",
"0.591661",
"0.5911601",
"0.5897217",
"0.589385",
"0.58906764",
"0.5882558",
"0.5878502",
"0.5877051",
"0.5875756",
"0.58741176",
"0.5871825",
"0.58700216",
"0.58700216",
"0.58700216",
"0.58700216",
"0.58699536",
"0.5866962",
"0.58668315",
"0.58648884",
"0.5864813",
"0.5862639",
"0.58552855",
"0.5854212",
"0.5850144",
"0.584879",
"0.5842227",
"0.5841358",
"0.58413416",
"0.58356434",
"0.58338034",
"0.5830481",
"0.58237255",
"0.58228207",
"0.5817209",
"0.5816821",
"0.5812686",
"0.5811963",
"0.5807686",
"0.57987523",
"0.57986635",
"0.5795098",
"0.57949716",
"0.5793384",
"0.5785838",
"0.578243",
"0.5779839",
"0.57789016",
"0.5773535",
"0.57596797",
"0.5756669",
"0.5755685",
"0.5754965"
] |
0.0
|
-1
|
rubocop:disable AbcSize, BlockLength, LineLength, MethodLength
|
def conflicts
@planning = Planning.find(params[:id])
@slots = @planning.slots.order(:id)
@slot = Slot.new
@slot_templates = Slot.slot_templates # liste des roles
# modifier 1 slot mécano du mercredi 13/9 en "no solution"
# guersbru : le dit slot n'a pas toujours l'id 887... ça crash je commente la ligne
# Slot.find(887).user_id = "no solution"
@url = 'conflicts'
# variables pour fullcalendar
@slots_array = []
@slots_solution = []
@user = current_user
@slots.each do |slot|
# Fake solution > def user id solution
if !User.find(slot.user_id).profile_picture.nil?
# picture du user
picture = 'http://res.cloudinary.com/dksqsr3pd/image/upload/c_fill,r_60,w_60/' + User.find(slot.user_id).profile_picture.path
else
# point d'interrogation par defaut
picture = 'http://a398.idata.over-blog.com/60x60/3/91/14/12/novembre-2010/point-d-interrogation-bleu-ciel.jpg'
end
a = {
id: slot.id,
start: slot.start_at,
end: slot.end_at,
title: Role.find_by(id: slot.role_id).name, # nom du role
role_id: slot.role_id, # nom du role
created_at: slot.created_at,
updated_at: slot.updated_at,
color: Role.find_by(id: slot.role_id).role_color,
planning_id: slot.planning_id,
user_id: User.find(slot.user_id).id,
picture: picture
}
picture_solution = 'http://res.cloudinary.com/dksqsr3pd/image/upload/c_fill,r_60,w_60/' + User.find_by(first_name: 'jean').profile_picture.path
user_id_solution = User.find_by(first_name: 'jean').id
b = {
id: slot.id,
start: slot.start_at,
end: slot.end_at,
title: Role.find_by(id: slot.role_id).name, # nom du role
role_id: slot.role_id, # nom du role
created_at: slot.created_at,
updated_at: slot.updated_at,
color: Role.find_by(id: slot.role_id).role_color,
planning_id: slot.planning_id,
user_id: user_id_solution,
picture: picture_solution
}
@slots_array << a
@slots_solution << if slot.user_id == User.find_by(first_name: 'no solution').id
b
else
a
end
end
# Fake solution => le boss remplacera le no solution
@user_solution = User.find_by(first_name: 'jean')
demo_method(@planning) if @planning.week_number == 37
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def private; end",
"def big_bad; end",
"def probers; end",
"def private_method\n end",
"def implementation; end",
"def implementation; end",
"def schubert; end",
"def code_of_conduct; end",
"def custom; end",
"def custom; end",
"def extra; end",
"def suivre; end",
"def operations; end",
"def operations; end",
"def refutal()\n end",
"def lines_of_code; end",
"def lines_of_code; end",
"def run_line_length_cop; end",
"def ignore; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def celebration; end",
"def bs; end",
"def offences_by; end",
"def internal; end",
"def used?; end",
"def coverage_exceeding_source_warn; end",
"def villian; end",
"def jack_handey; end",
"def operation; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def initialize # rubocop:disable Lint/UselessMethodDefinition\n super()\n end",
"def initialize # rubocop:disable Lint/UselessMethodDefinition\n super()\n end",
"def initialize # rubocop:disable Lint/UselessMethodDefinition\n super()\n end",
"def missing; end",
"def method_731(base); end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def processor; end",
"def berlioz; end",
"def rubocop_checksum; end",
"def code; end",
"def code; end",
"def code; end",
"def code; end",
"def code; end",
"def code; end",
"def code; end",
"def ignores; end",
"def macro; raise NotImplementedError; end",
"def macro; raise NotImplementedError; end",
"def macro; raise NotImplementedError; end",
"def anchored; end",
"def formation; end",
"def contract; end",
"def contract; end",
"def verdi; end",
"def returns; end",
"def silly_adjective; end",
"def as_you_like_it_quote; end",
"def internship_passed; end",
"def common\n \n end",
"def mambo_no_5; end",
"def buzzword; end",
"def buzzword; end",
"def who_we_are\r\n end",
"def overload; end",
"def incomplete\r\n\r\n end",
"def ca; end",
"def miss_reason; end",
"def final; end",
"def kex_byte_requirement; end",
"def intensifier; end",
"def bad_smell_by_nfunctions\n end",
"def public_method; end",
"def ibu; end",
"def strategy; end",
"def requirements; end",
"def requirements; end",
"def requirements; end",
"def requirements; end",
"def offset; end",
"def offset; end",
"def offset; end",
"def public; end",
"def public; end"
] |
[
"0.7032071",
"0.5972274",
"0.5872646",
"0.5856577",
"0.5762335",
"0.5762335",
"0.5735455",
"0.5687095",
"0.5597882",
"0.5597882",
"0.5542398",
"0.5530145",
"0.54522645",
"0.54522645",
"0.54329884",
"0.54105234",
"0.54105234",
"0.54035926",
"0.5383898",
"0.5383798",
"0.5383798",
"0.5383798",
"0.5383798",
"0.5383798",
"0.5383798",
"0.5383798",
"0.5383798",
"0.5383798",
"0.5383798",
"0.5383798",
"0.5383798",
"0.5378065",
"0.53628045",
"0.53611",
"0.5360821",
"0.53598064",
"0.53582925",
"0.5358017",
"0.5325092",
"0.53155816",
"0.5303879",
"0.5303879",
"0.5303879",
"0.5303879",
"0.5299424",
"0.5299424",
"0.5299424",
"0.52981234",
"0.5291284",
"0.5288113",
"0.5288113",
"0.5288113",
"0.5288113",
"0.52674174",
"0.52662736",
"0.52572256",
"0.5255551",
"0.5255551",
"0.5255551",
"0.5255551",
"0.5255551",
"0.5255551",
"0.5255551",
"0.5250415",
"0.52386355",
"0.52386355",
"0.52386355",
"0.52279556",
"0.522698",
"0.52250385",
"0.52250385",
"0.5224131",
"0.5218318",
"0.52136153",
"0.5212487",
"0.5206372",
"0.51941",
"0.51871675",
"0.51833916",
"0.51833916",
"0.51825345",
"0.5182194",
"0.51795775",
"0.5176597",
"0.5176136",
"0.5164451",
"0.5164419",
"0.51643825",
"0.5154514",
"0.5148018",
"0.5143681",
"0.5135002",
"0.51267415",
"0.51267415",
"0.51267415",
"0.51267415",
"0.5124847",
"0.5124847",
"0.5124847",
"0.51211965",
"0.51211965"
] |
0.0
|
-1
|
rubocop:enable AbcSize, BlockLength, LineLength
|
def update
@planning = Planning.find(params[:id])
@planning.update(planning_params)
@planning.save!
redirect_to planning_conflicts_path(@planning)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def private; end",
"def big_bad; end",
"def lines_of_code; end",
"def lines_of_code; end",
"def probers; end",
"def run_line_length_cop; end",
"def code_of_conduct; end",
"def source_line; end",
"def schubert; end",
"def coverage_exceeding_source_warn; end",
"def extra; end",
"def implementation; end",
"def implementation; end",
"def missed_lines; end",
"def missed_lines; end",
"def used?; end",
"def private_method\n end",
"def bs; end",
"def custom; end",
"def custom; end",
"def kex_byte_requirement; end",
"def line_number; end",
"def line_number; end",
"def line_number; end",
"def line_number; end",
"def line_number; end",
"def line_number; end",
"def line_number; end",
"def rubocop_checksum; end",
"def mambo_no_5; end",
"def berlioz; end",
"def suivre; end",
"def ignore; end",
"def ignore_bad_chunking; end",
"def ignore_bad_chunking; end",
"def line_num; end",
"def celebration; end",
"def lines_of_code\n danger_file.warn('Big PR') if danger_file.git.lines_of_code > 500\n end",
"def buzzword; end",
"def buzzword; end",
"def line; end",
"def line; end",
"def line; end",
"def line; end",
"def line; end",
"def line; end",
"def line; end",
"def line; end",
"def line; end",
"def line; end",
"def line; end",
"def line; end",
"def line; end",
"def line; end",
"def line; end",
"def offences_by; end",
"def code; end",
"def code; end",
"def code; end",
"def code; end",
"def code; end",
"def code; end",
"def code; end",
"def operations; end",
"def operations; end",
"def processed_source; end",
"def processed_source; end",
"def processed_source; end",
"def processed_source; end",
"def processed_source; end",
"def processed_source; end",
"def processed_source; end",
"def processed_source; end",
"def processed_source; end",
"def processed_source; end",
"def processed_source; end",
"def source_lines; end",
"def source_lines; end",
"def source_lines; end",
"def source_lines; end",
"def culprit\n @culprit\n end",
"def source_line=(_); end",
"def offset; end",
"def offset; end",
"def offset; end",
"def jack_handey; end",
"def ca; end",
"def internal; end",
"def ignore_bad_chunking=(_arg0); end",
"def original_line; end",
"def least_covered_file; end",
"def line_cache; end",
"def refutal()\n end",
"def returns; end",
"def as_you_like_it_quote; end",
"def villian; end",
"def code_point; end",
"def ignores; end",
"def miss_reason; end",
"def anchored; end",
"def verdi; end"
] |
[
"0.69074905",
"0.60839236",
"0.58996403",
"0.58996403",
"0.58639127",
"0.57792765",
"0.5758479",
"0.55996275",
"0.5596788",
"0.55755144",
"0.55025595",
"0.5475239",
"0.5475239",
"0.5468404",
"0.5468404",
"0.5442064",
"0.5438099",
"0.5437117",
"0.5426335",
"0.5426335",
"0.5415389",
"0.53993714",
"0.53993714",
"0.53993714",
"0.53993714",
"0.53993714",
"0.53993714",
"0.53993714",
"0.5398423",
"0.5390823",
"0.53880775",
"0.53766817",
"0.5363477",
"0.5348349",
"0.5348349",
"0.5346751",
"0.5344129",
"0.5337618",
"0.53349227",
"0.53349227",
"0.53313136",
"0.53313136",
"0.53313136",
"0.53313136",
"0.53313136",
"0.53313136",
"0.53313136",
"0.53313136",
"0.53313136",
"0.53313136",
"0.53313136",
"0.53313136",
"0.53313136",
"0.53313136",
"0.53313136",
"0.53271866",
"0.5324032",
"0.5324032",
"0.5324032",
"0.5324032",
"0.5324032",
"0.5324032",
"0.5324032",
"0.5318606",
"0.5318606",
"0.5318148",
"0.5318148",
"0.5318148",
"0.5318148",
"0.5318148",
"0.5318148",
"0.5318148",
"0.5318148",
"0.5318148",
"0.5318148",
"0.5318148",
"0.5314017",
"0.5314017",
"0.5314017",
"0.5314017",
"0.53095806",
"0.5306497",
"0.5306326",
"0.5306326",
"0.5306326",
"0.5303452",
"0.52870846",
"0.5277224",
"0.5275915",
"0.52692884",
"0.52455395",
"0.52398455",
"0.52372354",
"0.52361447",
"0.52273256",
"0.5227224",
"0.52259445",
"0.5225851",
"0.52215165",
"0.5214362",
"0.52109045"
] |
0.0
|
-1
|
before_filter :authenticate_user! prepend_before_filter :require_admin_access , :only => [ :new, :create, :cancel ] prepend_before_filter :authenticate_scope! , :only => [:edit, :update, :destroy] GET /resource/edit
|
def edit
render :edit
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n # authorize Admin\n end",
"def edit\n #@user = User.find(params[:id]) \n #replced by the before_action at the top\n end",
"def edit\n authorize! :edit, @user, :id => current_user.id\n end",
"def edit\n authorize! :update, @user\n end",
"def authorize\n render json: { error: 'You are not authorized to modify this data'} , status: 401 unless current_user && current_user.can_modify_user?(params[:id])\n end",
"def authorize\n return_unauthorized unless current_user && current_user.can_modify_user?(params[:id])\n end",
"def authorized_to_edit_records\n scope.none\n end",
"def before_filter; end",
"def self_edit_only\n #if current_user.id != Integer(params[:id]) && !current_user.is_admin\n if !can_edit\n redirect_to user_url, :notice => \"You don't have permission to do that.\"\n else\n end\n end",
"def edit\n authorize @user_information\n end",
"def edit\n # Listing 9.14: Finding the correct user is now handled by the correct_user before_action.\n end",
"def authorize\n render json: { error: 'You are not authorized to modify this data'} , status: 401 unless current_user && current_user.can_modify_user?(params[:id])\n end",
"def edit\n require_user\n end",
"def restrictToAdmin! ; redirect to('/login'),303 unless admin? ; end",
"def authorize_edit\n authorize! :edit, @opportunity\n end",
"def edit\n\n #Make sure only logged in admins can manipulate users\n\n if @loggedinuser && @loggedinuser.authorizationlevel >= 4\n \t@user = User.find(params[:id])\n else \n redirect_to '/'\n end\n end",
"def before_filter\n if current_user\n true\n end\n end",
"def user_action_on_resource_authorized\n end",
"def edit\n @user = User.find(params[:id])\n authorize! :update, @user \n end",
"def authorize_admin!\n redirect_to login_path unless current_user\n end",
"def authenticate_scope!\n \n \n do_before_request \n\n end",
"def filter_self\n if @user && !current_user.can_edit?(@user)\n respond_to do |format|\n format.html {\n render :nothing => true, :status => 403\n }\n format.json {\n render :json => {:status => 'failure'}, :status => 403\n }\n end\n end\n end",
"def authenticate_scope!\n super\n end",
"def authorize\n render json: { status: 200, msg: 'You are not allowed to do this update' } unless current_user && current_user.can_modify_user?(params[:id])\n end",
"def run_filters\n set_user\n authorize\n end",
"def show\n authorize @admin\n end",
"def can_edit\n return current_user && (current_user.id == Integer(params[:id]) || current_user.is_admin)\n end",
"def access_control\n \n end",
"def edit\n @car = Car.find(params[:id])\n\n if current_user.admin == true\n authorize @car\n end\n\n\n authorize @car\n end",
"def restrict_developer\n if (controller_name == 'user_sessions' and action_name == 'destroy') or\n (controller_name == 'users' and (action_name == 'edit' || action_name == 'update'))\n return\n end\n if current_user and is_developer \n redirect_to :controller => 'efforts'\n end\n end",
"def edit\n @user = User.shod(params[:id])\n authorize! :update, @user\n end",
"def show\n authorize! :update, Hospital\n end",
"def edit\n @user = User.find(params[:id])\n\n #this works, but we can do better.\n authorize! :edit, @user\n end",
"def show\n authorize User\n end",
"def show\n authorize User\n end",
"def authorize_admin\r\n unless session[:user_id] and\r\n User.find(session[:user_id]).level == 2\r\n session[:original_uri] = request.request_uri\r\n flash[:notice] = Resource.get(\"access_denied\")\r\n redirect_to(:controller => \"welcome\", :action => \"signin\")\r\n end\r\n end",
"def edit\n if current_user.access == 2\n redirect_to \"/users/indexU\"\n end\n end",
"def edit\n authorize! :edit, @profile\n end",
"def authorize_as_admin\n unless session[:administrator]\n redirect_to(:controller => \"portfolio\", :action => \"default\", :id => session[:username])\n end\n end",
"def authorizeAdmin\n redirect_to '/adminlogin' unless admin_user\n end",
"def auth_options\n { scope: resource_name, recall: \"#{controller_path}#unauthorized\" }\n end",
"def edit\n redirect_to root_url and return unless current_user\n @user = current_user\n end",
"def reset_filter!\n skip_before_action(:filter_access_filter) if method_defined?(:filter_access_filter)\n before_action :filter_access_filter\n end",
"def authenticate_admin!\n render_404 unless current_user.try(:admin?) && current_user\n end",
"def authorize_admin\n redirect_to root_path unless current.user.immortal?\n end",
"def show \n #if current_user.company_id == @user.company_id \n authorize @user \n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def edit\n\t\tadd_breadcrumb \"Editar\"\n\t\tif @request.user_id != current_user.id\n\t\t\tredirect_to root_path, alert: \"Usted no es el creador de la solicitud, por lo que no puede modificarla. Contáctese con su administrador.\"\n\t\tend\n\tend",
"def edit\n authorize @car\n end",
"def authorize_access\n # byebug\n redirect_to root_path, alert: \"Access Denied\" unless can? :modify, Post\n end",
"def edit\n\t @user = User.find(params[:id])\n\t redirect_to root_path unless current_user.is_admin? or @user == current_user\n\tend",
"def before_action \n end",
"def authorize_admin\n redirect_to '/librarians/denied' unless current_user && current_user.admin?\n end",
"def show\n authorize RoleCutoff\n end",
"def authorize_access\r\n # authorize!(action_name.to_sym, \"#{controller_name}_controller\".camelcase.constantize)\r\n end",
"def show\n admin_only\n end",
"def show\n admin_only\n end",
"def show\n admin_only\n end",
"def authorize\n @job = Job.find(params[:id])\n render json: { error: 'You are not authorized to modify this data'} , status: 401 unless current_user && @job.user_id == current_user.id || (current_user && current_user.role == 'admin')\n end",
"def authorize_user\n if @user.nil? and not current_user.is_a? AdminUser\n # TODO check if we can rewrite the URL and scope the resources\n # only for the current_user, instead of redirecting\n redirect_to root_url\n end\n end",
"def user_permitted_to_edit(item)\n item.user == current_user \n end",
"def edit_user\n redirect_to(root_url) unless current_user.edit?\n end",
"def authenticate_spraycan\n authorize! :admin, Spraycan::ViewOverride\n end",
"def authorize_admin\n return if current_customer.admin?\n redirect_to root_path, alert: 'Admins only!' unless current_customer and current_customer.admin?\n end",
"def editing_destroying_filter\n unless editing_destroying_filter_condition\n flash[:notice] = \"You're not authorized to edit or delete!\"\n redirect_to events_path\n end\n end",
"def show\n skip_authorization\n end",
"def authorized\n\t unless admin?\n\t redirect_to root_path\n\t end\n end",
"def authorize_admin\n\t\tauthorize( ADMIN_USER_LEVEL ) \n\tend",
"def authorize_admin!\n authorize! :manage, :all\n end",
"def authorize_user\n redirect_to restrooms_path, flash: {message: \"You don't have permission to make changes to another user's profile.\"} unless current_user.admin? || @user == current_user\n end",
"def edit\n redirect_back_or_default(\"/\") if\n !@user&.admin && session[:real_user_id].blank?\n end",
"def authorize\n render json: { error: 'You are not authorized to modify this data'} , status: 401 unless current_user && current_user.can_modify_blog?(params[:id])\n end",
"def authorise\n unless User.find_by_id(session[:user_id]) || (self.controller_name == 'users' && (self.action_name == 'new' || self.action_name == 'create'))\n session[:original_uri] = request.request_uri\n flash[:notice] = \"Please login!\"\n redirect_to login_url\n end\n end",
"def authenticate_scope!\r\n send(:\"authenticate_user!\", :force => true)\r\n self.resource = send(:\"current_user\")\r\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def edit_current_user\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def authorize_author\n redirect_to '/login' unless self.user_access > 1 || current_user.access == 3\n end",
"def edit\n if current_profile!=@profile\n redirect_to root_url, notice: 'Permission denied'\n end\n end",
"def authenticate_current_user\n unless current_user.admin == true\n unless current_user == User.find(params[:id]) \n flash[:danger] = \"Impossible d'aller sur cette page.\"\n redirect_to root_path\n end\n end\n end",
"def edit\n\t\t# admin is able to edit any user's page\n if current_user.is_admin?\n @user = User.find(params[:id])\n else\n @user = current_user\n end\n end",
"def edit\n authorize @volunteer_position\n end",
"def edit\n @city = City.find(params[:id])\n authorize @city\n end",
"def admin_authorize\n \tunless User.find(session[:user_id]).user_type == \"admin\"\n \t\tsession[:original_uri] = nil\n\t\t flash[:warning] = \"You are not authorized to view this page!\"\n\t\t redirect_to(root_path)\n \tend\n end",
"def authorize_admin!\n\t\tredirect_to new_admin_session_path unless current_admin\n\tend",
"def authorize\n\t\tredirect_to '/login' unless current_user\n\tend",
"def authorize_inherited_resource!\n authorize! :show, parent if parent?\n authorize! authorizable_action, authorize_resource? ? resource : resource_class\n end",
"def authorize_user\n @profile = current_user.profile\n return if @profile\n flash[:alert] = \"You can only edit your own profile\"\n redirect_to profile_path\n end",
"def authorize\n end",
"def authorize\n end",
"def authenticate_scope!\r\n send(:\"authenticate_#{resource_name}!\")\r\n self.resource = resource_class.find(send(:\"current_#{resource_name}\").id)\r\n end",
"def edit_authorized(current_user)\n return self.user_id == current_user.id\n end",
"def edit_authorized(current_user)\n return self.user_id == current_user.id\n end",
"def authorize_admin\n authorize! :update, convention.events.new\n end"
] |
[
"0.68939215",
"0.67663276",
"0.6688926",
"0.6678317",
"0.66612405",
"0.66326237",
"0.6627623",
"0.66241854",
"0.6611571",
"0.6563689",
"0.656317",
"0.6562768",
"0.65524554",
"0.65347296",
"0.652652",
"0.6512788",
"0.65017927",
"0.65015656",
"0.6460848",
"0.6445243",
"0.6442382",
"0.63989395",
"0.6398491",
"0.6397062",
"0.6367624",
"0.63653725",
"0.63477284",
"0.6341114",
"0.6332853",
"0.6325466",
"0.63245994",
"0.63118076",
"0.62794334",
"0.627878",
"0.627878",
"0.6270704",
"0.62601995",
"0.624715",
"0.623603",
"0.62254614",
"0.62179196",
"0.62149453",
"0.6211878",
"0.6203901",
"0.61920035",
"0.6189768",
"0.61754686",
"0.61742365",
"0.61688536",
"0.6168592",
"0.61653984",
"0.6159671",
"0.6149495",
"0.614329",
"0.6137776",
"0.61280394",
"0.61280394",
"0.61280394",
"0.6126787",
"0.6123356",
"0.6113538",
"0.61130303",
"0.61021763",
"0.60963106",
"0.6093674",
"0.60915565",
"0.6087026",
"0.608547",
"0.6081348",
"0.6076286",
"0.6075612",
"0.60747904",
"0.60662955",
"0.60641307",
"0.6055227",
"0.6055227",
"0.6055227",
"0.6055227",
"0.6055227",
"0.6055227",
"0.6055227",
"0.6055227",
"0.6050834",
"0.6048507",
"0.6026293",
"0.6024755",
"0.6023676",
"0.6020944",
"0.6016926",
"0.60154814",
"0.6012382",
"0.6011753",
"0.60109204",
"0.60073435",
"0.60045123",
"0.6002411",
"0.6002411",
"0.5996549",
"0.599504",
"0.599504",
"0.5991501"
] |
0.0
|
-1
|
PUT /resource We need to use a copy of the resource because we don't want to change the current user in place.
|
def update
self.resource = resource_class.to_adapter.get!(send(:"current_#{resource_name}").to_key)
if resource.update_with_password(resource_params)
if is_navigational_format?
if resource.respond_to?(:pending_reconfirmation?) && resource.pending_reconfirmation?
flash_key = :update_needs_confirmation
end
set_flash_message :notice, flash_key || :updated
end
sign_in resource_name, resource, :bypass => true
respond_with resource, :location => after_update_path_for(resource)
else
clean_up_passwords resource
respond_with resource
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def put\n if(resource.collection?)\n Forbidden\n elsif(!resource.parent_exists? || !resource.parent_collection?)\n Conflict\n else\n resource.lock_check if resource.supports_locking?\n status = resource.put(request, response)\n response['Location'] = \"#{scheme}://#{host}:#{port}#{url_format(resource)}\" if status == Created\n response.body = response['Location']\n status\n end\n end",
"def set_resource\n @user = current_user\n @resource = Resource.find(params[:id])\n end",
"def put(resource, body = \"\", headers = {})\n prepare_request(:put, resource, body, headers)\n end",
"def update_resource(resource, params)\n resource.role_id = 1\n resource.update_without_password(params)\n end",
"def _http_put resource, path\n uri = ::URI.parse(resource.auth_uri)\n path = _path uri, path\n request = Net::HTTP::Put.new(path)\n _build_request resource, request\nend",
"def _http_put resource, path\n uri = ::URI.parse(resource.auth_uri)\n path = _path uri, path\n request = Net::HTTP::Put.new(path)\n _build_request resource, request\nend",
"def put(resource_path, body:, headers: {}, prefix: API_PREFIX)\n request(method: :put, resource_path: resource_path, headers: headers, body: body, prefix: prefix)\n end",
"def update_resource(resource, attributes)\n resource.attributes = attributes\n resource.save\n resource\n end",
"def put(resource, **params)\n\n execute(Net::HTTP::Put, 'PUT', resource, **params)\n\n end",
"def update_resource(resource, params)\n resource.update_without_password(params)\n end",
"def update_resource(resource, params)\n resource.update_without_password(params)\n end",
"def update_resource(resource, params)\n resource.update_without_password(params)\n end",
"def update_resource(resource, params)\n resource.update_without_password(params)\n end",
"def update_resource(resource, params)\n resource.update_without_password(params)\n end",
"def update_resource(resource, params)\n resource.update_without_password(params)\n end",
"def update_resource(resource, params)\n resource.update_without_password(params)\n end",
"def update_resource(resource, params)\n resource.update_without_password(params)\n end",
"def update_resource(resource, params)\n resource.update_without_password(params)\n end",
"def update_resource(resource, params)\n resource.update_without_password(params)\n end",
"def update\n resource.update_attributes params[params_key], as: current_role\n respond_with resource\n end",
"def update\n @user_resource = UserResource.find(params[:id])\n\n respond_to do |format|\n if @user_resource.update_attributes(params[:user_resource])\n format.html { redirect_to user_preferences_path(@user), notice: 'User resource was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_resource(resource, params)\n check_id_uniformity(params)\n resource.assign_attributes(json_api_attributes(params))\n authorize resource, :update?\n resource.save!\n resource\n end",
"def update_resource(resource, params)\n resource.update_without_password(params)\n end",
"def update\n if @resource.update(resource_params)\n flash[:notice] = notification_message('edit_success')\n render json: { redirect_url: request.referrer }, status: :created\n else\n render json: { message: notification_message('edit_failure') }, status: :unprocessable_entity\n end\n end",
"def manage_resource(resource)\n unless resource.is_a?(OMF::SFA::Model::Resource)\n raise \"Resource '#{resource}' needs to be of type 'Resource', but is '#{resource.class}'\"\n end\n\n resource.account_id = _get_nil_account.id\n resource.save\n resource\n end",
"def update\n unless User.admin_by_token?(request.cookies[\"token\"])\n render json: { error: \"invalid_token\" }, status: :unauthorized\n return\n end\n\n if @resource.update(resource_params)\n render json: @resource, status: :ok\n else\n render json: @resource.errors, status: :unprocessable_entity\n end\n end",
"def put(path, request_options = {}, resource_options = {})\n response(:put, resource(resource_options)[path], request_options)\n end",
"def update_resource(resource, params)\n resource.update_with_password(params)\n end",
"def update_resource(resource, params)\n resource.update_with_password(params)\n end",
"def update_resource(resource, params)\n resource.update_with_password(params)\n end",
"def update_resource(resource, params)\n resource.update_with_password(params)\n end",
"def update_resource(resource, params)\n resource.update_with_password(params)\n end",
"def update_resource(resource, params)\n resource.update_with_password(params)\n end",
"def update_resource(resource, params)\n resource.update_with_password(params)\n end",
"def update\n respond_to do |format|\n if @resource.update(resource_params)\n @resource.saved_by(current_admin)\n format.html { redirect_to @resource, notice: 'Resource was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(resource, attributes = {})\n resource.client = self\n resource.update(attributes)\n end",
"def update_resource object, attributes\n object.update attributes\n end",
"def update_resource(resource_desc, resource_type, authorizer, new_attributes)\n resource = find_resource(resource_desc, resource_type, authorizer)\n authorizer.can_modify_resource?(resource, resource_type)\n resource.update(new_attributes)\n resource\n end",
"def update_resource(object, attrs)\n object.update_with_password(*attrs)\n end",
"def update_resource(resource, params)\n # abort params.inspect\n resource.update_without_password(params)\n end",
"def set_resource(resource = nil)\n resource ||= resource_class.find(params[:id])\n check_action_whitelisted!(params[:action])\n authorize! params[:action].to_sym, resource\n instance_variable_set(\"@#{resource_name}\", resource)\n end",
"def update\n authorize! :update, resource\n current_model_service.update resource, params\n yield if block_given? # after_update\n respond_with resource, location: helpers.show_path(resource)\n end",
"def update(resource, id, format=@default_format)\n options = { resource: resource.class, id: id, format: format }\n reply = put resource_url(options), resource, fhir_headers(options)\n reply.resource = parse_reply(resource.class, format, reply)\n reply.resource_class = resource.class\n reply\n end",
"def update\n @resource = Resource.find(params[:id])\n\n respond_to do |format|\n if @resource.update_attributes(params[:resource])\n format.html { redirect_to @resource, notice: 'Resource was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @resource = Resource.find(params[:id])\n\n respond_to do |format|\n if @resource.update_attributes(params[:resource])\n format.html { redirect_to @resource, notice: 'Resource was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @resource = Resource.find(params[:id])\n \n respond_to do |format|\n if @resource.update_attributes(params[:resource])\n flash[:notice] = 'Resource was successfully updated.'\n format.html { redirect_to(@resource) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @resource.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_resource(resource, params)\n if [\"facebook\", \"github\", \"google_oauth2\"].include? current_user.provider\n params.delete(\"email\")\n params.delete(\"avatar\")\n resource.update_without_password(params)\n else\n resource.update_with_password(params)\n end\n end",
"def update!(**args)\n @resource_id = args[:resource_id] if args.key?(:resource_id)\n end",
"def update\n @resource = Resource.find(params[:id])\n\n if @resource.update_attributes(params[:resource])\n flash[:notice] = 'Resource was successfully updated.'\n redirect_to @resource\n else\n render :action => \"edit\"\n end\n end",
"def new\n super\n @resource.user = current_user\n end",
"def send_put(resource, data)\n\n url = URI.parse(primavera_path(resource))\n req = Net::HTTP::Put.new(url.to_s, initheader = {'Content-Type' => 'application/json'})\n req.body = data\n\n puts 'Sending PUT request to ' + url.to_s\n\n send_request(url, req)\n end",
"def put\n conn = @client.authorized_connection(url: @client.object_api_url)\n res = conn.put do |req|\n req.headers['Content-Type'] = \"application/json\"\n req.url resource_uri\n req.body = raw.to_json\n end\n if res.success?\n data = JSON.parse(res.body)\n self.class.new(data, @client)\n else\n nil\n end\n end",
"def update\n begin\n @resource = Entity.find params[:id]\n @resource.update_attributes! params[:entity]\n render :response => :PUT\n rescue Exception => e\n @error = process_exception(e)\n render :response => :error\n end\n end",
"def update_profile_resource(resource, params)\n resource.update_without_password(params)\n end",
"def update \n begin\n @resource = Account.find(params[:id])\n @resource.update_attributes!(params[:account])\n render :response => :PUT\n rescue Exception => e\n @error = process_exception(e)\n render :response => :error\n end\n end",
"def resource=(new_resource)\n @resource = @resource.merge(new_resource)\n end",
"def update\n @resource = Resource.find(params[:id])\n\n respond_to do |format|\n if @resource.update_attributes(params[:resource])\n flash[:notice] = 'Resource was successfully updated.'\n format.html { redirect_to(@resource) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @resource.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @resource = Resource.find(params[:id])\n\n respond_to do |format|\n if @resource.update_attributes(params[:resource])\n flash[:notice] = 'Resource was successfully updated.'\n format.html { redirect_to(@resource) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @resource.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put(url, resource_name, options = {})\n build_response(resource_name) do\n connection.put do |req|\n req.url url\n req.body = options.to_json\n end\n end\n end",
"def update_resource(resource, params)\n # if params['email'] != current_user.email || params['password'].present?\n # resource.update_with_password(params)\n # else\n resource.update_without_password(params.except('password', 'password_confirmation', 'current_password'))\n # end\n end",
"def update\n user = self.resource = User.to_adapter.get!(send(:\"current_user\").to_key)\n\n if user.update_with_password(resource_params)\n set_flash_message :notice, :updated\n sign_in resource_name, user, :bypass => true\n respond_with user, :location => after_update_path_for(user)\n else\n clean_up_passwords user\n respond_with user\n end\n end",
"def update\n @resource = Resource.find(params[:id])\n\n respond_to do |format|\n if @resource.update_attributes(params[:resource])\n flash[:success] = 'Resource was successfully updated.'\n format.html { redirect_to admin_resource_path(@resource.id) }\n format.json { head :ok }\n else\n flash[:error] = @resource.errors.full_messages.join('')\n format.html { render action: \"edit\" }\n format.json { render json: @resource.errors.full_messages.join(''), status: :unprocessable_entity }\n end\n end\n end",
"def put(request, response)\n @resource.put(request, response)\n end",
"def update_current_logged_in_user(args = {}) \n put(\"/users.json/current\", args)\nend",
"def put(header = {})\n url = \"#{ApiClient.config.path}#{self.class.resource_path}\"\n response = ApiClient::Dispatcher.put(url, self.to_hash, header)\n attributes = ApiClient::Parser.response(response, url)\n update_attributes(attributes)\n end",
"def update\n @resource = Resource.find(params[:id])\n respond_to do |format|\n if @resource.update_attributes(params[:resource])\n format.html { redirect_to(edit_admin_resource_path(@resource), :notice => 'Resource was successfully updated.') }\n format.xml { head :ok }\n else\n get_resource_info\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @resource.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def base_update(resource, id, options, format = nil, headers = nil)\n headers ||= {}\n headers[:accept] = \"#{format}\" if format\n format ||= @default_format\n headers[:content_type] = \"#{format}\"\n headers[:prefer] = @return_preference if @use_return_preference\n options = {} if options.nil?\n options[:resource] = resource.class\n options[:format] = format\n options[:id] = id\n reply = put resource_url(options), resource, fhir_headers(headers)\n reply.resource = parse_reply(resource.class, format, reply) if reply.body.present?\n reply.resource_class = resource.class\n reply\n end",
"def find_and_update_resource\n model = class_name.find(params[:id])\n model.tap do |m|\n m.update get_secure_params\n set_resource_ivar m\n end\n end",
"def put!\n request! :put\n end",
"def update_resource(object, attributes)\n object.update(*attributes)\n end",
"def modify_user(user)\n query_api_object Model::User, '/rest/user', user.to_hash, 'PUT'\n end",
"def update_card_resource(card_id, resource, *paths)\n paths, options = extract_options(camp(resource), *paths)\n put card_path(card_id, *paths), options\n end",
"def updateUser\n options = {\n :body => params.to_json,\n :headers => {\n 'Content-Type' => 'application/json',\n 'Authorization' => request.headers['Authorization']\n }\n }\n results = HTTParty.put(\"http://192.168.99.101:4051/users/\"+@current_user[\"id\"].to_s, options)\n render json: results.parsed_response, status: results.code\n end",
"def put(name,&block)\n build_resource(name, :put, &block)\n end",
"def update_resource(resource, params)\n if !current_user.provider.nil?\n params.delete(\"current_password\")\n resource.update_without_password(params)\n else\n resource.update_with_password(params)\n end\n end",
"def update!(**args)\n @full_resource_name = args[:full_resource_name] if args.key?(:full_resource_name)\n @permission = args[:permission] if args.key?(:permission)\n @principal = args[:principal] if args.key?(:principal)\n end",
"def update!(**args)\n @full_resource_name = args[:full_resource_name] if args.key?(:full_resource_name)\n @permission = args[:permission] if args.key?(:permission)\n @principal = args[:principal] if args.key?(:principal)\n end",
"def set_resource\n @resource = Resource.find(params[:id])\n end",
"def set_resource\n @resource = Resource.find(params[:id])\n end",
"def set_resource\n @resource = Resource.find(params[:id])\n end",
"def set_resource\n @resource = Resource.find(params[:id])\n end",
"def set_resource\n @resource = Resource.find(params[:id])\n end",
"def set_resource\n @resource = Resource.find(params[:id])\n end",
"def set_resource\n @resource = Resource.find(params[:id])\n end",
"def set_resource\n @resource = Resource.find(params[:id])\n end",
"def set_resource\n @resource = Resource.find(params[:id])\n end",
"def set_resource\n @resource = Resource.find(params[:id])\n end",
"def set_resource\n @resource = Resource.find(params[:id])\n end",
"def set_resource\n @resource = Resource.find(params[:id])\n end",
"def update(resource,identifier,json)\n raise 'Not Yet Implemented'\n end",
"def update\n # make sure user is authorized\n unless @resource\n return render json: {\n success: false,\n errors: ['Unauthorized']\n }, status: 401\n end\n\n # ensure that password params were sent\n unless password_resource_params[:password] and password_resource_params[:password_confirmation]\n return render json: {\n success: false,\n errors: ['You must fill out the fields labeled \"password\" and \"password confirmation\".']\n }, status: 422\n end\n\n if @resource.update_attributes(password_resource_params)\n return render json: {\n success: true,\n data: {\n user: @resource,\n message: \"Your password has been successfully updated.\"\n }\n }\n else\n return render json: {\n success: false,\n errors: @resource.errors\n }, status: 422\n end\n end",
"def update!(**args)\n @granted = args[:granted] if args.key?(:granted)\n @permission = args[:permission] if args.key?(:permission)\n @resource = args[:resource] if args.key?(:resource)\n @resource_attributes = args[:resource_attributes] if args.key?(:resource_attributes)\n end",
"def save_resource\n resource.save\n end",
"def accept_resource\n resource = resource_class.accept_invitation!(update_resource_params)\n @user = User.find(resource.invited_by_id)\n resource.company_id = @user.company.id\n resource.save\n resource\n end",
"def update!(**args)\n @resource_key = args[:resource_key] if args.key?(:resource_key)\n end",
"def update_resource(resource, params)\n # Require current password if user is trying to change password.\n return super if params['password']&.present?\n\n # Allows user to update registration information without password.\n resource.update_without_password(params.except('current_password'))\n end",
"def update\n respond_to do |format|\n if @resource.update(resource_params)\n format.html { redirect_to @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 if @resource.update(resource_params)\n format.html { redirect_to @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 if @resource.update(resource_params)\n format.html { redirect_to @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 self.resource = resource_class.to_adapter.get!(send(:\"current_#{resource_name}\").to_key)\n\n if resource.update_attributes(params[resource_name])\n if is_navigational_format?\n if resource.respond_to?(:pending_reconfirmation?) && resource.pending_reconfirmation?\n flash_key = :update_needs_confirmation\n end\n set_flash_message :notice, flash_key || :updated\n end\n sign_in resource_name, resource, :bypass => true\n respond_with resource, :location => after_update_path_for(resource)\n else\n clean_up_passwords resource\n respond_with resource\n end\n end",
"def update_resource(resource, params)\n # Require current password if user is trying to change password.\n return super if params[\"password\"]&.present?\n # Allows user to update registration information without password.\n resource.update_without_password(params.except(\"current_password\"))\n end"
] |
[
"0.7224355",
"0.7005823",
"0.69810694",
"0.6971466",
"0.69555235",
"0.6954134",
"0.6753178",
"0.6746057",
"0.6743163",
"0.67177105",
"0.67177105",
"0.6707934",
"0.6707934",
"0.6707934",
"0.6707934",
"0.6707934",
"0.6707934",
"0.6707934",
"0.6707934",
"0.6702649",
"0.6697928",
"0.6695045",
"0.6686968",
"0.668169",
"0.66671896",
"0.6659751",
"0.664227",
"0.6627111",
"0.6627111",
"0.6627111",
"0.6627111",
"0.6627111",
"0.6627111",
"0.6627111",
"0.65771246",
"0.65642464",
"0.6540155",
"0.6511574",
"0.6510272",
"0.65095145",
"0.6435897",
"0.6427307",
"0.63887805",
"0.6381756",
"0.6381756",
"0.63437545",
"0.63271075",
"0.63200504",
"0.6312859",
"0.6305082",
"0.6287076",
"0.62765217",
"0.62747985",
"0.6259813",
"0.6257977",
"0.6253746",
"0.62329435",
"0.62329435",
"0.6231466",
"0.6222577",
"0.62140536",
"0.6204791",
"0.61853844",
"0.61746037",
"0.6167932",
"0.6164669",
"0.6158078",
"0.6149717",
"0.61487484",
"0.61481327",
"0.6142436",
"0.61329854",
"0.61319613",
"0.6128234",
"0.6127637",
"0.6125567",
"0.6125567",
"0.61198395",
"0.61198395",
"0.61198395",
"0.61198395",
"0.61198395",
"0.61198395",
"0.61198395",
"0.61198395",
"0.61198395",
"0.61198395",
"0.61198395",
"0.61198395",
"0.6117758",
"0.6112036",
"0.6108507",
"0.6107615",
"0.6103826",
"0.61006033",
"0.60934764",
"0.6087762",
"0.6087762",
"0.60876745",
"0.60842854",
"0.60839206"
] |
0.0
|
-1
|
def simplify_through_dictionary (0...columns).each do |col| (0...rows).each do |row|
|
def print_all
@data.each do |row|
row.each do |item|
print " ", item.area
end
print "\n"
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def print_map\n map.each_with_index do |row, i|\n row.each_with_index do |col , j|\n #puts col\n if col == 'R'\n print 'R'\n elsif col == 'S'\n print 'S'\n elsif col == 'B'\n print 'B'\n elsif col == 'W'\n print 'W'\n else\n print '#'\n end\n end\n puts ''\n end\n end",
"def cells\n rows.map { |r| r[key] }\n end",
"def rows_of_cols(cells = self.question_cells)\n result = cells.inject(Dictionary.new) do |rows, cell|\n rows[cell.row] = Dictionary.new if rows[cell.row].nil?\n rows[cell.row][cell.col] = cell\n rows\n end\n end",
"def yield_hash_rows(res, cols)\n res.ntuples.times do |recnum|\n converted_rec = {}\n cols.each do |fieldnum, type_proc, fieldsym|\n value = res.getvalue(recnum, fieldnum)\n converted_rec[fieldsym] = (value && type_proc) ? type_proc.call(value) : value\n end\n yield converted_rec\n end\n end",
"def yield_hash_rows(res, cols)\n res.ntuples.times do |recnum|\n converted_rec = {}\n cols.each do |fieldnum, type_proc, fieldsym|\n value = res.getvalue(recnum, fieldnum)\n converted_rec[fieldsym] = (value && type_proc) ? type_proc.call(value) : value\n end\n yield converted_rec\n end\n end",
"def make_decoding_or_key_rows\n hash_of_rows = {}\n i = 0\n hash_of_rows[i += 1] = make_row until i == 12\n hash_of_rows\n end",
"def build_hash_from_full_table_line(right_side, keycode, columns=[0..127])\n raise 'cannot build expresssions for full table with no columns' if columns.empty?\n sze = right_side.size\n right_side.each_with_object(TransmutableHash.new).with_index do |(keysyms, hsh), idx|\n if Utils.in_ranged_array?(columns, idx) \n # not sure why a 'b' is in the mapping when that's not an available range\n (flat = [keysyms].flatten).last.gsub!(/^\\+?0x0b/, '0x00') \n hsh[Utils.unwrap_ary([mod_combin(idx), keycode].flatten)] = Utils.unwrap_ary(flat)\n end\n end\n end",
"def normalize_row(row)\n Hash[row.map{|column_name, row_value| [column_name.parameterize.underscore.to_sym, row_value.to_s]}]\n end",
"def get_column_mappings(row)\r\n mappings = {}\r\n row.each_with_index do |heading, index|\r\n # Stop collecting headings, if heading is empty\r\n if not heading.blank?\r\n mappings[heading.downcase.gsub(/\\A\\s*/, '').chomp.gsub(/\\s/, '_').to_sym] = index\r\n else\r\n break\r\n end\r\n end\r\n mappings\r\n end",
"def fix_row(row)\n values = (1..SIZE).to_a\n values.each do |v|\n if reducable(row, v)\n row = replace_possible_with_known(row, v)\n end\n end\n row\nend",
"def fix_row(row)\n values = (1..SIZE).to_a\n values.each do |v|\n if reducable(row, v)\n row = replace_possible_with_known(row, v)\n end\n end\n row\nend",
"def updateColumns ws,srcColumn,srcHash,destColumn,writeNew = false\r\n row = 1\r\n keys = srcHash.keys\r\n #as long as the cell content is not nill\r\n while value = ws.cells(row,srcColumn).value\r\n #check if the contents of the srcColumn is present in the given hash\r\n if keys.include? value\r\n ws.cells(row,destColumn).value = srcHash[value]\r\n\t\t\t#Delete the entry , after writing into the excel\r\n\t\t\tsrcHash.delete value\r\n end\r\n\t\trow = row + 1\r\n end \r\n\t#check if new values should be written\r\n\tsrcHash.clear unless writeNew\r\n\r\n\t#Write the remaining entries in the excel sheet\r\n\tsrcHash.each do |key, value|\r\n\t\t#Since the key dint exist originally, write that as well\r\n\t\tws.cells(row,srcColumn).value = key\r\n\t\tws.cells(row,destColumn).value = srcHash[key]\r\n\t\trow = row + 1\r\n\tend\r\n \r\nend",
"def rows_of_cols\n result = self.answer_cells.inject({}) do |rows, cell|\n rows[cell.row] = {} unless rows[cell.row]\n rows[cell.row][cell.col] = cell\n rows\n end\n end",
"def each\n filas.times do |i|\n columnas.times do |j|\n yield self[i,j]\n end\n end\n end",
"def populate_row(row, key)\n alphabet.each do |letter|\n row << letter unless key.include? letter\n end\n\n row\n end",
"def map_from_row!(row_data)\n model_data = {}\n\n BREAKOUT_COLUMNS.each do |property_name|\n model_data[property_name] = row_data.delete(property_name) if row_data.key?(property_name)\n end\n\n# Merb.logger.info(\"Container Model Data is: #{model_data}\")\n\n model_data\n end",
"def yield_rows(r, cols)\n while row = r.fetch_row\n h = {}\n cols.each{|n, p, i| v = row[i]; h[n] = (v && p) ? p.call(v) : v}\n yield h\n end\n end",
"def raw\n @cache ||= Hash[ rows.map { |row| [row, cells(row)] } ]\n end",
"def columns; @columns_hash.values; end",
"def rows\n rows = []\n unless columns.empty?\n 0.upto(columns.first.items.last_i) do |rnum|\n row = {}\n columns.each do |col|\n row[col.header] = col[rnum]\n end\n rows << row\n end\n end\n rows\n end",
"def machine_hash(headers,rows)\n # This is just to give a nice data structure (a hash of )\n rows.each_with_index.map do |row, index|\n # todo - rearrange the hash so it is sorted - do we need the row index?\n Hash[headers.each_with_index.map { |header, pos| \n [header, row[pos] ]}\n ].merge('row' => index+2)\n end\n end",
"def kv_table(table)\n transform_table!(table).rows_hash\nend",
"def build_columns_and_rows_hash(db_columns, client, table_names)\n db_columns_and_rows = {}\n\n table_names.each do |table|\n db_columns_and_rows[table] = {}\n\n puts \"table #{table}\"\n\n query = \"select * from #{table}\"\n results = client.query(query)\n\n rows = []\n\n results.each do |row|\n els = []\n row.each do |el|\n els.push(el[1].to_s)\n end\n rows.push(els)\n end\n\n db_columns_and_rows[table]['rows'] = rows\n db_columns_and_rows[table]['columns'] = db_columns[table]\n end\n\n db_columns_and_rows\nend",
"def make_Fake_Map(num_rows, num_columns) \n random_row_index = (rand() * num_rows).to_i\n puts random_row_index\n random_column_index = (rand() * num_columns).to_i\n puts random_column_index\n \n fake_map_array = []\n\n count_row = 0\n\n while count_row < num_rows do \n row_array = []\n count_col = 0\n while count_col < num_columns do\n if (count_col == random_column_index && count_row == random_row_index) \n row_array.push(\"X\")\n else row_array.push(\"A\")\n end\n count_col +=1\n end\n count_row +=1\n fake_map_array.push(row_array)\n end\n\n p fake_map_array\nend",
"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 valid_sudoku(table)\n table.each do |row|\n row_map = {}\n row.each do |elem|\n if elem != '.'\n if row_map[elem] \n return false\n else\n row_map[elem] = 1\n end\n end\n end\n end\n \n i = 0\n 9.times do\n column_map = {}\n table.each do |row|\n col = row[i]\n if col != '.'\n if column_map[col] \n return false\n else\n column_map[col] = 1\n end\n end\n\n end\n k += 1\n end\n \n i = 0\n k = 0\n 9.times do\n box_map = {}\n while i < i + 3\n while k < k + 3\n \n end\n end \n end\n \n return true\nend",
"def extract_table table_rows, col_names, key, exclude_rows\n extracted_rows = []\n\n 0.upto(table_rows.size-1) do |idx|\n unless exclude_rows.include?(idx)\n row_node = table_rows[idx]\n extracted_rows.push extract_row row_node\n end\n end\n\n output = []\n extracted_rows.each do |row|\n json_row = {}\n row.each_with_index do |el, idx|\n json_row[col_names[idx]] = el\n end\n\n output[json_row[key].to_i] = json_row\n end\n\n output\n end",
"def inflate_functional_fields(data, original_key_order)\n output = []\n data.each do |row|\n output_row = {}\n\n processed_keys = []\n original_key_order.each do |original_key|\n if %w[ec go ipr].include? original_key\n # First, we take all distinct keys that start with \"ec\", \"go\" or \"ipr\"\n annotation_keys = row.keys.select { |key| key.start_with? original_key }\n processed_keys += annotation_keys\n unless annotation_keys.empty?\n # Each of the values of the annotation_keys is an array. All respective values of each of\n # these arrays need to be put together into one hash. (E.g. {a => [1, 2], b=> [x, y]} --> [{a: 1, b: x}, {a: 2, b: y}])\n reconstructed_objects = []\n (0..row[annotation_keys[0]].length).each do |i|\n reconstructed_object = {}\n annotation_keys.each do |annotation_key|\n reconstructed_object[%w[ec_number go_term ipr_code].include?(annotation_key) ? annotation_key : annotation_key[annotation_key.index('_') + 1, annotation_key.length]] = row[annotation_key][i]\n end\n reconstructed_objects << reconstructed_object\n end\n output_row[original_key] = reconstructed_objects\n end\n elsif row.key? original_key\n output_row[original_key] = row[original_key]\n end\n end\n\n output << output_row\n end\n output\n end",
"def each\n @rows.each do |row|\n row.each do |col|\n\tyield col\n end\n end\n end",
"def row_to_hash(row, columns, key_map)\n hash = {}\n (0..columns.length - 1).each do |i|\n # First, convert the column name using the translation table\n key = key_map[columns[i]]\n\n # Only process column if it's name is included in translation table\n if key\n value = row[i]\n # For string values, convert carriage returns to newlines, since\n # EasyChair form-entered newlines appear to be stored as CRs in\n # the exported data. This is primarily for the abstract field,\n # but this code performs the mapping on all string-valued columns\n if value && value.is_a?(String)\n value.gsub!(/\\r/, \"\\n\")\n end\n\n # Now store the value in the hash we're building\n hash[key] = value\n end\n end\n # Return the hash created from the array representing a CSV row\n hash\nend",
"def build_up_cells(cells, row)\n partial_cell = parse_row_to_partial_cell(row)\n\n partial_cell.each.with_index do |cell, index|\n if cells[index]\n cells[index] += \"#{cell.strip} \"\n else\n cells[index] = \"#{cell.strip} \"\n end\n end\n\n return cells\n end",
"def columns\n map.keys\n end",
"def relative_rows(square_type = :terrain)\r\n @rows ||= {}\r\n return @rows[square_type] if @rows[square_type] \r\n \r\n @rows[square_type] = @all_rows.values_at(*relative_indexes(:rows, square_type)).map do |column|\r\n column.values_at(*relative_indexes(:columns, square_type))\r\n end\r\n end",
"def clean_row(row)\n row = row.to_hash\n row['raw_ip_incoming'] = IPAddr.new(row['raw_ip_incoming']).to_i\n row['raw_ip_outgoing'] = IPAddr.new(row['raw_ip_outgoing']).to_i\n %w[port_incoming port_outgoing protocol num_packets_incoming \n size_packets_incoming num_packets_outgoing size_packets_outgoing].each do |col|\n row[col] = row[col].to_i\n end\n row\nend",
"def colorize_iterating map\n # map from country to its color\n colorized = {}\n map.each do |country, neighbors|\n local_colorized = colorized.clone # fake a functional view of colorized\n color = Ambit.choose Colors\n #puts \"considering #{color} for #{country}\"\n neighbors.each {|n| Ambit.assert colorized[n] != color}\n local_colorized[country] = color\n colorized = local_colorized\n end\n colorized\nend",
"def clean_table(table, number_of_colums)\n above_row = []\n #filter if they are not last column, and they are same as the item on the row above\n table.reduce([]) { |result, row|\n result << row.each_with_index.map do |item,i|\n if i == number_of_colums\n item \n else\n item == above_row[i] ? '' : item \n end\n end\n above_row = row\n result\n }\n end",
"def clean_table(table, number_of_colums)\n above_row = []\n #filter if they are not last column, and they are same as the item on the row above\n table.reduce([]) { |result, row|\n result << row.each_with_index.map do |item,i|\n if i == number_of_colums\n item \n else\n item == above_row[i] ? '' : item \n end\n end\n above_row = row\n result\n }\n end",
"def initTableMapping\n $map = Array.new(2000) { Array.new(2000,\"\") }\n $final_map = Array.new(2000) { Array.new(2000,\"\") }\n $hash = Hash.new(0)\nend",
"def itemized_changes\n offset_changes.inject({}) do |h, (row_num, col_hsh) |\n col_hsh.each_pair do |col_num, val|\n h[[row_num, col_num]] = val\n end\n \n h\n end\n end",
"def new_dictionary\n @m = get_row\n @dictionary = Array.new(m**3, 0)\n end",
"def load_map_chunk_column column_x, column_z; end",
"def _normalize( rows )\n rows.map do |row|\n h = row['_id']\n h['value'] = row['value'].to_i\n h\n end\n ensure\n rows.close\n end",
"def cover\n # TODO: return the order implied by the first example \n @rows.times do |r|\n @columns.times do |c|\n yield r,c\n end\n end\n end",
"def map_remove(column, *keys)\n statements.concat(keys.length.times.map { \"#{column}[?]\" })\n bind_vars.concat(keys)\n end",
"def symbolize_row_keys(row)\n out = {} # move to a real hash!\n row.each do |key, value|\n out[key.to_sym] = value.respond_to?(:wrapper) ? value.wrapper : value\n end\n out\n end",
"def flatmap(h, e, prefix = '')\n e.each do |k,v|\n if v.is_a?(Hash)\n flatmap(h, v, prefix+k+\"_\")\n else\n if not v.is_a? Array\n if v.is_a? String\n v = v.split.join(' ')\n v = v[0,10000] + ' ...' if v.size > 10000\n end\n\n h[prefix+k] = v\n end\n end\n end\n h\nend",
"def make_key_hash_for_row(keys, row)\n key_hash = {}\n keys.each {|k|\n key_hash[k] = row[k]\n }\n \n key_hash\nend",
"def build_index\n index = {}\n count = 0\n (0...rows).each do |row|\n (0...cols).each do |col|\n next unless used?(row, col)\n index[[row, col]] = count\n count += 1\n end\n end\n\n index\n end",
"def adjust_values\n @cols = @rows.transpose\n @blks[0] = [@rows[0][0], @rows[0][1], @rows[0][2], @rows[1][0], @rows[1][1], @rows[1][2], @rows[2][0], @rows[2][1], @rows[2][2]] #1\n @blks[1] = [@rows[0][3], @rows[0][4], @rows[0][5], @rows[1][3], @rows[1][4], @rows[1][5], @rows[2][3], @rows[2][4], @rows[2][5]] #2\n @blks[2] = [@rows[0][6], @rows[0][7], @rows[0][8], @rows[1][6], @rows[1][7], @rows[1][8], @rows[2][6], @rows[2][7], @rows[2][8]] #3\n @blks[3] = [@rows[3][0], @rows[3][1], @rows[3][2], @rows[4][0], @rows[4][1], @rows[4][2], @rows[5][0], @rows[5][1], @rows[5][2]] #4 \n @blks[4] = [@rows[3][3], @rows[3][4], @rows[3][5], @rows[4][3], @rows[4][4], @rows[4][5], @rows[5][3], @rows[5][4], @rows[5][5]] #5\n @blks[5] = [@rows[3][6], @rows[3][7], @rows[3][8], @rows[4][6], @rows[4][7], @rows[4][8], @rows[5][6], @rows[5][7], @rows[5][8]] #6\n @blks[6] = [@rows[6][0], @rows[6][1], @rows[6][2], @rows[7][0], @rows[7][1], @rows[7][2], @rows[8][0], @rows[8][1], @rows[8][2]] #7\n @blks[7] = [@rows[6][3], @rows[6][4], @rows[6][5], @rows[7][3], @rows[7][4], @rows[7][5], @rows[8][3], @rows[8][4], @rows[8][5]] #8\n @blks[8] = [@rows[6][6], @rows[6][7], @rows[6][8], @rows[7][6], @rows[7][7], @rows[7][8], @rows[8][6], @rows[8][7], @rows[8][8]] #9 \n solved\n end",
"def ensure_adjacent_rooms(map)\n map.each do |row|\n x_coordinate = map.index(row)\n row.each do |room|\n index = map[row].index(room)\n puts index\n end\n\n \n # x_coordinates = row.collect! { |room| room = row.index(room) }\n \n # x_coordinates.each { |coordin| puts coordin } \n # \n # row.each { |coordin| puts coordin } \n end\nend",
"def each_column\n end",
"def array_to_hash(map)\r\n h = Hash.new # key: item, value: 1D array of [row, column]\r\n for r in 0...map.length\r\n for c in 0...map[r].length\r\n item = map[r][c]\r\n if item!= nil\r\n h[item] = [r, c]\r\n end\r\n end\r\n end\r\n h[\"ORIGIN\"] = [0, 0] # special case. always fixed at (0,0)\r\n return h\r\nend",
"def lookup(row,col) #input file, put out rows\n @data.each do |row|\n\n row.each do |col|\n @parsed[row][col] = row[0][col].to_sym => col\n end\n end\n return @parsed\n end",
"def array_clone\n new_map = @map.inject([]) do |result,rows|\n result << rows.collect { |e| e}\n end\n \n \n end",
"def map_values(row, columns)\n values = columns.map do |v|\n # TODO - stw - which other cases do we need to handle?\n case v[1]\n when /int/: \n row[v[0]] || 'NULL'\n else \n (row[v[0]].nil? ? 'NULL' : \"'\" + @db1.escape_string(row[v[0]].to_s) + \"'\")\n end\n end\n values = values.join(',') \n end",
"def interleaved_table_to_hash(table)\n hash = {}\n array = table_to_array table\n array.each do |row|\n if row.size % 2 == 0\n hash.merge! Hash[*row]\n end\n end\n hash.delete \"\"\n hash\nend",
"def compact!\n compact_columns!\n compact_rows!\n end",
"def each_col\n cols.each\n end",
"def board(*rows) = rows.map(&:chars)",
"def normalize_array_of_columns(arry)\n arry.map do |f| \n if f.is_a?(Hash)\n f.symbolize_keys\n else\n f.to_sym\n end\n end\n end",
"def apply_with_context(sql,all_cols,keys_in_all_cols)\n hits = {}\n @pending_rcs.each do |rc|\n hits[rc.key] = rc\n end \n hist = []\n n = 2\n pending = 0\n skipped = false\n noted = false\n last_row = nil\n @db1.fetch(sql,all_cols + [\"__coopy_tag__\"]) do |row|\n tag = row.pop.to_i\n k = keyify(row.values_at(*keys_in_all_cols))\n if hits[k]\n emit_skip(row) if skipped\n hist.each do |row0|\n cells = row0.map{|v| { :txt => v, :value => v, :cell_mode => \"\" }}\n rc = RowChange.new(\"\",cells)\n rc.columns = @rc_columns\n @patch.apply_row(rc)\n end\n hist.clear\n pending = n\n @patch.apply_row(hits[k])\n hits.delete(k)\n skipped = false\n noted = true\n elsif tag == 1\n # ignore redundant row\n elsif pending>0\n emit_skip(row) if skipped\n cells = row.map{|v| { :txt => v, :value => v, :cell_mode => \"\" }}\n rc = RowChange.new(\"\",cells)\n rc.columns = @rc_columns\n @patch.apply_row(rc)\n pending = pending-1\n skipped = false\n else\n hist << row\n if hist.length>n\n skipped = true\n last_row = row\n hist.shift\n end\n end\n end\n emit_skip(last_row) if skipped and noted\n end",
"def apply_with_context(sql,all_cols,keys_in_all_cols)\n hits = {}\n @pending_rcs.each do |rc|\n hits[rc.key] = rc\n end \n hist = []\n n = 2\n pending = 0\n skipped = false\n noted = false\n last_row = nil\n @db1.fetch(sql,all_cols + [\"__coopy_tag__\"]) do |row|\n tag = row.pop.to_i\n k = keyify(row.values_at(*keys_in_all_cols))\n if hits[k]\n emit_skip(row) if skipped\n hist.each do |row0|\n cells = row0.map{|v| { :txt => v, :value => v, :cell_mode => \"\" }}\n rc = RowChange.new(\"\",cells)\n rc.columns = @rc_columns\n @patch.apply_row(rc)\n end\n hist.clear\n pending = n\n @patch.apply_row(hits[k])\n hits.delete(k)\n skipped = false\n noted = true\n elsif tag == 1\n # ignore redundant row\n elsif pending>0\n emit_skip(row) if skipped\n cells = row.map{|v| { :txt => v, :value => v, :cell_mode => \"\" }}\n rc = RowChange.new(\"\",cells)\n rc.columns = @rc_columns\n @patch.apply_row(rc)\n pending = pending-1\n skipped = false\n else\n hist << row\n if hist.length>n\n skipped = true\n last_row = row\n hist.shift\n end\n end\n end\n emit_skip(last_row) if skipped and noted\n end",
"def apply_with_context(sql,all_cols,keys_in_all_cols)\n hits = {}\n @pending_rcs.each do |rc|\n hits[rc.key] = rc\n end \n hist = []\n n = 2\n pending = 0\n skipped = false\n noted = false\n last_row = nil\n @db1.fetch(sql,all_cols + [\"__coopy_tag__\"]) do |row|\n tag = row.pop.to_i\n k = keyify(row.values_at(*keys_in_all_cols))\n if hits[k]\n emit_skip(row) if skipped\n hist.each do |row0|\n cells = row0.map{|v| { :txt => v, :value => v, :cell_mode => \"\" }}\n rc = RowChange.new(\"\",cells)\n rc.columns = @rc_columns\n @patch.apply_row(rc)\n end\n hist.clear\n pending = n\n @patch.apply_row(hits[k])\n hits.delete(k)\n skipped = false\n noted = true\n elsif tag == 1\n # ignore redundant row\n elsif pending>0\n emit_skip(row) if skipped\n cells = row.map{|v| { :txt => v, :value => v, :cell_mode => \"\" }}\n rc = RowChange.new(\"\",cells)\n rc.columns = @rc_columns\n @patch.apply_row(rc)\n pending = pending-1\n skipped = false\n else\n hist << row\n if hist.length>n\n skipped = true\n last_row = row\n hist.shift\n end\n end\n end\n emit_skip(last_row) if skipped and noted\n end",
"def times_table(rows)\n if rows > 0\n array = (1..rows).to_a\n\n i = 1\n while i <= rows\n puts array.map {|e| \"#{e*i} \"}.join(' ')\n i += 1\n end\n end\nend",
"def raw_table_to_hash tbl\n fixd_hsh = tbl.reject{|arr| arr.blank?}.inject({}) do |h,arr|\n title = arr.first.downcase.gsub(/[-\\s]/, '_').to_sym\n val = arr.last.gsub(\",\",\"\")\n h[title] = val\n h\n end\n fixd_hsh\n end",
"def de_populate_rows\n @rows.each_with_index do |row, y|\n row.each_index do |x|\n @rows[y][x] = nil\n end\n end\n end",
"def each\n @cells.each_with_index do |row, ir|\n row.each_with_index do |val, ic|\n yield ir, ic, val\n end\n end\n end",
"def rows\n @columns.each do |column|\n @rows << Array.new(@columns.size) do |i|\n \"#{column}#{i + 1}\"\n end\n end\n @rows\n end",
"def to_hash(cols=[])\n col_info = column_info(cols)\n rows = []\n while try { @result_set.next } do\n row = {}\n col_info.each do |col, info|\n obj = try{ @result_set.object(info[:index]) }\n case info[:type]\n when :string\n row[col] = obj.to_s\n when :boolean\n row[col] = (obj.to_s =~ /true/i ? true : false)\n when :long\n row[col] = obj.to_i\n when :double\n row[col] = obj.to_f\n else\n log.warning \"Unkown type: #{info[:type]} for #{col}\"\n row[col] = obj.to_s\n end\n end\n rows << row\n end\n rows\n end",
"def reduced_row_echelon_form\n (0...min_dimension).inject(clone) do |matrix, j|\n eliminate_row(matrix, j)\n end\n end",
"def process_rows!\n # Correct incorrect rows in the table\n table.each do |row|\n row_metric = row[\"metric\"] # perf optimization\n # TODO inject Saikuro reference\n if row_metric == :saikuro\n fix_row_file_path!(row)\n end\n tool_tables[row_metric] << row\n file_tables[row[\"file_path\"]] << row\n class_tables[row[\"class_name\"]] << row\n method_tables[row[\"method_name\"]] << row\n end\n end",
"def each_column\n @chash.each_with_index { |c, i| \n next if c.hidden\n yield c,i if block_given?\n }\n end",
"def flatten_cells() @cells.flatten end",
"def hash\r\n @row + @column\r\n end",
"def columns\r\n # TODO: transpose possibly doesn't work for rectangular (non-square) maps\r\n @all_columns ||= rows.transpose\r\n end",
"def expand_repeats(hash)\n\t\t\t\thash.each do |key,val|\n\t\t\t\t\tif val.kind_of? Array\n\t\t\t\t\t\tval.each_with_index{|v, i| hash[\"#{key}(#{i+1})\"] = v}\n\t\t\t\t\t\thash.delete(key)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\thash\n\t\t\tend",
"def get_data_map(d, colname)\n data_columns = []\n dc = get_data_column(d,colname)\n\n begin\n dc = dc.group_by(&:capitalize).map {|k,v| {k => v.length}}\n rescue NoMethodError #one of the values wasn't a string, and the capitalize method dne\n dc = dc.group_by(&:to_s).map {|k,v| {k => v.length}}\n end\n \n dc.each do |row|\n data_col_hash = {}\n colnames = [\"value\",\"count\"]\n key = row.keys().first()\n data_col_hash[\"value\"] = key\n data_col_hash[\"map\"] = row[key]\n data_columns << data_col_hash\n end\n\n return data_columns\n end",
"def other_way(matrix)\n result = []\n (0..2).each do |column_index|\n new_row = (0..2).map {|row_index| matrix[row_index][column_index]}\n result << new_row\n end\n result\nend",
"def generate\n for i in 0..$dimensions[0]-1\n for j in 0..$dimensions[1]-1\n for k in 0..$d-1\n item=populate k\n if item!=0 \n $grid[[i,j,k]]=item\n end\n end\n end\n end\nend",
"def tableConvert(tableName, table)\n dbTableH = Hash.new\n records = Array.new\n i = 0\n \n table.each do\n |row|\n records[i] = row\n i += 1\n end\n dbTableH[tableName] = records\n \n return dbTableH\nend",
"def times_table(rows)\n 1.upto(rows) do |y|\n puts\n 1.upto(rows) { |x| print \"#{x * y} \"}\n end\nend",
"def columns\n cols = []\n (0...size).each do |i|\n vals = []\n (0...size).each do |j|\n vals.push(get_square({:column => i, :row => j}))\n end\n cols.push(Row.new(size, {:vals => vals}))\n end\n cols\n end",
"def modify_from_hash(column)\n %i[sequence_no namespaced_name data_type caption width format hide pinned\n groupable group_by_seq group_sum group_avg group_min group_max].each do |att|\n send(\"#{att}=\", column[att])\n end\n end",
"def as_map\n row_names, rows = as_array\n map = {}\n row_names.zip(rows) do |row_name, row|\n map[row_name] = row\n end\n map\n end",
"def increase_columns(column)\n @sheet_data.each do |r|\n r.size.upto(column) do\n r << nil\n end\n end\n end",
"def populate_matrix_with_row_headers\n create_empty_array\n collect_row_headers\n replace_row_helpers\nend",
"def create_query_hash(array)\n names = array.shift\n rval = []\n array.each do |r|\n row = {}\n names.each_with_index { |column, idx| row[column] = r[idx] }\n rval << row\n end\n rval\nend",
"def initialize\n @map = []\n 8.times do |x|\n row = []\n 8.times { |y| row << nil }\n @map << row\n end\n end",
"def each(&block)\n table.values.each(&block)\n end",
"def sudoku(rows)\n # constrain the non-zero elements to keep their current values, and\n # constrain the zero elements (i.e. the blanks) to be between 1 and 9\n constrain_each_row(rows)\nend",
"def call\n @size.times.flat_map do |row|\n @size.times.map do |col|\n @cells.include?(\"#{row}-#{col}\") ? \"1\" : \"0\"\n end\n end.join\n end",
"def trans(input)\n\trows, columns = input.count, input.first.count\n\tx, y = [], []\n\ti = j = 0\n\twhile j < columns do\n\t\twhile i <= rows - 1 do\n\t\t\tx.push(input[i][j])\n\t\t\ti += 1\n\t\tend\n\t\tj += 1 #go to next column\n\t\ti = 0 #reset the inner counter to go back to 1st array\n\tend\n\tx.each_slice(rows).each.map{|e| y.push(e)}\n\treturn y\nend",
"def get_column_entries(column)\n jso = Hash.new() \n jss = self.get_structure()\n db_column = nil\n # Is the column recognized?\n if jss.has_key? column then\n db_column = jss[column].split(\"/\")[1]\n else\n return MIDB::Interface::Server.json_error(400, \"Bad Request\")\n end\n \n # Connect to database\n dbe = MIDB::API::Dbengine.new(@engine.config, @db)\n dblink = dbe.connect()\n rows = dbe.query(dblink, \"SELECT * FROM #{self.get_structure.values[0].split('/')[0]};\")\n if rows == false\n return MIDB::Interface::Server.json_error(400, \"Bad Request\")\n end\n # Iterate over all rows of this table\n rows.each do |row|\n\n name = column\n dbi = jss[name]\n table = dbi.split(\"/\")[0]\n field = dbi.split(\"/\")[1]\n # Must-match relations (\"table2/field/table2-field->row-field\")\n if dbi.split(\"/\").length > 2\n match = dbi.split(\"/\")[2]\n matching_field = match.split(\"->\")[0]\n row_field = match.split(\"->\")[1]\n query = dbe.query(dblink, \"SELECT #{field} FROM #{table} WHERE #{matching_field}=#{row[row_field]};\")\n else\n query = dbe.query(dblink, \"SELECT #{field} from #{table} WHERE id=#{row['id']};\")\n end\n if query == false\n return MIDB::Interface::Server.json_error(400, \"Bad Request\")\n end\n jso[row[\"id\"]] = {}\n jso[row[\"id\"]][name] = dbe.length(query) > 0 ? dbe.extract(query,field) : \"unknown\"\n jso[row[\"id\"]][name] = @hooks.format_field(name, jso[row[\"id\"]][name])\n end\n @hooks.after_get_all_entries(dbe.length(rows))\n return jso\n end",
"def columns=(integer); end",
"def generate_row(row)\n '<tr>' + '<td>' + \"#{(row.map {|x| generate_item(x)}).join('</td><td>')}\" + '</td></tr>' + \"\\n\" \n end",
"def simplify_dictionary\n self.class.simplify_dict(@x) || self\n end",
"def preprocess_2(data) \n data[1] = {A: 1, B: 0, C: 0 }\n data[2] = {A: 0, B: 1, C: 0 }\n data\nend",
"def iterate_through_keys\n upcased_cities = add_a_key_value_pair.map {|key, value| key.upcase}\n upcased_cities.each {|city| puts city}\nend",
"def multiple_variable_crossover(datacollection, colums, rows)\n porcent = datacollection.count\n\n puts \"#{colums}\"\n puts \"#{rows}\"\n data_collection_advanced = []\n datacollection.each_with_index do |data, index|\n id = index + 1\n data['id'] = id\n data_collection_advanced.push(data)\n end\n\n\n last_group_array = []\n rows.each do |column|\n agroup_array_x = []\n @hashx.each_with_index do |h, index|\n data_collection = {}\n groped_x = h[column]\n data_collection[column] = groped_x\n agroup_array_x.push(data_collection)\n end\n\n hashedART = {}\n group_hash = agroup_array_x.group_by { |u| u[column] }.map { |k, v| \n hashedART[ if !k.nil?\n \"#{k}\".downcase \n else\n \"null\"\n end\n ] = v.size.to_f/porcent.to_f }\n group_hash = hashedART\n group_array = agroup_array_x.group_by { |u| u[column] }.map { |k, v| [\n if !k.nil?\n \"#{k}\".downcase \n else\n \"null\"\n end, v.size.to_f/porcent.to_f] }\n heads = hashedART.keys\n hx = {\"hash\": hashedART, \"array\": group_array, \"heads\": heads}\n\n last_group_array.push(hx)\n end\n\n values_in_col = []\n\n\n colums.each do |col|\n @hashx.each_with_index do |h, index|\n values_in_col.push(h[col])\n end\n end\n\n values_in_col = values_in_col.uniq{|x| x}\n\n values_in_row = []\n adv_array = []\n last_group_array.each do |op|\n op[:heads].each do |px|\n values_in_row.push(px)\n rows.each do |row|\n values_in_col.each do |vin|\n colums.each do |col|\n hashed = {}\n hashed[\"row\"] = row\n hashed[\"rowvin\"] = px\n hashed[\"col\"] = col\n hashed[\"colvin\"] = vin\n selected = data_collection_advanced.select {|hash| hash[\"#{row}\"] == px if hash[\"#{col}\"] == \"#{vin}\"}\n hashed[\"q\"]= selected.count\n adv_array.push(hashed)\n end\n end\n end\n end\n end\n\n\n @crossover = {data: adv_array,values_in_row: values_in_row , values_in_col: values_in_col}\n\n end",
"def expand_lambda(row, col)\n (row - @lambda_table.size + 1).times do |r|\n @lambda_table << []\n end\n\n @lambda_table.each.with_index do |table_row, row_index|\n (col - @lambda_table[row_index].size + 1).times do |c|\n table_row << 0\n end\n end\n end",
"def build_row(row, i)\n row.map.with_index do |piece, j|\n color_options = colors_for(i,j)\n piece.to_s.colorize(color_options)\n end\n end"
] |
[
"0.6015866",
"0.5902497",
"0.5893342",
"0.5833148",
"0.5833148",
"0.5823839",
"0.5727281",
"0.5672835",
"0.567249",
"0.5602327",
"0.5602327",
"0.55974495",
"0.5595926",
"0.557455",
"0.5567937",
"0.55205506",
"0.5499634",
"0.54925597",
"0.5471352",
"0.54660463",
"0.54648113",
"0.54637897",
"0.5444707",
"0.54123217",
"0.5388258",
"0.53751194",
"0.53544265",
"0.53538257",
"0.5339876",
"0.5320947",
"0.5320026",
"0.53106284",
"0.5286014",
"0.52746624",
"0.52571887",
"0.5245107",
"0.5245107",
"0.5240672",
"0.5238479",
"0.5233704",
"0.5224496",
"0.5207527",
"0.51979774",
"0.5184339",
"0.5183577",
"0.51664186",
"0.514442",
"0.5140922",
"0.5138059",
"0.5126218",
"0.5122027",
"0.51216376",
"0.51167613",
"0.51130295",
"0.51103175",
"0.51093376",
"0.5108395",
"0.50948536",
"0.50939524",
"0.5088287",
"0.5085599",
"0.5085599",
"0.5085599",
"0.508128",
"0.5080833",
"0.5080263",
"0.5073402",
"0.5069218",
"0.5067062",
"0.50668985",
"0.50634176",
"0.5056482",
"0.5054842",
"0.5041436",
"0.50366366",
"0.50347126",
"0.5031923",
"0.50271386",
"0.5022234",
"0.5014815",
"0.5013115",
"0.50130934",
"0.5006155",
"0.49920607",
"0.49881306",
"0.49868",
"0.49836874",
"0.49735603",
"0.49725953",
"0.49704537",
"0.4969945",
"0.49690554",
"0.49663967",
"0.49573106",
"0.49541685",
"0.49522614",
"0.49515074",
"0.49514118",
"0.49493325",
"0.49474394",
"0.49411014"
] |
0.0
|
-1
|
GET /users GET /users.json
|
def index
@users = User.all
if is_admin?
@users = User.all - User.where(:username => "Anonymous")
elsif is_member?
@users = [@current_user]
else
redirect_to "signup"
end
respond_to do |format|
format.html # index.html.erb
format.json { render json: @users }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def users(args = {})\n get(\"/users.json\",args)\n end",
"def show\n begin\n user = User.find(params[:user_id])\n render json: { users: user }, status: :ok\n rescue => e\n render json: { errors: e.message}, status: 404\n end\n end",
"def GetUsers params = {}\n\n params = params.merge(path: 'users.json')\n APICall(params)\n\n end",
"def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n end",
"def list_users\n self.class.get('/users')\n end",
"def users\n get('get_users')\n end",
"def index\n users = User.all\n json_response(users)\n end",
"def show\n @users = User.all\n json_response(@users)\n end",
"def list\r\n users = User.all\r\n render json: users\r\n end",
"def show\n @users = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @users }\n end\n end",
"def get \n render :json => User.find(params[:id])\n end",
"def index\n @users = User.all\n\n render json: @users\n end",
"def index\n users = User.all\n render json: { users: users }, status: :ok\n end",
"def index\r\n users = User.all\r\n render json: users\r\n end",
"def users(params = {})\n params.merge!(key: 'users')\n objects_from_response(Code42::User, :get, 'user', params)\n end",
"def index\n users = User.all\n render json: users\n end",
"def index\n users = User.all\n render json: users\n end",
"def index\n users = User.all\n render json: users\n end",
"def index\n users = User.all\n render json: users\n end",
"def users(params = {})\n make_get_request('/account/users', params)\n end",
"def index\n users = User.all\n render json: users \n end",
"def index\n users = User.all\n\n render json: users, each_serializer: Api::V1::UsersSerializer\n end",
"def index\n user= User.all\n render json: {users:user}\n end",
"def index\n @users = User.all\n render json: @users, status: :ok\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n json_response(User.all) \n end",
"def index\n @users = User.all\n\n render json: @users\n end",
"def index\n @users = User.all\n\n render json: @users\n end",
"def index\n @users = User.all\n\n render json: @users\n end",
"def index\n @users = User.all\n\n render json: @users\n end",
"def index\n @users = User.all\n\n render json: @users\n end",
"def index\n @users = User.all\n\n render json: @users\n end",
"def user_info\n @user = @github.users.get user: params[:username]\n render json: Hash[@user]\n end",
"def index\n users = User.all \n render json: users \n end",
"def index\n\t\t# specifying json format in the URl\n\t uri = \"#{API_BASE_URL}/users.json\"\n\t # It will create new rest-client resource so that we can call different methods of it\n\t rest_resource = RestClient::Resource.new(uri, USERNAME, PASSWORD)\n\n\t # this next line will give you back all the details in json format, \n\t #but it will be wrapped as a string, so we will parse it in the next step.\n\t users = rest_resource.get \n\n\t # we will convert the return data into an array of hash. see json data parsing here\n\t @users = JSON.parse(users, :symbolize_names => true)\n\tend",
"def index\n\t\t@users = User.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render json: @users.map(&:as_json) }\n\t\tend\n\tend",
"def list\n render json: User.all\n end",
"def index\n @users = User.all\n render json: @users, status: :ok\n end",
"def user\n render :json=> User.find(params[:id])\n end",
"def index\n\n users = User.all \n render json: users\n\n end",
"def show\n render json: Users.find(params[\"id\"])\n end",
"def GetUser id\n\n APICall(path: \"users/#{id}.json\")\n\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html\n format.json { render json: @users }\n end\n end",
"def show\n @users = User.find(params[:id])\n if @users\n respond_to do |format|\n format.json { render :json => @users }\n format.xml { render :xml => @users }\n end\n else\n head :not_found\n end\n end",
"def index\n \t@users = User.all\n\n respond_to do |format| \n format.json { render json: @users }\n end\n end",
"def list\n get('users')['users']\n end",
"def index\n render ActiveModelSerializers::SerializableResource.new(@users,\n each_serializer: UserSerializer\n ).to_json, status: 200\n end",
"def index\n @users = User.all \n render json: @users, status: :ok \n end",
"def index\n @users = User.all\n logger.debug(\"user index\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n render json: User.all\n end",
"def index\n @users = User.order_by(last_name: :desc)\n if @users\n render json: Oj.dump(json_for(@users, include: ['phones', 'cards'], meta: meta), mode: :compat)\n else\n return head :unauthorized\n end\n end",
"def users(params = {})\n response = get('users/lookup.json', params)\n response.map {|user| Croudia::Object::User.new(user) }\n end",
"def index\n render json: User.all\n end",
"def index\n render json: User.all\n end",
"def show\n user = User.find(params[:id])\n render json: @user\nend",
"def list_users(user_id)\n self.class.get(\"/users/#{user_id}\")\n end",
"def show\n user = User.find(params[:id])\n render json: user\n end",
"def index\n\t\t@users = User.all\n\n\t\trespond_to do |format|\n\t\t format.html # index.html.erb\n\t\t format.json { render json: @users }\n\t\tend\n\tend",
"def index\n @users = User.all(limit: 100)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users.as_json(user: current_user) }\n end\n end",
"def get_users\r\n # Prepare query url.\r\n _path_url = '/users'\r\n _query_builder = Configuration.get_base_uri\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n decoded.map { |element| User.from_hash(element) }\r\n end",
"def show\n # When a http GET request to '/users/1' is received, have it show,\n # in json format, user 1's information.\n @id = params[:id]\n @user = User.find(@id)\n render json: @user\n end",
"def show\n user = User.find(params[:id])\n\n render json: user\n end",
"def index \n render json: User.all\n end",
"def index\n @myusers = Myuser.all\n\n render json: @myusers\n end",
"def index\n\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def query_users(options={}) path = \"/api/v2/users\"\n get(path, options, AvaTax::VERSION) end",
"def list\n response = @client.get(\"/users\")\n response[\"users\"].map {|u| User.new(@client, u) }\n end",
"def users\n\t\trespond_with User.all\n\tend",
"def index\n @users = User.all\n\n respond_with do |format|\n format.json do\n render json: @users,\n each_serializer: Api::UserSerializer,\n root: 'users'\n end\n end\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end"
] |
[
"0.82109934",
"0.7873764",
"0.7860689",
"0.78108346",
"0.78067017",
"0.7678852",
"0.76586664",
"0.76318866",
"0.7582366",
"0.75291824",
"0.7487637",
"0.74485743",
"0.7439024",
"0.7437192",
"0.7427442",
"0.73978853",
"0.73978853",
"0.73978853",
"0.73978853",
"0.7377353",
"0.7372414",
"0.736885",
"0.7368531",
"0.7367068",
"0.7358582",
"0.7358582",
"0.7358582",
"0.7358582",
"0.7358582",
"0.7358582",
"0.7358582",
"0.7358582",
"0.7358582",
"0.7358582",
"0.7351495",
"0.7350187",
"0.7350187",
"0.7350187",
"0.7350187",
"0.7350187",
"0.7350187",
"0.73463756",
"0.73426867",
"0.7331111",
"0.73231107",
"0.73227614",
"0.73126787",
"0.7295692",
"0.7274169",
"0.7265484",
"0.72624177",
"0.72607577",
"0.722517",
"0.72189873",
"0.71941674",
"0.71883225",
"0.7187108",
"0.71815044",
"0.717089",
"0.71695215",
"0.7156781",
"0.71546155",
"0.71546155",
"0.7140691",
"0.7135879",
"0.7134857",
"0.71316093",
"0.71315825",
"0.712011",
"0.7114429",
"0.7112858",
"0.7107888",
"0.7098051",
"0.70957917",
"0.70957917",
"0.7093039",
"0.70904744",
"0.70890427",
"0.70889443",
"0.7085115",
"0.7085115",
"0.7085115",
"0.7085115",
"0.7085115",
"0.7085115",
"0.7085115",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685"
] |
0.0
|
-1
|
GET /users/1 GET /users/1.json
|
def show
@user = User.find(params[:id])
@post_count = Post.where(:user_id => @user.id).count
@vote_count = Vote.where(:user_id => @user.id).count
@vote_for_your_posts_count = Post.where(:user_id => @user.id).joins(:votes).count
if !is_admin?
if !(@user == @current_user)
redirect_to @current_user
return
end
end
respond_to do |format|
format.html # show.html.erb
format.json { render json: @user }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n end",
"def get \n render :json => User.find(params[:id])\n end",
"def GetUser id\n\n APICall(path: \"users/#{id}.json\")\n\n end",
"def show\n begin\n user = User.find(params[:user_id])\n render json: { users: user }, status: :ok\n rescue => e\n render json: { errors: e.message}, status: 404\n end\n end",
"def users(args = {})\n get(\"/users.json\",args)\n end",
"def show\n # When a http GET request to '/users/1' is received, have it show,\n # in json format, user 1's information.\n @id = params[:id]\n @user = User.find(@id)\n render json: @user\n end",
"def user\n render :json=> User.find(params[:id])\n end",
"def fetch_one_user_data\n get_url(\"/api/v1/users/#{@filter}\")\n end",
"def show\n user = User.find(params[:id])\n render json: @user\nend",
"def show\n user = User.find(params[:id])\n render json: user\n end",
"def show\n user = User.find(params[:id])\n\n render json: user\n end",
"def show\n render json: Users.find(params[\"id\"])\n end",
"def show\n user = User.find(params[:id])\n render json: user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"def show\n user = User.select(:id, :username, :email).find(params[:id])\n render :json => user\n end",
"def show\n render json: User.find(params[\"id\"])\n end",
"def show\n @users = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @users }\n end\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\nend",
"def user_info\n @user = @github.users.get user: params[:username]\n render json: Hash[@user]\n end",
"def show\n render json: User.find(params[:id])\n end",
"def show\n @user = User.find(params[:id])\n render json:@user\n end",
"def show\n @user = User.find(params[:id])\n render json:@user\n end",
"def get_by_id\n \n # the user_id param comes from our route\n user = User.find(params[:user_id])\n \n if user\n render json: user, status: :ok\n else\n render json: { errors: 'User not found' }, status: :not_found\n end\n end",
"def GetUsers params = {}\n\n params = params.merge(path: 'users.json')\n APICall(params)\n\n end",
"def get_user_details\n @user = User.find_by_id(params[:user_id])\n render json: @user\n end",
"def show\n render json: User.find(params[:id])\n end",
"def show\n user = User.find_by(id: params[:id])\n render json: user, status: :ok\n end",
"def user(id)\n self.class.get(\"/user/#{id}\", @options).parsed_response\n end",
"def show\n @user = User.find(params[:id])\n render json: {user: @user}\n end",
"def list_users\n self.class.get('/users')\n end",
"def show\n user = User.find(params[:id])\n render json: user\n end",
"def show\n user = User.friendly.find(params[:user_id]) \n render json: user\n end",
"def show\n render :json => User.find(params[:id])\n end",
"def show(id)\n response = request(:get, \"/users/#{id}.json\")\n response[\"user\"]\n end",
"def index\n users = User.all\n json_response(users)\n end",
"def show\n @user = ActiveRecord::Base.connection.execute(\"\n SELECT * \n FROM users \n WHERE username = '#{params[:username].downcase}' \n LIMIT 1\").first\n\n respond_to do |format|\n format.html\n format.json {render json: User.find(@user[0])}\n end\n end",
"def show(id)\n response = request(:get, \"/users/#{id}.json\")\n response.first[1]\n end",
"def show\n @users = User.all\n json_response(@users)\n end",
"def index\n json_response(User.all) \n end",
"def get(user_id:)\n path = '/users/{userId}'\n .gsub('{userId}', user_id)\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n params = {\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'GET',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::User\n )\n end",
"def index\n users = User.all\n render json: { users: users }, status: :ok\n end",
"def show\n # @user = User.first\n user = User.find(params[:id])\n render json: user\n end",
"def user(user_id, params = {})\n make_get_request(\"/users/#{user_id}\", params)\n end",
"def show_user_profile\n @user = User.find(username: params[:username])\n render json: @user\n end",
"def user(id = nil)\n id.to_i.zero? ? get('/user') : get(\"/users/#{id}\")\n end",
"def get_user id, options={}, headers={}\n @connection.get \"users/#{id}.json\", options, headers\n end",
"def user(user=nil)\n if user\n get(\"/users/#{user}\", {}, 3)\n else\n get(\"/user\", {}, 3)\n end\n end",
"def index\n \n @user = User.find(current_user.id) \n\n respond_to do |format|\n format.html { render action: \"show\" }\n format.json { render json: @user }\n end\n end",
"def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @user }\n end\n end",
"def get_user(user_id:)\n parse(JSON.parse(connection.get(\"users/#{user_id}\").body))\n end",
"def index\n user= User.all\n render json: {users:user}\n end",
"def index\r\n users = User.all\r\n render json: users\r\n end",
"def show\n # puts params[:id]\n render json: User.find(params[:id])\n end",
"def get_user_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[\"user\"] = user.get_user_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 show\n @user = User.find(params[:id])\n if @user\n render json: {\n user: @user\n }\n else\n render json: {\n status: 500,\n errors: ['user not found']\n }\n end\n end",
"def index\n users = User.all\n render json: users\n end",
"def index\n users = User.all\n render json: users\n end",
"def index\n users = User.all\n render json: users\n end",
"def index\n users = User.all\n render json: users\n end",
"def show\n @user = User.find(params[:id])\n render json: {\n username: @user.username,\n first_name: @user.first_name,\n last_name: @user.last_name,\n email: @user.email,\n phone_number: @user.phone_number,\n contacts: @user.contacts\n }, status: :ok\n end",
"def get_user(user_id)\n request(Route.new(:GET, '/users/%{user_id}', user_id: user_id))\n end",
"def show\n @user = User.find(params[:id])\n render 'api/v1/users/show'\n end",
"def index\n users = User.all\n\n render json: users, each_serializer: Api::V1::UsersSerializer\n end",
"def index\n users = User.all\n render json: users \n end",
"def user(user_id)\n params = {\n :client_id => Swiftype.platform_client_id,\n :client_secret => Swiftype.platform_client_secret\n }\n get(\"users/#{user_id}.json\", params)\n end",
"def index\n users = User.all \n render json: users \n end",
"def list\r\n users = User.all\r\n render json: users\r\n end",
"def json_show_user_profile_by_user_id\n @user = User.find(params[:user_id])\n\n respond_to do |format|\n format.json { render json: @user.as_json(only:[:email,:username]) }\n end\n end",
"def index\n\t\t# specifying json format in the URl\n\t uri = \"#{API_BASE_URL}/users.json\"\n\t # It will create new rest-client resource so that we can call different methods of it\n\t rest_resource = RestClient::Resource.new(uri, USERNAME, PASSWORD)\n\n\t # this next line will give you back all the details in json format, \n\t #but it will be wrapped as a string, so we will parse it in the next step.\n\t users = rest_resource.get \n\n\t # we will convert the return data into an array of hash. see json data parsing here\n\t @users = JSON.parse(users, :symbolize_names => true)\n\tend",
"def show\n user = User.find_by(uid: params[:id])\n if user\n puts 'USER FOUND'\n render json: user\n else\n puts 'NO USER'\n render json: 'no user'.to_json\n end\n end",
"def show\n render json: UserService.get_user(params[:id]), includes: 'questions, answers'\n end",
"def index\n @users = User.all(limit: 100)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users.as_json(user: current_user) }\n end\n end",
"def index\n render :json => User.all, status: 200\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users, status: :ok\n end",
"def show\n @users = User.find(params[:id])\n if @users\n respond_to do |format|\n format.json { render :json => @users }\n format.xml { render :xml => @users }\n end\n else\n head :not_found\n end\n end",
"def index\n @users = User.all\n\n render json: @users\n end",
"def index\n @users = User.all\n\n render json: @users\n end"
] |
[
"0.81046426",
"0.7703556",
"0.77011716",
"0.76262826",
"0.7582106",
"0.74818",
"0.7461394",
"0.7446168",
"0.730656",
"0.7300699",
"0.72902125",
"0.72781444",
"0.72358584",
"0.72335744",
"0.72335744",
"0.72335744",
"0.72335744",
"0.72335744",
"0.72335744",
"0.72335744",
"0.7225407",
"0.7225407",
"0.7225407",
"0.7225407",
"0.7225407",
"0.7225407",
"0.7225407",
"0.7225407",
"0.72222257",
"0.72165024",
"0.72137505",
"0.72096044",
"0.71930283",
"0.7182953",
"0.7182144",
"0.7182144",
"0.7180289",
"0.71750754",
"0.7173851",
"0.71640617",
"0.71636444",
"0.71453786",
"0.7145053",
"0.7129776",
"0.71256554",
"0.71160513",
"0.7095665",
"0.70941204",
"0.70772994",
"0.7070785",
"0.7070607",
"0.7063351",
"0.70552826",
"0.7025071",
"0.7014598",
"0.70047677",
"0.6998373",
"0.69910055",
"0.6984177",
"0.6979766",
"0.6972448",
"0.6972228",
"0.6968384",
"0.69666255",
"0.6956339",
"0.69506294",
"0.6945614",
"0.6943135",
"0.69351804",
"0.6932212",
"0.6932212",
"0.6932212",
"0.6932212",
"0.6927094",
"0.69255126",
"0.6925136",
"0.6917375",
"0.6907744",
"0.68947464",
"0.6882589",
"0.6875701",
"0.68749416",
"0.68633634",
"0.6861618",
"0.6858055",
"0.6855495",
"0.68530583",
"0.685255",
"0.685255",
"0.685255",
"0.685255",
"0.685255",
"0.685255",
"0.685255",
"0.685255",
"0.685255",
"0.685255",
"0.6849599",
"0.6847195",
"0.6847074",
"0.6847074"
] |
0.0
|
-1
|
GET /users/new GET /users/new.json
|
def new
if is_admin?
if @superadmin_user
@role_options = ["Administrator", "Member"]
else
@role_options = ["Member"]
end
else
redirect_back_or(home_url)
return
end
@user = User.new
respond_to do |format|
format.html #new.html.erb
format.json { render json: @user }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @newuser = Newuser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newuser }\n end\n end",
"def new\n @usernew = Usernew.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @usernew }\n end\n end",
"def new\n @user = user.new\n\t\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n # When a http GET request to '/users/new' is received, have it render:\n # a view file with an empty form to create a new user.\n end",
"def new\n @user = User.new\n @action = \"new\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @users = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @users }\n end\n end",
"def new2\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n \n @user = User.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n \n end",
"def new\n @user = User.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end"
] |
[
"0.8287397",
"0.8169197",
"0.8155916",
"0.80483407",
"0.8022376",
"0.8021751",
"0.8009459",
"0.7950995",
"0.793078",
"0.793078",
"0.7873476",
"0.7873476",
"0.7873476",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956"
] |
0.0
|
-1
|
POST /users POST /users.json
|
def create
@user = User.new(params[:user])
if !is_admin?
@user.role = "Member"
end
respond_to do |format|
if @user.save
format.html { redirect_to @user, notice: 'User was successfully created.'}
format.json { render json: @user, status: :created, location: @user }
else
if !is_admin?
format.html { render "signup"}
format.json { render json: @user.errors, status: :unprocessable_entity }
else
if @superadmin_user
@role_options = ["Administrator", "Member"]
else
@role_options = ["Member"]
end
format.html {render "new"}
format.json { render json: @user.errors, status: :unprocessable_entity }
end
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def post_users(users)\n self.class.post('https://api.yesgraph.com/v0/users', {\n :body => users.to_json,\n :headers => @options,\n })\n end",
"def CreateUser params = {}\n \n APICall(path: 'users.json',method: 'POST',payload: params.to_json)\n \n end",
"def post body=nil, headers={}\n @connection.post \"users.json\", body, headers\n end",
"def create\n # render json: params\n render json: Users.create(params[\"user\"])\n end",
"def create_user(params:)\n parse(JSON.parse(connection.post(\"users\", params.to_json).body))\n end",
"def create\n user = User.create(user_params) \n render json: user, status: :created\n end",
"def create\n user = User.new(user_params)\n if user.save\n render json: user\n else\n render json: {errors: \"Cannot create user\"}, :status => 420\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(form_params)\n\n respond_to do |format|\n if @user.save\n format.json { render json: { users: @user }, status: :created }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n user = User.new(\n username: user_params[:username],\n password: user_params[:password])\n if user.save\n create_example_collection(user)\n render json: user, except: [:password_digest, :created_at, :updated_at]\n else\n render json: {errors: user.errors.full_messages}\n end\n end",
"def create\n user= User.create(user_params)\n render json: user\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n\t\t@user = User.new(users_params)\n\t\tif @user.save\n\t\t\tjson_response(@user, \"User is created Successfully.\")\n\t\telse\n\t\t\trender json: {message: @user.errors.full_messages.join(\" \")}, status: 400\n\t\tend\t\t\n\tend",
"def create\n user = User.new(@user_info)\n if user.save && user.errors.empty?\n render json: { status: 200, data: UserSerializer.new(user).as_json }\n else\n render json: { status: 400, error: user.errors.full_messages }\n end\n end",
"def create\n user = User.create(user_params)\n if user.valid?\n render json: user\n else\n render json: user.errors, status: :unprocessable_entity\n end\n end",
"def create(options = {})\n request(:post, '/users.json', default_params(options))\n end",
"def create\n @user = User.new user_params(params[:user])\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new user_params(params[:user])\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.create user_params\n \n if @user.save\n respond_with(@user) do |format|\n format.json {render}\n end\n end\n end",
"def create\n @user = User.new(user_params(params))\n \n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.json { render json: @user }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params(params))\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(user_params(params))\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create_user\n @user = User.new(user_params)\n if @user.save\n render json: UserSerializer.new(@user).serialized_json\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = @application.users.create(user_params)\n\n if @user.valid?\n render json: @user, status: :created, location: api_application_user_path(@application,@user)\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n user = User.create(user_params)\n if user.save\n render json: user\n else\n render json: user.errors, status: :bad\n end\n end",
"def create\n r = @api.create_user(user_params)\n respond_to do |format|\n if r.code == 201\n format.html { redirect_to users_url, notice: 'User was successfully created.' }\n else\n response = JSON.parse(r.body)\n format.html { redirect_to users_url, alert: response['message']}\n end\n end\n end",
"def create\n\n puts '-----------------------create in user controller'\n\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: UserSerializer.new(@user).serialized_json\n else\n render json: { error: I18n.t('user_create_error') }, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(user_params)\n if @user.save\n render json: { user: @user, success: 'User registration successful' }\n else\n render json: { error: 'User registration unsuccessful' }\n end\n end",
"def create\n @user = User.new(user_params)\n \n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n\t\tputs user_params\n\t\tuser = User.new(user_params)\n\t\tif user.save\n\t\t\trender json: { user: user, status: :success }\n\t\telse\n\t\t\trender json: { status: :failure, errors: user.errors.full_messages.join('') }\n\t\tend\n\tend",
"def create\n\t\t@user = User.new(user_params)\n\t\tif @user.save\n\t\t\trender json: @user, status: :created, location: @user\n\t\telse\n\t\t\trender json: @user.errors, status: :unprocessable_entity\n\t\tend\n\tend",
"def add_user(name, value)\n self.class.post(\"/users/#{name}\",\n body: value,\n headers: {\n 'Content-Type' => 'application/json; charset=UTF-8',\n Connection: 'keep-alive',\n Accept: 'application/json, text/plain, */*'\n })\n end",
"def create\n user = User.new(user_params)\n\n respond_to do |format|\n if user.save\n render json: user, status: :ok\n else\n format.json { render json: user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = current_user.users.build(user_params)\n\n if @user.save\n render json: @user\n else\n @user_items = []\n end\n end",
"def create\n user = User.new(user_params)\n render json: { status: 200, msg: 'User was created.', data: \"User Id #{user.id}\" } if user.save\n end",
"def create\n @users = User.new(params[:user])\n\n respond_to do |format|\n if @users.save\n format.html { redirect_to @users, notice: 'Regist was successfully created.' }\n format.json { render json: @users, status: :created, location: @users }\n else\n format.html { render action: \"new\" }\n format.json { render json: @users.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n user = User.new(user_params)\n if user.save\n render :json => user, :status => :created\n else\n render :json => {:ok => false, :message => user.errors}, :status => :unprocessable_entity\n end\n end",
"def create\n logger.debug user_params\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :ok\n else\n render json: @user.errors, status: :not_acceptable\n end\n end",
"def create\n user = User.create(user_params)\n render json: user, message: 'user succefully create', status: 200\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n\n up = user_params\n\n if up[:name].present?\n up[:first_name] = up[:name].split(' ')[0]\n up[:last_name] = up[:name].split(' ')[1]\n up.delete :name\n end\n @user = User.new(up)\n\n respond_to do |format|\n if @user.save\n # render json: {user: user, token: token}\n\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: api_user_url(@user)}\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n user = User.new(user_params)\n if user.save\n render json: {status: \"Se creo el usuario\"}, status: :ok\n else\n render json: {status: \"Error al crear el usuario\", errors: user.errors }, status: :unprocessable_entity\n end\n end",
"def create\n user = User.new(params[:user].permit(:username))\n if user.save\n render json: user\n else\n render json: user.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def create\n puts '>>> params:'\n puts params.inspect\n @user = User.new(params[:user])\n puts '>>> User:'\n puts @user.inspect\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n \tdata = { data: @user, status: :created, message: \"User was successfully created.\" }\n render :json => data\n else\n \tdata = { data: @user.errors, status: :unprocessable_entity }\n render :json => data\n end\n end",
"def create\n user_details = params.permit(:first_name, :last_name, :email)\n success = User.create(user_details)\n\n render json: { success: success }\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user.as_json(only: [:email, :authentication_token]), status: :created\n else\n head(:unprocessable_entity)\n end\n end",
"def create_user\n params = {\n :client_id => Swiftype.platform_client_id,\n :client_secret => Swiftype.platform_client_secret\n }\n post(\"users.json\", params)\n end",
"def create\n @user = User.new(params[:user])\n\n if @user.save\n respond_to do |format|\n format.json { render :json => @user.to_json, :status => 200 }\n format.xml { head :ok }\n format.html { redirect_to :action => :index }\n end\n else\n respond_to do |format|\n format.json { render :text => \"Could not create user\", :status => :unprocessable_entity } # placeholder\n format.xml { head :ok }\n format.html { render :action => :new, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n if @user.save\n render :ok, json: @user.to_json\n else\n @errors = @user.errors.full_messages\n render json: { message: @errors }, status: :unauthorized\n end\n end",
"def create\n puts params\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render json: @user.as_json(user: current_user), status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n user = User.new(user_params)\n if user.save\n render json: {status: 200, msg: 'User was created.'}\n else\n render json: {errors: user.errors.messages}\n end\n end",
"def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_url, :notice => 'User was successfully created.' }\n format.json { render :json => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new({name: params[:name], email: params[:email], password: params[:password], photo: params[:photo]})\n @user.save\n render json:@user\n end",
"def create\n user = User.create(user_params)\n\n if user.valid?\n render json: {user: UserSerializer.new(user), token: encode_token(user.id)}\n else\n render json: user.errors.full_messages\n end\n end",
"def create\n\t\tnew_user = User.new(user_params)\n\t\tif new_user.save\n\t\t render status: 200, json: {\n\t\t \tstatus: 200,\n\t\t message:\"New User Created\",\n\t\t response: {\n\t\t name: new_user.name,\n\t\t email: new_user.email,\n\t\t id: new_user.id,\n\t\t facebook_id: new_user.facebook_id,\n\t\t device_id: new_user.device_id,\n\t\t authentication_token: new_user.authentication_token\n\t\t }\n\t\t \n\t\t }.to_json\n\t\telse\n\t\t render status: 404, json: {\n\t\t \tstatus: 404,\n\t\t errors: new_user.errors\n\t\t }.to_json\n\t\tend\n\tend",
"def create\n\t\tresp = {} \n user = User.create(user_params)\n \tif user.valid?\n if user.save\n return render :json => user.as_json\n end\n end\n render json: user.errors.full_messages \n\tend",
"def post_users_with_http_info(users, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UsersApi.post_users ...'\n end\n # verify the required parameter 'users' is set\n if @api_client.config.client_side_validation && users.nil?\n fail ArgumentError, \"Missing the required parameter 'users' when calling UsersApi.post_users\"\n end\n # resource path\n local_var_path = '/users'\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(users) \n\n # return_type\n return_type = opts[:return_type] || 'User' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Bearer']\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: UsersApi#post_users\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_user(options = {})\n post \"/users\", options\n end",
"def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_url, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_url, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n user = User.new(user_params)\n\n if user.save\n\n render json: {status: 200, msg: 'User was created.'}\n\n else \n render json: {\n errors: user.errors.full_messages\n }, status: :unprocessable_entity\n\n end\n\n end",
"def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save \n format.html { redirect_to users_url, notice: \"User #{@user.name} was successfully created.\" }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_user(body)\n post 'create_user', body\n end",
"def create\n @user = User.new(user_params)\n @user.email = params[:email].downcase\n if @user.save\n render json: @user, status: 200\n else\n render json: { errors: @user.errors.full_messages }, status: 400\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json:@user\n elsif @user.errors\n render json: {error: {code: 400, server_message: @user.errors}}, status: :bad_request\n else\n render json: {error: {code: 500, message: \"Could not save user\", server_message: @user.errors}}, status: :internal_server_error\n end\n\n end",
"def create\n user = User.new(user_params)\n\n if user.valid?\n user.save\n render json: {user: user, token: encode_token({user_id: user.id})}\n else\n render json: {error: \"Failed to create the user\"}\n end\n end",
"def create\n @user = User.new(user_params)\n @user.save\n respond_with @user\n end",
"def create\n @user = User.new(user_params)\n render json: @user && return if @user.save\n\n render json: { error: \"Unable to save user: #{@user.errors.messages}\" }, status: 400\n end",
"def create\n params[:user][\"_id\"] = params[:user][:name]\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save()\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_user(attributes)\n post(\"/v1/users\", attributes)\n end",
"def create\n user = User.new(user_params)\n\n # if user is saved sucessfully it will return user and ith status 201 for created\n if user.save\n render json:user,status: :created\n #if request is properly served but data is wrong it ll give ubprocessable_entity with code 422\n else\n render json: user.errors, status: :unprocessable_entity\n end \n end",
"def create\r\n @user = User.new(params[:user])\r\n\r\n respond_to do |format|\r\n if @user.save\r\n format.html { redirect_to users_path, notice: 'Os dados do usuário foram salvos com sucesso!' }\r\n format.json { render json: @user, status: :created, location: @user }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @user.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @user = User.new(\n first_name: params[:first_name],\n last_name: params[:last_name],\n birth_date: params[:birth_date],\n height: params[:height],\n weight: params[:weight],\n user_name: params[:user_name],\n password: params[:password],\n password_confirmation: params[:password_confirmation],\n facebook_url: params[:facebook_url],\n twitter_url: params[:twitter_url],\n instagram_url: params[:instagram_url],\n address: params[:address],\n email: params[:email]\n ) \n if @user.save!\n render 'successful.json.jb', status: :created\n else\n render 'unsuccessful.json.jb', status: :bad_request\n end\n end",
"def post(hash)\n HttpClient::Preconditions.assert_class('hash', hash, Hash)\n @client.request(\"/users\").with_json(hash.to_json).post { |hash| Apidoc::Models::User.new(hash) }\n end",
"def create\n user = User.create!(user_params)\n session[:user_id] = user.id\n render json: user, status: :created\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: {message: \"user create successfuly\"}\n else\n render json: {message: \"Error\"}\n end \n end",
"def create\n # Insert new user in database\n user = User.new(user_params)\n\n if user.save\n # On success, send token information to authenticate user\n token = create_token(user.id, user.username)\n render json: {status: 200, token: token, user: user}\n # render json: @user, status: :created, location: @user\n else\n render json: user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(params[:user])\n @user.status = 'active'\n\n respond_to do |format|\n if @user.save\n format.json { render :json => @user, :status => :created }\n format.html { redirect_to(users_path) }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n respond_with(@user, location: users_url, notice: 'User was successfully created.')\n else\n respond_with(@user)\n end\n end",
"def create\n user = User.new(user_params)\n \n if user.save\n token = JsonWebToken.encode(user_id: user.id)\n render json: { auth_token: token, user: AuthUserSerializer.new(user).serializable_hash }, status: 201\n else \n render json: { errors: user.errors.full_messages }, status: 400\n end\n end",
"def create\n @user = User.new(params[:user])\n puts params[:user]\n respond_to do |format|\n if @user.save\n format.html { redirect_to :users, notice: 'Registration successful.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render :show, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render :show, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n user = User.create(user_params)\n if user.valid?\n user.username.downcase\n @token = issue_token(user)\n list = List.create(name: user.username)\n list.user_id = user.id\n user.save\n list.save\n render json: { user: UserSerializer.new(user), jwt: @token }, status: :created \n else \n render json: { error: user.errors.full_messages }, status: :not_acceptable\n end \n end",
"def create\n @user = User.new(user_params)\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_path, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_path, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n user_response = API::V1::Users.authenticate params.as_json\n if user_response.success?\n json = HashWithIndifferentAccess.new(user_response.parsed_response)\n auth_response = API::V1::Auth.issue json[:data]\n respond_with auth_response.body, auth_response.code\n else\n respond_with nil, :unauthorized\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render :json => { :status => 0 }\n else\n render :json => { :status => 1, :msg => @user.errors}\n end\n end",
"def create\n @user = User.new(user_params)\n if @user.save\n auth_token = Knock::AuthToken.new payload: { sub: @user.id }\n render json: { username: @user.username, jwt: auth_token.token }, status: :created\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n authorize :user, :create?\n @user = User.new(user_params)\n @user.save\n\n respond_to do |format|\n format.html\n format.json { render :json => @user, status: 200 }\n end\n end",
"def post_accounts(json_hash)\n @options = {:path => '/users.json',\n :body => json_hash[:json]}.merge(@options)\n\n request(\n :expects => 201,\n :method => :post,\n :body => @options[:body]\n )\n end",
"def create\n user = User.new(username: params[:username])\n if user.save\n payload = {'user_id': user.id}\n token = JWT.encode(payload, 'chatapp')\n render json: {\n user: user,\n token: token\n }\n else \n render json: { message: 'There was an error creating your account' }\n end\n end",
"def create\n user = User.create!(user_params)\n if user\n session[:user_id] = user.id\n render json: user, status: :created\n else\n render json: { errors: user.errors.full_messages }, status: :unprocessable_entity\n end\n end",
"def create\r\n @user = User.new user_params\r\n\r\n if @user.save\r\n render json: @user, serializer: SessionSerializer, root: nil\r\n else\r\n render json: { errors: @user.errors }, status: :unprocessable_entity\r\n end\r\n end",
"def create\n user = User.new(user_params)\n if user.save\n render json: { status: 'OK', msg: 'User was created.', error: 'nil' },\n status: :created\n else\n not_good(422)\n end\n end"
] |
[
"0.77179813",
"0.75206673",
"0.73831296",
"0.72405374",
"0.719841",
"0.7140812",
"0.71038526",
"0.7058827",
"0.7041636",
"0.70236504",
"0.7003128",
"0.70021695",
"0.70021695",
"0.70021695",
"0.69936967",
"0.6990463",
"0.6980393",
"0.6979075",
"0.69788617",
"0.69788617",
"0.69762856",
"0.6962628",
"0.6952247",
"0.69454783",
"0.69454783",
"0.6920555",
"0.69181055",
"0.691467",
"0.6901315",
"0.6898759",
"0.689459",
"0.6889815",
"0.6880676",
"0.6880467",
"0.6880196",
"0.68797004",
"0.6877297",
"0.686924",
"0.6855058",
"0.6851115",
"0.6844058",
"0.6814104",
"0.6803589",
"0.6777842",
"0.6776859",
"0.67678535",
"0.6757897",
"0.67471397",
"0.6738628",
"0.6734963",
"0.6733872",
"0.6720612",
"0.6711659",
"0.6670256",
"0.66581875",
"0.66573423",
"0.6654514",
"0.6638977",
"0.66325235",
"0.66199607",
"0.6615226",
"0.66148156",
"0.65989614",
"0.65910506",
"0.65792614",
"0.6578957",
"0.6573529",
"0.6573351",
"0.6557221",
"0.6553408",
"0.6551572",
"0.65466446",
"0.6540912",
"0.65399504",
"0.6538697",
"0.6535891",
"0.6533581",
"0.6526114",
"0.65116656",
"0.65072525",
"0.6507116",
"0.6503024",
"0.6490388",
"0.6488653",
"0.64881754",
"0.6473845",
"0.64722794",
"0.64702916",
"0.64702916",
"0.6469406",
"0.64682525",
"0.6462379",
"0.64619774",
"0.646129",
"0.6455196",
"0.645272",
"0.6448271",
"0.6447503",
"0.64468706",
"0.64460355",
"0.6441883"
] |
0.0
|
-1
|
PUT /users/1 PUT /users/1.json
|
def update
@user = User.find(params[:id])
respond_to do |format|
if @user.update_attributes(params[:user])
format.html { redirect_to @user, notice: 'User was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @user.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n render json: Users.update(params[\"id\"], params[\"user\"])\n end",
"def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end",
"def UpdateUser params = {}\n \n APICall(path: 'users.json',method: 'PUT',payload: params.to_json)\n \n end",
"def put user_id, options={}, headers={}\n @connection.put \"users/#{user_id}.json\", options, headers\n end",
"def updateUser\n options = {\n :body => params.to_json,\n :headers => {\n 'Content-Type' => 'application/json',\n 'Authorization' => request.headers['Authorization']\n }\n }\n results = HTTParty.put(\"http://192.168.99.101:4051/users/\"+@current_user[\"id\"].to_s, options)\n render json: results.parsed_response, status: results.code\n end",
"def update\n user = User.find_by(id: params[:id])\n user.update(user_params)\n render json: user\n end",
"def update\n @user = User.find(params[:id])\n @user.name = params[:name]\n @user.email = params[:email]\n @user.password = params[:password]\n @user.photo = params[:photo]\n @user.role = params[:type]\n @user.save\n render json:@user\n end",
"def update\n if user.update(user_params)\n render json: user\n else\n render json: {errors: \"Cannot create user\"}, :status => 420\n end\n end",
"def update\n user = @user_service.update_user(params[:id])\n render json: user, status: :ok\n end",
"def update_current_logged_in_user(args = {}) \n put(\"/users.json/current\", args)\nend",
"def modify_user(user)\n query_api_object Model::User, '/rest/user', user.to_hash, 'PUT'\n end",
"def update \n user = User.find(params[:id])\n # byebug\n user.update(user_params)\n\n render json: user\n end",
"def update\n @user = User.find(params[:id])\n @user.name = params[:name]\n @user.email = params[:email]\n @user.password = params[:password]\n @user.photo = params[:photo]\n @user.save\n render json:@user\n end",
"def update\n user = find_user\n user.update!(user_params)\n render json: user\n end",
"def update\n user = User.find(params[:id])\n\n # Use update with user_params to do a mass-assignment update and save. \n if user.update_attributes(user_params)\n render json: user\n else \n render json: user.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def update_user(user, options = {})\n put \"/users/#{user}\", options\n end",
"def update_user(options)\n patch(\"/user\", options, 3)\n end",
"def modify_user(user)\n query_api_object User, \"/rest/user\", user.dump(), \"PUT\"\n end",
"def update\n begin\n user = User.find(params[:user_id])\n if user.update(user_params)\n render json: { users: user }, status: :ok\n else\n render json: { errors: user.errors.messages }, status: 422\n end\n rescue => e\n render json: { errors: e.message }, status: 404\n end\n end",
"def update\n if @api_v1_user.update(api_v1_user_params)\n head :no_content\n else\n render json: @api_v1_user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n render json:@user\n else\n render json: { error: {code: 404, message: 'Invalid user' }}, status: :not_found\n end\n end",
"def update\n user = User.find(params[:id])\n user.update(user_params)\n if user.valid?\n render json: user\n else\n render json: user.errors\n end\n end",
"def update\n if @user.update(user_params)\n render json: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @user.update(user_params)\n render json: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update(id, params = {})\n request(:put, \"/users/#{id}\", body: params)\n end",
"def update\n if @user.update(user_params)\n render json: @user\n else\n render json: {error: \"Could not update user\"}\n end\n end",
"def update\n \trespond_to do |format|\n if @user.update(user_params)\n format.json { render json: @user }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n\t \t\n end",
"def update\n user = User.find(params[:id])\n if user.update(user_params)\n render json: user\n else\n render json: user.errors.full_messages\n end\n end",
"def update\n if @user.update(user_params)\n render json: @user, status: 200\n else\n render json: @user.errors, status: 422\n end\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update_attributes(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update_attributes(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update user_params(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = User.find(params[:id]) \n \n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_url, notice: 'User #{@user.name} was successfully created.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @user.update(user_params)\n render json: @user, status: :ok\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = User.find(params[:id])\n @user.update(user_params)\n render json: @current_user\n end",
"def update\n user = User.find(params[:id])\n if user.update(params_user)\n render json: user, status: 200\n else\n render json: user.errors, status: 422\n end\n\n end",
"def update\n\t\tif @user.update(user_params)\n\t\t\trender json: @user\n\t\telse\n\t\t\trender json: @user.errors, status: :unprocessable_entity\n\t\tend\n\tend",
"def update\n @user.update(user_params_update)\n json_response(@user)\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update(user_params(params[:user]))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @user.update(user_params)\n render json: @user, status: :ok, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if user.update(user_params)\n render json: user, status: :ok\n else\n format.json { render json: user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend",
"def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend",
"def update_user\n @user = User.find(params[:id])\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status :unprocessable_entity\n end\n end",
"def update\n user = User.find(params[:id])\n render json: { status: 200, msg: 'User details have been updated.' } if user.update(user_params)\n end",
"def update\n @user = User.find(params[:id])\n @user.update_attributes(params[:user])\n respond_with @user\n end",
"def update\n @user = User.find(params[:id])\n @user.update_attributes(params[:user])\n respond_with @user\n end",
"def update\n @user = V1::User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'V1::User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @user.id == current_api_user.id\n if @user.update(user_params)\n render json: @user.as_json(except: [:updated_at]), status: :ok\n else\n render json: @user.errors, status: :bad_request\n end\n else\n render json: '', status: :forbidden\n end\n end",
"def update\n @user = User.find(params[:id])\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update(user_params(params))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update(user_params(params))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update \n @current_user.update(user_params)\n render json: @current_user\n end",
"def update\n @user = User.find(params[:id])\n if @user.update(user_params(params))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = selected_user\n if @user.update(users_params)\n render 'api/users/show'\n else\n render json: @user.errors.full_messages, status: 422\n end\n end",
"def update\n @user = User.find(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.json { head :ok }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = current_api_user\n unless @user.update(user_params)\n render json: { error: @user.errors.full_messages.to_sentence }, status: :not_found\n end\n end",
"def update\n respond_to do |format|\n if @user.update(form_params)\n format.json { render json: { users: @user }, status: :ok, location: @user }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit(id, options={})\n request(:put, \"/users/#{id}.json\", default_params(options))\n end",
"def update_user(id, accountId, model) path = \"/api/v2/accounts/#{accountId}/users/#{id}\"\n put(path, model, {}, AvaTax::VERSION) end",
"def update\n user = User.find(params[:id])\n\n user.attributes = {\n name: params[:name]\n }\n\n user_save user\n end",
"def update\n @user = current_org.users.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'user was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user.update(user_params)\n respond_with @user\n end",
"def update\n user = User.find(params[:id])\n if user.update(user_params)\n render json: {\n status: 'OK',\n msg: 'User details have been updated.',\n error: 'nil'\n }, status: :accepted\n else\n not_good(406)\n end\n end",
"def update\n respond_to do |format|\n if @v1_user.update(v1_user_params)\n format.html { redirect_to @v1_user, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @v1_user }\n else\n format.html { render :edit }\n format.json { render json: @v1_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n authorize @user\n\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n\t\tif @user.update(users_params)\n \t\tjson_response(@user, \"User Update Successfully.\")\n \telse\n \t\trender json: {message: @user.errors.full_messages.join(\" \")}, status: 400\n \tend\n\tend",
"def update\n @user = current_user\n if @user.update(update_user_params)\n render 'api/v1/users/show'\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { render action: \"edit\"}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n \n end",
"def update(context, name, should)\n res = context.transport.put_request(context, \"security/users/#{name}\", keys_to_camelcase(should))\n\n context.err(name, res.body) unless res.success?\n end",
"def update!(options: {})\n\t\t\tuser = User.perform_request User.api_url(\"users/#{id}\"), :put, options, true\n\n\t\t\tif user\n\t\t\t\toptions.each do |key, value|\n\t\t\t\t\tself.send(\"#{key}=\", user['data'][\"#{key}\"])\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tnil\n\t\t\tend\n\t\tend",
"def update\n @user = user.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'user was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @todo = Todo.find(params[:todo][:id])\n if @todo.update_attributes(user_params)\n render json: @todo\n else\n render nothing: true, status: :bad_request\n end\n end",
"def update\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to users_path }\n format.json { render :json => @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_current_logged_in_users_password(args = {}) \n put(\"/users.json/current/password\", args)\nend",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_url, notice: 'User was successfully updated.' }\n\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_name(user_id:, name:)\n path = '/users/{userId}/name'\n .gsub('{userId}', user_id)\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n if name.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"name\"')\n end\n\n params = {\n name: name,\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'PATCH',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::User\n )\n end",
"def update_current_logged_in_user(args = {}) \n id = args['id']\n temp_path = \"/users.json/current\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"userId\")\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_user\n @user = User.find(params[:id])\n @user.update(params[:user])\n redirect \"/users/#{@user.id}\"\nend",
"def update\n @api_user = ApiUser.find(params[:id])\n\n if @api_user.update(api_user_params)\n head :no_content\n else\n render json: @api_user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_url, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_user\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user.as_json(user: current_user), notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.update(params[:user])\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update \n user = User.where(:id => current_user.user)\n if user.update(user_params)\n render :json => {:user => user }\n else\n render :json => {:error => user.errors.full_messages.first}\n end\nend",
"def update\n @user = User.find(params[:id])\n \n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, :notice => 'User was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n if @user.update(user_params)\n render json: @user, status: :ok, location: api_application_user_path(@application,@user)\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_path, :notice => 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes_from_api(params[:user])\n format.html { redirect_to @user, :notice => 'User was successfully updated.' }\n format.json { render_for_api :user, :json => @user }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, :notice => t('user.update_success') }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status=> :unprocessable_entity }\n end\n end\n end",
"def api_v11_users_user_name_put_with_http_info(user_name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi#api_v11_users_user_name_put ...\"\n end\n \n # verify the required parameter 'user_name' is set\n fail \"Missing the required parameter 'user_name' when calling api_v11_users_user_name_put\" if user_name.nil?\n \n # resource path\n path = \"/api/v11/users/{userName}\".sub('{format}','json').sub('{' + 'userName' + '}', user_name.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = []\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = []\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:PUT, 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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#api_v11_users_user_name_put\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update_user\n user = current_user\n if user.update(update_params)\n render json: { status: { updated: \"Ok\" } }\n else\n render json: user.errors.full_messages\n end\n end",
"def update\n @user = User.find(params[:id])\n if @user.update_attributes(user_params)\n redirect_to @user\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\nend",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = ::User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = \"User #{@user.username} successfully updated!\"\n format.html { redirect_to @user }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n user = User.find(params[:id])\n authorize! :update, user\n if user.update_attributes(user_params)\n render :json => {:ok => true, :message => 'successful updated'}, :head => :no_content\n else\n render :json => {:ok => false, :message => user.errors}, :status => :unprocessable_entity\n end\n end"
] |
[
"0.74114245",
"0.73920554",
"0.73041475",
"0.7254177",
"0.7202618",
"0.70756376",
"0.70535713",
"0.7029043",
"0.70075685",
"0.69883573",
"0.6983195",
"0.694263",
"0.69409895",
"0.692315",
"0.6909438",
"0.687742",
"0.68486536",
"0.6834162",
"0.6821841",
"0.6801179",
"0.67703044",
"0.6763487",
"0.6761313",
"0.6761313",
"0.67482305",
"0.67473894",
"0.6713073",
"0.6703807",
"0.6693307",
"0.66886777",
"0.66886777",
"0.66646844",
"0.66617274",
"0.66572624",
"0.6653578",
"0.66406506",
"0.6625279",
"0.66213304",
"0.66192704",
"0.6614916",
"0.6612626",
"0.6604333",
"0.65851104",
"0.65851104",
"0.65785134",
"0.65615654",
"0.65518224",
"0.65518224",
"0.6549094",
"0.6530534",
"0.6530534",
"0.65275174",
"0.6523527",
"0.6520384",
"0.6520384",
"0.6516204",
"0.65145653",
"0.65104014",
"0.6504922",
"0.6499594",
"0.64987266",
"0.64906204",
"0.64810187",
"0.64798295",
"0.64702576",
"0.64496434",
"0.6436427",
"0.6433962",
"0.64330167",
"0.6428237",
"0.6406415",
"0.6402615",
"0.6399288",
"0.63881207",
"0.63877773",
"0.6353986",
"0.63537806",
"0.633806",
"0.63360107",
"0.6334851",
"0.632672",
"0.63260114",
"0.63179153",
"0.63173646",
"0.6317282",
"0.6316377",
"0.6316055",
"0.63120025",
"0.6293317",
"0.62857985",
"0.6282219",
"0.6280316",
"0.6264061",
"0.62624925",
"0.625522",
"0.62549126",
"0.62547195",
"0.625327",
"0.625269",
"0.6252329",
"0.6245382"
] |
0.0
|
-1
|
DELETE /users/1 DELETE /users/1.json
|
def destroy
@user = User.find(params[:id])
if is_admin?
if @user.role == "Super Administrator"
flash[:notice] = "The Super Administrator cannot be deleted"
redirect_to @user
return
end
if @user.role == "Administrator"
if !@superadmin_user
if !(@current_user == @user)
flash[:notice] = "Only the super administrator can delete other administrators"
redirect_to @user
return
end
end
end
else
if !(@current_user == @user)
flash[:notice] = "You do not have permission to delete this user!"
redirect_to @current_user
return
end
end
@posts = Post.where(:user_id => @user.id).all
#@replies = Reply.where(:user_id => @user.id).all
@anonymous = User.where(:username => 'Anonymous').first
@posts.each do |p|
p.update_attributes(:user_id => @anonymous.id)
end
#@replies.each do |r|
# r.update_attributes(:user_id => @anonymous.id)
#end
@user.destroy
respond_to do |format|
format.html { redirect_to users_url }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end",
"def delete\n render json: User.delete(params[\"id\"])\n end",
"def delete(id)\n request(:delete, \"/users/#{id}.json\")\n end",
"def delete\n render json: Users.delete(params[\"id\"])\n end",
"def delete\n @user.destroy\n respond_to do |format|\n format.html { redirect_to v1_resources_users_all_path, notice: 'User was deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n render json:@user\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n render json:@user\n end",
"def destroy\n @user = V1::User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(v1_users_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n \"\"\"\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n \"\"\"\n end",
"def destroy\n debugger\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user.destroy\n format.json { head :no_content }\n end",
"def destroy\n user = User.find(params[:id]) # from url, nothing to do with table\n user.destroy\n render json: user\n end",
"def destroy\n @user.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find_by_id_or_username params[:id]\n @user.destroy\n render api_delete @user\n end",
"def destroy\n @user = user.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def delete_user\n @user = User.find(params[:id])\n if @user.destroy\n render :json => @user\n else\n render :json => @user.errors.full_messages\n end\n end",
"def destroy\n @v1_user.destroy\n respond_to do |format|\n format.html { redirect_to v1_users_url, notice: 'User was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n \n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.78750724",
"0.77518034",
"0.7713981",
"0.7610077",
"0.747295",
"0.74073994",
"0.74073994",
"0.7369968",
"0.7346072",
"0.7340465",
"0.7328618",
"0.7309635",
"0.73095363",
"0.7306841",
"0.7297868",
"0.72917855",
"0.7291585",
"0.7289111",
"0.7284347",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7245172",
"0.7242216",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177"
] |
0.0
|
-1
|
Instantiates a new Angle object.
|
def initialize(angle, unit)
case unit
when :degrees, :deg then convert_and_normalize_degrees(angle)
when :radians, :rad then convert_and_normalize_radians(angle)
else
raise InvalidArgumentsError, "Unit should be :degrees, :deg, :radians ord :rad."
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def initialize(angle = 0, radians = false)\n # assumes that we are getting an angle in degrees.\n @angle = if radians == true || radians == :radians\n angle.to_f # works for String, Fixed, other Angles and for Float.\n elsif angle.instance_of?(Array)\n self.class.decimal_deg(*angle).to_radians\n else\n angle.to_radians # we have a String and Numeric class version of this. Another Angle will work too.\n end\n end",
"def angle_a\n Angle.new(\n self,\n :a,\n (\n (\n Math.acos((b**2 + c**2 - a**2) / (2.0 * b * c)) * 180\n ) / Math::PI\n )\n )\n end",
"def angle\n ns = norm\n x_ = @x / ns\n y_ = @y / ns\n\n Math.atan2(x_, y_)\n end",
"def angle()\n a, c = @view__.angle, @context__\n c ? c.fromDegrees__(a) : a * Processing::GraphicsContext::DEG2RAD__\n end",
"def initialize(x,y,angle = 0)\n super()\n @pos = Point.new(x,y)\n @angle = angle*Math::PI / 180\n @down = true\n @stack = []\n end",
"def angle\n Math.atan2(@y, @x)\n end",
"def angle\n @angle\n end",
"def angle\n Math.atan2( @y, @x )\n end",
"def angle(x1, y1, x2, y2)\n end",
"def initialize(params={})\n super\n\n @current_angle = 0\n additional_params = params.fetch(:additional_params, {})\n min_max = additional_params.fetch(:range, {:min => 30, :max => 150})\n @angle_range = Range.new(min_max[:min],min_max[:max])\n end",
"def angle_c\n Angle.new(\n self,\n :c,\n (\n (\n Math.acos((a**2 + b**2 - c**2) / (2.0 * a * b)) * 180\n ) / Math::PI\n )\n )\n end",
"def radians\n Science::Angle.new(self, :radians)\n end",
"def angle(path)\n io_for(path).angle\n end",
"def angle_b\n Angle.new(\n self,\n :b,\n (\n (\n Math.acos((a**2 + c**2 - b**2) / (2.0 * a * c)) * 180\n ) / Math::PI\n )\n )\n end",
"def initialize(*args)\n @cx = 0\n @cy = 0\n @radius_x = 0\n @radius_y = 0\n @angle_offset = 0\n set(*args)\n end",
"def initialize(x = 0, y = 0, z = 0, yaw = 0, pitch = 0, roll = 0)\n super(x, y, z)\n @yaw, @pitch, @roll = yaw, pitch, roll\n end",
"def angle_deg=( angle_deg )\n self.angle = angle_deg * DEG_TO_RAD\n self\n end",
"def initialize\n\t\t@rotation\t= [0.0, 0.0, 0.0, 0.0]\n\tend",
"def angle(*args)\n Math.acos(self.dot(*args))\n end",
"def initialize(radians = NORTH)\n @radians = radians.to_f % FULL_ANGLE\n @memoized = {} # allow memoization since @some_var ||= x doesn't work when frozen\n self.freeze\n end",
"def angle\n rad / Math::PI * 180\n end",
"def angle_deg\n angle * RAD_TO_DEG\n end",
"def new\n @annonce = Annonce.new\n end",
"def initialize(distance, diameter)\n @distance = distance\n @diameter = diameter\n @theta = 0\n @orbit_speed = rand(-0.01 .. 0.01) \n end",
"def angle(other)\n\n # Two options here:\n #\n # 1. Math.atan2(other.cross_length(self), dot(other)) \n #\n # This is stable but slower (x 1.5)\n #\n # 2. Math.acos(dot(other) / (r * other.r)) \n #\n # This is faster but unstable around 0 and pi where the gradient of acos approaches \n # infinity. An alternative way to view this is that the gradient of cos approaches\n # zero and small differences in angle can be indistinguishable at some number of \n # decimal places.\n #\n \n # Math.acos(dot(other) / (r * other.r)) \n Math.atan2(other.cross_length(self), dot(other)) \n end",
"def angle_from_input\n\n return if @path.size < 2\n return unless @active_controller.is_a? Symbol\n\n i = @active_controller == :start ? 0 : 1\n corner = @path[-i]\n ref_vector = @path[-i] - @path[1 - 3 * i]\n input_vector = corner - @ip.position\n return unless input_vector.valid?\n return if input_vector.parallel? Z_AXIS\n return if input_vector.parallel? ref_vector\n\n angle = -(MyGeom.angle_in_plane input_vector, ref_vector)\n angle -= GRAPHICAL_ANGLES[i]\n angle = ((angle+90.degrees)%180.degrees)-90.degrees\n\n @end_angles[i] = angle\n\n end",
"def angle\n v = to_vec\n if v[1] == 0.0\n nil\n else\n v.angle\n end\n end",
"def initialize(x, y, z, theta = nil, phi = nil)\n set_coords(x, y, z)\n self.v = V\n self.theta = theta\n self.phi = phi\n self.theta = Random.rand(0..(Math::PI)) unless self.theta\n self.phi = Random.rand(0..(2 * Math::PI)) unless self.phi\n end",
"def angle_of_specified_radius\n @angle_of_radius\n end",
"def initialize(x = 0, y = 0, radius = 1, direction = 0)\n @x, @y, @radius, @direction = x, y, radius, direction\n end",
"def angle x1, y1, a, m, c\n x2, y2 = project x1, y1, a, m\n line x1, y1, x2, y2, c\n end",
"def rotation(during, on, angle_start, angle_end, distortion: :UNICITY_DISTORTION, time_source: :GENERIC_TIME_SOURCE)\n ScalarAnimation.new(during, on, :angle=, angle_start, angle_end, distortion: distortion, time_source: time_source)\n end",
"def angle=( angle_rad )\n raise \"can't modify frozen object\" if frozen?\n m = magnitude\n @x = Math::cos(angle_rad) * m\n @y = Math::sin(angle_rad) * m\n @hash = nil\n self\n end",
"def rotate\n @angle += Math::PI / 16\n @angle = @angle % (Math::PI * 2)\n end",
"def create_rotation\n end",
"def axis_rotation( axis, angle ) \n\t\t\traise TypeError, \"no implicit conversion of %s to ODE::Vector\" unless\n\t\t\t\taxis.is_a?( ODE::Vector )\n\t\t\tangle = Float(angle)\n\n\t\t\tif len = axis.abs\n\t\t\t\ta = axis/len * sin( angle / 2.0 );\n\t\t\t\tself.class.new( a, cos(angle/2.0) )\n\t\t\telse\n\t\t\t\tself.class.identity\n\t\t\tend\n\t\tend",
"def rotate!( angle_rad )\n self.angle += angle_rad\n self\n end",
"def initialize(latitude = 0, longitude = 0, altitude = 0, radians = false)\n @latitude = Latitude.new(latitude, radians)\n @longitude = Longitude.new(longitude, radians)\n @altitude = altitude.to_f\n end",
"def orthodrome_init_angle(lat1, lon1, lat2, lon2)\n dlon = (lon2 - lon1) * RAD_PER_DEG\n cola1 = Math.cos(lat1 * RAD_PER_DEG)\n sila1 = Math.sin(lat1 * RAD_PER_DEG)\n cola2 = Math.cos(lat2 * RAD_PER_DEG)\n sila2 = Math.sin(lat2 * RAD_PER_DEG)\n\n y = Math.sin(dlon) * cola2\n x = cola1 * sila2 - sila1 * cola2 * Math.cos(dlon)\n angle = Math.atan2(y,x)/RAD_PER_DEG # angle in degrees\n end",
"def start_angle\n end",
"def +(other)\n return self.class.radians(@angle + other)\n end",
"def initialize(radius, velocity, initial=0)\n @radius = radius\n @velocity = velocity\n @theta = initial\n end",
"def initialize( length = 0, direction = 0)\n @length = length\n @direction = direction\n \n @i = Math.cos( degreToRadian( @direction ) ) * @length\n #@j = 0\n @j = (Math.sin( degreToRadian( @direction ) ) * @length )*(-1) #*(-1) a cause du sytem axe en y inverse\n puts(\"vector unitaire: \" + i.to_s + \" \" + j.to_s)\n end",
"def antipode\n Location.new :latitude => -latitude, :longitude => longitude + (longitude >= 0 ? -180 : 180)\n end",
"def rotate(angle)\n case angle % 360\n when 0 then dup\n when 90 then rotate_cw\n when 180 then rotate_flip\n when 270 then rotate_ccw\n else\n raise RuntimeError, \"unsupported rotation angle #{angle}\"\n end\n end",
"def initialize(inclination_deg, period_min, swath_width_km, start_clat_deg, count=0)\n @declination_rad = nil # lazy\n @inclination_rad = inclination_deg * PI / 180.0\n @period_s = period_min * 60\n @swath_width_rad = swath_width_km * 1000 / EARTH_RADIUS_M\n @start_clat_rad = start_clat_deg * PI / 180.0\n @count = count\n end",
"def initialize turtle, x_translation = 0, y_translation = 0\n super()\n setup_attributes\n setup_affine turtle, x_translation, y_translation\n draw_turtle turtle\n self\n end",
"def new\n @bond = Bond.new\n end",
"def random_angle\n 360 * rand\n end",
"def initialize(degree, arcminute=0, arcsecond=0)\n @degree = degree\n @arcminute = arcminute\n @arcsecond = arcsecond\n end",
"def test_Complex_InstanceMethods_angle\n\t\tassert_equal(0.0, Complex(1, 0).angle)\n\t\tassert_equal(0.7853981633974483, Complex(1,1).angle)\n\t\tassert_equal(1.5707963267948966, Complex(0,1).angle)\n\tend",
"def rotate(radians)\n sin = Math.sin radians\n cos = Math.cos radians\n Vector.new cos * @x - sin * @y, sin * @x + cos * @y\n end",
"def rotate_deg!( angle_deg )\n self.angle_deg += angle_deg\n self\n end",
"def angle_from other_point\n Geometry.angle_from self, other_point\n end",
"def angle(p)\n Math.atan2(p.y - self.y, p.x - self.x)\n end",
"def angles\n @angles ||= Angles.from_grpc @grpc\n end",
"def initialize(x, y, direction)\n @x = x.to_i\n @y = y.to_i\n @direction = direction.to_s\n puts \"Initial Coordinates are (#{@x}, #{@y}) and the rover is facing #{@direction}\"\n end",
"def initialize (x, y, direction)\n\t\t@x = x\n\t\t@y = y\n\t\t@direction = direction\n\tend",
"def angle_to(a,b)\n a,b = *[a,b].map(&:to_np)\n d0,d1 = dist_from(a), a.dist_from(b)\n z = self.to(a,1+d1/d0)\n dz = z.dist_from(b)\n Math.asin(dz/2/d1)*2\n end",
"def angle_to(v)\n ret = Math.atan2(v.y, v.x) - Math.atan2(y, x)\n if ret > Math::PI\n ret -= 2*Math::PI\n end\n if ret < -Math::PI\n ret += 2*Math::PI\n end\n ret\n end",
"def angle_to(v)\n ret = Math.atan2(v.y, v.x) - Math.atan2(y, x)\n if ret > Math::PI\n ret -= 2*Math::PI\n end\n if ret < -Math::PI\n ret += 2*Math::PI\n end\n ret\n end",
"def initialize\n\t\t@is_blown = false\n\n\t\t@x = @y = @angle = 0\n\tend",
"def new_polar( angle_rad, magnitude )\n self.new( Math::cos(angle_rad)*magnitude,\n Math::sin(angle_rad)*magnitude )\n end",
"def initialize(location, orientation)\n @location = location\n @oritentation = orientation\n end",
"def antipodal\n Location.new(:longitude => 180 - (longitude.abs),\n :latitude => -latitude )\n end",
"def rotate(angle)\n primitive 'rotate ' + sprintf('%g', angle)\n end",
"def angle_equation_of_time() \r\n delta_orbit() + delta_oblique()\r\n end",
"def other_angle(a, b)\n 180 - (a + b)\nend",
"def initialize(options)\n if options.has_keys? [:norm, :orientation]\n @norm = options[:norm]\n case options[:orientation]\n when Science::Angle then @orientation = options[:orientation]\n else @orientation = options[:orientation].radians\n end\n calculate_components\n elsif options.has_keys? [:x, :y]\n @components = { x: options[:x], y: options[:y] }\n calculate_norm_and_orientation\n else\n raise InvalidArgumentsError, \"Options should contain :norm and :orientation or :x and :y.\"\n end\n end",
"def rotate(angle, *params)\n absolute_or_coord = params[0] || true\n mode_or_coord = params[1] || :degrees\n mode = params[2] || :degrees\n\n if absolute_or_coord.kind_of? Numeric\n raise TypeError(\"Second and third arguments should be numeric if using coordinates\") unless mode_or_coord.kind_of? Numeric\n if mode == :radians\n raise TypeError(\"#{angle} should be numeric if using with :radians mode\") unless angle.kind_of? Numeric\n angle = radians_to_degrees(angle)\n end\n @canvas << js_method('rotate', angle, absolute_or_coord, mode_or_coord)\n else\n if mode_or_coord == :radians\n raise TypeError(\"#{angle} should be numeric if using with :radians mode\") unless angle.kind_of? Numeric\n angle = radians_to_degrees(angle)\n end\n @canvas << js_method('rotate', angle, !!absolute_or_coord)\n end\n return self\n end",
"def other_angle(a, b)\n 180 - (a + b)\nend",
"def angle=(angle)\n c = @context__\n @view__.angle =\n c ? c.toAngle__(angle) : angle * Processing::GraphicsContext::RAD2DEG__\n angle\n end",
"def atan\n math :atan\n end",
"def initialize(x, y)\n @acceleration = PVector.new(0, 0)\n\n # This is a new PVector method not yet implemented in JS\n # @velocity = PVector.random2D();\n\n # Leaving the code temporarily this way so that this example runs in JS\n angle = random(TWO_PI)\n @velocity = PVector.new(cos(angle), sin(angle))\n\n @location = PVector.new(x, y)\n @r = 2.0\n @maxspeed = 2\n @maxforce = 0.03\n end",
"def rotate_around_origin(angle)\n sin_of_angle = Math.sin(angle)\n cos_of_angle = Math.cos(angle)\n\n Point.new(\n x * cos_of_angle - y * sin_of_angle,\n x * sin_of_angle + y * cos_of_angle\n )\n end",
"def initialize(xaxis, yaxis, direction)\n @xaxis = xaxis.to_i\n @yaxis = yaxis.to_i\n @direction = direction.to_s\n end",
"def rotate(n = 1)\n Orientation.new(ORIENTATIONS.index((@angle + n) % ORIENTATIONS.count))\n end",
"def angles\n [angle_a, angle_b, angle_c]\n end",
"def initialize dist, bearing\n dist, bearing = [bearing, dist] if bearing.kind_of? GeoDistance\n self.bearing = bearing\n self.distance = dist\n end",
"def update_angle(angle)\n\t\t@angle = angle\n\t\t@prawn.angle = angle\n\tend",
"def rotate(theta)\n new_x = Math::cos(theta) * @x - Math::sin(theta) * @y \n new_y = Math::sin(theta) * @x + Math::cos(theta) * @y\n BPoint.new(new_x, new_y)\n end",
"def to_radians\n self * Math::PI.fdiv(180)\n end",
"def rotate(theta)\n theta *= -1\n newx = @x * Math.cos(theta) - @y * Math.sin(theta)\n newy = @x * Math.sin(theta) + @y * Math.cos(theta)\n @x = newx\n @y = newy\n return self\n end",
"def calculate_orientation\n x, y = @components.values\n if x.pos? and y.zero?\n 0.deg\n elsif x.zero? and y.pos?\n 90.deg\n elsif x.neg? and y.zero?\n 180.deg\n elsif x.zero? and y.neg?\n 270.deg\n elsif x.pos? and y.pos?\n Math.atan( y/x ).rad # Will return an Angle object (with the property \"degrees\")\n elsif x.neg? and y.pos?\n angle = Math.atan( y/x.abs ).rad\n (180 - angle.deg).deg # Will return an Angle object (with the property \"degrees\")\n elsif x.neg? and y.neg?\n angle = Math.atan( y.abs/x.abs ).rad\n (180 + angle.deg).deg # Will return an Angle object (with the property \"degrees\")\n elsif x.pos? and y.neg?\n angle = Math.atan( y.abs/x ).rad\n (360 - angle.deg).deg\n end\n end",
"def radians\n self * 180 / Math::PI\n end",
"def atan\n Double.new(Math.atan(self.to_f))\n rescue Math::DomainError\n Double.new(::Float::NAN)\n end",
"def initialize(x_coord, y_coord, direction)\n\n @compass = [\"N\", \"E\", \"S\", \"W\"]\n @count = 0\n @x = x_coord\n @y = y_coord\n @d = direction\n @current_direction = @compass.index(@d)\n puts \"\\nThe initial position of the robot is #{@x}, #{@y}. It is facing the #{@d} direction.\"\n end",
"def rotate(angle, around_x=0, around_y=0, &rendering_code); end",
"def angle=(target)\n\n @target_angle = target.to_i\n\n end",
"def start_angle\n MSPhysics::Newton::Hinge.get_start_angle(@address)\n end",
"def initialize(radius)\n @radius = radius\n end",
"def calculate_radians\n if x_length == 0 || y_length == 0\n angle_to_start_of_quadrant\n else\n case angle_to_end_of_quadrant\n when DEGREES_90\n angle_ignoring_quadrant\n when DEGREES_180\n DEGREES_180 - angle_ignoring_quadrant\n when DEGREES_270\n DEGREES_180 + angle_ignoring_quadrant\n else\n DEGREES_360 - angle_ignoring_quadrant\n end\n end\n end",
"def set_rotation angle\n error(\n \"Passed argument `angle' needs to be an Integer or Float, but got\",\n \" #{angle.inspect}.#{angle.class.name}\"\n ) unless ([Integer, Float].include? angle.class)\n @rotation = angle\n handle_rotation_overflow\n end",
"def theta\n (@x == 0)? ((@y > 0)? @@pio2 : -@@pio2) : Math.atan2(@y,@x)\n end",
"def angle_to(point)\n Ubiquity::Geoformulas.angle self.lat, self.lon, point.lat, point.lon\n end",
"def initialize(x= 0, y = 0, orientation = 'N', options = {})\n options = {limits: [5, 5]}.merge options\n @facin_index = FACIN.index orientation\n @x, @y = x.to_i, y.to_i\n @top_x, @top_y = options[:limits]\n end",
"def _updateAngle\n\t\t\t\t@angle = (@maxAngle*@idxAngle) - Math::PIH\n\t\t\tend",
"def initialize(radius)\n @radius = radius\n end",
"def new_polar_deg( angle_deg, magnitude )\n self.new_polar( angle_deg * DEG_TO_RAD, magnitude )\n end",
"def initialize(x:, y:, facing:) # rubocop:disable Naming/MethodParameterName\n @x = x.to_i\n @y = y.to_i\n @facing = DIRECTIONS.index(facing) || facing.to_i % DIRECTIONS_SIZE\n end"
] |
[
"0.67836183",
"0.604015",
"0.60051924",
"0.5812162",
"0.5794369",
"0.57705545",
"0.5723011",
"0.5721475",
"0.57086426",
"0.56977314",
"0.5696677",
"0.5642626",
"0.55957353",
"0.55941373",
"0.5579113",
"0.55628693",
"0.5552162",
"0.55390257",
"0.5537195",
"0.5490472",
"0.5469588",
"0.5443051",
"0.5423936",
"0.5411678",
"0.5361683",
"0.53219163",
"0.531887",
"0.53163296",
"0.53122276",
"0.5282338",
"0.52759504",
"0.52711666",
"0.5257924",
"0.5250696",
"0.5244123",
"0.5208664",
"0.5208144",
"0.5195588",
"0.51890224",
"0.5187744",
"0.51812303",
"0.51624477",
"0.515733",
"0.51553166",
"0.5128274",
"0.5113582",
"0.51050836",
"0.50984395",
"0.5093063",
"0.5088964",
"0.5078498",
"0.5076334",
"0.505766",
"0.50448304",
"0.5031744",
"0.50251913",
"0.50223213",
"0.5020716",
"0.50103706",
"0.5002276",
"0.5002276",
"0.49983236",
"0.4985317",
"0.49819428",
"0.49558625",
"0.49498618",
"0.49314347",
"0.49261358",
"0.49245033",
"0.4922382",
"0.49217913",
"0.4906355",
"0.49061188",
"0.48956746",
"0.48868334",
"0.48746276",
"0.48717627",
"0.48710182",
"0.48694795",
"0.4856208",
"0.48514485",
"0.48345128",
"0.4831499",
"0.4829552",
"0.4827147",
"0.48228288",
"0.48218957",
"0.48185748",
"0.48122093",
"0.4811978",
"0.4788844",
"0.4781923",
"0.47799438",
"0.47741914",
"0.4769963",
"0.47687766",
"0.47654155",
"0.47562918",
"0.47503155",
"0.47461396"
] |
0.59488565
|
3
|
Returns the value of the angle (default unit: radians).
|
def to_f(unit = :radians)
case unit
when :degrees, :deg then @degrees
when :radians, :rad then @radians
else
raise InvalidArgumentsError, "Unit should be :degrees, :deg, :radians ord :rad."
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def angle\n @angle\n end",
"def angle_deg\n angle * RAD_TO_DEG\n end",
"def angle\n rad / Math::PI * 180\n end",
"def angle()\n a, c = @view__.angle, @context__\n c ? c.fromDegrees__(a) : a * Processing::GraphicsContext::DEG2RAD__\n end",
"def angle_of_specified_radius\n @angle_of_radius\n end",
"def angle\n v = to_vec\n if v[1] == 0.0\n nil\n else\n v.angle\n end\n end",
"def radians\n self * 180 / Math::PI\n end",
"def angle\n Math.atan2(@y, @x)\n end",
"def angle(path)\n io_for(path).angle\n end",
"def angle\n Math.atan2( @y, @x )\n end",
"def radians\n Science::Angle.new(self, :radians)\n end",
"def to_radians\n self * Math::PI.fdiv(180)\n end",
"def radian_angle\n @angle * Math::PI / 180.0\n end",
"def angle\n ns = norm\n x_ = @x / ns\n y_ = @y / ns\n\n Math.atan2(x_, y_)\n end",
"def degrees\n self * Math::PI / 180\n end",
"def degrees\n self * Math::PI / 180.0\n end",
"def radians(deg)\n deg * Math::PI / 180\n end",
"def to_degrees\n self / Math::PI.fdiv(180)\n end",
"def theta_deg\n theta_rad / DEG2RAD\n end",
"def convert_to_radians(degrees)\n degrees * PI / 180\nend",
"def to_radians(deg)\n deg * Math::PI / 180\n end",
"def format_angle(value, unit)\n if unit == :degree\n value + '°'\n else\n value + ' gon'\n end\n end",
"def to_rad\n self * Math::PI / 180\n end",
"def rad2deg\n self * (180/Math::PI)\n end",
"def gradians\n self * Math::PI / 200.0\n end",
"def convDegRad(value)\n unless value.nil? or value == 0\n value = (value/180) * Math::PI\n end\n return value\n end",
"def to_rad(angle)\n angle * Math::PI / 180\n end",
"def deg2rad\n self * (Math::PI/180)\n end",
"def radians(deg)\n deg * DEG_TO_RAD\n end",
"def convDegRad(value)\n unless value.nil? or value == 0\n value = (value/180) * Math::PI\n end\n return value\n end",
"def angle(*args)\n Math.acos(self.dot(*args))\n end",
"def atan\n math :atan\n end",
"def to_radians(mod = false)\n if mod\n (self * Math::PI / 180) % Math::PI\n else\n self * Math::PI / 180\n end\n end",
"def calculate_radians\n if x_length == 0 || y_length == 0\n angle_to_start_of_quadrant\n else\n case angle_to_end_of_quadrant\n when DEGREES_90\n angle_ignoring_quadrant\n when DEGREES_180\n DEGREES_180 - angle_ignoring_quadrant\n when DEGREES_270\n DEGREES_180 + angle_ignoring_quadrant\n else\n DEGREES_360 - angle_ignoring_quadrant\n end\n end\n end",
"def degrees\n self\n end",
"def angle_a\n Angle.new(\n self,\n :a,\n (\n (\n Math.acos((b**2 + c**2 - a**2) / (2.0 * b * c)) * 180\n ) / Math::PI\n )\n )\n end",
"def angle\r\n self.data.map(&:angle)\r\n end",
"def anglecw\n 360 - angle\n end",
"def to_radians(degrees)\n degrees * (Math::PI / 180)\n end",
"def convertToRadians(val)\n return val * PIx / 180\n end",
"def convertToRadians(val)\n return val * PIx / 180\n end",
"def degrees_to_radians degrees\n # The :: operator is much like the scope\n # resolution operator in C++\n degrees * Math::PI / 180.0\nend",
"def to_radians(n)\n r = n * (Math::PI / 180)\n return r\n end",
"def deg2rad(angle)\n angle * (Math::PI / 180.0)\n end",
"def angle_deg_with( vector )\n angle_with(vector) * RAD_TO_DEG\n end",
"def deg2rad(deg) \r\nreturn (deg * $pi / 180);\r\nend",
"def angle_with( vector )\n Math.acos( max(min(udot(vector),MAX_UDOT_PRODUCT), MIN_UDOT_PRODUCT) )\n end",
"def angle_rads \n\t\t\t2.0 * Math.atan2( self.vec.mag, self.scalar ) \n\t\tend",
"def angle_deg=( angle_deg )\n self.angle = angle_deg * DEG_TO_RAD\n self\n end",
"def to_radians(mod = false)\n return self.to_dec_degrees.to_radians(mod)\n end",
"def angle_c\n Angle.new(\n self,\n :c,\n (\n (\n Math.acos((a**2 + b**2 - c**2) / (2.0 * a * b)) * 180\n ) / Math::PI\n )\n )\n end",
"def other_angle(a, b)\n 180 - (a + b)\nend",
"def to_degrees(radians)\n (radians * 180.0) / Math::PI\n end",
"def angle(p)\n Math.atan2(p.y - self.y, p.x - self.x)\n end",
"def rad\n x = self[0]\n y = self[1]\n if x >= 0 && y >= 0\n Math.atan( y.to_f/x )\n elsif x < 0 && y >= 0\n Math::PI + Math.atan( y.to_f/x )\n elsif x < 0 && y < 0\n Math::PI + Math.atan( y.to_f/x )\n else\n 2*Math::PI + Math.atan( y.to_f/x )\n end\n end",
"def other_angle(a, b)\n 180 - (a + b)\nend",
"def conv_deg_rad(value)\n (value/180) * Math::PI unless value.nil? or value == 0\nend",
"def conv_deg_rad(value)\n (value/180) * Math::PI unless value.nil? or value == 0\nend",
"def toRadians(degree)\n return degree*Math::PI/180\nend",
"def degrees_to_radians(degrees)\n degrees * DEG_TO_RAD\n end",
"def degree; end",
"def atan\n Double.new(Math.atan(self.to_f))\n rescue Math::DomainError\n Double.new(::Float::NAN)\n end",
"def to_degs\n self * (180 / Math::PI)\n end",
"def angular_velocity_rad_s\n 2 * PI / period_s\n end",
"def to_s\n \"atan(#{@x})\"\n end",
"def determine_angle(angle, range)\n range.include?(angle) ? angle.to_f : angle.divmod(MAX_DEGREE_RANGE).last\nend",
"def degree_to_radian(d)\n d * DEG2RAD\n end",
"def theta\n (@x == 0)? ((@y > 0)? @@pio2 : -@@pio2) : Math.atan2(@y,@x)\n end",
"def degreToRadian( degree )\n return degree * RADIAN_TO_DEGREE\n end",
"def angle(current, percent)\n\n range = Quadrant.angle_range_for(@bounds.quadrant(current))\n interp = Interpolate::Points.new({\n 0 => range.begin,\n 1 => range.end\n })\n\n interp.at(percent).to_i % 360\n end",
"def deg_to_rad(deg)\n return (2 * Math::PI) * deg / 360\n end",
"def degree\n self.in_degree + self.out_degree\n end",
"def atan(x)\n atan_base(num_class[x])\n end",
"def norm_angle(angle)\n while angle < 0; angle += Const::PI2; end\n while angle > Const::PI2; angle -= Const::PI2; end\n return angle\n rescue => e\n raise\n end",
"def deg2rad(deg)\n deg*Math::PI/180\n end",
"def angle_b\n Angle.new(\n self,\n :b,\n (\n (\n Math.acos((a**2 + c**2 - b**2) / (2.0 * a * c)) * 180\n ) / Math::PI\n )\n )\n end",
"def /(other)\n return self.class.radians(@angle / other)\n end",
"def to_degrees(mod = false)\n return self.to_f.to_degrees(mod)\n end",
"def calculate_orientation\n x, y = @components.values\n if x.pos? and y.zero?\n 0.deg\n elsif x.zero? and y.pos?\n 90.deg\n elsif x.neg? and y.zero?\n 180.deg\n elsif x.zero? and y.neg?\n 270.deg\n elsif x.pos? and y.pos?\n Math.atan( y/x ).rad # Will return an Angle object (with the property \"degrees\")\n elsif x.neg? and y.pos?\n angle = Math.atan( y/x.abs ).rad\n (180 - angle.deg).deg # Will return an Angle object (with the property \"degrees\")\n elsif x.neg? and y.neg?\n angle = Math.atan( y.abs/x.abs ).rad\n (180 + angle.deg).deg # Will return an Angle object (with the property \"degrees\")\n elsif x.pos? and y.neg?\n angle = Math.atan( y.abs/x ).rad\n (360 - angle.deg).deg\n end\n end",
"def angle=(target)\n\n @target_angle = target.to_i\n\n end",
"def angle=(angle)\n c = @context__\n @view__.angle =\n c ? c.toAngle__(angle) : angle * Processing::GraphicsContext::RAD2DEG__\n angle\n end",
"def deg_to_rads(deg)\n deg * Math::PI / 180.0\n end",
"def safe_angle(angle)\n if angle < @angle_range.min\n @angle_range.min\n elsif angle > @angle_range.max\n @angle_range.max\n else\n angle\n end\n end",
"def cur_angle\n MSPhysics::Newton::Corkscrew.get_cur_angle(@address)\n end",
"def angle(other)\n\n # Two options here:\n #\n # 1. Math.atan2(other.cross_length(self), dot(other)) \n #\n # This is stable but slower (x 1.5)\n #\n # 2. Math.acos(dot(other) / (r * other.r)) \n #\n # This is faster but unstable around 0 and pi where the gradient of acos approaches \n # infinity. An alternative way to view this is that the gradient of cos approaches\n # zero and small differences in angle can be indistinguishable at some number of \n # decimal places.\n #\n \n # Math.acos(dot(other) / (r * other.r)) \n Math.atan2(other.cross_length(self), dot(other)) \n end",
"def polar\n theta = 0.0\n if Point.close_to(self.x, 0)\n if self.y > 0\n theta = 90.0\n elsif self.y < 0\n theta = 270.0\n end\n else\n theta = Point.rad2deg(Math.atan(self.y/self.x))\n if self.x < 0.0\n theta += 180.0\n end\n if theta < 0.0\n theta += 360.0\n end\n end\n theta\n end",
"def calc_angle(hours, minutes)\n angel = (minutes * 6 - (hours * 60 + minutes) * 0.5).abs\n if angel > 180\n 360 - angel.abs\n else\n angel.abs\n end\nend",
"def degrees\n\t\t@degrees ||= cardinal.keys.sort + [360.0]\n\tend",
"def to_decimal_degree\n return @degree + (@arcminute + (@arcsecond.fdiv(60))).fdiv(60)\n end",
"def map_direction_to_angle(dir)\n return $direction_map[dir]\nend",
"def angle_equation_of_time() \r\n delta_orbit() + delta_oblique()\r\n end",
"def angle(x1, y1, x2, y2)\n end",
"def angle_to(v)\n ret = Math.atan2(v.y, v.x) - Math.atan2(y, x)\n if ret > Math::PI\n ret -= 2*Math::PI\n end\n if ret < -Math::PI\n ret += 2*Math::PI\n end\n ret\n end",
"def angle_to(v)\n ret = Math.atan2(v.y, v.x) - Math.atan2(y, x)\n if ret > Math::PI\n ret -= 2*Math::PI\n end\n if ret < -Math::PI\n ret += 2*Math::PI\n end\n ret\n end",
"def angle_at(point)\n Point.angle(centre, point)\n end",
"def getAngleAxis\n angle = 2*Math.acos(@beta0)\n \n # if sin(theta/2) = 0, then theta = 2*n*PI, where n is any integer,\n # which means that the object has performed a complete rotation, and\n # any axis will do\n if Math.sin(angle/2).abs() < 1e-15\n axis = Vector[1, 0, 0]\n else\n axis = @beta_s / Math.sin(angle/2)\n end\n return angle, axis\n end",
"def to_code\n \"Math::atan(#{@x.to_code})\"\n end",
"def f(unit)\n x = (unit / ::Math.cos(angle_radians)).abs\n y = (unit / ::Math.sin(angle_radians)).abs\n\n operator =\n if (@angle % 360).zero? || (@angle % 270).zero?\n :+\n else\n :-\n end\n\n @x = @x.send(operator, x) if !x.infinite? && x.abs <= unit\n @y = @y.send(operator, y) if !y.infinite? && y.abs <= unit\n end",
"def min_angle\n 6 * self.min\n end",
"def to_s(unit = :radians)\n case unit\n when :degrees, :deg then \"#{@degrees}°\"\n when :radians, :rad then \"#@radians rad\"\n else\n raise InvalidArgumentsError, \"Unit should be :degrees, :deg, :radians ord :rad.\"\n end\n end",
"def cur_angle\n MSPhysics::Newton::Hinge.get_cur_angle(@address)\n end"
] |
[
"0.7752398",
"0.76539093",
"0.763003",
"0.75645053",
"0.73539823",
"0.72630644",
"0.720393",
"0.7139845",
"0.70931804",
"0.70875067",
"0.70855814",
"0.70381397",
"0.70200324",
"0.6990044",
"0.69408244",
"0.68078065",
"0.6799878",
"0.67603284",
"0.6564051",
"0.6561205",
"0.65528584",
"0.6544943",
"0.6502911",
"0.6486122",
"0.64606816",
"0.6449834",
"0.64497876",
"0.6438758",
"0.64169",
"0.6379412",
"0.63442063",
"0.6339515",
"0.63169414",
"0.6306255",
"0.630416",
"0.6304052",
"0.6296054",
"0.62871516",
"0.6279452",
"0.6249582",
"0.6249582",
"0.62360877",
"0.620432",
"0.61827075",
"0.6161982",
"0.6145711",
"0.61422086",
"0.6126903",
"0.6126387",
"0.61170316",
"0.6087402",
"0.60852355",
"0.607465",
"0.6066601",
"0.6064319",
"0.605598",
"0.6051103",
"0.6051103",
"0.60216784",
"0.602131",
"0.5990213",
"0.5985906",
"0.59683305",
"0.59474987",
"0.5915744",
"0.58998394",
"0.5880038",
"0.5870863",
"0.5837612",
"0.58372223",
"0.58264375",
"0.5824071",
"0.5822109",
"0.58167773",
"0.5816486",
"0.58017844",
"0.58006626",
"0.58000857",
"0.57896364",
"0.57819104",
"0.57660824",
"0.5762093",
"0.5756489",
"0.5753872",
"0.5752118",
"0.5751424",
"0.574656",
"0.57455313",
"0.57379264",
"0.5734426",
"0.573382",
"0.57306695",
"0.5717464",
"0.5717464",
"0.5699237",
"0.56991965",
"0.5678935",
"0.56697613",
"0.56686664",
"0.5661775",
"0.5659493"
] |
0.0
|
-1
|
Returns the string representation of the angle (default unit: radians).
|
def to_s(unit = :radians)
case unit
when :degrees, :deg then "#{@degrees}°"
when :radians, :rad then "#@radians rad"
else
raise InvalidArgumentsError, "Unit should be :degrees, :deg, :radians ord :rad."
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def format_angle(value, unit)\n if unit == :degree\n value + '°'\n else\n value + ' gon'\n end\n end",
"def to_s\n \"#{@degrees.round(2)} #{@scale}\"\n end",
"def angle_deg\n angle * RAD_TO_DEG\n end",
"def to_s(angle_unit = :degrees)\n string = <<EOS\nVector :\n- x = #{x}\n- y = #{y}\n- norm = #{norm}\n- orientation = #{orientation.to_s(angle_unit)}\nEOS\n string\n end",
"def to_s\n \"atan(#{@x})\"\n end",
"def to_s\n return \"atan(#{self.arg.to_s})\"\n end",
"def angle\n rad / Math::PI * 180\n end",
"def toString\n\t\t\t\"#{@degrees.round(2)} #{@scale}\"\n\t\tend",
"def angle\n @angle\n end",
"def to_s\n return \"acos(#{self.arg.to_s})\"\n end",
"def to_s\n \"[#{@pos_x}, #{@pos_y}, #{@angle}]\"\n end",
"def angle(path)\n io_for(path).angle\n end",
"def angle()\n a, c = @view__.angle, @context__\n c ? c.fromDegrees__(a) : a * Processing::GraphicsContext::DEG2RAD__\n end",
"def to_s\n value = self.real\n if ℤ.∋?(value)\n value = value.to_i.to_s\n else\n value = value.to_s\n end\n case(self.repr)\n when 3\n \"#{value}ʳθ\"\n when 4\n \"#{value}°θ\"\n when 5\n \"#{value}𝞽θ\"\n when 6\n \"#{value}ᵍθ\"\n else\n 🛑 RuntimeError.new(\"| c{ThetaAngle}-> m{to_s} w/ self{#{self.to_s}} val{#{self.real.to_s}} repr{#{self.repr.to_s}} had an unrecognized representation value |\")\n end\n end",
"def to_s\n \"acos(#{@x})\"\n end",
"def angle_of_specified_radius\n @angle_of_radius\n end",
"def angle\n v = to_vec\n if v[1] == 0.0\n nil\n else\n v.angle\n end\n end",
"def to_degrees\n self / Math::PI.fdiv(180)\n end",
"def rad2deg\n self * (180/Math::PI)\n end",
"def to_s\n \"#{@x} #{@y} #{@orientation}\"\n end",
"def to_radians\n self * Math::PI.fdiv(180)\n end",
"def to_rad(angle)\n angle * Math::PI / 180\n end",
"def radians\n Science::Angle.new(self, :radians)\n end",
"def radian_angle\n @angle * Math::PI / 180.0\n end",
"def rotate(angle)\n primitive 'rotate ' + sprintf('%g', angle)\n end",
"def radians\n self * 180 / Math::PI\n end",
"def get_orientation_string()\n case self.orientation\n when 0\n return \"East\"\n when 90\n return \"South\"\n when 180\n return \"West\"\n when 270\n return \"North\"\n else\n return \"Invalid\" # If the robot orientation is not included in [0 90 180 270] the orientation is invalid\n end\n end",
"def degrees\n self * Math::PI / 180\n end",
"def to_code\n \"Math::atan(#{@x.to_code})\"\n end",
"def dms(num)\n angle_str = %()\n num_ary = num.to_s.partition('.')\n \n #degree\n \n angle_str << (num_ary[0] + DEGREE)\n \n minutes_seconds_ary = ((num_ary[-1].to_f * 60.0) / 10**(num_ary[-1].size).to_f).to_s.partition('.')\n \n #minutes\n \n if minutes_seconds_ary[0].size <= 1\n angle_str << ('0' + minutes_seconds_ary[0] + \"'\")\n else\n angle_str << minutes_seconds_ary[0] + \"'\"\n end\n \n # seconds\n \n seconds = ((minutes_seconds_ary[-1].to_f * 60)/(10**(minutes_seconds_ary[-1].size))).round.to_s\n \n if seconds.size <= 1\n angle_str << ('0' + seconds)\n else\n angle_str << seconds\n end\n \n angle_str + %(\"\\\"\")\nend",
"def theta_deg\n theta_rad / DEG2RAD\n end",
"def radians(deg)\n deg * Math::PI / 180\n end",
"def to_radians(deg)\n deg * Math::PI / 180\n end",
"def deg2rad(angle)\n angle * (Math::PI / 180.0)\n end",
"def to_s(fmt = nil)\n if fmt\n # needs work to include distance as well as angle fmt.\n return \"#{@bearing.strf(fmt)} #{distance.round(4)}m\"\n else\n return \"#{@bearing.strf} #{distance.round(4)}m\"\n end\n end",
"def to_degs\n self * (180 / Math::PI)\n end",
"def degrees\n self * Math::PI / 180.0\n end",
"def full_name_degree\n if degree\n \"#{name}, #{degree}°\"\n else\n \"#{name}\"\n end\n end",
"def angle\n ns = norm\n x_ = @x / ns\n y_ = @y / ns\n\n Math.atan2(x_, y_)\n end",
"def to_s\n \"tan(#{@x})\"\n end",
"def to_s\n \"#{@numerador}/#{@denominador}\"\n end",
"def angle\n Math.atan2(@y, @x)\n end",
"def deg2rad\n self * (Math::PI/180)\n end",
"def to_code\n \"Math::acos(#{@x.to_code})\"\n end",
"def to_s\r\n \"Area west_lon_degree: #{self.west_lon_degree}, south_lat_degree: #{self.south_lat_degree}, east_lon_degree: #{self.east_lon_degree}, north_lat_degree: #{self.north_lat_degree}\"\r\n end",
"def to_rad\n self * Math::PI / 180\n end",
"def angle\n Math.atan2( @y, @x )\n end",
"def to_s\n \"cos(#{@x})\"\n end",
"def convert_to_radians(degrees)\n degrees * PI / 180\nend",
"def toString\n sprintf('%6.2f', @value) + \" \" + @unit\n end",
"def deg_to_rads(deg)\n deg * Math::PI / 180.0\n end",
"def to_degrees(radians)\n (radians * 180.0) / Math::PI\n end",
"def to_radians(degrees)\n degrees * (Math::PI / 180)\n end",
"def deg2rad(deg) \r\nreturn (deg * $pi / 180);\r\nend",
"def to_s\n return @magnitude.to_s if magnitude?\n u_descr = Units.units_descr(@units)\n \"#{@magnitude}*#{u_descr}\"\n end",
"def radians(deg)\n deg * DEG_TO_RAD\n end",
"def output\r\n (self.myDegrees.to_f).to_s + \" \" + self.myScale.to_s\r\n end",
"def to_radians(n)\n r = n * (Math::PI / 180)\n return r\n end",
"def to_s\n \n \"#{@n}/#{@d}\" \n end",
"def to_s\n \"asin(#{@x})\"\n end",
"def to_s\n inflection_diffs = [-swath_width_rad / 2, 0, swath_width_rad / 2]\n inflections = inflection_diffs.map {|d| ((max_orbit_phi + d) * 180 / PI).round(3)}\n\n \"Orbit with inflections #{inflections.inspect}\"\n end",
"def to_s\n return \"cos(#{self.arg.to_s})\"\n end",
"def to_s \n return \"%s/%s\" % [@num.to_s, @den.to_s]\n end",
"def angle(*args)\n Math.acos(self.dot(*args))\n end",
"def to_s\n @string_value ||= calculate_roman_numeral\n end",
"def deg2rad(deg)\n deg*Math::PI/180\n end",
"def to_s(io = nil)\n if io\n __io_append(io, @numerator, DIV_ID, @denominator)\n else\n return \"#{@numerator}/#{@denominator}\"\n end\n io\n end",
"def to_s\n return \"tan(#{self.arg.to_s})\"\n end",
"def angle_a\n Angle.new(\n self,\n :a,\n (\n (\n Math.acos((b**2 + c**2 - a**2) / (2.0 * b * c)) * 180\n ) / Math::PI\n )\n )\n end",
"def to_s\r\n \"Quaternion: axis: x #{axis.x} y #{axis.y} z #{axis.z} real #{real}\"\r\n end",
"def to_b\n return \"Math::acos(#{self.arg.to_b})\"\n end",
"def to_s \n\tputs \"#{@num}/#{@denom}\"\n end",
"def degrees\n self\n end",
"def to_s\n return \"asin(#{self.arg.to_s})\"\n end",
"def gradians\n self * Math::PI / 200.0\n end",
"def angle_deg_with( vector )\n angle_with(vector) * RAD_TO_DEG\n end",
"def unit_s\n self.unit.to_s if self.unit\n end",
"def other_angle(a, b)\n 180 - (a + b)\nend",
"def rad_to_deg(rad)\n return 360 * rad / (2 * Math::PI)\n end",
"def to_rad(n_decimals = nil)\n include Math unless defined?(Math)\n radians = self * PI / 180.0\n return radians if n_decimals.nil?\n radians.round(n_decimals)\n end",
"def other_angle(a, b)\n 180 - (a + b)\nend",
"def to_s\n\t\t\"#{@x}, #{@y}, #{@direction}\"\n\tend",
"def calculate_radians\n if x_length == 0 || y_length == 0\n angle_to_start_of_quadrant\n else\n case angle_to_end_of_quadrant\n when DEGREES_90\n angle_ignoring_quadrant\n when DEGREES_180\n DEGREES_180 - angle_ignoring_quadrant\n when DEGREES_270\n DEGREES_180 + angle_ignoring_quadrant\n else\n DEGREES_360 - angle_ignoring_quadrant\n end\n end\n end",
"def to_radians(mod = false)\n return self.to_dec_degrees.to_radians(mod)\n end",
"def degrees_to_radians(degrees)\n degrees * DEG_TO_RAD\n end",
"def angle_rads \n\t\t\t2.0 * Math.atan2( self.vec.mag, self.scalar ) \n\t\tend",
"def to_s\n @unit.s_for(value)\n end",
"def degree; end",
"def calculate_orientation\n x, y = @components.values\n if x.pos? and y.zero?\n 0.deg\n elsif x.zero? and y.pos?\n 90.deg\n elsif x.neg? and y.zero?\n 180.deg\n elsif x.zero? and y.neg?\n 270.deg\n elsif x.pos? and y.pos?\n Math.atan( y/x ).rad # Will return an Angle object (with the property \"degrees\")\n elsif x.neg? and y.pos?\n angle = Math.atan( y/x.abs ).rad\n (180 - angle.deg).deg # Will return an Angle object (with the property \"degrees\")\n elsif x.neg? and y.neg?\n angle = Math.atan( y.abs/x.abs ).rad\n (180 + angle.deg).deg # Will return an Angle object (with the property \"degrees\")\n elsif x.pos? and y.neg?\n angle = Math.atan( y.abs/x ).rad\n (360 - angle.deg).deg\n end\n end",
"def deg_to_rad(deg)\n return (2 * Math::PI) * deg / 360\n end",
"def angular_velocity_rad_s\n 2 * PI / period_s\n end",
"def to_degrees(mod = false)\n return self.to_f.to_degrees(mod)\n end",
"def atan\n math :atan\n end",
"def to_s\n\t\treturn \"#@num/#@den\"\n\tend",
"def to_s # :nodoc:\n \"#{ self.lattitude },#{ self.longitude } #{ self.radius }\"\n end",
"def to_s\n circle.to_s\n end",
"def angle\r\n self.data.map(&:angle)\r\n end",
"def angle_c\n Angle.new(\n self,\n :c,\n (\n (\n Math.acos((a**2 + b**2 - c**2) / (2.0 * a * b)) * 180\n ) / Math::PI\n )\n )\n end",
"def convDegRad(value)\n unless value.nil? or value == 0\n value = (value/180) * Math::PI\n end\n return value\n end",
"def to_radians(mod = false)\n if mod\n (self * Math::PI / 180) % Math::PI\n else\n self * Math::PI / 180\n end\n end"
] |
[
"0.75823575",
"0.72691846",
"0.7002912",
"0.6994467",
"0.6843078",
"0.6805929",
"0.67732173",
"0.67571175",
"0.6685982",
"0.6598627",
"0.65901154",
"0.6551482",
"0.6514853",
"0.64941305",
"0.64688224",
"0.6359093",
"0.62246895",
"0.62061405",
"0.62038636",
"0.62018436",
"0.6195743",
"0.6172171",
"0.6156764",
"0.6152832",
"0.61151373",
"0.61093956",
"0.6109302",
"0.6103453",
"0.61005145",
"0.6051265",
"0.60359824",
"0.6012722",
"0.5944083",
"0.59436506",
"0.59414214",
"0.5934594",
"0.5934298",
"0.5932944",
"0.5914938",
"0.59048516",
"0.59030986",
"0.5901814",
"0.5899196",
"0.58622044",
"0.5816336",
"0.58043176",
"0.57988644",
"0.5758928",
"0.5747537",
"0.57396954",
"0.5738356",
"0.5737459",
"0.57284105",
"0.57018304",
"0.56915414",
"0.56723887",
"0.56580126",
"0.5650258",
"0.56407994",
"0.56360745",
"0.56341684",
"0.56292844",
"0.56206924",
"0.56043094",
"0.5601878",
"0.5597715",
"0.5577857",
"0.5573268",
"0.55532897",
"0.55518764",
"0.55499756",
"0.5544797",
"0.55407",
"0.5532963",
"0.55315435",
"0.55288684",
"0.5525939",
"0.5525586",
"0.5525407",
"0.55062026",
"0.5503234",
"0.5499574",
"0.54992324",
"0.54929304",
"0.54699904",
"0.5468694",
"0.5462676",
"0.5454417",
"0.54515016",
"0.5451185",
"0.5444239",
"0.5442254",
"0.54409117",
"0.54339814",
"0.543363",
"0.54290175",
"0.54289633",
"0.5409815",
"0.5402516",
"0.5398274"
] |
0.7584844
|
0
|
Normalize the angle (in degrees) and converts it in radians.
|
def convert_and_normalize_degrees(angle)
@degrees = normalize_angle(angle, 360)
@radians = deg_to_rad(@degrees)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def convert_and_normalize_radians(angle)\n @radians = normalize_angle(angle, (2 * Math::PI))\n @degrees = rad_to_deg(@radians)\n end",
"def norm_angle(angle)\n while angle < 0; angle += Const::PI2; end\n while angle > Const::PI2; angle -= Const::PI2; end\n return angle\n rescue => e\n raise\n end",
"def to_rad(angle)\n angle * Math::PI / 180\n end",
"def deg2rad(angle)\n angle * (Math::PI / 180.0)\n end",
"def angle\n rad / Math::PI * 180\n end",
"def convert_to_radians(degrees)\n degrees * PI / 180\nend",
"def angle\n ns = norm\n x_ = @x / ns\n y_ = @y / ns\n\n Math.atan2(x_, y_)\n end",
"def to_radians\n self * Math::PI.fdiv(180)\n end",
"def to_rad\n self * Math::PI / 180\n end",
"def to_radians(mod = false)\n if mod\n (self * Math::PI / 180) % Math::PI\n else\n self * Math::PI / 180\n end\n end",
"def deg2rad\n self * (Math::PI/180)\n end",
"def radian_angle\n @angle * Math::PI / 180.0\n end",
"def angle_rads \n\t\t\t2.0 * Math.atan2( self.vec.mag, self.scalar ) \n\t\tend",
"def to_radians(mod = false)\n return self.to_dec_degrees.to_radians(mod)\n end",
"def normalize_bearing(angle)\n \t return ((angle + Math::PI) % (2 * Math::PI)) - Math::PI\n \tend",
"def angle_deg\n angle * RAD_TO_DEG\n end",
"def to_radians(n)\n r = n * (Math::PI / 180)\n return r\n end",
"def to_radians(degrees)\n degrees * (Math::PI / 180)\n end",
"def to_radians(deg)\n deg * Math::PI / 180\n end",
"def rad\n x = self[0]\n y = self[1]\n if x >= 0 && y >= 0\n Math.atan( y.to_f/x )\n elsif x < 0 && y >= 0\n Math::PI + Math.atan( y.to_f/x )\n elsif x < 0 && y < 0\n Math::PI + Math.atan( y.to_f/x )\n else\n 2*Math::PI + Math.atan( y.to_f/x )\n end\n end",
"def angle()\n a, c = @view__.angle, @context__\n c ? c.fromDegrees__(a) : a * Processing::GraphicsContext::DEG2RAD__\n end",
"def angle\n v = to_vec\n if v[1] == 0.0\n nil\n else\n v.angle\n end\n end",
"def radians\n self * 180 / Math::PI\n end",
"def calculate_radians\n if x_length == 0 || y_length == 0\n angle_to_start_of_quadrant\n else\n case angle_to_end_of_quadrant\n when DEGREES_90\n angle_ignoring_quadrant\n when DEGREES_180\n DEGREES_180 - angle_ignoring_quadrant\n when DEGREES_270\n DEGREES_180 + angle_ignoring_quadrant\n else\n DEGREES_360 - angle_ignoring_quadrant\n end\n end\n end",
"def degrees_to_radians(degrees)\n degrees * DEG_TO_RAD\n end",
"def deg2rad(deg) \r\nreturn (deg * $pi / 180);\r\nend",
"def convertToRadians(val)\n return val * PIx / 180\n end",
"def convertToRadians(val)\n return val * PIx / 180\n end",
"def deg_to_rads(deg)\n deg * Math::PI / 180.0\n end",
"def convDegRad(value)\n unless value.nil? or value == 0\n value = (value/180) * Math::PI\n end\n return value\n end",
"def angle\n @angle\n end",
"def rad2deg\n self * (180/Math::PI)\n end",
"def to_degrees\n self / Math::PI.fdiv(180)\n end",
"def convDegRad(value)\n unless value.nil? or value == 0\n value = (value/180) * Math::PI\n end\n return value\n end",
"def radians\n Science::Angle.new(self, :radians)\n end",
"def deg2rad(deg)\n deg*Math::PI/180\n end",
"def conv_deg_rad(value)\n (value/180) * Math::PI unless value.nil? or value == 0\nend",
"def conv_deg_rad(value)\n (value/180) * Math::PI unless value.nil? or value == 0\nend",
"def angle\n Math.atan2(@y, @x)\n end",
"def degrees_to_radians degrees\n # The :: operator is much like the scope\n # resolution operator in C++\n degrees * Math::PI / 180.0\nend",
"def to_degrees(radians)\n (radians * 180.0) / Math::PI\n end",
"def angle\n Math.atan2( @y, @x )\n end",
"def radians(deg)\n deg * Math::PI / 180\n end",
"def angle_of_specified_radius\n @angle_of_radius\n end",
"def deg_to_rad(deg)\n return (2 * Math::PI) * deg / 360\n end",
"def to_rad(n_decimals = nil)\n include Math unless defined?(Math)\n radians = self * PI / 180.0\n return radians if n_decimals.nil?\n radians.round(n_decimals)\n end",
"def sec_to_rad(x)\n x*Math::PI/(180*3600)\n end",
"def angle(path)\n io_for(path).angle\n end",
"def angle(*args)\n Math.acos(self.dot(*args))\n end",
"def normalize_heading(angle)\n \t return angle % (2 * Math::PI)\n \tend",
"def rad2rad(rad)\r\n remt(rad, PI2)\r\n end",
"def degree_to_radian(d)\n d * DEG2RAD\n end",
"def grados2radianes(alfa)\n\t\treturn ((alfa*Math::PI)/180)\n\tend",
"def angle_with( vector )\n Math.acos( max(min(udot(vector),MAX_UDOT_PRODUCT), MIN_UDOT_PRODUCT) )\n end",
"def angle_a\n Angle.new(\n self,\n :a,\n (\n (\n Math.acos((b**2 + c**2 - a**2) / (2.0 * b * c)) * 180\n ) / Math::PI\n )\n )\n end",
"def calculate_rad_angle_between(target)\n Math.atan2(target.y - y, target.x - x)\n end",
"def reduce_angle(a)\n modtwopi(a)\n end",
"def radians(deg)\n deg * DEG_TO_RAD\n end",
"def /(other)\n return self.class.radians(@angle / other)\n end",
"def to_radians(coordinates)\n coordinates.to_f * (Math::PI / 180)\n end",
"def degreToRadian( degree )\n return degree * RADIAN_TO_DEGREE\n end",
"def angle_to(v)\n ret = Math.atan2(v.y, v.x) - Math.atan2(y, x)\n if ret > Math::PI\n ret -= 2*Math::PI\n end\n if ret < -Math::PI\n ret += 2*Math::PI\n end\n ret\n end",
"def angle_to(v)\n ret = Math.atan2(v.y, v.x) - Math.atan2(y, x)\n if ret > Math::PI\n ret -= 2*Math::PI\n end\n if ret < -Math::PI\n ret += 2*Math::PI\n end\n ret\n end",
"def safe_angle(angle)\n if angle < @angle_range.min\n @angle_range.min\n elsif angle > @angle_range.max\n @angle_range.max\n else\n angle\n end\n end",
"def toRadians(degree)\n return degree*Math::PI/180\nend",
"def angle_direction(a,b)\n magnitude = angle_difference(a,b)\n if angle_difference(a + 1, b) < magnitude\n magnitude\n else\n -magnitude\n end\n end",
"def declination_rad\n if @declination_rad.nil?\n @declination_rad = inclination_rad - PI / 2\n @declination_rad -= PI / 2 while @declination_rad > PI / 2\n end\n @declination_rad\n end",
"def degrees\n self * Math::PI / 180\n end",
"def angle(vector1,vector2)\n\n small = 0.00000001\n undefined = 999999.1\n\n magnitudevector1 = magnitude(vector1)\n magnitudevector2 = magnitude(vector2)\n if (magnitudevector1*magnitudevector2) > (small**2)\n aux = vdot(vector1,vector2)/(magnitudevector1*magnitudevector2)\n if aux.abs> 1.0\n aux = signal(aux) * 1.0\n end\n return Math.acos(aux)\n else\n return undefined\n end\n end",
"def angle(other)\n\n # Two options here:\n #\n # 1. Math.atan2(other.cross_length(self), dot(other)) \n #\n # This is stable but slower (x 1.5)\n #\n # 2. Math.acos(dot(other) / (r * other.r)) \n #\n # This is faster but unstable around 0 and pi where the gradient of acos approaches \n # infinity. An alternative way to view this is that the gradient of cos approaches\n # zero and small differences in angle can be indistinguishable at some number of \n # decimal places.\n #\n \n # Math.acos(dot(other) / (r * other.r)) \n Math.atan2(other.cross_length(self), dot(other)) \n end",
"def angle_to(a,b)\n a,b = *[a,b].map(&:to_np)\n d0,d1 = dist_from(a), a.dist_from(b)\n z = self.to(a,1+d1/d0)\n dz = z.dist_from(b)\n Math.asin(dz/2/d1)*2\n end",
"def normalize_longitude(longitude)\n while (longitude < -180) do\n longitude += 360\n end\n\n while (longitude >= 180) do\n longitude -= 360\n end\n\n longitude\n end",
"def angles_diff(a1, a2)\n diff = a2 - a1\n while diff > Math::PI\n diff -= 2.0 * Math::PI\n end\n while diff < -Math::PI\n diff += 2.0 * Math::PI\n end\n diff\n end",
"def rad_to_deg(rad)\n return 360 * rad / (2 * Math::PI)\n end",
"def degrees\n self * Math::PI / 180.0\n end",
"def to_degrees(mod = false)\n return self.to_f.to_degrees(mod)\n end",
"def anglecw\n 360 - angle\n end",
"def atan\n Double.new(Math.atan(self.to_f))\n rescue Math::DomainError\n Double.new(::Float::NAN)\n end",
"def angle(p)\n Math.atan2(p.y - self.y, p.x - self.x)\n end",
"def degreesToRadians(deg)\n\treturn deg * (Math::PI/180)\nend",
"def angle_to(point)\n Ubiquity::Geoformulas.angle self.lat, self.lon, point.lat, point.lon\n end",
"def angle\n equation_1 = @wind_velocity * ETA\n apparent_wind_agl = @real_wind_agl - 0.0001\n\n until @variance > equation_1 - 0.001 && @variance < equation_1 + 0.001\n equation_2 = sailboat_transform(apparent_wind_agl)\n\n apparent_wind_agl -= 0.00001\n @variance = equation_1 - equation_2\n end\n puts \"Apparent Wind Angle:\\n#{apparent_wind_agl}\"\n apparent_wind_agl\n end",
"def other_angle(a, b)\n 180 - (a + b)\nend",
"def other_angle(a, b)\n 180 - (a + b)\nend",
"def initialize(angle, unit)\n case unit\n when :degrees, :deg then convert_and_normalize_degrees(angle)\n when :radians, :rad then convert_and_normalize_radians(angle)\n else\n raise InvalidArgumentsError, \"Unit should be :degrees, :deg, :radians ord :rad.\"\n end\n end",
"def angle_deg_with( vector )\n angle_with(vector) * RAD_TO_DEG\n end",
"def angle_to body\n dx = body.x - self.x\n dy = body.y - self.y\n\n (R2D * Math.atan2(dy, dx)).degrees\n end",
"def angle\r\n self.data.map(&:angle)\r\n end",
"def to_axis_angle\r\n half_angle = Math.acos(@real)\r\n sin_half_angle = Math.sin(half_angle)\r\n axis = (sin_half_angle.abs < 0.00000001)?\r\n Point3.new(1,0,0) : Point3.new(@axis).scale!(1.0/sin_half_angle)\r\n Quaternion.new(axis,2.0*half_angle)\r\n end",
"def determine_angle(angle, range)\n range.include?(angle) ? angle.to_f : angle.divmod(MAX_DEGREE_RANGE).last\nend",
"def theta_deg\n theta_rad / DEG2RAD\n end",
"def angle_deg=( angle_deg )\n self.angle = angle_deg * DEG_TO_RAD\n self\n end",
"def atan\n math :atan\n end",
"def angle=( angle_rad )\n raise \"can't modify frozen object\" if frozen?\n m = magnitude\n @x = Math::cos(angle_rad) * m\n @y = Math::sin(angle_rad) * m\n @hash = nil\n self\n end",
"def angular_velocity_rad_s\n 2 * PI / period_s\n end",
"def normalize_lat deg\n case deg \n when -360..-270\n deg % 90 \n when -270..-180\n 90 - (deg % 90)\n when -180..-90\n - (deg % 90)\n when -90..0 \n -90 + (deg % 90) \n when 0..90\n deg\n when 90..180 \n deg % 90\n when 180..270 \n - (deg % 90)\n when 270..360 \n - 90 + (deg % 90)\n else\n raise ArgumentError, \"Degrees #{deg} out of range, must be between -360 to 360\" \n end \n end",
"def angle_c\n Angle.new(\n self,\n :c,\n (\n (\n Math.acos((a**2 + b**2 - c**2) / (2.0 * a * b)) * 180\n ) / Math::PI\n )\n )\n end",
"def orthodrome_init_angle(lat1, lon1, lat2, lon2)\n dlon = (lon2 - lon1) * RAD_PER_DEG\n cola1 = Math.cos(lat1 * RAD_PER_DEG)\n sila1 = Math.sin(lat1 * RAD_PER_DEG)\n cola2 = Math.cos(lat2 * RAD_PER_DEG)\n sila2 = Math.sin(lat2 * RAD_PER_DEG)\n\n y = Math.sin(dlon) * cola2\n x = cola1 * sila2 - sila1 * cola2 * Math.cos(dlon)\n angle = Math.atan2(y,x)/RAD_PER_DEG # angle in degrees\n end",
"def to_angle_axis(eps = 1e-12)\n w, x, y, z = to_a\n norm = Math.sqrt(x*x+y*y+z*z);\n if norm < eps\n return 0, Eigen::Vector3.new(0,0,1);\n end\n\n angle = 2.0 * Math.atan2(norm, w);\n axis = Eigen::Vector3.new(x, y, z) / norm\n return angle, axis\n end",
"def rotate!( angle_rad )\n self.angle += angle_rad\n self\n end"
] |
[
"0.8137588",
"0.7489256",
"0.7373862",
"0.7199988",
"0.7065164",
"0.7023501",
"0.7015415",
"0.7009003",
"0.69523966",
"0.6831785",
"0.67868745",
"0.6752624",
"0.6690953",
"0.65927774",
"0.659094",
"0.65434813",
"0.6506284",
"0.6493496",
"0.64889234",
"0.6471543",
"0.64454556",
"0.6427833",
"0.6391881",
"0.637703",
"0.6346462",
"0.6341525",
"0.6337365",
"0.6337365",
"0.6328769",
"0.63122416",
"0.63028497",
"0.6283606",
"0.6281748",
"0.6266201",
"0.6261783",
"0.62600106",
"0.62393904",
"0.62393904",
"0.62366366",
"0.6232621",
"0.61744994",
"0.6139324",
"0.6138779",
"0.61144215",
"0.6106766",
"0.61024374",
"0.6089396",
"0.60836124",
"0.6019028",
"0.6012519",
"0.6009486",
"0.59933764",
"0.59884655",
"0.5965983",
"0.59595555",
"0.59319746",
"0.5920004",
"0.5901093",
"0.5890262",
"0.5865285",
"0.58327734",
"0.58012736",
"0.58012736",
"0.57703805",
"0.5766969",
"0.5743921",
"0.57208",
"0.5718983",
"0.57122165",
"0.5703841",
"0.57031816",
"0.56667763",
"0.56228536",
"0.5585552",
"0.5550072",
"0.5543192",
"0.55425566",
"0.5540098",
"0.5536674",
"0.5522201",
"0.5512888",
"0.5509468",
"0.5506656",
"0.54987115",
"0.5495143",
"0.54948646",
"0.54945916",
"0.54845273",
"0.5481409",
"0.5478449",
"0.5462091",
"0.5460831",
"0.5443071",
"0.54333645",
"0.5411682",
"0.53994197",
"0.53830415",
"0.53554124",
"0.5337138",
"0.53089476"
] |
0.77647895
|
1
|
Normalize the angle (in radians) and converts it in degrees.
|
def convert_and_normalize_radians(angle)
@radians = normalize_angle(angle, (2 * Math::PI))
@degrees = rad_to_deg(@radians)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def convert_and_normalize_degrees(angle)\n @degrees = normalize_angle(angle, 360)\n @radians = deg_to_rad(@degrees)\n end",
"def norm_angle(angle)\n while angle < 0; angle += Const::PI2; end\n while angle > Const::PI2; angle -= Const::PI2; end\n return angle\n rescue => e\n raise\n end",
"def to_degrees\n self / Math::PI.fdiv(180)\n end",
"def angle_deg\n angle * RAD_TO_DEG\n end",
"def angle\n ns = norm\n x_ = @x / ns\n y_ = @y / ns\n\n Math.atan2(x_, y_)\n end",
"def angle\n rad / Math::PI * 180\n end",
"def to_degrees(radians)\n (radians * 180.0) / Math::PI\n end",
"def normalize_bearing(angle)\n \t return ((angle + Math::PI) % (2 * Math::PI)) - Math::PI\n \tend",
"def convert_to_radians(degrees)\n degrees * PI / 180\nend",
"def normalize_heading(angle)\n \t return angle % (2 * Math::PI)\n \tend",
"def to_rad(angle)\n angle * Math::PI / 180\n end",
"def angle()\n a, c = @view__.angle, @context__\n c ? c.fromDegrees__(a) : a * Processing::GraphicsContext::DEG2RAD__\n end",
"def deg2rad(angle)\n angle * (Math::PI / 180.0)\n end",
"def angle\n v = to_vec\n if v[1] == 0.0\n nil\n else\n v.angle\n end\n end",
"def to_radians\n self * Math::PI.fdiv(180)\n end",
"def angle\n @angle\n end",
"def rad2deg\n self * (180/Math::PI)\n end",
"def angle\n Math.atan2(@y, @x)\n end",
"def convDegRad(value)\n unless value.nil? or value == 0\n value = (value/180) * Math::PI\n end\n return value\n end",
"def to_degrees(mod = false)\n return self.to_f.to_degrees(mod)\n end",
"def to_rad\n self * Math::PI / 180\n end",
"def convDegRad(value)\n unless value.nil? or value == 0\n value = (value/180) * Math::PI\n end\n return value\n end",
"def degrees\n self * Math::PI / 180\n end",
"def angle\n Math.atan2( @y, @x )\n end",
"def deg2rad\n self * (Math::PI/180)\n end",
"def to_radians(degrees)\n degrees * (Math::PI / 180)\n end",
"def radian_angle\n @angle * Math::PI / 180.0\n end",
"def degrees\n self * Math::PI / 180.0\n end",
"def angle(path)\n io_for(path).angle\n end",
"def to_radians(deg)\n deg * Math::PI / 180\n end",
"def conv_deg_rad(value)\n (value/180) * Math::PI unless value.nil? or value == 0\nend",
"def conv_deg_rad(value)\n (value/180) * Math::PI unless value.nil? or value == 0\nend",
"def degrees_to_radians(degrees)\n degrees * DEG_TO_RAD\n end",
"def to_radians(mod = false)\n if mod\n (self * Math::PI / 180) % Math::PI\n else\n self * Math::PI / 180\n end\n end",
"def to_radians(n)\n r = n * (Math::PI / 180)\n return r\n end",
"def angle(*args)\n Math.acos(self.dot(*args))\n end",
"def degrees_to_radians degrees\n # The :: operator is much like the scope\n # resolution operator in C++\n degrees * Math::PI / 180.0\nend",
"def deg2rad(deg) \r\nreturn (deg * $pi / 180);\r\nend",
"def safe_angle(angle)\n if angle < @angle_range.min\n @angle_range.min\n elsif angle > @angle_range.max\n @angle_range.max\n else\n angle\n end\n end",
"def angle_rads \n\t\t\t2.0 * Math.atan2( self.vec.mag, self.scalar ) \n\t\tend",
"def angle_a\n Angle.new(\n self,\n :a,\n (\n (\n Math.acos((b**2 + c**2 - a**2) / (2.0 * b * c)) * 180\n ) / Math::PI\n )\n )\n end",
"def angle_to(v)\n ret = Math.atan2(v.y, v.x) - Math.atan2(y, x)\n if ret > Math::PI\n ret -= 2*Math::PI\n end\n if ret < -Math::PI\n ret += 2*Math::PI\n end\n ret\n end",
"def angle_to(v)\n ret = Math.atan2(v.y, v.x) - Math.atan2(y, x)\n if ret > Math::PI\n ret -= 2*Math::PI\n end\n if ret < -Math::PI\n ret += 2*Math::PI\n end\n ret\n end",
"def to_radians(mod = false)\n return self.to_dec_degrees.to_radians(mod)\n end",
"def reduce_angle(a)\n modtwopi(a)\n end",
"def deg_to_rads(deg)\n deg * Math::PI / 180.0\n end",
"def angle_with( vector )\n Math.acos( max(min(udot(vector),MAX_UDOT_PRODUCT), MIN_UDOT_PRODUCT) )\n end",
"def angle_to(a,b)\n a,b = *[a,b].map(&:to_np)\n d0,d1 = dist_from(a), a.dist_from(b)\n z = self.to(a,1+d1/d0)\n dz = z.dist_from(b)\n Math.asin(dz/2/d1)*2\n end",
"def deg2rad(deg)\n deg*Math::PI/180\n end",
"def angle_deg=( angle_deg )\n self.angle = angle_deg * DEG_TO_RAD\n self\n end",
"def convertToRadians(val)\n return val * PIx / 180\n end",
"def convertToRadians(val)\n return val * PIx / 180\n end",
"def rad_to_deg(rad)\n return 360 * rad / (2 * Math::PI)\n end",
"def angle_deg_with( vector )\n angle_with(vector) * RAD_TO_DEG\n end",
"def angle_to(point)\n Ubiquity::Geoformulas.angle self.lat, self.lon, point.lat, point.lon\n end",
"def to_axis_angle\r\n half_angle = Math.acos(@real)\r\n sin_half_angle = Math.sin(half_angle)\r\n axis = (sin_half_angle.abs < 0.00000001)?\r\n Point3.new(1,0,0) : Point3.new(@axis).scale!(1.0/sin_half_angle)\r\n Quaternion.new(axis,2.0*half_angle)\r\n end",
"def radians\n self * 180 / Math::PI\n end",
"def angle(p)\n Math.atan2(p.y - self.y, p.x - self.x)\n end",
"def angle_direction(a,b)\n magnitude = angle_difference(a,b)\n if angle_difference(a + 1, b) < magnitude\n magnitude\n else\n -magnitude\n end\n end",
"def normalize_lat deg\n case deg \n when -360..-270\n deg % 90 \n when -270..-180\n 90 - (deg % 90)\n when -180..-90\n - (deg % 90)\n when -90..0 \n -90 + (deg % 90) \n when 0..90\n deg\n when 90..180 \n deg % 90\n when 180..270 \n - (deg % 90)\n when 270..360 \n - 90 + (deg % 90)\n else\n raise ArgumentError, \"Degrees #{deg} out of range, must be between -360 to 360\" \n end \n end",
"def initialize(angle, unit)\n case unit\n when :degrees, :deg then convert_and_normalize_degrees(angle)\n when :radians, :rad then convert_and_normalize_radians(angle)\n else\n raise InvalidArgumentsError, \"Unit should be :degrees, :deg, :radians ord :rad.\"\n end\n end",
"def radians\n Science::Angle.new(self, :radians)\n end",
"def anglecw\n 360 - angle\n end",
"def degreToRadian( degree )\n return degree * RADIAN_TO_DEGREE\n end",
"def deg_to_rad(deg)\n return (2 * Math::PI) * deg / 360\n end",
"def rad\n x = self[0]\n y = self[1]\n if x >= 0 && y >= 0\n Math.atan( y.to_f/x )\n elsif x < 0 && y >= 0\n Math::PI + Math.atan( y.to_f/x )\n elsif x < 0 && y < 0\n Math::PI + Math.atan( y.to_f/x )\n else\n 2*Math::PI + Math.atan( y.to_f/x )\n end\n end",
"def to_degs\n self * (180 / Math::PI)\n end",
"def to_angle_axis(eps = 1e-12)\n w, x, y, z = to_a\n norm = Math.sqrt(x*x+y*y+z*z);\n if norm < eps\n return 0, Eigen::Vector3.new(0,0,1);\n end\n\n angle = 2.0 * Math.atan2(norm, w);\n axis = Eigen::Vector3.new(x, y, z) / norm\n return angle, axis\n end",
"def determine_angle(angle, range)\n range.include?(angle) ? angle.to_f : angle.divmod(MAX_DEGREE_RANGE).last\nend",
"def radians(deg)\n deg * Math::PI / 180\n end",
"def convertFahrToCelsius(degrees) \n degrees = (degrees.to_f - 32) * 5 / 9 \nend",
"def angle_of_specified_radius\n @angle_of_radius\n end",
"def degree_to_radian(d)\n d * DEG2RAD\n end",
"def normalize_longitude(longitude)\n while (longitude < -180) do\n longitude += 360\n end\n\n while (longitude >= 180) do\n longitude -= 360\n end\n\n longitude\n end",
"def mirror_angle_horizontally!\n @angle = (-@angle) % 360\n end",
"def update_angle(angle)\n\t\t@angle = angle\n\t\t@prawn.angle = angle\n\tend",
"def f(unit)\n x = (unit / ::Math.cos(angle_radians)).abs\n y = (unit / ::Math.sin(angle_radians)).abs\n\n operator =\n if (@angle % 360).zero? || (@angle % 270).zero?\n :+\n else\n :-\n end\n\n @x = @x.send(operator, x) if !x.infinite? && x.abs <= unit\n @y = @y.send(operator, y) if !y.infinite? && y.abs <= unit\n end",
"def toRadians(degree)\n return degree*Math::PI/180\nend",
"def calculate_orientation\n x, y = @components.values\n if x.pos? and y.zero?\n 0.deg\n elsif x.zero? and y.pos?\n 90.deg\n elsif x.neg? and y.zero?\n 180.deg\n elsif x.zero? and y.neg?\n 270.deg\n elsif x.pos? and y.pos?\n Math.atan( y/x ).rad # Will return an Angle object (with the property \"degrees\")\n elsif x.neg? and y.pos?\n angle = Math.atan( y/x.abs ).rad\n (180 - angle.deg).deg # Will return an Angle object (with the property \"degrees\")\n elsif x.neg? and y.neg?\n angle = Math.atan( y.abs/x.abs ).rad\n (180 + angle.deg).deg # Will return an Angle object (with the property \"degrees\")\n elsif x.pos? and y.neg?\n angle = Math.atan( y.abs/x ).rad\n (360 - angle.deg).deg\n end\n end",
"def angle=( angle_rad )\n raise \"can't modify frozen object\" if frozen?\n m = magnitude\n @x = Math::cos(angle_rad) * m\n @y = Math::sin(angle_rad) * m\n @hash = nil\n self\n end",
"def _updateAngle\n\t\t\t\t@angle = (@maxAngle*@idxAngle) - Math::PIH\n\t\t\tend",
"def calculate_radians\n if x_length == 0 || y_length == 0\n angle_to_start_of_quadrant\n else\n case angle_to_end_of_quadrant\n when DEGREES_90\n angle_ignoring_quadrant\n when DEGREES_180\n DEGREES_180 - angle_ignoring_quadrant\n when DEGREES_270\n DEGREES_180 + angle_ignoring_quadrant\n else\n DEGREES_360 - angle_ignoring_quadrant\n end\n end\n end",
"def angle_to body\n dx = body.x - self.x\n dy = body.y - self.y\n\n (R2D * Math.atan2(dy, dx)).degrees\n end",
"def theta_deg\n theta_rad / DEG2RAD\n end",
"def angle(vector1,vector2)\n\n small = 0.00000001\n undefined = 999999.1\n\n magnitudevector1 = magnitude(vector1)\n magnitudevector2 = magnitude(vector2)\n if (magnitudevector1*magnitudevector2) > (small**2)\n aux = vdot(vector1,vector2)/(magnitudevector1*magnitudevector2)\n if aux.abs> 1.0\n aux = signal(aux) * 1.0\n end\n return Math.acos(aux)\n else\n return undefined\n end\n end",
"def angle=(angle)\n c = @context__\n @view__.angle =\n c ? c.toAngle__(angle) : angle * Processing::GraphicsContext::RAD2DEG__\n angle\n end",
"def convert(degree_fahrenheit)\n \n degree_celius = (degree_fahrenheit - 32)/1.8\n\nend",
"def grados2radianes(alfa)\n\t\treturn ((alfa*Math::PI)/180)\n\tend",
"def signed_angle_to(v, axis)\n dot_p = self.dot(v)\n dir = self.cross(v).dot(axis)\n\n unsigned = Math.acos(dot_p / norm / v.norm)\n if dir > 0\n return unsigned\n else\n return -unsigned\n end\n end",
"def signed_angle_to(v, axis)\n dot_p = self.dot(v)\n dir = self.cross(v).dot(axis)\n\n unsigned = Math.acos(dot_p / norm / v.norm)\n if dir > 0\n return unsigned\n else\n return -unsigned\n end\n end",
"def scale_degrees\n \n end",
"def atan\n Double.new(Math.atan(self.to_f))\n rescue Math::DomainError\n Double.new(::Float::NAN)\n end",
"def convert(degrees_F = 73)\r\n (degrees_F - 32) * 5 / 9.0\r\nend",
"def atan\n math :atan\n end",
"def angle\r\n self.data.map(&:angle)\r\n end",
"def other_angle(a, b)\n 180 - (a + b)\nend",
"def other_angle(a, b)\n 180 - (a + b)\nend",
"def deg2deg(deg)\r\n remt(deg, 360)\r\n end",
"def degrees\n self\n end",
"def format_angle(value, unit)\n if unit == :degree\n value + '°'\n else\n value + ' gon'\n end\n end"
] |
[
"0.8270539",
"0.7413582",
"0.6906046",
"0.6905473",
"0.6809431",
"0.6809337",
"0.6805236",
"0.6720024",
"0.66929656",
"0.6655652",
"0.66262394",
"0.66030914",
"0.65747476",
"0.64690137",
"0.6419076",
"0.6316655",
"0.63118374",
"0.62411577",
"0.62169427",
"0.62063026",
"0.61799914",
"0.61790544",
"0.61696696",
"0.6154029",
"0.6135634",
"0.61203915",
"0.61026174",
"0.6087258",
"0.6064607",
"0.60503936",
"0.6010209",
"0.6010209",
"0.59873146",
"0.597719",
"0.58983064",
"0.589328",
"0.58900326",
"0.5888926",
"0.5885042",
"0.58820534",
"0.58730924",
"0.5862753",
"0.5862753",
"0.5847167",
"0.5833029",
"0.58078396",
"0.5766428",
"0.5761476",
"0.5757801",
"0.57496494",
"0.5728996",
"0.5728996",
"0.57178706",
"0.5669885",
"0.56634855",
"0.5660355",
"0.5608135",
"0.5589122",
"0.55853575",
"0.5571335",
"0.5543256",
"0.5537787",
"0.5535082",
"0.5531246",
"0.55232275",
"0.55222857",
"0.5521215",
"0.55204093",
"0.5516233",
"0.5511056",
"0.55086035",
"0.549214",
"0.5469693",
"0.54508513",
"0.5449552",
"0.5443481",
"0.543949",
"0.5436843",
"0.5435422",
"0.54331535",
"0.5408061",
"0.5406951",
"0.5403591",
"0.5399682",
"0.5397823",
"0.53973967",
"0.5387593",
"0.53873414",
"0.53720516",
"0.53720516",
"0.53689724",
"0.536893",
"0.5365904",
"0.5365062",
"0.53391194",
"0.5338181",
"0.5336166",
"0.53314406",
"0.5327998",
"0.5324646"
] |
0.79983586
|
1
|
Convert an angle in degrees into radians
|
def deg_to_rad(deg)
return (2 * Math::PI) * deg / 360
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def convert_to_radians(degrees)\n degrees * PI / 180\nend",
"def deg2rad(angle)\n angle * (Math::PI / 180.0)\n end",
"def to_rad(angle)\n angle * Math::PI / 180\n end",
"def to_radians\n self * Math::PI.fdiv(180)\n end",
"def to_radians(deg)\n deg * Math::PI / 180\n end",
"def angle\n rad / Math::PI * 180\n end",
"def to_radians(degrees)\n degrees * (Math::PI / 180)\n end",
"def angle_deg\n angle * RAD_TO_DEG\n end",
"def deg2rad\n self * (Math::PI/180)\n end",
"def degrees_to_radians(degrees)\n degrees * DEG_TO_RAD\n end",
"def rad2deg\n self * (180/Math::PI)\n end",
"def radians(deg)\n deg * Math::PI / 180\n end",
"def deg2rad(deg) \r\nreturn (deg * $pi / 180);\r\nend",
"def convert_and_normalize_radians(angle)\n @radians = normalize_angle(angle, (2 * Math::PI))\n @degrees = rad_to_deg(@radians)\n end",
"def deg2rad(deg)\n deg*Math::PI/180\n end",
"def convertToRadians(val)\n return val * PIx / 180\n end",
"def convertToRadians(val)\n return val * PIx / 180\n end",
"def toRadians(degree)\n return degree*Math::PI/180\nend",
"def to_radians(n)\n r = n * (Math::PI / 180)\n return r\n end",
"def radian_angle\n @angle * Math::PI / 180.0\n end",
"def to_rad\n self * Math::PI / 180\n end",
"def convert_and_normalize_degrees(angle)\n @degrees = normalize_angle(angle, 360)\n @radians = deg_to_rad(@degrees)\n end",
"def to_degrees(radians)\n (radians * 180.0) / Math::PI\n end",
"def radians\n self * 180 / Math::PI\n end",
"def to_degrees\n self / Math::PI.fdiv(180)\n end",
"def to_radians(mod = false)\n if mod\n (self * Math::PI / 180) % Math::PI\n else\n self * Math::PI / 180\n end\n end",
"def radians(deg)\n deg * DEG_TO_RAD\n end",
"def degreesToRadians(deg)\n\treturn deg * (Math::PI/180)\nend",
"def calculate_radians\n if x_length == 0 || y_length == 0\n angle_to_start_of_quadrant\n else\n case angle_to_end_of_quadrant\n when DEGREES_90\n angle_ignoring_quadrant\n when DEGREES_180\n DEGREES_180 - angle_ignoring_quadrant\n when DEGREES_270\n DEGREES_180 + angle_ignoring_quadrant\n else\n DEGREES_360 - angle_ignoring_quadrant\n end\n end\n end",
"def to_radians(mod = false)\n return self.to_dec_degrees.to_radians(mod)\n end",
"def deg_to_rads(deg)\n deg * Math::PI / 180.0\n end",
"def radians\n Science::Angle.new(self, :radians)\n end",
"def angle()\n a, c = @view__.angle, @context__\n c ? c.fromDegrees__(a) : a * Processing::GraphicsContext::DEG2RAD__\n end",
"def degrees_to_radians degrees\n # The :: operator is much like the scope\n # resolution operator in C++\n degrees * Math::PI / 180.0\nend",
"def norm_angle(angle)\n while angle < 0; angle += Const::PI2; end\n while angle > Const::PI2; angle -= Const::PI2; end\n return angle\n rescue => e\n raise\n end",
"def degree_to_radian(d)\n d * DEG2RAD\n end",
"def degreToRadian( degree )\n return degree * RADIAN_TO_DEGREE\n end",
"def to_radians(coordinates)\n coordinates.to_f * (Math::PI / 180)\n end",
"def angle\n ns = norm\n x_ = @x / ns\n y_ = @y / ns\n\n Math.atan2(x_, y_)\n end",
"def convDegRad(value)\n unless value.nil? or value == 0\n value = (value/180) * Math::PI\n end\n return value\n end",
"def convDegRad(value)\n unless value.nil? or value == 0\n value = (value/180) * Math::PI\n end\n return value\n end",
"def conv_deg_rad(value)\n (value/180) * Math::PI unless value.nil? or value == 0\nend",
"def conv_deg_rad(value)\n (value/180) * Math::PI unless value.nil? or value == 0\nend",
"def rad\n x = self[0]\n y = self[1]\n if x >= 0 && y >= 0\n Math.atan( y.to_f/x )\n elsif x < 0 && y >= 0\n Math::PI + Math.atan( y.to_f/x )\n elsif x < 0 && y < 0\n Math::PI + Math.atan( y.to_f/x )\n else\n 2*Math::PI + Math.atan( y.to_f/x )\n end\n end",
"def rad2rad(rad)\r\n remt(rad, PI2)\r\n end",
"def other_angle(a, b)\n 180 - (a + b)\nend",
"def other_angle(a, b)\n 180 - (a + b)\nend",
"def calc_angle(hours, minutes)\n angel = (minutes * 6 - (hours * 60 + minutes) * 0.5).abs\n if angel > 180\n 360 - angel.abs\n else\n angel.abs\n end\nend",
"def angle_of_specified_radius\n @angle_of_radius\n end",
"def angle\n Math.atan2(@y, @x)\n end",
"def rad_to_deg(rad)\n return 360 * rad / (2 * Math::PI)\n end",
"def angle\n @angle\n end",
"def sec_to_rad(x)\n x*Math::PI/(180*3600)\n end",
"def angle(path)\n io_for(path).angle\n end",
"def grados2radianes(alfa)\n\t\treturn ((alfa*Math::PI)/180)\n\tend",
"def angle_rads \n\t\t\t2.0 * Math.atan2( self.vec.mag, self.scalar ) \n\t\tend",
"def degrees\n self * Math::PI / 180\n end",
"def angle\n Math.atan2( @y, @x )\n end",
"def angle\n v = to_vec\n if v[1] == 0.0\n nil\n else\n v.angle\n end\n end",
"def theta_deg\n theta_rad / DEG2RAD\n end",
"def angle_deg_with( vector )\n angle_with(vector) * RAD_TO_DEG\n end",
"def reduce_angle(a)\n modtwopi(a)\n end",
"def degrees\n self * Math::PI / 180.0\n end",
"def calculate_rad_angle_between(target)\n Math.atan2(target.y - y, target.x - x)\n end",
"def to_degrees(mod = false)\n return self.to_f.to_degrees(mod)\n end",
"def angle_a\n Angle.new(\n self,\n :a,\n (\n (\n Math.acos((b**2 + c**2 - a**2) / (2.0 * b * c)) * 180\n ) / Math::PI\n )\n )\n end",
"def angle_direction(a,b)\n magnitude = angle_difference(a,b)\n if angle_difference(a + 1, b) < magnitude\n magnitude\n else\n -magnitude\n end\n end",
"def deg2deg(deg)\r\n remt(deg, 360)\r\n end",
"def angle(*args)\n Math.acos(self.dot(*args))\n end",
"def angle_to(a,b)\n a,b = *[a,b].map(&:to_np)\n d0,d1 = dist_from(a), a.dist_from(b)\n z = self.to(a,1+d1/d0)\n dz = z.dist_from(b)\n Math.asin(dz/2/d1)*2\n end",
"def to_rad(n_decimals = nil)\n include Math unless defined?(Math)\n radians = self * PI / 180.0\n return radians if n_decimals.nil?\n radians.round(n_decimals)\n end",
"def normalize_bearing(angle)\n \t return ((angle + Math::PI) % (2 * Math::PI)) - Math::PI\n \tend",
"def determine_angle(angle, range)\n range.include?(angle) ? angle.to_f : angle.divmod(MAX_DEGREE_RANGE).last\nend",
"def angles_diff(a1, a2)\n diff = a2 - a1\n while diff > Math::PI\n diff -= 2.0 * Math::PI\n end\n while diff < -Math::PI\n diff += 2.0 * Math::PI\n end\n diff\n end",
"def angle_to(v)\n ret = Math.atan2(v.y, v.x) - Math.atan2(y, x)\n if ret > Math::PI\n ret -= 2*Math::PI\n end\n if ret < -Math::PI\n ret += 2*Math::PI\n end\n ret\n end",
"def angle_to(v)\n ret = Math.atan2(v.y, v.x) - Math.atan2(y, x)\n if ret > Math::PI\n ret -= 2*Math::PI\n end\n if ret < -Math::PI\n ret += 2*Math::PI\n end\n ret\n end",
"def angle(x1, y1, x2, y2)\n end",
"def g2r(n)\n\tn*(Math::PI/180)\nend",
"def turn_right(angle)\n @angle = @angle -angle*Math::PI / 180\n end",
"def rad2deg(rad, wrap = true)\r\n deg = RD * rad\r\n deg = deg2deg(deg) if wrap\r\n deg\r\n end",
"def anglecw\n 360 - angle\n end",
"def deg2rad(deg, wrap = true)\r\n rad = DR * deg\r\n rad = rad2rad(rad) if wrap\r\n rad\r\n end",
"def angle_with( vector )\n Math.acos( max(min(udot(vector),MAX_UDOT_PRODUCT), MIN_UDOT_PRODUCT) )\n end",
"def angle_to(point)\n Ubiquity::Geoformulas.angle self.lat, self.lon, point.lat, point.lon\n end",
"def getAngle(c1,c2)\n x = c2[0] - c1[0]\n y = c2[1] - c1[1]\n x = x <= -180 ? x + 360 : x\n x = x >= 180 ? x - 360 : x\n\n a = Math.atan2(y, x)\n rescue\n p \"Error x=#{x}, y=#{y} sq= #{Math.sqrt(x*x+y*y)} rat=#{x / Math.sqrt(x*x+y*y)}\"\n raise Error\n end",
"def angle_to body\n dx = body.x - self.x\n dy = body.y - self.y\n\n (R2D * Math.atan2(dy, dx)).degrees\n end",
"def angle_c\n Angle.new(\n self,\n :c,\n (\n (\n Math.acos((a**2 + b**2 - c**2) / (2.0 * a * b)) * 180\n ) / Math::PI\n )\n )\n end",
"def orthodrome_init_angle(lat1, lon1, lat2, lon2)\n dlon = (lon2 - lon1) * RAD_PER_DEG\n cola1 = Math.cos(lat1 * RAD_PER_DEG)\n sila1 = Math.sin(lat1 * RAD_PER_DEG)\n cola2 = Math.cos(lat2 * RAD_PER_DEG)\n sila2 = Math.sin(lat2 * RAD_PER_DEG)\n\n y = Math.sin(dlon) * cola2\n x = cola1 * sila2 - sila1 * cola2 * Math.cos(dlon)\n angle = Math.atan2(y,x)/RAD_PER_DEG # angle in degrees\n end",
"def polar\n theta = 0.0\n if Point.close_to(self.x, 0)\n if self.y > 0\n theta = 90.0\n elsif self.y < 0\n theta = 270.0\n end\n else\n theta = Point.rad2deg(Math.atan(self.y/self.x))\n if self.x < 0.0\n theta += 180.0\n end\n if theta < 0.0\n theta += 360.0\n end\n end\n theta\n end",
"def angle_delta(angle1, angle2)\n \t delta = (angle1 - angle2).abs\n \t if delta >= Math::PI\n \t delta = (((2 * Math::PI) - angle1) + angle2).abs\n \t end\n \t return delta\n \tend",
"def declination_rad\n if @declination_rad.nil?\n @declination_rad = inclination_rad - PI / 2\n @declination_rad -= PI / 2 while @declination_rad > PI / 2\n end\n @declination_rad\n end",
"def angle(p)\n Math.atan2(p.y - self.y, p.x - self.x)\n end",
"def rotate(angle)\n primitive 'rotate ' + sprintf('%g', angle)\n end",
"def atan\n math :atan\n end",
"def conv_radian_to_degree(aNum)\r\n# - - - - - - - - - - - - - - - - - - - -\r\n return (aNum * Radian_to_degree_mult)\r\nend",
"def equirectangular_angle(lat1, lon1, lat2, lon2)\n dlon = lon2 - lon1\n dlat = lat2 - lat1\n avlat_rad = (lat2 + lat1)/2 * RAD_PER_DEG\n\n x = dlon * Math.cos(avlat_rad)\n y = dlat\n angle = Math.atan2(x,y)/RAD_PER_DEG # angle in degrees\n end",
"def rotate(angle)\n case angle % 360\n when 0 then dup\n when 90 then rotate_cw\n when 180 then rotate_flip\n when 270 then rotate_ccw\n else\n raise RuntimeError, \"unsupported rotation angle #{angle}\"\n end\n end",
"def angle(hour, minutes)\n (hour + minutes / 60) * 30 - minutes * 6\nend",
"def map_direction_to_angle(dir)\n return $direction_map[dir]\nend",
"def rotate( angle_rad )\n dup.rotate!( angle_rad )\n end"
] |
[
"0.8170839",
"0.8003487",
"0.79211396",
"0.78019285",
"0.7771638",
"0.77399975",
"0.7691498",
"0.7684574",
"0.75916225",
"0.75691694",
"0.75187236",
"0.74985194",
"0.7495361",
"0.7476968",
"0.74729913",
"0.7400484",
"0.7400484",
"0.7385782",
"0.7326304",
"0.7310339",
"0.72934085",
"0.72899854",
"0.7276688",
"0.7269966",
"0.7262183",
"0.72236496",
"0.72208637",
"0.71419144",
"0.7101631",
"0.7095982",
"0.70464206",
"0.7036293",
"0.70027256",
"0.69880694",
"0.6975329",
"0.6933591",
"0.6919352",
"0.6887288",
"0.6883634",
"0.6880273",
"0.6850122",
"0.6826597",
"0.6826597",
"0.6818902",
"0.681008",
"0.67690164",
"0.67547345",
"0.6745961",
"0.67272824",
"0.67229307",
"0.67222613",
"0.6686937",
"0.66520786",
"0.6639768",
"0.66307336",
"0.6602214",
"0.6592702",
"0.65722936",
"0.6570107",
"0.6532183",
"0.6515954",
"0.63739914",
"0.63638484",
"0.6363181",
"0.63495725",
"0.6349393",
"0.6345593",
"0.6303694",
"0.6294048",
"0.62447876",
"0.62318254",
"0.6223432",
"0.6206185",
"0.61909884",
"0.61871135",
"0.61871135",
"0.61702317",
"0.6159525",
"0.61508393",
"0.6141477",
"0.6126976",
"0.6085951",
"0.60792124",
"0.6078608",
"0.60432655",
"0.60373944",
"0.6036411",
"0.6027801",
"0.6015721",
"0.60052395",
"0.6005037",
"0.59966505",
"0.59900016",
"0.5989907",
"0.5983125",
"0.59720105",
"0.5970204",
"0.59602684",
"0.59351826",
"0.59307194"
] |
0.7017877
|
32
|
Convert an angle in radians into degrees.
|
def rad_to_deg(rad)
return 360 * rad / (2 * Math::PI)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def to_degrees(radians)\n (radians * 180.0) / Math::PI\n end",
"def to_degrees\n self / Math::PI.fdiv(180)\n end",
"def angle_deg\n angle * RAD_TO_DEG\n end",
"def convert_and_normalize_degrees(angle)\n @degrees = normalize_angle(angle, 360)\n @radians = deg_to_rad(@degrees)\n end",
"def convert_to_radians(degrees)\n degrees * PI / 180\nend",
"def rad2deg\n self * (180/Math::PI)\n end",
"def angle\n rad / Math::PI * 180\n end",
"def convert_and_normalize_radians(angle)\n @radians = normalize_angle(angle, (2 * Math::PI))\n @degrees = rad_to_deg(@radians)\n end",
"def to_radians(degrees)\n degrees * (Math::PI / 180)\n end",
"def to_radians(deg)\n deg * Math::PI / 180\n end",
"def degrees_to_radians(degrees)\n degrees * DEG_TO_RAD\n end",
"def deg2rad(angle)\n angle * (Math::PI / 180.0)\n end",
"def to_radians\n self * Math::PI.fdiv(180)\n end",
"def to_degrees(mod = false)\n return self.to_f.to_degrees(mod)\n end",
"def to_rad(angle)\n angle * Math::PI / 180\n end",
"def degrees\n self * Math::PI / 180\n end",
"def angle()\n a, c = @view__.angle, @context__\n c ? c.fromDegrees__(a) : a * Processing::GraphicsContext::DEG2RAD__\n end",
"def toRadians(degree)\n return degree*Math::PI/180\nend",
"def deg2rad(deg)\n deg*Math::PI/180\n end",
"def deg2rad\n self * (Math::PI/180)\n end",
"def degrees\n self * Math::PI / 180.0\n end",
"def deg2deg(deg)\r\n remt(deg, 360)\r\n end",
"def radians(deg)\n deg * Math::PI / 180\n end",
"def deg2rad(deg) \r\nreturn (deg * $pi / 180);\r\nend",
"def convDegRad(value)\n unless value.nil? or value == 0\n value = (value/180) * Math::PI\n end\n return value\n end",
"def degreesToRadians(deg)\n\treturn deg * (Math::PI/180)\nend",
"def convDegRad(value)\n unless value.nil? or value == 0\n value = (value/180) * Math::PI\n end\n return value\n end",
"def to_radians(n)\n r = n * (Math::PI / 180)\n return r\n end",
"def convertToRadians(val)\n return val * PIx / 180\n end",
"def convertToRadians(val)\n return val * PIx / 180\n end",
"def norm_angle(angle)\n while angle < 0; angle += Const::PI2; end\n while angle > Const::PI2; angle -= Const::PI2; end\n return angle\n rescue => e\n raise\n end",
"def radians(deg)\n deg * DEG_TO_RAD\n end",
"def conv_deg_rad(value)\n (value/180) * Math::PI unless value.nil? or value == 0\nend",
"def conv_deg_rad(value)\n (value/180) * Math::PI unless value.nil? or value == 0\nend",
"def angle_deg_with( vector )\n angle_with(vector) * RAD_TO_DEG\n end",
"def degreToRadian( degree )\n return degree * RADIAN_TO_DEGREE\n end",
"def radian_angle\n @angle * Math::PI / 180.0\n end",
"def deg_to_rads(deg)\n deg * Math::PI / 180.0\n end",
"def angle\n ns = norm\n x_ = @x / ns\n y_ = @y / ns\n\n Math.atan2(x_, y_)\n end",
"def to_rad\n self * Math::PI / 180\n end",
"def degrees_to_radians degrees\n # The :: operator is much like the scope\n # resolution operator in C++\n degrees * Math::PI / 180.0\nend",
"def angle\n Math.atan2(@y, @x)\n end",
"def deg_to_rad(deg)\n return (2 * Math::PI) * deg / 360\n end",
"def radians\n self * 180 / Math::PI\n end",
"def to_radians(mod = false)\n if mod\n (self * Math::PI / 180) % Math::PI\n else\n self * Math::PI / 180\n end\n end",
"def angle\n v = to_vec\n if v[1] == 0.0\n nil\n else\n v.angle\n end\n end",
"def degree_to_radian(d)\n d * DEG2RAD\n end",
"def theta_deg\n theta_rad / DEG2RAD\n end",
"def to_radians(mod = false)\n return self.to_dec_degrees.to_radians(mod)\n end",
"def convertFahrToCelsius(degrees) \n degrees = (degrees.to_f - 32) * 5 / 9 \nend",
"def angle\n @angle\n end",
"def angle\n Math.atan2( @y, @x )\n end",
"def calc_angle(hours, minutes)\n angel = (minutes * 6 - (hours * 60 + minutes) * 0.5).abs\n if angel > 180\n 360 - angel.abs\n else\n angel.abs\n end\nend",
"def other_angle(a, b)\n 180 - (a + b)\nend",
"def other_angle(a, b)\n 180 - (a + b)\nend",
"def angle(path)\n io_for(path).angle\n end",
"def to_radians(coordinates)\n coordinates.to_f * (Math::PI / 180)\n end",
"def fahrenheit_to_degrees(fahrenheit)\n fahrenheit.to_f - 32 * 5.0 / 9.0\n end",
"def degrees\n\t\t@degrees ||= cardinal.keys.sort + [360.0]\n\tend",
"def radians\n Science::Angle.new(self, :radians)\n end",
"def angle_deg=( angle_deg )\n self.angle = angle_deg * DEG_TO_RAD\n self\n end",
"def rad2deg(rad, wrap = true)\r\n deg = RD * rad\r\n deg = deg2deg(deg) if wrap\r\n deg\r\n end",
"def rotateToDegree(degree)\n preDegree = getActualAngle\n adjustment = degree - preDegree\n rotateByDegree(adjustment)\n \n dir = getCurrentDirection\n if(@@roomView)\n @@rotationArray.unshift(dir) \n end\n\n if(@@eyeView) \n @@rotateAngle = adjustment\n @@view.animation = Avatar.new\n @@rotateAngle = 0\n end\n end",
"def angle_a\n Angle.new(\n self,\n :a,\n (\n (\n Math.acos((b**2 + c**2 - a**2) / (2.0 * b * c)) * 180\n ) / Math::PI\n )\n )\n end",
"def rotateByDegree(angle)\n return unless defined? angle\n currentPosition = getCurrentPosition\n z_vector = [0, 0, 1]\n\n rotationTransformation = Geom::Transformation.rotation(currentPosition, z_vector, angle.degrees)\n @@componentInstance.transform! (rotationTransformation)\n\n # Need to update the most recent transformation!!!\n # Without updating, the rotation will be changed to the initial status when move the model.\n updateAvatarLocation\n updateTransformation\n updateViewPort\n\n end",
"def to_degs\n self * (180 / Math::PI)\n end",
"def reduce_angle(a)\n modtwopi(a)\n end",
"def rotate(angle)\n case angle % 360\n when 0 then dup\n when 90 then rotate_cw\n when 180 then rotate_flip\n when 270 then rotate_ccw\n else\n raise RuntimeError, \"unsupported rotation angle #{angle}\"\n end\n end",
"def angle_to(a,b)\n a,b = *[a,b].map(&:to_np)\n d0,d1 = dist_from(a), a.dist_from(b)\n z = self.to(a,1+d1/d0)\n dz = z.dist_from(b)\n Math.asin(dz/2/d1)*2\n end",
"def rotate_deg( angle_deg )\n dup.rotate_deg!( angle_deg )\n end",
"def angle_direction(a,b)\n magnitude = angle_difference(a,b)\n if angle_difference(a + 1, b) < magnitude\n magnitude\n else\n -magnitude\n end\n end",
"def calculate_radians\n if x_length == 0 || y_length == 0\n angle_to_start_of_quadrant\n else\n case angle_to_end_of_quadrant\n when DEGREES_90\n angle_ignoring_quadrant\n when DEGREES_180\n DEGREES_180 - angle_ignoring_quadrant\n when DEGREES_270\n DEGREES_180 + angle_ignoring_quadrant\n else\n DEGREES_360 - angle_ignoring_quadrant\n end\n end\n end",
"def angle(*args)\n Math.acos(self.dot(*args))\n end",
"def rotate_deg!( angle_deg )\n self.angle_deg += angle_deg\n self\n end",
"def turn_left(angle)\n @angle = @angle + angle*Math::PI / 180\n end",
"def determine_angle(angle, range)\n range.include?(angle) ? angle.to_f : angle.divmod(MAX_DEGREE_RANGE).last\nend",
"def to_decimal_degree\n return @degree + (@arcminute + (@arcsecond.fdiv(60))).fdiv(60)\n end",
"def angle_to(point)\n Ubiquity::Geoformulas.angle self.lat, self.lon, point.lat, point.lon\n end",
"def to_fahrenheit(degrees)\n degrees.to_f * 9.0 / 5.0 + 32\n end",
"def angle(p)\n Math.atan2(p.y - self.y, p.x - self.x)\n end",
"def normalize_bearing(angle)\n \t return ((angle + Math::PI) % (2 * Math::PI)) - Math::PI\n \tend",
"def convert(degrees_F = 73)\r\n (degrees_F - 32) * 5 / 9.0\r\nend",
"def angle_to(v)\n ret = Math.atan2(v.y, v.x) - Math.atan2(y, x)\n if ret > Math::PI\n ret -= 2*Math::PI\n end\n if ret < -Math::PI\n ret += 2*Math::PI\n end\n ret\n end",
"def angle_to(v)\n ret = Math.atan2(v.y, v.x) - Math.atan2(y, x)\n if ret > Math::PI\n ret -= 2*Math::PI\n end\n if ret < -Math::PI\n ret += 2*Math::PI\n end\n ret\n end",
"def conv_radian_to_degree(aNum)\r\n# - - - - - - - - - - - - - - - - - - - -\r\n return (aNum * Radian_to_degree_mult)\r\nend",
"def angle_of_specified_radius\n @angle_of_radius\n end",
"def rotate\n @angle += Math::PI / 16\n @angle = @angle % (Math::PI * 2)\n end",
"def degrees\n self\n end",
"def calculate_orientation\n x, y = @components.values\n if x.pos? and y.zero?\n 0.deg\n elsif x.zero? and y.pos?\n 90.deg\n elsif x.neg? and y.zero?\n 180.deg\n elsif x.zero? and y.neg?\n 270.deg\n elsif x.pos? and y.pos?\n Math.atan( y/x ).rad # Will return an Angle object (with the property \"degrees\")\n elsif x.neg? and y.pos?\n angle = Math.atan( y/x.abs ).rad\n (180 - angle.deg).deg # Will return an Angle object (with the property \"degrees\")\n elsif x.neg? and y.neg?\n angle = Math.atan( y.abs/x.abs ).rad\n (180 + angle.deg).deg # Will return an Angle object (with the property \"degrees\")\n elsif x.pos? and y.neg?\n angle = Math.atan( y.abs/x ).rad\n (360 - angle.deg).deg\n end\n end",
"def turn dir\n self.a = (a + dir).degrees if dir\n end",
"def right(degrees)\n raise ArgumentError unless degrees.is_a?(Numeric)\n @heading += degrees\n @heading %= 360\n end",
"def kelvin_to_degrees(kelvin)\n kelvin.to_f + ABSOLUTE_ZERO\n end",
"def initialize(angle = 0, radians = false)\n # assumes that we are getting an angle in degrees.\n @angle = if radians == true || radians == :radians\n angle.to_f # works for String, Fixed, other Angles and for Float.\n elsif angle.instance_of?(Array)\n self.class.decimal_deg(*angle).to_radians\n else\n angle.to_radians # we have a String and Numeric class version of this. Another Angle will work too.\n end\n end",
"def rotate(angle)\n primitive 'rotate ' + sprintf('%g', angle)\n end",
"def rad2rad(rad)\r\n remt(rad, PI2)\r\n end",
"def grados2radianes(alfa)\n\t\treturn ((alfa*Math::PI)/180)\n\tend",
"def angle_to body\n dx = body.x - self.x\n dy = body.y - self.y\n\n (R2D * Math.atan2(dy, dx)).degrees\n end",
"def angle(x1, y1, x2, y2)\n end",
"def f(unit)\n x = (unit / ::Math.cos(angle_radians)).abs\n y = (unit / ::Math.sin(angle_radians)).abs\n\n operator =\n if (@angle % 360).zero? || (@angle % 270).zero?\n :+\n else\n :-\n end\n\n @x = @x.send(operator, x) if !x.infinite? && x.abs <= unit\n @y = @y.send(operator, y) if !y.infinite? && y.abs <= unit\n end",
"def convert_input(any_value_float)\n n, degrees_remaining = any_value_float.divmod(360)\n if degrees_remaining >= 0\n degrees_remaining\n elsif\n degrees_remaining < 0\n degrees_remaining + 360\n end\nend"
] |
[
"0.81189156",
"0.790555",
"0.7879468",
"0.78327274",
"0.76273376",
"0.7575523",
"0.7331729",
"0.7296378",
"0.7281546",
"0.72458893",
"0.72180253",
"0.7157238",
"0.7086928",
"0.7071854",
"0.6983566",
"0.6952312",
"0.6918229",
"0.688397",
"0.68577486",
"0.6825215",
"0.6819694",
"0.68160737",
"0.6801623",
"0.67986476",
"0.6720874",
"0.67162615",
"0.67051834",
"0.6589098",
"0.6572231",
"0.6572231",
"0.65350085",
"0.65264535",
"0.6495488",
"0.6495488",
"0.64802116",
"0.6449278",
"0.64391285",
"0.6421933",
"0.64077616",
"0.63995886",
"0.6399151",
"0.6383958",
"0.63705134",
"0.63403136",
"0.63212305",
"0.6319936",
"0.63042426",
"0.62952894",
"0.627839",
"0.627124",
"0.62516844",
"0.62473154",
"0.62384623",
"0.622541",
"0.62197316",
"0.6209255",
"0.6195087",
"0.6194269",
"0.6159976",
"0.6136146",
"0.61348885",
"0.6134733",
"0.6128589",
"0.6087459",
"0.60373205",
"0.60333866",
"0.60209966",
"0.60097456",
"0.5981936",
"0.5980705",
"0.5964854",
"0.59457254",
"0.59222865",
"0.5905297",
"0.590188",
"0.5897178",
"0.58896804",
"0.5877949",
"0.5874739",
"0.58725727",
"0.5866482",
"0.58647054",
"0.5859675",
"0.5859675",
"0.58436936",
"0.5840193",
"0.58271474",
"0.5824316",
"0.58242804",
"0.5823721",
"0.5819732",
"0.58039373",
"0.57993937",
"0.57767594",
"0.57760835",
"0.5761566",
"0.57574934",
"0.5755696",
"0.5751775",
"0.57471836"
] |
0.6982797
|
15
|
Instantiates a new Science::Angle with the unit "radians".
|
def radians
Science::Angle.new(self, :radians)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def initialize(angle, unit)\n case unit\n when :degrees, :deg then convert_and_normalize_degrees(angle)\n when :radians, :rad then convert_and_normalize_radians(angle)\n else\n raise InvalidArgumentsError, \"Unit should be :degrees, :deg, :radians ord :rad.\"\n end\n end",
"def initialize(angle = 0, radians = false)\n # assumes that we are getting an angle in degrees.\n @angle = if radians == true || radians == :radians\n angle.to_f # works for String, Fixed, other Angles and for Float.\n elsif angle.instance_of?(Array)\n self.class.decimal_deg(*angle).to_radians\n else\n angle.to_radians # we have a String and Numeric class version of this. Another Angle will work too.\n end\n end",
"def angle\n rad / Math::PI * 180\n end",
"def radians\n self * 180 / Math::PI\n end",
"def to_radians\n self * Math::PI.fdiv(180)\n end",
"def rotate(radians)\n sin = Math.sin radians\n cos = Math.cos radians\n Vector.new cos * @x - sin * @y, sin * @x + cos * @y\n end",
"def angle_deg\n angle * RAD_TO_DEG\n end",
"def angle_deg=( angle_deg )\n self.angle = angle_deg * DEG_TO_RAD\n self\n end",
"def angle_of_specified_radius\n @angle_of_radius\n end",
"def angle_a\n Angle.new(\n self,\n :a,\n (\n (\n Math.acos((b**2 + c**2 - a**2) / (2.0 * b * c)) * 180\n ) / Math::PI\n )\n )\n end",
"def convert_to_radians(degrees)\n degrees * PI / 180\nend",
"def angle()\n a, c = @view__.angle, @context__\n c ? c.fromDegrees__(a) : a * Processing::GraphicsContext::DEG2RAD__\n end",
"def rotate!( angle_rad )\n self.angle += angle_rad\n self\n end",
"def radians(deg)\n deg * Math::PI / 180\n end",
"def calculate_radians\n if x_length == 0 || y_length == 0\n angle_to_start_of_quadrant\n else\n case angle_to_end_of_quadrant\n when DEGREES_90\n angle_ignoring_quadrant\n when DEGREES_180\n DEGREES_180 - angle_ignoring_quadrant\n when DEGREES_270\n DEGREES_180 + angle_ignoring_quadrant\n else\n DEGREES_360 - angle_ignoring_quadrant\n end\n end\n end",
"def rad2deg\n self * (180/Math::PI)\n end",
"def angle_c\n Angle.new(\n self,\n :c,\n (\n (\n Math.acos((a**2 + b**2 - c**2) / (2.0 * a * b)) * 180\n ) / Math::PI\n )\n )\n end",
"def radian_angle\n @angle * Math::PI / 180.0\n end",
"def deg2rad\n self * (Math::PI/180)\n end",
"def angle=( angle_rad )\n raise \"can't modify frozen object\" if frozen?\n m = magnitude\n @x = Math::cos(angle_rad) * m\n @y = Math::sin(angle_rad) * m\n @hash = nil\n self\n end",
"def initialize(radians = NORTH)\n @radians = radians.to_f % FULL_ANGLE\n @memoized = {} # allow memoization since @some_var ||= x doesn't work when frozen\n self.freeze\n end",
"def to_degrees\n self / Math::PI.fdiv(180)\n end",
"def rotate!(radians)\n sin = Math.sin radians\n cos = Math.cos radians\n prev_x = @x\n @x = cos * @x - sin * @y\n @y = sin * prev_x + cos * @y\n end",
"def to_radians(degrees)\n degrees * (Math::PI / 180)\n end",
"def angle\n ns = norm\n x_ = @x / ns\n y_ = @y / ns\n\n Math.atan2(x_, y_)\n end",
"def f(unit)\n x = (unit / ::Math.cos(angle_radians)).abs\n y = (unit / ::Math.sin(angle_radians)).abs\n\n operator =\n if (@angle % 360).zero? || (@angle % 270).zero?\n :+\n else\n :-\n end\n\n @x = @x.send(operator, x) if !x.infinite? && x.abs <= unit\n @y = @y.send(operator, y) if !y.infinite? && y.abs <= unit\n end",
"def degrees\n self * Math::PI / 180\n end",
"def angle\n @angle\n end",
"def new_polar( angle_rad, magnitude )\n self.new( Math::cos(angle_rad)*magnitude,\n Math::sin(angle_rad)*magnitude )\n end",
"def axis_rotation( axis, angle ) \n\t\t\traise TypeError, \"no implicit conversion of %s to ODE::Vector\" unless\n\t\t\t\taxis.is_a?( ODE::Vector )\n\t\t\tangle = Float(angle)\n\n\t\t\tif len = axis.abs\n\t\t\t\ta = axis/len * sin( angle / 2.0 );\n\t\t\t\tself.class.new( a, cos(angle/2.0) )\n\t\t\telse\n\t\t\t\tself.class.identity\n\t\t\tend\n\t\tend",
"def to_radians(deg)\n deg * Math::PI / 180\n end",
"def to_rad(angle)\n angle * Math::PI / 180\n end",
"def to_rad\n self * Math::PI / 180\n end",
"def rotation(during, on, angle_start, angle_end, distortion: :UNICITY_DISTORTION, time_source: :GENERIC_TIME_SOURCE)\n ScalarAnimation.new(during, on, :angle=, angle_start, angle_end, distortion: distortion, time_source: time_source)\n end",
"def degrees_to_radians degrees\n # The :: operator is much like the scope\n # resolution operator in C++\n degrees * Math::PI / 180.0\nend",
"def rotate( angle_rad )\n dup.rotate!( angle_rad )\n end",
"def rotate_deg!( angle_deg )\n self.angle_deg += angle_deg\n self\n end",
"def angle(*args)\n Math.acos(self.dot(*args))\n end",
"def angle_b\n Angle.new(\n self,\n :b,\n (\n (\n Math.acos((a**2 + c**2 - b**2) / (2.0 * a * c)) * 180\n ) / Math::PI\n )\n )\n end",
"def to_degrees(radians)\n (radians * 180.0) / Math::PI\n end",
"def degrees\n self * Math::PI / 180.0\n end",
"def initialize(inclination_deg, period_min, swath_width_km, start_clat_deg, count=0)\n @declination_rad = nil # lazy\n @inclination_rad = inclination_deg * PI / 180.0\n @period_s = period_min * 60\n @swath_width_rad = swath_width_km * 1000 / EARTH_RADIUS_M\n @start_clat_rad = start_clat_deg * PI / 180.0\n @count = count\n end",
"def initialize( length = 0, direction = 0)\n @length = length\n @direction = direction\n \n @i = Math.cos( degreToRadian( @direction ) ) * @length\n #@j = 0\n @j = (Math.sin( degreToRadian( @direction ) ) * @length )*(-1) #*(-1) a cause du sytem axe en y inverse\n puts(\"vector unitaire: \" + i.to_s + \" \" + j.to_s)\n end",
"def radians(deg)\n deg * DEG_TO_RAD\n end",
"def to_radians(mod = false)\n if mod\n (self * Math::PI / 180) % Math::PI\n else\n self * Math::PI / 180\n end\n end",
"def angle(x1, y1, x2, y2)\n end",
"def toRadians(degree)\n return degree*Math::PI/180\nend",
"def theta_deg\n theta_rad / DEG2RAD\n end",
"def deg2rad(angle)\n angle * (Math::PI / 180.0)\n end",
"def rotate(angle)\n primitive 'rotate ' + sprintf('%g', angle)\n end",
"def new_polar_deg( angle_deg, magnitude )\n self.new_polar( angle_deg * DEG_TO_RAD, magnitude )\n end",
"def degrees_to_radians(degrees)\n degrees * DEG_TO_RAD\n end",
"def rad\n x = self[0]\n y = self[1]\n if x >= 0 && y >= 0\n Math.atan( y.to_f/x )\n elsif x < 0 && y >= 0\n Math::PI + Math.atan( y.to_f/x )\n elsif x < 0 && y < 0\n Math::PI + Math.atan( y.to_f/x )\n else\n 2*Math::PI + Math.atan( y.to_f/x )\n end\n end",
"def angle(path)\n io_for(path).angle\n end",
"def angle\n Math.atan2(@y, @x)\n end",
"def +(other)\n return self.class.radians(@angle + other)\n end",
"def to_radians(n)\n r = n * (Math::PI / 180)\n return r\n end",
"def initialize(degree, arcminute=0, arcsecond=0)\n @degree = degree\n @arcminute = arcminute\n @arcsecond = arcsecond\n end",
"def angle\n v = to_vec\n if v[1] == 0.0\n nil\n else\n v.angle\n end\n end",
"def orthodrome_init_angle(lat1, lon1, lat2, lon2)\n dlon = (lon2 - lon1) * RAD_PER_DEG\n cola1 = Math.cos(lat1 * RAD_PER_DEG)\n sila1 = Math.sin(lat1 * RAD_PER_DEG)\n cola2 = Math.cos(lat2 * RAD_PER_DEG)\n sila2 = Math.sin(lat2 * RAD_PER_DEG)\n\n y = Math.sin(dlon) * cola2\n x = cola1 * sila2 - sila1 * cola2 * Math.cos(dlon)\n angle = Math.atan2(y,x)/RAD_PER_DEG # angle in degrees\n end",
"def rotate\n @angle += Math::PI / 16\n @angle = @angle % (Math::PI * 2)\n end",
"def to_s(unit = :radians)\n case unit\n when :degrees, :deg then \"#{@degrees}°\"\n when :radians, :rad then \"#@radians rad\"\n else\n raise InvalidArgumentsError, \"Unit should be :degrees, :deg, :radians ord :rad.\"\n end\n end",
"def angle(current, percent)\n\n range = Quadrant.angle_range_for(@bounds.quadrant(current))\n interp = Interpolate::Points.new({\n 0 => range.begin,\n 1 => range.end\n })\n\n interp.at(percent).to_i % 360\n end",
"def deg2rad(deg) \r\nreturn (deg * $pi / 180);\r\nend",
"def convertToRadians(val)\n return val * PIx / 180\n end",
"def convertToRadians(val)\n return val * PIx / 180\n end",
"def angle\n Math.atan2( @y, @x )\n end",
"def rotate(angle)\n case angle % 360\n when 0 then dup\n when 90 then rotate_cw\n when 180 then rotate_flip\n when 270 then rotate_ccw\n else\n raise RuntimeError, \"unsupported rotation angle #{angle}\"\n end\n end",
"def rotate_around!(degrees, origin=Point.empty)\n result = rotate_around(degrees, origin)\n @x = result.x\n @y = result.y\n return result\n end",
"def gradians\n self * Math::PI / 200.0\n end",
"def rotate( rad )\n ca = Math.cos( rad )\n sa = Math.sin( rad )\n Vector[ ca*x - sa*y, sa*x + ca*y ]\n end",
"def format_angle(value, unit)\n if unit == :degree\n value + '°'\n else\n value + ' gon'\n end\n end",
"def /(other)\n return self.class.radians(@angle / other)\n end",
"def convert_and_normalize_radians(angle)\n @radians = normalize_angle(angle, (2 * Math::PI))\n @degrees = rad_to_deg(@radians)\n end",
"def rotate_deg( angle_deg )\n dup.rotate_deg!( angle_deg )\n end",
"def rotate_around_origin(angle)\n sin_of_angle = Math.sin(angle)\n cos_of_angle = Math.cos(angle)\n\n Point.new(\n x * cos_of_angle - y * sin_of_angle,\n x * sin_of_angle + y * cos_of_angle\n )\n end",
"def rotate_around(degrees, origin=Point.empty)\n radians = degrees * Math::PI / 180\n x2 = x - origin.x\n y2 = y - origin.y\n\n cos = Math.cos(radians)\n sin = Math.sin(radians)\n\n return Point.new(\n x2*cos - y2*sin + origin.x,\n x2*sin + y2*cos + origin.y\n )\n end",
"def angle_rads \n\t\t\t2.0 * Math.atan2( self.vec.mag, self.scalar ) \n\t\tend",
"def angle x1, y1, a, m, c\n x2, y2 = project x1, y1, a, m\n line x1, y1, x2, y2, c\n end",
"def rotate(angle, *params)\n absolute_or_coord = params[0] || true\n mode_or_coord = params[1] || :degrees\n mode = params[2] || :degrees\n\n if absolute_or_coord.kind_of? Numeric\n raise TypeError(\"Second and third arguments should be numeric if using coordinates\") unless mode_or_coord.kind_of? Numeric\n if mode == :radians\n raise TypeError(\"#{angle} should be numeric if using with :radians mode\") unless angle.kind_of? Numeric\n angle = radians_to_degrees(angle)\n end\n @canvas << js_method('rotate', angle, absolute_or_coord, mode_or_coord)\n else\n if mode_or_coord == :radians\n raise TypeError(\"#{angle} should be numeric if using with :radians mode\") unless angle.kind_of? Numeric\n angle = radians_to_degrees(angle)\n end\n @canvas << js_method('rotate', angle, !!absolute_or_coord)\n end\n return self\n end",
"def angles\n [angle_a, angle_b, angle_c]\n end",
"def convert_and_normalize_degrees(angle)\n @degrees = normalize_angle(angle, 360)\n @radians = deg_to_rad(@degrees)\n end",
"def atan\n math :atan\n end",
"def rotate_around(degrees, origin=Point.empty)\n return self.to_point.rotate_around(degrees, origin)\n end",
"def polar\n theta = 0.0\n if Point.close_to(self.x, 0)\n if self.y > 0\n theta = 90.0\n elsif self.y < 0\n theta = 270.0\n end\n else\n theta = Point.rad2deg(Math.atan(self.y/self.x))\n if self.x < 0.0\n theta += 180.0\n end\n if theta < 0.0\n theta += 360.0\n end\n end\n theta\n end",
"def angle_deg_with( vector )\n angle_with(vector) * RAD_TO_DEG\n end",
"def deg2rad(deg)\n deg*Math::PI/180\n end",
"def radians()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::Radians::RadiansRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def calc_angle(hours, minutes)\n angel = (minutes * 6 - (hours * 60 + minutes) * 0.5).abs\n if angel > 180\n 360 - angel.abs\n else\n angel.abs\n end\nend",
"def initialize(options)\n if options.has_keys? [:norm, :orientation]\n @norm = options[:norm]\n case options[:orientation]\n when Science::Angle then @orientation = options[:orientation]\n else @orientation = options[:orientation].radians\n end\n calculate_components\n elsif options.has_keys? [:x, :y]\n @components = { x: options[:x], y: options[:y] }\n calculate_norm_and_orientation\n else\n raise InvalidArgumentsError, \"Options should contain :norm and :orientation or :x and :y.\"\n end\n end",
"def test_Complex_InstanceMethods_angle\n\t\tassert_equal(0.0, Complex(1, 0).angle)\n\t\tassert_equal(0.7853981633974483, Complex(1,1).angle)\n\t\tassert_equal(1.5707963267948966, Complex(0,1).angle)\n\tend",
"def rotate_around!(degrees, origin=Point.empty)\n result = self.to_point.rotate_around(degrees, origin)\n self.x = result.x\n self.y = result.y\n return result\n end",
"def orientation=(degrees)\n degrees = degrees % 360\n raise \"Invalid value for degrees. Must be a right angle (0, 90, 180, etc.)\" unless (degrees % 90 == 0)\n self.clear_relationship(:orientation)\n self.add_relationship(:orientation, DEGREES_TO_EXIF_ORIENTATIONS[degrees], true)\n return degrees # Hide RDF backing structure and make this look like a simple setter method\n end",
"def other_angle(a, b)\n 180 - (a + b)\nend",
"def other_angle(a, b)\n 180 - (a + b)\nend",
"def to_axis_angle\r\n half_angle = Math.acos(@real)\r\n sin_half_angle = Math.sin(half_angle)\r\n axis = (sin_half_angle.abs < 0.00000001)?\r\n Point3.new(1,0,0) : Point3.new(@axis).scale!(1.0/sin_half_angle)\r\n Quaternion.new(axis,2.0*half_angle)\r\n end",
"def initialize(lat, lng, type)\n case type\n when :DEG\n @latitude_deg = lat\n @longitude_deg = lng\n @latitude_rad = lat * DEG_TO_RAD\n @longitude_rad = lng * DEG_TO_RAD\n when :RAD\n @latitude_rad = lat\n @longitude_rad = lng\n @latitude_deg = lat / DEG_TO_RAD\n @longitude_deg = lng / DEG_TO_RAD\n else\n raise \"unknown coordinate type \\\"#{type}\\\"\"\n end \n end",
"def angle=(angle)\n c = @context__\n @view__.angle =\n c ? c.toAngle__(angle) : angle * Processing::GraphicsContext::RAD2DEG__\n angle\n end",
"def random_angle\n 360 * rand\n end",
"def ml_Aries() \r\n # jd = @ta * DJC # convert first term back to jdn - J2000\r\n # old terms \t\r\n # angle = (36000.770053608 / DJC + 360) * jd # 36000.770053608 = 0.9856473662862 * DJC\r\n # total = [ -1.0/3.8710000e7, 3.87930e-4, 0, 100.460618375 ].inject(0.0) {|p, a| p * ta[0] + a} + 180 + angle \r\n # newer terms seem to be in arcseconds / 15.0\r\n # 0.0000013, - 0.0000062, 0.0931118, 307.4771600, 8639877.3173760, 24110.5493771\r\n # angle = (35999.4888224 / DJC + 360) * jd \r\n # total = angle + 280.460622404583 +\r\n # @ta[ 0 ] * 1.281154833333 +\r\n # @ta[ 1 ] * 3.87965833333e-4 +\r\n # @ta[ 2 ] * -2.58333333333e-8 +\r\n # @ta[ 3 ] * 5.41666666666e-9\r\n # total = [5.41666666666e-9, -2.58333333333e-8, 3.87965833333e-4, 1.281154833333, 280.460622404583].inject(0.0) {|p, a| p * @ta + a} \r\n # mod_360( angle + total ) * D2R\r\n dt = 67.184 \r\n tt = @ajd + dt / 86400.0#Celes.ut1tt(@ajd, 0, dt)\r\n Celes.gmst06(@ajd, 0, tt, 0) \r\n end"
] |
[
"0.6892005",
"0.68631434",
"0.65866053",
"0.6382998",
"0.6376083",
"0.636931",
"0.6235788",
"0.622283",
"0.6215951",
"0.61803144",
"0.61582",
"0.6068199",
"0.6054293",
"0.60163283",
"0.6010951",
"0.60075235",
"0.59861964",
"0.5979657",
"0.5969036",
"0.593779",
"0.593302",
"0.5932475",
"0.5926696",
"0.5922226",
"0.59206295",
"0.59120256",
"0.5860003",
"0.5850787",
"0.58020437",
"0.58015436",
"0.57981527",
"0.57940733",
"0.5755103",
"0.5739092",
"0.57326627",
"0.56898326",
"0.5673348",
"0.5671871",
"0.56700593",
"0.56679976",
"0.56632316",
"0.5633109",
"0.5630997",
"0.56252235",
"0.5617577",
"0.56070995",
"0.5592064",
"0.55840427",
"0.5583988",
"0.55544436",
"0.55274886",
"0.5526002",
"0.5523433",
"0.5510349",
"0.5501395",
"0.5497119",
"0.54917586",
"0.5477297",
"0.54698944",
"0.5465232",
"0.5454097",
"0.5439509",
"0.5436797",
"0.54326606",
"0.5427914",
"0.5427914",
"0.5423627",
"0.5411425",
"0.5403985",
"0.5390299",
"0.5363922",
"0.5360846",
"0.5351081",
"0.53440326",
"0.53407335",
"0.5332346",
"0.53315544",
"0.5328819",
"0.5328695",
"0.5328501",
"0.5328437",
"0.53254914",
"0.53208506",
"0.53192353",
"0.53165615",
"0.53098553",
"0.52975833",
"0.5295209",
"0.52910554",
"0.52888364",
"0.5285753",
"0.528513",
"0.5280466",
"0.52778757",
"0.52743727",
"0.52710974",
"0.5262516",
"0.5258842",
"0.5250364",
"0.524911"
] |
0.7452839
|
0
|
the desired result. To check your work, run this file by entering the following command in your terminal: `ruby section2/exercises/methods.rb` Example: Write a method that when called will print your name:
|
def print_name
p "Severus Snape"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def print_name\n puts \"Will Meighan\"\nend",
"def print_name(name)\nputs \"Name: #{name}\"\nend",
"def print_name\n p \"Alexander Mathieu\"\nend",
"def print_name\r\nputs \"Person called #{@name}\"\r\nend",
"def print_name\n puts \"Person called #{@name}\" \n end",
"def print_name\n p \"Chris\"\nend",
"def print_name(name)\n p \"#{name}\"\nend",
"def print_name(name)\n p \"#{name}\"\nend",
"def print_name(name)\n p \"#{name}\"\nend",
"def print_name(name)\n p \"#{name}\"\nend",
"def print_name(name)\n p \"#{name}\"\nend",
"def print_name()\n puts \"Sidarth Bagawandoss\"\nend",
"def print_name(name)\n p \"#{name} is my name.\"\nend",
"def print_name(name)\n puts \"#{name}\"\nend",
"def print_name(name)\n puts \"#{name}\"\nend",
"def print_name(name)\n puts \"#{name}\"\nend",
"def print_name\n puts \"Person called #{@name}\"\n end",
"def print_name\n puts \"Bailey Diveley\"\nend",
"def print_name(name)\n puts (name) # YOUR CODE HERE\nend",
"def print_name\n p \"Jennica\"\nend",
"def print_name(name)\n puts \"My name is #{name}\"\nend",
"def print_name(name)\n puts name\nend",
"def print_name(name)\n puts name\nend",
"def print_name(name)\n puts name\nend",
"def print_name(name)\n puts name\nend",
"def print_name(name)\n puts name\nend",
"def print_name(name)\n puts name\nend",
"def print_name(name)\n puts name\nend",
"def print_name(name)\n puts name\nend",
"def print_name(name)\n puts name\nend",
"def print_name(name)\n puts name\nend",
"def print_name(name)\n puts name\nend",
"def print_name(name)\n puts name\nend",
"def print_name(name)\n puts name\nend",
"def print_name(name)\n puts name\nend",
"def print_name(name)\n puts name\nend",
"def print_name(name)\n puts name\nend",
"def print_name(name)\n puts name\nend",
"def print_name(name)\n puts name\nend",
"def print_name(name)\n puts name\nend",
"def print_name(name)\n puts name\nend",
"def print_name(name)\n p \"Name: #{name}\"\nend",
"def print_name(name)\n puts \"Hello #{name}.\"\nend",
"def print_it(name)\n puts \"#{name}\"# YOUR CODE HERE\nend",
"def print_name(name)\n # YOUR CODE HERE\n p name\nend",
"def print_name(name)\n # YOUR CODE HERE\n p name\nend",
"def print_name(name)\n p \"Hello #{name}.\"# YOUR CODE HERE\nend",
"def print_name\n puts \"Joshua Sherwood\"\nend",
"def print_name()\n p \"Severus Snape\"\nend",
"def print_name(name)\n puts \"My name is #{name}.\"\nend",
"def print_name(name)\n puts \"My name is #{name}.\"\nend",
"def print_name(name)\n puts name# YOUR CODE HERE\nend",
"def print_name\n p \"Elliott Stein\"\nend",
"def print_name\n p \"Joshua Tukman\"\nend",
"def print_name(name)\n puts \"my name is #{name}.\"\nend",
"def say_name\n puts \"#{name}\"\n end",
"def print_name(name)\n puts \"This is #{name}\"\nend",
"def print_name\n puts \"Severus Snape\"\nend",
"def say_my_name(name) # created method called \"say_my_name\" that takes an\n # arguement called name. Arguements allow you to pass data into methods. Methods can accept multiple arguements which can simply be seperated by commas.\n\n puts name # prints name\n\nend",
"def print_name\n puts \"Person called #{@name}\"\n end",
"def print_name(name)\n p \"Albus Dumbledore\"\nend",
"def print_name(name)\n puts \"Look there! It's #{name}!\"\nend",
"def print_name(name)\n p name\nend",
"def print_name(name)\n p name\nend",
"def print_name(name)\n p name\nend",
"def print_name(name)\n p name\nend",
"def print_name(name)\n p name\nend",
"def print_name(name)\n p name\nend",
"def print_name(name)\n p name\nend",
"def print_name(name)\n p name\nend",
"def print_name(name)\n p name\nend",
"def print_name(name)\n p name\nend",
"def print_name(name)\n p name\nend",
"def print_name(name)\n p name\nend",
"def print_name(name)\n p name\nend",
"def print_name(name)\n p name\nend",
"def print_name(name)\n p name\nend",
"def print_name(name)\n p name\nend",
"def print_name(name)\n p name\nend",
"def print_name(name)\n p name\nend",
"def print_name(name)\n puts \"Albus Dumbledore\"\nend",
"def print_name(arg1)\n # YOUR CODE HERE\n puts \"arg1: #{arg1}\"\nend",
"def print_name(name)\n p \"Your name is #{name}\"\nend",
"def print_name\n puts \"Name: #{@name}\"\n end",
"def print_name\n p \"Dee\"\nend",
"def print_name(name)\n p \"My name is #{name}\"\nend",
"def print_name\n puts ('Rob')\nend",
"def print()\n puts ( fullName() )\n fullName()\n end",
"def print_name\n print \"Person called #{@name}\"\n end"
] |
[
"0.7981318",
"0.79593337",
"0.7927941",
"0.7921451",
"0.7860017",
"0.7855943",
"0.7834982",
"0.7834982",
"0.7834982",
"0.7834982",
"0.7834982",
"0.78063095",
"0.7805286",
"0.7803275",
"0.7803275",
"0.7803275",
"0.77970177",
"0.77950853",
"0.7788758",
"0.7786055",
"0.7786028",
"0.7782918",
"0.7782918",
"0.7782918",
"0.7782918",
"0.7782918",
"0.7782918",
"0.7782918",
"0.7782918",
"0.7782918",
"0.7782918",
"0.7782918",
"0.7782918",
"0.7782918",
"0.7782918",
"0.7782918",
"0.7782918",
"0.7782918",
"0.7782918",
"0.7782918",
"0.7782918",
"0.7754944",
"0.77533895",
"0.77519095",
"0.7748008",
"0.7748008",
"0.7741491",
"0.77407795",
"0.77398115",
"0.7737831",
"0.7737831",
"0.7729754",
"0.7727239",
"0.77247477",
"0.77245855",
"0.77220637",
"0.7712523",
"0.76895183",
"0.7678188",
"0.7662317",
"0.76346594",
"0.76196605",
"0.76048476",
"0.76048476",
"0.76048476",
"0.76048476",
"0.76048476",
"0.76048476",
"0.76048476",
"0.76048476",
"0.76048476",
"0.76048476",
"0.76048476",
"0.76048476",
"0.76048476",
"0.76048476",
"0.76048476",
"0.76048476",
"0.76048476",
"0.76048476",
"0.7594235",
"0.7585223",
"0.75848573",
"0.75557613",
"0.75544775",
"0.75427574",
"0.7539385",
"0.75309145",
"0.7514451"
] |
0.0
|
-1
|
Write a method that takes a name as an argument and prints it:
|
def print_name(name)
p "#{name} is my name."
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def print_name(name)\n puts name\nend",
"def print_name(name)\n puts name\nend",
"def print_name(name)\n puts name\nend",
"def print_name(name)\n puts name\nend",
"def print_name(name)\n puts name\nend",
"def print_name(name)\n puts name\nend",
"def print_name(name)\n puts name\nend",
"def print_name(name)\n puts name\nend",
"def print_name(name)\n puts name\nend",
"def print_name(name)\n puts name\nend",
"def print_name(name)\n puts name\nend",
"def print_name(name)\n puts name\nend",
"def print_name(name)\n puts name\nend",
"def print_name(name)\n puts name\nend",
"def print_name(name)\n puts name\nend",
"def print_name(name)\n puts name\nend",
"def print_name(name)\n puts name\nend",
"def print_name(name)\n puts name\nend",
"def print_name(name)\n puts name\nend",
"def print_name(name)\n puts name\nend",
"def print_name(name)\n puts \"#{name}\"\nend",
"def print_name(name)\n puts \"#{name}\"\nend",
"def print_name(name)\n puts \"#{name}\"\nend",
"def print_name(name)\n p \"#{name}\"\nend",
"def print_name(name)\n p \"#{name}\"\nend",
"def print_name(name)\n p \"#{name}\"\nend",
"def print_name(name)\n p \"#{name}\"\nend",
"def print_name(name)\n p \"#{name}\"\nend",
"def print_name(name)\nputs \"Name: #{name}\"\nend",
"def print_name(name)\n puts \"Look there! It's #{name}!\"\nend",
"def print_name(name)\n puts \"Hello #{name}.\"\nend",
"def print_name(name)\n puts \"This is #{name}\"\nend",
"def print_name(name)\n p \"Name: #{name}\"\nend",
"def print_name(name)\n p name\nend",
"def print_name(name)\n p name\nend",
"def print_name(name)\n p name\nend",
"def print_name(name)\n p name\nend",
"def print_name(name)\n p name\nend",
"def print_name(name)\n p name\nend",
"def print_name(name)\n p name\nend",
"def print_name(name)\n p name\nend",
"def print_name(name)\n p name\nend",
"def print_name(name)\n p name\nend",
"def print_name(name)\n p name\nend",
"def print_name(name)\n p name\nend",
"def print_name(name)\n p name\nend",
"def print_name(name)\n p name\nend",
"def print_name(name)\n p name\nend",
"def print_name(name)\n p name\nend",
"def print_name(name)\n p name\nend",
"def print_name(name)\n p name\nend",
"def print_name(name)\n puts \"my name is #{name}.\"\nend",
"def print_name(name)\n puts \"My name is #{name}.\"\nend",
"def print_name(name)\n puts \"My name is #{name}.\"\nend",
"def print_name(name)\n puts \"My name is #{name}\"\nend",
"def print_name(name)\n puts (name) # YOUR CODE HERE\nend",
"def print_name(name)\n # YOUR CODE HERE\n p name\nend",
"def print_name(name)\n # YOUR CODE HERE\n p name\nend",
"def print_it(name)\n puts \"#{name}\"# YOUR CODE HERE\nend",
"def print_name(name)\n puts name# YOUR CODE HERE\nend",
"def print_name(name)\n puts \"Albus Dumbledore\"\nend",
"def print_name(arg1)\n puts \"#{arg1}\"\nend",
"def print_name(name)\n p \"Albus Dumbledore\"\nend",
"def print_name(name)\n puts ('Rob')\nend",
"def print_name(name)\n p \"My name is #{name}\"\nend",
"def print_name(arg1)\n # YOUR CODE HERE\n puts \"arg1: #{arg1}\"\nend",
"def print_name(name)\n p \"Hello #{name}.\"# YOUR CODE HERE\nend",
"def print_name(name)\n p \"Your name is #{name}\"\nend",
"def print_name(name)\n p \"Get out of my house #{name}!\"\nend",
"def print_name\r\nputs \"Person called #{@name}\"\r\nend",
"def print_name\n puts \"Person called #{@name}\"\n end",
"def print_name\n p \"Chris\"\nend",
"def say_name(name)\n puts \"My name is #{name}\"\n end",
"def print_name\n puts \"Person called #{@name}\" \n end",
"def print_name\n puts \"Name: #{@name}\"\n end",
"def print_name()\n p \"Severus Snape\"\nend",
"def print_name\n puts \"Will Meighan\"\nend",
"def print_name\n puts \"Person called #{@name}\"\n end",
"def print_name\n print \"Person called #{@name}\"\n end",
"def print_name()\n puts \"Sidarth Bagawandoss\"\nend",
"def say_name\n puts \"#{name}\"\n end",
"def print_name\n puts \"Severus Snape\"\nend",
"def print_name\n p \"Jennica\"\nend",
"def print_name\n p \"Elliott Stein\"\nend",
"def print_name\n puts ('Rob')\nend",
"def print_name(name)\n p \"BILLY!!!!!\"# YOUR CODE HERE\nend",
"def print_name\n p \"Dee\"\nend",
"def print_name\n p \"Alexander Mathieu\"\nend",
"def print_name\n p \"Severus Snape\"\nend",
"def print_name\n p \"Severus Snape\"\nend",
"def print_name\n p \"Severus Snape\"\nend",
"def print_name\n p \"Severus Snape\"\nend",
"def print_name\n p \"Severus Snape\"\nend",
"def print_name\n p \"Severus Snape\"\nend",
"def print_name\n p \"Severus Snape\"\nend",
"def print_name\n p \"Severus Snape\"\nend",
"def print_name\n p \"Severus Snape\"\nend",
"def print_name\n p \"Severus Snape\"\nend",
"def print_name\n p \"Severus Snape\"\nend",
"def print_name\n p \"Severus Snape\"\nend"
] |
[
"0.8691205",
"0.8691205",
"0.8691205",
"0.8691205",
"0.8691205",
"0.8691205",
"0.8691205",
"0.8691205",
"0.8691205",
"0.8691205",
"0.8691205",
"0.8691205",
"0.8691205",
"0.8691205",
"0.8691205",
"0.8691205",
"0.8691205",
"0.8691205",
"0.8691205",
"0.8691205",
"0.8686641",
"0.8686641",
"0.8686641",
"0.86739975",
"0.86739975",
"0.86739975",
"0.86739975",
"0.86739975",
"0.8567322",
"0.8561365",
"0.85212",
"0.8520563",
"0.8504922",
"0.850404",
"0.850404",
"0.850404",
"0.850404",
"0.850404",
"0.850404",
"0.850404",
"0.850404",
"0.850404",
"0.850404",
"0.850404",
"0.850404",
"0.850404",
"0.850404",
"0.850404",
"0.850404",
"0.850404",
"0.850404",
"0.84930426",
"0.84677976",
"0.84677976",
"0.8444104",
"0.84338194",
"0.8422609",
"0.8422609",
"0.8392489",
"0.8351485",
"0.8349661",
"0.8344462",
"0.83387876",
"0.827336",
"0.82319266",
"0.819851",
"0.818441",
"0.8183247",
"0.81732947",
"0.8119385",
"0.80626744",
"0.80515164",
"0.80513537",
"0.8033208",
"0.80116826",
"0.80094063",
"0.79897916",
"0.79880345",
"0.79860896",
"0.79841787",
"0.79786676",
"0.79449636",
"0.79447776",
"0.7924438",
"0.7902893",
"0.78972435",
"0.7892796",
"0.78845894",
"0.7882342",
"0.7882342",
"0.7882342",
"0.7882342",
"0.7882342",
"0.7882342",
"0.7882342",
"0.7882342",
"0.7882342",
"0.7882342",
"0.7882342",
"0.7882342"
] |
0.84173834
|
58
|
Write a method that takes in 2 numbers as arguments and prints their sum. Then call your method three times with different arguments passed in:
|
def summator(x, y)
p x + y
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def sum_these_numbers (a, b)\n puts a + b\nend",
"def two_sum(nums)\nend",
"def sum_these_numbers(a, b)\n puts a + b\nend",
"def sum_these_numbers(a,b)\n puts a + b\nend",
"def numbers(a, b)\n puts \"First number is #{a}\"\n puts \"Second number is #{b}\"\n return a + b\nend",
"def sum_nums(num1, num2)\n puts num1 + num2\nend",
"def sum_numbers (x, y, z)\n puts x + y + z\nend",
"def sum_numbers(num_1,num_2)\n puts \"The sum of #{num_1} and #{num_2} is #{num_1 + num_2}\"\nend",
"def sum_two_numbers(a, b)\n a + b\nend",
"def total(num1, num2)\n puts num1 + num2\nend",
"def sum_these_numbers(num1,num2)\n p num1 + num2\nend",
"def numbers(num1, num2)\n p num1 + num2\nend",
"def numbers(num1, num2)\n puts \"#{num1} + #{num2}\"\n return num1 + num2\nend",
"def sum_two_num(a, b)\n puts a + b\nend",
"def calc_sum_two(first, second)\n\n puts \"the sum of #{first} and #{second} is #{first + second}\"\n\nend",
"def numbers( num1 = 0, num2 = 0 )\n puts (num1 + num2)\nend",
"def sum_method(a, b)\n puts \"Adding #{a} + #{b}\"\n puts a + b\nend",
"def sum_these_numbers(num1, num2)\n num1 + num2\nend",
"def sum(num1, num2)\n puts num1 + num2\nend",
"def sum(numbers)\n # write your code here\nend",
"def add_two_numbers( x, y )\n puts x + y\nend",
"def add_two_numbers (x,y)\n puts x + y\nend",
"def get_sum(num1, num2)\n puts num1 + num2\nend",
"def add_two(num_one, num_two, num_three = 0, num_four = 0)\n puts 'Calculating....'\n num_one + num_two\nend",
"def sum(number_A, number_B)\n p number_A + number_B\nend",
"def add_two_numbers(x,y)\n puts x + y\nend",
"def sum(n1, n2)\n n1 + n2\nend",
"def sum(num1, num2)\n puts \"Really? #{num1 + num2} foxes?!\"\nend",
"def print_sum(num1, num2)\n p num1 + num2\nend",
"def add_numbers(number1, number2)\n return sum\nend",
"def sum2(n1, n2)\n puts n1+n2\nend",
"def sum (a, b)\n puts a + b\nend",
"def sum_numbers(x, y, z)\n\tx + y + z\nend",
"def total(num1, num2)\n num1 + num2\nend",
"def sum(num1, num2)\n num1 * num2\nend",
"def print_sum num1=0,num2=0\r\n\tputs num1 + num2\t\r\nend",
"def main\n one = first_number\n two = second_number\n addit(one, two)\nend",
"def sum(x, y) # 2 arguments\n p \"The sum of #{x} and #{y} is #{x + y}\"\n # p math.sum(sum_numbers) # This will not work because the arguments are not in an array\nend",
"def sum_numbers (numbers)\n # Your code here\nend",
"def sum(a, b)\n puts \"Sum total: #{a} + #{b} = #{10 + 20}\"\n\nend",
"def two_numbers(one, two)\n p \"This is the sum of #{one} and #{two}\"\nend",
"def first_method(num_1, num_2)\n puts num_1 + num_2\nend",
"def sum_two(num1, num2)\n p \"#{num1} + #{num2} = #{num1 + num2}\"\nend",
"def sum(*numbers) # numbers in this context of method body\n # represent the array of all the arguments that are going\n # to come into the method.\n sum = 0\n numbers.each { |num| sum += num }\n sum\nend",
"def sum(*numbers)\n sum = 0\n numbers.each { |number| sum += number }\n sum\nend",
"def sum_finder(num_1, num_2)\n p num_1 + num_2\nend",
"def sum_these_numbers(x,y)\n sum = x + y\n puts sum\nend",
"def sum_two(x, y)\n x + y\nend",
"def times_two(nums)\n # your code\nend",
"def sum(number1, number2)\ntotal = number1 + number2 \nend",
"def sum a, b\n a + b\nend",
"def sum_stuff(nums1, nums2)\n nums1.each do |num1|\n nums2.each do |num2|\n puts num1 + num2\n end\n end\nend",
"def multiply_numbers(first_num, second_num, third_num)\r\n\tproduct = first_num * second_num * third_num\r\n\tputs \"inside the method #{product}\"\r\nend",
"def sum(x, y)\n puts x + y\nend",
"def sumoftwonumbers(number1, number2)\n return number1 + number2\nend",
"def find_sum(num1, num2)\n puts num1 + num2\nend",
"def sum_it(num1, num2)\n return num1 + num2\nend",
"def addNums(first, second, *nums)\n sum = first + second\n p nums.inject(sum) {|sum,x| sum+x}\n\nend",
"def sum(num1, num2)\n return num1 + num2\nend",
"def oddball_sum(numbers)\n\nend",
"def sum_three_numbers(number1, number2, number3)\n return number1 + number2 + number3\nend",
"def sum (a, b)\n a + b\nend",
"def sum(a,b)\n a + b\nend",
"def sum a, b\n return a + b\nend",
"def print_sums(nums1, nums2)\n nums1.each do |num1|\n nums2.each do |num2|\n p num1 + num2\n end\n end\nend",
"def sum(a, b)\n a + b\nend",
"def sum(a, b)\n a + b\nend",
"def add(num_1, num_2)\n puts num_1 + num_2\nend",
"def add_three(number)\n number + 3\n number + 4 \nend",
"def sum(a,b)\n a + b \nend",
"def numbers(a, b)\n p \"#{a} + #{b}\"\n return a + b\nend",
"def sum(a,b)\n p a + b\nend",
"def add_nums(num1,num2)\n p num1 + num2\nend",
"def sum x,y \n puts x+y \nend",
"def add_numbers(num1, num2)\n p num1 + num2\nend",
"def sum_many(*numbers)\r\n\t#numbers is an array, so we can call and do array stuff\r\n\t#puts numbers.size\r\n\t#puts numbers.first\r\n\t#puts numbers.last\r\n\t#numbers.each {|num| puts num }\r\n\tnumbers.each do |num|\r\n\t\tprint num,\" \"\r\n\tend\r\n\tputs\r\n\t#puts numbers[1]\r\n\t#sum = 0\r\n\t#numbers.each{|num| sum += num }\r\n\t#sum\r\n\t#inject == accumulate\r\n\t#accumulute, sum || concatenation\r\n\tnumbers.inject(0) {|sum,num| sum+=num}\r\nend",
"def add(num_one,num_two)\n puts \"#{num_one} + #{num_two} = #{num_one + num_two}\"\nend",
"def sum(a, b)\n return a + b\nend",
"def sum(a, b)\n return a + b\nend",
"def sum3(x, y, z)\n x + y + z\nend",
"def add_sum(a, b)\n puts \"ADDING #{a} + #{b}\"\n return a + b\nend",
"def add(x,y)\n total = x + y\n puts total\n calculate(total)\nend",
"def add(*numbers) # The (*) asterick is used to handle methods which have a variable parameter list!!\n numbers.inject(0) { |sum, number| sum + number } \nend",
"def sum(x, y)\n puts \"The sum of #{x} + #{y} is:\"\n puts \"-> #{x+y}\"\nend",
"def multiple(num1,num2)\n\tnum1 * num2\nend",
"def two_method(x,y,z)\n\t\tx + y + z\nend",
"def add_three num1, num2, num3\n num1 + num2 + num3\nend",
"def sum(a, b)\n p a + b\nend",
"def sum(a, b)\n p a + b\nend",
"def add (num_one, num_two)\n num_one + num_two\nend",
"def sum(*arguments)\n sum = 0\n arguments.each {|arg| sum += arg}\n sum\nend",
"def add(num_one, num_two)\n num_one + num_two\nend",
"def maths2(firstNum, secondNum)\n total = firstNum + secondNum\n puts \"firstNum is #{firstNum}\"\n puts \"the secondnum is #{secondNum}\"\n puts \"and the total is #{total} \"\n puts firstNum\n puts secondNum\n puts total\n puts \"firstNum is firstNum\"\n puts \"the secondnum is secondNum\"\n puts \"and the total is total\"\nend",
"def multiply_sum_by_3rd_argument\n\n end",
"def add(a,b)\n puts \"Adding these numbers #{a}, #{b}\"\n a + b\n end",
"def add(n1:, n2:, n3:)\n n1 + n2 + n3\nend",
"def double(*numbers)\n numbers.each do |x|\n puts x * 2\n end\nend",
"def add_three num1, num2, num3\n\tnum1 + num2 + num3\n\nend",
"def add(n1,n2)\n\tn1+n2\nend",
"def add(num_1, num_2)\n p num_1 + num_2\nend",
"def add(number_1, number_2)\n p number_1 + number_2\nend"
] |
[
"0.7773777",
"0.7760679",
"0.77463275",
"0.7746314",
"0.7674677",
"0.7632542",
"0.7614532",
"0.7522872",
"0.75148404",
"0.75112593",
"0.7504093",
"0.7488711",
"0.74648464",
"0.7450623",
"0.7448441",
"0.74280834",
"0.7426093",
"0.73960274",
"0.7391773",
"0.73876697",
"0.73736435",
"0.73685175",
"0.7359695",
"0.7328834",
"0.73212874",
"0.7317641",
"0.7315022",
"0.7314882",
"0.73008615",
"0.72936654",
"0.7280394",
"0.72788024",
"0.72763187",
"0.7260824",
"0.7250964",
"0.72342813",
"0.72265613",
"0.720972",
"0.7192153",
"0.7191741",
"0.71815866",
"0.71772426",
"0.7174379",
"0.7162584",
"0.7154183",
"0.71541446",
"0.71388453",
"0.71362394",
"0.71320754",
"0.712411",
"0.7123309",
"0.7112203",
"0.70875615",
"0.70855427",
"0.70742404",
"0.70706457",
"0.7067223",
"0.7066184",
"0.70561534",
"0.7055028",
"0.7054198",
"0.7040299",
"0.7040067",
"0.7011297",
"0.70106035",
"0.7006023",
"0.7006023",
"0.6984909",
"0.6983436",
"0.6979717",
"0.6977374",
"0.69739586",
"0.6971392",
"0.69684386",
"0.69674325",
"0.69546777",
"0.6945972",
"0.6944538",
"0.6944538",
"0.6943815",
"0.6936574",
"0.6935137",
"0.69296116",
"0.69228935",
"0.6922727",
"0.6921896",
"0.6919763",
"0.69183546",
"0.69183546",
"0.6913951",
"0.69132537",
"0.69108576",
"0.69070923",
"0.69005156",
"0.68950135",
"0.68820065",
"0.68816215",
"0.6878272",
"0.687",
"0.68549323",
"0.6854877"
] |
0.0
|
-1
|
Write a method that takes in two strings as arguments and prints a concatenation of those two strings. Example: The arguments could be (man, woman) and the end result might output: "When Harry Met Sally". Then call your method three times with different arguments passed in.
|
def concat_str(str1, str2)
p str1 + str2
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def string_concat(name_1, name_2)\n puts \"I went to the concert with \" +name_1 + \" and \" + name_2 + \".\"\nend",
"def concatenation(word1, word2)\n puts \"Artist #{word1} just released their newest album, titled #{word2}.\"\nend",
"def two_strings(man, woman)\n p \"When \" + man + \" Met \" + woman\nend",
"def concatenation (blow_dryer_setting, male_first_name)\n puts \"but my friends call me #{blow_dryer_setting} #{male_first_name}\"\nend",
"def dog_names(name_1, name_2)\n puts \"The dogs are named #{name_1} and #{name_2}.\"\n puts \"It was hard to give up #{name_1} but we got #{name_2} right after.\"\n puts \"#{name_1} was a little crazy and #{name_2} is quite mature.\"\n puts \"We're not suppose to pick favoriets but I'd pick #{name_2} over #{name_1}.\"\n puts \"\" # Added this to create a space in between the different arguments.\n end",
"def concatenator(string1, string2)\n \"#{string1} #{string2}\"\nend",
"def car(s1, s2)\n puts \"#{s1} #{s2}\"\nend",
"def string_conc(dog, cat)\n p \"#{dog} #{cat} around the house.\"\nend",
"def car(str_1, str_2)\n \"#{str_1} #{str_2}\"\nend",
"def things(thing1, thing2)\n puts \"Hey can you get me #{thing1} and #{thing2}. Cool thanks\"\nend",
"def concatentation_method(lover1, lover2)\n puts \"#{lover1} loves #{lover2}\"\nend",
"def example(first_name, last_name)\n full_name = first_name + ' ' + last_name\n \"#{first_name} #{last_name}\"\nend",
"def string_add(string1, string2)\n puts \"#{string1} #{string2}\"\nend",
"def together(string, string2, string3)\n return \"#{string} #{string2} #{string3}\" \nend",
"def concat(name_1, name_2)\n puts \"Name 1: #{name_1} Name 2: #{name_2}\"\nend",
"def two_strings(string_1, string_2)\n p \"When \" + string_1 + \" met \" + string_2 + \".\"\nend",
"def combine_name(first_name, last_name)\n # Q3 CODE HERE\n return \"#{first_name} #{last_name}\"\nend",
"def thing(fave_one, fave_two, fave_three)\n \"I love that #{fave_two} too!\"\nend",
"def greet name, name2\n puts \"Hello, #{name} and #{name2} how are you all doing today?\"\nend",
"def names(arg1, arg2)\n puts \"man: #{arg1}, woman: #{arg2}\"\n puts \"when #{arg1} met #{arg2}\"\n puts \"#{arg1} is much funnier than #{arg2}\"\nend",
"def say_hello name1=\"oscar\", name2=\"shane\"\n\t\"hello, #{name1} and #{name2}\"\nend",
"def car(first_name, second_name)\n puts \"#{first_name} #{second_name}\"\nend",
"def say_hello name1=\"Oscar\", name2=\"Shane\"\n \"hello, #{name1} and #{name2}\"\nend",
"def names(name1, name2)\n puts \"Huge announcement today! #{name1} climbed #{name2}! Congratulations!\"\nend",
"def join_strings(parameter1, parameter2)\r\n\treturn parameter1 + \" \" + parameter2\r\nend",
"def cheese_and_crackers(cheese_count, boxes_of_crackers)\n# Printing first argument using string interpolation\n puts \"You have #{cheese_count} cheeses!\"\n# Printing second argument using string interpolation\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n# Printing string\n puts \"Man that's enough for a party!\"\n# Printing string with newline character\n puts \"Get a blanket.\\n\"\n# Ending function\nend",
"def say_hello name1, name2 #pass parameters just like any other language. If you have lots of parameters, use Parentheses for readability (keep the code clean)\n puts \"Hello, #{name1} and #{name2}\"\nend",
"def cool_dude(arg1=\"Miles\", arg2=\"Coltrane\", arg3=\"Roach\")\n \"#{arg1}, #{arg2}, #{arg3}\"\nend",
"def sayHello( name=\"Stranger\", adjective=\"stinky\" )\n puts \"Hello #{ adjective } #{ name }\"\n \"hotdogs hotdogs hotdogs\"\nend",
"def car(*args)\n puts \"#{args.join(', ')}\"\nend",
"def string_argument(drink1, drink2)\n p \"My favorite drink is #{drink1}, but I really like #{drink2} too\"\nend",
"def concat(human, dog)\n p \"When #{human} walks #{dog}, there is never a dull moment.\"\nend",
"def do_something this,that,other\n puts \"We,I mean I ,am doing,er ,something!\"\nend",
"def print_two_agian(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def good_recipes(arg1, *rest)\n \"The deserts will be #{arg1} and #{rest.join(', ')}\" # the string has embedded two variables, the second variable 'rest' is defined by the 'join' method, which is basicly saying, join the rest of the strings with a comma and a space\nend",
"def join_strings(string_1, string_2)\n \"#{string_1} #{string_2}\"\nend",
"def method1 arg1, arg2\n return \"#{arg1} #{arg2}\"\nend",
"def full_name(first_name, last_name)\n puts \"Your full name is #{first_name + \" \" + last_name}.\"\nend",
"def join_strings(a, b)\n a + \" \" + b\nend",
"def two_more_things (arg1, arg2)\n puts \"arg1:#{arg1}, arg2:#{arg2}\"\nend",
"def say_hello3(name1=\"oscar\", name2=\"shane\")\n \"hello, #{name1} and #{name2}\"\nend",
"def join_strings(text_1, text_2)\n text_1 + \" \" + text_2\nend",
"def say_hello_3 name1=\"Bill\", name2=\"Ted\"\n \"hello, #{name1} and #{name2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1 #{arg1}, arg2: #{arg2}\"\nend",
"def say_hello2(name1=\"oscar\", name2=\"shane\")\n puts \"hello, #{name1} and #{name2}\"\nend",
"def two_arg_method(arg1, arg2)\n puts \"Here are my args: #{arg1}, #{arg2}\"\nend",
"def join_strings(first_string, second_string)\n\n joint_string = first_string + ' ' + second_string\n\n return(joint_string)\n\nend",
"def print_two_again(arg1, arg2) # Non-variable list of inputs it will accept\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two(thing, another_thing)\n\tputs \"thing 1: #{thing}, thing 2: #{another_thing}\"\nend",
"def complete_sentence(animal1, animal2)\n p \"The #{animal1} chased the #{animal2}\"\nend",
"def cheese_and_crackers(cheese_count, boxes_of_crackers)\n # Print string and the cheese_count argument using string interpolation\n puts \"You have #{cheese_count} cheeses!\"\n # Print string and the boxes_of_crackers argument using string interpolation\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n # Print string\n puts \"Man that's enough for a party!\"\n # Print string with a line break at the end\n puts \"Get a blanket.\\n\"\n# End method\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1; #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1; #{arg1}, arg2: #{arg2}\"\nend",
"def my_method2 argument1, argument2\n print argument1, \" \", argument2, \"\\n\" \n end",
"def puts_two(*args) #define \"method name\" \n\targ1, arg2 = args\n\tputs \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg2}, arg2:#{arg2}\"\nend",
"def print(destination1, destinantion2)\n puts \"I am going to #{destination1} and #{destinantion2} this summer!\"\nend",
"def cool_dude(arg1=\"Miles\", arg2=\"Coltrane\", arg3=\"Rose\")\n\t\"#{arg1}, #{arg2}, #{arg3}\"\nend",
"def print_two_again(arg1, arg2)\n\tputs \"arg1 : #{arg1}, arg2 : #{arg2}\"\nend",
"def join_strings(word_1, word_2)\n join_strings=\"#{word_1} #{word_2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, args2: #{arg2}\"\nend",
"def strings(team1, team2)\n p \"I think the #{team1} are better than the #{team2}.\"\nend",
"def print_two_again(arg1,arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\n end",
"def print_two_again(arg1, arg2)\n\tputs \"arg1 #{arg1}, arg2: #{arg2}\"\nend",
"def concat(school, person, program)\n return person + \" wants to go to \" + school + \" for \" + program + \".\"\nend",
"def concatenate(strings)\n\nend",
"def an_argument(*arguments)\n return \"You didn't give me any arguments.\" if arguments == []\n string = \"You gave me #{arguments.size} argument\"\n arguments.size == 1 ? string << \" and it is \" : string << \"s and they are \"\n if arguments.size > 1\n last = arguments.last\n arguments.pop\n end\n arguments.each {|argument| string << \"\\\"#{argument}\\\", \"}\n !last.nil? ? string.chop.chop<< \" and \\\"#{last}\\\".\" : string.chop.chop << \".\"\nend",
"def beam_me_up(person1, person2)\n \"The away team consists of #{person1} and #{person2}.\"\nend",
"def print_two_again(arg1,arg2)\n puts \"arg1: #{arg1},arg2: #{arg2}\"\n end",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def do_something this , that ,other\n puts \"We , I mean I ,am doing ,er , something!\"\nend",
"def print_two_again(arg1, arg2)\n\n # whatever the value for arg1 is, print it to the screen\n # whatever the value of arg2 is, print it on the screen\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\n\n #end the method\nend",
"def getFullName(arg1=\"Barton\", arg2=\"Joey\")\n \"#{arg1}, #{arg2}\"\nend",
"def puts_two(*args)\n arg1, arg2 = args\n puts \"wth 1 #{arg1} 2 #{arg2}\"\n arg2 = arg2 + 1\n arg1 = arg1 + \"woots\"\nend",
"def do_something this, that, other\n puts \"We, I mean I, am doing, er, something!\"\nend"
] |
[
"0.79055405",
"0.78413045",
"0.75947124",
"0.74779415",
"0.7411419",
"0.73758453",
"0.73172253",
"0.730744",
"0.7302126",
"0.72814775",
"0.7260351",
"0.72505903",
"0.7204876",
"0.7182308",
"0.71699727",
"0.71513385",
"0.71478766",
"0.7142378",
"0.7102632",
"0.70819914",
"0.70744354",
"0.706517",
"0.70059735",
"0.70033145",
"0.6996377",
"0.6981388",
"0.69772404",
"0.69761205",
"0.69722855",
"0.6956503",
"0.69426227",
"0.6931864",
"0.692658",
"0.69030416",
"0.6891844",
"0.6887019",
"0.6879231",
"0.6856353",
"0.68558854",
"0.68539804",
"0.6852552",
"0.68251324",
"0.68239504",
"0.6821871",
"0.68200487",
"0.6817302",
"0.6816778",
"0.6815347",
"0.6814701",
"0.68137723",
"0.6800001",
"0.6791472",
"0.6791472",
"0.67877835",
"0.67832625",
"0.677861",
"0.6774954",
"0.67723995",
"0.6769238",
"0.67635614",
"0.6761509",
"0.6758578",
"0.67537946",
"0.6751238",
"0.67504466",
"0.67470276",
"0.6745358",
"0.6739612",
"0.6735043",
"0.67243886",
"0.67205286",
"0.67205286",
"0.67205286",
"0.67205286",
"0.67205286",
"0.67205286",
"0.67205286",
"0.67205286",
"0.67205286",
"0.67205286",
"0.67205286",
"0.67205286",
"0.67205286",
"0.67205286",
"0.67205286",
"0.67205286",
"0.67205286",
"0.67205286",
"0.67205286",
"0.67205286",
"0.67205286",
"0.67205286",
"0.67205286",
"0.67205286",
"0.67205286",
"0.6713152",
"0.67102176",
"0.6709196",
"0.6708171",
"0.6700072"
] |
0.6807772
|
50
|
Update properties of this object
|
def update!(**args)
@id = args[:id] unless args[:id].nil?
@message = args[:message] unless args[:message].nil?
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
|
Update properties of this object
|
def update!(**args)
@id = args[:id] unless args[:id].nil?
@labels_added = args[:labels_added] unless args[:labels_added].nil?
@labels_removed = args[:labels_removed] unless args[:labels_removed].nil?
@messages = args[:messages] unless args[:messages].nil?
@messages_added = args[:messages_added] unless args[:messages_added].nil?
@messages_deleted = args[:messages_deleted] unless args[:messages_deleted].nil?
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
|
Update properties of this object
|
def update!(**args)
@label_ids = args[:label_ids] unless args[:label_ids].nil?
@message = args[:message] unless args[:message].nil?
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
|
Update properties of this object
|
def update!(**args)
@label_ids = args[:label_ids] unless args[:label_ids].nil?
@message = args[:message] unless args[:message].nil?
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
|
Update properties of this object
|
def update!(**args)
@message = args[:message] unless args[:message].nil?
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
|
Update properties of this object
|
def update!(**args)
@message = args[:message] unless args[:message].nil?
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
|
Update properties of this object
|
def update!(**args)
@id = args[:id] unless args[:id].nil?
@label_list_visibility = args[:label_list_visibility] unless args[:label_list_visibility].nil?
@message_list_visibility = args[:message_list_visibility] unless args[:message_list_visibility].nil?
@messages_total = args[:messages_total] unless args[:messages_total].nil?
@messages_unread = args[:messages_unread] unless args[:messages_unread].nil?
@name = args[:name] unless args[:name].nil?
@threads_total = args[:threads_total] unless args[:threads_total].nil?
@threads_unread = args[:threads_unread] unless args[:threads_unread].nil?
@type = args[:type] unless args[:type].nil?
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
|
Update properties of this object
|
def update!(**args)
@drafts = args[:drafts] unless args[:drafts].nil?
@next_page_token = args[:next_page_token] unless args[:next_page_token].nil?
@result_size_estimate = args[:result_size_estimate] unless args[:result_size_estimate].nil?
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
|
Update properties of this object
|
def update!(**args)
@history = args[:history] unless args[:history].nil?
@history_id = args[:history_id] unless args[:history_id].nil?
@next_page_token = args[:next_page_token] unless args[:next_page_token].nil?
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
|
Update properties of this object
|
def update!(**args)
@labels = args[:labels] unless args[:labels].nil?
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
|
Update properties of this object
|
def update!(**args)
@messages = args[:messages] unless args[:messages].nil?
@next_page_token = args[:next_page_token] unless args[:next_page_token].nil?
@result_size_estimate = args[:result_size_estimate] unless args[:result_size_estimate].nil?
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
|
Update properties of this object
|
def update!(**args)
@next_page_token = args[:next_page_token] unless args[:next_page_token].nil?
@result_size_estimate = args[:result_size_estimate] unless args[:result_size_estimate].nil?
@threads = args[:threads] unless args[:threads].nil?
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
|
Update properties of this object
|
def update!(**args)
@history_id = args[:history_id] unless args[:history_id].nil?
@id = args[:id] unless args[:id].nil?
@internal_date = args[:internal_date] unless args[:internal_date].nil?
@label_ids = args[:label_ids] unless args[:label_ids].nil?
@payload = args[:payload] unless args[:payload].nil?
@raw = args[:raw] unless args[:raw].nil?
@size_estimate = args[:size_estimate] unless args[:size_estimate].nil?
@snippet = args[:snippet] unless args[:snippet].nil?
@thread_id = args[:thread_id] unless args[:thread_id].nil?
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
|
Update properties of this object
|
def update!(**args)
@body = args[:body] unless args[:body].nil?
@filename = args[:filename] unless args[:filename].nil?
@headers = args[:headers] unless args[:headers].nil?
@mime_type = args[:mime_type] unless args[:mime_type].nil?
@part_id = args[:part_id] unless args[:part_id].nil?
@parts = args[:parts] unless args[:parts].nil?
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
|
Update properties of this object
|
def update!(**args)
@attachment_id = args[:attachment_id] unless args[:attachment_id].nil?
@data = args[:data] unless args[:data].nil?
@size = args[:size] unless args[:size].nil?
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
|
Update properties of this object
|
def update!(**args)
@name = args[:name] unless args[:name].nil?
@value = args[:value] unless args[:value].nil?
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
|
Update properties of this object
|
def update!(**args)
@add_label_ids = args[:add_label_ids] unless args[:add_label_ids].nil?
@remove_label_ids = args[:remove_label_ids] unless args[:remove_label_ids].nil?
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
|
Update properties of this object
|
def update!(**args)
@add_label_ids = args[:add_label_ids] unless args[:add_label_ids].nil?
@remove_label_ids = args[:remove_label_ids] unless args[:remove_label_ids].nil?
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
|
Update properties of this object
|
def update!(**args)
@email_address = args[:email_address] unless args[:email_address].nil?
@history_id = args[:history_id] unless args[:history_id].nil?
@messages_total = args[:messages_total] unless args[:messages_total].nil?
@threads_total = args[:threads_total] unless args[:threads_total].nil?
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
|
Update properties of this object
|
def update!(**args)
@history_id = args[:history_id] unless args[:history_id].nil?
@id = args[:id] unless args[:id].nil?
@messages = args[:messages] unless args[:messages].nil?
@snippet = args[:snippet] unless args[:snippet].nil?
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
|
Update properties of this object
|
def update!(**args)
@label_filter_action = args[:label_filter_action] unless args[:label_filter_action].nil?
@label_ids = args[:label_ids] unless args[:label_ids].nil?
@topic_name = args[:topic_name] unless args[:topic_name].nil?
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
|
Update properties of this object
|
def update!(**args)
@expiration = args[:expiration] unless args[:expiration].nil?
@history_id = args[:history_id] unless args[:history_id].nil?
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
|
Return symbol name for supported digest algorithms and string name for custom ones.
|
def digest_algorithm
@digester.symbol || @digester.digest_name
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def signature_digest_algorithm\n @sign_digester.symbol || @sign_digester.digest_name\n end",
"def digest_name(name)\n Digest::SHA2.hexdigest(short_name(name))[0..24]\n end",
"def to_sym\n name\n end",
"def digest_short_name(name)\n Digest::SHA2.hexdigest(name)[0..24]\n end",
"def openssl_name\n CipherSuites::OPENSSL_NAMES[rfc_name]\n end",
"def name\n [@n.to_s + character.to_s, symmetry].reject{|p| p == \"\"}.join(\"_\")\n end",
"def sym\n @name.to_sym\n end",
"def to_sym\n @name\n end",
"def signing_algorithm\n signing_key.is_a?(String) ? \"HS256\" : \"RS256\"\n end",
"def algorithm_name\n raise NotImplementedError\n end",
"def symbol_suffix\n \"\"\n end",
"def to_sym\n @name.to_sym\n end",
"def sym(name)\n SymEngine::Symbol.new(name)\nend",
"def algorithm\n attributes.fetch(:algorithm) do\n Ably::Util::Crypto::DEFAULTS.fetch(:algorithm)\n end.downcase\n end",
"def key_algorithm\n if self.rsa?\n \"RSA\"\n elsif self.dsa?\n \"DSA\"\n end\n end",
"def to_sym() end",
"def to_sym() end",
"def to_sym() end",
"def os_family_sym\n os_parser.family_sym\n end",
"def name\n \"#{self[:asn]} #{self[:vrf]} #{self[:afi]} #{self[:safi]} #{self[:aa]}\"\n end",
"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 calc_project_symbol project_name\n name = project_name.to_s.gsub(/\\W+/, '_').squeeze('_').gsub(/^_|_$/, '')\n (name[0,1].upcase + name[1..-1]).to_sym\n end",
"def os_sym\n os_parser.sym\n end",
"def name_sym\n @name_sym ||= name.downcase.to_sym\n end",
"def symbolidentifier\n\n \t\n\t\tif @usersym.upcase == \"X\" then \n\t\t @compsym = \"O\" \n \t\t else \n \t\t @compsym = \"X\"\n \t\tend \n\n\n end",
"def key_algorithm\n if self.rsa?\n :rsa\n elsif self.dsa?\n :dsa\n elsif self.ec?\n :ec\n end\n end",
"def default_key \n Digest::SHA1.hexdigest(\"riaque:#{name}\")\n end",
"def symbol\n # prefer a code display value since the state name may not be unique between modules\n if !@codes.nil? && !@codes.empty?\n @codes.first.display.gsub(/\\s+/, '_').downcase.to_sym\n else\n @name.gsub(/\\s+/, '_').downcase.to_sym\n end\n end",
"def symbol\n # prefer a code display value since the state name may not be unique between modules\n if !@codes.nil? && !@codes.empty?\n @codes.first.display.gsub(/\\s+/, '_').downcase.to_sym\n else\n @name.gsub(/\\s+/, '_').downcase.to_sym\n end\n end",
"def algorithm\n \"HS256\"\n end",
"def name\n GCODE_DICTIONARY[cmd.to_sym] || :unknown\n end",
"def symbol\n Util.from_bytes :symbol, value\n end",
"def bin_sym\n @underscored_name ||= name.split('::').last.gsub(/([a-z\\d])([A-Z])/, '\\1_\\2').downcase.to_sym\n end",
"def ext_sym(name)\r\n return name if name.kind_of?(Symbol)\r\n return ext_name(name).to_sym\r\n end",
"def supported_algorithms\n {\n None: [],\n SHA: %w{HS256 HS384 HS512},\n RSA: %w{RS256 RS384 RS512},\n ESDSA: %w{ES256 ES384 ES512}\n }\n end",
"def crypto_hash(name, digest_class)\n digest_length = digest_class.digest('').length\n\n defines = Proc.new do \n define_method :\"#{name}\" do |data|\n data = data.pack 'C*' unless data.kind_of? String\n digest_class.digest(data).unpack 'C*'\n end\n define_method(:\"#{name}_digest_class\") { digest_class }\n define_method(:\"#{name}_length\") { digest_length }\n end\n \n @target.class_eval(&defines)\n (class << @target; self; end).module_eval(&defines) \n end",
"def to_s\n \"#{symbol}\"\n end",
"def identify_hash(hash)\n hash = hash.to_s.strip\n case\n # operating systems\n when hash.start_with?('$1$') && hash.length == 34\n return 'md5'\n when hash.start_with?('$2$') && hash.length == 59,\n hash.start_with?('$2a$') && hash.length == 60,\n hash.start_with?('$2b$') && hash.length == 60,\n hash.start_with?('$2x$') && hash.length == 60,\n hash.start_with?('$2y$') && hash.length == 60\n return 'bf' #bcrypt\n when hash.start_with?('$5$') && hash.split('$').last.length == 43\n # we dont check full length since it may have 'rounds=' in the [1] area or not with an arbitrary length number\n return 'sha256,crypt'\n when hash.start_with?('$6$') && hash.split('$').last.length == 86\n # we dont check full length since it may have 'rounds=' in the [1] area or not with an arbitrary length number\n return 'sha512,crypt'\n when hash.start_with?('@S@') && hash.length == 148\n return 'qnx,sha512'\n when hash.start_with?('@s@') && hash.length == 84\n return 'qnx,sha256'\n when hash.start_with?('@m@') && hash.length == 52\n return 'qnx,md5'\n when hash.start_with?('_') && hash.length == 20\n return 'des,bsdi,crypt'\n when hash =~ /^[\\.\\/\\dA-Za-z]{13}$/ # hash.length == 13\n return 'des,crypt'\n when hash =~ /^\\$dynamic_82\\$[\\da-f]{128}\\$HEX\\$[\\da-f]{32}$/ # jtr vmware ldap https://github.com/rapid7/metasploit-framework/pull/13865#issuecomment-660718108\n return 'dynamic_82'\n when hash.start_with?(/{SSHA}/i)\n return 'ssha'\n when hash.start_with?(/{SHA512}/i)\n return 'raw-sha512'\n when hash.start_with?(/{SHA}/i)\n return 'raw-sha1'\n when hash.start_with?(/{MD5}/i)\n return 'raw-md5'\n when hash.start_with?(/{SMD5}/i)\n return 'smd5'\n when hash.start_with?(/{SSHA256}/i)\n return 'ssha256'\n when hash.start_with?(/{SSHA512}/i)\n return 'ssha512'\n # windows\n when hash.length == 65 && hash =~ /^[\\da-fA-F]{32}:[\\da-fA-F]{32}$/ && hash.split(':').first.upcase == 'AAD3B435B51404EEAAD3B435B51404EE'\n return 'nt'\n when hash.length == 65 && hash =~ /^[\\da-fA-F]{32}:[\\da-fA-F]{32}$/\n return 'lm'\n # OSX\n when hash.start_with?('$ml$') && hash.split('$').last.length == 256\n return 'pbkdf2-hmac-sha512,osx' # 10.8+\n when hash =~ /^[\\da-fA-F]{48}$/ # hash.length == 48\n return 'xsha,osx' # 10.4-10.6\n # databases\n when hash.start_with?('0x0100') && hash.length == 54\n return 'mssql05'\n when hash.start_with?('0x0100') && hash.length == 94\n return 'mssql'\n when hash.start_with?('0x0200') && hash.length == 142\n return 'mssql12'\n when hash =~ /^[\\da-f]{16}$/ # hash.length == 16\n return 'mysql' # mysql323 (pre 4.1)\n when hash.start_with?('*') && hash.length == 41\n return 'mysql-sha1' # mysql 4.1+\n when hash.start_with?('md5') && hash.length == 35\n return 'postgres'\n when hash =~ /^[\\da-fA-F]{16}$/\n return 'des,oracle' # pre 11g\n when hash =~ /^S:[\\dA-F]{60}$/\n return 'raw-sha1,oracle11'\n when hash =~ /^S:[\\dA-F]{60};H:[\\dA-F]{32};T:[\\dA-F]{160}$/\n return 'raw-sha1,oracle'\n when hash =~ /^H:[\\dA-F]{32};T:[\\dA-F]{160}$/\n return 'pbkdf2,oracle12c'\n # webapps\n when hash.start_with?('$P$') && hash.length == 34,\n hash.start_with?('$H$') && hash.length == 34\n return 'phpass' # wordpress, drupal, phpbb3 (H not P)\n when hash.start_with?('$ml$') && hash.length == 203\n return 'PBKDF2-HMAC-SHA512'\n when hash.start_with?('{PKCS5S2}') && hash.length == 73\n return 'PBKDF2-HMAC-SHA1'\n when hash.start_with?('$B$') && hash.split('$').last.length == 32\n return 'mediawiki'\n # mobile\n when hash =~/^[A-F0-9]{40}:[a-f0-9]{16}$/\n return 'android-sha1'\n when hash =~/^[A-F0-9]{32}:[a-f0-9]{16}$/\n return 'android-md5'\n # other\n when hash =~ /^<\\d+@.+?>#[\\w]{32}$/\n return 'hmac-md5'\n when hash.length == 114 && hash.start_with?('$M$')\n return 'F5-Secure-Vault'\n when hash =~ /^M\\$[[:print:]]+#[\\da-fA-F]{32}(?:(?::[[:print:]]*$)|$)/\n return 'mscash'\n when hash =~ /^\\$DCC2\\$\\d+#[[:print:]]+#[\\da-fA-F]{32}(?:(?::[[:print:]]*$)|$)/\n return 'mscash2'\n end\n ''\nend",
"def digest_class\n Digest::SHA256\n end",
"def digest_class\n Digest::SHA256\n end",
"def _unique_name\n string = aliases.split(\",\").sort_by{|x| x.downcase}.join(\", \")\n Digest::SHA1.hexdigest string\n end",
"def to_sym; end",
"def key\n key = self.name\n key = Economic::Support::String.demodulize(key)\n key = Economic::Support::String.underscore(key)\n key.intern\n end",
"def symbol_for_name(name)\n if symbols.has_key? name\n symbols[name]\n else\n raise \"No symbol with name #{name} found\"\n end\n end",
"def getname\n return @name.to_sym\n end",
"def fingerprint(algorithm = 'sha256')\n message_digest = R509::MessageDigest.new(algorithm)\n md = message_digest.digest\n md.update(@cert.to_der)\n md.to_s\n end",
"def salted_name\n [api_name,rand_salt].join('--')\n end",
"def hash_proc_4symstr\n @hash_proc_4symstr ||= proc do |hash, key|\n case key\n when String\n tmp = key.to_sym\n hash.key?(tmp) ? hash[tmp] : nil\n when Symbol\n tmp = key.to_s\n hash.key?(tmp) ? hash[tmp] : nil\n end\n end\n end",
"def name\n \"#{self[:asn]} #{self[:vrf]} #{self[:neighbor]} #{self[:afi]} \" \\\n \"#{self[:safi]}\"\n end",
"def key_algorithm\n if @req.public_key.kind_of? OpenSSL::PKey::RSA then\n 'RSA'\n elsif @req.public_key.kind_of? OpenSSL::PKey::DSA then\n 'DSA'\n end\n end",
"def digest_hash_function\n decode[:hash_function]\n end",
"def name_sym\n self.__enum_name__.to_sym\n end",
"def computed_name(context)\n @_name ||= case @name\n when String\n @name\n when Symbol\n context.public_send(@name) # todo\n when Proc\n context.instance_exec(&@name)\n when nil\n computed_path(context)\n else\n raise ArgumentError,\n \"Expected one of String, Symbol, or Proc, \" \\\n \"got #{@name.class}\"\n end\n end",
"def to_sym\n @name&.to_sym\n end",
"def to_sym\n \tname.downcase.gsub(/\\s+/, \"_\").to_sym\n end",
"def namehash(name)\n node = '0' * 64\n if (name != '')\n name.split('.').reverse.each do |label|\n node = sha3(node + sha3(label),encoding: :hex);\n end\n end\n '0x'+node\n end",
"def name\n [cc_type, last_digits].join(' - ')\n end",
"def hash\n name.hash ^ provider.hash\n end",
"def to_sym() name_singular.to_sym end",
"def code_name(code)\n Codes.code_symbol(code)\n end",
"def browser_family_sym\n browser_parser.family_sym\n end",
"def rfc_name\n RFC_NAMES[name]\n end",
"def default_hash_function(plain_token)\n ::Digest::SHA256.hexdigest plain_token\n end",
"def jwa_alg\n # https://tools.ietf.org/html/rfc7518#section-3.1\n # HMAC using SHA-256\n 'HS256'\n end",
"def document_symbol_provider\n attributes.fetch(:documentSymbolProvider)\n end",
"def to_s\n return self.symbol\n end",
"def to_ruby\n @name.to_s.to_sym\n end",
"def to_standardized_sym\n standardize\n .to_sym\n end",
"def digest_key(digest)\n \"asset-uri-digest:#{compressed_path}:#{digest}\"\n end",
"def symbol_by_name(name)\n each_symbols.find { |symbol| symbol.name == name }\n end",
"def calc_program_name project_symbol\n camel_to_snake_case(project_symbol).downcase\n end",
"def gem_signature(gem_full_name)\n Digest::SHA256.new(@gems[gem_full_name].to_yaml).to_s\n end",
"def symbol(string)\n Types::Symbol.cast(string)\n end",
"def digester(type=nil)\n require 'openssl'\n case type.to_s.downcase\n when 'md5'\n require 'digest/md5'\n ::Digest::MD5\n when 'sha128', 'sha1'\n require 'digest/sha1' #need?\n OpenSSL::Digest::SHA1\n when 'sha256'\n require 'digest/sha1' #need?\n OpenSSL::Digest::SHA256\n when 'sha512'\n require 'digest/sha1' #need?\n OpenSSL::Digest::SHA512\n else\n raise \"unsupported digest #{type}\"\n end\n end",
"def name_significance #adding an instance method\n parts = self.split( '-' )\n syllables = @@syllables.dup\n signif = parts.collect do |p|\n syllables.shift[p]\n end\n signif.join( ' ' )\n end",
"def key\n (key_name || name).to_sym\n end",
"def fingerprint(algorithm='sha1')\n message_digest = R509::MessageDigest.new(algorithm)\n md = message_digest.digest\n md.update(@cert.to_der)\n md.to_s\n end",
"def to_sym\n to_s.to_sym\n end",
"def attr_hash\n Digest::MD5.hexdigest(\"#{@name}:#{@ruby_type}\")\n end",
"def sym(name)\n #This is a stub, used for indexing\n end",
"def __gibbler(digest_type=nil)\n klass = self.class\n nom = self.name if self.respond_to?(:name)\n nom ||= ''\n a = Gibbler.digest '%s:%s:%s' % [klass, nom.size, nom], digest_type\n gibbler_debug klass, a, [klass, nom.size, nom]\n a\n end",
"def name_key\n return base_key + \".name\"\n end",
"def workspace_symbol_provider\n attributes.fetch(:workspaceSymbolProvider)\n end",
"def fusion_name\n SecureRandom.uuid\n end",
"def symbol; end",
"def symbol; end",
"def symbol; end",
"def symbol; end",
"def symbol; end",
"def symbol; end",
"def key_pair_name\n\n # return the key_pair_name if one is already generated\n return @key_pair_name if @key_pair_name\n\n # generate on from a random string of 10 upper and lowercase letters\n o = [('a'..'z'), ('A'..'Z')].map { |i| i.to_a }.flatten\n @key_pair_name = (0..10).map { o[rand(o.length)] }.join\n return @key_pair_name\n\n end",
"def name\n @name ||= begin \n ioctl(EVIOCGNAME(len = 256), out_name = \" \" * len)\n out_name.rstrip\n end\n end",
"def symbol\n @symbol\n end",
"def hash_function_label\n hash_function.nil? ? '' : HASH_FUNCTION_LABELS[ hash_function ]\n end",
"def get_symbol_or_name\n tk = get_tk\n case tk[:kind]\n when :on_symbol then\n text = tk[:text].sub(/^:/, '')\n\n next_tk = peek_tk\n if next_tk && :on_op == next_tk[:kind] && '=' == next_tk[:text] then\n get_tk\n text << '='\n end\n\n text\n when :on_ident, :on_const, :on_gvar, :on_cvar, :on_ivar, :on_op, :on_kw then\n tk[:text]\n when :on_tstring, :on_dstring then\n tk[:text][1..-2]\n else\n raise RDoc::Error, \"Name or symbol expected (got #{tk})\"\n end\n end",
"def format\n self.class.name.split('::').last.downcase.to_sym\n end",
"def common_family_name; end",
"def method_name\n deface_hash = Deface::Override.digest(:virtual_path => @virtual_path)\n\n #we digest the whole method name as if it gets too long there's problems\n \"_#{Deface::Digest.hexdigest(\"#{deface_hash}_#{super}\")}\"\n end",
"def key\n name.underscore.tr('/', '_').to_sym\n end",
"def to_sym\n self.class.endpoint_name.to_sym\n end"
] |
[
"0.7170623",
"0.632829",
"0.60010874",
"0.59882784",
"0.58345854",
"0.58336776",
"0.5763421",
"0.5750439",
"0.5745365",
"0.5692395",
"0.56923664",
"0.56011367",
"0.55982345",
"0.55792636",
"0.55559343",
"0.55513453",
"0.55513453",
"0.55513453",
"0.5540581",
"0.5519668",
"0.5519361",
"0.5514308",
"0.5469721",
"0.54670507",
"0.5466466",
"0.54546726",
"0.54480016",
"0.5439945",
"0.5439945",
"0.54299945",
"0.54198146",
"0.54164255",
"0.54018086",
"0.5397899",
"0.53623885",
"0.5360475",
"0.5358516",
"0.5353795",
"0.5349255",
"0.5349255",
"0.5343642",
"0.5339995",
"0.53380287",
"0.5320125",
"0.53166664",
"0.53144383",
"0.5307569",
"0.5293727",
"0.52866405",
"0.5284421",
"0.52690566",
"0.5265094",
"0.5253752",
"0.5235735",
"0.5217991",
"0.5207042",
"0.52066797",
"0.5199896",
"0.51653016",
"0.5162999",
"0.51623666",
"0.515109",
"0.514335",
"0.5142598",
"0.51394916",
"0.51374",
"0.5135242",
"0.5134904",
"0.5130644",
"0.5118784",
"0.511622",
"0.51115143",
"0.51039195",
"0.5100347",
"0.5087811",
"0.50815016",
"0.5076079",
"0.5068991",
"0.50662065",
"0.50638515",
"0.5056318",
"0.50562924",
"0.5056077",
"0.5050937",
"0.5050025",
"0.5050025",
"0.5050025",
"0.5050025",
"0.5050025",
"0.5050025",
"0.5049696",
"0.50452167",
"0.50346",
"0.5033722",
"0.5028286",
"0.502783",
"0.50214034",
"0.50209135",
"0.50200856",
"0.50182843"
] |
0.7308521
|
0
|
Allows to change algorithm for node digesting (default is SHA1). You may pass either a one of +:sha1+, +:sha256+ or +:gostr3411+ symbols or +Hash+ with keys +:id+ with a string, which will denote algorithm in XML Reference tag and +:digester+ with instance of class with interface compatible with +OpenSSL::Digest+ class.
|
def digest_algorithm=(algorithm)
@digester = Kiji::Digester.new(algorithm)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def digest_algorithm\n @digester.symbol || @digester.digest_name\n end",
"def digest(string, algorithm)\n Base64.encode64 digester(algorithm).digest(string)\n end",
"def generate_digest(element, algorithm)\n element = document.at_xpath(element, namespaces) if element.is_a? String\n xml = canonicalize(element)\n digest(xml, algorithm).strip\n end",
"def digester(type=nil)\n require 'openssl'\n case type.to_s.downcase\n when 'md5'\n require 'digest/md5'\n ::Digest::MD5\n when 'sha128', 'sha1'\n require 'digest/sha1' #need?\n OpenSSL::Digest::SHA1\n when 'sha256'\n require 'digest/sha1' #need?\n OpenSSL::Digest::SHA256\n when 'sha512'\n require 'digest/sha1' #need?\n OpenSSL::Digest::SHA512\n else\n raise \"unsupported digest #{type}\"\n end\n end",
"def digest_class\n Digest::SHA256\n end",
"def digest_class\n Digest::SHA256\n end",
"def signature_digest_algorithm=(algorithm)\n @sign_digester = Kiji::Digester.new(algorithm)\n end",
"def digester_for_signature_method(algorithm_url)\n signature_digest_mapping = {\n 'http://www.w3.org/2000/09/xmldsig#rsa-sha1' => 'http://www.w3.org/2000/09/xmldsig#sha1',\n 'http://www.w3.org/2001/04/xmldsig-more#gostr34102001-gostr3411' => 'http://www.w3.org/2001/04/xmldsig-more#gostr3411',\n }\n digest_url = signature_digest_mapping[algorithm_url] || algorithm_url\n digester(digest_url)\n end",
"def crypto_hash(name, digest_class)\n digest_length = digest_class.digest('').length\n\n defines = Proc.new do \n define_method :\"#{name}\" do |data|\n data = data.pack 'C*' unless data.kind_of? String\n digest_class.digest(data).unpack 'C*'\n end\n define_method(:\"#{name}_digest_class\") { digest_class }\n define_method(:\"#{name}_length\") { digest_length }\n end\n \n @target.class_eval(&defines)\n (class << @target; self; end).module_eval(&defines) \n end",
"def calculate_hash!\n prefix = PREFIX_NAME_LOOKUP[self.type]\n # add special cases for refs\n self.hash_id = NodeId.sha1(\"#{prefix} #{self.size}\\0#{self.content}\")\n end",
"def digest_method=(value)\n @children['digestMethod'][:value] = value\n end",
"def digest_method=(value)\n @children['digestMethod'][:value] = value\n end",
"def set_default_signature_method!\n # self.signature_digest_algorithm = :sha1\n # self.signature_algorithm_id = 'http://www.w3.org/2000/09/xmldsig#rsa-sha1'\n self.signature_digest_algorithm = :sha256\n self.signature_algorithm_id = 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256'\n end",
"def digest_hash_function\n decode[:hash_function]\n end",
"def default_hash_function(plain_token)\n ::Digest::SHA256.hexdigest plain_token\n end",
"def signature_digest_algorithm\n @sign_digester.symbol || @sign_digester.digest_name\n end",
"def digest(string)\n @digest_class.new(string).digest\n end",
"def hexdigest(string)\n @digest_class.new(string).hexdigest\n end",
"def digest( str )\n Digest::SHA1.hexdigest( str )\n end",
"def digest\n Digest::SHA1.hexdigest(self)\n end",
"def digest\n @digest ||= DEFAULT_DIGEST_PROC\n end",
"def digest_63bit(payload)\n configure_default_algo\n send(\"#{algorithm.downcase}63_digest\", payload)\n end",
"def digest\n Digest::SHA2.new\n end",
"def integrity_uri(digest)\n case digest\n when Digest::Base\n digest_class = digest.class\n digest = digest.digest\n when String\n digest_class = DIGEST_SIZES[digest.bytesize]\n else\n raise TypeError, \"unknown digest: #{digest.inspect}\"\n end\n\n if hash_name = HASH_ALGORITHMS[digest_class]\n \"#{hash_name}-#{pack_base64digest(digest)}\"\n end\n end",
"def integrity_uri(digest)\n case digest\n when Digest::Base\n digest_class = digest.class\n digest = digest.digest\n when String\n digest_class = DIGEST_SIZES[digest.bytesize]\n else\n raise TypeError, \"unknown digest: #{digest.inspect}\"\n end\n\n if hash_name = HASH_ALGORITHMS[digest_class]\n \"#{hash_name}-#{pack_base64digest(digest)}\"\n end\n end",
"def digest(password, salt, algo = nil)\n raise ArgumentError, \"digest_size is required\" unless @digest_size\n\n digest = Util.zeros(@digest_size)\n salt = Util.check_string(salt, SALTBYTES, \"salt\")\n\n if algo.nil?\n algorithm = ALG_DEFAULT\n elsif algo == :argon2i\n algorithm = ALG_ARGON2I13\n elsif algo == :argon2id && Sodium::Version::ARGON2ID_SUPPORTED\n algorithm = ALG_ARGON2ID13\n else\n raise ArgumentError, \"digest algorithm is not supported\"\n end\n\n status = self.class.pwhash(\n digest, @digest_size,\n password, password.bytesize, salt,\n @opslimit, @memlimit, algorithm\n )\n raise CryptoError, ARGON_ERROR_CODES[status] if status.nonzero?\n\n digest\n end",
"def attr_hash\n Digest::MD5.hexdigest(\"#{@name}:#{@ruby_type}\")\n end",
"def digest!(target_node, options = {})\n wsu_ns = namespace_prefix(target_node, WSU_NAMESPACE)\n current_id = target_node[\"#{wsu_ns}:Id\"] if wsu_ns\n id = options[:id] || current_id || \"_#{Digest::SHA1.hexdigest(target_node.to_s)}\"\n # if id.to_s.size > 0\n # wsu_ns ||= namespace_prefix(target_node, WSU_NAMESPACE, 'wsu')\n # target_node[\"#{wsu_ns}:Id\"] = id.to_s\n # end\n target_canon = canonicalize(target_node, options[:inclusive_namespaces])\n # target_digest = Base64.encode64(@digester.digest(target_canon)).strip\n target_digest = @digester.base64(target_canon)\n\n reference_node = Nokogiri::XML::Node.new('Reference', document)\n reference_node['URI'] = !id.to_s.empty? ? encode_ja(id) : ''\n signed_info_node.add_child(reference_node)\n\n transforms_node = Nokogiri::XML::Node.new('Transforms', document)\n reference_node.add_child(transforms_node)\n\n transform_node = Nokogiri::XML::Node.new('Transform', document)\n transform_node['Algorithm'] = if options[:enveloped]\n 'http://www.w3.org/2000/09/xmldsig#enveloped-signature'\n else\n # transform_node['Algorithm'] = 'http://www.w3.org/2001/10/xml-exc-c14n#'\n 'http://www.w3.org/TR/2001/REC-xml-c14n-20010315'\n end\n if options[:inclusive_namespaces]\n inclusive_namespaces_node = Nokogiri::XML::Node.new('ec:InclusiveNamespaces', document)\n inclusive_namespaces_node.add_namespace_definition('ec', transform_node['Algorithm'])\n inclusive_namespaces_node['PrefixList'] = options[:inclusive_namespaces].join(' ')\n transform_node.add_child(inclusive_namespaces_node)\n end\n transforms_node.add_child(transform_node)\n\n digest_method_node = Nokogiri::XML::Node.new('DigestMethod', document)\n digest_method_node['Algorithm'] = @digester.digest_id\n reference_node.add_child(digest_method_node)\n\n digest_value_node = Nokogiri::XML::Node.new('DigestValue', document)\n digest_value_node.content = target_digest\n reference_node.add_child(digest_value_node)\n self\n end",
"def digest(string, options = {})\n salt = options[:salt] || SecureRandom.base64\n Digest::SHA1.hexdigest(\"#{salt}--#{string}\")\n end",
"def digest\n @digest ||= Digest::MD5.hexdigest(self.attributes[self.class.config[:digest]])[0, 8]\n end",
"def digester(url)\n @digesters ||= {}\n unless @digesters[url]\n DIGESTERS[url] or raise InvalidDigest, \"Digest algorithm not supported: #{url}\"\n @digesters[url] = DIGESTERS[url].call\n end\n @digesters[url].reset\n end",
"def hexdigest\n DigestUtils.pack_hexdigest(digest)\n end",
"def uri_hash # :nodoc:\n require_relative '../openssl'\n\n normalized =\n if @repository =~ %r{^\\w+://(\\w+@)?}\n uri = URI(@repository).normalize.to_s.sub %r{/$},''\n uri.sub(/\\A(\\w+)/) { $1.downcase }\n else\n @repository\n end\n\n OpenSSL::Digest::SHA1.hexdigest normalized\n end",
"def set_certificate_id_digest_method(opts)\n opts = check_params(opts,[:digest_methods])\n super(opts)\n end",
"def hashFromWeb(uri, auth, algo)\n URI::NI.buildFromHTTP(auth, URI(uri), nil, algo)\nend",
"def change_sha\n DeliveryGolang::Helpers.change_sha(node)\n end",
"def digest(*args)\n return @digest if args.empty?\n\n self.type = :digest\n @digest = args.flatten.compact\n end",
"def digest(data); end",
"def digest\n case @signature_method\n when \"HMAC-SHA256\" then OpenSSL::Digest.new(\"sha256\")\n when \"HMAC-SHA1\" then OpenSSL::Digest.new(\"sha1\")\n else\n fail InvalidSignatureMethodError\n end\n end",
"def hexdigest(*several_variants)\n #This is a stub, used for indexing\n end",
"def set_hash(hash, hash_type = 'SHA256')\n @hash = hash\n @hash_type = hash_type\n end",
"def hash\n raw = [name, type, values.join('/')].join(' ')\n Digest::MD5.hexdigest(raw)\n end",
"def computed_sha(string)\n provider.computed_sha(string)\n end",
"def digest(*args)\n options = args.extract_options!\n ::Klarna::API.digest(*[(self.store_id unless options[:store_id] == false), args, self.store_secret].compact.flatten)\n end",
"def hexdigest\n # Read bytes in chunks of the optimal digest size.\n while (chunk = @io.read(@digest.block_length))\n @digest.update(chunk)\n end\n @digest.hexdigest\n end",
"def filehash(filename, algorithm = DEFAULT_ALGORITHM)\n algo_class = Digest.const_get(algorithm.to_s.upcase)\n\n # Safety check\n unless algo_class.class == Class and algo_class.respond_to?(:new)\n raise \"Unknown filehash provider #{algo_class}\"\n end\n\n hash = algo_class.new()\n File.open(filename,'r') do |f|\n until f.eof?\n hash.update(f.read(READ_SIZE))\n end\n end\n\n return hash.hexdigest\n end",
"def sha_hash (arg)\r\n Digest::SHA2.hexdigest(arg)\r\n end",
"def initialize(name, aes_size, sha_size, alg)\n @name = name\n @aes_size = aes_size\n @sha_size = sha_size\n @cipher_name = \"aes-#{aes_size}-cbc\"\n @alg = alg\n @digest = OpenSSL::Digest.new(\"sha#{@sha_size}\")\n end",
"def digest_class=(klass)\n @digest_class = klass\n end",
"def certificate_id_digest_method\n super\n end",
"def checksum_file(digest_class, path)\n digester = digest_class.new\n digester.file(path)\n digester.hexdigest\n end",
"def fingerprint(algorithm = 'sha256')\n message_digest = R509::MessageDigest.new(algorithm)\n md = message_digest.digest\n md.update(@cert.to_der)\n md.to_s\n end",
"def digest\n @digest ||= Digest::SHA1.new.update(version.to_s)\n @digest.dup\n end",
"def fingerprint(algorithm='sha1')\n message_digest = R509::MessageDigest.new(algorithm)\n md = message_digest.digest\n md.update(@cert.to_der)\n md.to_s\n end",
"def uri_hash # :nodoc:\n normalized =\n if @repository =~ %r%^\\w+://(\\w+@)?% then\n uri = URI(@repository).normalize.to_s.sub %r%/$%,''\n uri.sub(/\\A(\\w+)/) { $1.downcase }\n else\n @repository\n end\n\n Digest::SHA1.hexdigest normalized\n end",
"def relevant_options_digest(options); end",
"def digest\n OpenSSL::HMAC.digest(\n OpenSSL::Digest.new('sha1'),\n secret,\n document\n )\n end",
"def hexdigest!()\n #This is a stub, used for indexing\n end",
"def secure_digest(*args)\n Digest::SHA1.hexdigest(args.flatten.join('--'))\n end",
"def secure_digest(*args)\n Digest::SHA1.hexdigest(args.flatten.join('--'))\n end",
"def secure_digest(*args)\n Digest::SHA1.hexdigest(args.flatten.join('--'))\n end",
"def hexdigest\n self.class.hexdigest_for(path)\n end",
"def initialize\n super('Digest')\n @auth = {}\n @nonce_count = 0\n end",
"def call( *args )\n text = args.shift.to_s\n bitlength = (args.shift || 256).to_i\n Digest::SHA2.new( bitlength ).hexdigest( text )\n end",
"def digest_type\n DIGESTS.each do |digest|\n return digest if source.key? digest\n end\n raise ChecksumMissing.new(self)\n end",
"def update(string)\n check_valid\n string_ptr = FFI::MemoryPointer.from_string(string)\n OpenSSL::LibCrypto.EVP_DigestUpdate(self, string_ptr, string.length)\n self\n end",
"def digest(obj)\n build_digest(obj).digest\n end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def _hash_digest(key)\n m = Digest::MD5.new\n m.update(key)\n\n # No need to ord each item since ordinary array access\n # of a string in Ruby converts to ordinal value\n return m.digest\n end",
"def digest\n Digest::SHA1.hexdigest(@pub.to_der)\n end",
"def generate_hash(bytes, algorithm = nil)\n bytes = Validation.check_filled_array_argument!(bytes)\n\n alg = algorithm\n alg ||= use_SHA256_fingerprints ? HashAlgorithm::SHA256 : HashAlgorithm::SHA512\n\n begin\n native_algorithm = HashAlgorithm.convert_to_native(alg)\n native_hasher = Core::VirgilHash.new(native_algorithm)\n wrap_bytes(native_hasher.hash(bytes))\n rescue StandardError => error\n raise VirgilCryptoException, error.message\n end\n end",
"def hash(tx)\n Digest::SHA256.hexdigest(Digest::SHA256.hexdigest(tx))\nend",
"def fingerprint(digest, cert_file)\n if cert_file.is_a? String\n cert = OpenSSL::X509::Certificate.new(Util.read_file!(cert_file))\n elsif cert_file.is_a? OpenSSL::X509::Certificate\n cert = cert_file\n elsif cert_file.is_a? CertificateAuthority::Certificate\n cert = cert_file.openssl_body\n end\n digester = case digest\n when \"MD5\" then Digest::MD5.new\n when \"SHA1\" then Digest::SHA1.new\n when \"SHA256\" then Digest::SHA256.new\n when \"SHA384\" then Digest::SHA384.new\n when \"SHA512\" then Digest::SHA512.new\n end\n digester.hexdigest(cert.to_der)\n end",
"def checksum\n source[digest_type]\n end",
"def to_param\n digest\n end",
"def hash # Hack for Ruby 1.8.6\n @node.id.hash ^ self.class.hash\n end",
"def algorithm\n attributes.fetch(:algorithm) do\n Ably::Util::Crypto::DEFAULTS.fetch(:algorithm)\n end.downcase\n end",
"def sha1\n @sha1 ||= digest(path, :sha1)\n end",
"def digest(*several_variants)\n #This is a stub, used for indexing\n end",
"def fedora_shasum\n \"urn:sha1:#{Digest::SHA1.file(file_path)}\"\n end",
"def default_key \n Digest::SHA1.hexdigest(\"riaque:#{name}\")\n end",
"def calc_digest input\n Digest::SHA1.hexdigest(input.to_s).\n\n # XXX: surround all digits with alphabets so\n # Maruku doesn't change them into HTML\n gsub(/\\d/, 'z\\&z')\n end",
"def dave(new_str)\r\n new_hash = Digest::SHA256.hexdigest new_str\r\n return new_hash\r\nend",
"def upstream_sha1=( checksum )\n @digest = Crate::Digest.sha1( checksum )\n end",
"def sha256; end",
"def reset\n check_valid\n OpenSSL::LibCrypto.EVP_DigestInit_ex(self, self.md, nil)\n self\n end",
"def hashed_key_and_args(key, *args)\n base = args.inject('') do |memo, arg|\n memo << (':' + arg.class.to_s + ':') << case arg\n when Array\n hashed_key_and_args(key, *arg)\n when Hash\n hashed_key_and_args(key, *arg.to_a)\n when NilClass, Numeric, String, Symbol\n arg.to_s\n else\n raise ArgumentError, 'can only compute digest for primitive objects'\n end\n\n Digest::SHA1::hexdigest(memo)\n end\n\n key + ':' + base\n end",
"def hash(*) end",
"def []=(node, value)\n return @hash[node.sha1] = value\n end",
"def digest!()\n #This is a stub, used for indexing\n end",
"def secure_hash(string)\n Digest::SHA2.hexdigest(string)\n end",
"def hexdigest(value)\n Digest::SHA256.new.update(value).hexdigest\n end",
"def to_sha(hash)\n # converts a hash to a SHA256\n return Digest::SHA256.hexdigest(JSON.dump(hash))\nend",
"def check_hash=(flag)\r\n @conf[:use_md5_digest] = flag\r\n end"
] |
[
"0.7002007",
"0.66663814",
"0.6597156",
"0.65157485",
"0.6472355",
"0.6472355",
"0.627788",
"0.62028486",
"0.6133024",
"0.6080581",
"0.60600656",
"0.60600656",
"0.6028101",
"0.6023464",
"0.6017885",
"0.59559715",
"0.59235394",
"0.5881173",
"0.5875797",
"0.58557427",
"0.58470535",
"0.58200747",
"0.58031523",
"0.57852274",
"0.57852274",
"0.5746745",
"0.5692624",
"0.5658911",
"0.56324923",
"0.562688",
"0.5607963",
"0.56066346",
"0.558135",
"0.5581295",
"0.55756295",
"0.5574179",
"0.5556515",
"0.5533936",
"0.5523712",
"0.5505914",
"0.5498371",
"0.54920316",
"0.54775286",
"0.5475701",
"0.54439586",
"0.53981423",
"0.5397813",
"0.5389813",
"0.5388364",
"0.53635615",
"0.5339937",
"0.53253466",
"0.5324021",
"0.5322211",
"0.5309607",
"0.5304704",
"0.53026694",
"0.52839005",
"0.5278923",
"0.5278923",
"0.5278923",
"0.5274747",
"0.5268472",
"0.5265667",
"0.5256915",
"0.5252908",
"0.52382994",
"0.5236568",
"0.5236568",
"0.5236568",
"0.5236568",
"0.5236568",
"0.5236568",
"0.5236568",
"0.5229474",
"0.52270085",
"0.5207002",
"0.5204839",
"0.52046716",
"0.5198014",
"0.5192028",
"0.5180821",
"0.51771706",
"0.5156926",
"0.5149713",
"0.51489365",
"0.5144015",
"0.5137237",
"0.51337725",
"0.512731",
"0.51270986",
"0.51206493",
"0.51091415",
"0.50989",
"0.5098114",
"0.50959927",
"0.50901705",
"0.50746953",
"0.5073093",
"0.5065713"
] |
0.69125223
|
1
|
Return symbol name for supported digest algorithms and string name for custom ones.
|
def signature_digest_algorithm
@sign_digester.symbol || @sign_digester.digest_name
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def digest_algorithm\n @digester.symbol || @digester.digest_name\n end",
"def digest_name(name)\n Digest::SHA2.hexdigest(short_name(name))[0..24]\n end",
"def to_sym\n name\n end",
"def digest_short_name(name)\n Digest::SHA2.hexdigest(name)[0..24]\n end",
"def openssl_name\n CipherSuites::OPENSSL_NAMES[rfc_name]\n end",
"def name\n [@n.to_s + character.to_s, symmetry].reject{|p| p == \"\"}.join(\"_\")\n end",
"def sym\n @name.to_sym\n end",
"def to_sym\n @name\n end",
"def signing_algorithm\n signing_key.is_a?(String) ? \"HS256\" : \"RS256\"\n end",
"def algorithm_name\n raise NotImplementedError\n end",
"def symbol_suffix\n \"\"\n end",
"def to_sym\n @name.to_sym\n end",
"def sym(name)\n SymEngine::Symbol.new(name)\nend",
"def algorithm\n attributes.fetch(:algorithm) do\n Ably::Util::Crypto::DEFAULTS.fetch(:algorithm)\n end.downcase\n end",
"def key_algorithm\n if self.rsa?\n \"RSA\"\n elsif self.dsa?\n \"DSA\"\n end\n end",
"def to_sym() end",
"def to_sym() end",
"def to_sym() end",
"def os_family_sym\n os_parser.family_sym\n end",
"def name\n \"#{self[:asn]} #{self[:vrf]} #{self[:afi]} #{self[:safi]} #{self[:aa]}\"\n end",
"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 calc_project_symbol project_name\n name = project_name.to_s.gsub(/\\W+/, '_').squeeze('_').gsub(/^_|_$/, '')\n (name[0,1].upcase + name[1..-1]).to_sym\n end",
"def os_sym\n os_parser.sym\n end",
"def name_sym\n @name_sym ||= name.downcase.to_sym\n end",
"def symbolidentifier\n\n \t\n\t\tif @usersym.upcase == \"X\" then \n\t\t @compsym = \"O\" \n \t\t else \n \t\t @compsym = \"X\"\n \t\tend \n\n\n end",
"def key_algorithm\n if self.rsa?\n :rsa\n elsif self.dsa?\n :dsa\n elsif self.ec?\n :ec\n end\n end",
"def default_key \n Digest::SHA1.hexdigest(\"riaque:#{name}\")\n end",
"def symbol\n # prefer a code display value since the state name may not be unique between modules\n if !@codes.nil? && !@codes.empty?\n @codes.first.display.gsub(/\\s+/, '_').downcase.to_sym\n else\n @name.gsub(/\\s+/, '_').downcase.to_sym\n end\n end",
"def symbol\n # prefer a code display value since the state name may not be unique between modules\n if !@codes.nil? && !@codes.empty?\n @codes.first.display.gsub(/\\s+/, '_').downcase.to_sym\n else\n @name.gsub(/\\s+/, '_').downcase.to_sym\n end\n end",
"def algorithm\n \"HS256\"\n end",
"def name\n GCODE_DICTIONARY[cmd.to_sym] || :unknown\n end",
"def symbol\n Util.from_bytes :symbol, value\n end",
"def bin_sym\n @underscored_name ||= name.split('::').last.gsub(/([a-z\\d])([A-Z])/, '\\1_\\2').downcase.to_sym\n end",
"def ext_sym(name)\r\n return name if name.kind_of?(Symbol)\r\n return ext_name(name).to_sym\r\n end",
"def supported_algorithms\n {\n None: [],\n SHA: %w{HS256 HS384 HS512},\n RSA: %w{RS256 RS384 RS512},\n ESDSA: %w{ES256 ES384 ES512}\n }\n end",
"def crypto_hash(name, digest_class)\n digest_length = digest_class.digest('').length\n\n defines = Proc.new do \n define_method :\"#{name}\" do |data|\n data = data.pack 'C*' unless data.kind_of? String\n digest_class.digest(data).unpack 'C*'\n end\n define_method(:\"#{name}_digest_class\") { digest_class }\n define_method(:\"#{name}_length\") { digest_length }\n end\n \n @target.class_eval(&defines)\n (class << @target; self; end).module_eval(&defines) \n end",
"def to_s\n \"#{symbol}\"\n end",
"def identify_hash(hash)\n hash = hash.to_s.strip\n case\n # operating systems\n when hash.start_with?('$1$') && hash.length == 34\n return 'md5'\n when hash.start_with?('$2$') && hash.length == 59,\n hash.start_with?('$2a$') && hash.length == 60,\n hash.start_with?('$2b$') && hash.length == 60,\n hash.start_with?('$2x$') && hash.length == 60,\n hash.start_with?('$2y$') && hash.length == 60\n return 'bf' #bcrypt\n when hash.start_with?('$5$') && hash.split('$').last.length == 43\n # we dont check full length since it may have 'rounds=' in the [1] area or not with an arbitrary length number\n return 'sha256,crypt'\n when hash.start_with?('$6$') && hash.split('$').last.length == 86\n # we dont check full length since it may have 'rounds=' in the [1] area or not with an arbitrary length number\n return 'sha512,crypt'\n when hash.start_with?('@S@') && hash.length == 148\n return 'qnx,sha512'\n when hash.start_with?('@s@') && hash.length == 84\n return 'qnx,sha256'\n when hash.start_with?('@m@') && hash.length == 52\n return 'qnx,md5'\n when hash.start_with?('_') && hash.length == 20\n return 'des,bsdi,crypt'\n when hash =~ /^[\\.\\/\\dA-Za-z]{13}$/ # hash.length == 13\n return 'des,crypt'\n when hash =~ /^\\$dynamic_82\\$[\\da-f]{128}\\$HEX\\$[\\da-f]{32}$/ # jtr vmware ldap https://github.com/rapid7/metasploit-framework/pull/13865#issuecomment-660718108\n return 'dynamic_82'\n when hash.start_with?(/{SSHA}/i)\n return 'ssha'\n when hash.start_with?(/{SHA512}/i)\n return 'raw-sha512'\n when hash.start_with?(/{SHA}/i)\n return 'raw-sha1'\n when hash.start_with?(/{MD5}/i)\n return 'raw-md5'\n when hash.start_with?(/{SMD5}/i)\n return 'smd5'\n when hash.start_with?(/{SSHA256}/i)\n return 'ssha256'\n when hash.start_with?(/{SSHA512}/i)\n return 'ssha512'\n # windows\n when hash.length == 65 && hash =~ /^[\\da-fA-F]{32}:[\\da-fA-F]{32}$/ && hash.split(':').first.upcase == 'AAD3B435B51404EEAAD3B435B51404EE'\n return 'nt'\n when hash.length == 65 && hash =~ /^[\\da-fA-F]{32}:[\\da-fA-F]{32}$/\n return 'lm'\n # OSX\n when hash.start_with?('$ml$') && hash.split('$').last.length == 256\n return 'pbkdf2-hmac-sha512,osx' # 10.8+\n when hash =~ /^[\\da-fA-F]{48}$/ # hash.length == 48\n return 'xsha,osx' # 10.4-10.6\n # databases\n when hash.start_with?('0x0100') && hash.length == 54\n return 'mssql05'\n when hash.start_with?('0x0100') && hash.length == 94\n return 'mssql'\n when hash.start_with?('0x0200') && hash.length == 142\n return 'mssql12'\n when hash =~ /^[\\da-f]{16}$/ # hash.length == 16\n return 'mysql' # mysql323 (pre 4.1)\n when hash.start_with?('*') && hash.length == 41\n return 'mysql-sha1' # mysql 4.1+\n when hash.start_with?('md5') && hash.length == 35\n return 'postgres'\n when hash =~ /^[\\da-fA-F]{16}$/\n return 'des,oracle' # pre 11g\n when hash =~ /^S:[\\dA-F]{60}$/\n return 'raw-sha1,oracle11'\n when hash =~ /^S:[\\dA-F]{60};H:[\\dA-F]{32};T:[\\dA-F]{160}$/\n return 'raw-sha1,oracle'\n when hash =~ /^H:[\\dA-F]{32};T:[\\dA-F]{160}$/\n return 'pbkdf2,oracle12c'\n # webapps\n when hash.start_with?('$P$') && hash.length == 34,\n hash.start_with?('$H$') && hash.length == 34\n return 'phpass' # wordpress, drupal, phpbb3 (H not P)\n when hash.start_with?('$ml$') && hash.length == 203\n return 'PBKDF2-HMAC-SHA512'\n when hash.start_with?('{PKCS5S2}') && hash.length == 73\n return 'PBKDF2-HMAC-SHA1'\n when hash.start_with?('$B$') && hash.split('$').last.length == 32\n return 'mediawiki'\n # mobile\n when hash =~/^[A-F0-9]{40}:[a-f0-9]{16}$/\n return 'android-sha1'\n when hash =~/^[A-F0-9]{32}:[a-f0-9]{16}$/\n return 'android-md5'\n # other\n when hash =~ /^<\\d+@.+?>#[\\w]{32}$/\n return 'hmac-md5'\n when hash.length == 114 && hash.start_with?('$M$')\n return 'F5-Secure-Vault'\n when hash =~ /^M\\$[[:print:]]+#[\\da-fA-F]{32}(?:(?::[[:print:]]*$)|$)/\n return 'mscash'\n when hash =~ /^\\$DCC2\\$\\d+#[[:print:]]+#[\\da-fA-F]{32}(?:(?::[[:print:]]*$)|$)/\n return 'mscash2'\n end\n ''\nend",
"def digest_class\n Digest::SHA256\n end",
"def digest_class\n Digest::SHA256\n end",
"def _unique_name\n string = aliases.split(\",\").sort_by{|x| x.downcase}.join(\", \")\n Digest::SHA1.hexdigest string\n end",
"def to_sym; end",
"def key\n key = self.name\n key = Economic::Support::String.demodulize(key)\n key = Economic::Support::String.underscore(key)\n key.intern\n end",
"def symbol_for_name(name)\n if symbols.has_key? name\n symbols[name]\n else\n raise \"No symbol with name #{name} found\"\n end\n end",
"def getname\n return @name.to_sym\n end",
"def fingerprint(algorithm = 'sha256')\n message_digest = R509::MessageDigest.new(algorithm)\n md = message_digest.digest\n md.update(@cert.to_der)\n md.to_s\n end",
"def salted_name\n [api_name,rand_salt].join('--')\n end",
"def hash_proc_4symstr\n @hash_proc_4symstr ||= proc do |hash, key|\n case key\n when String\n tmp = key.to_sym\n hash.key?(tmp) ? hash[tmp] : nil\n when Symbol\n tmp = key.to_s\n hash.key?(tmp) ? hash[tmp] : nil\n end\n end\n end",
"def name\n \"#{self[:asn]} #{self[:vrf]} #{self[:neighbor]} #{self[:afi]} \" \\\n \"#{self[:safi]}\"\n end",
"def key_algorithm\n if @req.public_key.kind_of? OpenSSL::PKey::RSA then\n 'RSA'\n elsif @req.public_key.kind_of? OpenSSL::PKey::DSA then\n 'DSA'\n end\n end",
"def digest_hash_function\n decode[:hash_function]\n end",
"def name_sym\n self.__enum_name__.to_sym\n end",
"def computed_name(context)\n @_name ||= case @name\n when String\n @name\n when Symbol\n context.public_send(@name) # todo\n when Proc\n context.instance_exec(&@name)\n when nil\n computed_path(context)\n else\n raise ArgumentError,\n \"Expected one of String, Symbol, or Proc, \" \\\n \"got #{@name.class}\"\n end\n end",
"def to_sym\n @name&.to_sym\n end",
"def to_sym\n \tname.downcase.gsub(/\\s+/, \"_\").to_sym\n end",
"def namehash(name)\n node = '0' * 64\n if (name != '')\n name.split('.').reverse.each do |label|\n node = sha3(node + sha3(label),encoding: :hex);\n end\n end\n '0x'+node\n end",
"def name\n [cc_type, last_digits].join(' - ')\n end",
"def hash\n name.hash ^ provider.hash\n end",
"def to_sym() name_singular.to_sym end",
"def code_name(code)\n Codes.code_symbol(code)\n end",
"def browser_family_sym\n browser_parser.family_sym\n end",
"def rfc_name\n RFC_NAMES[name]\n end",
"def default_hash_function(plain_token)\n ::Digest::SHA256.hexdigest plain_token\n end",
"def jwa_alg\n # https://tools.ietf.org/html/rfc7518#section-3.1\n # HMAC using SHA-256\n 'HS256'\n end",
"def document_symbol_provider\n attributes.fetch(:documentSymbolProvider)\n end",
"def to_s\n return self.symbol\n end",
"def to_ruby\n @name.to_s.to_sym\n end",
"def to_standardized_sym\n standardize\n .to_sym\n end",
"def digest_key(digest)\n \"asset-uri-digest:#{compressed_path}:#{digest}\"\n end",
"def symbol_by_name(name)\n each_symbols.find { |symbol| symbol.name == name }\n end",
"def calc_program_name project_symbol\n camel_to_snake_case(project_symbol).downcase\n end",
"def gem_signature(gem_full_name)\n Digest::SHA256.new(@gems[gem_full_name].to_yaml).to_s\n end",
"def symbol(string)\n Types::Symbol.cast(string)\n end",
"def digester(type=nil)\n require 'openssl'\n case type.to_s.downcase\n when 'md5'\n require 'digest/md5'\n ::Digest::MD5\n when 'sha128', 'sha1'\n require 'digest/sha1' #need?\n OpenSSL::Digest::SHA1\n when 'sha256'\n require 'digest/sha1' #need?\n OpenSSL::Digest::SHA256\n when 'sha512'\n require 'digest/sha1' #need?\n OpenSSL::Digest::SHA512\n else\n raise \"unsupported digest #{type}\"\n end\n end",
"def name_significance #adding an instance method\n parts = self.split( '-' )\n syllables = @@syllables.dup\n signif = parts.collect do |p|\n syllables.shift[p]\n end\n signif.join( ' ' )\n end",
"def key\n (key_name || name).to_sym\n end",
"def fingerprint(algorithm='sha1')\n message_digest = R509::MessageDigest.new(algorithm)\n md = message_digest.digest\n md.update(@cert.to_der)\n md.to_s\n end",
"def to_sym\n to_s.to_sym\n end",
"def attr_hash\n Digest::MD5.hexdigest(\"#{@name}:#{@ruby_type}\")\n end",
"def sym(name)\n #This is a stub, used for indexing\n end",
"def __gibbler(digest_type=nil)\n klass = self.class\n nom = self.name if self.respond_to?(:name)\n nom ||= ''\n a = Gibbler.digest '%s:%s:%s' % [klass, nom.size, nom], digest_type\n gibbler_debug klass, a, [klass, nom.size, nom]\n a\n end",
"def name_key\n return base_key + \".name\"\n end",
"def workspace_symbol_provider\n attributes.fetch(:workspaceSymbolProvider)\n end",
"def fusion_name\n SecureRandom.uuid\n end",
"def symbol; end",
"def symbol; end",
"def symbol; end",
"def symbol; end",
"def symbol; end",
"def symbol; end",
"def key_pair_name\n\n # return the key_pair_name if one is already generated\n return @key_pair_name if @key_pair_name\n\n # generate on from a random string of 10 upper and lowercase letters\n o = [('a'..'z'), ('A'..'Z')].map { |i| i.to_a }.flatten\n @key_pair_name = (0..10).map { o[rand(o.length)] }.join\n return @key_pair_name\n\n end",
"def name\n @name ||= begin \n ioctl(EVIOCGNAME(len = 256), out_name = \" \" * len)\n out_name.rstrip\n end\n end",
"def symbol\n @symbol\n end",
"def hash_function_label\n hash_function.nil? ? '' : HASH_FUNCTION_LABELS[ hash_function ]\n end",
"def get_symbol_or_name\n tk = get_tk\n case tk[:kind]\n when :on_symbol then\n text = tk[:text].sub(/^:/, '')\n\n next_tk = peek_tk\n if next_tk && :on_op == next_tk[:kind] && '=' == next_tk[:text] then\n get_tk\n text << '='\n end\n\n text\n when :on_ident, :on_const, :on_gvar, :on_cvar, :on_ivar, :on_op, :on_kw then\n tk[:text]\n when :on_tstring, :on_dstring then\n tk[:text][1..-2]\n else\n raise RDoc::Error, \"Name or symbol expected (got #{tk})\"\n end\n end",
"def format\n self.class.name.split('::').last.downcase.to_sym\n end",
"def common_family_name; end",
"def method_name\n deface_hash = Deface::Override.digest(:virtual_path => @virtual_path)\n\n #we digest the whole method name as if it gets too long there's problems\n \"_#{Deface::Digest.hexdigest(\"#{deface_hash}_#{super}\")}\"\n end",
"def key\n name.underscore.tr('/', '_').to_sym\n end",
"def to_sym\n self.class.endpoint_name.to_sym\n end"
] |
[
"0.7308521",
"0.632829",
"0.60010874",
"0.59882784",
"0.58345854",
"0.58336776",
"0.5763421",
"0.5750439",
"0.5745365",
"0.5692395",
"0.56923664",
"0.56011367",
"0.55982345",
"0.55792636",
"0.55559343",
"0.55513453",
"0.55513453",
"0.55513453",
"0.5540581",
"0.5519668",
"0.5519361",
"0.5514308",
"0.5469721",
"0.54670507",
"0.5466466",
"0.54546726",
"0.54480016",
"0.5439945",
"0.5439945",
"0.54299945",
"0.54198146",
"0.54164255",
"0.54018086",
"0.5397899",
"0.53623885",
"0.5360475",
"0.5358516",
"0.5353795",
"0.5349255",
"0.5349255",
"0.5343642",
"0.5339995",
"0.53380287",
"0.5320125",
"0.53166664",
"0.53144383",
"0.5307569",
"0.5293727",
"0.52866405",
"0.5284421",
"0.52690566",
"0.5265094",
"0.5253752",
"0.5235735",
"0.5217991",
"0.5207042",
"0.52066797",
"0.5199896",
"0.51653016",
"0.5162999",
"0.51623666",
"0.515109",
"0.514335",
"0.5142598",
"0.51394916",
"0.51374",
"0.5135242",
"0.5134904",
"0.5130644",
"0.5118784",
"0.511622",
"0.51115143",
"0.51039195",
"0.5100347",
"0.5087811",
"0.50815016",
"0.5076079",
"0.5068991",
"0.50662065",
"0.50638515",
"0.5056318",
"0.50562924",
"0.5056077",
"0.5050937",
"0.5050025",
"0.5050025",
"0.5050025",
"0.5050025",
"0.5050025",
"0.5050025",
"0.5049696",
"0.50452167",
"0.50346",
"0.5033722",
"0.5028286",
"0.502783",
"0.50214034",
"0.50209135",
"0.50200856",
"0.50182843"
] |
0.7170623
|
1
|
Allows to change digesting algorithm for signature creation. Same as +digest_algorithm=+
|
def signature_digest_algorithm=(algorithm)
@sign_digester = Kiji::Digester.new(algorithm)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def signature_digest_algorithm\n @sign_digester.symbol || @sign_digester.digest_name\n end",
"def digest_algorithm=(algorithm)\n @digester = Kiji::Digester.new(algorithm)\n end",
"def set_default_signature_method!\n # self.signature_digest_algorithm = :sha1\n # self.signature_algorithm_id = 'http://www.w3.org/2000/09/xmldsig#rsa-sha1'\n self.signature_digest_algorithm = :sha256\n self.signature_algorithm_id = 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256'\n end",
"def digest_algorithm\n @digester.symbol || @digester.digest_name\n end",
"def digest(string, algorithm)\n Base64.encode64 digester(algorithm).digest(string)\n end",
"def digester_for_signature_method(algorithm_url)\n signature_digest_mapping = {\n 'http://www.w3.org/2000/09/xmldsig#rsa-sha1' => 'http://www.w3.org/2000/09/xmldsig#sha1',\n 'http://www.w3.org/2001/04/xmldsig-more#gostr34102001-gostr3411' => 'http://www.w3.org/2001/04/xmldsig-more#gostr3411',\n }\n digest_url = signature_digest_mapping[algorithm_url] || algorithm_url\n digester(digest_url)\n end",
"def digest_class\n Digest::SHA256\n end",
"def digest_class\n Digest::SHA256\n end",
"def signing_algorithm\n signing_key.is_a?(String) ? \"HS256\" : \"RS256\"\n end",
"def digest\n case @signature_method\n when \"HMAC-SHA256\" then OpenSSL::Digest.new(\"sha256\")\n when \"HMAC-SHA1\" then OpenSSL::Digest.new(\"sha1\")\n else\n fail InvalidSignatureMethodError\n end\n end",
"def default_hash_function(plain_token)\n ::Digest::SHA256.hexdigest plain_token\n end",
"def generate_digest(element, algorithm)\n element = document.at_xpath(element, namespaces) if element.is_a? String\n xml = canonicalize(element)\n digest(xml, algorithm).strip\n end",
"def digest_hash_function\n decode[:hash_function]\n end",
"def fingerprint(algorithm = 'sha256')\n message_digest = R509::MessageDigest.new(algorithm)\n md = message_digest.digest\n md.update(@cert.to_der)\n md.to_s\n end",
"def algorithm\n secret ? (@algorithm || ALGORITHM_HMAC_HS256) : 'none'\n end",
"def relevant_options_digest(options); end",
"def fingerprint(algorithm='sha1')\n message_digest = R509::MessageDigest.new(algorithm)\n md = message_digest.digest\n md.update(@cert.to_der)\n md.to_s\n end",
"def digest_63bit(payload)\n configure_default_algo\n send(\"#{algorithm.downcase}63_digest\", payload)\n end",
"def set_certificate_id_digest_method(opts)\n opts = check_params(opts,[:digest_methods])\n super(opts)\n end",
"def digest_method=(value)\n @children['digestMethod'][:value] = value\n end",
"def digest_method=(value)\n @children['digestMethod'][:value] = value\n end",
"def sign_digest(params)\n sign = []\n params.sort.each do |p|\n sign << p[0].to_s + '=' + p[1].to_s + '&'\n end\n sign << \"key=#{@key}\"\n Digest::MD5.hexdigest(sign.join).upcase\n end",
"def key_algorithm=(algorithm)\n SaltedHash::assert_supported_algorithm(algorithm)\n properties_class.instance.update_attributes :key_algorithm => algorithm\n end",
"def calculate_signature\n normalized_string = [\n request_header.timestamp,\n request_header.nonce,\n request_header.algorithm,\n method.upcase,\n host_with_port,\n request_uri\n ].join(',')\n\n ActiveSupport::Base64.encode64s(OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha256'), secret, normalized_string))\n end",
"def digest(password, salt, algo = nil)\n raise ArgumentError, \"digest_size is required\" unless @digest_size\n\n digest = Util.zeros(@digest_size)\n salt = Util.check_string(salt, SALTBYTES, \"salt\")\n\n if algo.nil?\n algorithm = ALG_DEFAULT\n elsif algo == :argon2i\n algorithm = ALG_ARGON2I13\n elsif algo == :argon2id && Sodium::Version::ARGON2ID_SUPPORTED\n algorithm = ALG_ARGON2ID13\n else\n raise ArgumentError, \"digest algorithm is not supported\"\n end\n\n status = self.class.pwhash(\n digest, @digest_size,\n password, password.bytesize, salt,\n @opslimit, @memlimit, algorithm\n )\n raise CryptoError, ARGON_ERROR_CODES[status] if status.nonzero?\n\n digest\n end",
"def generate_hash(bytes, algorithm = nil)\n bytes = Validation.check_filled_array_argument!(bytes)\n\n alg = algorithm\n alg ||= use_SHA256_fingerprints ? HashAlgorithm::SHA256 : HashAlgorithm::SHA512\n\n begin\n native_algorithm = HashAlgorithm.convert_to_native(alg)\n native_hasher = Core::VirgilHash.new(native_algorithm)\n wrap_bytes(native_hasher.hash(bytes))\n rescue StandardError => error\n raise VirgilCryptoException, error.message\n end\n end",
"def algorithm\n attributes.fetch(:algorithm) do\n Ably::Util::Crypto::DEFAULTS.fetch(:algorithm)\n end.downcase\n end",
"def generate_digest(data)\n OpenSSL::HMAC.hexdigest(DIGEST, @secret, data)\n end",
"def generate_digest(data)\n OpenSSL::HMAC.hexdigest(DIGEST, @secret, data)\n end",
"def crypto_hash(name, digest_class)\n digest_length = digest_class.digest('').length\n\n defines = Proc.new do \n define_method :\"#{name}\" do |data|\n data = data.pack 'C*' unless data.kind_of? String\n digest_class.digest(data).unpack 'C*'\n end\n define_method(:\"#{name}_digest_class\") { digest_class }\n define_method(:\"#{name}_length\") { digest_length }\n end\n \n @target.class_eval(&defines)\n (class << @target; self; end).module_eval(&defines) \n end",
"def digest(string, options = {})\n salt = options[:salt] || SecureRandom.base64\n Digest::SHA1.hexdigest(\"#{salt}--#{string}\")\n end",
"def hash_signature_by_method(values)\n case @method\n when :md5 then Digest::MD5.hexdigest(values)\n else Digest::SHA256.hexdigest(values)\n end\n end",
"def secure_digest(*args)\n Digest::SHA1.hexdigest(args.flatten.join('--'))\n end",
"def secure_digest(*args)\n Digest::SHA1.hexdigest(args.flatten.join('--'))\n end",
"def secure_digest(*args)\n Digest::SHA1.hexdigest(args.flatten.join('--'))\n end",
"def digester(type=nil)\n require 'openssl'\n case type.to_s.downcase\n when 'md5'\n require 'digest/md5'\n ::Digest::MD5\n when 'sha128', 'sha1'\n require 'digest/sha1' #need?\n OpenSSL::Digest::SHA1\n when 'sha256'\n require 'digest/sha1' #need?\n OpenSSL::Digest::SHA256\n when 'sha512'\n require 'digest/sha1' #need?\n OpenSSL::Digest::SHA512\n else\n raise \"unsupported digest #{type}\"\n end\n end",
"def digest\n @digest ||= DEFAULT_DIGEST_PROC\n end",
"def sign(params)\n Digest::MD5::hexdigest(wrap_with_secret sorted_option_string(params)).upcase\n end",
"def generate_signature(string_to_sign)\n digest = OpenSSL::Digest.new('sha256')\n OpenSSL::HMAC.hexdigest(digest, @api_secret, string_to_sign)\n end",
"def digest\n Digest::SHA2.new\n end",
"def key_algorithm\n if self.rsa?\n \"RSA\"\n elsif self.dsa?\n \"DSA\"\n end\n end",
"def create_signature(dev_id, api_method, auth_key, formatted_timestamp)\n # ts = Time.at(timestamp).strftime(\"%Y%m%d%H%M%S\")\n raw_sig = \"#{dev_id}#{api_method}#{auth_key}#{formatted_timestamp}\"\n Digest::MD5.hexdigest(raw_sig)\n end",
"def filehash(filename, algorithm = DEFAULT_ALGORITHM)\n algo_class = Digest.const_get(algorithm.to_s.upcase)\n\n # Safety check\n unless algo_class.class == Class and algo_class.respond_to?(:new)\n raise \"Unknown filehash provider #{algo_class}\"\n end\n\n hash = algo_class.new()\n File.open(filename,'r') do |f|\n until f.eof?\n hash.update(f.read(READ_SIZE))\n end\n end\n\n return hash.hexdigest\n end",
"def hexdigest(*several_variants)\n #This is a stub, used for indexing\n end",
"def integrity_uri(digest)\n case digest\n when Digest::Base\n digest_class = digest.class\n digest = digest.digest\n when String\n digest_class = DIGEST_SIZES[digest.bytesize]\n else\n raise TypeError, \"unknown digest: #{digest.inspect}\"\n end\n\n if hash_name = HASH_ALGORITHMS[digest_class]\n \"#{hash_name}-#{pack_base64digest(digest)}\"\n end\n end",
"def integrity_uri(digest)\n case digest\n when Digest::Base\n digest_class = digest.class\n digest = digest.digest\n when String\n digest_class = DIGEST_SIZES[digest.bytesize]\n else\n raise TypeError, \"unknown digest: #{digest.inspect}\"\n end\n\n if hash_name = HASH_ALGORITHMS[digest_class]\n \"#{hash_name}-#{pack_base64digest(digest)}\"\n end\n end",
"def check_hash=(flag)\r\n @conf[:use_md5_digest] = flag\r\n end",
"def key_algorithm\n if self.rsa?\n :rsa\n elsif self.dsa?\n :dsa\n elsif self.ec?\n :ec\n end\n end",
"def algorithm\n \"HS256\"\n end",
"def to_param\n digest\n end",
"def generate_signature\n digest = OpenSSL::Digest.new('sha256')\n string_to_sign = \"#{@url_path}?#{sorted_parameters_query}\"\n OpenSSL::HMAC.hexdigest(digest, @api_secret_d, string_to_sign)\n end",
"def create_digest(string, bit_size)\n Digest::SHA1.hexdigest(string).hex.to_s(2).rjust(40*4, '0')[0..bit_size-1].to_i(2)\nend",
"def digest(data); end",
"def digest(message)\n OpenSSL::HMAC.digest SHA256, @secret, message\n end",
"def encode_signature(algo, signature)\n encode_string(algo) + encode_string(signature)\n end",
"def reset\n check_valid\n OpenSSL::LibCrypto.EVP_DigestInit_ex(self, self.md, nil)\n self\n end",
"def generate_digest(message)\n MD4_MAC.new(@key, message).digest\n end",
"def digest_key(digest)\n \"asset-uri-digest:#{compressed_path}:#{digest}\"\n end",
"def calc_digest(password)\n return nil unless password\n algorithm.encode(password)\n end",
"def sign_type\n @sign_type ||= :md5\n end",
"def parse_wwwauth_digest param_string\n params = parse_quoted_wwwauth param_string\n qop = params[:qop] ? params[:qop].split(\",\") : nil\n\n param_string.gsub(/stale=([^,]*)/) do\n params[:stale] = ($1.downcase == \"true\")\n end\n\n params[:algorithm] = \"MD5\"\n param_string.gsub(/algorithm=([^,]*)/) { params[:algorithm] = $1 }\n\n params\n end",
"def hmac_sha(digest_name, key, input)\n OpenSSL::HMAC.digest(digest_name, key, input)\n end",
"def key_algorithm\n if @req.public_key.kind_of? OpenSSL::PKey::RSA then\n 'RSA'\n elsif @req.public_key.kind_of? OpenSSL::PKey::DSA then\n 'DSA'\n end\n end",
"def digest( str )\n Digest::SHA1.hexdigest( str )\n end",
"def certificate_id_digest_method\n super\n end",
"def algorithm=(alg)\n return @algorithm if Algorithm::EXISTING == alg\n case alg\n when String\n @algorithm = Algorithm.algorithm_from_name(alg)\n when ::HTAuth::Algorithm\n @algorithm = alg\n else\n raise InvalidAlgorithmError, \"Unable to assign #{alg} to algorithm\"\n end\n return @algorithm\n end",
"def algorithm=(new_algorithm=\"\")\n (raise CloudLB::Exception::MissingArgument, \"Must provide a new name\") if new_algorithm.to_s.empty?\n body = {\"algorithm\" => new_algorithm.to_s.upcase}\n update(body)\n end",
"def digest(*args)\n return @digest if args.empty?\n\n self.type = :digest\n @digest = args.flatten.compact\n end",
"def dave(new_str)\r\n new_hash = Digest::SHA256.hexdigest new_str\r\n return new_hash\r\nend",
"def digest(string)\n @digest_class.new(string).digest\n end",
"def aes_cts_hmac_sha1_96(algorithm, raw_secret, salt)\n iterations = 4096\n cipher = OpenSSL::Cipher::AES.new(algorithm)\n key = OpenSSL::PKCS5.pbkdf2_hmac_sha1(raw_secret, salt, iterations, cipher.key_len)\n plaintext = \"kerberos\\x7B\\x9B\\x5B\\x2B\\x93\\x13\\x2B\\x93\".b\n result = ''.b\n loop do\n cipher.reset\n cipher.encrypt\n cipher.iv = \"\\x00\".b * 16\n cipher.key = key\n ciphertext = cipher.update(plaintext)\n result += ciphertext\n break unless result.size < cipher.key_len\n\n plaintext = ciphertext\n end\n result\n end",
"def params_digest\n # return Digest::SHA1.hexdigest(params.sort.flatten.join(\"_\"))\n Digest::SHA1.hexdigest(params.to_s)\n end",
"def initialize(name, aes_size, sha_size, alg)\n @name = name\n @aes_size = aes_size\n @sha_size = sha_size\n @cipher_name = \"aes-#{aes_size}-cbc\"\n @alg = alg\n @digest = OpenSSL::Digest.new(\"sha#{@sha_size}\")\n end",
"def digest_name(name)\n Digest::SHA2.hexdigest(short_name(name))[0..24]\n end",
"def hexdigest\n DigestUtils.pack_hexdigest(digest)\n end",
"def sha256; end",
"def params_digest\n return Digest::SHA1.hexdigest(params.sort.flatten.join(\"_\"))\n end",
"def digest\n Digest::SHA1.hexdigest(self)\n end",
"def signature_for(string)\n format('sha1=%s'.freeze, generate_hmac(string))\n end",
"def build_signature\n sig = case signature_method\n when \"HMAC-SHA1\"\n Base64.encode64(HMAC::SHA1.digest(signature_secret, signature_base_string)).chomp.gsub(/\\n/,'')\n when \"HMAC-MD5\"\n Base64.encode64(HMAC::MD5.digest(signature_secret, signature_base_string)).chomp.gsub(/\\n/,'')\n else\n false\n end\n Merb::Parse.escape(sig)\n end",
"def hexdigest!()\n #This is a stub, used for indexing\n end",
"def digest\n Digest::SHA1.hexdigest(@pub.to_der)\n end",
"def digest\n ''\n end",
"def digest\n ''\n end",
"def calc_digest input\n Digest::SHA1.hexdigest(input.to_s).\n\n # XXX: surround all digits with alphabets so\n # Maruku doesn't change them into HTML\n gsub(/\\d/, 'z\\&z')\n end",
"def digest(data)\n OpenSSL::HMAC.digest(digest_class.new, key, data)[0,mac_length]\n end",
"def update_signature!; end",
"def update_signature!; end",
"def ssh_signature_type; end",
"def ssh_signature_type; end",
"def ssh_signature_type; end",
"def sign_without_token(params)\n Digest::MD5::hexdigest(wrap_with_secret_without_token sorted_option_string(params)).upcase\n end",
"def randomart(dgst_alg = \"MD5\")\n fieldsize_x = 17\n fieldsize_y = 9\n x = fieldsize_x / 2\n y = fieldsize_y / 2\n\n case dgst_alg\n when \"MD5\" then raw_digest = Digest::MD5.digest(ssh_public_key_conversion)\n when \"SHA256\" then raw_digest = Digest::SHA2.new(256).digest(ssh_public_key_conversion)\n when \"SHA384\" then raw_digest = Digest::SHA2.new(384).digest(ssh_public_key_conversion)\n when \"SHA512\" then raw_digest = Digest::SHA2.new(512).digest(ssh_public_key_conversion)\n else\n raise \"Unknown digest algorithm: #{digest}\"\n end\n\n augmentation_string = \" .o+=*BOX@%&#/^SE\"\n len = augmentation_string.length - 1\n\n field = Array.new(fieldsize_x) { Array.new(fieldsize_y) {0} }\n\n raw_digest.bytes.each do |byte|\n 4.times do\n x += (byte & 0x1 != 0) ? 1 : -1\n y += (byte & 0x2 != 0) ? 1 : -1\n\n x = [[x, 0].max, fieldsize_x - 1].min\n y = [[y, 0].max, fieldsize_y - 1].min\n\n field[x][y] += 1 if (field[x][y] < len - 2)\n\n byte >>= 2\n end\n end\n\n fieldsize_x_halved = fieldsize_x / 2\n fieldsize_y_halved = fieldsize_y / 2\n\n field[fieldsize_x_halved][fieldsize_y_halved] = len - 1\n field[x][y] = len\n\n type_name_length_max = 4 # Note: this will need to be extended to accomodate ed25519\n bits_number_length_max = (bits < 1000 ? 3 : 4)\n formatstr = \"[%#{type_name_length_max}s %#{bits_number_length_max}u]\"\n output = \"+--#{sprintf(formatstr, type.upcase, bits)}----+\\n\"\n\n fieldsize_y.times do |y|\n output << \"|\"\n fieldsize_x.times do |x|\n output << augmentation_string[[field[x][y], len].min]\n end\n output << \"|\"\n output << \"\\n\"\n end\n output << \"+#{\"-\" * fieldsize_x}+\"\n output\n end",
"def hash_key(style_name = default_style)\n raise ArgumentError, \"Unable to generate hash without :hash_secret\" unless @options[:hash_secret]\n\n require \"openssl\" unless defined?(OpenSSL)\n data = interpolate(@options[:hash_data], style_name)\n OpenSSL::HMAC.hexdigest(OpenSSL::Digest.const_get(@options[:hash_digest]).new, @options[:hash_secret], data)\n end",
"def hexdigest(string)\n @digest_class.new(string).hexdigest\n end",
"def digest\n OpenSSL::HMAC.digest(\n OpenSSL::Digest.new('sha1'),\n secret,\n document\n )\n end",
"def generate_api_sig(options={})\n # Every request requires the api_key parameter\n options.merge! @auth\n # Keys must be sorted alphabetically\n api_sig = options.sort { |a, b| a.to_s <=> b.to_s }.join\n Digest::MD5.hexdigest(\"#{@secret}#{api_sig}\")\n end",
"def signature(args)\n str = args.to_s\n if str.length <= SHA1_THRESHHOLD\n args\n else\n Digest::SHA1.hexdigest args.to_s\n end\n end",
"def build_hash data\n digest = OpenSSL::Digest::Digest.new('md5')\n OpenSSL::HMAC.hexdigest(digest, @project_secret, data)\n end",
"def signature\n @signature ||= Base64.encode64(digest).gsub(\"\\n\", '')\n end"
] |
[
"0.7462788",
"0.7210203",
"0.7161311",
"0.7045905",
"0.66351146",
"0.6572472",
"0.65375257",
"0.65375257",
"0.6377582",
"0.6335187",
"0.61894286",
"0.6094229",
"0.6005794",
"0.5986462",
"0.5964601",
"0.59476775",
"0.5918975",
"0.59141046",
"0.5890726",
"0.5880813",
"0.5880813",
"0.5874893",
"0.58670884",
"0.57985085",
"0.57817554",
"0.57739586",
"0.57460386",
"0.5740886",
"0.5740886",
"0.57395554",
"0.57139415",
"0.57088876",
"0.5703017",
"0.5703017",
"0.5703017",
"0.56831604",
"0.5680041",
"0.56711394",
"0.5664149",
"0.5663628",
"0.5636197",
"0.56283957",
"0.5582334",
"0.55774146",
"0.5570218",
"0.5570218",
"0.556361",
"0.55344313",
"0.5528806",
"0.5521551",
"0.5520536",
"0.55078804",
"0.5494987",
"0.5494773",
"0.5492406",
"0.5492322",
"0.5478573",
"0.54584897",
"0.545043",
"0.54488486",
"0.5411527",
"0.53949946",
"0.539008",
"0.53879714",
"0.5387067",
"0.53855455",
"0.5383065",
"0.5369635",
"0.53643787",
"0.5358046",
"0.53561276",
"0.53546876",
"0.533588",
"0.5334778",
"0.53319395",
"0.532878",
"0.53172976",
"0.5315477",
"0.5315023",
"0.53144336",
"0.52996945",
"0.52924395",
"0.5283365",
"0.5283365",
"0.5280412",
"0.5272353",
"0.5261105",
"0.5261105",
"0.52587277",
"0.52587277",
"0.52587277",
"0.5257614",
"0.5257464",
"0.5252624",
"0.5248067",
"0.52477664",
"0.52359813",
"0.5232376",
"0.5229762",
"0.52266115"
] |
0.78329134
|
0
|
Receives certificate for signing and tries to guess a digest algorithm for signature creation. Will change +signature_digest_algorithm+ and +signature_algorithm_id+ for known certificate types and reset to defaults for others.
|
def cert=(certificate)
@cert = certificate
# Try to guess a digest algorithm for signature creation
case @cert.signature_algorithm
when 'GOST R 34.11-94 with GOST R 34.10-2001'
self.signature_digest_algorithm = :gostr3411
self.signature_algorithm_id = 'http://www.w3.org/2001/04/xmldsig-more#gostr34102001-gostr3411'
# Add clauses for other types of keys that require other digest algorithms and identifiers
else # most common 'sha1WithRSAEncryption' type included here
set_default_signature_method! # Reset any changes as they can become malformed
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def signature_digest_algorithm=(algorithm)\n @sign_digester = Kiji::Digester.new(algorithm)\n end",
"def set_default_signature_method!\n # self.signature_digest_algorithm = :sha1\n # self.signature_algorithm_id = 'http://www.w3.org/2000/09/xmldsig#rsa-sha1'\n self.signature_digest_algorithm = :sha256\n self.signature_algorithm_id = 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256'\n end",
"def signature_digest_algorithm\n @sign_digester.symbol || @sign_digester.digest_name\n end",
"def digest\n case @signature_method\n when \"HMAC-SHA256\" then OpenSSL::Digest.new(\"sha256\")\n when \"HMAC-SHA1\" then OpenSSL::Digest.new(\"sha1\")\n else\n fail InvalidSignatureMethodError\n end\n end",
"def digester_for_signature_method(algorithm_url)\n signature_digest_mapping = {\n 'http://www.w3.org/2000/09/xmldsig#rsa-sha1' => 'http://www.w3.org/2000/09/xmldsig#sha1',\n 'http://www.w3.org/2001/04/xmldsig-more#gostr34102001-gostr3411' => 'http://www.w3.org/2001/04/xmldsig-more#gostr3411',\n }\n digest_url = signature_digest_mapping[algorithm_url] || algorithm_url\n digester(digest_url)\n end",
"def certificate_id_digest_method\n super\n end",
"def sign!(signing_profile={})\n raise \"Invalid certificate #{self.errors.full_messages}\" unless valid?\n merge_profile_with_extensions(signing_profile)\n\n openssl_cert = OpenSSL::X509::Certificate.new\n openssl_cert.version = 2\n openssl_cert.not_before = self.not_before\n openssl_cert.not_after = self.not_after\n openssl_cert.public_key = self.key_material.public_key\n\n openssl_cert.serial = self.serial_number.number\n\n openssl_cert.subject = self.distinguished_name.to_x509_name\n openssl_cert.issuer = parent.distinguished_name.to_x509_name\n\n factory = OpenSSL::X509::ExtensionFactory.new\n factory.subject_certificate = openssl_cert\n\n #NB: If the parent doesn't have an SSL body we're making this a self-signed cert\n if parent.openssl_body.nil?\n factory.issuer_certificate = openssl_cert\n else\n factory.issuer_certificate = parent.openssl_body\n end\n\n factory.config = build_openssl_config\n\n # Order matters: e.g. for self-signed, subjectKeyIdentifier must come before authorityKeyIdentifier\n self.extensions.keys.sort{|a,b| b<=>a}.each do |k|\n e = extensions[k]\n next if e.to_s.nil? or e.to_s == \"\" ## If the extension returns an empty string we won't include it\n ext = factory.create_ext(e.openssl_identifier, e.to_s, e.critical)\n openssl_cert.add_extension(ext)\n end\n\n if signing_profile[\"digest\"].nil?\n digest = OpenSSL::Digest.new(\"SHA512\")\n else\n digest = OpenSSL::Digest.new(signing_profile[\"digest\"])\n end\n\n self.openssl_body = openssl_cert.sign(parent.key_material.private_key, digest)\n end",
"def set_certificate_id_digest_method(opts)\n opts = check_params(opts,[:digest_methods])\n super(opts)\n end",
"def fingerprint(digest, cert_file)\n if cert_file.is_a? String\n cert = OpenSSL::X509::Certificate.new(Util.read_file!(cert_file))\n elsif cert_file.is_a? OpenSSL::X509::Certificate\n cert = cert_file\n elsif cert_file.is_a? CertificateAuthority::Certificate\n cert = cert_file.openssl_body\n end\n digester = case digest\n when \"MD5\" then Digest::MD5.new\n when \"SHA1\" then Digest::SHA1.new\n when \"SHA256\" then Digest::SHA256.new\n when \"SHA384\" then Digest::SHA384.new\n when \"SHA512\" then Digest::SHA512.new\n end\n digester.hexdigest(cert.to_der)\n end",
"def verify_signature signature, data, chain, time = Time.now\n Gem.ensure_ssl_available\n cert_class = OpenSSL::X509::Certificate\n exc = Gem::Security::Exception\n chain ||= []\n\n chain = chain.map{ |str| cert_class.new(str) }\n signer, ch_len = chain[-1], chain.size\n opt = Gem::Security::OPT.merge(@opt)\n\n # make sure signature is valid\n if @verify_data\n # get digest algorithm (TODO: this should be configurable)\n dgst = opt[:dgst_algo]\n\n # verify the data signature (this is the most important part, so don't\n # screw it up :D)\n v = signer.public_key.verify(dgst.new, signature, data)\n raise exc, \"Invalid Gem Signature\" unless v\n\n # make sure the signer is valid\n if @verify_signer\n # make sure the signing cert is valid right now\n v = signer.check_validity(nil, time)\n raise exc, \"Invalid Signature: #{v[:desc]}\" unless v[:is_valid]\n end\n end\n\n # make sure the certificate chain is valid\n if @verify_chain\n # iterate down over the chain and verify each certificate against it's\n # issuer\n (ch_len - 1).downto(1) do |i|\n issuer, cert = chain[i - 1, 2]\n v = cert.check_validity(issuer, time)\n raise exc, \"%s: cert = '%s', error = '%s'\" % [\n 'Invalid Signing Chain', cert.subject, v[:desc]\n ] unless v[:is_valid]\n end\n\n # verify root of chain\n if @verify_root\n # make sure root is self-signed\n root = chain[0]\n raise exc, \"%s: %s (subject = '%s', issuer = '%s')\" % [\n 'Invalid Signing Chain Root',\n 'Subject does not match Issuer for Gem Signing Chain',\n root.subject.to_s,\n root.issuer.to_s,\n ] unless root.issuer.to_s == root.subject.to_s\n\n # make sure root is valid\n v = root.check_validity(root, time)\n raise exc, \"%s: cert = '%s', error = '%s'\" % [\n 'Invalid Signing Chain Root', root.subject, v[:desc]\n ] unless v[:is_valid]\n\n # verify that the chain root is trusted\n if @only_trusted\n # get digest algorithm, calculate checksum of root.subject\n algo = opt[:dgst_algo]\n path = Gem::Security::Policy.trusted_cert_path(root, opt)\n\n # check to make sure trusted path exists\n raise exc, \"%s: cert = '%s', error = '%s'\" % [\n 'Untrusted Signing Chain Root',\n root.subject.to_s,\n \"path \\\"#{path}\\\" does not exist\",\n ] unless File.exist?(path)\n\n # load calculate digest from saved cert file\n save_cert = OpenSSL::X509::Certificate.new(File.read(path))\n save_dgst = algo.digest(save_cert.public_key.to_s)\n\n # create digest of public key\n pkey_str = root.public_key.to_s\n cert_dgst = algo.digest(pkey_str)\n\n # now compare the two digests, raise exception\n # if they don't match\n raise exc, \"%s: %s (saved = '%s', root = '%s')\" % [\n 'Invalid Signing Chain Root',\n \"Saved checksum doesn't match root checksum\",\n save_dgst, cert_dgst,\n ] unless save_dgst == cert_dgst\n end\n end\n\n # return the signing chain\n chain.map { |cert| cert.subject }\n end\n end",
"def sign_certificate\n sign_certificate_for(default)\n end",
"def fingerprint(algorithm='sha1')\n message_digest = R509::MessageDigest.new(algorithm)\n md = message_digest.digest\n md.update(@cert.to_der)\n md.to_s\n end",
"def fingerprint(algorithm = 'sha256')\n message_digest = R509::MessageDigest.new(algorithm)\n md = message_digest.digest\n md.update(@cert.to_der)\n md.to_s\n end",
"def signing_algorithm\n signing_key.is_a?(String) ? \"HS256\" : \"RS256\"\n end",
"def calculate_signature\n normalized_string = [\n request_header.timestamp,\n request_header.nonce,\n request_header.algorithm,\n method.upcase,\n host_with_port,\n request_uri\n ].join(',')\n\n ActiveSupport::Base64.encode64s(OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha256'), secret, normalized_string))\n end",
"def signature_1 \n @signature1 ||= read_certificate(\"certificate1\")\n end",
"def cert_digest\n Digest::SHA1.hexdigest(@cert.to_der)\n end",
"def signature\n subject = self.class.sig_subject([@payload,\n DATA_TYPE,\n ENCODING,\n ALGORITHM])\n @rsa_pkey.sign(DIGEST, subject)\n end",
"def verify_gem(signature, data, chain, time = Time.now)\n\tGem.ensure_ssl_available\n cert_class = OpenSSL::X509::Certificate\n exc = Gem::Security::Exception\n chain ||= []\n\n chain = chain.map{ |str| cert_class.new(str) }\n signer, ch_len = chain[-1], chain.size\n\n # make sure signature is valid\n if @verify_data\n # get digest algorithm (TODO: this should be configurable)\n dgst = @opt[:dgst_algo]\n\n # verify the data signature (this is the most important part,\n # so don't screw it up :D)\n v = signer.public_key.verify(dgst.new, signature, data)\n raise exc, \"Invalid Gem Signature\" unless v\n \n # make sure the signer is valid\n if @verify_signer\n # make sure the signing cert is valid right now\n v = signer.check_validity(nil, time)\n raise exc, \"Invalid Signature: #{v[:desc]}\" unless v[:is_valid]\n end\n end\n\n # make sure the certificate chain is valid\n if @verify_chain\n # iterate down over the chain and verify each certificate\n # against it's issuer\n (ch_len - 1).downto(1) do |i|\n issuer, cert = chain[i - 1, 2]\n v = cert.check_validity(issuer, time)\n raise exc, \"%s: cert = '%s', error = '%s'\" % [\n 'Invalid Signing Chain', cert.subject, v[:desc] \n ] unless v[:is_valid]\n end\n\n # verify root of chain\n if @verify_root\n # make sure root is self-signed\n root = chain[0]\n raise exc, \"%s: %s (subject = '%s', issuer = '%s')\" % [\n 'Invalid Signing Chain Root', \n 'Subject does not match Issuer for Gem Signing Chain',\n root.subject.to_s,\n root.issuer.to_s,\n ] unless root.issuer.to_s == root.subject.to_s\n\n # make sure root is valid\n v = root.check_validity(root, time)\n raise exc, \"%s: cert = '%s', error = '%s'\" % [\n 'Invalid Signing Chain Root', root.subject, v[:desc] \n ] unless v[:is_valid]\n\n # verify that the chain root is trusted\n if @only_trusted\n # get digest algorithm, calculate checksum of root.subject\n algo = @opt[:dgst_algo]\n path = Gem::Security::Policy.trusted_cert_path(root, @opt)\n\n # check to make sure trusted path exists\n raise exc, \"%s: cert = '%s', error = '%s'\" % [\n 'Untrusted Signing Chain Root',\n root.subject.to_s,\n \"path \\\"#{path}\\\" does not exist\",\n ] unless File.exists?(path)\n\n # load calculate digest from saved cert file\n save_cert = OpenSSL::X509::Certificate.new(File.read(path))\n save_dgst = algo.digest(save_cert.public_key.to_s)\n\n # create digest of public key\n pkey_str = root.public_key.to_s\n cert_dgst = algo.digest(pkey_str)\n\n # now compare the two digests, raise exception\n # if they don't match\n raise exc, \"%s: %s (saved = '%s', root = '%s')\" % [\n 'Invalid Signing Chain Root',\n \"Saved checksum doesn't match root checksum\",\n save_dgst, cert_dgst,\n ] unless save_dgst == cert_dgst\n end\n end\n\n # return the signing chain\n chain.map { |cert| cert.subject } \n end\n end",
"def reset\n check_valid\n OpenSSL::LibCrypto.EVP_DigestInit_ex(self, self.md, nil)\n self\n end",
"def fingerprint(cert)\n unless cert.is_a? OpenSSL::X509::Certificate\n cert = OpenSSL::X509::Certificate.new cert\n end\n\n signature = OpenSSL::Digest::SHA256.new(cert.to_der).to_s\n signature.scan(/../).map{ |s| s.upcase }.join(\":\")\n end",
"def digest_algorithm\n @digester.symbol || @digester.digest_name\n end",
"def digester(type=nil)\n require 'openssl'\n case type.to_s.downcase\n when 'md5'\n require 'digest/md5'\n ::Digest::MD5\n when 'sha128', 'sha1'\n require 'digest/sha1' #need?\n OpenSSL::Digest::SHA1\n when 'sha256'\n require 'digest/sha1' #need?\n OpenSSL::Digest::SHA256\n when 'sha512'\n require 'digest/sha1' #need?\n OpenSSL::Digest::SHA512\n else\n raise \"unsupported digest #{type}\"\n end\n end",
"def createsignature(str)\r\n signature_raw = sign(str)\r\n signature_der = ECDSA::Format::SignatureDerString.encode(signature_raw)\r\n signature_der_b64 = Base64.strict_encode64(signature_der) \r\n digest_raw = Digest::SHA256.digest(str)\r\n digest_b64 = Base64.encode64(digest_raw)\r\n #Base64 encoding was used due to the readablility, and transportability. \r\n puts(\"Signature (b64 encoded der): \"+signature_der_b64)\r\n puts(\"Digest (b64 endoded): \"+digest_b64)\r\n $signature_array.push(signature_der_b64)\r\n $digest_array.push(digest_b64)\r\n #return signature_der_b64\r\nend",
"def digest_algorithm=(algorithm)\n @digester = Kiji::Digester.new(algorithm)\n end",
"def certificate_for\n @certificate_for || :default\n end",
"def generate_signature\n sha1x16 = Digest::SHA1.hexdigest(signed_string)\n .tap { |s| logger.debug \"sha1x16 #{s}\" }\n enc = case form_fields['signMethod']\n when '01' # 01 means RSA\n merchant_private_key.sign(OpenSSL::Digest::SHA1.new, sha1x16)\n .tap { |s| logger.debug \"enc #{s}\" }\n else # at current time (2015-05-25) no other signing method is mentioned in Unionpay's official docs\n raise \"sign method #{form_fields['signMethod']} is not implemented yet.\"\n end\n Base64.strict_encode64(enc) # has to be strict_encode64, not encode64, as the latter as an extra '\\n'\n .tap { |s| logger.debug \"final: #{s}\" }\n end",
"def default_signer(string_to_sign)\n key = @storage_json.authorization.signing_key\n key = OpenSSL::PKey::RSA.new(@storage_json.authorization.signing_key) unless key.respond_to?(:sign)\n digest = OpenSSL::Digest::SHA256.new\n return key.sign(digest, string_to_sign)\n end",
"def sign_type\n @sign_type ||= :md5\n end",
"def cert_sha1_fingerprint certificate\n fingerprint = OpenSSL::Digest::SHA1.hexdigest certificate.to_der\n\n # Format it the same way OpenSSL does.\n fingerprint = fingerprint.chars.each_slice(2).map(&:join).join ':'\n fingerprint.upcase\n end",
"def digest_type\n DIGESTS.each do |digest|\n return digest if source.key? digest\n end\n raise ChecksumMissing.new(self)\n end",
"def verify!\n verify\n rescue InvalidDigest, InvalidSignedValue => e\n raise InvalidSignature, e.message\n end",
"def verify!\n verify\n rescue InvalidDigest, InvalidSignedValue => e\n raise InvalidSignature, e.message\n end",
"def generate_signature(string_to_sign)\n digest = OpenSSL::Digest.new('sha256')\n OpenSSL::HMAC.hexdigest(digest, @api_secret, string_to_sign)\n end",
"def signature\n digest = \"SHA256\"\n OpenSSL::HMAC.hexdigest(digest, signing_key, string_to_sign)\n end",
"def compute_signature(env)\n message = BuildMessage.new(env).build!\n HmacSignature.new(shared_key(env), message).sign\n end",
"def formatted_signature(signature)\n n = (verify_key_length.to_f / BYTE_LENGTH).ceil\n\n if signature.size == n * 2\n r = signature[0..(n - 1)]\n s = signature[n..-1]\n\n OpenSSL::ASN1::Sequence.new([r, s].map { |int| OpenSSL::ASN1::Integer.new(OpenSSL::BN.new(int, 2)) }).to_der\n else\n signature\n end\n end",
"def generate_signature\n digest = OpenSSL::Digest.new('sha256')\n string_to_sign = \"#{@url_path}?#{sorted_parameters_query}\"\n OpenSSL::HMAC.hexdigest(digest, @api_secret_d, string_to_sign)\n end",
"def sign data\n return unless @key\n\n @key.sign @digest_algorithm.new, data\n end",
"def sign!(cert)\n openssl_cert = cert.cert # because model -> OpenSSL object\n openssl_cert.serial = self.next_serial\n cert.serial = self.next_serial\n openssl_cert.issuer = ca_cert.subject\n openssl_cert.sign private_key, OpenSSL::Digest::SHA1.new\n self.next_serial = self.next_serial + 1\n self.save\n nil\n end",
"def process_signing\n if sign_file?\n @appearance = @stamper.getSignatureAppearance().to_java(Java::ComLowagieTextPdf::PdfSignatureAppearance)\n @appearance.setCrypto(@private_key, @cert_chain, nil, Java::ComLowagieTextPdf::PdfSignatureAppearance::WINCER_SIGNED)\n end\n end",
"def verify_signatures spec, digests, signatures\n if only_signed and signatures.empty? then\n raise Gem::Security::Exception,\n \"unsigned gems are not allowed by the #{name} policy\"\n end\n\n digests.each do |file, digest|\n signature = signatures[file]\n raise Gem::Security::Exception, \"missing signature for #{file}\" unless\n signature\n verify_signature signature, digest.digest, spec.cert_chain\n end\n end",
"def certificate_signing_request\n return @certificate_signing_request\n end",
"def ecdsa_signature(hash, normalized: true)\n BTC::OpenSSL.ecdsa_signature(hash, @private_key, normalized: normalized)\n end",
"def sign!(options = {})\n binary_security_token_node if options[:security_token]\n x509_data_node if options[:issuer_serial]\n\n if options[:inclusive_namespaces]\n c14n_method_node = signed_info_node.at_xpath('ds:CanonicalizationMethod', ds: 'http://www.w3.org/2000/09/xmldsig#')\n inclusive_namespaces_node = Nokogiri::XML::Node.new('ec:InclusiveNamespaces', document)\n inclusive_namespaces_node.add_namespace_definition('ec', c14n_method_node['Algorithm'])\n inclusive_namespaces_node['PrefixList'] = options[:inclusive_namespaces].join(' ')\n c14n_method_node.add_child(inclusive_namespaces_node)\n end\n\n signed_info_canon = canonicalize(signed_info_node, options[:inclusive_namespaces])\n\n signature = private_key.sign(@sign_digester.digester, signed_info_canon)\n signature_value_digest = Base64.encode64(signature).delete(\"\\n\")\n\n signature_value_node = Nokogiri::XML::Node.new('SignatureValue', document)\n signature_value_node.content = signature_value_digest\n signed_info_node.add_next_sibling(signature_value_node)\n self\n end",
"def sign(data)\n if rsa?\n @priv.sign(OpenSSL::Digest::SHA1.new,data)\n elsif dsa?\n # DSS1 was dropped from OpenSSL in version 1.1\n # @priv.sign(OpenSSL::Digest::DSS1.new,data)\n raise StandardError, 'DSA is not supported'\n end\n end",
"def get_secure_signature(message)\n digest = OpenSSL::Digest.new('SHA256')\n Base64.strict_encode64(private_key.sign(digest, message))\n end",
"def handle_signing(jwt, key=nil)\n if jwt.alg =~ /none/i\n jwt.to_s\n else\n raise JSON::JWS::UnexpectedAlgorithm.new(\"Encryption algorithm '#{jwt.alg}' requires key.\") if key.nil?\n alg = jwt.alg.upcase\n case\n when alg.start_with?(\"HS\")\n key\n when alg.start_with?(\"RS\")\n key = OpenSSL::PKey::RSA.new(key)\n when alg.start_with?(\"PS\")\n key = OpenSSL::PKey::RSA.new(key)\n when alg.start_with?(\"ES\")\n # key = OpenSSL::PKey::RSA.new(key)\n print_error(\"Signing for ECDSA-SHA is not yet implemented\")\n print_warning 'Please report the issue to: https://github.com/KINGSABRI/jwtear/issues'.underline\n else\n print_warning(\"Undefined algorithm. This might generate a wrong token\")\n print_warning 'Please report the issue to: https://github.com/KINGSABRI/jwtear/issues'.underline\n key\n end\n jwt.alg = alg.to_sym\n jwt.sign(key).to_s\n end\n end",
"def sign_request\n # By default OpenSSL generates an all-zero array for the encriptation vector\n # You can read it here: http://ruby-doc.org/stdlib-1.9.3/libdoc/openssl/rdoc/OpenSSL/Cipher.html#method-i-iv-3D\n # If you want to declare it, you can take a look at the next couple of lines\n #bytes = Array.new(8,0)\n #iv = bytes.map(&:chr).join\n # We need to decode the secret key\n key = Base64.strict_decode64(credentials[:secret_key])\n # In thee cipher initialization we need to speficy the encryptation like method-length-mode (http://ruby-doc.org/stdlib-1.9.3/libdoc/openssl/rdoc/OpenSSL/Cipher.html#method-c-new).\n # Sermepa needs DES3 in CBC mode\n # The direct way the declare it's: des-ede3-cbc\n # You can also declare like 'des3' wich use CBC mode by default\n des3 = OpenSSL::Cipher::Cipher.new('des-ede3-cbc')\n # OpenSSL use by default PKCS padding. But Sermepa (mcrypt_encrypt PHP function) use zero padding.\n # OpenSSL do not allow zero padding. So we need to disable the default padding and make zero padding by hand\n # Padding in cryptography is to fill the data with especial characteres in order to use the data in blocks of N (https://en.wikipedia.org/wiki/Padding_(cryptography))\n # We need to use blocks of 8 bytes\n block_length = 8\n # We tell OpenSSL not to pad\n des3.padding = 0\n # We want to encrypt\n des3.encrypt\n # Key set\n des3.key = key\n #des3.iv = iv\n order_number = @fields[\"Ds_Merchant_Order\"]\n # Here is the 'magic'. Instead use the default OpenSSL padding (PKCS). We fill with \\0 till the data have\n # a multiple of the block size (8, 16, 24...)\n order_number += \"\\0\" until order_number.bytesize % block_length == 0\n # For example: the string \"123456789\" will be transform in \"123456789\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n # data must be in blocks of 8 or the update will break\n key_des3 = des3.update(order_number) + des3.final\n # The next step is to encrypt in SHA256 the resulting des3 key with the base64 json\n result = OpenSSL::HMAC.digest('sha256', key_des3, merchant_parameters_base64_json)\n # The last step is to encode the data in base64\n Base64.strict_encode64(result)\n end",
"def rsaes_pkcs_signature(key, input)\n private_key = if BSON::Environment.jruby?\n # JRuby cannot read DER format, we need to convert key into PEM first.\n key_pem = [\n \"-----BEGIN PRIVATE KEY-----\",\n Base64.strict_encode64(Base64.decode64(key)).scan(/.{1,64}/),\n \"-----END PRIVATE KEY-----\",\n ].join(\"\\n\")\n OpenSSL::PKey::RSA.new(key_pem)\n else\n OpenSSL::PKey.read(Base64.decode64(key))\n end\n private_key.sign(OpenSSL::Digest::SHA256.new, input)\n end",
"def parse_signed_request(signed_request)\n encoded_sig, payload = signed_request.split('.')\n sig = base64decode(encoded_sig)\n data = JSON.parse base64decode(payload)\n return \"-1\" if data['algorithm'].upcase != \"HMAC-SHA256\"\n \n digest = OpenSSL::Digest.new(\"SHA256\")\n expected_sig = OpenSSL::HMAC.digest(digest, @client.secret, payload)\n (sig != expected_sig) ? \"-2\" : data\n end",
"def signature(timestamp, nonce, verb, url)\n nsurl = NSURL.URLWithString(url.to_s)\n fail(ArgumentError, \"could not parse \\\"#{url}\\\" into NSURL\") unless nsurl.host\n\n path = nsurl.path\n path = \"/\" if path == \"\"\n\n port = nsurl.port\n port = nsurl.scheme == \"https\" ? 443 : 80 unless port\n\n signature = [\n timestamp,\n nonce,\n verb.to_s.upcase,\n path,\n nsurl.host,\n port,\n \"\", nil\n ].join(\"\\n\")\n\n digest = CocoaSecurity.send(algorithm, signature, secret)\n digest.base64\n end",
"def signature\n @signature ||= Base64.encode64(digest).gsub(\"\\n\", '')\n end",
"def prepare_for_signature\n prepare\n end",
"def validate_signature(doc, certificate, canonicalization_method)\n node = doc.at('xmlns|SignedInfo', xmlns: DSIG)\n\n return false unless node\n\n node = case canonicalization_method\n when :normal\n node.canonicalize\n when :exclusive\n canonicalize_exclusively node\n end\n\n signature = doc.at('xmlns|SignatureValue', xmlns: DSIG).content\n signature = decode(signature)\n\n # Return true or false\n certificate.public_key.verify(OpenSSL::Digest::SHA1.new, signature, node)\n end",
"def digest_class\n Digest::SHA256\n end",
"def digest_class\n Digest::SHA256\n end",
"def digest\n @digest ||= DEFAULT_DIGEST_PROC\n end",
"def create_certificate\n visit CREATE_CERT_URL\n wait_for_elements(\"form[name='certificateSave']\")\n\n Helper.log.info \"Creating a new code signing certificate\"\n\n # select certificate type\n if @type == DEVELOPMENT\n app_store_toggle = first(\"input#type-development\")\n else\n app_store_toggle = first(\"input#type-iosNoOCSP\") || first(\"input#type-iosOCSP\")\n end\n \n if !!app_store_toggle['disabled']\n # Limit of certificates already reached\n raise \"Could not create another certificate, reached the maximum number of available certificates.\".red\n end\n\n app_store_toggle.click\n\n click_next # submit the certificate type\n sleep 2\n click_next # information about how to upload the file (no action required on this step)\n\n cert_signing_request = Cert::SigningRequest.get_path\n Helper.log.info \"Uploading the cert signing request '#{cert_signing_request}'\"\n\n wait_for_elements(\"input[name='upload']\").first.set cert_signing_request # upload the cert signing request\n sleep 1\n click_next\n\n sleep 3\n\n while all(:css, '.loadingMessage').count > 0\n Helper.log.debug \"Waiting for iTC to generate the profile\"\n sleep 2\n end\n\n Helper.log.info \"Downloading newly generated certificate\"\n sleep 2\n\n # Now download the certificate\n download_button = wait_for_elements(\".button.small.blue\").first\n url = download_button['href']\n\n path = File.join(Cert.config[:output_path], \"certificate.cer\")\n download_url(url, path)\n\n certificate_id = url.match(/.*displayId=(.*)&type.*/)[1]\n\n ENV[\"CER_FILE_PATH\"] = path\n ENV[\"CER_CERTIFICATE_ID\"] = certificate_id\n Helper.log.info \"Successfully downloaded latest .cer file to '#{path}' (#{certificate_id})\".green\n\n Cert::KeychainImporter::import_file(path) unless Cert.config[:skip_keychain_import]\n rescue => ex\n error_occured(ex)\n end",
"def signature\n # Remove 'sha_sign' key from request params and concatenate all\n # key value pairs\n params = payload.to_h\n .reject { |key, value| key == :sha_sign }\n .reject { |key, value| value == '' || value == false }.sort\n .map { | key, value| \"#{key}=#{value}#{passphrase}\" }.join\n\n # Calculate SHA512 and upcase all letters, since Digistore will\n # also return upcased letters in the signature.\n Digest::SHA512.hexdigest(params).upcase\n end",
"def parsed_certificate\n OpenSSL::X509::Certificate.new(certificate_bytes)\n end",
"def verify(signed_data, signature)\n sig_algo, raw_sig, _ = Encoding.decode_signature(signature)\n digest = ALGO_DIGESTS[sig_algo]\n\n if digest.nil?\n raise DecodeError, \"bad signature algorithm: #{sig_algo.inspect}\"\n end\n\n openssl.verify(digest.new, raw_sig, signed_data)\n end",
"def verify(signed_data, signature)\n sig_algo, raw_sig, _ = Encoding.decode_signature(signature)\n digest = ALGO_DIGESTS[sig_algo]\n\n if digest.nil?\n raise DecodeError, \"bad signature algorithm: #{sig_algo.inspect}\"\n end\n\n # OpenSSH compatibility: if a the number of bytes in the signature is less than the number of bytes of the RSA\n # modulus, prepend the signature with zeros.\n # See https://github.com/openssh/openssh-portable/blob/ac383f3a5c6f529a2e8a5bc44af79a08c7da294e/ssh-rsa.c#L531\n difference = n.num_bytes - raw_sig.bytesize\n raw_sig = \"\\0\" * difference + raw_sig if difference.positive?\n\n openssl.verify(digest.new, raw_sig, signed_data)\n end",
"def expected_digest\n OpenSSL::HMAC.digest(HMAC_ALGORITHM, Octokey::Config.hmac_secret, unsigned_buffer.raw)\n end",
"def solve\n init_signature\n compute_hashes\n compute_signature\n recommendations\n end",
"def certificate_signing_request=(value)\n @certificate_signing_request = value\n end",
"def hmac_signature_with_openssl(key, base64_json)\n base64(OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha1'), key, base64_json))\n end",
"def gen_sig(mac, params)\n signed = params[\"signed\"].split(\",\").map {|k| [k, params[k]]}\n base64_encode(Signatures.sign(mac, kv_encode(signed)))\n rescue Signatures::NotFound\n nil\n end",
"def verify_ecdsa_signature(signature, hash)\n BTC::OpenSSL.ecdsa_verify(signature, hash, self.public_key)\n end",
"def signature_verify( doc )\n # 1. Figure out signature namespace prefix\n sig_ns, prefix = signature_namespace_and_prefix( doc )\n\n # 2.a Signer present?\n @signer_node = doc.xpath( \"//#{ namespace_prefix( doc, doc.root.namespace.href ) }:Signer\" )\n if @signer_node.size != 1\n @messages << \"#{ @signer_node.size == 0 ? 'No' : @signer_node.size } Signer node#{ @signer_node.size > 1 ? 's' : '' } found\"\n end\n\n # 2.b Signature present?\n @signature_node = doc.xpath( \"//#{ prefix }:Signature\", sig_ns )\n if @signature_node.size != 1\n @messages << \"#{ @signature_node.size == 0 ? 'No' : @signature_node.size } Signature node#{ @signature_node.size > 1 ? 's' : '' } found\"\n end\n\n # 2.c Abort if none or more than 1 Signer or Signature node\n return FALSE if ( @signer_node.size != 1 or @signature_node.size != 1 )\n\n # 3. Extract and check signer certs\n certs = extract_certs( doc, sig_ns, prefix )\n @crypto = DC_Signer_Crypto_Compliance.new( certs )\n\n if ! @crypto.valid?\n if ! @crypto.errors[ :pre_context ].empty?\n @crypto.errors[ :pre_context ].each do |e|\n @messages << e\n end\n return FALSE\n else\n # Compliance issues in the extracted certs.\n # List those errors but then try to continue anyway,\n # thus allowing for inspection of compliance issues and signature in context.\n @crypto.messages.each do |e|\n @messages << e\n end\n end\n else # cc is valid\n @messages << \"Certificate chain is complete and compliant (#{ @crypto.type })\"\n end\n\n # 3.a Might check here whether the signer chain is known, trustworthy etc.\n #\n # See 3 for @crypto validity hop-over\n #\n\n # 4. Get signer's public key\n pub_k = @crypto.context.first.public_key\n\n # 5. Check references and signature value\n @reference_digests_check = check_references( doc, sig_ns, prefix )\n @signature_value_check = check_signature_value( doc, sig_ns, prefix, pub_k )\n\n return TRUE\n end",
"def sign_legacy(private_key)\n ctx = Secp256k1::Context.new\n signature, recovery_id = ctx.sign_recoverable(private_key, hash).compact\n result = signature.bytes\n result = result.append(27 + recovery_id)\n result.pack('c*')\n end",
"def build_signature\n sig = case signature_method\n when \"HMAC-SHA1\"\n Base64.encode64(HMAC::SHA1.digest(signature_secret, signature_base_string)).chomp.gsub(/\\n/,'')\n when \"HMAC-MD5\"\n Base64.encode64(HMAC::MD5.digest(signature_secret, signature_base_string)).chomp.gsub(/\\n/,'')\n else\n false\n end\n Merb::Parse.escape(sig)\n end",
"def create_signature(dev_id, api_method, auth_key, formatted_timestamp)\n # ts = Time.at(timestamp).strftime(\"%Y%m%d%H%M%S\")\n raw_sig = \"#{dev_id}#{api_method}#{auth_key}#{formatted_timestamp}\"\n Digest::MD5.hexdigest(raw_sig)\n end",
"def correct_signature?\n client = RestClient.where(:api_key => @api_key).first\n sign=client.nil? ? \"\" : client.secret + @request_uri.gsub(/\\?.*/,\"\")+@timestamp\n calculated_sign= (Digest::SHA256.new << sign).to_s\n Digest::SHA1.hexdigest(@signature)==Digest::SHA1.hexdigest(calculated_sign)\n end",
"def update_signature!; end",
"def update_signature!; end",
"def signature_verify( doc )\n # 1. Figure out signature namespace prefix\n sig_ns, prefix = signature_namespace_and_prefix( doc )\n\n # 2.a Signer present?\n @signer_node = doc.xpath( \"//#{ namespace_prefix( doc, doc.root.namespace.href ) }:Signer\" )\n if @signer_node.size != 1\n @messages << \"#{ @signer_node.size == 0 ? 'No' : @signer_node.size } Signer node#{ @signer_node.size > 1 ? 's' : '' } found\"\n end\n\n # 2.b Signature present?\n @signature_node = doc.xpath( \"//#{ prefix }:Signature\", sig_ns )\n if @signature_node.size != 1\n @messages << \"#{ @signature_node.size == 0 ? 'No' : @signature_node.size } Signature node#{ @signature_node.size > 1 ? 's' : '' } found\"\n end\n\n # 2.c Abort if none or more than 1 Signer or Signature node\n return false if ( @signer_node.size != 1 or @signature_node.size != 1 )\n\n # 3. Extract and check signer certs\n certs = extract_certs( doc, sig_ns, prefix )\n @crypto = DC_Signer_Crypto_Compliance.new( certs )\n\n if ! @crypto.valid?\n if ! @crypto.errors[ :pre_context ].empty?\n @crypto.errors[ :pre_context ].each do |e|\n @messages << e\n end\n return false\n else\n # Compliance issues in the extracted certs.\n # List those errors but then try to continue anyway,\n # thus allowing for inspection of compliance issues and signature in context.\n @crypto.messages.each do |e|\n @messages << e\n end\n end\n else # cc is valid\n @messages << \"Certificate chain is complete and compliant (#{ @crypto.type })\"\n end\n\n # 3.a Might check here whether the signer chain is known, trustworthy etc.\n #\n # See 3 for @crypto validity hop-over\n #\n\n # 4. Get signer's public key\n pub_k = @crypto.context.first.public_key\n\n # 5. Check references and signature value\n @reference_digests_check = check_references( doc, sig_ns, prefix )\n @signature_value_check = check_signature_value( doc, sig_ns, prefix, pub_k )\n\n return true\n end",
"def sign_legacy(private_key)\n ctx = Secp256k1::Context.new\n signature, recovery_id = ctx.sign_recoverable(private_key, hash).compact\n result = signature.bytes\n result = result.append(27 + recovery_id)\n result.pack('c*')\n end",
"def initialize_with_sign_and_crypt(method_name, *parameters)\n mail = initialize_without_sign_and_crypt(method_name, *parameters)\n\n x509_initvar()\n\n # If we need to sign the outgoing mail.\n if should_sign? or should_crypt?\n if logger\n logger.debug(\"actionmailer_x509: We should sign and\\or crypt the mail with #{@x509_sign_and_crypt_method} method.\")\n end\n __send__(\"x509_#{@x509_sign_and_crypt_method}\", mail)\n end\n\n end",
"def initialize_with_sign_and_crypt(method_name, *parameters)\n mail = initialize_without_sign_and_crypt(method_name, *parameters)\n\n x509_initvar()\n\n # If we need to sign the outgoing mail.\n if should_sign? or should_crypt?\n if logger\n logger.debug(\"actionmailer_x509: We should sign and\\or crypt the mail with #{@x509_sign_and_crypt_method} method.\")\n end\n __send__(\"x509_#{@x509_sign_and_crypt_method}\", mail)\n end\n\n end",
"def signing_input; end",
"def signing_input; end",
"def generate(name)\n raise ArgumentError, \"A Certificate already exists for %s\" % name if Puppet::SSL::Certificate.find(name)\n host = Puppet::SSL::Host.new(name)\n\n host.generate_certificate_request\n\n sign(name)\n end",
"def generate\n cert = OpenSSL::X509::Certificate.new\n configure(cert)\n add_extensions(cert)\n cert.sign(Billy.certificate_authority.key, OpenSSL::Digest::SHA256.new)\n end",
"def verify\n @sigs = []\n @orig_data = request.params['data']\n if @orig_data.nil?\n # XXX: Implement HTTP error here.\n end\n begin\n GPGME::verify(request.params['data'], nil, @plain) do |signature|\n @sigs << signature\n end\n rescue GPGME::Error => e\n @error = \"GPGME Error: #{e.to_s}\"\n #rescue\n # @error = \"Unspecified Error.\"\n end\n end",
"def signature\n registration_data_raw.byteslice(\n (KEY_HANDLE_OFFSET + key_handle_length + certificate_length)..-1\n )\n end",
"def gen_x509_cert(request, extension, info, key)\n raise TypeError, \"request must be a Ruby OpenSSL::X509::Request\" unless request.is_a?(::OpenSSL::X509::Request)\n raise TypeError, \"extension must be a Ruby Array\" unless extension.is_a?(Array)\n raise TypeError, \"info must be a Ruby Hash\" unless info.is_a?(Hash)\n raise TypeError, \"key must be a Ruby OpenSSL::PKey::EC object or a Ruby OpenSSL::PKey::RSA object\" unless key.is_a?(::OpenSSL::PKey::EC) || key.is_a?(::OpenSSL::PKey::RSA)\n\n raise ArgumentError, \"info must contain a validity\" unless info.key?(\"validity\")\n raise TypeError, \"info['validity'] must be a Ruby Integer object\" unless info[\"validity\"].is_a?(Integer)\n\n cert = ::OpenSSL::X509::Certificate.new\n ef = ::OpenSSL::X509::ExtensionFactory.new\n\n cert.serial = gen_serial\n cert.version = 2\n cert.subject = request.subject\n cert.public_key = request.public_key\n cert.not_before = Time.now\n cert.not_after = cert.not_before + info[\"validity\"] * 24 * 60 * 60\n\n if info[\"issuer\"].nil?\n cert.issuer = request.subject\n ef.issuer_certificate = cert\n extension << ef.create_extension(\"basicConstraints\", \"CA:TRUE\", true)\n else\n raise TypeError, \"info['issuer'] must be a Ruby OpenSSL::X509::Certificate object\" unless info[\"issuer\"].is_a?(::OpenSSL::X509::Certificate)\n\n cert.issuer = info[\"issuer\"].subject\n ef.issuer_certificate = info[\"issuer\"]\n end\n ef.subject_certificate = cert\n if openssl_config = __openssl_config\n ef.config = openssl_config\n end\n\n cert.extensions = extension\n cert.add_extension ef.create_extension(\"subjectKeyIdentifier\", \"hash\")\n cert.add_extension ef.create_extension(\"authorityKeyIdentifier\",\n \"keyid:always,issuer:always\")\n\n cert.sign(key, ::OpenSSL::Digest.new(\"SHA256\"))\n cert\n end",
"def generate_digest(element, algorithm)\n element = document.at_xpath(element, namespaces) if element.is_a? String\n xml = canonicalize(element)\n digest(xml, algorithm).strip\n end",
"def verify_signatures?; end",
"def signature\n Base64.encode64(digest_with_key(string_to_sign)).strip\n end",
"def signature_for(string)\n format('sha1=%s'.freeze, generate_hmac(string))\n end",
"def initialize_with_sign_and_crypt(method_name, *parameters)\n default_settings = {\n sign: false,\n crypt: false,\n p12: nil,\n crypt_cert: nil,\n crypt_cipher: :des,\n crypt_method: :smime,\n passphrase: nil,\n ca_cert: nil\n }\n\n initialize_without_sign_and_crypt(method_name, *parameters)\n mail = @_message\n\n @x509_settings = default_settings.merge @x509_settings\n\n # If we need to sign the outgoing mail.\n if should_sign? or should_crypt?\n if logger\n logger.debug(\"actionmailer_x509: We should sign and\\or crypt the mail with #{@x509_settings[:crypt_method]} method.\")\n end\n send(\"x509_#{@x509_settings[:crypt_method]}\", mail)\n end\n end",
"def sign(signed_data, algo: nil)\n algo ||= self.algo\n raise AlgorithmError unless algo == self.algo\n openssl_sig = openssl.sign(public_key.digest.new, signed_data)\n raw_sig = PublicKey::ECDSA.ssh_signature(openssl_sig)\n Encoding.encode_signature(algo, raw_sig)\n end",
"def certificate_verification_state\n super\n end",
"def digest(string, algorithm)\n Base64.encode64 digester(algorithm).digest(string)\n end",
"def secure?(cert)\n info = cert_key_info(cert)\n case info.fetch(:type)\n when 'RSA'\n # reject RSA < 2048 bit\n if info.fetch(:bits) < 2048\n return false\n end\n when 'EC'\n # reject ECDSA < 256 bit\n if info.fetch(:bits) < 256\n return false\n end\n else\n raise NotImplementedError.new(\"Unexpected cert algorithm: #{info}\")\n end\n\n # reject MD2 and MD5\n if cert.signature_algorithm.start_with?('md')\n return false\n end\n\n return true\n end",
"def generate_request_signature(components)\n string_to_sign = components.join(\"\\n\")\n\n digest = OpenSSL::Digest.new('sha1')\n Base64.encode64(OpenSSL::HMAC.digest(digest, @configuration.secret_key, string_to_sign))\n end",
"def generate_request_signature(components)\n string_to_sign = components.join(\"\\n\")\n\n digest = OpenSSL::Digest.new('sha1')\n Base64.encode64(OpenSSL::HMAC.digest(digest, @configuration.secret_key, string_to_sign))\n end",
"def certificate\n Base64.strict_encode64(parsed_certificate.to_der)\n end",
"def signature_for(string)\n format('sha1=%s'.freeze, generate_hmac(string))\n end"
] |
[
"0.6409925",
"0.63705426",
"0.63635504",
"0.6288841",
"0.62522954",
"0.60069263",
"0.59798944",
"0.59655166",
"0.590693",
"0.5739672",
"0.57230186",
"0.5706069",
"0.56976324",
"0.55488294",
"0.5545869",
"0.55281913",
"0.54226375",
"0.5416415",
"0.53022736",
"0.5196886",
"0.51936215",
"0.5186399",
"0.51319575",
"0.51060146",
"0.5104526",
"0.5101961",
"0.5072474",
"0.50482166",
"0.5046607",
"0.5043375",
"0.5025667",
"0.50249135",
"0.50249135",
"0.50225294",
"0.50157416",
"0.50132847",
"0.5012106",
"0.49490646",
"0.4910427",
"0.49009934",
"0.48998514",
"0.48874587",
"0.48845327",
"0.48760274",
"0.48744273",
"0.48657376",
"0.48650023",
"0.4863928",
"0.48470485",
"0.48364863",
"0.48282138",
"0.48277748",
"0.48236278",
"0.48159847",
"0.48076567",
"0.48065385",
"0.48065385",
"0.48001358",
"0.47875944",
"0.47839436",
"0.47692198",
"0.47674417",
"0.47619265",
"0.4744154",
"0.47211307",
"0.47163153",
"0.46904233",
"0.46891117",
"0.46882603",
"0.46668378",
"0.4666042",
"0.46634465",
"0.46619877",
"0.46601066",
"0.46572697",
"0.46572697",
"0.46568513",
"0.46567175",
"0.4649827",
"0.4649827",
"0.46490726",
"0.46490726",
"0.4639669",
"0.46371454",
"0.4628641",
"0.4627581",
"0.46206123",
"0.4620023",
"0.46177474",
"0.4617165",
"0.4606381",
"0.46047986",
"0.45939502",
"0.45888785",
"0.45874923",
"0.45783418",
"0.4570318",
"0.4570318",
"0.45695528",
"0.45613655"
] |
0.6383257
|
1
|
Digests some +target_node+, which integrity you wish to track. Any changes in digested node will invalidate signed message. All digest should be calculated before signing. Available options: [+:id+] Id for the node, if you don't want to use automatically calculated one [+:inclusive_namespaces+] Array of namespace prefixes which definitions should be added to node during canonicalization [+:enveloped+] Example of XML that will be inserted in message for call like digest!(node, inclusive_namespaces: ['soap']): aeqXriJuUCk4tPNPAGDXGqHj6ao=
|
def digest!(target_node, options = {})
wsu_ns = namespace_prefix(target_node, WSU_NAMESPACE)
current_id = target_node["#{wsu_ns}:Id"] if wsu_ns
id = options[:id] || current_id || "_#{Digest::SHA1.hexdigest(target_node.to_s)}"
# if id.to_s.size > 0
# wsu_ns ||= namespace_prefix(target_node, WSU_NAMESPACE, 'wsu')
# target_node["#{wsu_ns}:Id"] = id.to_s
# end
target_canon = canonicalize(target_node, options[:inclusive_namespaces])
# target_digest = Base64.encode64(@digester.digest(target_canon)).strip
target_digest = @digester.base64(target_canon)
reference_node = Nokogiri::XML::Node.new('Reference', document)
reference_node['URI'] = !id.to_s.empty? ? encode_ja(id) : ''
signed_info_node.add_child(reference_node)
transforms_node = Nokogiri::XML::Node.new('Transforms', document)
reference_node.add_child(transforms_node)
transform_node = Nokogiri::XML::Node.new('Transform', document)
transform_node['Algorithm'] = if options[:enveloped]
'http://www.w3.org/2000/09/xmldsig#enveloped-signature'
else
# transform_node['Algorithm'] = 'http://www.w3.org/2001/10/xml-exc-c14n#'
'http://www.w3.org/TR/2001/REC-xml-c14n-20010315'
end
if options[:inclusive_namespaces]
inclusive_namespaces_node = Nokogiri::XML::Node.new('ec:InclusiveNamespaces', document)
inclusive_namespaces_node.add_namespace_definition('ec', transform_node['Algorithm'])
inclusive_namespaces_node['PrefixList'] = options[:inclusive_namespaces].join(' ')
transform_node.add_child(inclusive_namespaces_node)
end
transforms_node.add_child(transform_node)
digest_method_node = Nokogiri::XML::Node.new('DigestMethod', document)
digest_method_node['Algorithm'] = @digester.digest_id
reference_node.add_child(digest_method_node)
digest_value_node = Nokogiri::XML::Node.new('DigestValue', document)
digest_value_node.content = target_digest
reference_node.add_child(digest_value_node)
self
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def digest(*args)\n options = args.extract_options!\n ::Klarna::API.digest(*[(self.store_id unless options[:store_id] == false), args, self.store_secret].compact.flatten)\n end",
"def generate_digest(element, algorithm)\n element = document.at_xpath(element, namespaces) if element.is_a? String\n xml = canonicalize(element)\n digest(xml, algorithm).strip\n end",
"def digest(*args)\n return @digest if args.empty?\n\n self.type = :digest\n @digest = args.flatten.compact\n end",
"def target_shasum\n @target_shasum ||= digest_directory(project_dir, :sha256, source_options)\n end",
"def digest(obj)\n build_digest(obj).digest\n end",
"def checksum!\n # Get a deep copy of hash to compare with\n @_original_hash = Marshal.load(Marshal.dump(to_hash))\n # create a copy of basic elements\n base = self.reject { |k,_| ['_id', '_rev', 'couchrest-hash'].include? k.to_s }\n\n result = nil\n\n flatten =\n lambda {|r|\n (recurse = lambda {|v|\n if v.is_a?(Hash) || v.is_a?(CouchRest::Document)\n v.to_a.map{|v| recurse.call(v)}.flatten\n elsif v.is_a?(Array)\n v.flatten.map{|v| recurse.call(v)}\n else\n v.to_s\n end\n }).call(r)\n }\n self['couchrest-hash'] = Digest::MD5.hexdigest(flatten.call(base).sort.join(''))\n end",
"def assoc_sha(source, target)\n case target\n when source then source\n when empty_sha then source\n else target\n end\n end",
"def digest\n query = Ox::Element.new(\"query\").tap do |element|\n element[:xmlns] = \"jabber:iq:auth\"\n\n digest_password = self.class.generate_digest(stream_id, password)\n\n element << (Ox::Element.new(\"username\") << jid.node)\n element << (Ox::Element.new(\"digest\") << digest_password)\n element << (Ox::Element.new(\"resource\") << jid.resource)\n end\n\n build_iq(query)\n end",
"def checksum\n source[digest_type]\n end",
"def calculate_hash!\n prefix = PREFIX_NAME_LOOKUP[self.type]\n # add special cases for refs\n self.hash_id = NodeId.sha1(\"#{prefix} #{self.size}\\0#{self.content}\")\n end",
"def digest\n query = Ox::Element.new(\"query\").tap do |element|\n element[:xmlns] = \"jabber:iq:auth\"\n\n digest_password = self.class.generate_digest(stream_id, password)\n\n element << (Ox::Element.new(\"username\") << jid.node)\n element << (Ox::Element.new(\"digest\") << digest_password)\n element << (Ox::Element.new(\"resource\") << jid.resource)\n end\n\n build_iq(query)\n end",
"def to_sparql(**options)\n \"MD5(\" + operands.to_sparql(**options) + \")\"\n end",
"def digest(*several_variants)\n #This is a stub, used for indexing\n end",
"def compute_checksum(h)\n begin\n signed_h = h.dup.with_indifferent_access\n CLEAR_OPTIONS.map{|o| signed_h.delete(o) }\n marshaled = ActionController::Routing::Route.new.build_query_string(signed_h)\n marshaled = marshaled.gsub(/^\\?/, '').split(/&/).sort.join('&')\n digest.call(self, Base64.encode64(marshaled.to_s.reverse)).to_s\n ensure\n end\n end",
"def digest_63bit(payload)\n configure_default_algo\n send(\"#{algorithm.downcase}63_digest\", payload)\n end",
"def digest\n digest = ''\n @elements.each { |element| digest << element.digest << ' '}\n digest\n end",
"def digest(data); end",
"def checksum_file(digest_class, path)\n digester = digest_class.new\n digester.file(path)\n digester.hexdigest\n end",
"def digest(data)\n OpenSSL::HMAC.digest(digest_class.new, key, data)[0,mac_length]\n end",
"def sign!(options = {})\n binary_security_token_node if options[:security_token]\n x509_data_node if options[:issuer_serial]\n\n if options[:inclusive_namespaces]\n c14n_method_node = signed_info_node.at_xpath('ds:CanonicalizationMethod', ds: 'http://www.w3.org/2000/09/xmldsig#')\n inclusive_namespaces_node = Nokogiri::XML::Node.new('ec:InclusiveNamespaces', document)\n inclusive_namespaces_node.add_namespace_definition('ec', c14n_method_node['Algorithm'])\n inclusive_namespaces_node['PrefixList'] = options[:inclusive_namespaces].join(' ')\n c14n_method_node.add_child(inclusive_namespaces_node)\n end\n\n signed_info_canon = canonicalize(signed_info_node, options[:inclusive_namespaces])\n\n signature = private_key.sign(@sign_digester.digester, signed_info_canon)\n signature_value_digest = Base64.encode64(signature).delete(\"\\n\")\n\n signature_value_node = Nokogiri::XML::Node.new('SignatureValue', document)\n signature_value_node.content = signature_value_digest\n signed_info_node.add_next_sibling(signature_value_node)\n self\n end",
"def targetURI\n \"http://www.w3.org/2001/DOM-Test-Suite/tests/Level-1/hc_nodeappendchildchildexists\"\n end",
"def change_sha(node)\n node['delivery']['change']['sha']\n end",
"def relevant_options_digest(options); end",
"def digest!()\n #This is a stub, used for indexing\n end",
"def checksum\n @checksum ||= begin\n if empty?\n EMPTY_CHECKSUM\n else\n ::Digest::MD5.hexdigest(children.map(&:checksum).join)\n end\n end.to_s\n end",
"def hexdigest(obj)\n build_digest(obj).hexdigest!\n end",
"def digest\n @digest ||= DEFAULT_DIGEST_PROC\n end",
"def hexdigest(*several_variants)\n #This is a stub, used for indexing\n end",
"def hexdigest\n # Read bytes in chunks of the optimal digest size.\n while (chunk = @io.read(@digest.block_length))\n @digest.update(chunk)\n end\n @digest.hexdigest\n end",
"def digest()\n @stomach.clear\n end",
"def targetURI\n \"http://www.w3.org/2001/DOM-Test-Suite/tests/Level-1/nodeappendchilddocfragment\"\n end",
"def digest_command(command:, cutoff: nil)\n \"#{command} | #{@run} digest#{\" cutoff #{cutoff}\" if cutoff}\"\n end",
"def hexdigest\n DigestUtils.pack_hexdigest(digest)\n end",
"def encoderequest(sender, target, msg, requestid, filter={}, target_agent=nil, target_collective=nil)\n serialized = Marshal.dump(msg)\n digest = makehash(serialized)\n\n req = create_request(requestid, target, filter, serialized, @initiated_by, target_agent, target_collective)\n req[:hash] = digest\n\n Marshal.dump(req)\n end",
"def update!(**args)\n @digest = args[:digest] if args.key?(:digest)\n end",
"def path_sum(root, target)\n return 0 unless root\n\n path_sum_helper(root, target, 0, Hash.new(0))\nend",
"def digest\n OpenSSL::HMAC.digest(\n OpenSSL::Digest.new('sha1'),\n secret,\n document\n )\n end",
"def digest\n @digest ||= Digest::MD5.hexdigest(self.attributes[self.class.config[:digest]])[0, 8]\n end",
"def digest_path\n if DigestUtils.already_digested?(@name)\n logical_path\n else\n logical_path.sub(/\\.(\\w+)$/) { |ext| \"-#{etag}#{ext}\" }\n end\n end",
"def change_sha\n DeliveryGolang::Helpers.change_sha(node)\n end",
"def digest\n metadata[:digest]\n end",
"def digest(password, salt, algo = nil)\n raise ArgumentError, \"digest_size is required\" unless @digest_size\n\n digest = Util.zeros(@digest_size)\n salt = Util.check_string(salt, SALTBYTES, \"salt\")\n\n if algo.nil?\n algorithm = ALG_DEFAULT\n elsif algo == :argon2i\n algorithm = ALG_ARGON2I13\n elsif algo == :argon2id && Sodium::Version::ARGON2ID_SUPPORTED\n algorithm = ALG_ARGON2ID13\n else\n raise ArgumentError, \"digest algorithm is not supported\"\n end\n\n status = self.class.pwhash(\n digest, @digest_size,\n password, password.bytesize, salt,\n @opslimit, @memlimit, algorithm\n )\n raise CryptoError, ARGON_ERROR_CODES[status] if status.nonzero?\n\n digest\n end",
"def sha\n Digest::SHA2.new.update(self.source).to_s\n end",
"def checksum(file, digest=nil)\n return nil unless digest\n if FileTest.directory?(file)\n @null_string ||= digester(digest).hexdigest(\"\") # TODO use other means\n else\n digester(digest).hexdigest(File.read(file))\n end\n end",
"def calculate_signature(doc, node)\n sha1 = OpenSSL::Digest::SHA1.new\n node = doc.at_css(node)\n canon_signed_info_node = canonicalize_exclusively(node)\n signature = @signing_private_key.sign(sha1, canon_signed_info_node)\n\n encode(signature).gsub(/\\s+/, \"\")\n end",
"def digest\n ''\n end",
"def digest\n ''\n end",
"def targetURI\n \"http://www.w3.org/2001/DOM-Test-Suite/tests/Level-1/hc_elementnormalize\"\n end",
"def prepared_doc_digest(from: nil)\n get_document_tag(:esignprepdoc, from: from)\n end",
"def canonicalized_signed_info\n\n parametros = ActiveSupport::OrderedHash.new\n parametros[\"xmlns\"] = \"http://www.w3.org/2000/09/xmldsig#\"\n parametros[\"xmlns:xsd\"] = \"http://www.w3.org/2001/XMLSchema\"\n parametros[\"xmlns:xsi\"] = \"http://www.w3.org/2001/XMLSchema-instance\"\n \n @builder = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|\n xml.SignedInfo(parametros) do\n\n xml.CanonicalizationMethod({'Algorithm' => \"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\"}) do\n xml.TEST\n end\n \n xml.SignatureMethod({'Algorithm' => \"http://www.w3.org/2000/09/xmldsig#rsa-sha1\"}) do\n xml.TEST\n end\n \n xml.Reference({'URI' => \"\"}) do\n \n xml.Transforms do\n xml.Transform({ 'Algorithm' => \"http://www.w3.org/2000/09/xmldsig#enveloped-signature\" }) do\n xml.TEST\n end\n end\n \n xml.DigestMethod({ 'Algorithm' => \"http://www.w3.org/2000/09/xmldsig#sha1\" }) do\n xml.TEST\n end\n \n xml.DigestValue(self.digested_canonicalized_data)\n \n end\n \n end\n end\n\n return @builder.to_xml(:save_with => Nokogiri::XML::Node::SaveOptions::AS_XML | Nokogiri::XML::Node::SaveOptions::NO_DECLARATION)\n \n end",
"def destination_shasum\n @destination_shasum ||= digest_directory(source_path, :sha256, source_options)\n end",
"def digest\n case @signature_method\n when \"HMAC-SHA256\" then OpenSSL::Digest.new(\"sha256\")\n when \"HMAC-SHA1\" then OpenSSL::Digest.new(\"sha1\")\n else\n fail InvalidSignatureMethodError\n end\n end",
"def invoke_put_fabric_central_api_with_http_info(target_node_id, target_uri, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: NsxComponentAdministrationApi.invoke_put_fabric_central_api ...\"\n end\n # verify the required parameter 'target_node_id' is set\n if @api_client.config.client_side_validation && target_node_id.nil?\n fail ArgumentError, \"Missing the required parameter 'target_node_id' when calling NsxComponentAdministrationApi.invoke_put_fabric_central_api\"\n end\n # verify the required parameter 'target_uri' is set\n if @api_client.config.client_side_validation && target_uri.nil?\n fail ArgumentError, \"Missing the required parameter 'target_uri' when calling NsxComponentAdministrationApi.invoke_put_fabric_central_api\"\n end\n # resource path\n local_var_path = \"/fabric/nodes/{target-node-id}/{target-uri}\".sub('{' + 'target-node-id' + '}', target_node_id.to_s).sub('{' + 'target-uri' + '}', target_uri.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NsxComponentAdministrationApi#invoke_put_fabric_central_api\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def fedora_shasum\n \"urn:sha1:#{Digest::SHA1.file(file_path)}\"\n end",
"def hashed_key_and_args(key, *args)\n base = args.inject('') do |memo, arg|\n memo << (':' + arg.class.to_s + ':') << case arg\n when Array\n hashed_key_and_args(key, *arg)\n when Hash\n hashed_key_and_args(key, *arg.to_a)\n when NilClass, Numeric, String, Symbol\n arg.to_s\n else\n raise ArgumentError, 'can only compute digest for primitive objects'\n end\n\n Digest::SHA1::hexdigest(memo)\n end\n\n key + ':' + base\n end",
"def targetURI\n \"http://www.w3.org/2001/DOM-Test-Suite/tests/Level-1/hc_nodeclonenodetrue\"\n end",
"def digest\n Digest::SHA2.new\n end",
"def node_hash(node_id)\n \n end",
"def correct_node_hash(node_id)\n SpStore::Crypto.hash_for_tree_node node_id, node_hash(left_child(node_id)),\n node_hash(right_child(node_id))\n end",
"def hexdigest(value)\n Aws::Checksums.sha256_hexdigest(value)\n end",
"def targetURI\n \"http://www.w3.org/2001/DOM-Test-Suite/tests/Level-1/nodeentitysetnodevalue\"\n end",
"def find_digest_values\n references = {}\n reference_nodes = doc.css('xmlns|Reference', xmlns: DSIG)\n\n reference_nodes.each do |node|\n uri = node.attr('URI')\n digest_value = node.at('xmlns|DigestValue', xmlns: DSIG).content\n\n references[uri] = digest_value\n end\n\n references\n end",
"def digest_method=(value)\n @children['digestMethod'][:value] = value\n end",
"def digest_method=(value)\n @children['digestMethod'][:value] = value\n end",
"def certificate_id_digest_method\n super\n end",
"def node_hash_for(node, statements, hashes)\n statement_signatures = []\n grounded = true\n statements.each do | statement |\n if statement.to_quad.include?(node)\n statement_signatures << hash_string_for(statement, hashes, node)\n statement.to_quad.compact.each do | resource |\n grounded = false unless grounded?(resource, hashes) || resource == node\n end\n end\n end\n # Note that we sort the signatures--without a canonical ordering, \n # we might get different hashes for equivalent nodes.\n [grounded,Digest::SHA1.hexdigest(statement_signatures.sort.to_s)]\n end",
"def invoke_delete_fabric_central_api_with_http_info(target_node_id, target_uri, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: NsxComponentAdministrationApi.invoke_delete_fabric_central_api ...\"\n end\n # verify the required parameter 'target_node_id' is set\n if @api_client.config.client_side_validation && target_node_id.nil?\n fail ArgumentError, \"Missing the required parameter 'target_node_id' when calling NsxComponentAdministrationApi.invoke_delete_fabric_central_api\"\n end\n # verify the required parameter 'target_uri' is set\n if @api_client.config.client_side_validation && target_uri.nil?\n fail ArgumentError, \"Missing the required parameter 'target_uri' when calling NsxComponentAdministrationApi.invoke_delete_fabric_central_api\"\n end\n # resource path\n local_var_path = \"/fabric/nodes/{target-node-id}/{target-uri}\".sub('{' + 'target-node-id' + '}', target_node_id.to_s).sub('{' + 'target-uri' + '}', target_uri.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, 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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NsxComponentAdministrationApi#invoke_delete_fabric_central_api\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def digest(message)\n OpenSSL::HMAC.digest SHA256, @secret, message\n end",
"def digest(string)\n @digest_class.new(string).digest\n end",
"def digest\n Digest::MD5.file(file).hexdigest\n end",
"def digest(string, algorithm)\n Base64.encode64 digester(algorithm).digest(string)\n end",
"def digest\n digest = ''\n @entries.each { |entry| digest << entry.digest << ' ' }\n digest\n end",
"def set_certificate_id_digest_method(opts)\n opts = check_params(opts,[:digest_methods])\n super(opts)\n end",
"def expected_digest\n OpenSSL::HMAC.digest(HMAC_ALGORITHM, Octokey::Config.hmac_secret, unsigned_buffer.raw)\n end",
"def calculate_checksum\n last_checksum = previous_event&.checksum\n attrs = attributes.except(\"checksum\", \"id\", \"updated_at\").merge(last_checksum: last_checksum)\n cs = Digest::SHA256.hexdigest(attrs.to_s)\n puts \"#{id} calculate_checksum: #{cs} <- #{attrs} \" if Rails.env.development?\n Rails.logger.info(\"#{id} calculate_checksum: #{cs} <- #{attrs} \")\n return cs\n end",
"def digest_class\n Digest::SHA256\n end",
"def digest_class\n Digest::SHA256\n end",
"def checksum\n digest = @digest_klass.new\n buf = ''\n\n File.open(@path, \"rb\") do |f|\n while !f.eof\n begin\n f.readpartial(BUFFER_SIZE, buf)\n digest.update(buf)\n rescue EOFError\n # Although we check for EOF earlier, this seems to happen\n # sometimes anyways [GH-2716].\n break\n end\n end\n end\n\n digest.hexdigest\n end",
"def compute_checksum\n pseudo = []\n pseudo << ((((self.version << 4) | self.hlen) << 8) | self.tos)\n pseudo << self.len\n pseudo << self.id\n pseudo << ((self.flags << 13) | self.foffset)\n pseudo << ((self.ttl << 8) | self.protocol)\n pseudo << 0 \n pseudo << L3::Misc.ipv42long(self.src_ip)\n pseudo << L3::Misc.ipv42long(self.dst_ip)\n L3::Misc.checksum(pseudo.pack(\"nnnnnnNN\"))\n end",
"def hash\n node_id.hash\n end",
"def digest_type\n DIGESTS.each do |digest|\n return digest if source.key? digest\n end\n raise ChecksumMissing.new(self)\n end",
"def digest\n assert_file!\n Digest::SHA256.hexdigest(@name + Digest::SHA256.file(@path).to_s)\n end",
"def compute_checksums data\n\n digest = OpenSSL::Digest::Digest.new('sha256')\n tree_digest = OpenSSL::Digest::Digest.new('sha256')\n tree_parts = []\n\n until data.eof?\n\n chunk = data.read(1024 * 1024) # read 1MB\n tree_parts << tree_digest.update(chunk).digest\n tree_digest.reset\n\n digest.update(chunk)\n\n end\n\n data.rewind\n\n [digest.to_s, compute_tree_hash(tree_parts)]\n\n end",
"def sha\n id.sha\n end",
"def block_hash\n\t\tdigest = Digest::SHA2.new\n\n\t\tdigest << '%d' % [ self.index ]\n\t\tdigest << self.timestamp.strftime( '%s%N' )\n\t\tdigest << self.payload\n\t\tdigest << self.payload_hash\n\t\tdigest << self.proof.to_s\n\t\tdigest << self.previous_hash\n\t\t\n\t\treturn digest.hexdigest\n\tend",
"def xml_args\n [{\"rdf:nodeID\" => self.identifier}]\n end",
"def compute_checksum# {{{\n pseudo = []\n pseudo << ((self.version << 8) | self.ttl)\n pseudo << 0\n pseudo << self.payload\n L3::Misc.checksum(pseudo.pack(\"nna*\"))\n end",
"def hexdigest!()\n #This is a stub, used for indexing\n end",
"def digest_key(digest)\n \"asset-uri-digest:#{compressed_path}:#{digest}\"\n end",
"def string_for_node(node, hashes, target)\n case\n when node.nil?\n \"\"\n when node == target\n \"itself\"\n when node.node? && hashes.member?(node)\n hashes[node]\n when node.node?\n \"a blank node\"\n # RDF.rb auto-boxing magic makes some literals the same when they\n # should not be; the ntriples serializer will take care of us\n when node.literal?\n node.class.name + RDF::NTriples.serialize(node)\n else\n node.to_s\n end\n end",
"def digest\n Digest::MD5.digest(blob)\n end",
"def integrity_uri(digest)\n case digest\n when Digest::Base\n digest_class = digest.class\n digest = digest.digest\n when String\n digest_class = DIGEST_SIZES[digest.bytesize]\n else\n raise TypeError, \"unknown digest: #{digest.inspect}\"\n end\n\n if hash_name = HASH_ALGORITHMS[digest_class]\n \"#{hash_name}-#{pack_base64digest(digest)}\"\n end\n end",
"def integrity_uri(digest)\n case digest\n when Digest::Base\n digest_class = digest.class\n digest = digest.digest\n when String\n digest_class = DIGEST_SIZES[digest.bytesize]\n else\n raise TypeError, \"unknown digest: #{digest.inspect}\"\n end\n\n if hash_name = HASH_ALGORITHMS[digest_class]\n \"#{hash_name}-#{pack_base64digest(digest)}\"\n end\n end",
"def hexdigest\n self.class.hexdigest_for(path)\n end",
"def digest\n \"%s([%s],{%s})\" % [\n rule_path,\n inputs.map{|i|\n i.kind_of?(Array) ? \"[%s, ...]\" % i[0].name : i.name\n }.join(\",\"),\n params.data.select{|k,_|\n not(k.toplevel?)\n }.map{|k,v| \"%s:%s\" % [k.name, v.textize]}.join(\",\")\n ]\n end",
"def hexdigest(value)\n Digest::SHA256.new.update(value).hexdigest\n end",
"def digest(string, options = {})\n salt = options[:salt] || SecureRandom.base64\n Digest::SHA1.hexdigest(\"#{salt}--#{string}\")\n end",
"def update(string)\n check_valid\n string_ptr = FFI::MemoryPointer.from_string(string)\n OpenSSL::LibCrypto.EVP_DigestUpdate(self, string_ptr, string.length)\n self\n end",
"def digest\n Digest::SHA1.hexdigest(self)\n end",
"def digest_algorithm\n @digester.symbol || @digester.digest_name\n end"
] |
[
"0.5318144",
"0.53022665",
"0.5112031",
"0.4929795",
"0.49201173",
"0.49194315",
"0.49063328",
"0.47994432",
"0.47525492",
"0.4747147",
"0.4734291",
"0.4723136",
"0.4705035",
"0.4689216",
"0.4641407",
"0.4625129",
"0.461728",
"0.46135968",
"0.46096346",
"0.45957282",
"0.45944688",
"0.4575493",
"0.45601907",
"0.452106",
"0.4515416",
"0.44941837",
"0.44865087",
"0.44702718",
"0.4464505",
"0.4459493",
"0.4459063",
"0.44347444",
"0.44294122",
"0.44198227",
"0.44183323",
"0.44160923",
"0.44093853",
"0.43889534",
"0.43781045",
"0.43769798",
"0.43691418",
"0.43522263",
"0.4341771",
"0.43269625",
"0.4298282",
"0.42954347",
"0.42954347",
"0.4278535",
"0.42550573",
"0.42410845",
"0.42218247",
"0.42079142",
"0.42065933",
"0.41817883",
"0.41756523",
"0.4172863",
"0.416735",
"0.4155814",
"0.41530308",
"0.41460735",
"0.4145254",
"0.41395277",
"0.41348696",
"0.41348696",
"0.41342255",
"0.41219372",
"0.41030562",
"0.4102123",
"0.41006804",
"0.40922",
"0.4090197",
"0.40885243",
"0.4083272",
"0.40733203",
"0.40698528",
"0.4067604",
"0.4067604",
"0.4064883",
"0.40638748",
"0.40622506",
"0.40612903",
"0.40580082",
"0.4051775",
"0.40460965",
"0.40410402",
"0.40409452",
"0.40401816",
"0.40337047",
"0.40153897",
"0.40085593",
"0.40058815",
"0.40000126",
"0.40000126",
"0.39989933",
"0.39930156",
"0.39905423",
"0.39903095",
"0.3989043",
"0.39883348",
"0.39874467"
] |
0.8205236
|
0
|
Sign document with provided certificate, private key and other options This should be very last action before calling +to_xml+, all the required nodes should be digested with +digest!+ before signing. Available options: [+:security_token+] Serializes certificate in DER format, encodes it with Base64 and inserts it within ++ tag [+:issuer_serial+] [+:inclusive_namespaces+] Array of namespace prefixes which definitions should be added to signed info node during canonicalization
|
def sign!(options = {})
binary_security_token_node if options[:security_token]
x509_data_node if options[:issuer_serial]
if options[:inclusive_namespaces]
c14n_method_node = signed_info_node.at_xpath('ds:CanonicalizationMethod', ds: 'http://www.w3.org/2000/09/xmldsig#')
inclusive_namespaces_node = Nokogiri::XML::Node.new('ec:InclusiveNamespaces', document)
inclusive_namespaces_node.add_namespace_definition('ec', c14n_method_node['Algorithm'])
inclusive_namespaces_node['PrefixList'] = options[:inclusive_namespaces].join(' ')
c14n_method_node.add_child(inclusive_namespaces_node)
end
signed_info_canon = canonicalize(signed_info_node, options[:inclusive_namespaces])
signature = private_key.sign(@sign_digester.digester, signed_info_canon)
signature_value_digest = Base64.encode64(signature).delete("\n")
signature_value_node = Nokogiri::XML::Node.new('SignatureValue', document)
signature_value_node.content = signature_value_digest
signed_info_node.add_next_sibling(signature_value_node)
self
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def canonicalized_signed_info\n\n parametros = ActiveSupport::OrderedHash.new\n parametros[\"xmlns\"] = \"http://www.w3.org/2000/09/xmldsig#\"\n parametros[\"xmlns:xsd\"] = \"http://www.w3.org/2001/XMLSchema\"\n parametros[\"xmlns:xsi\"] = \"http://www.w3.org/2001/XMLSchema-instance\"\n \n @builder = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|\n xml.SignedInfo(parametros) do\n\n xml.CanonicalizationMethod({'Algorithm' => \"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\"}) do\n xml.TEST\n end\n \n xml.SignatureMethod({'Algorithm' => \"http://www.w3.org/2000/09/xmldsig#rsa-sha1\"}) do\n xml.TEST\n end\n \n xml.Reference({'URI' => \"\"}) do\n \n xml.Transforms do\n xml.Transform({ 'Algorithm' => \"http://www.w3.org/2000/09/xmldsig#enveloped-signature\" }) do\n xml.TEST\n end\n end\n \n xml.DigestMethod({ 'Algorithm' => \"http://www.w3.org/2000/09/xmldsig#sha1\" }) do\n xml.TEST\n end\n \n xml.DigestValue(self.digested_canonicalized_data)\n \n end\n \n end\n end\n\n return @builder.to_xml(:save_with => Nokogiri::XML::Node::SaveOptions::AS_XML | Nokogiri::XML::Node::SaveOptions::NO_DECLARATION)\n \n end",
"def sign!(signing_profile={})\n raise \"Invalid certificate #{self.errors.full_messages}\" unless valid?\n merge_profile_with_extensions(signing_profile)\n\n openssl_cert = OpenSSL::X509::Certificate.new\n openssl_cert.version = 2\n openssl_cert.not_before = self.not_before\n openssl_cert.not_after = self.not_after\n openssl_cert.public_key = self.key_material.public_key\n\n openssl_cert.serial = self.serial_number.number\n\n openssl_cert.subject = self.distinguished_name.to_x509_name\n openssl_cert.issuer = parent.distinguished_name.to_x509_name\n\n factory = OpenSSL::X509::ExtensionFactory.new\n factory.subject_certificate = openssl_cert\n\n #NB: If the parent doesn't have an SSL body we're making this a self-signed cert\n if parent.openssl_body.nil?\n factory.issuer_certificate = openssl_cert\n else\n factory.issuer_certificate = parent.openssl_body\n end\n\n factory.config = build_openssl_config\n\n # Order matters: e.g. for self-signed, subjectKeyIdentifier must come before authorityKeyIdentifier\n self.extensions.keys.sort{|a,b| b<=>a}.each do |k|\n e = extensions[k]\n next if e.to_s.nil? or e.to_s == \"\" ## If the extension returns an empty string we won't include it\n ext = factory.create_ext(e.openssl_identifier, e.to_s, e.critical)\n openssl_cert.add_extension(ext)\n end\n\n if signing_profile[\"digest\"].nil?\n digest = OpenSSL::Digest.new(\"SHA512\")\n else\n digest = OpenSSL::Digest.new(signing_profile[\"digest\"])\n end\n\n self.openssl_body = openssl_cert.sign(parent.key_material.private_key, digest)\n end",
"def sign_metadata(metadata_xml, keypair, xmlsectool_path = nil)\n puts(\"Signing metadata locally with cert #{keypair.cert.subject}\")\n in_tmp_dir('proxy_node_meta') do |dir|\n cert_file = create_file('metadata.crt', keypair.cert.to_pem)\n key_file = create_file('metadata.key', keypair.key.to_der)\n metadata_file = create_file('metadata.xml', metadata_xml)\n\n cmd = <<~EOS\n #{xmlsectool_path} \\\n --sign \\\n --inFile #{dir}/metadata.xml \\\n --outFile #{dir}/metadata_signed.xml \\\n --certificate #{dir}/metadata.crt \\\n --key #{dir}/metadata.key \\\n --digest SHA-256\n EOS\n\n cmd_out = `#{cmd}`\n puts (cmd_out)\n File.open('metadata_signed.xml').read\n end\nend",
"def digest!(target_node, options = {})\n wsu_ns = namespace_prefix(target_node, WSU_NAMESPACE)\n current_id = target_node[\"#{wsu_ns}:Id\"] if wsu_ns\n id = options[:id] || current_id || \"_#{Digest::SHA1.hexdigest(target_node.to_s)}\"\n # if id.to_s.size > 0\n # wsu_ns ||= namespace_prefix(target_node, WSU_NAMESPACE, 'wsu')\n # target_node[\"#{wsu_ns}:Id\"] = id.to_s\n # end\n target_canon = canonicalize(target_node, options[:inclusive_namespaces])\n # target_digest = Base64.encode64(@digester.digest(target_canon)).strip\n target_digest = @digester.base64(target_canon)\n\n reference_node = Nokogiri::XML::Node.new('Reference', document)\n reference_node['URI'] = !id.to_s.empty? ? encode_ja(id) : ''\n signed_info_node.add_child(reference_node)\n\n transforms_node = Nokogiri::XML::Node.new('Transforms', document)\n reference_node.add_child(transforms_node)\n\n transform_node = Nokogiri::XML::Node.new('Transform', document)\n transform_node['Algorithm'] = if options[:enveloped]\n 'http://www.w3.org/2000/09/xmldsig#enveloped-signature'\n else\n # transform_node['Algorithm'] = 'http://www.w3.org/2001/10/xml-exc-c14n#'\n 'http://www.w3.org/TR/2001/REC-xml-c14n-20010315'\n end\n if options[:inclusive_namespaces]\n inclusive_namespaces_node = Nokogiri::XML::Node.new('ec:InclusiveNamespaces', document)\n inclusive_namespaces_node.add_namespace_definition('ec', transform_node['Algorithm'])\n inclusive_namespaces_node['PrefixList'] = options[:inclusive_namespaces].join(' ')\n transform_node.add_child(inclusive_namespaces_node)\n end\n transforms_node.add_child(transform_node)\n\n digest_method_node = Nokogiri::XML::Node.new('DigestMethod', document)\n digest_method_node['Algorithm'] = @digester.digest_id\n reference_node.add_child(digest_method_node)\n\n digest_value_node = Nokogiri::XML::Node.new('DigestValue', document)\n digest_value_node.content = target_digest\n reference_node.add_child(digest_value_node)\n self\n end",
"def sign_certificate\n sign_certificate_for(default)\n end",
"def create_and_sign(src_dir, cert_dir, target)\n\n # Required Apple Safari developer security files:\n # - cert.der, cert01, cert02, key.pem, size.txt\n cert_dir = File.expand_path('~/.private/safari')\n size_file = File.join(cert_dir, 'size.txt')\n\n # Create the extension archive file\n sh \"xar -czf #{target} --distribution #{src_dir}\"\n\n # Generate and sign archive digest\n sh \"xar --sign -f #{target} \\\n --digestinfo-to-sign digest.dat \\\n --sig-size #{File.read(size_file).strip} \\\n --cert-loc #{cert_dir}/cert.der \\\n --cert-loc #{cert_dir}/cert01 \\\n --cert-loc #{cert_dir}/cert02\"\n\n # Generate and inject signature file\n sh \"openssl rsautl -sign -inkey #{cert_dir}/key.pem \\\n -in digest.dat -out sig.dat\"\n sh \"xar --inject-sig sig.dat -f #{target}\"\n\n # Clean up\n rm_f ['sig.dat', 'digest.dat']\n FileUtils.chmod 0744, target\n\nend",
"def sign!\n @signed_date_time = Time.now.utc.strftime('%Y-%m-%dT%H:%M:%SZ')\n @signature = Cybersource::Security.generate_signature(signed_data)\n\n self\n end",
"def sign(data, key, options = {})\n raise KeyError.new(\"Please provide a secret key to sign data with.\") unless key\n options = settings[:sign].merge(options)\n digest = OpenSSL::Digest.new(options[:algorithm])\n signature = OpenSSL::HMAC.digest(digest, key, data)\n encode(signature, options)\n end",
"def sign_request(options)\n options.merge!(:pub => @api_key)\n options.merge!(:key => Digest::MD5.hexdigest(@api_secret + @api_key))\n end",
"def sign_metadata_hsm(metadata_xml, signing_cert, xmlsectool_path = nil)\n puts(\"TODO: Signing metadata using HSM with cert #{signing_cert.subject}\")\n return metadata_xml\nend",
"def calculate_signature(doc, node)\n sha1 = OpenSSL::Digest::SHA1.new\n node = doc.at_css(node)\n canon_signed_info_node = canonicalize_exclusively(node)\n signature = @signing_private_key.sign(sha1, canon_signed_info_node)\n\n encode(signature).gsub(/\\s+/, \"\")\n end",
"def create_root_certificate(info = {})\n root_key = OpenSSL::PKey::RSA.new(RSA_KEY_SIZE)\n root_ca = create_certificate_skeleton(info)\n\n root_ca.issuer = root_ca.subject\n root_ca.public_key = root_key.public_key\n\n extensions = [\n ['basicConstraints', 'CA:TRUE', true],\n ['keyUsage', 'keyCertSign, cRLSign', true],\n ['subjectKeyIdentifier', 'hash', false],\n ['authorityKeyIdentifier', 'keyid:always', false],\n ]\n\n if info[:policy_constraints]\n extensions << [\n 'policyConstraints',\n info[:policy_constraints].to_a.map { |kv| kv.join(':') }.join(','),\n true,\n ]\n end\n\n if info[:policy_mapping]\n extensions << [\n 'policyMappings',\n info[:policy_mapping].to_a.map { |kv| kv.join(':') }.join(','),\n true,\n ]\n end\n\n add_certificate_extensions(root_ca, root_ca, *extensions)\n root_ca.sign(root_key, OpenSSL::Digest::SHA256.new)\n [root_ca, root_key]\n end",
"def sign!(request, options = {})\n consumer.sign!(request, self, options)\n end",
"def sign csr, org_id, opts = {}\n opts[:days] ||= opts[:years] * 365 unless opts[:years].nil?\n csr = Varanus::SSL::CSR.new(csr) unless csr.is_a?(Varanus::SSL::CSR)\n cert_type_id = opts_to_cert_type_id opts, csr\n args = {\n orgId: org_id,\n csr: csr.to_s,\n subjAltNames: csr.subject_alt_names.join(','),\n certType: cert_type_id,\n term: opts_to_term(opts, cert_type_id),\n serverType: -1,\n comments: opts[:comments].to_s[0, 1024],\n externalRequester: opts[:external_requester].to_s[0, 512]\n }\n post('ssl/v1/enroll', args)['sslId']\n end",
"def initialize(options = {})\n if options[:data]\n @x509_csr = OpenSSL::X509::Request.new(options[:data])\n\n else\n # generate the subject name\n subjectX509 = OpenSSL::X509::Name.parse options[:subject]\n\n # save the key pair which was used for that\n @key_pair = options[:key]\n\n # generate the csr\n @x509_csr = OpenSSL::X509::Request.new\n @x509_csr.version = 0\n @x509_csr.subject = subjectX509\n @x509_csr.public_key = @key_pair.to_x509.public_key\n @x509_csr = @x509_csr.sign @key_pair.to_x509, OpenSSL::Digest::SHA1.new\n end\n end",
"def sign!(cert)\n openssl_cert = cert.cert # because model -> OpenSSL object\n openssl_cert.serial = self.next_serial\n cert.serial = self.next_serial\n openssl_cert.issuer = ca_cert.subject\n openssl_cert.sign private_key, OpenSSL::Digest::SHA1.new\n self.next_serial = self.next_serial + 1\n self.save\n nil\n end",
"def signing_request\n req = OpenSSL::X509::Request.new\n req.public_key = key.public_key\n req.subject = OpenSSL::X509::Name.new([['CN', domain]])\n req.sign(key, OpenSSL::Digest::SHA256.new)\n end",
"def sign!(request,options = {})\n consumer.sign!(request,self,options)\n end",
"def verify_signature!(xml, options={})\n in_tmp_dir do\n if options[:id_attr].blank?\n raise \"Missing :id_attr option\"\n end\n if options[:cert_pem].blank?\n raise \"Missing :cert_pem option\"\n else\n options[:cert_path] = create_tmp_file(options[:cert_pem])\n end\n command = verify_command(create_tmp_file(xml), options)\n result, exitstatus = run command\n if (exitstatus) != 0\n raise \"unable to validate xml signature: #{command}\\ngot error #{exitstatus}:\\n#{result}\"\n end\n result\n end\n end",
"def validate_signature(doc, certificate, canonicalization_method)\n node = doc.at('xmlns|SignedInfo', xmlns: DSIG)\n\n return false unless node\n\n node = case canonicalization_method\n when :normal\n node.canonicalize\n when :exclusive\n canonicalize_exclusively node\n end\n\n signature = doc.at('xmlns|SignatureValue', xmlns: DSIG).content\n signature = decode(signature)\n\n # Return true or false\n certificate.public_key.verify(OpenSSL::Digest::SHA1.new, signature, node)\n end",
"def xml_final_output\n\n parametros = ActiveSupport::OrderedHash.new\n parametros[\"xmlns\"] = \"http://cancelacfd.sat.gob.mx\"\n parametros[\"xmlns:xsd\"] = \"http://www.w3.org/2001/XMLSchema\"\n parametros[\"xmlns:xsi\"] = \"http://www.w3.org/2001/XMLSchema-instance\"\n parametros[\"Fecha\"] = @fecha\n parametros[\"RfcEmisor\"] = @rfcemisor\n \n @certificate = CFDI::Certificado.new @certificate\n \n @builder = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|\n xml.Cancelacion(parametros) do\n xml.Folios {\n xml.UUID(@uuid)\n }\n xml.Signature({'xmlns' => \"http://www.w3.org/2000/09/xmldsig#\" }) do\n xml.SignedInfo do \n xml.CanonicalizationMethod({'Algorithm' =>\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\"})\n xml.SignatureMethod({'Algorithm' => \"http://www.w3.org/2000/09/xmldsig#rsa-sha1\"})\n \n xml.Reference({'URI' => \"\"}) do\n \n xml.Transforms do\n xml.Transform({ 'Algorithm' => \"http://www.w3.org/2000/09/xmldsig#enveloped-signature\" })\n end\n \n xml.DigestMethod({ 'Algorithm' => \"http://www.w3.org/2000/09/xmldsig#sha1\" })\n xml.DigestValue(self.digested_canonicalized_data)\n \n end\n \n end\n xml.SignatureValue(self.computed_signed_info)\n xml.KeyInfo do \n xml.X509Data do\n xml.X509IssuerSerial do\n xml.X509IssuerName(@certificate.issuername)\n xml.X509SerialNumber(@certificate.serial)\n end\n xml.X509Certificate(@certificate.data)\n end\n end\n end\n end\n end\n \n CGI::unescapeHTML(@builder.to_xml(:save_with => Nokogiri::XML::Node::SaveOptions::AS_XML).strip.gsub(/\\n/, ''))\n \n end",
"def sign data\n return unless @key\n\n @key.sign @digest_algorithm.new, data\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_object_value(\"certificateSigningRequest\", @certificate_signing_request)\n writer.write_string_value(\"connectorId\", @connector_id)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_boolean_value(\"hasPhysicalDevice\", @has_physical_device)\n writer.write_string_value(\"manufacturer\", @manufacturer)\n writer.write_string_value(\"model\", @model)\n writer.write_string_value(\"physicalDeviceId\", @physical_device_id)\n writer.write_additional_data(@additional_data)\n end",
"def sign(data)\n @key.sign(@algo.new, data)\n end",
"def sign_wrapped_cert(cert)\n signer = Puppet::SSL::CertificateSigner.new\n signer.sign(cert.content, key)\n end",
"def sign_compact(data, privkey)\n sig, rec = sign_ecdsa(data, privkey, nil)\n [ECDSA::Format::SignatureDerString.decode(sig), rec]\n end",
"def to_xml private_key\n # Generate magic envelope\n magic_envelope = XML::Document.new\n\n magic_envelope.root = XML::Node.new 'env'\n\n me_ns = XML::Namespace.new(magic_envelope.root,\n 'me', 'http://salmon-protocol.org/ns/magic-env')\n\n magic_envelope.root.namespaces.namespace = me_ns\n\n # Armored Data <me:data>\n data = @activity.to_atom\n @plaintext = data\n data_armored = Base64::urlsafe_encode64(data)\n elem = XML::Node.new 'data', data_armored, me_ns\n elem.attributes['type'] = 'application/atom+xml'\n data_type_armored = 'YXBwbGljYXRpb24vYXRvbSt4bWw='\n magic_envelope.root << elem\n\n # Encoding <me:encoding>\n magic_envelope.root << XML::Node.new('encoding', 'base64url', me_ns)\n encoding_armored = 'YmFzZTY0dXJs'\n\n # Signing Algorithm <me:alg>\n magic_envelope.root << XML::Node.new('alg', 'RSA-SHA256', me_ns)\n algorithm_armored = 'UlNBLVNIQTI1Ng=='\n\n # Signature <me:sig>\n plaintext =\n \"#{data_armored}.#{data_type_armored}.#{encoding_armored}.#{algorithm_armored}\"\n\n # Assign @signature to the signature generated from the plaintext\n @signature = Nelumba::Crypto.emsa_sign(plaintext, private_key)\n\n signature_armored = Base64::urlsafe_encode64(@signature)\n magic_envelope.root << XML::Node.new('sig', signature_armored, me_ns)\n\n magic_envelope.to_s :indent => true, :encoding => XML::Encoding::UTF_8\n end",
"def sign(url, *options)\n temp_signer = UrlSigner::Signer.new(url, *options)\n temp_signer.sign\n end",
"def signon_app_cert_rq()\n xml = Builder::XmlMarkup.new(:indent => 2)\n create_xml_header(xml, options)\n\n xml.tag!('QBMSXML') do\n xml.tag!('SignonMsgsRq') do\n xml.tag!('SignonAppCertRq') do\n xml.tag!('ClientDateTime', Time.now)\n xml.tag!('ApplicationLogin', @options[:applogin])\n xml.tag!('ConnectionTicket', @options[:conntkt])\n end\n end\n end\n xml.target!\n end",
"def sign!(key, sign_nonce = T.unsafe(nil)); end",
"def sign\n validate!\n\n @voter.update(\n data: @data,\n signature: @signature,\n signed_vote_at: Time.now\n )\n\n signer = @signer.new(@admin_key)\n signer.sign(@data.to_i)\n end",
"def sign_request(options, authorize = true)\n options.merge!(:auth_token => self.auth.token(false).to_s, :api_key => @api_key) if authorize and self.auth.token(false)\n options.delete(:api_sig)\n options.merge!(:api_sig => Digest::MD5.hexdigest(@api_secret + options.to_a.sort_by{|k| k[0].to_s}.flatten.join)) if @api_secret\n end",
"def sign(unsigned_query)\n raise MissingSecret unless @locale.secret\n\n digest = OpenSSL::Digest::Digest.new('sha256')\n url_string = ['GET', @locale.host, '/onca/xml', unsigned_query].join(\"\\n\")\n hmac = OpenSSL::HMAC.digest(digest, @locale.secret, url_string)\n signature = escape([hmac].pack('m').chomp)\n\n \"#{unsigned_query}&Signature=#{signature}\"\n end",
"def create_intermediate_certificate(info = {})\n root_ca = info[:ca]\n root_key = info[:ca_key]\n\n key = OpenSSL::PKey::RSA.new(RSA_KEY_SIZE)\n\n cert = create_certificate_skeleton(info)\n cert.issuer = root_ca.subject # root CA is the issuer\n cert.public_key = key.public_key\n\n extensions = [\n ['basicConstraints', 'CA:TRUE', true],\n ['keyUsage', 'keyCertSign, cRLSign', true],\n AUTHORITY_INFO_ACCESS_EXTENSION,\n SUBJECT_INFO_ACCESS_EXTENSION,\n ['subjectKeyIdentifier', 'hash', false],\n ['authorityKeyIdentifier', 'keyid:always', false],\n ]\n\n if info[:policy_constraints]\n extensions << [\n 'policyConstraints',\n info[:policy_constraints].to_a.map { |kv| kv.join(':') }.join(','),\n true,\n ]\n end\n\n if info[:policy_mapping]\n extensions << [\n 'policyMappings',\n info[:policy_mapping].to_a.map { |kv| kv.join(':') }.join(','),\n true,\n ]\n end\n\n add_certificate_extensions(cert, root_ca, *extensions)\n cert.sign(root_key, OpenSSL::Digest::SHA256.new)\n [cert, key]\n end",
"def signature_verify( doc )\n # 1. Figure out signature namespace prefix\n sig_ns, prefix = signature_namespace_and_prefix( doc )\n\n # 2.a Signer present?\n @signer_node = doc.xpath( \"//#{ namespace_prefix( doc, doc.root.namespace.href ) }:Signer\" )\n if @signer_node.size != 1\n @messages << \"#{ @signer_node.size == 0 ? 'No' : @signer_node.size } Signer node#{ @signer_node.size > 1 ? 's' : '' } found\"\n end\n\n # 2.b Signature present?\n @signature_node = doc.xpath( \"//#{ prefix }:Signature\", sig_ns )\n if @signature_node.size != 1\n @messages << \"#{ @signature_node.size == 0 ? 'No' : @signature_node.size } Signature node#{ @signature_node.size > 1 ? 's' : '' } found\"\n end\n\n # 2.c Abort if none or more than 1 Signer or Signature node\n return FALSE if ( @signer_node.size != 1 or @signature_node.size != 1 )\n\n # 3. Extract and check signer certs\n certs = extract_certs( doc, sig_ns, prefix )\n @crypto = DC_Signer_Crypto_Compliance.new( certs )\n\n if ! @crypto.valid?\n if ! @crypto.errors[ :pre_context ].empty?\n @crypto.errors[ :pre_context ].each do |e|\n @messages << e\n end\n return FALSE\n else\n # Compliance issues in the extracted certs.\n # List those errors but then try to continue anyway,\n # thus allowing for inspection of compliance issues and signature in context.\n @crypto.messages.each do |e|\n @messages << e\n end\n end\n else # cc is valid\n @messages << \"Certificate chain is complete and compliant (#{ @crypto.type })\"\n end\n\n # 3.a Might check here whether the signer chain is known, trustworthy etc.\n #\n # See 3 for @crypto validity hop-over\n #\n\n # 4. Get signer's public key\n pub_k = @crypto.context.first.public_key\n\n # 5. Check references and signature value\n @reference_digests_check = check_references( doc, sig_ns, prefix )\n @signature_value_check = check_signature_value( doc, sig_ns, prefix, pub_k )\n\n return TRUE\n end",
"def signature_verify( doc )\n # 1. Figure out signature namespace prefix\n sig_ns, prefix = signature_namespace_and_prefix( doc )\n\n # 2.a Signer present?\n @signer_node = doc.xpath( \"//#{ namespace_prefix( doc, doc.root.namespace.href ) }:Signer\" )\n if @signer_node.size != 1\n @messages << \"#{ @signer_node.size == 0 ? 'No' : @signer_node.size } Signer node#{ @signer_node.size > 1 ? 's' : '' } found\"\n end\n\n # 2.b Signature present?\n @signature_node = doc.xpath( \"//#{ prefix }:Signature\", sig_ns )\n if @signature_node.size != 1\n @messages << \"#{ @signature_node.size == 0 ? 'No' : @signature_node.size } Signature node#{ @signature_node.size > 1 ? 's' : '' } found\"\n end\n\n # 2.c Abort if none or more than 1 Signer or Signature node\n return false if ( @signer_node.size != 1 or @signature_node.size != 1 )\n\n # 3. Extract and check signer certs\n certs = extract_certs( doc, sig_ns, prefix )\n @crypto = DC_Signer_Crypto_Compliance.new( certs )\n\n if ! @crypto.valid?\n if ! @crypto.errors[ :pre_context ].empty?\n @crypto.errors[ :pre_context ].each do |e|\n @messages << e\n end\n return false\n else\n # Compliance issues in the extracted certs.\n # List those errors but then try to continue anyway,\n # thus allowing for inspection of compliance issues and signature in context.\n @crypto.messages.each do |e|\n @messages << e\n end\n end\n else # cc is valid\n @messages << \"Certificate chain is complete and compliant (#{ @crypto.type })\"\n end\n\n # 3.a Might check here whether the signer chain is known, trustworthy etc.\n #\n # See 3 for @crypto validity hop-over\n #\n\n # 4. Get signer's public key\n pub_k = @crypto.context.first.public_key\n\n # 5. Check references and signature value\n @reference_digests_check = check_references( doc, sig_ns, prefix )\n @signature_value_check = check_signature_value( doc, sig_ns, prefix, pub_k )\n\n return true\n end",
"def sign( identity, data )\n info = find_identity( identity )\n\n if info[:key].nil? && info[:from] == :file\n begin\n info[:key] = @keys.load_private_key( info[:file] )\n rescue Exception => e \n raise UserKeyManagerError,\n \"the given identity is known, \" +\n \"but the private key could not be loaded \" +\n \"(#{e.message} [#{e.class}])\"\n end\n end\n\n if info[:key]\n sig_blob = @buffers.writer\n sig_blob.write_string identity.ssh_type\n sig_blob.write_string info[:key].ssh_do_sign( data.to_s )\n return sig_blob.to_s\n end\n\n if info[:from] == :agent\n raise UserKeyManagerError,\n \"the agent is no longer available\" unless @agent\n return @agent.sign( identity, data.to_s )\n end\n\n raise UserKeyManagerError,\n \"[BUG] can't determine identity origin (#{info.inspect})\"\n end",
"def sign(t_outputs)\n # binding.pry\n Base64.encode64(private_key.sign(OpenSSL::Digest::SHA256.new, t_outputs.to_json))\n end",
"def sign(data, padding: nil, rng: Botan::RNG.new)\n sign = Botan::PK::Sign.new(key: self, padding: padding)\n sign << data\n sign.finish(rng)\n end",
"def generate_xml_request\n tax_receipt = generate_tax_receipt\n @certificate.certifica tax_receipt\n @key.sella tax_receipt\n tax_receipt.to_xml\n end",
"def sign(data)\n key.dsa_sign_asn1(data)\n end",
"def process_signing\n if sign_file?\n @appearance = @stamper.getSignatureAppearance().to_java(Java::ComLowagieTextPdf::PdfSignatureAppearance)\n @appearance.setCrypto(@private_key, @cert_chain, nil, Java::ComLowagieTextPdf::PdfSignatureAppearance::WINCER_SIGNED)\n end\n end",
"def signed_url_for(options)\n canonical_options = rewrite_options(options)\n canonical_options[:controller] ||= controller_path\n SignedParams.sign!(canonical_options)\n url_for(canonical_options)\n end",
"def sign!(request, token = nil, request_options = {})\n request.oauth!(http, self, token, options.merge(request_options))\n end",
"def autosign\n return unless auto = autosign?\n\n store = nil\n if auto != true\n store = autosign_store(auto)\n end\n\n Puppet::SSL::CertificateRequest.search(\"*\").each do |csr|\n sign(csr.name) if auto == true or store.allowed?(csr.name, \"127.1.1.1\")\n end\n end",
"def sign(private_key)\n # Our multiline hash for authorization will be encoded in multiple header\n # lines - X-Ops-Authorization-1, ... (starts at 1, not 0!)\n header_hash = {\n \"X-Ops-Sign\" => SIGNING_DESCRIPTION,\n \"X-Ops-Userid\" => user_id,\n \"X-Ops-Timestamp\" => canonical_time,\n \"X-Ops-Content-Hash\" => hashed_body,\n }\n\n string_to_sign = canonicalize_request\n signature = Base64.encode64(private_key.private_encrypt(string_to_sign)).chomp\n signature_lines = signature.split(/\\n/)\n signature_lines.each_index do |idx|\n key = \"X-Ops-Authorization-#{idx + 1}\"\n header_hash[key] = signature_lines[idx]\n end\n \n Mixlib::Authentication::Log.debug \"String to sign: '#{string_to_sign}'\\nHeader hash: #{header_hash.inspect}\"\n \n header_hash\n end",
"def create_leaf_certificate(info = {})\n root_ca = info[:ca]\n root_key = info[:ca_key]\n\n key = OpenSSL::PKey::RSA.new(RSA_KEY_SIZE)\n\n cert = create_certificate_skeleton(info)\n cert.issuer = root_ca.subject # root CA is the issuer\n cert.public_key = key.public_key\n\n extensions = [\n ['keyUsage', 'digitalSignature', true],\n ['subjectKeyIdentifier', 'hash', false],\n AUTHORITY_INFO_ACCESS_EXTENSION,\n ['authorityKeyIdentifier', 'keyid:always', false],\n ]\n\n unless info[:no_policies]\n extensions << [\n 'certificatePolicies',\n IdentityConfig.store.required_policies.first,\n false,\n ]\n end\n\n if info[:policy_constraints]\n extensions << [\n 'policyConstraints',\n info[:policy_constraints].to_a.map { |kv| kv.join(':') }.join(','),\n true,\n ]\n end\n\n if info[:policy_mapping]\n extensions << [\n 'policyMappings',\n info[:policy_mapping].to_a.map { |kv| kv.join(':') }.join(','),\n true,\n ]\n end\n\n add_certificate_extensions(cert, root_ca, *extensions)\n cert.sign(root_key, OpenSSL::Digest::SHA256.new)\n cert\n end",
"def create_certificate_set(**options)\n # we create the number of trusted roots, then for each root, the intermediates,\n # and for each intermediate, the leaves\n root_certs = []\n intermediate_certs = []\n leaf_certs = []\n root_options = options[:root_options] || {}\n intermediate_options = options[:intermediate_options] || {}\n leaf_options = options[:leaf_options] || {}\n options[:root_count].times do |root_index|\n root, root_key = create_root_certificate(\n dn: \"DC=com, DC=example, OU=ca, CN=Root #{root_index + 1}\",\n serial: root_index + 1,\n **root_options\n )\n root_cert_id = OpenSSL::OCSP::CertificateId.new(\n root, root, OpenSSL::Digest::SHA1.new\n )\n root_certs << {\n type: :root,\n certificate: Certificate.new(root),\n key: root_key,\n signing_cert_id: root_cert_id,\n cert_id: root_cert_id,\n }\n options[:intermediate_count].times do |intermediate_index|\n intermediate, intermediate_key = create_intermediate_certificate(\n dn: [\n 'DC=com',\n 'DC=example',\n 'OU=ca',\n \"CN=Intermediate #{root_index + 1}-#{intermediate_index + 1}\",\n ].join(' '),\n serial: intermediate_index + 1,\n ca: root,\n ca_key: root_key,\n **intermediate_options\n )\n intermediate_cert_id = OpenSSL::OCSP::CertificateId.new(\n intermediate, root, OpenSSL::Digest::SHA1.new\n )\n intermediate_certs << {\n type: :intermediate,\n certificate: Certificate.new(intermediate),\n key: intermediate_key,\n signing_cert_id: root_cert_id,\n cert_id: intermediate_cert_id,\n }\n options[:leaf_count].times do |leaf_index|\n cn_number = root_index * options[:intermediate_count] +\n intermediate_index * options[:leaf_count] +\n leaf_index\n leaf = create_leaf_certificate(\n dn: [\n 'DC=com',\n 'DC=example',\n 'OU=foo',\n \"CN=bar #{cn_number}\",\n ].join(' '),\n serial: leaf_index + 1,\n ca: intermediate,\n ca_key: intermediate_key,\n **leaf_options\n )\n leaf_cert_id = OpenSSL::OCSP::CertificateId.new(\n leaf, intermediate, OpenSSL::Digest::SHA1.new\n )\n leaf_certs << {\n type: :leaf,\n certificate: Certificate.new(leaf),\n signing_cert_id: intermediate_cert_id,\n cert_id: leaf_cert_id,\n }\n end\n end\n end\n root_certs + intermediate_certs + leaf_certs\n end",
"def signature(options = {})\n signature = nil\n url = '/api/videos/signature'\n if options[:success_action_redirect]\n url += \"?success_action_redirect=#{options[:success_action_redirect]}\"\n end\n if options[:include_metadata]\n url += url.include?('?') ? '&' : '?'\n url += \"include_metadata=yes\"\n end\n if options[:flash_request]\n url += url.include?('?') ? '&' : '?'\n url += \"flash_request=yes\"\n end\n auth_connection HTTP_GET, url do |xml|\n signature = Signature.new xml\n end\n signature\n end",
"def to_xml(xml=Builder::XmlMarkup.new)\n attributes = {}\n attributes['ForceAuthn'] = force_authn unless force_authn.nil?\n attributes['IsPassive'] = is_passive unless is_passive.nil?\n # TODO implement assertion consumer service index\n # TODO implement assertion consumer service URL\n attributes['ProtocolBinding'] = protocol_binding unless protocol_binding.nil?\n attributes['AttributeConsumingServiceURL'] = attribute_consuming_service_url unless attribute_consuming_service_url.nil?\n attributes['ProviderName'] = provider_name unless provider_name.nil?\n attributes = add_xmlns(attributes)\n xml.tag!('samlp:AuthnRequest', attributes) {\n xml << subject.to_xml unless subject.nil?\n xml << name_id_policy.to_xml unless name_id_policy.nil?\n xml << conditions.to_xml unless conditions.nil?\n xml << requested_authn_context unless requested_authn_context.nil?\n xml << scoping.to_xml unless scoping.nil?\n }\n end",
"def salt_document\n raise ESignatureException, 'Document salt requires timestamp ms to be set' unless @signed_at_timestamp_ms\n\n @document_salt = generate_salt\n set_document_tag :esignuniquecode, @document_salt\n @document_salt\n end",
"def generate_doc_from_model\n # Get the config for the model to be signed\n elt = @e_sign_document.option_type_config\n\n # Use either the specified fields in the activity log e_sign configuration,\n # or the fields specified in the model to be signed\n sign_fields = @specified_fields || elt.fields\n\n # Limit the attributes to just the specified fields, and order them according the field config\n att_order = @e_sign_document.class.permitted_params\n all_atts = {}\n if att_order\n att_order.each do |a|\n a = a.to_s\n all_atts[a] = @e_sign_document.attributes[a]\n end\n else\n all_atts = @e_sign_document.attributes.dup\n end\n atts = all_atts.select { |k, _v| sign_fields.include? k }\n\n ApplicationController.render(template: 'e_signature/document', layout: 'e_signature', locals: {\n e_sign_document: @e_sign_document,\n prepared_document: self,\n attributes: atts,\n caption_before: elt.caption_before,\n labels: elt.caption_before,\n show_if: elt.show_if,\n current_user: current_user,\n document_title: @document_title,\n document_intro: @document_intro\n }).html_safe\n end",
"def sign(data)\n if rsa?\n @priv.sign(OpenSSL::Digest::SHA1.new,data)\n elsif dsa?\n # DSS1 was dropped from OpenSSL in version 1.1\n # @priv.sign(OpenSSL::Digest::DSS1.new,data)\n raise StandardError, 'DSA is not supported'\n end\n end",
"def build_verify_request(credit_card, options)\n timestamp = new_timestamp\n xml = Builder::XmlMarkup.new indent: 2\n xml.tag! 'request', 'timestamp' => timestamp, 'type' => 'otb' do\n add_merchant_details(xml, options)\n xml.tag! 'orderid', sanitize_order_id(options[:order_id])\n add_card(xml, credit_card)\n add_comments(xml, options)\n add_signed_digest(xml, timestamp, @options[:login], sanitize_order_id(options[:order_id]), credit_card.number)\n end\n xml.target!\n end",
"def to_xml\n Nokogiri::XML::Builder.new do |xml|\n xml['me'].env({ 'xmlns:me' => XMLNS }) do\n xml['me'].data({ type: type }, OStatus2::Salmon.encode_base64url(body))\n xml['me'].encoding(encoding)\n xml['me'].alg(alg)\n xml['me'].sig({ key_id: key_id }, OStatus2::Salmon.encode_base64url(sig))\n end\n end.to_xml\n end",
"def set_signing_information(opts)\n opts = check_params(opts,[:signers])\n super(opts)\n end",
"def signer_info( xml, sig )\n sig_info = Hash.new\n if ! sig.signature_node.empty?\n sig_info[ :signer_name ] = sig.signer_name\n sig_info[ :signer_issuer_name ] = sig.signer_issuer\n if ! sig.signer_node.empty?\n signer_ns_prefix = namespace_prefix( xml, MStr::Ns_Xmldsig )\n sig_info[ :x509serialnumber ] = sig.signer_node.first.xpath( \"//#{ signer_ns_prefix }:X509SerialNumber\", signer_ns_prefix => MStr::Ns_Xmldsig ).first.text.to_i\n sig_info[ :cert_serial ] = sig.crypto.context.first.serial.to_i unless sig.crypto.context.empty?\n end\n end\n return sig_info\nend",
"def signer_info( xml, sig )\n sig_info = Hash.new\n if ! sig.signature_node.empty?\n sig_info[ :signer_name ] = sig.signer_name\n sig_info[ :signer_issuer_name ] = sig.signer_issuer\n if ! sig.signer_node.empty?\n signer_ns_prefix = namespace_prefix( xml, MStr::Ns_Xmldsig )\n sig_info[ :x509serialnumber ] = sig.signer_node.first.xpath( \"//#{ signer_ns_prefix }:X509SerialNumber\", signer_ns_prefix => MStr::Ns_Xmldsig ).first.text.to_i\n sig_info[ :cert_serial ] = sig.crypto.context.first.serial.to_i unless sig.crypto.context.empty?\n end\n end\n return sig_info\nend",
"def signer\n end",
"def start\n\n # Retrieve parameters\n @file_to_sign = params[:file_id]\n @cert_thumb = params[:cert_thumb]\n @cert_content = params[:cert_content]\n\n # Get instance of the PadesSignatureStarter class, responsible for receiving\n # the signature elements and start the signature process.\n signature_starter = PkiExpress::PadesSignatureStarter.new\n\n # Set PKI default options (see util.rb)\n set_pki_defaults(signature_starter)\n\n # Set signature policy.\n signature_starter.signature_policy = PkiExpress::StandardSignaturePolicies::PADES_BASIC_WITH_LTV\n\n # Set PDF to be signed.\n signature_starter.pdf_to_sign_path = get_data_path(@file_to_sign)\n\n # Set Base64-encoded certificate's content to signature starter.\n signature_starter.certificate_base64 = @cert_content\n\n # Set visual representation. We provide a class that represents the visual\n # representation model.\n signature_starter.visual_representation = get_visual_representation\n\n # Start the signature process. Receive as response a SignatureStartResult\n # instance containing the following fields:\n # - to_sign_hash: The hash to be signed.\n # - digest_algorithm_name: The digest algorithm's name that be used to\n # configure Web PKI component to compute the signature.\n # - digest_algorithm_oid: The digest algorithm's oid that be used to\n # configure Web PKI component to compute the signature.\n # - transfer_file_id: A temporary file's id to be passed to \"complete\" step.\n result = signature_starter.start\n\n @to_sign_hash = result.to_sign_hash\n @transfer_file_id = result.transfer_file_id\n @digest_algorithm = result.digest_algorithm_name\n end",
"def session_ticket(options = {})\n xml = signon_app_cert_rq\n response = commit('session_ticket', xml)\n end",
"def generate_signature\n sha1x16 = Digest::SHA1.hexdigest(signed_string)\n .tap { |s| logger.debug \"sha1x16 #{s}\" }\n enc = case form_fields['signMethod']\n when '01' # 01 means RSA\n merchant_private_key.sign(OpenSSL::Digest::SHA1.new, sha1x16)\n .tap { |s| logger.debug \"enc #{s}\" }\n else # at current time (2015-05-25) no other signing method is mentioned in Unionpay's official docs\n raise \"sign method #{form_fields['signMethod']} is not implemented yet.\"\n end\n Base64.strict_encode64(enc) # has to be strict_encode64, not encode64, as the latter as an extra '\\n'\n .tap { |s| logger.debug \"final: #{s}\" }\n end",
"def sign\n url.query = url.query.to_s + \"&Signature=#{Utils.encode signature}\"\n self\n end",
"def sign_request\n # By default OpenSSL generates an all-zero array for the encriptation vector\n # You can read it here: http://ruby-doc.org/stdlib-1.9.3/libdoc/openssl/rdoc/OpenSSL/Cipher.html#method-i-iv-3D\n # If you want to declare it, you can take a look at the next couple of lines\n #bytes = Array.new(8,0)\n #iv = bytes.map(&:chr).join\n # We need to decode the secret key\n key = Base64.strict_decode64(credentials[:secret_key])\n # In thee cipher initialization we need to speficy the encryptation like method-length-mode (http://ruby-doc.org/stdlib-1.9.3/libdoc/openssl/rdoc/OpenSSL/Cipher.html#method-c-new).\n # Sermepa needs DES3 in CBC mode\n # The direct way the declare it's: des-ede3-cbc\n # You can also declare like 'des3' wich use CBC mode by default\n des3 = OpenSSL::Cipher::Cipher.new('des-ede3-cbc')\n # OpenSSL use by default PKCS padding. But Sermepa (mcrypt_encrypt PHP function) use zero padding.\n # OpenSSL do not allow zero padding. So we need to disable the default padding and make zero padding by hand\n # Padding in cryptography is to fill the data with especial characteres in order to use the data in blocks of N (https://en.wikipedia.org/wiki/Padding_(cryptography))\n # We need to use blocks of 8 bytes\n block_length = 8\n # We tell OpenSSL not to pad\n des3.padding = 0\n # We want to encrypt\n des3.encrypt\n # Key set\n des3.key = key\n #des3.iv = iv\n order_number = @fields[\"Ds_Merchant_Order\"]\n # Here is the 'magic'. Instead use the default OpenSSL padding (PKCS). We fill with \\0 till the data have\n # a multiple of the block size (8, 16, 24...)\n order_number += \"\\0\" until order_number.bytesize % block_length == 0\n # For example: the string \"123456789\" will be transform in \"123456789\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n # data must be in blocks of 8 or the update will break\n key_des3 = des3.update(order_number) + des3.final\n # The next step is to encrypt in SHA256 the resulting des3 key with the base64 json\n result = OpenSSL::HMAC.digest('sha256', key_des3, merchant_parameters_base64_json)\n # The last step is to encode the data in base64\n Base64.strict_encode64(result)\n end",
"def computed_signed_info\n \n llave = CFDI::Key.new @key, @password\n\n return Base64::encode64(llave.sign(OpenSSL::Digest::SHA1.new, CGI::unescapeHTML(self.canonicalized_signed_info.gsub('<TEST/>','').gsub(/\\n/, ''))))\n \n end",
"def sign\n write_attr('mid', SecureRandom.uuid)\n write_attr('ts', Time.now.utc.to_i)\n canonical_msg = self.canonicalize\n\n #priv_key = OmfCommon::Key.instance.private_key\n #digest = OpenSSL::Digest::SHA512.new(canonical_msg)\n\n #signature = Base64.encode64(priv_key.sign(digest, canonical_msg)).encode('utf-8') if priv_key\n #write_attr('digest', digest)\n #write_attr('signature', signature) if signature\n\n if OmfCommon::Measure.enabled?\n MPMessage.inject(Time.now.to_f, operation.to_s, mid, cid, self.to_s.gsub(\"\\n\",''))\n @@mid_list << mid\n end\n self\n end",
"def to_xml(options = {})\n with_credentials = options[:with_credentials] || false\n\n doc = Nokogiri::XML('')\n doc.root = Nokogiri::XML::Node.new('provider_account', doc)\n root = doc.root.at_xpath('/provider_account')\n\n node = Nokogiri::XML::Node.new('name', doc)\n node.content = self.name\n root << node\n\n node = Nokogiri::XML::Node.new('provider', doc)\n node.content = self.provider.name\n root << node\n\n node = Nokogiri::XML::Node.new('provider_type', doc)\n node.content = self.provider.provider_type.deltacloud_driver\n root << node\n\n if with_credentials\n credential_node_name = provider.provider_type.deltacloud_driver + '_credentials'\n credential_node = Nokogiri::XML::Node.new(credential_node_name, doc)\n node = Nokogiri::XML::Node.new('provider_credentials', doc)\n node << credential_node\n root << node\n\n creds_label_hash.each do |h|\n element = Nokogiri::XML::Node.new(h[:label], doc)\n element.content = h[:value]\n credential_node << element\n end\n end\n\n doc.root.to_xml\n end",
"def encode(options={})\n self.class.format.encode(attributes, {:root => self.class.element_name}.merge(options))\n end",
"def sign(key, string)\n SSL.new(nil, key).sign(string, true)\n end",
"def rsaes_pkcs_signature(key, input)\n private_key = if BSON::Environment.jruby?\n # JRuby cannot read DER format, we need to convert key into PEM first.\n key_pem = [\n \"-----BEGIN PRIVATE KEY-----\",\n Base64.strict_encode64(Base64.decode64(key)).scan(/.{1,64}/),\n \"-----END PRIVATE KEY-----\",\n ].join(\"\\n\")\n OpenSSL::PKey::RSA.new(key_pem)\n else\n OpenSSL::PKey.read(Base64.decode64(key))\n end\n private_key.sign(OpenSSL::Digest::SHA256.new, input)\n end",
"def verify_signature signature, data, chain, time = Time.now\n Gem.ensure_ssl_available\n cert_class = OpenSSL::X509::Certificate\n exc = Gem::Security::Exception\n chain ||= []\n\n chain = chain.map{ |str| cert_class.new(str) }\n signer, ch_len = chain[-1], chain.size\n opt = Gem::Security::OPT.merge(@opt)\n\n # make sure signature is valid\n if @verify_data\n # get digest algorithm (TODO: this should be configurable)\n dgst = opt[:dgst_algo]\n\n # verify the data signature (this is the most important part, so don't\n # screw it up :D)\n v = signer.public_key.verify(dgst.new, signature, data)\n raise exc, \"Invalid Gem Signature\" unless v\n\n # make sure the signer is valid\n if @verify_signer\n # make sure the signing cert is valid right now\n v = signer.check_validity(nil, time)\n raise exc, \"Invalid Signature: #{v[:desc]}\" unless v[:is_valid]\n end\n end\n\n # make sure the certificate chain is valid\n if @verify_chain\n # iterate down over the chain and verify each certificate against it's\n # issuer\n (ch_len - 1).downto(1) do |i|\n issuer, cert = chain[i - 1, 2]\n v = cert.check_validity(issuer, time)\n raise exc, \"%s: cert = '%s', error = '%s'\" % [\n 'Invalid Signing Chain', cert.subject, v[:desc]\n ] unless v[:is_valid]\n end\n\n # verify root of chain\n if @verify_root\n # make sure root is self-signed\n root = chain[0]\n raise exc, \"%s: %s (subject = '%s', issuer = '%s')\" % [\n 'Invalid Signing Chain Root',\n 'Subject does not match Issuer for Gem Signing Chain',\n root.subject.to_s,\n root.issuer.to_s,\n ] unless root.issuer.to_s == root.subject.to_s\n\n # make sure root is valid\n v = root.check_validity(root, time)\n raise exc, \"%s: cert = '%s', error = '%s'\" % [\n 'Invalid Signing Chain Root', root.subject, v[:desc]\n ] unless v[:is_valid]\n\n # verify that the chain root is trusted\n if @only_trusted\n # get digest algorithm, calculate checksum of root.subject\n algo = opt[:dgst_algo]\n path = Gem::Security::Policy.trusted_cert_path(root, opt)\n\n # check to make sure trusted path exists\n raise exc, \"%s: cert = '%s', error = '%s'\" % [\n 'Untrusted Signing Chain Root',\n root.subject.to_s,\n \"path \\\"#{path}\\\" does not exist\",\n ] unless File.exist?(path)\n\n # load calculate digest from saved cert file\n save_cert = OpenSSL::X509::Certificate.new(File.read(path))\n save_dgst = algo.digest(save_cert.public_key.to_s)\n\n # create digest of public key\n pkey_str = root.public_key.to_s\n cert_dgst = algo.digest(pkey_str)\n\n # now compare the two digests, raise exception\n # if they don't match\n raise exc, \"%s: %s (saved = '%s', root = '%s')\" % [\n 'Invalid Signing Chain Root',\n \"Saved checksum doesn't match root checksum\",\n save_dgst, cert_dgst,\n ] unless save_dgst == cert_dgst\n end\n end\n\n # return the signing chain\n chain.map { |cert| cert.subject }\n end\n end",
"def sign(opts = {})\n params = {\n secret: client_secret,\n tx_json: {\n 'TransactionType' => opts[:transaction_type] || 'Payment',\n 'Account' => client_account,\n 'Destination' => opts[:destination],\n 'Amount' => opts[:amount]\n }\n }\n if opts.key?(:SendMax) and opts.key?(:Paths)\n # Complex IOU send\n params[:tx_json]['SendMax'] = opts[:SendMax]\n params[:tx_json]['Paths'] = opts[:Paths]\n end\n if opts.key?(:DestinationTag)\n params[:tx_json]['DestinationTag'] = opts[:DestinationTag]\n end\n if opts.key?(:InvoiceID)\n params[:tx_json]['InvoiceID'] = opts[:InvoiceID]\n end\n post(:sign, params)\n end",
"def sign(payload)\n payload = payload.merge({\n :client_id => @client_id,\n :client_secret => @client_secret,\n })\n\n scope = create_scope\n context = create_context(payload)\n s2s = create_string_to_sign(scope, context)\n signing_key = get_signing_salt\n OpenSSL::HMAC.hexdigest(@hash_algo, signing_key, s2s)\n end",
"def to_dev_signed\n self.class.new(:handle => @handle + \"_dev\",\n :caps => dev_cert_caps(@component.caps),\n :component => @component,\n :target => @target,\n :devkit => @devkit,\n :sign => true,\n :sign_type => :dev_cert)\n end",
"def sign(params)\n string = params_to_string(params)\n\n case @sign_type\n when 'RSA'\n ::Alipay::Sign::RSA.sign(@app_private_key, string)\n when 'RSA2'\n ::Alipay::Sign::RSA2.sign(@app_private_key, string)\n else\n raise \"Unsupported sign_type: #{@sign_type}\"\n end\n end",
"def generate\n cert = OpenSSL::X509::Certificate.new\n configure(cert)\n add_extensions(cert)\n cert.sign(Billy.certificate_authority.key, OpenSSL::Digest::SHA256.new)\n end",
"def signed_string\n \"service=#{params['service']}&v=#{params['v']}&sec_id=#{params['sec_id']}¬ify_data=#{params['notify_data']}#{key}\"\n end",
"def build_create_certificate_request\n set_cert_contents\n add_encrypted_request_to_soap(encrypt_application_request)\n end",
"def signature_is_valid?\n node = @ar.at_css('xmlns|SignedInfo',\n 'xmlns' => 'http://www.w3.org/2000/09/xmldsig#')\n\n node = node.canonicalize\n\n signature = @ar.at_css(\n 'xmlns|SignatureValue',\n 'xmlns' => 'http://www.w3.org/2000/09/xmldsig#'\n ).content\n\n signature = Base64.decode64(signature)\n\n certificate.public_key.verify(OpenSSL::Digest::SHA1.new, signature, node)\n end",
"def signature\n subject = self.class.sig_subject([@payload,\n DATA_TYPE,\n ENCODING,\n ALGORITHM])\n @rsa_pkey.sign(DIGEST, subject)\n end",
"def to_signed_tx(private_key)\n sign_tx to_raw_tx, private_key\n end",
"def to_xml\n raise WebexXmlApi::NotEnoughArguments, 'SecurityContext' unless valid?\n builder = Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml|\n xml.header do\n xml.securityContext do\n PARAMETER_MAPPING.each_pair do |k, v|\n xml.send(v, send(k)) if send(k)\n end\n end\n end\n end\n builder.to_xml.gsub(\"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n\", '')\n end",
"def own_signing_certificate\n application_response = extract_application_response(OP_PKI)\n at = 'xmlns|Certificate > xmlns|Certificate'\n node = Nokogiri::XML(application_response).at(at, xmlns: OP_XML_DATA)\n\n return unless node\n\n cert_value = process_cert_value node.content\n cert = x509_certificate cert_value\n cert.to_s\n end",
"def sign_file_if_setup(opts = nil)\n path = yield\n if signer && options[:sign]\n signer.file(path, nil, opts)\n end\n path\n end",
"def list_signing_certificates(options = {})\n request({\n 'Action' => 'ListSigningCertificates',\n :parser => Fog::Parsers::AWS::IAM::ListSigningCertificates.new\n }.merge!(options))\n end",
"def sign(signed_data, algo: nil)\n algo ||= self.algo\n raise AlgorithmError unless algo == self.algo\n openssl_sig = openssl.sign(public_key.digest.new, signed_data)\n raw_sig = PublicKey::ECDSA.ssh_signature(openssl_sig)\n Encoding.encode_signature(algo, raw_sig)\n end",
"def sellar(cert_file, key_file, password)\n nocertificado=\"\"\n certificado=\"\"\n raw = File.read cert_file\n certificate = OpenSSL::X509::Certificate.new raw\n certificate.serial.to_s(16).scan(/.{2}/).each {|v| nocertificado += v[1] }\n certificado = certificate.to_s.gsub(/^-.+/, '').gsub(/\\n/, '')\n\n digest = OpenSSL::Digest::SHA1.new\n pem_file = export_to_pem(key_file, password )\n\n pkey = OpenSSL::PKey::RSA.new( File.read(pem_file), password)\n signature = pkey.sign(OpenSSL::Digest::SHA1.new, certificado)\n #puts pkey.verify(digest, signature, certificado)\n sello =Base64.encode64(signature).gsub(/\\n/, '')\n\n set(:certificado, certificado)\n set(:nocertificado, nocertificado)\n set(:sello, sello)\n\n\n end",
"def signed_url(options = {})\n #STDERR.puts \"file.signed_url options=#{options.inspect}\"\n u = url(options)\n Aws::CF::Signer.sign_url(u)\n end",
"def sign( key, data )\n blob = @buffers.writer\n blob.write_key key\n\n packet_data = @buffers.writer\n packet_data.write_string blob.to_s\n packet_data.write_string data.to_s\n packet_data.write_long 0\n\n type, reply = send_with_reply SSH2_AGENT_SIGN_REQUEST, packet_data\n if agent_failed( type )\n raise AgentError,\n \"agent could not sign data with requested identity\"\n elsif type != SSH2_AGENT_SIGN_RESPONSE\n raise AgentError, \"bad authentication response #{type}\"\n end\n\n return reply.read_string\n end",
"def gen_x509_cert(request, extension, info, key)\n raise TypeError, \"request must be a Ruby OpenSSL::X509::Request\" unless request.is_a?(::OpenSSL::X509::Request)\n raise TypeError, \"extension must be a Ruby Array\" unless extension.is_a?(Array)\n raise TypeError, \"info must be a Ruby Hash\" unless info.is_a?(Hash)\n raise TypeError, \"key must be a Ruby OpenSSL::PKey::EC object or a Ruby OpenSSL::PKey::RSA object\" unless key.is_a?(::OpenSSL::PKey::EC) || key.is_a?(::OpenSSL::PKey::RSA)\n\n raise ArgumentError, \"info must contain a validity\" unless info.key?(\"validity\")\n raise TypeError, \"info['validity'] must be a Ruby Integer object\" unless info[\"validity\"].is_a?(Integer)\n\n cert = ::OpenSSL::X509::Certificate.new\n ef = ::OpenSSL::X509::ExtensionFactory.new\n\n cert.serial = gen_serial\n cert.version = 2\n cert.subject = request.subject\n cert.public_key = request.public_key\n cert.not_before = Time.now\n cert.not_after = cert.not_before + info[\"validity\"] * 24 * 60 * 60\n\n if info[\"issuer\"].nil?\n cert.issuer = request.subject\n ef.issuer_certificate = cert\n extension << ef.create_extension(\"basicConstraints\", \"CA:TRUE\", true)\n else\n raise TypeError, \"info['issuer'] must be a Ruby OpenSSL::X509::Certificate object\" unless info[\"issuer\"].is_a?(::OpenSSL::X509::Certificate)\n\n cert.issuer = info[\"issuer\"].subject\n ef.issuer_certificate = info[\"issuer\"]\n end\n ef.subject_certificate = cert\n if openssl_config = __openssl_config\n ef.config = openssl_config\n end\n\n cert.extensions = extension\n cert.add_extension ef.create_extension(\"subjectKeyIdentifier\", \"hash\")\n cert.add_extension ef.create_extension(\"authorityKeyIdentifier\",\n \"keyid:always,issuer:always\")\n\n cert.sign(key, ::OpenSSL::Digest.new(\"SHA256\"))\n cert\n end",
"def sign!\n params = {\n :if_updated_at => @contract.content_updated_at\n }\n\n response = @client.put self.url, { :body => params.to_json, :headers => { 'Content-Type' => 'application/json' } }\n\n if response.status != 201\n raise Inkdit::Error.new(response)\n end\n\n Inkdit::Signature.new(@client, response.parsed)\n end",
"def sign(key, cert, ca_certs=nil)\n m = self.entries.find { |e| e.name == \"META-INF/MANIFEST.MF\" }\n raise RuntimeError.new(\"Jar has no manifest\") unless m\n\n ca_certs ||= [ cert ]\n\n new_manifest = ''\n sigdata = \"Signature-Version: 1.0\\r\\n\"\n sigdata << \"Created-By: 1.6.0_18 (Sun Microsystems Inc.)\\r\\n\"\n sigdata << \"\\r\\n\"\n\n # Grab the sections of the manifest\n files = m.data.split(/\\r?\\n\\r?\\n/)\n if files[0] =~ /Manifest-Version/\n # keep the header as is\n new_manifest << files[0]\n new_manifest << \"\\r\\n\\r\\n\"\n files = files[1,files.length]\n end\n\n # The file sections should now look like this:\n # \"Name: metasploit/Payload.class\\r\\nSHA1-Digest: KbAIMttBcLp1zCewA2ERYkcnRU8=\\r\\n\\r\\n\"\n files.each do |f|\n next unless f =~ /Name: (.*)/\n name = $1\n e = self.entries.find { |e| e.name == name }\n if e\n digest = OpenSSL::Digest::SHA1.digest(e.data)\n manifest_section = \"Name: #{name}\\r\\n\"\n manifest_section << \"SHA1-Digest: #{[digest].pack('m').strip}\\r\\n\"\n manifest_section << \"\\r\\n\"\n\n manifest_digest = OpenSSL::Digest::SHA1.digest(manifest_section)\n\n sigdata << \"Name: #{name}\\r\\n\"\n sigdata << \"SHA1-Digest: #{[manifest_digest].pack('m')}\\r\\n\"\n new_manifest << manifest_section\n end\n end\n\n # Now overwrite with the new manifest\n m.data = new_manifest\n\n flags = 0\n flags |= OpenSSL::PKCS7::BINARY\n flags |= OpenSSL::PKCS7::DETACHED\n # SMIME and ATTRs are technically valid in the signature but they\n # both screw up the java verifier, so don't include them.\n flags |= OpenSSL::PKCS7::NOSMIMECAP\n flags |= OpenSSL::PKCS7::NOATTR\n\n signature = OpenSSL::PKCS7.sign(cert, key, sigdata, ca_certs, flags)\n sigalg = case key\n when OpenSSL::PKey::RSA; \"RSA\"\n when OpenSSL::PKey::DSA; \"DSA\"\n # Don't really know what to do if it's not DSA or RSA. Can\n # OpenSSL::PKCS7 actually sign stuff with it in that case?\n # Regardless, the java spec says signatures can only be RSA,\n # DSA, or PGP, so just assume it's PGP and hope for the best\n else; \"PGP\"\n end\n\n # SIGNFILE is the default name in documentation. MYKEY is probably\n # more common, though because that's what keytool defaults to. We\n # can probably randomize this with no ill effects.\n add_file(\"META-INF/SIGNFILE.SF\", sigdata)\n add_file(\"META-INF/SIGNFILE.#{sigalg}\", signature.to_der)\n\n return true\n end",
"def openssl_create_csr(*args,&block)\n key = args[0][:key]\n name = OpenSSL::X509::Name.new [['CN', \"To be detailed\"]]\n req = OpenSSL::X509::Request.new\n req.version = 0\n req.subject = name\n req.public_key = key.public_key\n req.sign key, OpenSSL::Digest::SHA1.new\n req\n end",
"def sign(private_key, chain_id)\n ctx = Secp256k1::Context.new\n signature, recovery_id = ctx.sign_recoverable(private_key, hash).compact\n result = signature.bytes\n result = result.append(Chains.to_v(recovery_id, chain_id))\n result.pack('c*')\n end",
"def valid_signature? signature\n # We create a new XML document in Nokogiri to canonicalize the\n # signature. Nokogiri needs the xmlns:ds tag on the root element to\n # preserve the 'ds:' namespace on all the elements. Not exactly sure\n # why this is needed, but it works if we do it.\n info = signature.find_first('.//ds:SignedInfo', DS)\n\n canon = LibXML::XML::Document.new\n canon.root = canon.import info\n canonicalized = canon.canonicalize\n\n b64_sig = signature.find_first('.//ds:SignatureValue', DS).content\n dec_sig = Base64.decode64 b64_sig\n\n b64_cert = signature.find_first('.//ds:X509Certificate', DS).content\n cert = OpenSSL::X509::Certificate.new(Base64.decode64(b64_cert))\n\n digest = OpenSSL::Digest::SHA1.new\n cert.public_key.verify(digest, dec_sig, canonicalized)\n end",
"def start\n # Get the parameters for this signature (received from the POST call via\n # AJAX, see batch-signature-form.js).\n id = params[:id]\n \n # Get an instantiate of the PadesSignatureStarter class, responsible for\n # receiving the signature elements and start the signature process.\n signature_starter = RestPki::PadesSignatureStarter.new(get_rest_pki_client)\n \n # Set signature policy.\n signature_starter.signature_policy_id = RestPki::StandardSignaturePolicies::PADES_BASIC\n \n # Set the security context to be used to determine trust in the certificate\n # chain. We have encapsulated the security context choice on util.rb.\n signature_starter.security_context_id = get_security_context_id\n\n # Set the visual representation for the signature.\n signature_starter.visual_representation = get_visual_representation\n \n # Set the PDF to be signed.\n signature_starter.set_pdf_tosign_from_path(get_batch_doc_path(id))\n \n # Call the start_with_webpki method, which initiates the signature. This\n # yields the token, a 43-character case-sensitive URL-safe string, which\n # identifies this signature process. We'll use this value to call the\n # sign_with_restpki method on the Web PKI component (see signature-form.js)\n # and also to complete the signature after the form is submitted (see method\n # create below). This should not be mistaken with the API access token.\n @token = signature_starter.start_with_webpki\n\n # The token acquired above can only be used for a single signature attempt.\n # In order to retry the signature it is necessary to get a new token. This\n # can be a problem if the user uses the back button of the browser, since\n # the browser might show a cached page that we rendered previously, with a\n # now stale token. To prevent this from happening, we call the method\n # set_expired_page_headers, located in application_helper.rb, which sets\n # HTTP headers to prevent caching of the page.\n set_expired_page_headers\n\n render json: \"\\\"#{@token}\\\"\"\n end",
"def sign_document_status\n puts \"------ JSON que veio ------\"\n document_data = JSON.parse(request.body.read)\n puts document_data\n\n puts \"------ Nossa transformação ------\"\n document_data.deep_symbolize_keys!\n puts document_data\n\n puts \"----- doc_key: #{document_data[:document][:key]} -----------\"\n # testar escrever @operation como operation\n @operation = Operation.new\n\n if request.headers[\"Event\"] == \"auto_close\"\n @operation = Operation.find_by_sign_document_key(document_data[:document][:key])\n @operation.signed_at = Time.current\n @operation.signed = true\n @operation.save!\n SlackMessage.new(\"CHQFGD43Y\", \"<!channel> o contrato da *Operação #{@operation.id}* foi completamente assinado\").send_now\n elsif request.headers[\"Event\"] == \"sign\"\n @operation = Operation.find_by_sign_document_key(document_data[:document][:key])\n signer_email = document_data[:event][:data][:signer][:email]\n new_sign_document_info = @operation.sign_document_info.deep_symbolize_keys\n new_sign_document_info[:signer_signature_keys].each do |signer_signature_key|\n if signer_signature_key[:email] == signer_email\n signer_signature_key.store(:status, \"signed\")\n SlackMessage.new(\"CHQFGD43Y\", \"<!channel> #{signer_email} assinou o contrato da *Operação #{@operation.id}*\").send_now\n end\n end\n @operation.sign_document_info = new_sign_document_info\n @operation.save!\n end\n # testar tirar esse authorize\n authorize @operation\n render body: {}.to_json, status: :created\n\n end",
"def accounts_documents_sign_init_post(accountid, documentid, parameters, authorization, psu_ip_address, opts = {})\n data, _status_code, _headers = accounts_documents_sign_init_post_with_http_info(accountid, documentid, parameters, authorization, psu_ip_address, opts)\n data\n end",
"def configure(cert)\n req = signing_request\n cert.issuer = Billy.certificate_authority.cert.subject\n cert.not_before = days_ago(2)\n cert.not_after = days_from_now(2)\n cert.public_key = req.public_key\n cert.serial = serial\n cert.subject = req.subject\n cert.version = 2\n end",
"def create\n # get the ca\n @authority = Certify::Authority.find(params[:certify_authority_id])\n\n # generate a new one\n @certificate = Certify::Certificate.new(params[:certificate])\n\n # generate the csr\n if (params[:csr] && params[:csr] != \"\")\n csr = Certify::Csr.new :data => params[:csr]\n else\n kp = Certify::KeyPair.find(params[:keypair][:id])\n csr = kp.generate_csr('CN=ca/DC=example')\n end\n\n # sign the csr\n @certificate = @authority.sign_csr(csr)\n\n # format\n respond_to do |format|\n if @certificate && @certificate.valid?\n format.html { redirect_to certify_authority_path(@authority), notice: 'Certificate was successfully created.' }\n format.json { render json: @certificate, status: :created, location: @certificate }\n else\n format.html { render action: \"new\" }\n format.json { render json: @certificate.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.59415257",
"0.5758002",
"0.57578945",
"0.56604856",
"0.56379086",
"0.55662215",
"0.5553731",
"0.5552196",
"0.5411213",
"0.5408934",
"0.53781074",
"0.53595304",
"0.529558",
"0.52936125",
"0.5251523",
"0.5246577",
"0.52071613",
"0.5183398",
"0.51571876",
"0.5154924",
"0.50167185",
"0.49753547",
"0.49732053",
"0.4943373",
"0.49404934",
"0.49310458",
"0.49244028",
"0.49211225",
"0.491504",
"0.4914028",
"0.48994547",
"0.48733902",
"0.48664021",
"0.4864976",
"0.48617247",
"0.48580158",
"0.48451477",
"0.48237386",
"0.4789859",
"0.4789447",
"0.4771811",
"0.4765388",
"0.47264484",
"0.4722037",
"0.47128886",
"0.47080415",
"0.47068676",
"0.46985435",
"0.46920496",
"0.46765345",
"0.46579596",
"0.46451285",
"0.46385798",
"0.46281728",
"0.46269542",
"0.46266964",
"0.46151236",
"0.46151236",
"0.46039945",
"0.45623314",
"0.45582736",
"0.45575094",
"0.45526206",
"0.45507154",
"0.4550009",
"0.45391497",
"0.45279932",
"0.4520554",
"0.45194256",
"0.45190397",
"0.45143747",
"0.45031896",
"0.45030957",
"0.44999182",
"0.4492352",
"0.4485588",
"0.44828734",
"0.44765583",
"0.44758007",
"0.44755092",
"0.44645885",
"0.44631723",
"0.44615966",
"0.44580176",
"0.44574085",
"0.4454314",
"0.44461113",
"0.4439601",
"0.4431082",
"0.44310692",
"0.44277534",
"0.44268352",
"0.4425298",
"0.44178897",
"0.44114187",
"0.44011927",
"0.4397359",
"0.43946707",
"0.4385661",
"0.43754193"
] |
0.8422334
|
0
|
Reset digest algorithm for signature creation and signature algorithm identifier
|
def set_default_signature_method!
# self.signature_digest_algorithm = :sha1
# self.signature_algorithm_id = 'http://www.w3.org/2000/09/xmldsig#rsa-sha1'
self.signature_digest_algorithm = :sha256
self.signature_algorithm_id = 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256'
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def reset\n check_valid\n OpenSSL::LibCrypto.EVP_DigestInit_ex(self, self.md, nil)\n self\n end",
"def signature_digest_algorithm=(algorithm)\n @sign_digester = Kiji::Digester.new(algorithm)\n end",
"def signature_digest_algorithm\n @sign_digester.symbol || @sign_digester.digest_name\n end",
"def reset\n @sha_in_phrase = \"\"\n @params = {}\n end",
"def digest()\n @stomach.clear\n end",
"def digest_algorithm\n @digester.symbol || @digester.digest_name\n end",
"def create_reset_digest\n self.reset_token = Golfer.new_token\n update_attribute(:reset_digest, Golfer.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def digest_algorithm=(algorithm)\n @digester = Kiji::Digester.new(algorithm)\n end",
"def digest\n case @signature_method\n when \"HMAC-SHA256\" then OpenSSL::Digest.new(\"sha256\")\n when \"HMAC-SHA1\" then OpenSSL::Digest.new(\"sha1\")\n else\n fail InvalidSignatureMethodError\n end\n end",
"def create_reset_digest\n new_token = SecureRandom.urlsafe_base64\n update_attributes(reset_digest: User.hash_token(new_token), reset_sent_at: Time.zone.now)\n new_token\n end",
"def create_reset_digest\n self.reset_digest = SecureRandom.urlsafe_base64.to_s\n update_attribute(:reset_digest, reset_digest)\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def digest_class\n Digest::SHA256\n end",
"def digest_class\n Digest::SHA256\n end",
"def create_reset_digest\n self.reset_token = LocalIdentity.new_token\n update_attribute(:reset_digest, LocalIdentity.digest(self.reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def digest\n ''\n end",
"def digest\n ''\n end",
"def create_reset_digest\n self.reset_token = Gamer.new_token\n update_attribute(:reset_digest, Gamer.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def reset()\n\n\t\t@aChecksum = [ 0xFF, 0xFF ];\n\n\tend",
"def create_reset_digest\n self.reset_token = Organization.new_token\n update_attribute(:reset_digest, Organization.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = Person.new_token\n update_attribute(:reset_digest, Person.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def reset_code!\n self.reset_code = Digest::MD5.hexdigest(self.object_id.to_s + Rauth::Encode.mksalt).upcase\n end",
"def create_reset_digest\n self.reset_token = Usuario.new_token\n update_attribute(:reset_digest, Usuario.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = Agent.new_token\n update_attribute(:reset_digest, Agent.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = Lawfirm.new_token\n update_attribute(:reset_digest, Lawfirm.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n @reset_token = SecureRandom.urlsafe_base64(48)\n self.reset_token = @reset_token\n update_attribute(:reset_digest, @reset_token)\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def digester\n @digest_info[:digester].reset\n end",
"def digest\n @digest ||= DEFAULT_DIGEST_PROC\n end",
"def digester_for_signature_method(algorithm_url)\n signature_digest_mapping = {\n 'http://www.w3.org/2000/09/xmldsig#rsa-sha1' => 'http://www.w3.org/2000/09/xmldsig#sha1',\n 'http://www.w3.org/2001/04/xmldsig-more#gostr34102001-gostr3411' => 'http://www.w3.org/2001/04/xmldsig-more#gostr3411',\n }\n digest_url = signature_digest_mapping[algorithm_url] || algorithm_url\n digester(digest_url)\n end",
"def signature\n @signature ||= Base64.encode64(digest).gsub(\"\\n\", '')\n end",
"def create_reset_digest\n self.reset_token = Band.new_token\n update_attribute(:reset_digest, Band.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def fingerprint(algorithm='sha1')\n message_digest = R509::MessageDigest.new(algorithm)\n md = message_digest.digest\n md.update(@cert.to_der)\n md.to_s\n end",
"def create_reset_digest\n\t self.reset_token = User.new_token\n\t update_attribute(:reset_digest, User.digest(reset_token))\n\t update_attribute(:reset_sent_at, Time.zone.now)\n\tend",
"def create_reset_digest\n\t self.reset_token = User.new_token\n\t update_attribute(:reset_digest, User.digest(reset_token))\n\t update_attribute(:reset_sent_at, Time.zone.now)\n\tend",
"def fingerprint(algorithm = 'sha256')\n message_digest = R509::MessageDigest.new(algorithm)\n md = message_digest.digest\n md.update(@cert.to_der)\n md.to_s\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update reset_digest: User.digest(reset_token),\n reset_sent_at: Time.zone.now\n end",
"def hexdigest!()\n #This is a stub, used for indexing\n end",
"def create_reset_digest\r\n self.reset_token = User.new_token\r\n update_attribute(:reset_digest,User.digest(reset_token))\r\n update_attribute(:reset_sent_at,Time.zone.now)\r\n end",
"def create_reset_digest\n\t\tself.reset_token = Member.new_token\n\t\tupdate_attribute(:reset_digest, Member.digest(reset_token))\n\t\tupdate_attribute(:reset_sent_at, Time.zone.now)\n\tend",
"def create_reset_digest\n\t\tself.reset_token = User.new_token\n\t\tupdate_attribute(:reset_digest, User.digest(reset_token))\n\t\tupdate_attribute(:reset_sent_at, Time.zone.now)\n\tend",
"def create_reset_digest\n\t\tself.reset_token = User.new_token\n\t\tupdate_attribute(:reset_digest, User.digest(reset_token))\n\t\tupdate_attribute(:reset_sent_at, Time.zone.now)\n\tend",
"def create_reset_digest\n\t\tself.reset_token = User.new_token\n\t\tupdate_attribute(:reset_digest, User.digest(reset_token))\n\t\tupdate_attribute(:reset_sent_at, Time.zone.now)\n\tend",
"def create_reset_digest\n\t\tself.reset_token = User.new_token\n\t\tupdate_attribute(:reset_digest, User.digest(reset_token))\n\t\tupdate_attribute(:reset_sent_at, Time.zone.now)\n\tend",
"def create_reset_digest\n\t\tself.reset_token = User.new_token\n\t\tupdate_attribute(:reset_digest, User.digest(reset_token))\n\t\tupdate_attribute(:reset_sent_at, Time.zone.now)\n\tend",
"def create_reset_digest\n self.reset_token = ApplicationController.new_token\n update_attribute(:reset_digest, ApplicationController.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def digest(string, algorithm)\n Base64.encode64 digester(algorithm).digest(string)\n end",
"def create_reset_digest\n self.reset_token = Member.new_token\n update_attribute(:reset_digest, Member.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def signing_algorithm\n signing_key.is_a?(String) ? \"HS256\" : \"RS256\"\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attributes(reset_digest: User.digest(reset_token), reset_sent_at: Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n\t self.reset_token = User.new_token\n\t update_attribute(:reset_digest, User.digest(reset_token))\n\t update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def update_signature!; end",
"def update_signature!; end",
"def create_reset_digest\n self.reset_token = Doctor.new_token\n update_attribute(:reset_digest, Doctor.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end"
] |
[
"0.73125803",
"0.69204104",
"0.68029976",
"0.6341454",
"0.61070776",
"0.6096316",
"0.60683715",
"0.60480535",
"0.5979214",
"0.5938267",
"0.5932809",
"0.5888691",
"0.5888691",
"0.588021",
"0.5864254",
"0.5864254",
"0.5854045",
"0.5811001",
"0.58022064",
"0.5788237",
"0.57848024",
"0.5772063",
"0.57498914",
"0.5711889",
"0.5706891",
"0.56789804",
"0.56530255",
"0.5651745",
"0.5642901",
"0.5613062",
"0.5609275",
"0.55911314",
"0.55911314",
"0.55908585",
"0.5590698",
"0.55803084",
"0.5563434",
"0.55621064",
"0.5556657",
"0.5556657",
"0.5556657",
"0.5556657",
"0.55531675",
"0.55512875",
"0.55413365",
"0.5539604",
"0.5538724",
"0.55380696",
"0.55366844",
"0.5528653",
"0.55247444",
"0.5522347",
"0.5519804",
"0.5519804",
"0.55159664",
"0.5512908",
"0.5512908",
"0.55086124",
"0.55086124",
"0.55086124",
"0.55086124",
"0.55086124",
"0.55086124",
"0.55086124",
"0.55086124",
"0.55086124",
"0.55086124",
"0.55086124",
"0.55086124",
"0.55086124",
"0.55086124",
"0.55086124",
"0.55086124",
"0.55086124",
"0.55086124",
"0.55086124",
"0.55086124",
"0.55086124",
"0.55086124",
"0.55086124",
"0.55086124",
"0.55086124",
"0.55086124",
"0.55086124",
"0.55086124",
"0.55086124",
"0.55086124",
"0.55086124",
"0.55086124",
"0.55086124",
"0.55086124",
"0.55086124",
"0.55086124",
"0.55086124",
"0.55086124",
"0.55084383",
"0.55084383",
"0.55084383",
"0.55084383",
"0.55084383"
] |
0.68817925
|
2
|
Searches in namespaces, defined on +target_node+ or its ancestors, for the +namespace+ with given URI and returns its prefix. If there is no such namespace and +desired_prefix+ is specified, adds such a namespace to +target_node+ with +desired_prefix+
|
def namespace_prefix(target_node, namespace, desired_prefix = nil)
ns = target_node.namespaces.key(namespace)
if ns
ns.match(/(?:xmlns:)?(.*)/) && Regexp.last_match(1)
elsif desired_prefix
target_node.add_namespace_definition(desired_prefix, namespace)
desired_prefix
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_namespace(node, prefix); end",
"def prefix_for(ns_uri)\n if namespaces_by_uri().has_key?(ns_uri)\n namespaces_by_uri()[ns_uri].prefix || \"\" # namespace.prefix returns nil if there is no prefix defined (default prefix)\n end\n end",
"def prefix_for(ns_href)\n namespaces[ns_href] || add_namespace(ns_href)\n end",
"def get_namespace( node, prefix )\n if @namespaces\n return @namespaces[prefix] || ''\n else\n return node.namespace( prefix ) if node.node_type == :element\n return ''\n end\n end",
"def lookup_namespace_uri( prefix )\n # TODO\n nil\n end",
"def ns(wanted_uri=\"DAV:\")\n _ns = ''\n if(request_document && request_document.root && request_document.root.namespace_definitions.size > 0)\n _ns = request_document.root.namespace_definitions.collect{|__ns| __ns if __ns.href == wanted_uri}.compact\n if _ns.empty?\n _ns = request_document.root.namespace_definitions.first.prefix.to_s if _ns.empty?\n else\n _ns = _ns.first\n _ns = _ns.prefix.nil? ? 'xmlns' : _ns.prefix.to_s\n end\n _ns += ':' unless _ns.empty?\n end\n _ns\n end",
"def targetURI\n \"http://www.w3.org/2001/DOM-Test-Suite/tests/Level-1/nodesetprefix01\"\n end",
"def namespace(prefix)\n easy = Curl::Easy.new\n easy.url = self.uri + \"/namespaces/\" + easy.escape(prefix)\n easy.http_get\n\n raise(SesameException.new(easy.body_str)) unless easy.response_code == 200\n\n ns = easy.body_str\n ns =~ /^Undefined prefix:/ ? nil : ns\n end",
"def namespace_prefix( doc, ns )\n doc_ns = doc.collect_all_namespaces_href_keys\n if doc_ns.key?( ns )\n doc_ns[ ns ].first.nil? ? 'xmlns' : doc_ns[ ns ].first\n else\n 'xmlns'\n end\nend",
"def default_prefix=(prefix)\r\n # Find default prefix\r\n ns = find_by_prefix(nil)\r\n raise(ArgumentError, \"No default namespace was found\") unless ns\r\n Namespace.new(self.node, prefix, ns.href)\r\n end",
"def namespace_prefix( doc, ns )\n doc_ns = doc.collect_all_namespaces_href_keys\n if doc_ns.key?( ns )\n doc_ns[ ns ].first.nil? ? 'xmlns' : doc_ns[ ns ].first\n else\n 'xmlns'\n end\n end",
"def add_namespace(ns, prefix = \"unknown#{rand 65536}\")\n return nil if ns.nil? || ns.empty?\n unless namespaces.key? ns\n namespaces[ns] = prefix\n return prefix\n end\n end",
"def getNamespace(prefix)\n @obj.getNamespace(prefix)\n end",
"def uri_for(prefix)\n if namespaces_by_prefix().has_key?(prefix)\n namespaces_by_prefix()[prefix].href\n end\n end",
"def prefix(new_prefix = nil)\n return @prefix if new_prefix.nil?\n @prefix = new_prefix\n end",
"def inherited_namespace(prefix=inherited_prefix)\n namespace(prefix)\n end",
"def namespaces_by_prefix\n form_data = { 'action' => 'query', 'meta' => 'siteinfo', 'siprop' => 'namespaces' }\n res = make_api_request(form_data)\n REXML::XPath.match(res, \"//ns\").inject(Hash.new) do |namespaces, namespace|\n prefix = namespace.attributes[\"canonical\"] || \"\"\n namespaces[prefix] = namespace.attributes[\"id\"].to_i\n namespaces\n end\n end",
"def use_prefix\n prefix, @prefix = @prefix, nil\n @res << prefix if prefix\n\n prefix\n end",
"def find_or_new_namespace(name, uri)\n namespace = @namespaces.find { |n| n.namespace == name } || (@namespaces << Restfulie::Common::Builder::Rules::Namespace.new(name, uri)).last\n namespace.uri = uri unless uri.nil?\n namespace\n end",
"def sfa_add_namespace(prefix, urn)\n @@sfa_namespaces[prefix] = urn\n end",
"def namespaces_by_prefix\n namespace_scopes.reduce({}, &->(m, ns) { m[ns.prefix]=ns; m })\n end",
"def add_ns2_prefix(content)\n %w{ actuate arcrole entityref from href id linktype parent role show target title to xpointer }.each do | xa |\n content.gsub!(/ #{xa}=/) {|match| \" ns2:#{match.strip}\"} if content =~ / #{xa}=/\n end\n content\n end",
"def setNamespace(prefix, uri) \n @obj.setNamespace(prefix, uri)\n end",
"def namespace!(prefix, namespace)\n uri = URI.parse(self.uri + \"/namespaces/\" + URI.escape(prefix))\n http = Net::HTTP.start(uri.host, uri.port)\n result = http.send_request('PUT', uri.path, namespace)\n\n raise(SesameException.new(easy.body_str)) unless easy.response_code == 204\n\n result.body\n end",
"def node_ns_definition(node, ns)\n prefix = ns.is_a?(Nokogiri::XML::Namespace) ? ns.prefix : ns\n node.namespace_definitions.find { |n| n.prefix == prefix }\n end",
"def prefixes\n @prefixes ||= Hash[namespaces.sort_by { |k, v| k }.uniq { |k, v| v }].invert\n end",
"def test_nodesetprefix01\n doc = nil\n docFragment = nil\n element = nil\n elementTagName = nil\n elementNodeName = nil\n appendedChild = nil\n doc = load_document(\"staff\", true)\n docFragment = doc.createDocumentFragment()\n element = doc.createElementNS(\"http://www.w3.org/DOM/Test\", \"emp:address\")\n appendedChild = docFragment.appendChild(element)\n element.prefix = \"dmstc\"\n elementTagName = element.tagName()\n elementNodeName = element.nodeName()\n assert_equal(\"dmstc:address\", elementTagName, \"nodesetprefix01_tagname\")\n assert_equal(\"dmstc:address\", elementNodeName, \"nodesetprefix01_nodeName\")\n \n end",
"def namespace(ns)\n ns.blank? ? \"nil\" : %|\"#{ns.prefix}\"|\nend",
"def test_namespace\n N::Namespace.shortcut(:test_namespace, \"http://test_namespace/\")\n assert_equal(:test_namespace, N::URI.new(\"http://test_namespace/\").namespace)\n assert_equal(:test_namespace, N::URI.new(\"http://test_namespace/else\").namespace)\n assert_equal(nil, N::URI.new(\"http://test_namespace/else/other\").namespace)\n end",
"def prefix(name, uri = nil)\n name = name.to_s.empty? ? nil : (name.respond_to?(:to_sym) ? name.to_sym : name.to_s.to_sym)\n uri.nil? ? prefixes[name] : prefixes[name] = (uri.respond_to?(:to_sym) ? uri.to_sym : uri.to_s.to_sym)\n end",
"def namespace(value)\n merge(namespace: value.to_s)\n end",
"def add_namespaces node\n raw.root.namespace_definitions.each do |ns|\n node.add_namespace_definition ns.prefix, ns.href if ns.href != NS\n end\n end",
"def delegation_prefix\n ensure_setup!\n options[:prefix].try(:to_s)\n end",
"def collect_namespaces\n # TODO: print warning message if a prefix refers to more than one URI in the document?\n ns = {}\n traverse {|j| ns.merge!(j.namespaces)}\n ns\n end",
"def resolve(curie_or_uri)\n ns, short_name = split_curie curie_or_uri\n\n if ns && (namespaces.has_key? ns)\n namespaces[ns].expand(rel: short_name).to_s\n else\n curie_or_uri\n end\n end",
"def xmlns_attr\n prefix.empty? ? \"xmlns\" : \"xmlns:#{prefix}\"\n end",
"def xmlns_attr\n prefix.empty? ? \"xmlns\" : \"xmlns:#{prefix}\"\n end",
"def wrap_prefix(prefix)\n prefix\n end",
"def targetURI\n \"http://www.w3.org/2001/DOM-Test-Suite/tests/Level-1/setNamedItemNS01\"\n end",
"def xml_namespace(node, name, uri, namespaces = {})\n XML::Namespace.new(node, name, uri)\n end",
"def dom_prefix\n @dom_prefix || (@up ? @up.dom_prefix : nil)\n end",
"def get_prefixed_words(prefix)\n # FILL ME IN\n # return [@trie.is_word(prefix)]\n prefix_copy = prefix\n answer = []\n current_node = My_trie.root\n # p \"val is: \"\n # p My_trie.root.val\n # return ['alphabet']\n\n while prefix.length > 0\n # p \"node is: \", current_node.keys\n node = current_node.keys[prefix[0]]\n prefix = prefix[1..-1]\n if node\n current_node = node\n else\n return \"Sorry, we can't find any words with that prefix\"\n end\n end\n #we now have the final letter of the prefix as the current node, I hope.\n # p \"CURRENT NODE.VAL: \", current_node.val\n answer = dfs(current_node, prefix_copy[0...-1])\n return answer\n end",
"def element_by_xpath_with_default_namespace(xpath_without_ns)\n xpath_without_ns = xpath_without_ns.to_s\n @xml.xpath(xpath_without_ns.gsub(/(^|\\/{1,2})(\\w+)/, '\\1xmlns:\\2'), :xmlns => OMF_NAMESPACE)\n end",
"def extract_namespace node\n node.ancestors[0].to_s\n end",
"def fix_namespaces(doc)\n if is_jruby?\n # Only needed in jruby, nokogiri's jruby implementation isn't weird\n # around namespaces in exactly the same way as MRI. We need to keep\n # track of the namespaces in outer contexts ourselves, and then see\n # if they are needed ourselves. :(\n namespaces = namespaces_stack.compact.reduce({}, :merge)\n default_ns = namespaces.delete(\"xmlns\")\n\n namespaces.each_pair do |attrib, uri|\n ns_prefix = attrib.sub(/\\Axmlns:/, '')\n\n # gotta make sure it's actually used in the doc to not add it\n # unecessarily. GAH.\n if doc.xpath(\"//*[starts-with(name(), '#{ns_prefix}:')][1]\").empty? &&\n doc.xpath(\"//@*[starts-with(name(), '#{ns_prefix}:')][1]\").empty?\n next\n end\n doc.root.add_namespace_definition(ns_prefix, uri)\n end\n\n if default_ns\n doc.root.default_namespace = default_ns\n # OMG nokogiri, really?\n default_ns = doc.root.namespace\n doc.xpath(\"//*[namespace-uri()='']\").each do |node|\n node.namespace = default_ns\n end\n end\n\n end\n return doc\n end",
"def add_namespaces( node, namespaces )\n #pass nil as the prefix to create a default node\n default = namespaces.delete( \"default\" )\n node.namespaces.namespace = XML::Namespace.new( node, nil, default )\n namespaces.each do |prefix, prefix_uri|\n XML::Namespace.new( node, prefix, prefix_uri )\n end\n end",
"def prefix=(value)\n @prefix = value\n end",
"def prefixes\n prefix.split(NAMESPACE_PATTERN)\n end",
"def prefixes\n prefix.split(NAMESPACE_PATTERN)\n end",
"def prefix(value)\n merge(leprefix: value.to_s)\n end",
"def prefix(num)\n namespace + '_prefix_' + num.to_s\n end",
"def register_namespace(name_and_href)\n (@default_namespaces ||= []) <<name_and_href\n end",
"def register_namespace(name_and_href)\n (@default_namespaces ||= []) <<name_and_href\n end",
"def namespace(prefix = nil)\n Namespace.new(prefix, @memcache)\n end",
"def prefix(value)\n merge(aguprefix: value.to_s)\n end",
"def namespace(value = nil)\n if value\n @namespace = value\n else\n @namespace\n end\n end",
"def namespace?(x)\n if x.namespace && x.namespace.prefix\n self.class.namespace?(x.namespace.prefix)\n else\n true\n end\n end",
"def append_penultimate_lookup_context_prefixes(*prefixes, &block)\n lookup_context.prefixes.insert(-2, *prefixes)\n block.call\n remove_lookup_context_prefixes(-2, *prefixes.reverse)\n end",
"def namespace_matches?(xml_node, ns)\n return false unless xml_node.respond_to?(:namespace)\n\n return xml_node.namespace.to_s == ns || ns == '*'\n end",
"def prefix(value)\n merge(gadrprefix: value.to_s)\n end",
"def match(prefix)\n result = []\n current = @root\n current_prefix = prefix\n\n while current != nil && current_prefix != \"\"\n previous, previous_prefix = current, current_prefix\n current, current_prefix = next_node(current, current_prefix)\n end\n\n unless current\n if current_prefix\n return []\n else\n next_nodes = previous[:nodes].select { |prefix, node| prefix.start_with?(previous_prefix) }.values\n end\n else\n next_nodes = [current]\n end\n\n until next_nodes.empty?\n current = next_nodes.pop\n result << current[:value]\n current[:nodes].each { |prefix, node| next_nodes.push(node) }\n end\n\n return result.compact\n end",
"def [](prefix)\n @prefixed[prefix] ||= PrefixedWithFallback.new(prefix, self)\n end",
"def combineNsBase(namespace, base)\n namespace && !namespace.empty? ? \"#{namespace}.#{base}\".to_sym : base.to_sym\nend",
"def ns_prefixes\n {\n 'jerm' => JERMVocab.to_uri.to_s,\n 'dcterms' => RDF::Vocab::DC.to_uri.to_s,\n 'owl' => RDF::Vocab::OWL.to_uri.to_s,\n 'foaf' => RDF::Vocab::FOAF.to_uri.to_s,\n 'sioc' => RDF::Vocab::SIOC.to_uri.to_s\n }\n end",
"def namespace(value)\n _namespace(value) or fail ArgumentError, \"Unknown value for namespace: #{value}\"\n end",
"def handle_prefix(client, data)\n prefix, uri = data\n\n topic = @engine.find_or_create_topic(uri)\n client.add_prefix(prefix, topic)\n\n trigger(:prefix, client, prefix, uri)\n end",
"def removeNamespace(prefix) \n @obj.removeNamespace(prefix)\n end",
"def namespace(prefix = T.unsafe(nil)); end",
"def get_pname(resource)\n case resource\n when RDF::Node\n return options[:unique_bnodes] ? resource.to_unique_base : resource.to_base\n when RDF::URI\n uri = resource.to_s\n else\n return nil\n end\n\n #log_debug {\"get_pname(#{resource}), std?}\"}\n pname = case\n when @uri_to_pname.key?(uri)\n return @uri_to_pname[uri]\n when u = @uri_to_prefix.keys.detect {|u| uri.index(u.to_s) == 0}\n # Use a defined prefix\n prefix = @uri_to_prefix[u]\n unless u.to_s.empty?\n prefix(prefix, u) unless u.to_s.empty?\n #log_debug(\"get_pname\") {\"add prefix #{prefix.inspect} => #{u}\"}\n uri.sub(u.to_s, \"#{prefix}:\")\n end\n when @options[:standard_prefixes] && vocab = RDF::Vocabulary.each.to_a.detect {|v| uri.index(v.to_uri.to_s) == 0}\n prefix = vocab.__name__.to_s.split('::').last.downcase\n @uri_to_prefix[vocab.to_uri.to_s] = prefix\n prefix(prefix, vocab.to_uri) # Define for output\n #log_debug {\"get_pname: add standard prefix #{prefix.inspect} => #{vocab.to_uri}\"}\n uri.sub(vocab.to_uri.to_s, \"#{prefix}:\")\n else\n nil\n end\n\n # Make sure pname is a valid pname\n if pname\n md = PNAME_LN.match(pname) || PNAME_NS.match(pname)\n pname = nil unless md.to_s.length == pname.length\n end\n\n @uri_to_pname[uri] = pname\n end",
"def find_prefix(word)\n prefix = ''\n i = 0\n while starts_with(prefix)\n prefix += word[i]\n i += 1\n end\n prefix.slice(0, prefix.length - 1)\n end",
"def match_prefix(prefix)\n consume(self.class.cached_matcher([:prefix, prefix]){/#{prefix}([^\\\\\\/]+)/})\n end",
"def resource_prefix=(value)\n @prefix_parameters = nil\n\n resource_prefix_call = value.gsub(/:\\w+/) { |key| \"\\#{URI::DEFAULT_PARSER.escape options[#{key}].to_s}\" }\n\n silence_warnings do\n # Redefine the new methods.\n instance_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1\n def prefix_source() \"#{value}\" end\n def resource_prefix(options={}) \"#{resource_prefix_call}\" end\n RUBY_EVAL\n end\n rescue => e\n logger&.error(\"Couldn't set prefix: #{e}\\n #{code}\")\n raise\n end",
"def router_uri_prefix\n @router_uri_prefix ||= begin\n u = respond_to?(:uri) ? uri : nil\n u && u.chomp('/')\n end\n end",
"def prefix=(value)\n value += '/' if value != '' and value[-1] != '/'\n @prefix = value\n end",
"def search_prefix(prefix)\n current_node = @root_node\n i = 0\n while i < prefix.length\n node = current_node.children[prefix[i]]\n if node.nil?\n return false\n end\n current_node = node\n i += 1\n end\n # we return true if we have successfully iterated through the prefix\n true\n end",
"def namespace_name\n @namespace_name ||= namespaces.join('::')\n end",
"def bind(namespace)\n # Over-write an empty prefix\n uri = namespace.uri.to_s\n @uri_binding[uri] = namespace unless namespace.prefix.to_s.empty?\n @uri_binding[uri] ||= namespace\n @nsbinding[namespace.prefix.to_s] = namespace\n end",
"def get_node_name(_name, _prefix)\n nil\n end",
"def targetURI\n \"http://www.w3.org/2001/DOM-Test-Suite/tests/Level-1/namednodemapremovenameditem\"\n end",
"def with_prefixes_namespaces_targets_key_for(keys = EMPTY_ARRAY)\n [*prefixes, *namespaces, *targets, *keys].join('_').upcase\n end",
"def with_prefixes_namespaces_targets_key_for(keys = EMPTY_ARRAY)\n [*prefixes, *namespaces, *targets, *keys].join('_').upcase\n end",
"def with_prefixes_namespaces_key_for(keys = EMPTY_ARRAY)\n [*prefixes, *namespaces, *keys].join('_').upcase\n end",
"def with_prefixes_namespaces_key_for(keys = EMPTY_ARRAY)\n [*prefixes, *namespaces, *keys].join('_').upcase\n end",
"def namespace(namespace = nil, options = {})\n return @namespace unless namespace\n\n @namespace = namespace.to_sym if namespace\n @base_namespace = options[:base].to_sym if options[:base]\n end",
"def on_end_element_ns(name, prefix, uri)\n end",
"def to_s\n \"Namespace prefix ‘#{@prefix}’ for QName ‘#{@qname_string}’ is not bound to a URI\"\n end",
"def on_axis_namespace(ast_node, context)\n nodes = XML::NodeSet.new\n name = ast_node.children[1]\n\n context.each do |context_node|\n next unless context_node.respond_to?(:available_namespaces)\n\n context_node.available_namespaces.each do |_, namespace|\n if namespace.name == name or name == '*'\n nodes << namespace\n end\n end\n end\n\n return nodes\n end",
"def ns(owner, address)\n rr('NS', owner, address)\n end",
"def end_element_namespace(name, prefix = T.unsafe(nil), uri = T.unsafe(nil)); end",
"def end_element_namespace(name, prefix = T.unsafe(nil), uri = T.unsafe(nil)); end",
"def delete_namespace!(prefix)\n uri = URI.parse(self.uri + \"/namespaces/\" + URI.escape(prefix))\n http = Net::HTTP.start(uri.host, uri.port)\n http.delete(uri.path)\n raise(SesameException.new(easy.body_str)) unless easy.response_code == 204\n end",
"def with_prefix prefix, mode = :replace\n new_prefix = case mode\n when :replace then prefix\n when :append then \"#{@prefix}#{prefix}\"\n when :prepend then \"#{prefix}#{@prefix}\"\n else\n raise ArgumentError, \"invalid prefix mode `#{mode}`, it must be \" +\n \":replace, :append or :prepend\"\n end\n self.class.new(bucket, :prefix => new_prefix)\n end",
"def namespace=(value)\n self.namespaces = [value]\n end",
"def fetch_namespace(resource)\n uri = Addressable::URI.parse(resource.to_s)\n \n if(uri.fragment != nil)\n return \"#{uri.host}#{uri.path}\"\n elsif(resource.to_s.include?(\"bio2rdf.org\"))\n #template = Addressable::Template.new(\"http://{host}/{first}:{fragment}\")\n #template = template.extract(uri)\n ns = resource.to_s.split(\":\")\n return ns[0..(ns.length-1)].join(\":\")\n #return \"#{template[\"host\"]}#{template[\"first\"]}\"\n end\n end",
"def start_element_namespace(name, attrs_ary = [], prefix = nil, uri = nil, ns = [])\n @text = nil\n node = Node.new(uri, name, attrs_ary.inject({}) { |hsh, a| hsh[a.localname] = a.value; hsh }, '')\n path << node\n\n # call delegate\n delegate.start_element(path, self, node) if delegate.respond_to?(:start_element)\n end",
"def assertNamespace(fullName)\n ns, base = DataMetaDom::splitNameSpace(fullName)\n [DataMetaDom.validNs?(ns, base) ? ns : '', base]\n end",
"def assertNamespace(fullName)\n ns, base = DataMetaDom::splitNameSpace(fullName)\n [DataMetaDom.validNs?(ns, base) ? ns : '', base]\n end",
"def prefix\n regexify(bothify(fetch('aircraft.prefix')))\n end",
"def on_call_namespace_uri(context, expression = nil)\n node = function_node(context, expression)\n\n if node.respond_to?(:namespace) and node.namespace\n return node.namespace.uri\n else\n return ''\n end\n end",
"def namespace=(value)\n @namespace = value\n end"
] |
[
"0.675067",
"0.6494743",
"0.6395798",
"0.61228865",
"0.6001941",
"0.59689844",
"0.58908814",
"0.5786866",
"0.5773298",
"0.5680329",
"0.56723136",
"0.56331795",
"0.55357695",
"0.5507548",
"0.54717785",
"0.54670006",
"0.5460989",
"0.54460114",
"0.53890336",
"0.5384815",
"0.53282416",
"0.53093946",
"0.52513236",
"0.5207107",
"0.51720846",
"0.5158073",
"0.5090996",
"0.50811833",
"0.50164574",
"0.4983855",
"0.4979747",
"0.4967558",
"0.49653387",
"0.49620306",
"0.4913565",
"0.49089316",
"0.49089316",
"0.48976076",
"0.4877323",
"0.48711678",
"0.4866945",
"0.48514745",
"0.4851105",
"0.4836536",
"0.48254552",
"0.481421",
"0.4813134",
"0.48096353",
"0.48096353",
"0.48092753",
"0.4808167",
"0.47968408",
"0.47968408",
"0.47951397",
"0.4786076",
"0.4779208",
"0.47745907",
"0.47723708",
"0.47701776",
"0.47568354",
"0.47543103",
"0.47536504",
"0.47383913",
"0.47335",
"0.4730682",
"0.47212172",
"0.47174978",
"0.4715002",
"0.4712323",
"0.47092617",
"0.47090074",
"0.46942618",
"0.46918598",
"0.46915254",
"0.46879303",
"0.4685141",
"0.46455702",
"0.46434084",
"0.4623007",
"0.46206117",
"0.46206117",
"0.46100146",
"0.46100146",
"0.45992374",
"0.45966026",
"0.45954546",
"0.45914036",
"0.4588458",
"0.4584688",
"0.4584688",
"0.45836237",
"0.45741302",
"0.45676437",
"0.45555368",
"0.45502225",
"0.4544366",
"0.4544366",
"0.45331573",
"0.45316985",
"0.45311868"
] |
0.8329108
|
0
|
Write a method that returns true if its integer argument is palindromic, false otherwise. A palindromic number reads the same forwards and backwards. Examples:
|
def palindromic_number?(n)
n.to_s == n.to_s.reverse
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def palindromic?(number)\n if number.to_s == number.to_s.reverse\n return true\n end\nend",
"def palindromic_number?(int)\r\n int.to_s == int.to_s.reverse\r\nend",
"def palindromic_number?(int)\n int.to_s == int.to_s.reverse\nend",
"def palindromic_number?(integer)\n integer.to_s == integer.to_s.reverse!\nend",
"def palindromic_number?(integer)\n integer.to_s == integer.to_s.reverse\nend",
"def palindromic?(number)\n number.to_s == number.to_s.reverse\nend",
"def palindromic_number?(num)\n num == num.to_s.reverse.to_i\nend",
"def palindromic_number?(num)\n num == num.to_s.reverse.to_i\nend",
"def palindromic_number?(num)\n num.to_s == num.to_s.reverse\nend",
"def palindromic_number?(num)\n num.to_s == num.to_s.reverse\nend",
"def palindromic_number?(num)\n num.to_s == num.to_s.reverse\nend",
"def palindromic_number?(int)\n str = int.to_s\n str == str.reverse\nend",
"def palindromic_number?(integer)\n string = integer.to_s\n string == string.reverse\nend",
"def palindromic_number?(number)\n number.to_s.reverse.to_i\nend",
"def palindromic_number?(integer)\n digits = integer.to_s\n digits == digits.reverse\nend",
"def palindromic_number?(num)\n num.to_s.chars.join(\"\").reverse.to_i == num\nend",
"def palindromic?(number)\n num = number.to_s.split('')\n (1..(num.size/2)).all? do |index|\n num[index-1] == num[index*(-1)]\n end\nend",
"def palindromic_number?(num)\n string = num.to_s\n string == string.reverse\nend",
"def palindromic_number?(num)\n num = num.to_s\n num == num.reverse\nend",
"def palindromic_number?(int)\n new_int = int.to_s\n new_int = new_int.reverse\n new_int = new_int.to_i\n int == new_int\nend",
"def IsPalindromic(value)\r\n @value = value\r\n @n = @value\r\n @rev = 0\r\n \r\n while @value > 0\r\n @digit = @value % 10\r\n \r\n @rev = @rev * 10 + @digit\r\n @value = @value / 10\r\n end\r\n \r\n return (@n == @rev)\r\n end",
"def palindromic_number?(int)\n string_num = int.abs.to_s\n string_num == string_num.reverse\nend",
"def palindromic_number?(int)\n arr = int.to_s\n if arr == arr.reverse\n p true\n else\n p false\n end\n\nend",
"def palindromic_number?(int)\n new_integer = int.to_s.reverse\n new_integer == int.to_s\nend",
"def palindromic_number?(integer)\n int_to_string = integer.to_s\n if integer == int_to_string.to_i\n true\n else\n false\n end\nend",
"def palindromic_number?(num)\n\tstr = num.to_s\n\n\tnum == str.reverse.to_i\nend",
"def palindromic?(input)\n input == input.reverse\nend",
"def palindromic_number?(number)\n palindrome?(number.to_s)\nend",
"def palindromic_number?(num)\n num.to_s \nend",
"def palindromic?(x)\n x.to_s == x.to_s.reverse\nend",
"def palindromic_number?(num)\n palindrome?(num.to_s)\nend",
"def palindromic?(i)\n i.to_s == i.to_s.reverse\nend",
"def palindromic(num) \n if num.to_s.split(\"\") == num.to_s.split(\"\").reverse\n true \n else \n false \n end \nend",
"def palindromic_number?(number)\n index = -1\n rev_array = Array.new(\"#{number}\".length)\n \"#{number}\".chars.each do |char|\n rev_array[index] = char.to_i\n index -= 1\n end\n number == rev_array.join.to_i\nend",
"def is_palindrome? number\n num_string = number.to_s\n counter = num_string.length / 2\n\n palindromic = true\n counter.times {|n| palindromic &&= ( num_string[n] == num_string[-n-1])}\n\n palindromic\nend",
"def palindromic_number?(number, zeros=0)\n number = \"#{'0' * zeros}%o\" % number if zeros > 0\n palindrome?(number.to_s)\nend",
"def palindrom?(string)\n string == string.reverse\nend",
"def palindrome?( num )\n num.to_s == num.to_s.reverse\nend",
"def isPalindromic(val)\n\tln = val.length\n\tmiddle = ln / 2.0\n\tarr = val.split('')\n\t0.upto(middle) do |x|\n\t\tif(arr[x] != arr[ln - x - 1]) then return false end\n\tend\n\treturn true\nend",
"def is_palandrome?(number)\n return number.to_s == number.to_s.reverse\nend",
"def palindrome?(num)\n num.to_s == num.to_s.reverse\nend",
"def is_palindrome?(num)\n characters = num.to_s\n return true if characters == characters.reverse\n false\nend",
"def is_palindrome?(num)\n binary = num.to_s(2)\n num = num.to_s\n\n num.reverse == num && binary == binary.reverse\nend",
"def is_palindrome?(number)\n\tnumber.to_s.reverse == number.to_s\nend",
"def is_palindrome?(num)\n num.to_s == num.to_s.reverse\nend",
"def is_palindrome (n) #Checks to see if the number is a palindrome\n if n == n.reverse\n return true\n end\nend",
"def is_palindrome?(number)\n number.to_s == number.to_s.reverse\nend",
"def is_palindrome?(number) # step 2\n digit_array = number.to_s.split('')\n return true if digit_array.reverse == digit_array\nend",
"def is_palindrome?(n)\n n.to_s == n.to_s.reverse!\nend",
"def palindrome?\n n = self\n\n digit_array = n.to_s.each_char.map(&:to_i)\n digit_array.shift if n < 0\n\n start_index = 0\n end_index = digit_array.length - 1\n\n palindrome = true\n loop do\n break if end_index < start_index\n\n if digit_array[start_index] == digit_array[end_index]\n start_index += 1\n end_index -= 1\n\n break if end_index == start_index\n else\n palindrome = false\n break\n end\n end\n\n return palindrome\n end",
"def palindrome?(n)\n n.to_s == n.to_s.reverse\nend",
"def check_palindromic(variable)\n if variable == variable.reverse\n puts \"#{ variable } is a palindrome.\"\n else\n puts \"#{ variable } is not a palindrome.\"\n end\nend",
"def q10_palindromic?(num)\n q9_palindrome?(num.to_s)\nend",
"def palindrome_integer(num)\n if num > 0 \n str_num = num.to_s\n return true if str_num == str_num.reverse\n end \n false \n \nend",
"def palindrome?(argument)\n argumen.reverse == argument\nend",
"def palindrome?(param)\n param == param.reverse\nend",
"def is_palindrome(number)\n return false if number == nil || number < 0\n i = 0\n placeholder = number\n until placeholder == 0\n placeholder /= 10\n i += 1\n end\n until i <= 0\n i -= 1\n\n if number % 10 != number / 10 ** i\n return false\n end\n\n number -= (number / 10 ** i) * 10 ** i\n number /= 10\n\n i -= 1\n end\n return true\nend",
"def is_palindrome?(n)\n n.to_s == n.to_s.reverse\n end",
"def pallindrome? n\n n.to_s == n.to_s.reverse\nend",
"def is_palindrome(number)\n number.to_s.reverse == number.to_s\nend",
"def palindromic_number?(num)\n # my_list = num.digits\n # array_palindrome?(my_list)\n my_list = num.to_s\n palindrome?(my_list)\nend",
"def is_palindrome(number)\n return true if number.to_s == number.to_s.reverse\n return false\nend",
"def isPalidrome(str)\n str == str.reverse\nend",
"def palin?(n)\n n.to_s == n.to_s.reverse\nend",
"def palindrome?(arg)\n arg == arg.reverse\nend",
"def palindrome?(arg)\n arg == arg.reverse\nend",
"def palindrome?(werd)\n werd == werd.reverse\nend",
"def is_palindrome(number)\n return false if number == nil || number < 0\n i = 10\n while (number % (i)) != number\n i *= 10\n end\n i /= 10\n while i > 10\n if (number / i) == (number % 10)\n number = (number % i) / 10\n i /= 100\n else\n return false\n end\n end\n return true\nend",
"def palindrome?(sequence)\n sequence == sequence.reverse\nend",
"def is_palindrome(n)\n string = n.to_s\n string == string.reverse\nend",
"def palindrome?(input)\n input == input.reverse\nend",
"def palindrome?(input)\n input == input.reverse\nend",
"def palindrome?(input)\n input == input.reverse\nend",
"def palindrome?(input)\n input == input.reverse\nend",
"def is_palindrome(number)\n return false if number == nil || number < 0\n\n num = number\n reverse = 0\n\n while num > 0\n last = num % 10\n reverse = (reverse * 10) + last\n num /= 10\n end\n\n reverse == number ? true : false\n\nend",
"def is_palindrome(number)\n if (number.to_s == number.to_s.reverse)\n return true\n else\n return false\n end\nend",
"def is_palindrome?(num)\n num_string = num.to_s\n num_string == num_string.reverse\nend",
"def is_palindrome?(num)\n\tdigit_array = num.to_s.chars.map(&:to_i)\n\tlength = digit_array.length\n\teach_half = digit_array.each_slice(length/2).map(&:to_a)\n\treturn each_half[0] == each_half[1].reverse\nend",
"def is_palindrome(number)\n return false if !number || number < 0\n length = 1\n until number / (10 ** length) == 0\n length += 1\n end\n (length / 2).times do |i|\n return false if (number / (10 ** (length - i - 1))) % 10 != (number % (10 ** (i + 1))) / (10 ** i)\n end\n return true\nend",
"def is_palindrome(number)\n if number.nil?\n return false\n end\n\n if number < 0\n return false\n end\n\n if number % 10 == 0 && number != 0\n return false\n end\n\n reverted = 0\n while number > reverted\n reverted = reverted * 10 + number % 10\n number /= 10\n end\n\n return number == reverted || number == reverted / 10\nend",
"def palindromic_number?(int)\n int_arr = []\n \nend",
"def Palindrome? (number)\r\n nstr = number.to_s()\r\n nstr == nstr.reverse\r\nend",
"def palindromo?(palavra)\n palavra.downcase == palavra.downcase.reverse\nend",
"def valid_palindrome(str)\n l_ndx = 0\n r_ndx = str.size - 1\n while l_ndx < r_ndx\n unless str[l_ndx] == str[r_ndx]\n return palindromic?(str, l_ndx, r_ndx - 1) || palindromic?(str, l_ndx + 1, r_ndx)\n end\n\n l_ndx += 1\n r_ndx -= 1\n end\n\n true\nend",
"def is_palindrome?(x)\n x.to_s == x.to_s.reverse ? true : false\nend",
"def Palindrome? (number)\r\n nstr = number.to_s()\r\n nstr == nstr.reverse\r\n end",
"def is_palindrome(number)\n return false if number == nil || number < 0\n\n k = 0\n clone_number = number\n\n until clone_number == 0\n clone_number /= 10\n k += 1\n end\n\n return true if k == 1\n\n i = 1\n\n until i > k / 2\n a = number % 10 ** (k + 1 - i) / 10 ** (k - i)\n b = (number / 10 ** (i - 1)) % 10\n return false if a != b\n i += 1\n end\n\n return true\nend",
"def is_palindrome?(num)\r\n\tnum = num.to_s\r\n\t# Go down array, checking each number against its relevant counterpart down the line\r\n\tnum.length.times do |x|\r\n\t\treturn false unless num[x] == num[num.length-1-x]\r\n\tend\r\n\ttrue\r\nend",
"def is_palindrome(number)\n return false if !number\n return false if number < 0\n return true if number < 10\n modulo = 10\n divide = 10\n digets = 2\n until number / divide < 10\n divide *= 10\n digets += 1\n end\n (digets / 2).times do\n return true if number == 0\n return false if number % modulo != number / divide\n first_num = number / divide\n number = (number % (first_num * divide)) / modulo\n divide /= 100\n end\n return true\nend",
"def is_palindrome(number)\n return false if number == nil\n return true if number == 0\n reverse = 0\n while number > 0\n temp = number # can check if temp = reverse\n digit = number % 10\n reverse = reverse * 10 + digit\n number = number / 10\n # number_even = number * 10 + digit\n p \"temp: #{temp}\"\n p \"digit: #{digit}\"\n p \"reverse: #{reverse}\"\n p \"number: #{number}\"\n\n return true if number == reverse || temp == reverse\n # return true if number == reverse\n end\n return false\nend",
"def is_palindrome(number)\n if number == nil || number < 0\n return false\n elsif number == 0\n return true\n end\n\n # Count number of digits in number.\n digit_count = 0\n div_result = 0\n int = number\n until div_result == 0 && digit_count > 0\n digit_count += 1\n div_result = int / 10\n int /= 10\n end\n if digit_count == 1\n return true\n end\n\n # Math to check for palindrome.\n count = 1\n (digit_count / 2).times do\n if number % 10 != number / (10 ** (digit_count - count))\n return false\n else\n number = number / 10\n count += 1\n number = number % (10 ** (digit_count - count))\n count += 1\n end\n end\n return true\nend",
"def is_palindrome(number)\n return false if number.class != Integer || number < 0\n\n # create a varibale to store the result number\n result = 0\n prev_result = 0\n copy_num = number\n\n while copy_num != 0\n current_digit = copy_num % 10\n result = result * 10 + current_digit\n\n # This is to handle overflow\n return false if ((result - current_digit) / 10) != prev_result\n\n prev_result = result\n copy_num = copy_num / 10\n end\n return result == number\nend",
"def palindrome?(number)\n number_array = number.abs.to_s.split(\"\")\n index = number_array.size-1\n (0..number_array.size/2).each do |index|\n if number_array.at(index) != number_array.at(number_array.size-(index+1))\n return false\n end\n end\n return true\nend",
"def palindrome(st1)\n if st1.reverse == st1\n return true\n else\n return false\n end\nend",
"def palinodrome?(string)\n string == my_reverse(string)\nend",
"def is_palindrome(x)\n y = x.to_s.reverse.to_i\n # 將引數轉成字串反轉再轉回數字\n if y === x\n # 如果兩者相等(三個等號判斷連同類別也要一樣)\n true\n else\n # 如果兩者不等於\n false\n end\nend",
"def pallindrome?(s)\n return s == s.reverse\nend",
"def is_palindrome(number)\n # Special cases.\n if number.nil? or number < 0\n return false\n end\n if number == 0\n return true\n end\n # Get number of digits in number.\n num_digits = Math.log10(number).to_i + 1\n if num_digits == 1\n return true\n end\n # Reverse the last half of the number's digits.\n last_half = 0\n (num_digits / 2).to_i.downto(1) do |digit_index|\n digit = number % 10\n last_half += digit * 10**(digit_index - 1)\n number = (number / 10).to_i\n end\n # Ignore middle digit in number with odd num digits.\n if num_digits % 2 == 1\n number = (number / 10).to_i\n end\n return last_half == number\nend",
"def is_palindrome(number)\n puts \"NOT IMPLEMENTED\"\n return true\nend",
"def palindrome?(word)\n word.reverse == word\nend"
] |
[
"0.8824028",
"0.8821626",
"0.8816631",
"0.8810726",
"0.8789885",
"0.87653863",
"0.872211",
"0.872211",
"0.8690405",
"0.8687968",
"0.8687968",
"0.86749405",
"0.86710507",
"0.86615694",
"0.8655318",
"0.8598389",
"0.85953796",
"0.85943776",
"0.8587044",
"0.85838616",
"0.8569998",
"0.8567218",
"0.8561864",
"0.8554047",
"0.8538374",
"0.8537515",
"0.8492218",
"0.84697264",
"0.8462806",
"0.83817846",
"0.83606184",
"0.83494335",
"0.8336479",
"0.8298937",
"0.82617205",
"0.8202663",
"0.8131868",
"0.79487616",
"0.7931108",
"0.7897378",
"0.788072",
"0.7825649",
"0.78227055",
"0.7821124",
"0.78206444",
"0.7804083",
"0.7787267",
"0.77777004",
"0.77723825",
"0.77679724",
"0.776645",
"0.7763275",
"0.77613914",
"0.7760693",
"0.77568847",
"0.7746231",
"0.77404165",
"0.7721357",
"0.7721147",
"0.77105474",
"0.77029765",
"0.7691397",
"0.76812595",
"0.76799124",
"0.76708704",
"0.76708704",
"0.76708025",
"0.76666313",
"0.76644033",
"0.7664011",
"0.76567185",
"0.76567185",
"0.76567185",
"0.76567185",
"0.7655357",
"0.7655005",
"0.7635891",
"0.7628361",
"0.76221657",
"0.7596523",
"0.7579538",
"0.75756544",
"0.7564219",
"0.7557236",
"0.7552779",
"0.75522286",
"0.7552083",
"0.754892",
"0.754004",
"0.75321573",
"0.7496978",
"0.74885696",
"0.7449033",
"0.74432766",
"0.7435929",
"0.7434664",
"0.7432933",
"0.7423112",
"0.74188113",
"0.741704"
] |
0.8804961
|
4
|
Using a private method to encapsulate the permissible parameters is just a good pattern since you'll be able to reuse the same permit list between create and update. Also, you can specialize this method with peruser checking of permissible attributes.
|
def taxon_params
params.permit(:visible)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def permitted_params\n policy(resource || resource_class.new).send(\"permitted_#{action_name}_attributes\")\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 permitted_create_params\n fail NotImplementedError\n end",
"def form_params\n # Remove role and privilege ids as these are managed by the app not by\n # the active record associations\n params[:user].delete :role_ids\n params[:user].delete :privilege_ids\n params.require(:user).permit(user_allowable_params)\n end",
"def permitted_params\n res = attribute_names.map(&:to_sym) - %i[disabled user_id created_at updated_at tracker_id tracker_history_id\n admin_id]\n refine_permitted_params res\n end",
"def strengthen_params!(method_name)\n permitting_model_name = self.class.instance_variable_defined?(:@permitting_model_name) && self.class.instance_variable_get(:@permitting_model_name)\n target_model_name = (permitting_model_name || self.class.name.sub(/.+::/, '').sub(/Controller$/, '')).singularize.underscore.tr('/', '_').to_sym\n permitted_attributes = self.class.instance_variable_defined?(:@permitted_attributes) && self.class.instance_variable_get(:@permitted_attributes)\n\n method_parameters = method(method_name).parameters\n method_parameters.each do |type, key|\n trimmed_key = key.to_s.sub(/_params\\z/, '').to_sym\n if (trimmed_key == target_model_name) && permitted_attributes\n params.require(trimmed_key) if %i[req keyreq].include?(type)\n params[trimmed_key] = params[trimmed_key].try :permit, *permitted_attributes if params.key? trimmed_key\n end\n end\n end",
"def permit(*permitted)\n hardened_params = params.dup\n\n hardened_params.keep_if { |k, _v| permitted.flatten.include?(k.to_sym) }\n\n hardened_params.symbolize_keys\n end",
"def permitted_params\n @implementation_class ||= implementation_class\n\n res = @implementation_class.permitted_params\n @implementation_class.refine_permitted_params res\n end",
"def permitters\n @_parametrizr_permitters || {}\n end",
"def permitted_update_params\n fail NotImplementedError\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 permitted?; end",
"def permitted_params\n if is_singleton?\n singleton_permitted_params\n else\n params.require(:data).permit(allowed_resource_params.to_a)\n end\n end",
"def permit(type,options={})\n raise NameError.new(\"duplicate ability definition\") if @ability.key? type\n ability_object = GraphQL::Authorization::AbilityType.new(type,nil,{})\n if options.key?(:except) && options.key?(:only)\n raise ArgumentError.new(\"you cannot specify white list and black list\")\n end\n if options[:except]\n ability_object.access(type.fields.keys.map(&:to_sym) - options[:except])\n elsif options[:only]\n ability_object.access(options[:only])\n end\n ability_object.execute options[:execute]\n if block_given?\n #note Proc.new creates a proc with the block given to the method\n ability_object.instance_eval(&Proc.new)\n end\n @ability[type] = ability_object\n end",
"def set_permit\n @vehiclepermit = Permit.find(params[:id])\n authorize @vehiclepermit\n end",
"def permit_attributes\n params.require(resource_as_param_key).permit(*permitted_attributes)\n end",
"def set_permit\n @permit = Permit.find(params[:id])\n end",
"def permitted_params\n \t@permitted_params ||= PermittedParams.new(params, current_user)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def request_permitted?(item)\n true\n end",
"def permitted\n {attrib_name => spec.permitted}\n end",
"def set_permit\n @permit = Permit.find(params[:id])\n end",
"def create\n\n vehicle = Vehicle.find_by(license_number: permit_params[:vehicle_attributes][:license_number])\n if current_user.faculty?\n @vehiclepermit = current_user.vehiclepermit.build(permit_params.merge(date_entered: Date.today, \n entered_by: current_user.faculty.first_name + \" \" + current_user.faculty.last_name))\n @vehiclepermit.update(vehicle: vehicle)\n elsif current_user.student?\n @vehiclepermit = current_user.vehiclepermit.build(permit_params.merge(date_entered: Date.today,\n entered_by: current_user.student.first_name + \" \" + current_user.student.last_name))\n @vehiclepermit.update(vehicle: vehicle)\n end\n authorize @permit\n\n respond_to do |format|\n if @vehiclepermit.save\n format.html { redirect_to @vehiclepermit, notice: 'Permit was successfully created.' }\n format.json { render :show, status: :created, location: @vehiclepermit }\n else\n format.html { render :new }\n format.json { render json: @vehiclepermit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def analise_privacidade_params\n #params.require(:analise_privacidade).permit(:rede_social, :url_rede_social, :descricao_analise, tipo_coumunicacoes_attributes: [:id, :tipo_comunicacao, :observacao])\n \n \n params.require(:analise_privacidade).permit!\n \n \n \n \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 user_params\n params.require(:user).permit(policy(@user || User).permitted_attributes)\n end",
"def user_params\n params.require(:user).permit(policy(@user || User).permitted_attributes)\n end",
"def formulary_params\n allow = [:responsable_llenado,:cod01,:cod02,:ape01,:ape04,:ape07,:ape02,:ape05,:ape03,:ape06,:api01,:api04,:api02,:ssb01,:api03,:cao01,:cao04,:cao07,:cao10,:tit01,:cao02,:cao05,:cao08,:cao11,:cao03,:cao06,:cao09,:cao12,:uni01,:uni02,:uni03,:ben01,:ben02,:per01,:per02,:user_id]\n params.require(:formulary).permit(allow)\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 permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end",
"def permitted_params\n\n \n if action_name.to_s == \"update\" && !current_signed_in_resource.is_admin?\n\n \n params.permit({cart_item: [:discount_code,:quantity]},:id)\n\n elsif action_name.to_s == \"create_multiple\"\n params.permit({discount: [:id, {:product_ids => []}]})\n else\n\n params.permit({cart_item: [:product_id,:discount_code,:quantity]},:id)\n\n end\n\n\n end",
"def permitted_params\n @permitted_params ||= PermittedParams.new(params, current_user)\n end",
"def permitted_params(action, kind=nil)\n params.require(model_name).permit!\n end",
"def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindata_default_parameters.each do |k,v|\n params[k] = v unless params.has_key?(k)\n end\n\n # ensure mandatory parameters exist\n bindata_mandatory_parameters.each do |prm|\n if not params.has_key?(prm)\n raise ArgumentError, \"parameter ':#{prm}' must be specified \" +\n \"in #{self}\"\n end\n end\n\n # ensure mutual exclusion\n bindata_mutually_exclusive_parameters.each do |param1, param2|\n if params.has_key?(param1) and params.has_key?(param2)\n raise ArgumentError, \"params #{param1} and #{param2} \" +\n \"are mutually exclusive\"\n end\n end\n end",
"def strong_params\n params.require(:team_member).permit(param_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 grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def form_params\n params.require(:funding_request).permit(FundingRequest.allowable_params)\n end",
"def expected_permitted_parameter_names; end",
"def permission_policy_params\n params.require(:permission_policy).permit(:name, :io1, :io2, :io3, :io4)\n end",
"def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end",
"def access_control_params\n params.require(:access_control).permit(:uuid, :role_id, :ability_to_create_stream, :ability_to_create_discussion, :ability_to_comment, :ability_to_create_question, :ability_to_create_answer, :ability_to_administrate)\n end",
"def params_not_permitted\n logger.warn('exception: params not permitted')\n render plain: \"403 ForbiddEn\", status: 403\n end",
"def borrowership_params\n params\n .require(:borrowership)\n .permit(*policy(@borrowership || Borrowership.new).permitted_attributes)\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 allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); 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 unpermitted_parameters\n fail 'Define me!'\n end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def user_params\n params.require(:user).permit(*policy(@user || User).permitted_attributes)\n end",
"def user_params\n params.require(:user).permit(current_ability.permitted_attributes(:manage, @user))\n end",
"def vip_privilege_params\n params[:vip_privilege].permit!\n 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 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 is_permitted_for?( user )\n ( user.id == self.user.id ) or ( user.privileged? )\n end",
"def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend",
"def user_params\n params.permit(User::UPDATABLE_ATTRIBUTES)\n end",
"def permitted_params_from_policy(object_or_class, key)\n _params = permitted_params[key]\n _attributes = policy(object_or_class).permitted_attributes\n ::ActionController::Parameters.new(_params).permit(*_attributes)\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 users_params\n\t\tparams.require(:user).permit(User::PERMIT_ATTRIBUTES)\n\tend",
"def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end",
"def tam_policy_params\n params.require(:tam_policy).permit(TamPolicy.allowable_params)\n end",
"def permit(*keys)\n select { |key, _| keys.include?(key) }\n end",
"def post_card_params\n params[:post_card].permit!\n end",
"def secure_params(require_param, permit_keys)\n params.require(require_param).permit(*permit_keys)\n end",
"def create_permitted?\n acting_user.administrator?\n end",
"def create_permitted?\n acting_user.administrator?\n end",
"def create_permitted?\n acting_user.administrator?\n end",
"def create_permitted?\n acting_user.administrator?\n end",
"def privilege_params\n params.require(:privilege).permit(:qDrive, :addSong, :editSong, :deleteSong, :grantPermission, :addUser, :editUser, :deleteUser)\n end",
"def permit_params_on_create *keys\n filter_strong_params :permit, [:create], keys\n end",
"def permitted=(_arg0); end",
"def user_params\n allowed_params = [:username, :email, :jabber_id, :jabber_otr_fingerprint, :avatar]\n allowed_params << [:password, :password_confirmation] unless params[:user][:password].blank?\n allowed_params << [:role] if current_user.moderator_or_admin?\n allowed_params << [:tenant_ids => []] if current_user.admin?\n allowed_params << [:user_ids => []] if current_user.moderator_or_admin?\n params.require(:user).permit(allowed_params)\n end",
"def safe_params\n safe_attributes = %i[name key]\n params.require(:role).permit(safe_attributes)\n end",
"def param_whitelist\n [:role, :title]\n end",
"def allow_params_authentication!; end",
"def defect_params\n params.require(:defect).permit(Defect.allowable_params)\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 object_params\n params.require(resource.name.underscore.to_sym)\n .permit(resource_params)\n end",
"def resource_params\n # TODO DANGER!\n params.require(@resource_class.name.underscore.to_sym).permit!\n end",
"def resource_params\n deserialized_params.permit!\n end",
"def sanitize_params\n if valid_lease?\n sanitize_lease_params\n elsif valid_embargo?\n sanitize_embargo_params\n elsif !wants_lease? && !wants_embargo?\n sanitize_unrestricted_params\n else\n @attributes\n end\n end",
"def update_params\n params.require(:permission_template)\n .permit(:release_date, :release_period, :release_varies, :release_embargo,\n :visibility, :workflow_id, :metadata_context_id,\n access_grants_attributes: %i[access agent_id agent_type id])\n end",
"def resource_params\n params.require(resource_name).permit(*permitted_params)\n end",
"def permition_params\n params.require(:permition).permit(:act, :information_system_id, :parameter)\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 resource_params\n permition = @klazz.attribute_names - [:created_at, :updated_at]\n @metadata.items.each do |entity|\n permition << {\"many_#{entity.name}_attributes\".to_sym =>\n [:id] + entity.many_field.map{|field| field.name.to_sym} - [:created_at, :updated_at]}\n end\n params.require(@resource_sym).permit(*permition)\n end",
"def update_permitted?\n\t\tacting_user.administrator?\n\tend",
"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 allowed?\n raise NotImplementedError, 'please implement #allowed? '\\\n \"for #{self.class.name} which should decide if the action is allowed, \"\\\n 'based on the given attributes'\n end",
"def permit?(action)\n case action\n # -- list\n when :list\n permit?(:list_cases)\n\n # -- create\n when :create\n source? && @settings.working_hours?\n when :create_assignment\n agent? || enroller? || governor?\n when :create_note\n agent? || enroller?\n\n # -- edit\n when :edit\n agent? || governor? || enroller?\n when :edit_address\n agent? || source?\n when :edit_contact\n agent? || source?\n when :edit_address_geography\n source?\n when :edit_household\n agent? || governor? || permit?(:edit_household_source)\n when :edit_household_source\n permit?(:edit_household_ownership) || permit?(:edit_household_proof_of_income)\n when :edit_household_size\n agent? || governor?\n when :edit_household_ownership\n (agent? || source?) && requirement?(R::HouseholdOwnership)\n when :edit_household_proof_of_income\n (agent? || source?) && !requirement?(R::HouseholdProofOfIncomeDhs)\n when :edit_household_dhs_number\n (agent? || governor?) && proof_of_income?(P::Dhs)\n when :edit_household_size\n agent? || governor?\n when :edit_household_income\n (agent? || governor?) && proof_of_income?(P::Dhs)\n when :edit_supplier_account\n (agent? || source?) && requirement?(R::SupplierAccountPresent)\n when :edit_supplier\n agent? || (source? && !supplier?)\n when :edit_supplier_account_active_service\n agent? && requirement?(R::SupplierAccountActiveService)\n when :edit_food\n (source? || agent?) && requirement?(R::FoodDietaryRestrictions)\n when :edit_benefit\n agent? || enroller?\n when :edit_benefit_amount\n (agent? || enroller?)\n when :edit_benefit_contract\n (agent?) && requirement?(R::ContractPresent)\n when :edit_documents\n agent?\n when :edit_admin\n agent?\n\n # -- view\n when :view\n agent? || source? || enroller?\n when :view_details\n permit?(:view)\n when :view_details_status\n agent? || enroller?\n when :view_details_enroller\n agent?\n when :view_supplier_account\n permit?(:view) && requirement?(R::SupplierAccountPresent)\n when :view_food\n permit?(:view) && requirement?(R::FoodDietaryRestrictions)\n when :view_household_size\n (agent? || enroller?)\n when :view_household_ownership\n permit?(:view) && requirement?(R::HouseholdOwnership)\n when :view_household_proof_of_income\n (agent? || enroller?) && !requirement?(R::HouseholdProofOfIncomeDhs)\n when :view_household_dhs_number\n (agent? || enroller?) && proof_of_income?(P::Dhs)\n when :view_household_income\n (agent? || enroller?) && proof_of_income?(P::Dhs)\n when :view_supplier_account_active_service\n (agent? || enroller?) && requirement?(R::SupplierAccountActiveService)\n\n # -- actions\n when :convert\n agent?\n when :referral\n agent?\n when :complete\n agent? || enroller?\n\n # -- destroy\n when :destroy\n agent?\n when :destroy_assignment\n agent?\n\n # -- archive\n when :archive\n agent?\n else\n super\n end\n end",
"def ability_params\n params.require(:ability).permit(:child_id, :skill_id, :status)\n end",
"def permitUser\n @member_permitted_name=Member.where(:id=>params[:id]).first.first_name\n Member.update(params[:id], :permitted => 1)\n flash[:notice] = \"User #{@member_permitted_name} allowed to book multiple rooms\"\n redirect_to(:action => 'index' )\n end",
"def setting_attribute_is_allowed?(name, user)\n return false unless user.can_write?(self, name)\n (self.whitelisted_attributes && self.whitelisted_attributes.has_key?( name.to_sym)) ||\n (\n self.attribute_names.include?( name.to_s ) &&\n ( self.blacklisted_attributes.nil? ||\n ! self.blacklisted_attributes.has_key?( name.to_sym ) )\n )\n end",
"def permitted_params\n []\n end",
"def update_sanitized_params\n\t\t\tif \"#{resource_name}\" == \"lecturer\"\n\t\t\t\tdevise_parameter_sanitizer.for(:sign_up) {\n\t\t\t\t\t|lecturer| lecturer.permit(:name, :email,\n\t\t\t\t\t\t:password, :password_confirmation,\n\t\t\t\t\t\t:university, :department)\n\t\t\t\t}\n\t\t\t\tdevise_parameter_sanitizer.for(:account_update) {\n\t\t\t\t\t|lecturer| lecturer.permit(:name, :current_password,\n\t\t\t\t\t\t:password, :password_confirmation,\n\t\t\t\t\t\t:university, :department,\n\t\t\t\t\t\t:profile_image, :profile_image_cache)\n\t\t\t\t}\n\t\t\telsif \"#{resource_name}\" == \"student\"\n\t\t\t\tdevise_parameter_sanitizer.for(:sign_up) {\n\t\t\t\t\t|student| student.permit(:name, :email,\n\t\t\t\t\t\t:password, :password_confirmation,\n\t\t\t\t\t\t:university, :faculty, :major, :semester,\n\t\t\t\t\t\t:advising, :probation)\n\t\t\t\t}\n\t\t\t\tdevise_parameter_sanitizer.for(:account_update) {\n\t\t\t\t\t|student| student.permit(:name, :current_password,\n\t\t\t\t\t\t:password, :password_confirmation,\n\t\t\t\t\t\t:university, :faculty, :major, :semester,\n\t\t\t\t\t\t:advising, :probation, :profile_image,\n\t\t\t\t\t\t:profile_image_cache)\n\t\t\t\t}\n\t\t\telsif \"#{resource_name}\" == \"teaching_assistant\"\n\t\t\t\tdevise_parameter_sanitizer.for(:sign_up) {\n\t\t\t\t\t|teaching_assistant| teaching_assistant.permit(:name,\n\t\t\t\t\t\t:email, :password, :password_confirmation,\n\t\t\t\t\t\t:graduated_from, :graduated_year, :degree,\n\t\t\t\t\t\t:university, :department)\n\t\t\t\t}\n\t\t\t\tdevise_parameter_sanitizer.for(:account_update) {\n\t\t\t\t\t|teaching_assistant| teaching_assistant.permit(:name,\n\t\t\t\t\t\t:current_password, :password, :password_confirmation,\n\t\t\t\t\t\t:graduated_from, :graduated_year, :degree,\n\t\t\t\t\t\t:university, :department, :profile_image,\n\t\t\t\t\t\t:profile_image_cache)\n\t\t\t\t}\n\t\t\tend\n\t\tend",
"def build_permissions(perms, other)\n perms.permits! :read\n perms.permits! :write if self == other\n end"
] |
[
"0.70202553",
"0.70113915",
"0.68419456",
"0.68100685",
"0.6692469",
"0.6688504",
"0.6683111",
"0.66686696",
"0.66341746",
"0.6619179",
"0.66165733",
"0.6604276",
"0.6590041",
"0.65745556",
"0.65722924",
"0.6531341",
"0.6526208",
"0.65222895",
"0.65171784",
"0.65098655",
"0.6470991",
"0.6470808",
"0.64543694",
"0.64296913",
"0.64261764",
"0.64194137",
"0.63879883",
"0.63879883",
"0.63690346",
"0.63601947",
"0.63601947",
"0.63543075",
"0.63509977",
"0.6350015",
"0.6341208",
"0.6334287",
"0.63275754",
"0.631252",
"0.63029444",
"0.6301723",
"0.6297292",
"0.6280793",
"0.62738365",
"0.62700474",
"0.62682134",
"0.6237965",
"0.62340856",
"0.62306404",
"0.62306404",
"0.62264496",
"0.62154895",
"0.621358",
"0.6197648",
"0.61972815",
"0.6195937",
"0.61952883",
"0.6192707",
"0.6179008",
"0.61789894",
"0.61614966",
"0.6152479",
"0.6151477",
"0.6144903",
"0.6138951",
"0.6128798",
"0.6127795",
"0.6126497",
"0.6116443",
"0.6111361",
"0.6107944",
"0.6107944",
"0.6107944",
"0.6107944",
"0.6104416",
"0.6101615",
"0.6087246",
"0.6086868",
"0.60795635",
"0.60733974",
"0.6072614",
"0.60633075",
"0.60630417",
"0.60507447",
"0.604349",
"0.6029013",
"0.6019928",
"0.60135394",
"0.60066456",
"0.59979266",
"0.59826565",
"0.59758586",
"0.5970152",
"0.59682125",
"0.5967452",
"0.5965977",
"0.5964587",
"0.596096",
"0.5957924",
"0.5954951",
"0.59544164",
"0.5951089"
] |
0.0
|
-1
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.