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
Check to see if there is a Sunset header, which contains deprecation date
def sunset_header(headers) return if headers[:sunset].nil? DateTime.parse(headers[:sunset]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_date?\n header.has_date?\n end", "def sunset_header(headers)\n return if headers[:sunset].nil?\n DateTime.parse(headers[:sunset])\n end", "def should_override_api_timestamp?\n (@timestamp_header_value == \"posse\")? true : false\n end", "def has_source_header?\n false\n end", "def has_header?\n @has_header\n end", "def is_http_header? line\n line.split(':').length == 2\n end", "def headers?\n !self.data.strip.each.first.split(column_seperator).any? { |column| Date.parse(column) rescue false }\n end", "def deprecated?\n parsed {\n @status == 'Deprecated'\n }\n end", "def is_header?\n return false unless contains_data?\n return false if spent_finance.present?\n return false if planned_finance.present?\n return false unless only_code_and_name_present?\n true\n end", "def completely_deprecated?\n @deprecated == :completely\n end", "def check_headers(headers)\n # check version from Accept headers; expect custom media type `spoonlibrary`\n accept = headers[:accept]\n accept&.include?(\"application/vnd.spoonlibrary.#{version}+json\")\n end", "def deprecated?\n superseded_by.present?\n end", "def deprecated?\n comment.include?(\"(Deprecated)\")\n end", "def has_date?\n format = self.format.gsub(/(\"[^\"]*\"|#|\\[[\\w.]+\\])/,'')\n \n !(format =~ /[ymdwhq]/).nil?\n end", "def header_line_rate?\n !additional_headers.nil? && additional_headers.include?(:line)\n end", "def is_header()\n\t\tend", "def header?(key)\n return true if @args[:headers].key?(key) && @args[:headers][key].first.to_s.length > 0\n false\n end", "def validateable?\n headers.key?('Last-Modified') || headers.key?('ETag')\n end", "def check_header\n !request.env[\"HTTP_X_ACCESS_TOKEN\"].nil?\n end", "def unrecognized_headers\n extra_headers = @transformed_headers - valid_headers\n extra_headers.each do |header|\n @warnings << \"The field name \\\"#{header}\\\" is not supported. This field will be ignored, and the metadata for this field will not be imported.\"\n end\n end", "def header?(key)\n return true if headers.key?(key) && !headers[key].first.to_s.empty?\n\n false\n end", "def change_deprecation_iff_user_requested\n return nil unless @name.deprecated != (params[:name][:deprecated] == \"true\")\n\n !@name.deprecated\n end", "def headers?\n @headers.empty?\n end", "def legacy?\n date < Date.new(2014, 06, 06)\n end", "def have_transmission_header?\n @have_transmission_header\n end", "def format_severity diagnostic\n diagnostic.severity == :deprecation ? \"Deprecation notice: \" : \"\"\n end", "def sunset(datetime:, link: nil)\n header 'Sunset', datetime.httpdate\n header 'Link', format('<%{link}>; rel=\"sunset\";', link:) if link.present?\n ActiveSupport::Deprecation.warn(\"deprecated endpoint #{namespace} (sunset date #{datetime.iso8601}) has been called by #{request.headers['User-Agent']}\")\n end", "def autoupdate?\n update_header = headers[:update]\n update_header && update_header.strip == \"now\"\n end", "def has_mime_version?\n header.has_mime_version?\n end", "def unrecognized_headers\n extra_headers = headers - valid_headers\n extra_headers.each do |header|\n @warnings << \"The field name \\\"#{header}\\\" is not supported. This field will be ignored, and the metadata for this field will not be imported.\"\n end\n end", "def http_header?(name)\n name.start_with?(\"HTTP\") && !HTTP_NON_HEADERS.include?(name)\n end", "def release_fixed_date?\n release_period == RELEASE_TEXT_VALUE_FIXED\n end", "def headercheck(raw)\n decode(raw)[0...Payload::HEADER.length] == Payload::HEADER\n end", "def expected_header\n raise\n end", "def check_headers(v)\n return true unless v\n return true if v.size == 0\n if HEADER_REGEXP !~ v\n raise InvalidComponentError,\n \"bad component(expected opaque component): #{v}\"\n end\n\n true\n end", "def header?\n @header\n end", "def header?\n @header\n end", "def header?(key)\n key.is_a?(Numeric) || @headers.nil? || @headers.include?(key)\n end", "def check_module_deprecated(module_name)\n module_name = module_name.sub('/', '-')\n module_data = get_module_data(module_name)\n version = get_current_version(module_name)\n version.to_s.eql?('999.999.999') || version.to_s.eql?('99.99.99') || !module_data.attribute('deprecated_at').nil?\n end", "def token_expired?\r\n begin\r\n conditions_element = REXML::XPath.first(document,\"/p:Response/a:Assertion/a:Conditions\", { \"p\" => PROTOCOL, \"a\" => ASSERTION })\r\n raise SA1012Exception if conditions_element.nil?\r\n raise SA1003Exception if conditions_element.attribute('NotBefore') and Time.now.utc < Time.parse(conditions_element.attribute('NotBefore').value)\r\n raise SA1004Exception if conditions_element.attribute('NotOnOrAfter') and Time.now.utc >= Time.parse(conditions_element.attribute('NotOnOrAfter').value)\r\n rescue RuntimeError => exp\r\n Rails.logger.error \"#{exp.class} - #{exp.message}\"\r\n return true\r\n else\r\n return false\r\n end\r\n end", "def returns_cleared_scroll_id_info?\n $client.version_support.es_version_5_x?\nend", "def deprecated?\n false\n end", "def isDataUpToDate?\n DailyNews.first.updated_at.to_s.slice(5..6).eql? Time.now.to_s.slice(8..9)\n end", "def check_null_headers\n\t\t\t@headers_name.each do |p|\n\t\t\t\tunless @headers[p].present? && !@headers[p].nil? && !@headers[p].empty?\n\t\t\t\t\traise Exceptions::WrongHeaderError.new(p)\n\t\t\t\tend\n\t\t\tend\n\t\t\ttrue\n\t\tend", "def legacy?\n concierge_version.to_s.empty?\n end", "def is_outdated?\n bit_set?(OUTDATED_FLAG_BIT)\n end", "def outdated?\n prefix == '+'\n end", "def has_date?\n !fields.select { |f| f.responsible_for?('Date') }.empty?\n end", "def filtered_query_removed?\n $client.version_support.es_version_5_x?\nend", "def test_no_missing_headers\n headers = [\"File Name\", \"Format\", \"MIME\"]\n result = @validator.list_missing_headers(headers, @header_map)\n assert result.success?\n end", "def valid_headers?(row)\n (required_csv_headers - row.keys).empty?\n end", "def have_transmission_header?\n self.class.have_transmission_header?\n end", "def validate_header!\n [:date, :from].each do |field|\n raise \"No '#{field}' header field provided\" unless self.send(field)\n end\n end", "def report\n deprecations = @messages.select { |m| m[:kind] == :deprecation }\n\n if deprecations.any?\n puts\n puts \"Deprecations:\"\n puts\n\n messages = deprecations.map { |m| m[:message] }\n puts messages.join(\"\\n---\\n\\n\")\n puts\n end\n\n # code blocks in chef report callbacks are expected to yield true\n true\n end", "def dirty?\n return !self.headers.first(:name => :dirty).nil?\n end", "def header?\n @properties.key?(:header) && !@properties[:header].empty?\n end", "def scrub_headers(headers)\n headers.select {|h| UserMailer.legal_headers.include? h}\n end", "def _deprecation\n @link['deprecation']\n end", "def obsolete?\n !@obsolete.nil?\n end", "def obsolete?\n @obsolete ? true : false\n end", "def stale?\n return true if expired?\n if header['Cache-Control']\n return true if header['Cache-Control'].include?('must-revalidate')\n return true if header['Cache-Control'].include?('no-cache')\n end\n\n false\n end", "def release_before_date?\n # All PermissionTemplate embargoes are dynamically determined release before dates\n release_period == RELEASE_TEXT_VALUE_BEFORE_DATE || release_max_embargo?\n end", "def includes?(date)\n false\n end", "def header?\r\n\t\ttrue\r\n\tend", "def header?\r\n\t\ttrue\r\n\tend", "def sunset?\n return $game_switches[::Yuki::Sw::TJN_SunsetTime]\n end", "def has_mime_version?\n !fields.select { |f| f.responsible_for?('Mime-Version') }.empty?\n end", "def outdated?\n if dependency.specific?\n ( latest_stable_version <=> dependency.to_version ) == OUTDATED_FLAG\n end\n end", "def deleted?\n return @header.deleted?\n end", "def vulnerable?(dates=@@OPEN_DATES)\n cves(dates).any?\n end", "def valid_bugsnag_integrity_header(request)\n header = request[:request]['Bugsnag-Integrity']\n return !Maze.config.enforce_bugsnag_integrity if header.nil?\n\n digests = request[:digests]\n if header.start_with?('sha1')\n computed_digest = \"sha1 #{digests[:sha1]}\"\n elsif header.start_with?('simple')\n computed_digest = \"simple #{digests[:simple]}\"\n else\n return false\n end\n header == computed_digest\n end", "def is_header?(); @type == GRT_HEADER; end", "def expect_logged_deprecation(message)\n expect(LoggingHelper.messages).to include(kind: :deprecation, message: message)\n end", "def check_fixed_date_requirements(date)\n return true unless release_fixed_date? && release_date.present?\n date == release_date\n end", "def is_not_ordered()\n if (placed_date)\n return false\n else\n return true\n end\n end", "def check_no_delay_requirements(date)\n return true unless release_no_delay?\n date == Time.zone.today\n end", "def has_yaml_header?(file); end", "def unpublished?\n @is_unpublished ||= begin\n raise NotFetchedError unless fetched?\n !!(@data =~ /<h2>Cache is Unpublished<\\/h2>/)\n end\n end", "def skip_header_lines?\n \"t\" == @options[\"skip\"]\n end", "def has_warnings?\n @has_warnings ||= false\n end", "def unspsc?\n data = unspsc_title?()\n if (data == 'API call failed')\n return 'API call failed'\n elsif (data == 'No results found')\n return false\n end\n return true\n end", "def contains_valid_headers(value)\n split_value = value.split(/\\n/)\n if split_value.size == 0 || split_value[4].nil?\n return false\n else\n if(split_value[0].index('/*').nil? || split_value[4].index('*/').nil?)\n return false\n else\n start_index = value.index('/*')\n return false if start_index.nil?\n end_index = value.index('*/', start_index+2)\n return false if end_index.nil?\n value = value[start_index+2..end_index-1]\n\n type_i = value.index('Type:')\n layer_i = value.index('Layer:')\n variation_i = value.index('Variation:')\n return false if type_i.nil? || layer_i.nil? || variation_i.nil?\n # sets the type, layer, variation as an array\n headers = [value[type_i+5..layer_i-1], value[layer_i+6..variation_i-1], value[variation_i+10..value.size]]\n # return it with each value stripped of nextline characters and extra white space\n return headers.collect { |c| c.gsub(/\\n|\\t/, '').strip }\n end\n end\n end", "def response_headers_parseable\n response_headers_hash\n rescue HeaderParseError => error\n errors.add :response_headers, \" could not be parsed: #{error.message}\"\n end", "def check_for_invalid_deprecations\n schema[:internals].each do |param_key,param_schema|\n deprecated_by = param_schema[:deprecated_by]\n if deprecated_by && !schema[:internals].key?(deprecated_by.to_sym)\n raise \"#{param_key}: deprecated_by target '#{deprecated_by}' not found in schema\"\n end\n end\n end", "def legacy_request?\n AedLegacy.legacy_year?(params[:year])\n end", "def valid?\n return false if @headers.nil?\n return false if published_at.nil? or published_at > Time.now.getlocal\n return false if tags.nil? or tags.empty?\n true\n end", "def warnings?\n !gem?(\"shelly-dependencies\")\n end", "def header?(header)\n data.key?(header)\n end", "def recent_api_version?\n Time.parse(api_version).utc >= Time.parse('2016-01-01').utc\n end", "def has_version?\n return (@name != @metaname)\n end", "def is_header?(fields)\n # parsing should ignore...\n # lines that are completely blank\n # lines that appear to be entirely delimiters\n\n return true if fields.empty?\n\n line = fields.join\n\n # these are probably horizontal markers between any header text and the actual data\n return true if line =~ /^[-=*_\\s]*$/\n\n return true unless line =~ /\\d/\n\n return true if line =~ /^\\s*[A-Za-z ]+$/\n\n # this line looks significant, keep it in.\n false\n end", "def old_post?\n post? && Time.utc(*filename_date_string.split(\"/\")) < Time.utc(2013, 4, 1)\n end", "def strip_storehouse_headers(response)\n response[1].except!('X-Storehouse-Distribute', 'X-Storehouse', 'X-Storehouse-Expires-At')\n response\n end", "def verify_header\n # normal header like sample ==> Authorization 'ddd$$%gggrghHFDSS.HHJHTTGGR'\n if headers['Authorization'].present?\n headers['Authorization'].split(' ').last\n else\n errors.add(:token, 'Missing Token')\n nil\n end\n end", "def old?(line)\n today = Date.today()\n return (today.year > line.year) && (today.month >= line.month) || ((today.year - line.year) > 1)\n end", "def should_report? issue\n diagnose = self[issue]\n diagnose == :error || diagnose == :warning || diagnose == :deprecation\n end", "def expected_headers_unmet\n unmet = []\n expected = test_case.expected_headers\n expected.each_pair do |k,v|\n got = response.headers[k]\n unmet << \"[headers] #{v} expected for #{k}, got #{got}\" unless (got == v)\n end\n unmet.empty? ? nil : unmet.join(\"\\n\")\n end", "def skip?(env)\n !env.key?(header_group)\n end", "def disable_min_words_essay?\n !!org_details[:disable_min_words_essay]\n end" ]
[ "0.63464975", "0.61777836", "0.6064769", "0.57246095", "0.57124686", "0.5685866", "0.56770307", "0.56172967", "0.55493355", "0.5542464", "0.55098325", "0.5491204", "0.54625815", "0.54618466", "0.54544634", "0.54203326", "0.53898174", "0.5382764", "0.5366776", "0.5359634", "0.5346588", "0.5342719", "0.5329941", "0.53275293", "0.53237945", "0.5286313", "0.5254446", "0.5243476", "0.5241302", "0.52407414", "0.52039933", "0.5188898", "0.51842815", "0.5173893", "0.5164058", "0.5126687", "0.5126687", "0.51264524", "0.5117184", "0.51154786", "0.51141655", "0.5112725", "0.50875443", "0.5082531", "0.50801593", "0.5053947", "0.50360435", "0.5029761", "0.50241965", "0.50234354", "0.50162506", "0.5013434", "0.50100315", "0.49991322", "0.49953702", "0.4994819", "0.49930492", "0.49864143", "0.498463", "0.49836302", "0.4982229", "0.49764496", "0.49615836", "0.49509278", "0.49509278", "0.49445373", "0.49425328", "0.4935384", "0.49327472", "0.4928407", "0.4926022", "0.49119797", "0.49013445", "0.4899714", "0.4878315", "0.48616445", "0.48615903", "0.4860355", "0.48572126", "0.4847349", "0.48455107", "0.4842369", "0.48384643", "0.48361766", "0.483617", "0.4832364", "0.48309374", "0.4822927", "0.4822709", "0.48135597", "0.48060587", "0.48047283", "0.480298", "0.48028004", "0.480093", "0.47965017", "0.47941878", "0.4786341", "0.47846282" ]
0.6098532
3
GET /events GET /events.json
def index if(params[:conf_id]) @events = Event.where(conference_id: params[:conf_id]).by_position @conference = Conference.find(params[:conf_id]) else @events = Event.all.by_position end @speaker_event_type = EventType.where(speaker_event: true) @non_speaker_event_type = EventType.where(speaker_event: false) @speaker_events = @events.where(event_type: @speaker_event_type) @non_speaker_events = @events.where(event_type: @non_speaker_event_type) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def events\n response = self.class.get('/v1/events.json')\n response.code == 200 ? JSON.parse(response.body) : nil\n end", "def get_events\n Resources::Event.parse(request(:get, \"Events\"))\n end", "def get_events()\n @client.make_request(:get, @client.concat_user_path(\"#{CALL_PATH}/#{id}/events\"))[0]\n end", "def index\n #returns all events from eventbrite API, need to change to pull from her endpoint\n @eventList = Event.retrieve_all_events params\n render json: @eventList, status: 200\n end", "def get_events\n response = request(:get, \"/devmgr/v2/events\")\n #status(response, 200, 'Failed to get current events from server')\n #JSON.parse(response.body)\n response\n end", "def index\n @events = Event.all\n render json: @events, status: 200\n end", "def index\n @events = Event.all\n render json: @events\n end", "def index\n @events = current_user.events\n\n render json: @events\n end", "def index\n @events = Event.find(:all)\n respond_to do |format|\n format.html\n format.json\n end\n end", "def index\n @events = Event.all\n\n render json: @events\n end", "def index\n @event = Event.all\n render json: @event\n end", "def index\n @events = Event.live\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.live\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n respond_to do |format|\n format.html\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n respond_to do |format|\n format.html \n format.json do\n render :json => {events: @events}\n end\n end\n end", "def index\n response = { events: Event.all }\n respond_to do |format|\n format.json { render json: response.to_json }\n format.html { render :index }\n end\n end", "def get_events\n if @user.uuid.present?\n @events = @user.events.active_events.page(params[:page])\n paginate json: @events, per_page: params[:per_page]\n elsif @user.uuid == \"guest\"\n @events = Com::Nbos::Events::Event.active_events.where(tenant_id: @user.tenant_id)\n render json: @events\n else\n render :json => {messageCode: \"bad.request\", message: \"Bad Request\"}, status: 400\n end\n end", "def index\n\t\t@events = Event.all.order('created_at desc')\n\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render :json => @events }\n\t\tend\n\tend", "def index\n @events = Event.all\n respond_to do |format|\n format.html \n format.json \n end\n end", "def get_events(args)\n\tapi_url = \"#{@base_url}/#{args[:collection]}/#{args[:key]}/events/#{args[:event_type]}\"\n\tdo_the_get_call( url: api_url, user: @user )\nend", "def events(project_id, options = {})\n get \"projects/#{project_id}/events\", options\n end", "def index\n @events = current_user.events\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def show\n @event = Event.find(params[:id])\n render json: @event\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n \n @events = current_user.events\n \n \n respond_to do |format|\n format.html {}\n format.json { render json: Event.events_to_json(@events) }\n end\n end", "def events\n data[\"events\"]\n end", "def events\n url = 'https://api.artic.edu/api/v1/exhibitions?limit=35'\n\n res = RestClient.get(url)\n JSON.parse(res)\nend", "def index\n @events = @calendar.events.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @events }\n end\n end", "def index\n @events = @category.events\n render json: @events \n end", "def index\n\t\t@events = current_user.events\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @events }\n\t\tend\n\tend", "def show\n render json: @event\n end", "def show\n render json: @event\n end", "def show\n render json: @event\n end", "def show\n render json: @event\n end", "def show\n render json: @event\n end", "def index\n event = Event.find(params[:event_id])\n render json: event.route, status: :ok\n end", "def index\n render json: Event.all, status: :ok\n end", "def show\n render json: @event, status: :ok\n end", "def index\n @upcoming_events = Event.upcoming\n @past_events = Event.past\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n respond_with(@events)\n end", "def get_event(session, options={})\n json_request \"get\", {:session => session}, options\n end", "def index\n @events = getUpcomingEvents()\n \n @page_title = \"Events\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def get(event_id)\n @client.request \"events/#{event_id}\"\n end", "def index\n\t\t@events = Event.page(params[:page]).per(10)\n\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json {\n\t\t\t\trender :json => @events.to_json\n\t\t\t}\n\t\tend\n\n\tend", "def show\n event_id = params[:id]\n if event_id.present?\n @event = Com::Nbos::Events::Event.active_events.where(id: event_id, tenant_id: @user.tenant_id)\n if @event.present?\n render :json => @event\n else\n render :json => {messageCode: \"event.notfound\", message: \"Event Not Found\"}, status: 404\n end\n else\n render :json => {messageCode: \"bad.request\", message: \"Bad Request\"}, status: 400\n end\n end", "def events\n collection(\"events\")\n end", "def event(event, options = {})\n get \"events/#{event}\", options\n end", "def past_events\n @events = Event.past\n render json: @events, include: :talks\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def get_event_list ( year )\n get_api_resource \"#{@@api_base_url}events/#{year}\"\n end", "def index\n begin\n events = Event.all\n render :json => {events: ActiveModel::ArraySerializer.new(events, each_serializer: EventsSerializer), :code => 200}, status: :ok\n rescue Exception => e\n logger.error {\"Error while populating list of events. ErrorMessage: #{e.message}, Params: #{params.inspect}\"}\n render json: {error: e.message, code: 500}\n end\n end", "def show\n \trender json: @event\n end", "def show\n @events = fetch_events\n end", "def show\n render json: EventSerializer.new(@event).as_json, status: 200\n end", "def list\n @events = Event.coming_events\n respond_to do |format|\n format.html do\n render layout: 'events'\n end\n format.json do \n events = @events.map {|event| {event: event, users: event.users, applied: event.users.include?(current_user) }}\n render json: events \n end\n end\n end", "def index\n if params[:query].present?\n @events = GroupEvent.send(params[:query])\n else\n @events = GroupEvent.published\n end\n\n render json: @events\n end", "def fullcalendar_events_json\n events.map do |event|\n {\n id: event.id.to_s,\n title: event.name,\n start: event.starts_at.strftime('%Y-%m-%d %H:%M:%S'),\n end: event.ends_at.strftime('%Y-%m-%d %H:%M:%S'),\n allDay: event.all_day,\n url: event_path(event)\n }\n end\n end", "def show\n @event = Event.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event_event = Event::Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event_event }\n end\n end", "def index\n if params[:user]\n @events = Event.where(user: params[:user]).first\n else\n @events = Event.all.order('created_at asc')\n end\n\n render json: @events, :only => [:id, :date, :user, :event_type, :message, :otheruser]\n end", "def show\n @event = Event.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def details\n get(\"v1/event/#{@id}\")\n end", "def show\n @event = Event.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event } \n end\n end", "def show\n render json: format_event(@event)\n end", "def index\n @events = Event.all\n @event = Event.new\n\n respond_to do |format|\n format.html\n format.json { render 'events/index', events: @events }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end" ]
[ "0.8337294", "0.82393", "0.7943906", "0.7928331", "0.77682066", "0.77408546", "0.76701826", "0.7665501", "0.76581633", "0.7642472", "0.76212007", "0.7615658", "0.7615658", "0.7612881", "0.75687", "0.7522498", "0.7488667", "0.74813455", "0.74698067", "0.7441679", "0.74408287", "0.7439104", "0.7438", "0.7410777", "0.74091715", "0.74091715", "0.74091715", "0.74091715", "0.74091715", "0.74091715", "0.74091715", "0.74091715", "0.74091715", "0.74091715", "0.74001324", "0.73986024", "0.73760885", "0.7367902", "0.7366312", "0.7364237", "0.7363436", "0.73616976", "0.73616976", "0.73616976", "0.73616976", "0.73616976", "0.73592705", "0.7352217", "0.7334486", "0.73247266", "0.7320335", "0.72969604", "0.72951084", "0.7288287", "0.7282072", "0.72735256", "0.72733235", "0.72477293", "0.7245006", "0.7228475", "0.7228475", "0.72234964", "0.72129667", "0.72124153", "0.7182632", "0.71820146", "0.71711934", "0.71332264", "0.712864", "0.7123786", "0.7122708", "0.7114666", "0.7110134", "0.7110134", "0.7104194", "0.71022034", "0.7101582", "0.7101437", "0.7099895", "0.70996326", "0.70996326", "0.70996326", "0.70996326", "0.70996326", "0.70996326", "0.70996326", "0.70996326", "0.70996326", "0.70996326", "0.70996326", "0.70996326", "0.70996326", "0.70996326", "0.70996326", "0.70996326", "0.70996326", "0.70996326", "0.70996326", "0.70996326", "0.70996326", "0.70996326" ]
0.0
-1
GET /events/1 GET /events/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @event = Event.find(params[:id])\n render json: @event\n end", "def get(event_id)\n @client.request \"events/#{event_id}\"\n end", "def show\n event_id = params[:id]\n if event_id.present?\n @event = Com::Nbos::Events::Event.active_events.where(id: event_id, tenant_id: @user.tenant_id)\n if @event.present?\n render :json => @event\n else\n render :json => {messageCode: \"event.notfound\", message: \"Event Not Found\"}, status: 404\n end\n else\n render :json => {messageCode: \"bad.request\", message: \"Bad Request\"}, status: 400\n end\n end", "def get_events()\n @client.make_request(:get, @client.concat_user_path(\"#{CALL_PATH}/#{id}/events\"))[0]\n end", "def events\n response = self.class.get('/v1/events.json')\n response.code == 200 ? JSON.parse(response.body) : nil\n end", "def index\n #returns all events from eventbrite API, need to change to pull from her endpoint\n @eventList = Event.retrieve_all_events params\n render json: @eventList, status: 200\n end", "def index\n @events = Event.all\n render json: @events, status: 200\n end", "def index\n @event = Event.all\n render json: @event\n end", "def index\n @events = Event.find(:all)\n respond_to do |format|\n format.html\n format.json\n end\n end", "def index\n respond_to do |format|\n format.html\n format.json { render json: @events }\n end\n end", "def get_events\n Resources::Event.parse(request(:get, \"Events\"))\n end", "def show\n @event = Event.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def index\n @events = Event.live\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.live\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def details\n get(\"v1/event/#{@id}\")\n end", "def index\n @events = Event.all\n render json: @events\n end", "def show\n\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @myevent = Myevent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @myevent }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event_event = Event::Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event_event }\n end\n end", "def index\n event = Event.find(params[:event_id])\n render json: event.route, status: :ok\n end", "def index\n @events = Event.all\n\n render json: @events\n end", "def show\n render json: @event, status: :ok\n end", "def index\n @events = Event.all\n respond_to do |format|\n format.html \n format.json do\n render :json => {events: @events}\n end\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.json { render json: @events }\n end\n end", "def show\n @event = Event.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event } \n end\n end", "def show\n @event = Event.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @event }\n end\n end", "def show\n render json: @event\n end", "def show\n render json: @event\n end", "def show\n render json: @event\n end", "def show\n render json: @event\n end", "def show\n render json: @event\n end", "def index\n @events = Event.all\n respond_to do |format|\n format.html \n format.json \n end\n end", "def show\n render json: EventSerializer.new(@event).as_json, status: 200\n end", "def event(event, options = {})\n get \"events/#{event}\", options\n end", "def index\n response = { events: Event.all }\n respond_to do |format|\n format.json { render json: response.to_json }\n format.html { render :index }\n end\n end", "def index\n render json: Event.all, status: :ok\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def index\n @events = current_user.events\n\n render json: @events\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def event(id, options = {})\n get \"events/#{id}\", options\n end", "def index\n @events = Event.all\n @event = Event.new\n\n respond_to do |format|\n format.html\n format.json { render 'events/index', events: @events }\n end\n end", "def show\n @event = Event.find(params[:id])\n @client = Client.find(@event.client_id)\n @event_type = EventType.find(@event.event_type_id)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @events }\n end\n end", "def get_event ( event_key )\n get_api_resource \"#{@@api_base_url}event/#{event_key}\"\n end", "def get_events(args)\n\tapi_url = \"#{@base_url}/#{args[:collection]}/#{args[:key]}/events/#{args[:event_type]}\"\n\tdo_the_get_call( url: api_url, user: @user )\nend", "def index\n @event = Event.find(params[:event_id])\n\n end", "def index\n @upcoming_events = Event.upcoming\n @past_events = Event.past\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def show\n \trender json: @event\n end", "def index\n @events = current_user.events\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = getUpcomingEvents()\n \n @page_title = \"Events\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n respond_with(@events)\n end", "def show\n render json: format_event(@event)\n end", "def show\n @current_event = CurrentEvent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @current_event }\n end\n end", "def get_events\n if @user.uuid.present?\n @events = @user.events.active_events.page(params[:page])\n paginate json: @events, per_page: params[:per_page]\n elsif @user.uuid == \"guest\"\n @events = Com::Nbos::Events::Event.active_events.where(tenant_id: @user.tenant_id)\n render json: @events\n else\n render :json => {messageCode: \"bad.request\", message: \"Bad Request\"}, status: 400\n end\n end", "def show\n begin\n @event = Event.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n logger.error \"Attempt to show invalid event #{params[:id]}\"\n redirect_to events_path, notice: 'Invalid event ID'\n else\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end\n end", "def index\n @events = @category.events\n render json: @events \n end", "def index\n\t\t@events = Event.all.order('created_at desc')\n\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render :json => @events }\n\t\tend\n\tend", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @event, methods: [:talks] }\n end\n end", "def get_events\n response = request(:get, \"/devmgr/v2/events\")\n #status(response, 200, 'Failed to get current events from server')\n #JSON.parse(response.body)\n response\n end", "def index\n if params[:user]\n @events = Event.where(user: params[:user]).first\n else\n @events = Event.all.order('created_at asc')\n end\n\n render json: @events, :only => [:id, :date, :user, :event_type, :message, :otheruser]\n end", "def get_event(session, options={})\n json_request \"get\", {:session => session}, options\n end", "def index\n \n @events = current_user.events\n \n \n respond_to do |format|\n format.html {}\n format.json { render json: Event.events_to_json(@events) }\n end\n end", "def show\n @calendar = Calendar.find(params[:id])\n @events = Event.find(@calendar.event_ids)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @calendar }\n end\n end" ]
[ "0.75029767", "0.74019474", "0.7361382", "0.7348975", "0.73475033", "0.7338018", "0.7317425", "0.72875094", "0.72813755", "0.7246173", "0.72317284", "0.7219172", "0.7219172", "0.7218839", "0.7218839", "0.721464", "0.7204848", "0.71989256", "0.7196662", "0.71925515", "0.7192214", "0.7192214", "0.7192214", "0.7192214", "0.7192214", "0.7192214", "0.7192214", "0.7192214", "0.7192214", "0.7192214", "0.7192214", "0.7192214", "0.7192214", "0.7192214", "0.7192214", "0.7192214", "0.7192214", "0.7192214", "0.7192214", "0.7192214", "0.7192214", "0.7192214", "0.7192214", "0.7192214", "0.7190171", "0.7189989", "0.71858066", "0.71843475", "0.71817815", "0.7178166", "0.716525", "0.71637964", "0.7158998", "0.71580267", "0.7120116", "0.7120116", "0.7120116", "0.7120116", "0.7120116", "0.7104676", "0.7098543", "0.70866513", "0.7075021", "0.7071629", "0.70692325", "0.70692325", "0.7067004", "0.70606047", "0.70606047", "0.70606047", "0.70606047", "0.70606047", "0.70606047", "0.70606047", "0.70606047", "0.70606047", "0.70606047", "0.7050251", "0.7043129", "0.70385677", "0.70330113", "0.7027942", "0.7025206", "0.70196456", "0.6993209", "0.69843143", "0.69733816", "0.69682246", "0.69497913", "0.6949218", "0.6943893", "0.6929541", "0.69259447", "0.6922537", "0.69194067", "0.6912311", "0.6893206", "0.689077", "0.687633", "0.6853893", "0.6851784" ]
0.0
-1
POST /events POST /events.json
def create @event = Event.new(event_params) @conference = Conference.find(event_params[:conference_id]) respond_to do |format| if @event.save format.html { redirect_to controller: 'admin/events', action: 'index', conf_id: @conference.id } format.json { render :show, status: :created, location: @event } else @event_type = @event.event_type @speaker_event = @event_type.speaker_event format.html { render :new } format.json { render json: @event.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_event event, data={}\n data[:event] = event\n post '/event', data\n end", "def create\n event = Event.new(event_params)\n event.save!\n render json: event\n end", "def create\n Rails.logger.debug(\"Received event #{params[:event]}\")\n head :ok\n end", "def create\n @event = Event.new(params[:event])\n\n if @event.save\n render json: @event, status: :created, location: @event\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def create\n megam_rest.post_event(to_hash)\n end", "def create\n @event = Event.new(event_params)\n\n if @event.save\n \tdata = { data: @event, status: :created, message: \"Event was successfully created.\" }\n render :json => data\n else\n \tdata = { data: @event.errors, status: :unprocessable_entity }\n render :json => data\n end\n end", "def create\n @event = Event.new(event_params)\n if @event.save\n head :created\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def create\n puts params[:event]\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to events_path, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, :notice => 'Event was successfully created.' }\n format.json { render :json => @event, :status => :created, :location => @event }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.json { render :show, status: :created, location: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.json { render :show, status: :created, location: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.find_by_authentication_token(params[:auth_token])\n @event = Event.new.from_json(params[:event])\n @event.user_id = @user.id\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n @event.organizer = current_user\n\n if @event.save\n render json: @event, status: :created, location: @event\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def save\n event = params\n # This assumes that all keys exists. Yay no error handling...\n toSave = Event.new(update_type: event[:event],\n start_time: event[:payload][:event][:start_time_pretty],\n end_time: event[:payload][:event][:end_time_pretty],\n location: event[:payload][:event][:location],\n invitee_name: event[:payload][:invitee][:name],\n duration: event[:payload][:event_type][:duration],\n event_kind: event[:payload][:event_type][:kind])\n toSave.save\n render json: {}, status: 200\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, :notice => 'Event was successfully created.' }\n format.json { render :json => @event, :status => :created, :location => @event }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: t(:event_created) }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n params['user_id'] = current_user.id if current_user\n @event = Event.new(event_params)\n\n if @event.save\n render json: { location: format_event(@event) }, status: :created\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to \"/#{@event.url}\" }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def push_events\n saved = []\n jsonHash = request.POST[:_json];\n jsonHash.each do |jsonEvent|\n event = Event.new\n event.race_id = jsonEvent[\"raceId\"]\n event.walker_id = jsonEvent[\"walkerId\"]\n event.eventId = jsonEvent[\"eventId\"]\n event.eventType = jsonEvent[\"type\"]\n event.eventData = jsonEvent[\"data\"]\n event.batteryLevel = jsonEvent[\"batL\"]\n event.batteryState = jsonEvent[\"batS\"]\n event.timestamp = Time.zone.parse(jsonEvent[\"time\"])\n if event.save # if new\n saved << jsonEvent[\"eventId\"]\n if event.race_id != 0 # if not unknown race_id\n after_create(event)\n end\n else # if exists\n saved << jsonEvent[\"eventId\"]\n puts \"Not Saved!\" # debug print\n puts jsonEvent # debug print \n end\n end\n render :json => {:savedEventIds => saved}\n end", "def create\n result = Event::CreateEvent.perform(event_context)\n\n respond_to do |format|\n if result.success?\n @event = result.event\n format.json { render action: 'show', status: :created }\n else\n format.json { render json: { :errors => result.errors.full_messages }, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n if @event.save\n render :show, status: :created, location: @event\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def create\n @event = Events::Event.new(event_params)\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to events_path, notice: \"Event #{@event} was successfully created.\" }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to events_path, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: events_path(@event) }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, event: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n params[:event] = convert_datetimes( params[:event] )\n @event = @current_account.events.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # render json: params[:event]\n temp_event = Event.create(\n name: params[:event][:name],\n location: params[:event][:location],\n date: params[:event][:date],\n time: params[:event][:time],\n budget: params[:event][:budget],\n user: current_user\n )\n redirect_to \"/items?event=#{temp_event.id}\"\n end", "def create\n \n @event = Event.new(event_params)\n \n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: \"Event was successfully created.\" }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event_event = Event::Event.new(params[:event_event])\n\n respond_to do |format|\n if @event_event.save\n format.html { redirect_to @event_event, notice: 'Event was successfully created.' }\n format.json { render json: @event_event, status: :created, location: @event_event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event_event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to events_path, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to dashboard_home_path }\n format.json { render 'event', status: :created, event: @event }\n else\n format.html { render dashboard_home_path }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n logger.debug @event.errors.inspect\n format.html { redirect_to @event, notice: 'データが新規作成されました。' }\n format.json { render :show, status: :created, location: @event }\n else\n logger.debug @event.errors.to_hash(true)\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to new_event_path, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, flash: {success: 'Event was successfully created.'} }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: \"Event was successfully created.\" }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: \"Event was successfully created.\" }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, success: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'El evento fue creado exitosamente.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n flash[:success] = \"Event was successfully created.\"\n format.html { redirect_to @event }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @event = Event.new(event_params)\r\n convert_timezone @event\r\n event_type_status @event\r\n if @event.save_without_exception\r\n update_theme @event\r\n add_event_categories @event\r\n add_event_location @event\r\n create_group_guest_list @event\r\n add_photos @event\r\n # Create Groups and contacts through CSV\r\n contacts_imports\r\n render json: SuccessResponse.new(\r\n code: 200, message: 'Event Created.', location: '/events/List?id=' + @event.id.to_s, eventID: @event.id\r\n ), adapter: :json, status: :ok\r\n else\r\n render json: ErrorResponse.new, adapter: :json, status: :unprocessable_entity\r\n end\r\n end", "def create\n @event = current_user.events.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: t(:event_success) }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_events\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Aula cadastrada com sucesso.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to action: :index, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to new_user_event_path(current_user), notice: 'event was successfully created.' }\n format.json\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n @event.url = BASE_URL + @event.name.gsub(' ', '_')\n \n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render action: 'show', status: :created, location: @event }\n else\n format.html { render action: 'new' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_event(url, event, payload_type, payload)\n body = {\n :event => event,\n :payload_type => payload_type }\n body[:payload] = payload if payload\n\n http_post(url) do |req|\n req.headers['Content-Type'] = 'application/json'\n req.body = body.to_json\n req.params['verification'] = 1 if event == 'verification'\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render action: 'show', status: :created, location: @event }\n else\n format.html { render action: 'new' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render action: 'show', status: :created, location: @event }\n else\n format.html { render action: 'new' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = @calendar.events.new(event_params)\n respond_to do |format|\n if @event.save\n format.json { render json: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n flash[:success] = \"Wydarzenie zostało utworzone.\"\n format.html {redirect_to @event}\n format.json {render :show, status: :created, location: @event}\n else\n format.html {render :new}\n format.json {render json: @event.errors, status: :unprocessable_entity}\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to event_registration_path(id: @event.id), notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n @event.creator = @current_user\n\n if @event.save\n @event.users.each do |user|\n p \"event user = #{user.name}\"\n user.send_event_push(PushTypes::NEW_EVENT, current_user.to_push, @event.title)\n end\n else\n render json: @event.errors, status: :unprocessable_entity\n return\n end\n end", "def create\n @event = Event.new(event_params)\n if @event.save\n render json: @event, status: 201\n @user_event = UserEvent.create(admin: true, event_id: @event.id, user_id: current_user.id)\n else\n render json: { message: \"Please make sure to fill all required fields.\" }, status: 401\n end\n end", "def create\n @event = Event.new(event_params)\n respond_to do |format|\n if @event.save\n track_activity @event\n format.html { redirect_to :back, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n after_event_created_mail @event\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @myevent = Myevent.new(params[:myevent])\n\n respond_to do |format|\n if @myevent.save\n format.html { redirect_to @myevent, notice: 'Myevent was successfully created.' }\n format.json { render json: @myevent, status: :created, location: @myevent }\n else\n format.html { render action: \"new\" }\n format.json { render json: @myevent.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7712453", "0.76103187", "0.76023", "0.754027", "0.74432945", "0.731932", "0.73127836", "0.7280875", "0.72503763", "0.7234792", "0.7234792", "0.72143626", "0.7167559", "0.7149272", "0.7125694", "0.7117843", "0.71169645", "0.71154994", "0.7095357", "0.7089589", "0.70818335", "0.707999", "0.7079779", "0.70705944", "0.70568603", "0.70410204", "0.7017483", "0.7017483", "0.7017483", "0.7017483", "0.7017483", "0.7017483", "0.7017483", "0.7017483", "0.7017483", "0.7017483", "0.7017483", "0.7017483", "0.7017483", "0.70169675", "0.70154995", "0.7008169", "0.700749", "0.69885564", "0.69861186", "0.69695103", "0.69695103", "0.69657636", "0.6947553", "0.6946979", "0.6946979", "0.6946979", "0.6946979", "0.6946979", "0.6946979", "0.6946979", "0.6946979", "0.6946979", "0.6946979", "0.6946979", "0.6946979", "0.6946979", "0.6946979", "0.6946979", "0.6946979", "0.6946979", "0.6946979", "0.6946979", "0.6946979", "0.6946979", "0.6946979", "0.6946979", "0.6946979", "0.6946979", "0.6946979", "0.6946979", "0.6941264", "0.6935449", "0.6934859", "0.6934859", "0.6930619", "0.69255376", "0.6906487", "0.6904309", "0.6904067", "0.6903791", "0.6901801", "0.6900472", "0.68987685", "0.6895279", "0.6880863", "0.68741393", "0.68631655", "0.68631655", "0.68417245", "0.68408704", "0.6835462", "0.683374", "0.6819643", "0.67983", "0.6790408" ]
0.0
-1
PATCH/PUT /events/1 PATCH/PUT /events/1.json
def update respond_to do |format| if @event.update(event_params) format.html { redirect_to controller: 'admin/events', action: 'index', conf_id: @event.conference_id } format.json { render :show, status: :ok, location: @event } else @event_type = @event.event_type @speaker_event = @event_type.speaker_event format.html { render :edit } format.json { render json: @event.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch_event\n user_id = params[\"user_id\"]\n group_id = params[\"group_id\"]\n event_id = params[\"event_id\"]\n\n #TODO Handle 404 if event not found\n event = Event.find(event_id)\n\n json_body = JSON.parse(request.body.read)\n\n @@event_service.patch_event(json_body, user_id, group_id, event_id)\n\n render status: :ok, text: \"\"\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.json { head :no_content }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @event.update(event_params(params))\n render json: @event, status: 200\n else\n render :json => @event.errors, :status => 422\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.json { render json: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @event.update(event_params)\n render json: @event, status: 201\n else\n render json: { message: \"Error. Error. Please try again.\"}, status: 400\n end\n end", "def update\n\tif @event.update(event_params)\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def update\n return forbidden unless user_is_owner\n return bad_request unless @event.update_attributes(event_params)\n render json: @event, status: :ok\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.json { render :show, status: :ok, location: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.json { render :show, status: :ok, location: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @event.update(event_params)\n render json: { location: format_event(@event) }\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n @event.update(status: \"Pending\")\n else\n @reopen = true\n format.json { render json: @event.errors, status: :unprocessable_entity }\n format.html { render :show }\n end\n end\n end", "def update\n \n \n @event = Event.find(params[:id])\n\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: t(:event_updated) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n \n end\n end", "def update\n @event = Event.find(params[:id])\n\n if @event.update(params[:event])\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def pupdate\n @event = Event.find(params[:id])\n respond_to do |format|\n if @event.update_attributes(JSON.parse(params[:event]))\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content}\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # @event = Event.find(params[:id])\n\n if @event.update(event_params)\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def update\n @event = Event.find(params[:id])\n\n if @event.update(event_params)\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def update\n @event = Event.find(params[:id])\n\n if @event.update(event_params)\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @base_event.update(base_event_params)\n format.json { head :no_content }\n else\n format.json { render json: @base_event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html {redirect_to @event, notice: 'Event was successfully updated.'}\n format.json {head :no_content}\n else\n format.html {render action: 'edit'}\n format.json {render json: @event.errors, status: :unprocessable_entity}\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n @event.save!\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #require \"pry\"; binding.pry\n\n update_users\n\n respond_to do |format|\n if @event.update(event_params)\n sync_update @event\n format.html { redirect_to @event, notice: t(\"successfully_updated\", :model => t(\"models.event\")) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.using(:shard_one).find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, :notice => 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n\n\n\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to events_path, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: events_path(@event) }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, :notice => 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, :notice => 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, :notice => 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\n\n\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to '/', notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @event.update(event_params)\n\n format.html { redirect_to @event }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #@event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n event_id = params[:id]\n if event_id.present? && params[:event].present? && @user.uuid.present? && @user.uuid != \"guest\"\n event_params = params[:event]\n @event = Com::Nbos::Events::Event.where(id: params[:id], user_id: @user.id ).first\n if @event.present?\n @event.update(event_params.permit!)\n if @event.save\n render :json => @event\n else\n data = add_error_messages(@event)\n render :json => data\n end\n else\n render :json => {\"messageCode\": \"module.user.unauthorized\", \"message\": \"Unauthorized to update others Event\"}, status: 404\n end\n else\n render :json => {messageCode: \"bad.request\", message: \"Bad Request\"}, status: 400\n end\n end", "def update\r\n respond_to do |format|\r\n if @event.update(event_params)\r\n format.html { redirect_to @event, notice: 'Event 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: @event.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html do\n gflash :notice\n redirect_to @event\n end\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event_event = Event::Event.find(params[:id])\n\n respond_to do |format|\n if @event_event.update_attributes(params[:event_event])\n format.html { redirect_to @event_event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event_event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to events_event_path(@event), notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @event.update(event_params)\n \tdata = { data: @event, status: :ok, message: \"Event was successfully updated.\" }\n render :json => data\n else\n \tdata = { data: @event.errors, status: :unprocessable_entity }\n render :json => data\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to edit_event_path(@event), notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.75299805", "0.7372486", "0.71766764", "0.7172103", "0.7170955", "0.71424884", "0.70959055", "0.7082709", "0.7082709", "0.7057662", "0.70209146", "0.6989379", "0.69825095", "0.69775003", "0.69601995", "0.6954494", "0.6954494", "0.6951992", "0.692109", "0.692109", "0.692109", "0.692109", "0.692109", "0.692109", "0.692109", "0.692109", "0.692109", "0.69159144", "0.6893937", "0.68830234", "0.68787163", "0.68631184", "0.68579584", "0.6854905", "0.68530035", "0.68461853", "0.68461853", "0.68461853", "0.6839517", "0.6839378", "0.6835066", "0.68241036", "0.681631", "0.68139076", "0.68139076", "0.68139076", "0.68139076", "0.68139076", "0.68139076", "0.68139076", "0.68139076", "0.68139076", "0.68139076", "0.68139076", "0.68139076", "0.68139076", "0.68139076", "0.68139076", "0.68139076", "0.68139076", "0.68139076", "0.68139076", "0.68139076", "0.681159", "0.68073547", "0.679286", "0.679286", "0.679286", "0.679286", "0.679286", "0.679286", "0.679286", "0.679286", "0.6789041", "0.67812467", "0.67756975", "0.67662907", "0.67662907", "0.67662907", "0.67662907", "0.67662907", "0.67662907", "0.67662907", "0.67662907", "0.67662907", "0.67662907", "0.67662907", "0.67662907", "0.67662907", "0.67662907", "0.67662907", "0.67662907", "0.67662907", "0.67662907", "0.67662907", "0.67662907", "0.67662907", "0.67662907", "0.67662907", "0.67662907", "0.67662907" ]
0.0
-1
DELETE /events/1 DELETE /events/1.json
def destroy @event.destroy respond_to do |format| format.html { redirect_to controller: 'admin/events', action: 'index', conf_id: @event.conference_id } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @event = Event.using(:shard_one).find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def delete_event\n if params[:id]\n @e = Evento.find(params[:id]).destroy\n end\n render :json => msj = { :status => true, :message => 'ok'}\n end", "def destroy\n @event = Event.find(params[:id])\n \n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n #@event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "def destroy\n # @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @events = Event.where(event_id: params[:id])\n @events.each.destroy\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n\n end", "def destroy\n @event_event = Event::Event.find(params[:id])\n @event_event.destroy\n\n respond_to do |format|\n format.html { redirect_to event_events_url }\n format.json { head :ok }\n end\n end", "def destroy\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url}\n format.json { head :no_content }\n end\n end", "def destroy\n @myevent = Myevent.find(params[:id])\n @myevent.destroy\n\n respond_to do |format|\n format.html { redirect_to myevents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n\n sync_destroy @event\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html {redirect_to events_url}\n format.json {head :no_content}\n end\n end", "def destroy\n @calevent = Calevent.find(params[:id])\n @calevent.destroy\n\n respond_to do |format|\n format.html { redirect_to calevents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n #@event.update_attribute(:deleted, true)\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n render :nothing => true, :status => 200, :content_type => 'text/plain'\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url, notice: t(:event_deleted) }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_events_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n head :no_content\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to root_url, notice: 'Event was successfully removed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url, notice: 'データが削除されました。' }\n format.json { head :no_content }\n end\n end", "def delete_event\r\n event = Event.find_by(id: params[:eventid].to_i)\r\n if event.present?\r\n event.update(status: 3)\r\n lt_update_event_status event, 'archived'\r\n render json: SuccessResponse.new(\r\n code: 200,\r\n message: 'Event Deleted.'\r\n ), adapter: :json, status: :ok\r\n else\r\n render json: ErrorResponse.new(\r\n code: 404,\r\n message: 'Event not found!'\r\n ), adapter: :json, status: :not_found\r\n end\r\n\r\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url, notice: 'Event was successfully removed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url, notice: 'Event was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url, notice: 'Event was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @client = Client.find(@event.client_id)\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_to_client_path(@client) }\n format.json { head :no_content }\n end\n end", "def destroy\n @event_request = EventRequest.find(params[:id])\n @event_request.destroy\n\n respond_to do |format|\n format.html { redirect_to event_requests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url, notice: 'Мероприятие успешно удалено.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = current_user.events.find_by_url(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post_event.destroy\n respond_to do |format|\n format.html { redirect_to post_events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = @current_account.events.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @evento = Evento.find(params[:id])\n @evento.destroy\n\n respond_to do |format|\n format.html { redirect_to eventos_url }\n format.json { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url, notice: 'Event was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @eventtype.events.each do |e|\n e.destroy\n end\n @eventtype.destroy\n respond_to do |format|\n format.html { redirect_to eventtypes_url }\n format.json { head :no_content }\n end\n end", "def destroy \n @event.destroy \n respond_to do |format|\n format.html { redirect_to events_url, success: 'Event was successfully removed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.mobile { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @create_event = CreateEvent.find(params[:id])\n @create_event.destroy\n\n respond_to do |format|\n format.html { redirect_to create_events_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.76929694", "0.7688217", "0.7688217", "0.7688217", "0.7681325", "0.7585923", "0.75685203", "0.7560765", "0.7541314", "0.75410026", "0.75410026", "0.75410026", "0.75410026", "0.75410026", "0.75410026", "0.75410026", "0.75410026", "0.75410026", "0.75410026", "0.75410026", "0.75407314", "0.7538618", "0.7537845", "0.75270605", "0.7519828", "0.7519828", "0.7519828", "0.7519828", "0.7519828", "0.7519828", "0.7519828", "0.7519828", "0.7519828", "0.7519828", "0.7519828", "0.7519828", "0.7519828", "0.7519828", "0.7519828", "0.7519828", "0.7519828", "0.7515053", "0.7515053", "0.7515053", "0.7515053", "0.7515053", "0.7515053", "0.7515053", "0.7515053", "0.7515053", "0.7515053", "0.7515053", "0.7515053", "0.7515053", "0.7515053", "0.7515053", "0.7515053", "0.7515053", "0.7515053", "0.7515053", "0.7515053", "0.7515053", "0.7515053", "0.7515053", "0.7515053", "0.7515053", "0.7515053", "0.7515053", "0.7515053", "0.7515053", "0.7515053", "0.7515053", "0.7495719", "0.74660254", "0.7460513", "0.7453805", "0.7447235", "0.7440681", "0.7440677", "0.74352366", "0.7433521", "0.7402055", "0.73883057", "0.7378132", "0.7372413", "0.73654723", "0.7338665", "0.73354304", "0.73354304", "0.73233044", "0.73011655", "0.7297207", "0.7291023", "0.72906876", "0.72897285", "0.72883385", "0.7285439", "0.7284677", "0.7282717", "0.7272616", "0.7270284" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_event @event = Event.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 set_actions\n actions :all\n end", "def define_action_helpers?; end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup_handler\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; 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 workflow\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def setup\n # override and do something appropriate\n end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def 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 startcompany(action)\n @done = true\n action.setup\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def action\n end", "def 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 after_set_callback; end", "def initialize(*args)\n super\n @action = :set\nend", "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 around_hooks; end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def save_action; end", "def 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 setup(&blk)\n @setup_block = blk\n end", "def default_action; end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def call\n setup_context\n super\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def duas1(action)\n action.call\n action.call\nend" ]
[ "0.61637366", "0.60446453", "0.59452957", "0.591511", "0.58885515", "0.5834122", "0.57761765", "0.5702554", "0.5702554", "0.5652102", "0.5619581", "0.5423898", "0.5409782", "0.5409782", "0.5409782", "0.5394745", "0.53780794", "0.5356209", "0.5338898", "0.53381324", "0.5328622", "0.5309231", "0.5296901", "0.529641", "0.5296097", "0.5258364", "0.5242683", "0.5236372", "0.5236372", "0.5236372", "0.5236372", "0.5236372", "0.52346426", "0.52320486", "0.5225926", "0.52210605", "0.52171826", "0.52138335", "0.5207914", "0.52069265", "0.5176269", "0.5174653", "0.51730466", "0.51650184", "0.5161409", "0.5156175", "0.5154185", "0.5151096", "0.5151089", "0.51452935", "0.5138662", "0.51339483", "0.5113475", "0.51132", "0.51132", "0.5108031", "0.51075375", "0.5090693", "0.50892115", "0.5081523", "0.5081454", "0.5064919", "0.50545585", "0.50531805", "0.50501585", "0.50501585", "0.50329936", "0.5024674", "0.50203156", "0.50156844", "0.50149846", "0.50011337", "0.4999346", "0.49984375", "0.4988749", "0.4988749", "0.49842322", "0.49800175", "0.4979922", "0.49791628", "0.49666047", "0.49655434", "0.49559638", "0.49557537", "0.49554902", "0.4953974", "0.49519545", "0.49449277", "0.49440357", "0.49329734", "0.49315402", "0.49261367", "0.4925912", "0.4925598", "0.4924306", "0.49202663", "0.49167567", "0.49164373", "0.4915191", "0.49145022", "0.49140996" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def event_params params.require(:event).permit(:published, :title, :description, :event_type_id, :conference_id, :speaker_id, :duration, :position, :responsable, :video, :materials, :materials_link) 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 valid_params_request?; end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n 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 safe_params\n params.require(:user).permit(:name)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\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 user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\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 ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\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 post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def url_whitelist; end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def permit_request_params\n params.permit(:address)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def 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 backend_user_params\n params.permit!\n end", "def url_params\n params[:url].permit(:full)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.6981273", "0.6783789", "0.67460483", "0.6742222", "0.67354137", "0.65934366", "0.65028495", "0.6497783", "0.64826745", "0.6479415", "0.6456823", "0.6440081", "0.63800216", "0.6376521", "0.636652", "0.6319898", "0.6300256", "0.62994003", "0.6293621", "0.6292629", "0.6291586", "0.629103", "0.6282451", "0.6243152", "0.62413", "0.6219024", "0.6213724", "0.62103724", "0.61945", "0.61786324", "0.61755824", "0.6173267", "0.6163613", "0.6153058", "0.61521065", "0.6147508", "0.61234015", "0.61168665", "0.6107466", "0.6106177", "0.6091159", "0.60817343", "0.6071238", "0.6062299", "0.6021663", "0.60182893", "0.6014239", "0.6011563", "0.60080767", "0.60080767", "0.60028875", "0.60005623", "0.59964156", "0.5993086", "0.5992319", "0.5992299", "0.59801805", "0.59676576", "0.59606016", "0.595966", "0.59591126", "0.59589803", "0.5954058", "0.5953234", "0.5944434", "0.5940526", "0.59376484", "0.59376484", "0.5935253", "0.5930846", "0.5926387", "0.59256274", "0.5917907", "0.5910841", "0.590886", "0.59086543", "0.59060425", "0.58981544", "0.5898102", "0.5896809", "0.5895416", "0.58947027", "0.58923644", "0.5887903", "0.58830196", "0.5880581", "0.5873854", "0.58697754", "0.5869004", "0.58669055", "0.5866886", "0.58664906", "0.5864619", "0.58630043", "0.5862495", "0.5861368", "0.5859712", "0.5855544", "0.58551925", "0.5851284", "0.5850602" ]
0.0
-1
Whether or not this LogEntry was an error
def error? return false if error_text.nil? or error_text.empty? return true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error_log?\n @status.exitstatus & (1 << 6) != 0\n end", "def error_log?\n @status.exitstatus & (1 << 6) != 0\n end", "def error?\n get_last_error['err'] != nil\n end", "def error?\n get_last_error['err'] != nil\n end", "def error?\n @status == ERROR_FLAG\n end", "def error?\n last_error.present?\n end", "def error?\n severity == :ERROR\n end", "def error?\n logger.debug { sign_message(\"Error state : #{@error}\") }\n if @error\n true\n else\n false\n end\n end", "def error?\n @error\n end", "def error?\n @error\n end", "def error?\n self.type == :error\n end", "def error?\n self.type == :error\n end", "def error?\n type == :error\n end", "def error?\n status == STATUS_ERROR\n end", "def error?\n error.to_bool\n end", "def error?\n status[:error] || false\n end", "def error?\n !failure?\n end", "def error?\n task_result_field if States::Error.include?(task_state)\n end", "def error?\n error\n end", "def error?\n attributes['error'] != 0\n end", "def error?\n !! @error\n end", "def error?\n true\n end", "def errors?\n @statistics[:error] != 0\n end", "def error?\n !error.nil?\n end", "def error?\n !error.nil?\n end", "def has_error?\n status == ERROR \n end", "def error?\n !error.nil?\n end", "def error?\n not @error.nil?\n end", "def error?\n !!@error\n end", "def error?\n level <= ERROR\n end", "def error?()\n #This is a stub, used for indexing\n end", "def error?; @logger.error? end", "def error?\n false\n end", "def error?\n !error.blank?\n end", "def error?\n self.error || false\n end", "def errors?\n @error_count > 0\n end", "def is_error?\n return (self.status == HostResult::STATUS_ERROR)\n end", "def error?\n false\n end", "def error?\n false\n end", "def error?\n false\n end", "def error?\n level >= ASL_LEVEL_ERR\n end", "def error?\n message.fields[0] == 'WE'\n end", "def error\n @last_error && @last_error.error\n end", "def error?\n outcome == ERROR\n end", "def error?\n return true if errors.count > 0\n\n false\n end", "def error?\n !success?\n end", "def error?\n !success?\n end", "def failed?\n error.present?\n end", "def error?\n !!@exception\n end", "def error?\n !!exception\n end", "def has_errors?\n return @exitcode == 2 || @exitcode == 1\n end", "def on_error?\n @kind == :on_error\n end", "def error?\n !@error.equal?(NOT_SET)\n end", "def failure?\n error.nil?\n end", "def error?\n error_state?(peek_current_state)\n end", "def error?\n self.State == P2::DS_STATE_ERROR\n end", "def error?\n self.body.keys.include?(:err_code)\n end", "def errored_during_import?\n import_errors.present?\n end", "def error?; @loggers.first.level <= ERROR; end", "def error?\n !@data['error'].nil?\n end", "def error?\n !@data['error'].nil?\n end", "def error?\n @exception.present?\n end", "def error?\n level == 2\n end", "def error?\n !!@error\n end", "def error?\n !!@error\n end", "def error?\n @loggers.any? { |logger| logger.respond_to?(:error?) && logger.error? }\n end", "def failed?\n errors.count > 0\n end", "def error?\n @level <= 3\n end", "def check_error\n if @errors.empty?\n false\n else\n @log.error(@taskname) { \"--- Configuration for #{@taskname} ---\" }\n @doc.each do |doc|\n @log.error(@taskname) { \"#{doc}\" }\n end\n @log.error(@taskname) { \"--- Errors found for #{@taskname} ---\" }\n @errors.each do |error|\n @log.error(@taskname) { \" #{error}\" }\n end\n @log.fatal(@taskname) { 'terminated' }; exit\n end\n end", "def failure?\n !error?\n end", "def import_failed?\n IMPORT_ERRORS.include? import_progress[:status]\n end", "def failed?\n @failed\n end", "def failed?\n @is_failed\n end", "def error?(response)\n response.key?('errorcode')\n end", "def errors?\n !success?\n end", "def failure_has_occurred?\r\n @failure_has_occurred = true\r\n end", "def error?\n no_error_code = error_code.nil? || error_code.zero?\n done? && !(err.nil? && no_error_code)\n end", "def fatal_error?(_error, _payload, _metadata)\n false\n end", "def failed?\n @failed\n end", "def errors?\n process_errors.errors?\n end", "def self_log?\n @status.exitstatus & (1 << 7) != 0\n end", "def error?\n return if @resource.is_a?(Array)\n @resource.key?(\"error\")\n end", "def error?\n resources.error.count > 0\n end", "def error?\n resources.error.count > 0\n end", "def errors_found?\n errors.size > 0\n end", "def error?\n converter_results[:errors] && converter_results[:errors].any?\n end", "def failed?\n true\n end", "def error?\n !!(status.to_s =~ /[4|5]\\d\\d/)\n end", "def is_error?\n is_server_error? || is_client_error?\n end", "def failure?\n @status == FAILURE_FLAG\n end", "def has_error?\n !(error.nil? || error.empty?)\n end", "def has_error?\n !(error.nil? || error.empty?)\n end", "def error?\n\t\tEventMachine::report_connection_error_status(@signature) != 0\n\tend", "def error?\n !success?\n end", "def error?(name = nil, type = nil)\n return 0 < errors(name, type).size\n end", "def error?\n error = (self[:error_upgrade] & 0b1111111)\n return error != 0\n end", "def is_failed\n @status == Status::FAILURE\n end", "def error?\n response.is_a?(Hash) ? response.has_key?(:status) : false\n end", "def api_error\n dm_data.first.first == \"errors\"\n end", "def failed?\n state == :failed\n end" ]
[ "0.76077443", "0.7376135", "0.73660296", "0.73660296", "0.73642373", "0.72570986", "0.72305584", "0.7125339", "0.69953346", "0.69953346", "0.69828457", "0.69828457", "0.6974009", "0.69424915", "0.6913015", "0.6900868", "0.6886072", "0.6883914", "0.6883866", "0.68727005", "0.68573284", "0.6842967", "0.68364096", "0.6823892", "0.6823892", "0.6817017", "0.6810146", "0.6766641", "0.67306405", "0.67300993", "0.67273694", "0.6689043", "0.6680651", "0.66787374", "0.66779417", "0.6677833", "0.666779", "0.66662604", "0.6655159", "0.6655159", "0.6625882", "0.6620525", "0.659434", "0.65943325", "0.65918267", "0.65545905", "0.6549905", "0.6540162", "0.6518085", "0.6507693", "0.64967144", "0.64964485", "0.6461385", "0.64574856", "0.6453613", "0.64525515", "0.64401346", "0.6438522", "0.6421596", "0.63963246", "0.63963246", "0.6393717", "0.6363523", "0.6340875", "0.6340875", "0.63198006", "0.63179916", "0.63068515", "0.6304423", "0.6302251", "0.63006586", "0.62805617", "0.6268489", "0.6228377", "0.6226752", "0.6224848", "0.62240064", "0.620224", "0.6201508", "0.62013656", "0.61829364", "0.61719495", "0.61692166", "0.61692166", "0.6151317", "0.61476153", "0.6147469", "0.6146068", "0.6145503", "0.6145452", "0.6140911", "0.6140911", "0.6139569", "0.61351705", "0.6126607", "0.61098254", "0.6096543", "0.6071587", "0.6067112", "0.6066103" ]
0.622134
77
turned into a monster again refactor
def play_turn(data) word_smith = WordSmith.new(data: data, board: board) word_smith.process_data create_turn(word_smith.points, word_smith.tiles) end_game if over? assign_new_tiles(current_player) toggle_current_player rescue WordSmith::InvalidWord self.error_message = I18n.t("games.error_messages.invalid_word") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def anchored; end", "def suivre; end", "def probers; end", "def schubert; end", "def private; end", "def ravel; end", "def jack_handey; end", "def malts; end", "def villian; end", "def king_richard_iii; end", "def monster; end", "def monster; end", "def superweening_adorningly(counterstand_pyrenomycetales)\n end", "def unusual_sport; end", "def stderrs; end", "def processor; end", "def transformations; end", "def terpene; end", "def surge; end", "def gounod; end", "def schumann; end", "def romeo_and_juliet; end", "def transact; end", "def silly_adjective; end", "def rossini; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def celebration; end", "def strain; end", "def formation; end", "def nasa_space_craft; end", "def mitch_hedberg; end", "def weber; end", "def scientist; end", "def post_match() end", "def trd; end", "def who_we_are\r\n end", "def buzzword; end", "def buzzword; end", "def mambo_no_5; end", "def motto; end", "def transform; end", "def intensifier; end", "def heroine; end", "def refutal()\n end", "def p15\n\t\nend", "def winter_paralympics_sport; end", "def invention; end", "def passes; end", "def passes; end", "def starship; end", "def operations; end", "def operations; end", "def reap; end", "def play_move!( m )\n self.delete_if { |pos, piece| pos == m.to_coord || pos == m.captured_piece_coord }\n\n piece_moved = self.delete(m.from_coord)\n self[m.to_coord] = piece_moved\n\n if m.castled==1\n castling_rank = m.to_coord.rank.to_s\n [['g', 'f', 'h'], ['c', 'd', 'a']].each do |king_file, new_rook_file, orig_rook_file|\n #update the position of the rook corresponding to the square the king landed on\n\tif m.to_coord.file == king_file \n\t rook = self.delete(\"#{orig_rook_file}#{castling_rank}\")\n\t self[\"#{new_rook_file}#{castling_rank}\"] = rook\n\tend\n end\n end\n \n #TODO investigate why this method is getting called multiply per moves << Move.new\n return unless piece_moved\n ep_from_rank, ep_to_rank, ep_rank = EN_PASSANT_CONFIG[ piece_moved.side ]\n @en_passant_square = ( piece_moved.function == :pawn &&\n m.from_coord.rank == ep_from_rank && \n m.to_coord.rank == ep_to_rank ) ? m.from_coord.file + ep_rank.to_s : nil\n\n #reflect promotion\n if piece_moved && piece_moved.function == :pawn && m.to_coord.to_s.rank == piece_moved.promotion_rank\n self.delete(m.to_coord)\n self[m.to_coord] = Queen.new(piece_moved.side, :promoted)\n #puts self.to_s if m.to_coord == 'a8'\n #debugger if m.to_coord == 'a8'\n end\n \n self\n end", "def spice; end", "def checks; end", "def spouse; end", "def feruchemist; end", "def r; end", "def r; end", "def guct\n end", "def sharp; accidental; end", "def ignores; end", "def bellini; end", "def mascot; end", "def slop!; end", "def slop!; end", "def method_731(base); end", "def droid; end", "def zuruecksetzen()\n end", "def herald; end", "def gen_washing\r\r\n end", "def berlioz; end", "def processed_source=(_); end", "def processed_source=(_); end", "def mob; end", "def transforms; end", "def next() end", "def next() end", "def faint; end", "def faint; end", "def witcher; end", "def offences_by; end", "def summer_paralympics_sport; end", "def trans_enemies\n b = []\n a = \"\"\n for i in $data_enemies\n if i != nil and i.name != nil\n oldname = i.name.split(/\\//)[0]\n oldname = oldname.gsub(\"【data】\", \"\").gsub(\"【fix】\",\"\") if oldname.is_a?(String)\n if oldname!= \"\" and oldname!= nil #and oldname.translation_check != i.UK_name\n a = \"when \" + i.id.to_s + \" \\#\" + oldname + \"\\n\"\n b.push(a)\n a = \" return \\\"\" + i.UK_name + \"\\\"\"\n a = a + \" ***TODO\" if oldname == i.UK_name\n a = a + \"\\n\"\n b.push(a)\n end\n end\n end\n open(\"zzz.txt\",\"a+\") do |log|\n log.puts b\n end\nend", "def ibu; end", "def code; end", "def code; end", "def code; end", "def code; end", "def code; end", "def code; end", "def code; end", "def soft_ace\n # softy method refactor for when an ace is played\nend", "def rassoc(p0) end", "def pass; end", "def pass; end", "def parslet; end" ]
[ "0.6484325", "0.6391546", "0.6204299", "0.6180854", "0.60765606", "0.59509224", "0.59266037", "0.5901084", "0.5864783", "0.58105946", "0.5779841", "0.5779841", "0.57757264", "0.57631344", "0.57376826", "0.56927025", "0.56906295", "0.56855416", "0.56549954", "0.5578517", "0.5576659", "0.55565447", "0.55338216", "0.55308616", "0.5523233", "0.54773766", "0.54773766", "0.54773766", "0.54773766", "0.54767776", "0.5475143", "0.54674447", "0.54461294", "0.54351735", "0.54290867", "0.5428208", "0.54277706", "0.54274577", "0.54184866", "0.53951424", "0.53951424", "0.53911185", "0.53784204", "0.53759784", "0.53715235", "0.5371067", "0.5356544", "0.5353191", "0.5352868", "0.53345096", "0.53188473", "0.53188473", "0.53187186", "0.53098583", "0.53098583", "0.53068304", "0.5304786", "0.52977914", "0.5290769", "0.52897733", "0.52669924", "0.5263645", "0.5263645", "0.5258762", "0.52485824", "0.5244656", "0.5234008", "0.52267826", "0.52262187", "0.52262187", "0.52166784", "0.5205903", "0.52026975", "0.520102", "0.51999116", "0.51938564", "0.5181285", "0.5181285", "0.51751757", "0.51737666", "0.51721084", "0.51721084", "0.51590747", "0.51590747", "0.51573265", "0.5144514", "0.5139735", "0.51363856", "0.51294446", "0.51278526", "0.51278526", "0.51278526", "0.51278526", "0.51278526", "0.51278526", "0.51278526", "0.5127254", "0.51243454", "0.5120737", "0.5120737", "0.5118199" ]
0.0
-1
color should be Array like [r, g, b]. Float from 0.0 to 1.0.
def initialize(v0, v1, v2, v3, color, transmit = nil) super(v0, v1, v2, v3) @color = color @transmit = transmit end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def color=(array)\n shader.set_float_uniform('color', array)\n return self\n end", "def rgb_color\n [self.color_red, self.color_green, self.color_blue]\n end", "def rgb_color; end", "def to_array\n\t\t\tm_color = self.color.delete(' ')\n\t\t\tm_color.delete!('hsl(')\n\t\t\tm_color.delete!(')')\n\n\t\t\tm_color = m_color.split(',')\n\t\t\tm_color[0] = m_color[0].to_i \n\t\t\tm_color[1] = m_color[1].to_f / 100 \n\t\t\tm_color[2] = m_color[2].to_f / 100\n\t\t\tm_color \n\t\tend", "def i_to_f(color_array)\n b = []\n color_array.each do |n|\n b.push(n / 255.0)\n end\n b\n end", "def rgb_color\n Array.new(3) { single_rgb_color }\n end", "def color(color); end", "def set_colour(r,g,b)\n\t\t@colour_r = LoopedArray.new [*r].map {|i| i % 256}\n\t\t@colour_g = LoopedArray.new [*g].map {|i| i % 256}\n\t\t@colour_b = LoopedArray.new [*b].map {|i| i % 256}\n\tend", "def color (color=nil)\n if not color then\n @color\n else\n color = COLORS[color] if color.is_a? Symbol\n color = color.to_str\n if color[0] == ?# and color.length == 7\n color = color[1..-1].to_i(16)\n @color = color * (2**8) + 255\n else\n raise \"color must be a valid string in the format #RRGGBB\"\n end\n end\n end", "def color(*values); end", "def color(*values); end", "def to_3f; return [red, green, blue].map {|i| i / 255.0}; end", "def to_array\n\t\t\tm_color = self.color.delete(' ')\n\t\t\tm_color.delete!('cielab(')\n\t\t\tm_color.delete!(')')\n\n\t\t\tm_color = m_color.split(',')\n\t\t\tm_color[0] = m_color[0].to_f / 100\n\t\t\tm_color[1] = m_color[1].to_f.round(4) \n\t\t\tm_color[2] = m_color[2].to_f.round(4)\n\t\t\tm_color \n\t\tend", "def validate_color(color)\n if (color<0) \n return 0\n elsif (color>255)\n return 255\n else\n return color\n end\n end", "def color=(value)\n @color = value\n end", "def color=(value)\n @color = value\n end", "def shades_of_green value\n #Bunch of shades\n shades = %w( 00FF00 00F800 00F000 00E800 00E000 00D800 00D000 00C800 00C000 00B800 00B000 00A800 00A000 009800 009000 008800 008000 007800 007000 006800 006000 005800 005000 004800 004000 003800 003000 002800 002000 )\n\n #Fewer of shades\n #shades = %w( 00FF00 00D800 00B000 008800 006000 003800 )\n\n #scale the 'value' to an index in the array and display the color\n #the min/max ensure the value is within the range\n index = [ [shades.length * value / 100, 0].max, shades.length - 1].min\n return shades[index]\n end", "def color_rgb\n return nil if self.color_red.blank? || self.color_green.blank? || self.color_blue.blank?\n [self.color_red, self.color_green, self.color_blue]\n end", "def similar_color(param)\n r, g, b = case param\n when Array\n param\n when /#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})/\n $~.values_at(1, 2, 3).map{|s| s.to_i(16)}\n else\n raise \"unknown parameter: #{param}\"\n end\n\n rgb(*ColorfulDays.similar_rgb(r, g, b))\n end", "def color\n @data[:color]\n end", "def set_color\n self.color = [\"#7AD8E5\", \"#63b4d1\", \"6da7d3\", \"#7699d4\", \"#816ec4\", \"#8658bc\", \"#602278\", \"#34023C\"].sample\n end", "def r; self.color.r end", "def much_green?(colors) ; colors[1] > 200 ; end", "def red(r1)\n Rubyvis.rgb(r1,g,b,a)\n end", "def color_channels\n color == 2 ? 3 : 4\n end", "def rgb_color(r,g,b)\n rgba_color(r,g,b,1)\n end", "def add_color\n if !color\n self.color = %w(\n #000000 #0000FF #00FF00 #FF0000 #FFFF00 #9900CC\n #CC0066 #00FFFF #FF00FF #C0C0C0 #00008B #FFD700\n #FFA500 #FF1493 #FF00FF #F0FFFF #EE82EE #D2691E\n #C0C0C0 #A52A2A #9ACD32 #9400D3 #8B008B #8B0000\n #87CEEB #808080 #800080 #008B8B #006400\n ).sample\n end\n end", "def fill_color(color)\n end", "def valid?(color)\n color.is_a?(Color) || # color object\n NAMED_COLORS.key?(color) || # keyword\n hex?(color) || # hexadecimal value\n ( # Array of Floats from 0.0..1.0\n color.instance_of?(Array) &&\n color.length == 4 &&\n color.all? { |el| el.is_a?(Numeric) }\n )\n end", "def color(color)\n color_byte = COLORS.fetch(color, nil)\n\n fail ArgumentError, \"Invalid color #{color.inspect}: It must be one of #{COLORS.keys.inspect}\" if color_byte.nil?\n\n input_value(color_byte)\n end", "def color=(color)\n each_with_index do |cell, index|\n cell.color = color.is_a?(Array) ? color[index] : color\n end\n end", "def get_color\n @color\n end", "def initialize(color_or_red=nil,green=nil,blue=nil)\n @color=color_or_red\n @color=[color_or_red.to_f,green.to_f,blue.to_f] if color_or_red.is_a? Numeric\n @color=DEFAULT_RGB.merge(color_or_red) if color_or_red.is_a? Hash\n \n end", "def to_a\n if self.red && self.green && self.blue\n red = (self.red * 255).round\n green = (self.green * 255).round\n blue = (self.blue * 255).round\n return [red, green, blue]\n else\n return nil\n end\n end", "def color; end", "def color; end", "def color; end", "def color\n @data['color']\n end", "def color\n @red ? \"R\" : \"B\"\n end", "def color\n @color\n end", "def color\n @color\n end", "def rgb\n [red, green, blue].freeze\n end", "def rgb\n [red, green, blue].freeze\n end", "def color=(c)\n @color = Color.new(c)\n end", "def color\n @color ||= COLORS[label.length%COLORS.length].to_sym\n end", "def values\n [@red, @green, @blue]\n end", "def red\n (rgba & 0xFF0000) >> 16\n end", "def flatten_color(color)\n ((((color.to_f / 255.0) * flattened_max_color.to_i).to_i / flattened_max_color) * 255.0).to_i\n end", "def color2pixel(color)\n color.rgba\n end", "def to_truecolor_bytes(color)\n [r(color), g(color), b(color)]\n end", "def to_truecolor_bytes(color)\n [r(color), g(color), b(color)]\n end", "def rgb_value(red, green, blue)\n gray_possible = true\n sep = 42.5\n\n while gray_possible\n if red < sep || green < sep || blue < sep\n gray = red < sep && green < sep && blue < sep\n gray_possible = false\n end\n sep += 42.5\n end\n\n if gray\n \";5;#{ 232 + ((red.to_f + green.to_f + blue.to_f)/33).round }\"\n else # rgb\n \";5;#{ [16, *[red, green, blue].zip([36, 6, 1]).map{ |color, mod|\n (6 * (color.to_f / 256)).to_i * mod\n }].inject(:+) }\"\n end\n end", "def color=(value)\n @color = value.nil? ? nil : value.to_s\n end", "def ==(*color)\n color = (color[0].is_a? Sketchup::Color)? color[0].to_a : color.to_a.flatten\n return self.to_a == color\n end", "def color?(color)\n match color,\n on(Black | Grey.(-> v { v < 0.2 }), 'black-ish'),\n on(White | Grey.(-> v { v > 0.8 }), 'white-ish'),\n on(Grey.(-> v { v >= 0.2 }) & Grey.(-> v { v <= 0.8 }), 'grey-ish'),\n on(Pink, \"that's not a color ;)\")\nend", "def color\n return @color\n end", "def brightness(color)\n r, g, b = color\n # http://stackoverflow.com/a/596243\n 0.299 * r + 0.587 * g + 0.114 * b\n end", "def color\n\t\treturn @color\n\t\t\n\tend", "def color=(v)\n RestrictionValidator.validate :storage_color, COLORS.values, v\n @color = v\n end", "def get_red_scala n\n colors = []\n r = 255; g = 0; b = 0\n max = 255\n\n # se inicia la escala con el r mas fuerte y se añade g y b por igual cantidad hasta llegar al blanco\n for i in 1..n\n g = b = (i*(max/n)).round\n colors << rgb(r, g, b)\n end\n\n #se entrega la escala de blanco a rojo\n colors.reverse\n end", "def processed_color\n if(self.processed == \"1\")\n return \"green\"\n else\n return \"red\"\n end\n\n end", "def rgb(r, g, b)\n \"%.2X%.2X%.2X\" % [r,g,b].map{|i| [[i,255].min,0].max}\nend", "def color\n return @color\n end", "def color\n return @color\n end", "def processed_color\n if(self.processed == \"1\")\n return \"green\"\n else\n return \"red\"\n end\n end", "def processed_color\n if(self.processed == \"1\")\n return \"green\"\n else\n return \"red\"\n end\n end", "def processed_color\n if(self.processed == \"1\")\n return \"green\"\n else\n return \"red\"\n end\n end", "def processed_color\n if(self.processed == \"1\")\n return \"green\"\n else\n return \"red\"\n end\n end", "def processed_color\n if(self.processed == \"1\")\n return \"green\"\n else\n return \"red\"\n end\n end", "def processed_color\n if(self.processed == \"1\")\n return \"green\"\n else\n return \"red\"\n end\n end", "def color?\n @color\n end", "def green=(num)\n @green = constrain num, 0..255\n end", "def constrain_to_colors(array)\n array[0] > 255 ? array[0] = 255 : array[0] < 0 ? array[0] = 0 : array[0]\n array[1] > 255 ? array[1] = 255 : array[1] < 0 ? array[1] = 0 : array[1]\n array[2] > 255 ? array[2] = 255 : array[2] < 0 ? array[2] = 0 : array[2]\n return array\n end", "def parse_rgb(color)\n rgbs = color.split(',')\n\n {\n r: rgbs[0].to_i,\n g: rgbs[1].to_i,\n b: rgbs[2].to_i\n }\n end", "def rgb_value(red, green, blue)\n gray_possible = true\n sep = 42.5\n\n while gray_possible\n if red < sep || green < sep || blue < sep\n gray = red < sep && green < sep && blue < sep\n gray_possible = false\n end\n sep += 42.5\n end\n\n if gray\n \";5;#{ 232 + ((red.to_f + green.to_f + blue.to_f)/33).round }\"\n else # rgb\n \";5;#{ [16, *[red, green, blue].zip([36, 6, 1]).map{ |color, mod|\n (6 * (color.to_f / 256)).to_i * mod\n }].inject(:+) }\"\n end\n end", "def red\n ((hex_color & RED) >> 16) / MAX_RGB_VALUE * 100\n end", "def color(color)\n self.class.color_codes[color] + 30 if self.class.color_codes[color]\n end", "def color(color)\n self.class.color_codes[color] + 30 if self.class.color_codes[color]\n end", "def rgb_value(red, green, blue)\n [16, *[red, green, blue].zip([36, 6, 1]).map{ |color, mod|\n (6 * (color.to_f / 256)).to_i * mod\n }].inject(:+) \n end", "def <<(color)\n r = [1.0, color.red * color.alpha + self.red].min\n g = [1.0, color.green * color.alpha + self.green].min\n b = [1.0, color.blue * color.alpha + self.blue].min\n a = self.alpha\n UIColor.colorWithRed(r, green:g, blue:b, alpha:a)\n end", "def red\n hsl_to_rgb!\n @attrs[:red]\n end", "def red\n hsl_to_rgb!\n @attrs[:red]\n end", "def get_red_green_color current = 0, total = 0, offset = 0, size = 0\n red = 0\n green = 0\n\n if total <= 0\n red = offset + size / 2\n green = offset + size / 2\n else\n itmd = current * 1.0 / total\n green = itmd * size + offset\n red = (1 - itmd) * size + offset\n end\n\n {\n red: red.ceil.to_s,\n green: green.ceil.to_s\n }\n end", "def normal_color\n #return Color.new(255,255,255)\n end", "def color_type\n @src.color_model.has_alpha ? ARGB : RGB\n end", "def color_type\n @src.color_model.has_alpha ? ARGB : RGB\n end", "def lightness(red, green, blue)\n min, max = [red, green, blue].minmax\n\n (min + max) / (2.0 * 255)\n end", "def red=(num)\n @red = constrain num, 0..255\n end", "def pixel_color_f(c, r)\n c1, c2 = c.floor, c.ceil\n r1, r2 = r.floor, r.ceil\n return pixel_color(c, r) if c1 == c2 && r1 == r2\n \n fq11 = pixel_color(c1, r1)\n fq12 = pixel_color(c1, r2)\n fq21 = pixel_color(c2, r1)\n fq22 = pixel_color(c2, r2)\n\n Pixel.new(\n Interplolate.bilinear(c, r, fq11.red, fq12.red, fq21.red, fq22.red),\n Interplolate.bilinear(c, r, fq11.green, fq12.green, fq21.green, fq22.green),\n Interplolate.bilinear(c, r, fq11.blue, fq12.blue, fq21.blue, fq22.blue),\n )\n end", "def to_rgb\n [@red, @green, @blue]\n end", "def binary\n r, g, b, a = self.to_a\n sum = r + g + b\n return (sum < 382)? self.new_extended_color([0,0,0,a]) : self.new_extended_color([255,255,255,a])\n end", "def color=(new_color)\n\t\t@color = new_color\n\tend", "def color\n @color;\n end", "def color_components\n check_if_opacity_changed\n @color_components ||= if @color.is_a? Color::Set\n # Extract colour component arrays; see +def color=+ where colour set\n # size is enforced\n [\n @color[0].to_a, @color[1].to_a, @color[2].to_a\n ]\n else\n # All vertex colours are the same\n c_a = @color.to_a\n [\n c_a, c_a, c_a\n ]\n end\n end", "def get_green_to_red_scala n\n colors = []\n r = 0; g = 150; b = 0\n max = 255\n\n #se empieza en un g oscuro en 150 y se aclarece añadiendo g hasta 255\n #ni = numero iteraciones\n ni = (1*n/3)\n for i in 1..(1*n/3.to_f).floor\n g = 150 + (i*(max - 150)/ni.to_f).floor\n colors << rgb(r, g, b)\n end\n\n #una vez g esta en 255 se añade r desde 150 hasta 255 hasta llegar a amarillo\n #ni = numero iteraciones\n g = 255\n ni = 1 + (2*n/3.to_f).floor - (1*n/3.to_f).ceil\n for j in (1*n/3.to_f).ceil..(2*n/3.to_f).floor\n i = j - (1*n/3.to_f).ceil + 1\n r = 150 + (i*(max - 150)/ni.to_f).floor\n colors << rgb(r, g, b)\n end\n\n #una vez g y r estan en 255 se quita g hasta 0 hasta llegar a rojo\n #ni = numero iteraciones\n g = r = 255\n ni = 1 + n - (2*n/3.to_f).ceil\n for i in (2*n/3.to_f).ceil..n\n g = ((n - i)*(max/ni.to_f)).floor\n colors << rgb(r, g, b)\n end\n\n #se entrega la escala de verde a rojo\n colors\n end", "def r\n\t\t\tColor.r(@color)\n\t\tend", "def rgb(*args); end", "def rgb(*args); end", "def random_color\n self.color = [\"#80b891\", \"#f89f81\", \"#586576\", \"#f0d2a8\"].sample\n end", "def color\n @attributes[:color]\n end", "def colors() = @colors ||= %i[blue green purple magenta cyan yellow red]" ]
[ "0.694924", "0.69114965", "0.68729544", "0.67646515", "0.6721372", "0.67199606", "0.6663142", "0.66272426", "0.65968627", "0.6506966", "0.6506966", "0.6486075", "0.6451934", "0.6450803", "0.6425849", "0.6425606", "0.64147794", "0.6354385", "0.6292194", "0.6277969", "0.6265991", "0.6245173", "0.6220087", "0.6219866", "0.6218542", "0.62011", "0.62002087", "0.6184479", "0.6172783", "0.61205566", "0.61144865", "0.60996675", "0.6066067", "0.6064553", "0.60601795", "0.60601795", "0.60601795", "0.6057229", "0.6055169", "0.60490495", "0.60490495", "0.6046771", "0.6046771", "0.6046192", "0.6037935", "0.60340333", "0.6032938", "0.6025917", "0.60108745", "0.6009921", "0.6009921", "0.60078627", "0.60003436", "0.5992533", "0.59887356", "0.59811294", "0.5980052", "0.5978691", "0.59777236", "0.5973635", "0.5962858", "0.59580386", "0.5956931", "0.5956931", "0.59484214", "0.59484214", "0.59484214", "0.59484214", "0.59484214", "0.59484214", "0.59477764", "0.59408665", "0.5939308", "0.5932438", "0.59294105", "0.59236485", "0.59157854", "0.59157854", "0.591364", "0.5910754", "0.59092075", "0.59092075", "0.5897594", "0.5881782", "0.5875277", "0.5875277", "0.58719903", "0.58685565", "0.58677804", "0.5862962", "0.5862441", "0.5860497", "0.5859466", "0.58532375", "0.5853192", "0.5852334", "0.5836953", "0.5836953", "0.5836275", "0.5835873", "0.5834269" ]
0.0
-1
PUBLIC METHODS Returns number of link_tracking assocations Only used for reporting purposes
def tracking_total_count link_tracking.count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_links\n @links_count = Link.count\n end", "def number_of_internal_links_to_page(link)\n @ilps[link]\n end", "def total_link_count\n @sitemaps_link_count\n end", "def count_edge\n count = 0\n @f_net.each_with_index do |followees, follower|\n count += followees_of(follower).count\n end\n count\n end", "def collectionobject_link_count(options = {})\n co_count = 0\n MediaFile.where('sourceable_type=? AND resource_id=?', 'collectionobjectLink', self.id).find_each do |rf|\n if rf.access == 1 and rf.display_collectionobject_link == 1\n co_count += 1\n elsif options[:get_hidden]\n co_count += 1\n end\n end\n return co_count\n end", "def number_of_edges\n @pathway.relations.size\n end", "def count_item\n count = 0\n @g_net.each do |followers|\n count += 1 unless !followers or followers.empty?\n end\n count\n end", "def backlink_count(site)\n result = client.execute(\n service.cse.list,\n default_options.merge(\n 'q' => \"link:#{site}\"\n )\n )\n\n result.data.search_information.total_results\n end", "def num_similar_links\n num_elements(\".sim a\")\n end", "def size\n each_advisory_path.count\n end", "def count_links\n @page_source.find_elements(:tag_name, 'a').count\n rescue element_not_found\n with_zero\n end", "def cc_count\n stats = self.association_stats\n stats['cc_conditions'] + stats['cc_loops'] + stats['cc_questions'] +\n stats['cc_sequences'] + stats['cc_statements']\n end", "def size\n @references_to_keys_map.count do |_, ref|\n ref.object\n end\n end", "def num_neighbors\r\n @neighbors.count\r\n end", "def count_of_associated_requests\n self.requests.functional.count\n end", "def route_count\n @routes.size\n end", "def links_total(page)\n\t\tnonadword_count_total(page) + adword_count_total(page)\n\tend", "def edge_count\n @adjacency_list.flatten.count / 2\n end", "def following_count\n sql = \"SELECT count(guid) FROM buddy WHERE relationship=#{Model::Buddy::FOLLOWING} or relationship=#{Model::Buddy::BOTH};\";\n result = @db.execute(sql)\n result[0][0].to_i\n end", "def get_affiliations_count\r\n @summary.affiliations_count\r\n end", "def number_of_related_events(login=nil)\n count_by_frbr(login, :is_related_to, :how_many_events?) \n end", "def number_of_edges\n @adj.values.map(&:length).inject(:+)\n end", "def relation_count(relation)\n relation.unordered.count\n end", "def size\n @list_link.size\n end", "def size\n @list_link.size\n end", "def num_references\n return @num_references unless @num_references.nil?\n @num_references = ((num_references_m1 + 1) % 65536)\n @num_references\n end", "def num_connections\n @num_connections ||= @doc.xpath('/person/num-connections').text\n end", "def reversals_count\n reversals.count\n end", "def fwd_count; @fwd_map.count; end", "def track_count\n @ole.TrackCount\n end", "def insight_counts\n return @insight_counts\n end", "def count\r\n @internal_list.length\r\n end", "def num_answered_calls\n answered_contacts.count\n end", "def num_of_visits\n self.visits.size\n end", "def number_of_fan_bases\r\n self.fan_relationships.count\r\n end", "def num_clicks\n count = 0\n self.visits.each { |user| count += user.visits }\n count\n end", "def count_dead_tracks \n @dead_track_list.length\n end", "def num_clicks\n self.visits.count\n end", "def get_counts\n #1 - @friend_count -> gets the number of current friends you have.\n @friend_count = current_user.active_friends.size\n \n #2 - @pending_count -> gets the number of pending friend requests you have.\n @pending_count = current_user.pending_friend_requests_to.map(&:friend).size\n end", "def master_song_relationships_total\r\n self.master_song_relationships.count\r\n end", "def num_urls\n @client[:urls].count\n end", "def size\n @references.count do |_, ref|\n ref.object\n end\n end", "def count(options = {})\n @owner.ids_for_outbound(@reflection.options[:property]).size\n end", "def track_count\n self.tracks.count\n end", "def popular_links\n result = {}\n urls[0...5].each do |url|\n result[url] = url.num_clicks\n end\n result\n end", "def track_count\n return @tracks.length\n end", "def count_addresses\n self.people.collect { |a| a.address }.count\n end", "def count\n\t\treturn UserAssoziation.where(:assoziation_id => self.id).count\n\tend", "def call_site_count\n @call_sites.size\n end", "def number_of_tracklists\n tracklists.size\n end", "def people_shared_with(link, owner)\n curations = Curation.where(link_id: link.id)\n shared_with = curations.select { |curation| curation.user_id != owner.id }\n shared_with.length\n end", "def related_issue_counts\n self.class.related_issue_counts(self.version_key)\n end", "def count_follower\n\t\t#relationships.count - count_followed\n\n\tend", "def badges_count\n badges.count\n end", "def relationship_answer_count\n return 0 unless id #\n\n ::Relationship.where(metric_card.answer_lookup_field => id).count\nend", "def relationship_answer_count\n return 0 unless id #\n\n ::Relationship.where(metric_card.answer_lookup_field => id).count\nend", "def follow_count\n\t\t\t\tFollow.active.for_follower( self ).count\n \t\t\tend", "def callbacks_count\n model.analyzed_callbacks_count\n end", "def member_count\n attach_info\n @member_count\n end", "def passenger_count()\n return @passengers.size()\n end", "def num_clicks\n visits.count\n end", "def follower_count\n sql = \"SELECT count(guid) FROM buddy WHERE relationship=#{Model::Buddy::FOLLOWER} or relationship=#{Model::Buddy::BOTH};\";\n result = @db.execute(sql)\n result[0][0].to_i\n end", "def peer_check_count\n \n checklist = self.checklist\n\n case self.design.design_type\n when 'New'\n checklist.new_design_peer_check_count\n when 'Dot Rev'\n checklist.bareboard_design_peer_check_count\n end\n\n end", "def ref_count(node)\n @references.fetch(node, 0)\n end", "def num_urls\n @client[URLS_COLLECTION].count\n end", "def enrollee_count\n count = 0\n courses.each do |c|\n count += c.course.all_enrollee_count\n end\n count += extra_enrollees.size\n count\n end", "def num_cookmarks\n user_pointers.count\n end", "def count_user\n count = 0\n @f_net.each do |followees|\n count += 1 unless !followees or followees.empty?\n end\n count\n end", "def update_associated_count\n self.update_kase_responses_count\n self.update_person_responses_count\n end", "def populate_sources_stats\n # Iterate over each of a user's links, adding to the count of the corresponding source\n @user.links.all.each { |link| @sources_stats[link.source.name] += 1 }\n end", "def session_count\n entries.count('attended_session')\n end", "def badge_counter\n @badges.count { |badge| badge == true }\n end", "def num_attendees\n # store a integer that represents the number\n # whenever an attendee is created ->\n # Event.all ( search for the event, incremement number of attendees)\n number_of_attendees = Location.all.select do |location|\n location.event == self\n end.length\n end", "def likes_count\n self.likes.size\n end", "def n_responses\n if Rails.configuration.comments_active then\n\t self.comments.count\n else\n 0\n end\n end", "def check_num_links(rsrc,tag,expect)\n num = rsrc.query([Person,tag]).size\n puts \" #{expect}? #{num == expect}\"\nend", "def hit_count()\n #This is a stub, used for indexing\n end", "def how_many_active_announcements\n return announcements.where('expires_at >= ?', Date.today).count\n end", "def solar_landing_leads_count\n leads.where(call_consented: true).count\n end", "def count_ai_battler\n count = -1\n @battle_info.parties.each do |bank|\n count += bank.size\n end\n log_debug(\"Found #{count} AI\")\n return count\n end", "def count_followed\n\t\t#relationships.where(follower_id: self.id).count\n\tend", "def opened_group_member_notifier_count(limit = ActivityNotification.config.opened_index_limit)\n limit == 0 and return 0\n group_members.opened_only(limit)\n .filtered_by_association_type(\"notifier\", notifier)\n .where(\"notifier_key.ne\": notifier_key)\n .to_a\n .collect {|n| n.notifier_key }.compact.uniq\n .length\n end", "def connections_count(relation_name)\n return Relation.get_connections_count(relation_name, self.node)\n end", "def visitors_count\n self.visitors.count\n end", "def num_followers\n follower_ids = Following.where(:followed_id => self.id).pluck(:follower_id)\n follower_ids.size - 1 #don't count yourself\n end", "def num_custom_lookup_table_entries\n return @num_custom_lookup_table_entries unless @num_custom_lookup_table_entries.nil?\n if flags.has_custom_lookup_table\n @num_custom_lookup_table_entries = (num_custom_lookup_table_entries_m1 + 1)\n end\n @num_custom_lookup_table_entries\n end", "def check_count\n\n count = { :designer => 0, :peer => 0 }\n checklist = self.checklist\n\n case self.design.design_type\n when 'New'\n count[:designer] = checklist.new_design_self_check_count\n count[:peer] = checklist.new_design_peer_check_count\n when 'Dot Rev'\n count[:designer] = checklist.bareboard_design_self_check_count\n count[:peer] = checklist.bareboard_design_peer_check_count\n end\n\n return count\n \n end", "def occurences_count\n\t\t\t\t\t\tHash.new(0).tap do |result|\n\t\t\t\t\t\t each { |item| result[item] += 1 }\n\t\t\t\t\t\tend\n\t\t\t\tend", "def num_allies\n @allies.size\n end", "def get_num_of_join(state)\n count = 0\n @joined.each_value do |v|\n count += 1 if v == state\n end\n return count\n end", "def known_ip_count\n @mutex.synchronize do\n @connections.size\n end\n end", "def company_count\n return 0 unless answer_id\n Relationship.where(answer_id: answer_id).count\nend", "def followers_count\n @target.followers_count.to_i\n end", "def how_many_on_bus\n return @passengers.length\n end", "def completed_check_count\n \n count = { :self => 0, :peer => 0 }\n \n self.checklist.each_check do |check|\n design_check = self.design_checks.detect { |dc| dc.check_id == check.id }\n next if !design_check\n count[:self] += 1 if design_check.self_auditor_checked?\n count[:peer] += 1 if design_check.peer_auditor_checked?\n end\n \n count\n \n end", "def total_entries\n @delegated_to_object.size\n end", "def notification_count\n @notifications.size\n end", "def size\n return @data_achievements.length\n end", "def the_number_of_members\n user_school_relations.count\n end", "def num_of_tracks\n\t\t@tracks.count\t \n\tend" ]
[ "0.6871865", "0.64864355", "0.6403187", "0.6376514", "0.6310534", "0.62912786", "0.614341", "0.6124568", "0.6071571", "0.60666233", "0.6051078", "0.6041124", "0.60318494", "0.6031757", "0.60292643", "0.5957545", "0.59478354", "0.5946964", "0.59419936", "0.59167325", "0.5914114", "0.58730507", "0.58600175", "0.5858353", "0.5858353", "0.58377", "0.58364", "0.5835401", "0.5820505", "0.58175915", "0.5814194", "0.5810221", "0.5802936", "0.5796674", "0.5792621", "0.57598317", "0.5750301", "0.57498354", "0.5744769", "0.5740848", "0.57060355", "0.5695263", "0.56912", "0.56849325", "0.56836414", "0.5681488", "0.5677841", "0.56773853", "0.5674802", "0.5666917", "0.5663174", "0.56612265", "0.5657674", "0.5636228", "0.5619536", "0.5619536", "0.56172115", "0.56111073", "0.56050986", "0.5596934", "0.55935884", "0.5588985", "0.5588128", "0.55699", "0.55642956", "0.5558997", "0.5558619", "0.55549747", "0.555094", "0.5546292", "0.55321777", "0.55287826", "0.55259037", "0.5524468", "0.5522115", "0.55095696", "0.55041873", "0.54946685", "0.54940873", "0.5489553", "0.5484155", "0.54789686", "0.5472907", "0.5472821", "0.5468332", "0.54674196", "0.54660493", "0.5458524", "0.5457658", "0.5456375", "0.5451621", "0.54489607", "0.54434067", "0.54413724", "0.54410595", "0.54355127", "0.54343057", "0.54317284", "0.5431428", "0.54299766" ]
0.7829485
0
Uses Enum method to determine if something is published. Only used in the search params for elasticsearch
def published self.production? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def published?\n [:public, :private].include?(self.status)\n end", "def is_published?\n status === 'published'\n end", "def published?\n status == Status[:published]\n end", "def published?\n (status == PUBLISHED)\n end", "def published?\n (status == PUBLISHED)\n end", "def published?\n (status == PUBLISHED)\n end", "def published?\n (status == PUBLISHED)\n end", "def published?\n (status == PUBLISHED)\n end", "def published?\n !(data.key?(\"published\") && data[\"published\"] == false)\n end", "def published?\n !(data.key?(\"published\") && data[\"published\"] == false)\n end", "def published?\n if self.status == \"live\"\n true\n else\n false\n end\n end", "def published?\n published == true || published == \"1\" || published == \"t\" || published == \"true\"\n end", "def publishable?\n [ UNPUBLISHED, OUT_OF_DATE ].include? flickr_status\n end", "def index\n get_by_published_status(true)\n end", "def unpublished?\n self.status == \"Unpublished\"\n end", "def published_or_not\n self.published = (self.published_at <= Time.now and self.unpublished_at >= Time.now) ? 1 : 0\n end", "def published\n respond_with published_query(true)\n end", "def published?\n self.published\n end", "def not_published_status\n 'Not published'\n end", "def publish_immediately?\n params[:publish_type].to_i > 0\n end", "def published?\n published.eql?(true)\n end", "def can_publish?\n !published_at\n end", "def publish_status_for(m)\n s = if m.upcoming?\n :upcoming\n elsif m.expired?\n :expired\n elsif m.published?\n :published\n else\n :draft\n end\n end", "def is_published?\n self.publishing_state == PublishingState::PUBLISHED\n end", "def is_published(*args)\n # set default args if none passed in\n args = [:live, :draft, :hidden] if args.blank?\n args = args.first if args.first.is_a?(Array)\n \n # the various publish states accepted.\n @publish_states = args.collect{ |state| state.to_s.downcase.to_sym }\n @publish_states_for_validation = args.collect{ |state| state.to_s.downcase }\n \n extend DataMapper::Is::Published::ClassMethods\n include DataMapper::Is::Published::InstanceMethods\n \n # do we have a :publish_status declared\n if properties.any?{ |p| p.name == :publish_status }\n \n # set default value to first value in declaration or the given value\n d = properties[:publish_status].default.blank? ? @publish_states.first.to_s : properties[:publish_status].default\n \n # set the length to 10 if missing or if shorter than 5, otherwise use the given value\n l = 5 if properties[:publish_status].length.blank?\n l = (properties[:publish_status].length <= 10 ? 10 : properties[:publish_status].length)\n \n property :publish_status, String, :length => l, :default => d.to_s\n else\n # no such property, so adding it with default values\n property :publish_status, String, :length => 10, :default => @publish_states.first.to_s \n end\n \n # create the state specific instance methods\n self.publish_states.each do |state|\n define_method(\"is_#{state}?\") do \n self.publish_status == state.to_s\n end\n define_method(\"save_as_#{state}\") do \n self.publish_status = state.to_s\n save\n end\n end\n \n # ensure we are always saving publish_status values as strings\n before :valid? do\n self.publish_status = self.publish_status.to_s if self.respond_to?(:publish_status)\n end\n \n validates_within :publish_status, \n :set => @publish_states_for_validation,\n :message => \"The publish_status value can only be one of these values: [ #{@publish_states_for_validation.join(', ')} ]\"\n \n end", "def published?\n if is_standard?\n respond_to?(:copy_form_published_col) ? copy_form_published_col == 1 : copies.any?(&:published?)\n else\n respond_to?(:form_published_col) ? form_published_col == 1 : forms.any?(&:published?)\n end\n end", "def published?; end", "def published?; end", "def published?\n if is_standard?\n respond_to?(:published_copy_count_col) ? (published_copy_count_col || 0) > 0 : copies.any?(&:published?)\n else\n read_attribute(:published)\n end\n end", "def bulk_published?\n facet_values[\"bulk_published\"].present?\n end", "def trackable?\n published?\n end", "def unpublished?\n (status == UNPUBLISHED)\n end", "def unpublished?\n (status == UNPUBLISHED)\n end", "def unpublished?\n (status == UNPUBLISHED)\n end", "def unpublished?\n (status == UNPUBLISHED)\n end", "def unpublished?\n (status == UNPUBLISHED)\n end", "def publishable?\n self.status == STATUS_PENDING\n end", "def verify_unpublishable_search\n # only logged in users viewing their own resources can search unpublished\n unless logged_in? && params[:user_id].present? && current_user.id == params[:user_id].to_i\n params.merge! published: true\n end\n end", "def published\n if self.delivery_options.publishable.present?\n meth = \"published_by_#{self.delivery_options.publishable.to_s}\"\n return self.send(meth.to_sym)\n end\n where(:published => true)\n end", "def bulk_published\n true\n end", "def is_published?\n return false if self.published_on.nil?\n return true if self.published_on <= Time.now.beginning_of_day\n return false\n end", "def published?\n self.product.try(:published?)\n end", "def can_publish?\n\t\ttrue\n\tend", "def change_status\n @is_published ? false : true\n end", "def published?\n is_standard? ? false : forms.any?(&:published?)\n end", "def publish\n\t\tchanged = !published?\n\t\tself.status = 'published'\n\t\tchanged\n\tend", "def published?\n if self.publish_at < Time.now.utc\n true\n else\n false\n end\n end", "def is_published? obj\n if obj.respond_to?(\"resource_state\") && obj.respond_to?(\"resource_published?\")\n obj.resource_published?\n else\n # if the object does not contain resource_state, we will assume that it is a published un-queued object\n true \n end\n end", "def published?\n !published_at.nil?\n end", "def published?\n self.published_at.present?\n end", "def public_venue\r\n case public\r\n when 1\r\n return true\r\n else\r\n return false\r\n end\r\n end", "def publish\n status_id = STATUSES.index('published')\n set_published_at\n end", "def newly_published?\n !!@newly_published\n end", "def published?\n published_at.present?\n end", "def published?\r\n (publish_at.nil? || (publish_at <=> Time.now) <= 0) && (unpublish_at.nil? || (unpublish_at <=> Time.now) >= 0)\r\n end", "def check_if_published_changed\n if \"published\".in? self.changed\n self.published_at = published ? Time.now : nil\n end\n end", "def published?\n is_published && Time.at(publish_at.to_i).to_datetime <= DateTime.now\n end", "def published?\n !is_privacy_private? && (!builder? || !derived? || mapcapped?)\n end", "def viewable?\n published? || created? || editing?\n end", "def publishable?\n false\n end", "def publish?\n false\n end", "def count_in_published(*args)\n count_in_status(:published, *args)\n end", "def published?\n self.published_at.present?\n end", "def publish_button?\n return false unless params[:button]\n\n [PUBLISH, UNPUBLISH].include? params[:button].upcase\n end", "def publish!\n return true if published?\n publish_status!\n end", "def in_use?\n published? || has_answers? || has_choices?\n end", "def is_published?\n\t !self.is_discontinued? && (Time.now >= Time.parse(self.date_available.to_s))\n\tend", "def published?\n data['published'] != false && (blog_options.publish_future_dated || date <= Time.current)\n end", "def publish\r\n if update_attribute('published', true)\r\n log_activity\r\n true\r\n else\r\n false\r\n end\r\n end", "def check_published\n \n if self.publishing_state == PublishingState::PUBLISHED\n self.publishing_date = Time.now\n self.publishing_publisher = connected_user.username\n end\n\n end", "def toggle_status\n if can_unpublish?\n self.published = !published\n self.save\n else\n return false\n end\n end", "def published?\n !self.versions.published.last.nil?\n end", "def published?\n sys[:publishedAt] ? true : false\n end", "def unpublishable?\n [ UP_TO_DATE, OUT_OF_DATE ].include? flickr_status\n end", "def publish\n self.published = true\n end", "def set_published_state; end", "def published_work?\n true\n end", "def published() @feed.read_attribute(:published); end", "def available?\n published? && published_at <= Time.current\n end", "def publication_status_as_uri\n if type.name == 'journal_article_draft'\n [CONTROLLED_VOCABULARIES[:publication_status].draft, CONTROLLED_VOCABULARIES[:publication_status].submitted]\n elsif type.name == 'journal_article_published'\n [CONTROLLED_VOCABULARIES[:publication_status].published]\n end\n end", "def published?\n published_at && published_at == edited_at\n end", "def published?\n published_at && published_at == edited_at\n end", "def publish!\n @new = true if self.private?\n self.status = statuses.public\n self.save!\n end", "def published?\n # He I don't use the static attr because a finished tip is also published\n !!self.published_at\n end", "def unpublished; end", "def publication_status_as_uri\n case type.name\n when 'journal_article_draft'\n [ControlledVocabulary.era.publication_status.draft,\n ControlledVocabulary.era.publication_status.submitted]\n when 'journal_article_published'\n [ControlledVocabulary.era.publication_status.published]\n end\n end", "def has_simple_search?\n self.search_type.to_s == \"simple\" && !self.is_static?\n end", "def is_published=(value)\n published_date = nil\n # check if value is parsable date\n begin\n published_date = Time.parse(value.to_s)\n rescue\n # otherwise evaluate value, true or false\n published_date = Time.now.beginning_of_day if value\n end\n\n self.published_on = published_date\n end", "def publication_match_in_profile\n @info.available_related_content_types.include? 'emp'\n end", "def unpublished\n respond_with(published_query(false) + Page.where(:published_on.exists => false).all)\n end", "def index\n \n if params[:filter] === 'not published'\n @puns = Pun.all.where(is_published: false).order(:publication_date)\n elsif params[:filter] === 'published'\n @puns = Pun.all.where(is_published: true).order(:publication_date)\n else\n @puns = Pun.all.order(:publication_date)\n end\n \n respond_to do |format|\n # debugger\n format.html\n format.json { render json: @puns, status: 201 } \n end\n\n end", "def published?\n is_public && pcp_step.released?\n end", "def has_any_event\n include InstanceMethods unless @published_events\n @published_events = :any_event_is_ok\n end", "def show\n published_check\n end", "def publication_status(obj, options={})\n return raw toggle_field(obj, \"publish\", 'toggle', options) if obj.date_end_at.nil?\n return raw toggle_field(obj, \"publish\", 'toggle', options) if publish_date?(obj)\n return t(\"expired\") \n end", "def pagable?\n (titular)\n end", "def is_public?\n !@@hide_status_choices.include?(self.status)\n end", "def published_with_inheritance?\n return false unless published?\n return true if teachable_type == 'Course'\n teachable.lecture.published?\n end", "def find_in_published(number, *args)\n with_status_scope :published do\n find(number, *args)\n end\n end", "def has_complex_search?\n self.search_type.to_s == \"complex\" && !self.is_static?\n end" ]
[ "0.7309411", "0.72886", "0.72466534", "0.69474137", "0.69474137", "0.69474137", "0.69474137", "0.69474137", "0.69281846", "0.69281846", "0.68461335", "0.6837029", "0.68340266", "0.6822371", "0.6817957", "0.676112", "0.6760402", "0.6727401", "0.67206055", "0.6714393", "0.66981894", "0.6662015", "0.66330147", "0.66201615", "0.6612357", "0.6529123", "0.65226126", "0.65226126", "0.6446126", "0.6417012", "0.6410438", "0.6402292", "0.6402292", "0.6402292", "0.6402292", "0.6402292", "0.63856715", "0.63801205", "0.6379385", "0.63741934", "0.63580847", "0.6356685", "0.63140863", "0.63020504", "0.6287767", "0.6263528", "0.62359333", "0.6221772", "0.62145054", "0.61889845", "0.6097697", "0.6079846", "0.60616636", "0.6058352", "0.6052703", "0.6051441", "0.604442", "0.60309124", "0.6005889", "0.599652", "0.59954476", "0.5989772", "0.5988547", "0.59824604", "0.59823", "0.596081", "0.59549356", "0.5925763", "0.59207916", "0.5918475", "0.5891437", "0.5889356", "0.5888463", "0.58855456", "0.5884036", "0.58834463", "0.5881747", "0.58735496", "0.58416146", "0.58227104", "0.5820371", "0.5820371", "0.58003557", "0.57997084", "0.5793694", "0.57892156", "0.57776153", "0.57651216", "0.5762897", "0.5759668", "0.57408977", "0.5720792", "0.57161325", "0.56836027", "0.5682335", "0.5680204", "0.5678803", "0.5666207", "0.5655479", "0.56532365" ]
0.57838446
86
Creates keywords for indexing, filtering, search etc.
def keywords attr = [status, name, title_search, subject_list] attr.join(' ') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_keywords\n\n keywords = t(LOCALE_KEYWORDS_KEY, default: SiteMetaInfoDefaults.keywords)\n business_cats = BusinessCategory.pluck(:name).uniq\n\n cats_str = business_cats.empty? ? '' : ', ' + business_cats.join(', ')\n keywords + cats_str\n end", "def generate_keywords\n all_keywords = {\n minions: [],\n tokens: [],\n mechanics: []\n }\n\n pt = plain_text.downcase\n\n Mechanic.names.each do |mechanic|\n next unless pt.include?(\" #{mechanic.downcase}\") || pt.include?(\"#{mechanic.downcase} \")\n\n p mechanic.downcase\n all_keywords[:mechanics].push(mechanic)\n pt.slice!(mechanic.downcase)\n end\n\n Card.names.each do |name|\n next unless pt.include?(\" #{name.downcase}\") || pt.include?(\"#{name.downcase} \")\n\n p Card.find_by(name: name).name\n all_keywords[:minions].push(name)\n pt.slice!(name)\n end\n pt\n end", "def index_keywords!\n all.each { |d| d.index_keywords! }\n end", "def create_keywords(data=nil,generate_objects=false)\n uri = URI.parse(@uri + \"/Keywords\")\n results = post(uri,data,generate_objects)\n end", "def set_keywords\n\t\t\tself.keywords = [title, author, description].map(&:downcase).join(' ')\n\t\tend", "def before_create\n keywords = []\n subkeywords = []\n end", "def set_keywords\n self.search_fields.keys.each do |namespace| \n self._keywords[namespace] = self.search_fields[namespace].map do |field|\n if field.is_a?(Hash) \n field.keys.map do |key|\n attribute = self.send(key)\n method = field[key] \n attribute = [attribute] if !attribute.is_a?(Array) \n method = [method] if !method.is_a?(Array)\n method.map {|m| attribute.map { |a| Util.keywords a.send(m), stem_keywords[namespace], ignore_list[namespace] } }\n end\n else \n value = self[field]\n value = [value] if !value.is_a?(Array)\n value.map {|v| Util.keywords(v, stem_keywords[namespace], ignore_list[namespace]) if v}\n end\n end.flatten.map(&:to_s).select{|f| not f.empty? }.uniq.sort\n \n end\n end", "def set_keywords\n self._keywords = self.search_fields.map do |field|\n if field.is_a?(Hash)\n field.keys.map do |key|\n attribute = self.send(key)\n method = field[key]\n if attribute.is_a?(Array)\n if method.is_a?(Array)\n method.map {|m| attribute.map { |a| KeywordsExtractor.extract a.send(m) } }\n else\n attribute.map(&method).map { |t| KeywordsExtractor.extract t }\n end\n else\n KeywordsExtractor.extract(attribute.send(method))\n end\n end\n else\n KeywordsExtractor.extract(self.send(field))\n end\n end.flatten.compact.sort\n end", "def keywords_for_index(_item)\n []\n end", "def keywords\n @keywords_accessed = true\n @keywords\n end", "def index_keywords!\n all.each { |d| d.index_keywords! ? MongoidSearch::Log.green(\".\") : MongoidSearch::Log.red(\"F\") }\n end", "def keywords( *args )\n @allowed_keywords = Array([*args])\n end", "def required_keywords; end", "def keywords_field= params\n\t\t\t\ttmp = params.uniq\n\t\t\t\tself.keywordings.each do |k|\n\t\t\t\t\tself.keywords.delete(k.keyword) unless tmp.delete(k.keyword.name)\n\t\t\t\tend\n\t\t\t\ttmp.each do |keyword_name|\n\t\t\t\t\tkeyword = Keyword.find(:first, :conditions => { :name => keyword_name }) || Keyword.new(:name => keyword_name)\n\t\t\t\t\tself.keywordings.build(:keyword => keyword)\n\t\t\t\tend\n\t\t\tend", "def keywords\n return nil unless @doc.keywords\n \n keywords = @doc.keywords[0..(NUM_KEYWORDS-1)].join(\", \")\n mark(keywords)\n end", "def set_keywords\n # keywords = '' -> can't write this way because keywords will only be a\n # local variable and won't reference the model's property. would work if\n # we were wanting to read only but not for property assignment\n self.keywords = [title, author, description].map(&:downcase).join(' ')\n # &: is symbol to proc\n # it knows that the variables in the array are referring to properties on\n # self\n end", "def index_keywords!\n update_attribute(:_keywords, set_keywords)\n end", "def meta_keywords\n keywords = [\"coin collecting, coin collecting software, free coin collecting software, coins, usa coins, us coins, coin photos\"]\n if @coin and !@coin.new_record?\n keywords << [@coin.meta_keywords]\n end\n raw keywords.join(\",\")\n end", "def keyword\n\t\t\tlegal = legal_record_type_id == 0 ? legal_record_type.name : custom_legal_record_type\n\t\t\talley = is_alley == 1 ? 'Hẻm' : 'Mặt tiền'\n\n\t\t\tkeyword = \n\t\t\t\t\"#{name}, #{purpose.name} #{real_estate_type.name} quận #{district.name}, #{real_estate_type.name} #{legal}, #{real_estate_type.name} #{alley}, #{alley} quận #{district.name}, #{street.name} quận #{district.name}, #{purpose.name}, #{province.name}, #{real_estate_type.name}, #{legal}\"\n\t\tend", "def generate_keyword_constructor(arguments)\n params = arguments.map do |arg_name, required|\n if required\n \"#{arg_name}:\"\n else\n \"#{arg_name}: __constructor_default(:#{arg_name})\"\n end\n end\n\n <<-SRC\n def with(#{params.join(\", \")})\n self.new(#{arguments.keys.join(\", \")})\n end\n SRC\n end", "def keywords(keywords)\n ensure_valid_parameter('keywords', keywords, lambda {|k| k.is_a? Array or k.is_a? String})\n keywords = keywords.join(' ') if keywords.is_a? Array\n @request[:keywords] = keywords\n self\n end", "def meta_keywords\n keywords = [] # keywords = [\"one, two, three\"]\n if @category and !@category.new_record?\n keywords << [@category.title]\n end\n if @post and !@post.new_record?\n keywords << [@post.title, @post.subtitle]\n end\n keywords.join(\",\")\n end", "def keywords\n self.to_s.downcase.split(SPLIT_REGEXP).uniq\n end", "def test_keyword_index_builder\n CEdictImporter.create_headword_index\n end", "def keywords\n @emphasis[:stemming] = use_stemming?\n\n keywords = Keywords.new\n\n Keywords.find_keywords(processed_content, wordlist, word_pattern).each do |text|\n text = text.to_s\n text = text.stem if @emphasis[:stemming]\n\n if not (text.match(/^[\\d]+(\\.[\\d]+){0,1}$/) or text.length <= 2)\n keywords << Highscore::Keyword.new(text, weight(text))\n elsif allow_short_words\n keywords << Highscore::Keyword.new(text, weight(text))\n end\n end\n\n keywords\n end", "def keywords\n [self.keyword]\n end", "def generate_new_keyword_set_from_kernel\n write_keywords_on_file(find_keywords_in_kernel)\n Mapper::EngineParameter.generate_new_version_from_file(type)\n end", "def BuildKeywords(query, index, hits)\n assert { query.instance_of? String }\n assert { index.instance_of? String }\n assert { hits.instance_of?(TrueClass) || hits.instance_of?(FalseClass) }\n \n # build request\n request = Request.new\n # v.1.0 req\n request.put_string query # req query\n request.put_string index # req index\n request.put_int hits ? 1 : 0\n\n response = PerformRequest(:keywords, request)\n \n # parse response\n begin\n res = []\n nwords = response.get_int\n 0.upto(nwords - 1) do |i|\n tokenized = response.get_string\n normalized = response.get_string\n \n entry = { 'tokenized' => tokenized, 'normalized' => normalized }\n entry['docs'], entry['hits'] = response.get_ints(2) if hits\n \n res << entry\n end\n rescue EOFError\n @error = 'incomplete reply'\n raise SphinxResponseError, @error\n end\n \n return res\n end", "def add_keywords(keyword_titles)\n self.keywords = []\n keyword_titles.each do |keyword_title|\n keyword = Keyword.where(title: keyword_title).first_or_create\n self.keywords << keyword\n end\n self.keywords = self.keywords.uniq\n end", "def meta_keywords\n\t\t\"Add your keywords here. Find me in application_helper.rb\"\n\tend", "def get_meta_keywords(include_color, include_defaults)\n name = self.name_from_taxon\n name = \"\" if name.blank?\n loc = self.location\n loc = \"\" if location.blank?\n ptypes = self.product_types\n ptypes = \"\" if ptypes.blank?\n #abt = self.about\n #abt = \"\" if abt.blank?\n #name + \", \" + loc + \", \" + ptypes + \",\" + abt + \",\" + Spree::Config[:default_meta_keywords]\n name + \", \" + loc + \", \" + ptypes\n end", "def keywords\n keywords = []\n metadata[dataset_uri][dcat.keyword.to_s].each do |k|\n keywords << k\n end\n rescue\n []\n end", "def conditions_for_keywords\n sql = []\n params = []\n\n keywords.each do |kw|\n str = \"lower(tasks.name) like ?\"\n str += \" or lower(tasks.description) like ?\"\n sql << str\n 2.times { params << \"%#{ kw.word.downcase }%\" }\n end\n\n sql = sql.join(\" or \")\n res = TaskFilter.send(:sanitize_sql_array, [ sql ] + params)\n return \"(#{ res })\" if !res.blank?\n end", "def initialize\n @words = (KEYWORDS + OTHERS).map(&:downcase)\n end", "def keywords\n my_nodes_tagged(:querykeywordexpr)\n end", "def keywords\n my_nodes_tagged(:querykeywordexpr)\n end", "def optional_keywords; end", "def extract_keywords\n self.keywords = Alice::Parser::NgramFactory.filtered_grams_from(self.text).flatten.uniq\n end", "def rest_keywords; end", "def initialize_keywords\n variants = []\n search_queries.each do |sq|\n variants << sq.keyword\n variants += sq.variants\n end\n\n update_column(:keywords, variants.uniq)\n end", "def keywords\n get_keywords.flatten.uniq\n end", "def create_keyword_categories(data=nil,generate_objects=false)\n uri = URI.parse(@uri + \"/KeywordCategories\")\n results = post(uri,data,generate_objects)\n end", "def get_keywords\r\n\t@keywords = Keyword.all\r\n\t@keywords.sort! { |a, b| a.name <=> b.name }\r\n end", "def keywords\n ks = Keyword.where(meta_key_id: id)\n if keywords_alphabetical_order\n ks.order('keywords.term ASC')\n else\n ks.order('keywords.position ASC')\n end\n end", "def keywords\n @entries.keys.sort # sorts keys to alphabetical \n end", "def set_keywords\n product_keywords ? product_keywords.join(', ') : ''\n end", "def set_keywords\n product_keywords ? product_keywords.join(', ') : ''\n end", "def set_keywords\n product_keywords ? product_keywords.join(', ') : ''\n end", "def create_keyword_instance(name, card)\n case name.downcase\n # Expansions\n when 'Base'.downcase\n CardKeyword.create!({\n name: 'Base (1st Edition)',\n category: 'Expansion',\n description: 'First release of Dominion (2008).',\n card: card\n })\n # Card types\n when 'Action'.downcase\n CardKeyword.create!({\n name: 'Action',\n category: 'Card Type',\n description: 'Standard card type',\n card: card\n })\n when 'Reaction'.downcase\n CardKeyword.create!({\n name: 'Reaction',\n category: 'Card Type',\n description: 'Can be played after another player plays an Attack card',\n card: card\n })\n when 'Attack'.downcase\n CardKeyword.create!({\n name: 'Attack',\n category: 'Card Type',\n description: 'Causes a negative effect to all other players.',\n card: card\n })\n when 'Victory'.downcase\n CardKeyword.create!({\n name: 'Victory',\n category: 'Card Type',\n description: 'Award victory points at the end of the game.',\n card: card\n })\n # Subtypes\n # Attack Subtypes\n when 'Handsize Attack'.downcase\n CardKeyword.create!({\n name: 'Handsize Attack',\n category: 'Subtype',\n description: 'Forces players to discard cards.',\n card: card\n })\n when 'Deck Inspection Attack'.downcase\n CardKeyword.create!({\n name: 'Deck Inspection Attack',\n category: 'Subtype',\n description: 'Allows you to see other player\\'s cards and choose whether they keep or discard them.',\n card: card\n })\n when 'Trashing Attack'.downcase\n CardKeyword.create!({\n name: 'Trashing Attack',\n category: 'Subtype',\n description: 'Forces other players to trash cards.',\n card: card\n })\n when 'Curser'.downcase\n CardKeyword.create!({\n name: 'Curser',\n category: 'Subtype',\n description: 'Gives other players curse cards.',\n card: card\n })\n\n\n # Trasher Subtypes\n when 'Trash-For-Benefit'.downcase\n CardKeyword.create!({\n name: 'Trash-For-Benefit',\n category: 'Subtype',\n description: 'Allow you to trash a card and gain an additional benefit.',\n card: card\n })\n\n # Archetypes\n when 'Blocker'.downcase\n CardKeyword.create!({\n name: 'Blocker',\n category: 'Archetype',\n description: 'Nullifies the effects of Attacks against you.',\n card: card\n })\n when 'Sifter'.downcase\n CardKeyword.create!({\n name: 'Sifter',\n category: 'Archetype',\n description: 'Enables players to cycle through junk cards in their deck faster.',\n card: card\n })\n\n when 'Trasher'.downcase\n CardKeyword.create!({\n name: 'Trasher',\n category: 'Archetype',\n description: 'Allows player to remove one or more cards from their deck.',\n card: card\n })\n when 'Deck Discarder'.downcase\n CardKeyword.create!({\n name: 'Deck Discarder',\n category: 'Archetype',\n description: 'Allows you to discard your deck, allowing you to draw recently bought cards more quickly.',\n card: card\n })\n when '+Buy'.downcase\n CardKeyword.create!({\n name: '+Buy',\n category: 'Archetype',\n description: 'Grants you one or more additional Buys',\n card: card\n })\n when 'Gainer'.downcase\n CardKeyword.create!({\n name: 'Gainer',\n category: 'Archetype',\n description: 'Allows you to obtain a Card during your Action Phase without consuming a Buy.',\n card: card\n })\n when \"One-Shot\".downcase\n CardKeyword.create!({\n name: 'One-Shot',\n category: 'Archetype',\n description: 'Card that can only be played once, then is removed from your deck.',\n card: card\n })\n when 'Smithies'.downcase\n CardKeyword.create!({\n name: 'Smithies',\n category: 'Archetype',\n description: 'Allows you to draw 2 or more cards.',\n card: card\n })\n when 'Virtual Coin'.downcase\n CardKeyword.create!({\n name: 'Virtual Coin',\n category: 'Archetype',\n description: 'Non-Treasure card that gives Coins on the turn it is played.',\n card: card\n })\n when 'Throne Room'.downcase, 'Duplicator'.downcase\n CardKeyword.create!({\n name: 'Throne Room',\n category: 'Archetype',\n description: 'Duplicates the effect of another card.',\n card: card\n })\n when 'Draw'.downcase\n CardKeyword.create!({\n name: 'Draw',\n category: 'Archetype',\n description: 'Draws you two or more cards.',\n card: card\n })\n when 'Digger'.downcase\n CardKeyword.create!({\n name: 'Digger',\n category: 'Archetype',\n description: 'Searches the deck for a particular card type',\n card: card\n })\n # Terminality\n when 'Non-Terminal'.downcase\n CardKeyword.create!({\n name: 'Non-Terminal',\n category: 'Terminality',\n description: 'Refunds the Action spent to use this card, allowing additional Action cards to be played.',\n card: card\n })\n when 'Terminal'.downcase\n CardKeyword.create!({\n name: 'Terminal',\n category: 'Terminality',\n description: 'Consumes the Action spent to use this card.',\n card: card\n })\n when 'Village'.downcase, 'Splitter'.downcase\n if(CardKeyword.where(name: 'Splitter / Village').any?)\n return\n end\n \n CardKeyword.create!({\n name: 'Splitter / Village',\n category: 'Terminality',\n description: 'Refunds the Action spent to use this card plus provides one or more additional Actions.',\n card: card\n })\n when 'Cantrip'.downcase\n CardKeyword.create!({\n name: 'Cantrip',\n category: 'Terminality',\n description: 'Refunds the Action spent to use this card and draws you an additional card, effectively taking up no space in your deck.',\n card: card\n })\n # Strategies\n when 'Trashing'.downcase, 'Deckthinning'.downcase\n CardKeyword.create!({\n name: 'Deckthinning / Trashing',\n category: 'Strategy',\n description: 'Removing as many low-value cards from your deck as possible to more consistently draw your strongest cards.',\n card: card\n })\n when 'Engine'.downcase\n CardKeyword.create!({\n name: 'Engine',\n category: 'Strategy',\n description: 'Focusing on extra actions and card draw to build towards big turns that combo multiple effects.',\n card: card\n })\n when 'Rush'.downcase\n CardKeyword.create!({\n name: 'Rush',\n category: 'Strategy',\n description: 'Attempt to end the game early by depleting victory card piles as fast as possible.',\n card: card\n })\n when 'Alt-VP'.downcase\n CardKeyword.create!({\n name: 'Alt-VP',\n category: 'Strategy',\n description: 'Focus on obtaining victory points through card effects rather than traditional victory cards.',\n card: card\n })\n when 'Big Money'.downcase\n CardKeyword.create!({\n name: 'Big Money',\n category: 'Strategy',\n description: 'Focus on high-value Treasure cards and card draw.',\n card: card\n })\n else\n raise \"Invalid keyword creation request. Params name: '#{name}' card: '#{card}'\"\n end\nend", "def the_keywords\n k = object.get_option(\"keywords\", \"\")\n k = h.current_site.the_keywords if object.class.name != \"CamaleonCms::Site\" && !k.present?\n k.to_s.translate(get_locale)\n end", "def its_keywords\n spec_keywords(\"its\")\n end", "def keywords\n response = request :keywords\n keywords = Hash.new\n response[\"labels\"].each do |label|\n keywords[label[\"keyword\"]] = label[\"content\"]\n end\n keywords\n end", "def keywords\n\t\t\t\treturn [\n\t\t\t\t\tsuper,\n\t\t\t\t\t@data['keywords_self'],\n\t\t\t\t\tPLAYER.current_room.keywords_neighbors(get_classname)\n\t\t\t\t].flatten.reject { |x| !x }\n\t\t\tend", "def keyword\n\n @search_text = params[\"search_text\"] ||= \"\"\n\n add_breadcrumb \"Keyword Search: '#{@search_text}'\"\n\n if @search_text.blank? or @search_text.length < 2\n @keyword_search_results = KeywordSearchIndex.where(\"1 = 2\")\n else\n\n # here we build the query one clause at a time based on the input params. The query\n # is of the form:\n #\n # where organization_id IN (?) AND (search_text LIKE ? OR search_text_like ? OR ... )\n\n where_clause = 'organization_id IN (?) AND ('\n values = []\n # The organization is scoped to search across all objects that are owned by\n # the user's list of organizations\n orgs = @organization_list.dup\n # add org = 0 to get objects that are not indexed by org and are by\n # contract available to users of all organizations\n orgs << 0\n values << orgs\n\n search_params = []\n @search_text.split(\",\").each_with_index do |search_string|\n search_params << 'search_text LIKE ?'\n values << \"%#{search_string.strip}%\"\n end\n\n where_clause << search_params.join(' OR ')\n where_clause << ')'\n\n @keyword_search_results = KeywordSearchIndex.where(where_clause, *values)\n\n end\n\n @num_rows = @keyword_search_results.count\n cache_list(@keyword_search_results, INDEX_KEY_LIST_VAR)\n\n respond_to do |format|\n format.html\n format.json {\n render :json => {\n :total => @num_rows,\n :rows => data\n }\n }\n end\n\n end", "def keywords\r\n @@words.keys.sort\r\nend", "def keyword!(keyword_ids:)\n action = mirrored_with_taggings? ? :build : :create\n keyword_ids.each { |id| taggings.send(action, tag_id: id) }\n end", "def index\n kw = Keyword.find(params[:kw].to_i) unless params[:kw].nil?\n @ideas = Idea.all\n @keywordname = \"\" if kw.nil?\n @keywordname = kw.name + \" - \" unless kw.nil?\n @indexideas = Idea.all if kw.nil?\n @indexideas = Idea.all.select{ |i| i.keywords.include?(kw)} if not kw.nil?\n\n# This section adds filtering to keyword bar, customer doesn't want it anymore\n=begin\n @keywords = []\n @indexideas.each do |i|\n i.keywords.each do |k| \n @keywords << k\n end\n \n order = params[:order] || 'id'\n\n case order\n when 'id' then @indexideas.sort_by!{ |b| b.id }\n end\n end\n=end\n# replaced by @keywords = Keyword.all\n @keywords = Keyword.all\n\n @keywords = @keywords.inject([]){ |result, h| result << h unless result.include?(h); result }\n @words = @keywords unless kw.nil?\n \n order = params[:order] || 'name'\n\n case order\n when 'name' then @words.sort_by!{ |b| b.name }\n end\n \n # this new idea needed when there is no related keyword to form new idea partial\n @idea = Idea.new\n \n \n end", "def meta_keywords\n # Change the value below between the quotes.\n \"ezonline, ez troubleshooter, repository\"\n end", "def set_Keywords(value)\n set_input(\"Keywords\", value)\n end", "def keywords(page_keywords) \n content_for(:keywords){\"<meta name=\\\"keywords\\\" content=\\\"#{page_keywords}\\\" />\\n\"} \n end", "def setKeywords(keywords)\n @fields['keywords'] = keywords\n self\n end", "def setKeywords(keywords)\n @fields['keywords'] = keywords\n self\n end", "def setKeywords(keywords)\n @fields['keywords'] = keywords\n self\n end", "def setKeywords(keywords)\n @fields['keywords'] = keywords\n self\n end", "def meta_keywords(*args)\n if args.any?\n @meta_keywords = Array(args.first).join(\", \")\n else\n keywords = @meta_keywords\n keywords ||= @page.tag_list if @page&.tags&.any?\n strip_tags(keywords)\n end\n end", "def search_keywords\n @categories = params[:categories]\n @project_id = params[:project_id]\n if @categories.present?\n categories_array = @categories.split(/,/)\n categories_array.map! { |x| x.strip }\n categories_array.reject! { |x| x.blank? }\n categories_array.uniq!\n else\n categories_array = []\n end\n @search_keyword = params[\"search\"]\n if(!@search_keyword.blank?)\n @search_keyword = @search_keyword.strip\n @search_keyword = @search_keyword.split(\" \").join(\" \")\n end\n @similar_keywords =\n Keyword.get_similar_keywords(@search_keyword, categories_array)\n @categories = categories_array.join(\", \")\n end", "def keywords(limit = 20)\n @keywords ||= {}\n @keywords[limit] ||= begin\n list = []\n count = 0\n _stopwords = Vidibus::Words.stopwords(*locales)\n for word in sort\n clean = word.permalink.gsub('-','')\n unless _stopwords.include?(clean)\n list << word\n count += 1\n break if count >= limit\n end\n end\n list\n end\n end", "def keyword\n values = super\n values = MetadataHelper.ordered( ordered_values: self.keyword_ordered, values: values )\n return values\n end", "def keyword\n values = super\n values = MetadataHelper.ordered( ordered_values: self.keyword_ordered, values: values )\n return values\n end", "def hooks_params_keywords\n hooks_keywords = {}\n hooks.each do |hook, value|\n values = split_word(value)\n hooks_keywords[hook] = values\n end\n hooks_keywords\n end", "def create_search_index\n #Notice the assoction on article.user.id\n TaggyMcFaggy.create_index :attribute_namespace => :article_text,\n :document_id => id,\n :words => text_content,\n :association => user.id\n \n end", "def build_keyword_list(s, heading)\n \n a = s.split.uniq.flat_map do |raw_word|\n\n i, pos = 0, []\n\n w = raw_word[/\\w{2,}/]\n \n next if IGNOREWORDS.include? w\n next unless w\n\n (pos << (s[i..-1] =~ /#{w}/i); i += pos[-1] + 1) while s[i..-1][/#{w}/i]\n\n pos[1..-1].inject([pos[0]]) {|r,x| r << r.last + x + 1 }\n\n pos.map do |x| \n \n start = x-15\n start = 0 if start < 0\n snippet = make_snippet(s, start)\n \n \"[%s] %s | %s %s\" % [heading, snippet, w.downcase, \n heading.scan(/\\w+/).join(' ').downcase]\n end\n\n\n end\n \n a\n \n end", "def keyword_query_string\n processed_terms = []\n self.search_terms.each do |search_val|\n # spaces or dashes (-) need to be quoted to be treated as single values\n term = search_val.match?(/[\\s-]/) ? \"\\\"#{search_val}\\\"\" : search_val\n processed_terms << term\n end\n processed_terms.join(' ')\n end", "def index\n @keywords = Keyword.rank.page params[:page]\n @keyword_indices = KeywordIndex.all\n end", "def keywords(page_keywords)\n content_for(:keywords) do\n \"<meta name=\\\"keywords\\\" content=\\\"#{page_keywords}\\\" />\\n\"\n end\n end", "def keywords(page_keywords)\n content_for(:keywords) do\n \"<meta name=\\\"keywords\\\" content=\\\"#{page_keywords}\\\" />\\n\"\n end\n end", "def index\n @keywords = Keyword.all\n end", "def index\n @keywords = Keyword.all\n end", "def index\n @keywords = Keyword.all\n end", "def index\n @keywords = Keyword.all\n end", "def index\n @keywords = Keyword.all\n end", "def index\n @keywords = Keyword.all\n end", "def index\n @keywords = Keyword.all\n end", "def keyword\n values = super\n values = Deepblue::MetadataHelper.ordered( ordered_values: keyword_ordered, values: values )\n return values\n end", "def named_keywords(key: 42)\n p key\nend", "def index\n @spec_keywords = SpecKeyword.all\n end", "def example_group_keywords\n spec_keywords(\"it\")\n end", "def initialize(keywords, search_index = \"Books\", region = :uk)\n super()\n\n self.keywords = keywords\n self.search_index = search_index\n self.operation = \"ItemSearch\"\n self.region = region\n end", "def key_words\n # because dollar signs don't work we can't display a $ sign in the keyword\n # list so its not explicitly clear what the keyword\n variables = scope.to_hash.keys\n # prepend a :: to topscope variables\n scoped_vars = variables.map { |k, _v| scope.compiler.topscope.exist?(k) ? \"$::#{k}\" : \"$#{k}\" }\n PuppetDebugger::InputResponders::Functions.instance.debugger = self\n funcs = PuppetDebugger::InputResponders::Functions.instance.func_list\n PuppetDebugger::InputResponders::Datatypes.instance.debugger = self\n (scoped_vars + funcs + static_responder_list + PuppetDebugger::InputResponders::Datatypes.instance.all_data_types).uniq.sort\n end", "def create_keyword_lists(options = {})\r\n # Prepare query url.\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/keyword/lists.json'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare form parameters.\r\n _parameters = {\r\n 'page' => options['page'],\r\n 'pagesize' => options['pagesize'],\r\n 'Keyword' => options['keyword'],\r\n 'Shortcode' => options['shortcode']\r\n }\r\n _parameters = APIHelper.form_encode_parameters(_parameters)\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.post(\r\n _query_url,\r\n parameters: _parameters\r\n )\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n\r\n # Return appropriate response type.\r\n _context.response.raw_body\r\n end", "def map_keywords(keywords)\n keywords.inject({}) do |out, keyvalue|\n key, value = keyvalue\n out.merge({ KEYWORDS[key.to_sym], value.to_s })\n end\nend", "def set_args\n get_keywords.join(\"\\\\|\")\n end", "def render_keywords(tags)\n keywords = TextNormalizer.normalize_keywords(meta_tags.extract(:keywords))\n normalized_meta_tags[:keywords] = keywords\n tags << Tag.new(:meta, :name => :keywords, :content => keywords) if keywords.present?\n end", "def set_keyword\n journal = Journal.find(params[:journal_id])\n issue = journal.issues.find(params[:issue_id])\n article = issue.articles.find(params[:article_id])\n @keyword = article.keywords.find(params[:id])\n end", "def set_keywords=(value)\n self.product_keywords = value ? value.split(',').map{|w| w.strip} : []\n end", "def set_keywords=(value)\n self.product_keywords = value ? value.split(',').map{|w| w.strip} : []\n end", "def set_keywords=(value)\n self.product_keywords = value ? value.split(',').map{|w| w.strip} : []\n end", "def keywords(obj)\n dirty_words = %w[ip browser created_at updated_at id]\n obj.class.properties.map(&:name)\n .reject { |v| dirty_words.include?(v.to_s) }\n .map { |var| obj.instance_variable_get(\"@%s\" % var).to_s }\n .join(\" \")\n end", "def tags\n records.each do |record|\n KEYWORDS_TAGGER.each do |name, keywords|\n record[name] = keywords.find {|keyword| record[:text].include?(keyword) }\n end\n end\n end", "def keywords\n @keywords ||= keyword_class.find(:all, :params => {\n :watched_domain_id => self.id })\n end" ]
[ "0.7500841", "0.7032309", "0.70204914", "0.70127857", "0.69941574", "0.6860696", "0.68050075", "0.6763526", "0.6738273", "0.6667183", "0.6640339", "0.6611523", "0.66000867", "0.65977585", "0.6579472", "0.6568702", "0.65630233", "0.6542726", "0.6499553", "0.6499068", "0.64887434", "0.64682573", "0.63906074", "0.63887906", "0.6383843", "0.63473064", "0.63349897", "0.63345957", "0.63291067", "0.632558", "0.62849146", "0.62690765", "0.6212803", "0.62117964", "0.6206081", "0.6206081", "0.62022233", "0.6133532", "0.61071956", "0.61064005", "0.6089509", "0.6069498", "0.6060544", "0.6051835", "0.605085", "0.6049823", "0.6049823", "0.6049823", "0.60454607", "0.60326916", "0.60214186", "0.6019172", "0.6002123", "0.5990481", "0.5972482", "0.5955358", "0.5944303", "0.5940644", "0.5929836", "0.5927056", "0.5910836", "0.5910836", "0.5910836", "0.5910836", "0.5909183", "0.5907646", "0.59044284", "0.58936983", "0.58936983", "0.5887871", "0.58831394", "0.5879108", "0.5877501", "0.5870147", "0.58543885", "0.58543885", "0.58186734", "0.58186734", "0.58186734", "0.58186734", "0.58186734", "0.58186734", "0.58186734", "0.5815907", "0.5814761", "0.5808397", "0.5803266", "0.5799663", "0.57832646", "0.5762513", "0.57487607", "0.5747993", "0.57459533", "0.5707159", "0.5693236", "0.5693236", "0.5693236", "0.5689411", "0.5686488", "0.56858194" ]
0.6759638
8
Creates comma seperated list of subjects.
def subject_list list = [] subjects.each { |subject| list << subject.name } list.to_sentence end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subjects_column\n list = []\n subjects.each { |subject| list << subject.name }\n list.join(';')\n end", "def format_final_subject(subjects)\n if subjects.size == 1\n subjects[0]\n elsif subjects.size == 2\n subjects[0] + ' and ' + subjects[1]\n else\n last_subject = subjects.pop()\n subjects.join(', ') + ' and ' + last_subject\n end\n end", "def subjects\r\n subjects = []\r\n range =\"#{group[:first_message]}-\"\r\n connection.query(:xhdr, \"Subject\", range) do |status, data|\r\n if status[:code] == 221\r\n data.each do |line|\r\n message = Message.new\r\n message.num, message.subject = line.split(' ', 2)\r\n subjects << message\r\n end\r\n end\r\n end\r\n subjects\r\n end", "def subjects_for_csv\n roots = []\n if comments.any?\n comments.map do |comment|\n roots += comment.subjects.roots\n end\n end\n if roots.empty?\n structures.map do |structure|\n roots += structure.subjects.roots\n end\n end\n subjects_to_array_for_csv roots.uniq.map(&:name)\n end", "def subjectify(options = {})\n result = []\n all_subjects = []\n sub_array = []\n options[:value].each_with_index do |subject, i|\n spl_sub = subject.split(QUERYSEP)\n sub_array << []\n subject_accum = ''\n spl_sub.each_with_index do |subsubject, j|\n spl_sub[j] = subject_accum + subsubject\n subject_accum = spl_sub[j] + QUERYSEP\n sub_array[i] << spl_sub[j]\n end\n all_subjects[i] = subject.split(QUERYSEP)\n end\n options[:value].each_with_index do |_subject, i|\n lnk = ''\n lnk_accum = ''\n all_subjects[i].each_with_index do |subsubject, j|\n lnk = lnk_accum + link_to(subsubject,\n \"/?f[subject_facet][]=#{CGI.escape sub_array[i][j]}\",\n class: 'search-subject', title: \"Search: #{sub_array[i][j]}\")\n lnk_accum = lnk + content_tag(:span, SEPARATOR, class: 'subject-level')\n end\n result << sanitize(lnk)\n end\n result\n end", "def subject_list_for_autocomplete\n subject_list = \"[\"\n all_subjects do |subject|\n subject_list+=\"{label:\\\"#{subject.to_s}\\\",title:\\\"#{subject.title}\\\",value:\\\"#{subject.code}\\\"},\\n\"\n subject_list << { :label => \"#{subject.to_s}\",\n :title => \"#{subject.title}\",\n :value => \"#{subject.code}\" }\n end\n subject_list += \"]\"\n end", "def subjects\n subjects_array = object.syncable_subjects.to_a\n\n return subjects_array unless object.is_send?\n\n subjects_array << Subject.new(subject_code: \"U3\", subject_name: \"Special Educational Needs\")\n\n subjects_array\n end", "def subjects\n bib_subjects || get_item_data_by_name('Subject')\n end", "def subjects(list=[], root=@result.at_css('article-meta article-categories'), prefix = nil)\n return unless root\n subj_node = root.at_css('> subject')\n\n subj_text = subj_node && subj_node.text\n\n if subj_text.present?\n prefix = [prefix, subj_text].compact.join(\" - \")\n list << prefix\n end\n\n root.css('> subj-group').each do |node|\n subjects(list, node, prefix)\n end\n\n list.presence\n end", "def subjects\n curriculums = self.curriculums\n out = []\n\n unless curriculums.empty?\n qualifications = curriculums.collect{ |c| c.qualification }\n\n unless qualifications.empty?\n out = qualifications.collect{ |q| q.subject }\n end\n end\n\n out\n end", "def subject_names\n ret = []\n if cn = self.subject_component('CN')\n ret << cn\n end\n # Merge in san_names if we got anything.\n if sn = self.san_names\n ret.concat(sn)\n end\n\n return ret.sort.uniq\n end", "def subject_names\n @subject_names ||= sw_subject_names\n end", "def message_subjects\n list = []\n active_div.divs(:class=>\"inbox_subject\").each do |div|\n list << div.text\n end\n return list\n end", "def subjects\n links = frm.table(:class=>\"listHier\").links.find_all { |link| link.title=~/View announcement/ }\n subjects = []\n links.each { |link| subjects << link.text }\n return subjects\n end", "def get_subject\n out = ''\n if aggregate_count > 1 #multiple records of any type\n if type_count > 1 #multiple types of records\n if distinct_aggregate_count > 1 #multiple profiles\n others = (distinct_aggregate_count-1)\n out << \"and #{pluralize(others, 'other')} \"\n out << subject_aggregate.sub('was ','were ')\n out << \" #{type_count} times\"\n else\n out << subject_aggregate\n out << \" #{type_count} times\"\n end\n else\n if distinct_aggregate_count > 1 #multiple profiles\n others = (distinct_aggregate_count-1)\n out << \"and #{pluralize(others, 'other')} \"\n out << subject.sub('was ','were ')\n else\n out << subject\n end\n end\n else\n out << subject\n end\n return out.html_safe\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 create_subjects_json(subject_list)\n subjects_json = []\n subject_list.each do |subj|\n subjects_json << subj.as_json\n end\n { 'subjects' => subjects_json }.to_json\nend", "def subscribers_to_s\n subscribers.map { |subscriber|\n \"#{subscriber.name}<#{subscriber.email}>\"\n }.join(\", \")\n end", "def sw_subject_titles(sep = ' ')\n result = []\n mods_ng_xml.subject.titleInfo.each { |ti_el|\n parts = ti_el.element_children.map(&:text).reject(&:empty?)\n result << parts.join(sep).strip unless parts.empty?\n }\n result\n end", "def subjects\n @graphs.inject([]) {|memo, g| memo += g.subjects}\n end", "def list_subjects(study_id)\n act = SubjectListAction.new(self)\n act.get(study_id)\n end", "def cellect_subjects(workflow_id)\n cellect.get '/subjects', workflow_id: workflow_id\n end", "def all_subjects\n observations + profile_users + glossary_terms\n end", "def subjects\n tag_range(\"600\", \"69X\")\n end", "def subject_titles\n @subject_titles ||= sw_subject_titles\n end", "def sw_subject_names(sep = ', ')\n mods_ng_xml.subject.name_el\n .select { |n_el| n_el.namePart }\n .map { |name_el_w_np| name_el_w_np.namePart.map(&:text).reject(&:empty?) }\n .reject(&:empty?)\n .map { |parts| parts.join(sep).strip }\n end", "def subject_topics\n @subject_topics ||= term_values([:subject, :topic])\n end", "def collect_subjects_with_curriculums( school_class )\n subjects = school_class.curriculums.collect do |c|\n [ c.qualification.subject.subject_name, c.id ]\n end\n end", "def extract_subjects_from_table(subject_list)\n subject_list\n .split(',')\n .map(&:strip)\n .reject { |subject| subject == 'None' }\n .compact\nend", "def all_subjects\n Subject.current.where(site_id: all_editable_sites.select(:id))\n end", "def make_dlist(cuds)\n emails = []\n\n cuds.each do |cud|\n emails << cud.user.email.to_s\n end\n\n emails.join(\",\")\n end", "def subjects_without_concidering_versions(options={})\n render_without_concidering_versions(options.merge(:only => :subjects)) unless @subjects_rendered\n @subjects\n end", "def list_topic_titles\n topics.keys.join(\"\\n\")\n end", "def to_s\n\t\t\"#{title}, by #{authors.join(', ')}\"\n\tend", "def to_s\n to_a.join(',')\n end", "def subject_results\n env.subjects.map(&method(:subject_result))\n end", "def unfinished_subjects(param = nil)\n @unfinished_subjects ||= plan_subjects - self.finished_subjects\n\n if param == :subjects\n return @unfinished_subjects.map {|p| p.subject}\n else\n return @unfinished_subjects\n end\n end", "def subject_taxon_name_ids\n return taxon_name_id if !taxon_name_id.empty? # only one or the other supposed to be sent\n return subject_taxon_name_id if !subject_taxon_name_id.empty?\n return []\n end", "def subject_name\n subjects.any? ? subjects.first.name : nil\n end", "def process_subjects(subjects_arr)\n return_arr = []\n subjects_arr.each do |subject|\n unless subject['_resolved'].blank?\n return_arr.push(subject['_resolved'])\n end\n end\n return_arr\n end", "def subject(value)\n merge(subject: value.to_s)\n end", "def categories_to_csv\n categories.map { |category| category.name }.join(\", \")\n end", "def subjects_person\n get_item_data_by_name('SubjectPerson')\n end", "def recite_subject(number)\n # validate number\n validate_number(number)\n\n i = @size - number\n final_subjects = []\n while i < @size\n subjects = get_subject(@lyrics[i])\n subjects.each do |subject|\n final_subjects.push(subject)\n end\n i+=1\n end\n\n final_subjects = format_final_subject(final_subjects)\n\n return \"This is \" + final_subjects\n end", "def keywords_subject\n key = @strip['keywords']\n if key.nil?\n @null\n else\n [@strip['subject'], key].join(',')\n end\n end", "def subject_ids\n self.get_civet_outputs.map(&:dsid)\n end", "def emails_send_to\n (emails + [cc.presence]).compact.uniq.to_sentence\n end", "def order_subjects\n subjects = super\n \n add_debug \"order_subjects: #{subjects.inspect}\"\n\n # Order subjects by finding those with templates, and then by the template priority order\n prioritized_subjects = []\n other_subjects = []\n subjects.each do |s|\n template = find_template(s)\n next unless template\n \n priority = template[:priority] || 99\n add_debug \" priority(#{s}) = #{priority}\"\n prioritized_subjects[priority] ||= []\n prioritized_subjects[priority] << s\n end\n\n ordered_subjects = prioritized_subjects.flatten.compact\n \n other_subjects = subjects - ordered_subjects\n \n add_debug \"ordered_subjects: #{ordered_subjects.inspect}\\n\" + \n \"other_subjects: #{other_subjects.inspect}\"\n\n ordered_subjects + other_subjects\n end", "def categories\n return [] if @feed.channel.categories.empty? && @feed.channel.dc_subjects.empty?\n [@feed.channel.categories, ((@feed.channel.dc_subjects.empty?) ? nil : @feed.channel.dc_subjects)].flatten.uniq.compact.collect{|c| c.content}.reject{|c| c == '' || c.match(/^\\s+$/)}\n end", "def to_s\n \"#{self.class.name}<#{@subject}>\"\n end", "def get_cloudkit_participants_csv\n to_return = [AppleCloudKitShareParticipant.to_csv_headers]\n @cloud_kit_participants.each do |key, participant|\n to_return.push(participant.to_csv)\n end\n to_return\n end", "def subject(*args)\n subject = \"#{Settings['application']['name']} | \"\n subject << args.join(' ') if args.present?\n subject\n 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 to_csv\n CSV.generate(\"\", encoding: 'UTF-8') do |csv|\n csv << %w(study_group name)\n get_groups.each_with_index do |group, index|\n group.each do |student|\n csv << [index + 1, student]\n end\n end\n end\n end", "def get_subject(lyric)\n arr = lyric.gsub(' and ', 'and').split('and')\n subjects = []\n for item in arr\n item = item.split(' ')\n subjects.push(item[0..1].join(' ')) if item[0].downcase == 'the'\n end\n return subjects\n end", "def email_list\n @entries.collect do |line|\n name, email = line.split(\",\")\n format_email_address name, email.chomp\n end.join(\", \")\n end", "def enroll(subject)\n\t\tsubjects[subject] = []\n\t\tsubjects\n\tend", "def subject_name\n subject_full_name\n end", "def topic_facet\n vals = subject_topics ? Array.new(subject_topics) : []\n vals.concat(subject_names) if subject_names\n vals.concat(subject_titles) if subject_titles\n vals.concat(subject_occupations) if subject_occupations\n vals.map! { |val| val.sub(/[\\\\,;]$/, '').strip }\n vals.empty? ? nil : vals\n end", "def subject=(subject)\n self.subjects = [subject]\n end", "def order_subjects\n subjects = super\n other_subjects = []\n templates = {}\n\n log_debug \"order_subjects: #{subjects.inspect}\"\n\n # Order subjects by finding those with templates, and then by the template priority order and name\n\n # Get template priorities for each subject\n subjects.each do |s|\n if (t = find_template(s)) && !t[:skip]\n t[:priority] ||= 99\n templates[s] = t\n else\n other_subjects << s\n end\n end\n\n # Order subjects by priority or identifier\n ordered_subjects = templates.keys.sort do |s1, s2|\n if templates[s1][:priority] == templates[s2][:priority]\n templates[s1][:identifier] <=> templates[s2][:identifier]\n else\n templates[s1][:priority] <=> templates[s2][:priority]\n end\n end\n\n log_debug \"ordered_subjects: #{ordered_subjects.inspect}\\n\" + \n \"other_subjects: #{other_subjects.inspect}\"\n\n ordered_subjects + other_subjects\n end", "def list_names\n list_of_names = String.new\n Contacts.each { |contact| list_of_names = list_of_names + contact[1][:name_choices] + \", \" }\n return list_of_names\nend", "def to_s\n @items.join( _separator )\n end", "def categories_as_string\n categories.map(&:title).sort.join(',')\n end", "def subject\n map_field(:subject)&.map { |a| a.gsub(/ \\$[a-z] /, '--') }\n end", "def to_s\r\n @list.map{|el| el.to_s}.join ' '\r\n end", "def mail_list\n str =\"\"\n self.users.each do |person|\n str << \"#{person.login} <#{person.email}> \\n\"\n end\n str\n end", "def categories_as_string\ncategories.map(&:title).sort.join(', ')\n end", "def subjects=(value)\n unless value == :all or value == :signed or value.is_a?(Array)\n raise ArgumentError, \"Subjects must be an array or :all; not #{value}\"\n end\n\n value = nil if value.is_a?(Array) and value.empty?\n\n @subjects = value\n end", "def index\n @user_subjects = UserSubject.all\n end", "def subject(options)\n case [options[:person], options[:plurality]]\n when %i[first singular]\n 'I'\n when %i[first plural]\n 'we'\n when %i[second singular], %i[second plural]\n 'you'\n when %i[third singular]\n 'he'\n when %i[third plural]\n 'they'\n end\n end", "def subject_topic\n map_field(:subject_topic)&.map { |a| a.gsub(/ \\$[a-z] /, '--') }\n end", "def subject_name\n return @subject_name\n end", "def generateSubmitterMailList()\n\tsubmitter_map = {}\n\t# Handle duplicate users\n\t@submit_changes.each do |item|\n\t\tsubmitter_map[item.user_id] = item.user_email\n\tend\n\temail_to = \"\"\n\tsubmitter_map.each do |user_id, user_email|\n\t\temail_to = \"#{user_email}, #{email_to}\"\n\tend\n\t#Remove if exist\n\tif (File.exists?(\"email_to.txt\")) then\n\t\tFile.delete(\"email_to.txt\")\n\tend\n\tFile.open(\"email_to.txt\", File::WRONLY|File::CREAT) { |f|\n\t\tf.puts email_to\n\t}\nend", "def recipients_list\n to.split(/\\s*,\\s*/)\n end", "def index\n \n @subjects = Subject.sorted\n \n end", "def categories_as_string\n categories.map(&:title).sort.join(', ')\n\n end", "def index\n @tutor_subjects = TutorSubject.all\n end", "def extract_subjects(subject)\n if subject.is_a?(Hash) && subject.key?(:any)\n subject[:any]\n else\n [subject]\n end\n end", "def index\n @subjects = subject_scope\n end", "def subjectsOptions(selected_id, options_all=false, tree_type_id)\n if options_all\n ret = [['All', '']]\n else\n ret = []\n end\n Subject.where(\"tree_type_id = ? AND min_grade < ?\", tree_type_id, 999).order(\"max_grade desc\", \"min_grade asc\", \"code\").each do |s|\n # ret << [ @translations[\"sector.#{s.code}.name\"], s.id ]\n ret << [s.code, s.id]\n end\n return ret\n end", "def count_subjects\n Subject.count(:id)\n end", "def participants_email_list(exclude_email=nil)\n participants(exclude_email).collect{ |p| \"#{p[0]} <#{p[1]}>\" }.join(\", \")\n end", "def active_subject_results\n active_subjects.map(&method(:subject_result))\n end", "def enhance_subjects(key, value)\n return unless key == 'dc_subject_sm'\n\n metadata[key] = value.map do |val|\n if subjects.include?(val)\n subjects[val]\n else\n val\n end\n end\n end", "def uncompleted_students_list(students)\n students = students.to_a.map(&:name).sort!\n students.each_with_index do |student, index|\n students[index] = \"#{index + 1}. #{student}\"\n end.join(\"\\n\")\n end", "def category_names_of_subject subject, &block\n categories_of_subject(subject).keys\n end", "def categories_as_string\n categories.map(&:title).sort.join(', ')\n end", "def all_names\n ret = []\n ret << @subject.CN unless @subject.CN.nil?\n ret.concat(self.san.names.map { |n| n.value }) unless self.san.nil?\n\n ret.sort.uniq\n end", "def notes_to_char_string_csv\n notes_to_char_string_array.join(',')\n end", "def to_s\n if (subject.nil? || subject.blank?)\n truncate(self.description, :length => 100, :omission => '...')\n else\n self.subject\n end\n end", "def to_s\n join\n end", "def index\n @subjects = Subject.all.sort_by { |m| m.name.downcase }\n @user = current_user\n end", "def combine_subjects\n @sentences.each_cons(2) do |s1, s2|\n if s1.subject == s2.subject\n s2.subject = Pronoun.new(s1.subject.gender)\n end\n end\n end", "def to_s\n multiple ? value.map(&:to_s).join(', ') : value.to_s\n end", "def base_to_subjects(base, filename)\n print \".\"\n @lines << subject_to_csv_line(base, filename)\n end", "def comstr\n\t\tjoin(', ')\n\tend", "def unfinished_external_subjects\n PlanSubject.find_unfinished_external(self).map {|ps| ps.subject}\n end", "def to_joined_str (item)\n if (item.class == Array) then\n item.join(\", \")\n else\n item.to_s\n end\nend", "def including_topics_list\n names_string(self.includes_topics)\n end" ]
[ "0.7360715", "0.7082522", "0.6774296", "0.6663561", "0.649294", "0.6472248", "0.6449567", "0.64210546", "0.64110374", "0.6395672", "0.639089", "0.6365869", "0.6358851", "0.63236743", "0.62995267", "0.6240473", "0.62367433", "0.6182755", "0.6158407", "0.6116354", "0.60407895", "0.60269606", "0.5910544", "0.5863504", "0.58506817", "0.58349067", "0.5821919", "0.5814698", "0.5757121", "0.5670778", "0.5645017", "0.5644679", "0.5599669", "0.5598358", "0.5591225", "0.5590146", "0.5583235", "0.5568575", "0.5558942", "0.5553274", "0.5542135", "0.55272514", "0.54946387", "0.5488133", "0.5467843", "0.5461751", "0.5455951", "0.54539484", "0.5426321", "0.5413055", "0.54105306", "0.5403805", "0.53985476", "0.53939104", "0.53821975", "0.5381898", "0.53758746", "0.53617203", "0.5351352", "0.5341525", "0.5329441", "0.5325032", "0.5320757", "0.53126115", "0.53082573", "0.52876097", "0.5280053", "0.52755785", "0.52725273", "0.527053", "0.52703923", "0.5269116", "0.5262416", "0.52611566", "0.5258432", "0.5254124", "0.5249253", "0.52317244", "0.52313757", "0.52260286", "0.522102", "0.52160776", "0.5211714", "0.5209804", "0.5209654", "0.52049077", "0.5203235", "0.52025956", "0.5202002", "0.52018416", "0.51984394", "0.51945037", "0.51862407", "0.51801795", "0.51800215", "0.5172898", "0.51680285", "0.51663846", "0.5162837", "0.51620233" ]
0.8026546
0
Creates groupings of subjects seprated by semicolons.
def subjects_column list = [] subjects.each { |subject| list << subject.name } list.join(';') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_groups(people)\n number_people = people.length\n if number_people < 3\n group_quantity = 1\n else\n group_quantity = number_people / 3\n end\n group_number = 1\n groups_names = Hash.new(\"\")\n people.each do |name|\n if group_number <= group_quantity\n groups_names[group_number] += (name + \", \")\n group_number += 1\n else\n groups_names[1] += (name + \", \")\n group_number = 2\n end\n end\n groups_names.each do |group, name|\n print \"\\n\", \"Group \", group, \"\\n\"\n print name, \"\\n\"\n end\nend", "def format_final_subject(subjects)\n if subjects.size == 1\n subjects[0]\n elsif subjects.size == 2\n subjects[0] + ' and ' + subjects[1]\n else\n last_subject = subjects.pop()\n subjects.join(', ') + ' and ' + last_subject\n end\n end", "def build_grouping_body\n arr = []\n data.each do |_,group| \n arr << render_group(group, options)\n end\n output << arr.join(\",\\n\")\n end", "def subjects\r\n subjects = []\r\n range =\"#{group[:first_message]}-\"\r\n connection.query(:xhdr, \"Subject\", range) do |status, data|\r\n if status[:code] == 221\r\n data.each do |line|\r\n message = Message.new\r\n message.num, message.subject = line.split(' ', 2)\r\n subjects << message\r\n end\r\n end\r\n end\r\n subjects\r\n end", "def group_divider (array_of_names)\n\tcounter = 0\n\tgroup_num = 0\n\tgroup_storage = []\n\tif array_of_names == nil\n\t\treturn nil\n\telsif\n\t\tarray_of_names.length < 3\n\t\tp \"It's no fun in a group less than 3 people.\"\n\telsif array_of_names.length == 3\n\t\tp \"Group 1: \" + array_of_names.join(\", \")\n\telsif array_of_names.length % 4 != 0\n\t\t\n\t\twhile counter < array_of_names.length \n\t\t\tgroup_storage << array_of_names[counter..counter + 3]\n\t\t\tcounter += 4\n\t\t\tif group_storage[group_num].length == 2\n\t\t\t\tgroup_storage.last << group_storage.first.pop\n\t\t\telsif group_storage[group_num].length == 1\n\t\t\t\tgroup_storage.first << group_storage.pop.pop\n\t\t\tend\n\t\t\tgroup_num += 1\n\t\tend\n\telse\n\t\t\n\t\twhile counter < array_of_names.length \n\t\t\tgroup_storage << array_of_names[counter..counter + 3]\n\t\t\tcounter += 4\n\t\tend\n\t\t\n\tend\n\t\n\tgroup_name_assign = 1\n\twhile group_name_assign <= group_storage.length\n\t\tp \"Group #{group_name_assign}: \" + group_storage[group_name_assign - 1].join(\", \")\n\t\tgroup_name_assign += 1\n\tend\t\nend", "def get_subject\n out = ''\n if aggregate_count > 1 #multiple records of any type\n if type_count > 1 #multiple types of records\n if distinct_aggregate_count > 1 #multiple profiles\n others = (distinct_aggregate_count-1)\n out << \"and #{pluralize(others, 'other')} \"\n out << subject_aggregate.sub('was ','were ')\n out << \" #{type_count} times\"\n else\n out << subject_aggregate\n out << \" #{type_count} times\"\n end\n else\n if distinct_aggregate_count > 1 #multiple profiles\n others = (distinct_aggregate_count-1)\n out << \"and #{pluralize(others, 'other')} \"\n out << subject.sub('was ','were ')\n else\n out << subject\n end\n end\n else\n out << subject\n end\n return out.html_safe\n end", "def make_grp_prj_periods\n grp = {}; prj = {}\n @period_fields.each do |period|\n grp[period] = '$' + period\n prj[period] = '$_id.' + period\n end\n return [grp, prj]\n end", "def grouped\n # temporary feature flag in case we need a prod 'kill' switch for this feature\n raise ApiErrors::FeatureDisabled unless Panoptes.flipper[:subject_group_selection].enabled?\n\n skip_policy_scope\n\n # setup the selector params from user input, note validation occurs in the operation class\n selector_param_keys = %i[workflow_id subject_set_id num_rows num_columns]\n selector_params = params.permit(*selector_param_keys)\n\n # Sanity check -- use a testing feature flag\n # against an allow listed workflow id env var\n allowed_workflow_ids = ENV.fetch('SUBJECT_GROUP_WORKFLOW_ID_ALLOWLIST').split(',')\n raise ApiErrors::FeatureDisabled unless allowed_workflow_ids.include?(selector_params[:workflow_id])\n\n group_selection_result = SubjectGroups::Selection.run!(\n num_rows: selector_params.delete(:num_rows),\n num_columns: selector_params.delete(:num_columns),\n uploader_id: ENV.fetch('SUBJECT_GROUP_UPLOADER_ID'),\n params: selector_params,\n user: api_user\n )\n # get the list of the groups 'placeholder' group_subject ids\n group_subject_ids = group_selection_result.subject_groups.map(&:group_subject_id)\n\n selected_subject_scope =\n Subject\n .where(id: group_subject_ids)\n .order(\"idx(array[#{group_subject_ids.join(',')}], id)\") # guardrails-disable-line\n\n selection_context = Subjects::SelectorContext.new(\n group_selection_result.subject_selector,\n group_subject_ids\n ).format\n\n # serialize the subject_group's group_subject data\n render json_api: SubjectSelectorSerializer.page(\n group_selection_result.subject_selector.params,\n selected_subject_scope,\n selection_context\n )\n end", "def part2 groups\n yeses = groups.map { | g |\n members = g.split(\"\\n\")\n shared_answers = members.reduce(\"abcdefghijklmnopqrstuvwxyz\".chars) { |m,v |\n m & v.chars\n }.uniq.length\n }.reduce(0){ |m,v|\n m+v\n }\nend", "def write_groups(groups, f)\n groups.each do |key, array|\n f.write(\"\\n[#{key}]\\n\")\n if array.count > 1\n array.each do |value|\n f.write(\"#{value}\\n\")\n end\n else\n f.write(\"#{array.join('')}\\n\")\n end\n end\n end", "def sw_subject_titles(sep = ' ')\n result = []\n mods_ng_xml.subject.titleInfo.each { |ti_el|\n parts = ti_el.element_children.map(&:text).reject(&:empty?)\n result << parts.join(sep).strip unless parts.empty?\n }\n result\n end", "def sw_subject_names(sep = ', ')\n mods_ng_xml.subject.name_el\n .select { |n_el| n_el.namePart }\n .map { |name_el_w_np| name_el_w_np.namePart.map(&:text).reject(&:empty?) }\n .reject(&:empty?)\n .map { |parts| parts.join(sep).strip }\n end", "def races_groups\n\t\t'study_subjects.id' unless races.blank?\n\tend", "def generate_one_grouping(size)\n\tstudents_array = self.students.to_a\n\tstudents_array.shuffle!\n \tgroup_sizes_array = determine_group_sizes(size)\n \tgroups = []\n \tgroup_sizes_array.each do |size|\n \t\tgroup = []\n\t\twhile group.length < size\n\t\t\tgroup << students_array.slice!(0)\n\t\tend\n\t\t\tgroups << group\n \tend\n \tgroups\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 subjects(list=[], root=@result.at_css('article-meta article-categories'), prefix = nil)\n return unless root\n subj_node = root.at_css('> subject')\n\n subj_text = subj_node && subj_node.text\n\n if subj_text.present?\n prefix = [prefix, subj_text].compact.join(\" - \")\n list << prefix\n end\n\n root.css('> subj-group').each do |node|\n subjects(list, node, prefix)\n end\n\n list.presence\n end", "def discover_groups_string\n discover_groups.join(', ')\n end", "def subject_list\n list = []\n subjects.each { |subject| list << subject.name }\n list.to_sentence\n end", "def subjects_for_csv\n roots = []\n if comments.any?\n comments.map do |comment|\n roots += comment.subjects.roots\n end\n end\n if roots.empty?\n structures.map do |structure|\n roots += structure.subjects.roots\n end\n end\n subjects_to_array_for_csv roots.uniq.map(&:name)\n end", "def make_groups(all_students)\n\n #calculate how many groups of 5, with one group of leftovers\n num_full_groups = all_students.size / 5\n leftovers = all_students.size % 5\n group_avg = all_students.size.to_f / num_full_groups\n\n #each entry in group_sizes represents one group - put 5 in each full one\n group_sizes = Array.new\n for i in 0...num_full_groups\n group_sizes[i] = 5\n end\n\n #if there's a leftover group- while its size is (1 or more) students less than average, move students into it from other groups one by one\n if leftovers != 0\n i = 0\n while ((group_avg - leftovers) >= 1)\n group_sizes[i] -= 1\n leftovers += 1\n if i.next == num_full_groups\n i = 0\n else\n i = i.next\n end\n end\n group_sizes << leftovers #add leftovers group to group_sizes list\n end\n\n #now we have an array of group sizes, ex: [4,4,5,5,4]\n #populate new groups_names array with arrays of student names of those sizes\n\n groups_names = Array.new\n groupcount=0\n group_sizes.cycle(1) do |i|\n groups_names[groupcount] = Array.new\n for j in 0...i\n groups_names[groupcount][j] = all_students.shift\n end\n groupcount += 1\n end\n\n groups_names\n\nend", "def output_groups(names_array, size_of_group)\n\tgroup_id = 1\n\tuntil names_array.size == 0 do\n\t\tputs \"Group \" + group_id.to_s\n\t\tputs \"=================\"\n\t\tputs names_array.shift(size_of_group)\n\t\tputs\n\t\tgroup_id += 1\n\tend\nend", "def make_groups(list_of_names)\n result = []\n num_people = list_of_names.length\n cur_group = []\n list_of_names.each do |name|\n cur_group.push(name)\n if cur_group.length == 4 || (cur_group.length == 3 && num_people == 3)\n result.push(cur_group)\n cur_group=[]\n end\n end\n # Right now the solution doesn't gracefully handle 6 people.\n # I should write a find_available function to find an open group to stick someone\n # in.\n if cur_group.length == 2\n name = cur_group.pop\n result[1].push(name)\n end\n if cur_group.length == 1\n name = cur_group.pop\n result[0].push(name)\n end\n return result\nend", "def lines_groups\n @lines_groups = []\n #current_split = ''\n split_count = 0\n\n #@lines_groups ||= text.collect.with_index do |line, i|\n text.each do |line|\n split_line = line.split( /\\s{2,}/ ).reject! {|e| e == '' }\n $stderr.puts \"SPLIT LINE: #{split_line}\"\n # If we're looking at at least one blank area, we need to start a new group.\n if split_line.nil? || split_count == 0\n split_count += 1\n @lines_groups << []\n # Guard against possibly first line being nil.\n @lines_groups.last << split_line unless split_line.nil?\n elsif !split_line.nil? && split_count > 0\n @lines_groups.last << split_line.flatten #.map {|e| e.squish }\n #unless split_line.nil?\n #{\n # index: i, \n # line: split_line, \n # line_size: split_line.length\n #}\n else\n end\n end\n @lines_groups.flatten\n end", "def create_groups(names)\n groups = []\n names.shuffle.each_slice(4) do |group|\n if group.count == 4\n groups << group\n else\n i = 0\n group.each do |name|\n groups[i] << name\n i += 1\n end\n end\n end\n p groups\nend", "def str_groups_separated_by_blank_lines(original_filename)\n groups = []\n curr_group = []\n\n get_input_str_arr(original_filename).each do |str|\n if str == ''\n groups << curr_group\n curr_group = []\n next\n end\n\n curr_group << str\n end\n\n groups << curr_group\n groups\nend", "def group_header(class_name)\n name_parts = class_name.split('::')\n group = name_parts[2]\n collection = name_parts[3]\n\n # split group and collection to words\n pattern = /(?=[A-Z])/\n\n group = group.split(pattern).join(' ')\n collection = collection.split(pattern).join(' ')\n\n # write group and collection to file\n file.write \"# #{group}\\n\\n\"\n file.write \"# #{collection} [/#{file_name}]\\n\\n\"\n end", "def make_grp_prj_nodes\n grp = {}; prj = {}\n @nodes_fields.each do |node|\n grp[node] = '$' + node\n prj[node] = '$_id.' + node\n end\n return [grp, prj]\n end", "def _group\n\n _save = self.pos\n while true # sequence\n _tmp = apply(:_phrase)\n unless _tmp\n self.pos = _save\n break\n end\n _tmp = apply(:_ocms)\n unless _tmp\n self.pos = _save\n break\n end\n _tmp = match_string(\":\")\n unless _tmp\n self.pos = _save\n break\n end\n _tmp = apply(:_ocms)\n unless _tmp\n self.pos = _save\n break\n end\n _tmp = apply(:_mailbox)\n unless _tmp\n self.pos = _save\n break\n end\n while true\n\n _save2 = self.pos\n while true # sequence\n _tmp = apply(:_ocms)\n unless _tmp\n self.pos = _save2\n break\n end\n _tmp = match_string(\",\")\n unless _tmp\n self.pos = _save2\n break\n end\n _tmp = apply(:_ocms)\n unless _tmp\n self.pos = _save2\n break\n end\n _tmp = apply(:_mailbox)\n unless _tmp\n self.pos = _save2\n end\n break\n end # end sequence\n\n break unless _tmp\n end\n _tmp = true\n unless _tmp\n self.pos = _save\n break\n end\n _tmp = apply(:_ocms)\n unless _tmp\n self.pos = _save\n break\n end\n _tmp = match_string(\";\")\n unless _tmp\n self.pos = _save\n end\n break\n end # end sequence\n\n set_failed_rule :_group unless _tmp\n return _tmp\n end", "def group_for_grouped_select(items)\n items.group_by { |entry| entry.first.split(\": \").first }\n end", "def groups; end", "def groups; end", "def groups; end", "def build_group_header\n output << \" \\\"#{data.name}\\\":\"\n end", "def to_csv\n CSV.generate(\"\", encoding: 'UTF-8') do |csv|\n csv << %w(study_group name)\n get_groups.each_with_index do |group, index|\n group.each do |student|\n csv << [index + 1, student]\n end\n end\n end\n end", "def create_groups(cohort)\n if cohort.length % 5 == 0\n hash = {} \t\n \tcounter = 1\n group_count = cohort.length / 5\n remainder = cohort.length % 5 \t\n # Set to groups(keys) to members(values)\n group_count.times do\n hash[counter] = cohort.slice!(0..4)\n counter += 1\n end\n else\n \thash = {}\n counter = 1 \n group_count = cohort.length / 4\n remainder = cohort.length % 4\n # Set to groups(keys) to members(values)\n group_count.times do\n hash[counter] = cohort.slice!(0..3)\n counter += 1\n end\n end\n # Add remainders\n counter = 1\n cohort.each do |string|\n hash[counter] << string\n counter += 1\n end\nreturn hash\nend", "def grouping_identifier(box)\n \"#{ead_id}-#{box['label'].to_s.tr(' ', '-')}\"\n end", "def hierarchical_subject_link(hierarchical_subject)\n label = hierarchical_subject.last\n subject = hierarchical_subject.join(\" — \")\n\n subject_link(subject, label)\n end", "def fill_breakable(sep=' ', width=sep.length)\n group { breakable sep, width }\n end", "def build_groups\n groups = {}\n roles = %w[client server initial]\n roles.each do |role|\n groups[role] = build_roles(role)\n end\n groups\n end", "def group(*) end", "def groups\n quads\n end", "def group_by\n end", "def new_group(key)\n []\n end", "def links_group_by_separated(attribute, separator)\n links_group_by(attribute, links_duplicate_on(attribute, separator))\n end", "def group_by\n ActiveSupport::StringInquirer.new(@params[:group_by]) unless @params[:group_by].nil?\n end", "def create_subjects_json(subject_list)\n subjects_json = []\n subject_list.each do |subj|\n subjects_json << subj.as_json\n end\n { 'subjects' => subjects_json }.to_json\nend", "def combine_subjects\n @sentences.each_cons(2) do |s1, s2|\n if s1.subject == s2.subject\n s2.subject = Pronoun.new(s1.subject.gender)\n end\n end\n end", "def output_groups(students, size_of_group)\n group_id = 1\n until students.size == 0 do\n puts \"Group \" + group_id.to_s\n puts \"=================\"\n students.shift(size_of_group).each { |student| puts student.name }\n puts\n group_id += 1\n end\nend", "def group_by\n\n end", "def group_through_identifier\n \"#{name.downcase}_groups\".to_sym\n end", "def ii_groups; end", "def listgroups(msg, ent, ii, depth)\r\n ent.each do |bit|\r\n next unless bit.is_a?(Sketchup::Group)\r\n bname = bit.name.empty? ? 'no name' : bit.name\r\n spacer = ' ' * depth\r\n msg += spacer + ii.to_s + ' - ' + bname + \"\\n\"\r\n msg = listgroups(msg, bit.entities, ii, depth + 1)\r\n end\r\n msg\r\n end", "def add_subject_terminology(t)\n t.subject(:attributes=>{:authority=>\"UoH\"}) {\n t.topic\n t.temporal\n t.geographic\n }\n t.subject_topic(:proxy=>[:subject, :topic], :index_as=>[:displayable, :facetable])\n t.subject_geographic(:proxy=>[:subject, :geographic], :index_as=>[:displayable])\n t.subject_temporal(:proxy=>[:subject, :temporal], :index_as=>[:displayable])\n end", "def groups\n @groups ||= STDIN.read.split(\"\\n\\n\").map { |e| e.split.map { |f| f.chars } }\nend", "def sequence_separator; end", "def groupby_fields\n ids = {}\n ids.merge!(make_grp_prj_periods[0])\n ids.merge!(make_grp_prj_nodes[0])\n { '_id' => ids }\n end", "def subjectify(options = {})\n result = []\n all_subjects = []\n sub_array = []\n options[:value].each_with_index do |subject, i|\n spl_sub = subject.split(QUERYSEP)\n sub_array << []\n subject_accum = ''\n spl_sub.each_with_index do |subsubject, j|\n spl_sub[j] = subject_accum + subsubject\n subject_accum = spl_sub[j] + QUERYSEP\n sub_array[i] << spl_sub[j]\n end\n all_subjects[i] = subject.split(QUERYSEP)\n end\n options[:value].each_with_index do |_subject, i|\n lnk = ''\n lnk_accum = ''\n all_subjects[i].each_with_index do |subsubject, j|\n lnk = lnk_accum + link_to(subsubject,\n \"/?f[subject_facet][]=#{CGI.escape sub_array[i][j]}\",\n class: 'search-subject', title: \"Search: #{sub_array[i][j]}\")\n lnk_accum = lnk + content_tag(:span, SEPARATOR, class: 'subject-level')\n end\n result << sanitize(lnk)\n end\n result\n end", "def group_builder; end", "def extend_initials!\n groups = Hash.new do |h,k|\n h[k] = { :prototype => nil, :names => [] }\n end\n\n # group names together\n names.each do |name|\n group = groups[name.sort_order(:initials => true).downcase]\n group[:names] << name\n\n if group[:prototype].nil? || group[:prototype].first.to_s.length < name.first.to_s.length\n group[:prototype] = name\n end\n end\n\n # extend all names in group to prototype\n groups.each_value do |group|\n group[:names].each do |name|\n name.set(group[:prototype])\n end\n end\n\n self\n end", "def create_group(stream, group)\n stream = stream_name(stream)\n connection.xgroup(:create, stream, \"#{stream}-#{group}\", '$',\n mkstream: true)\n end", "def subject\n map_field(:subject)&.map { |a| a.gsub(/ \\$[a-z] /, '--') }\n end", "def to_string\n h = ''\n h << \"Groups\\n\"\n groups.each do |group|\n h << \" #{group}\\n\"\n end\n \n h << \"\\nHosts:\\n\"\n hosts.each do |host|\n h << \" #{host}\\n\"\n end\n \n h << \"\\nRoles\\n\"\n roles.each do |role|\n h << \" #{role}\\n\"\n end\n\n h << \"\\nTop-level tasks\\n\"\n tasks.each do |task|\n h << \" #{task}\\n\"\n end\n\n h\n end", "def citation_groups\n grouper = CitationGrouper.new(self)\n\n citation_nodes.each do |citation|\n grouper.add_citation(citation)\n end\n\n grouper.groups\n end", "def create_example_groups(groups_count = 100)\n # FIXME: What if Example organization is not found?\n organization = Organization.where(:name => 'Example').first\n \n # Get example students\n users = User.where(:firstname => 'Student', :organization_id => organization.id).all\n user_counter = 0\n \n # Create groups and submissions\n for i in (1..groups_count)\n # Create group\n group = Group.new(:course_instance_id => self.id, :name => \"Group #{i}\", :max_size => 3)\n group.save(:validate => false)\n\n # Add users to group\n students_count = rand(3) # self.groupsizemin + rand(self.groupsizemax - self.groupsizemin + 1)\n for j in (0..students_count)\n user = users[user_counter]\n group.add_member(user) if user\n user_counter += 1\n end\n\n break if user_counter >= users.size\n end\n end", "def group_root_set_by_subject(root)\n subject_table = {}\n \n # 5B\n # Populate the subject table with one message per each\n # base subject. For each child of the root:\n root.children.each do |container|\n\n # Find the subject of this thread, by using the base\n # subject from either the current message or its first\n # child if the current message is a dummy. This is the\n # thread subject.\n c = nil\n if container.message == nil\n c = container.children[0]\n else\n c = container\n end\n \n message = c.message\n if message.nil?\n next\n end\n \n subject = MessageParser.normalize_subject(message.subject)\n\n # If the thread subject is empty, skip this message\n if subject.length == 0 \n next\n end\n\n existing = subject_table[subject]\n \n # If there is no message in the subject table with the\n # thread subject, add the current message and the thread\n # subject to the subject table.\n if existing == nil\n subject_table[subject] = c\n \n # Otherwise, if the message in the subject table is not a\n # dummy, AND either of the following criteria are true:\n # - The current message is a dummy, OR\n # - The message in the subject table is a reply or forward\n # and the current message is not. \n elsif ( ( not existing.dummy?) && ( c.dummy? || ( \n ( MessageParser.is_reply_or_forward existing.message.subject ) && \n ( not MessageParser.is_reply_or_forward message.subject ))))\n subject_table[subject] = c\n end\n \n end\n \n # 5C\n # using reverse_each here because removing children from root\n # would lead to skipping of root's children\n root.children.reverse_each do |container|\n subject = nil\n \n # Find the subject of this thread, by using the base\n # subject from either the current message or its first\n # child if the current message is a dummy. This is the\n # thread subject.\n if container.message == nil\n subject = container.children[0].message.subject\n else\n subject = container.message.subject\n end\n \n subject = MessageParser.normalize_subject(subject)\n \n c = subject_table[subject]\n \n # If the message in the subject table is the current\n # message, skip this message.\n if c == nil || c == container\n # puts \">>>> skip\"\n next\n end\n \n \n \n # If both messages are dummies, append the current\n # message's children to the children of the message in\n # the subject table (the children of both messages\n # become siblings), and then delete the current message \n if c.dummy?() && container.dummy?()\n container.children.each {|ctr| c.add_child(ctr) }\n container.parent.remove_child(container)\n # If the message in the subject table is a dummy and the\n # current message is not, make the current message a\n # child of the message in the subject table (a sibling\n # of its children). \n elsif c.dummy?() && ( not container.dummy?() )\n c.add_child(container)\n # If the current message is a reply or forward and the\n # message in the subject table is not, make the current\n # message a child of the message in the subject table (a\n # sibling of its children). \n elsif not MessageParser.is_reply_or_forward(c.message.subject) && \n MessageParser.is_reply_or_forward(container.message.subject)\n c.add_child(container) \n # Otherwise, create a new dummy message and make both\n # the current message and the message in the subject\n # table children of the dummy. Then replace the message\n # in the subject table with the dummy message.\n else\n new_container = Container.new\n new_container.add_child(c)\n new_container.add_child(container)\n subject_table[subject] = new_container\n end \n end\n\n subject_table\n end", "def read_groups_string\n read_groups.join(', ')\n end", "def hyrax_group_names\n groups\n end", "def i_groups; end", "def subjects\n @graphs.inject([]) {|memo, g| memo += g.subjects}\n end", "def groups\n if groups_last_update.blank? || ((Time.now - groups_last_update) > 24 * 60 * 60)\n return groups!\n end\n group_list.split(\";?;\")\n end", "def group_lines\n @lines.rewind\n\n in_list = false\n wanted_type = wanted_level = nil\n\n block = LineCollection.new\n group = nil\n\n while line = @lines.next\n if line.level == wanted_level and line.type == wanted_type\n group.add_text(line.text)\n else\n group = block.fragment_for(line)\n block.add(group)\n\n if line.type == :LIST\n wanted_type = :PARAGRAPH\n else\n wanted_type = line.type\n end\n\n wanted_level = line.type == :HEADING ? line.param : line.level\n end\n end\n\n block.normalize\n block\n end", "def split pattern=$;, *more\n arr = super\n i = 0\n interval = 0\n interval = (self.length - arr.join.length) / (arr.length - 1) if\n arr.length > 1\n\n arr.map do |str|\n ds = self.class.new str\n ds.meta = @meta[i,str.length]\n i += str.length + interval\n ds\n end\n end", "def test_rule1_more_can_attend_one_even_if_fewer_can_attend_both\n student_a = Student.new(\"a\", [MONDAY_8, MONDAY_12], [WEDNESDAY_13, WEDNESDAY_18])\n student_b = Student.new(\"b\", [MONDAY_12, MONDAY_14], [WEDNESDAY_18, WEDNESDAY_19])\n student_c = Student.new(\"c\", [MONDAY_8, MONDAY_15], [WEDNESDAY_7, WEDNESDAY_20])\n student_d = Student.new(\"d\", [MONDAY_8, MONDAY_16], [WEDNESDAY_9, WEDNESDAY_21])\n group = StudentGroup.new([student_a, student_b, student_c, student_d])\n\n assert_equal \"8:00 AM EDT (12:00 UTC)\\n\\na\\nc\\nd\", group.monday_roster.to_s\n assert_equal \"6:00 PM EDT (22:00 UTC)\\n\\na\\nb\", group.wednesday_roster.to_s\n end", "def group_consistent_answers(group)\n group_member_count = group.lines.count\n unique_chars = group.chars.uniq.select{|char| /[a-z]/.match?(char)}\n unique_chars.select{|char| group.count(char) == group_member_count}.length\nend", "def meeting(s)\n s\n .upcase\n .split(\";\")\n .map { |name| name.split(\":\") }\n .sort_by { |first, last| [last, first]}\n .map { |first, last| \"(#{last}, #{first})\"}\n .join\nend", "def hack_members_for_newsletter\n member_hash = {}\n hack_members.name_seq.each do | member |\n member_hash[member.informal_name] = {:name => member.informal_name,\n :grp_with => member.group_with_id.nil? ? nil : member.group_with.informal_name,\n :subnodes => []}\n end\n member_hash.each do |_, item|\n parent = member_hash[item[:grp_with]]\n parent[:subnodes] << item if parent\n end\n unique_array = member_hash.reject {|_, item| member_hash.has_key? item[:grp_with] }.values\n ar = []\n collect_names(ar, unique_array)\n\n leader = self.hack_leader.informal_name\n if ar.include? leader\n ar.delete leader\n ar.push leader\n end\n\n ar.blank? ? 'None.' : ar.to_sentence(:last_word_connector => ' and ')\n end", "def set_groups_subgroup(glisthash, lines, defaultkey, groupcol, subgroupcol, \n\t\thighlighted_group=\"\", snpTags=nil)\n # set up hash for holding columns for main group names\n subnames = Hash.new\n subgrouporder = Array.new\n groupnames = Hash.new\n groupnameorder = Array.new\n \n for i in (1..lines.length-1)\n data = strip_and_split(lines[i])\n if subgroupcol\n unless subnames.has_key?(data[subgroupcol])\n subnames[data[subgroupcol]]=1\n subgrouporder << data[subgroupcol]\n end\n end\n if groupcol\n unless groupnames.has_key?(data[groupcol])\n groupnames[data[groupcol]]=1\n groupnameorder << data[groupcol]\n end\n end\n end\n \n groups = Hash.new\n grouporder = Array.new\n groupkeys = Array.new \n\tgroupcolors = Hash.new \n \n # construct the groups\n groupnameorder.each do |gname|\n gname == highlighted_group ? highlighted = true : highlighted = false\n if subnames.empty?\n key = gname\n#\t\t\tsnpTags.tags.has_key?(key) ? colorstr = snpTags.tags[key] : colorstr = GroupList.get_next_color\n\t\t\tcolorstr = GroupList.get_next_color\n groups.store(key, Group.new(key, highlighted,colorstr))\n\t\t\tgroupcolors[key]=colorstr\n grouporder << key\n groupkeys << key\n else\n subnames.each_key do |sname| \n key = gname + ':' + sname\n groups.store(key, Group.new(key, highlighted))\n grouporder << key\n groupkeys << key\n end\n end\n end\n \n mafcoltitle = 'MAF'\n headers = strip_and_split(lines[0])\n\n # create the groups using the headers \n headers.each_with_index do |header, i|\n \n if header =~ /snp\\s*id/i || header=~ /snp_id/i || header =~ /^snp$/i\n @snpid = i\n elsif header =~ /snp\\s*name/i\n @snpname = i\n elsif header =~ /chromosome|CHR|^chrom$/i\n @chromnum = i\n elsif header =~ /location|^pos$|^bp$/i\n @location = i\n\t\telsif header =~ /^snpcolor|snp\\scolor/i\n\t\t\t@snpcolorcol = i\n\t\telsif header =~ /anc\\d/i\n\t\t\t# should be anc0, anc1, or anc2\n\t\t\tallelenum = /anc(\\d)/.match(header)[1]\n\t\t\t@anccol[allelenum.to_i] = i\n elsif header =~ /^subgroup$/i || header =~ /^group$/i # skip if no _ to mark name\n next\n else\n header.strip!\n column_type = header\n if column_type =~ /pval|p_value/i\n groupkeys.each {|key| groups[key].pcol = i}\n elsif column_type =~ /beta_uci|betauci/i\n groupkeys.each {|key| groups[key].betaucicol = i}\n elsif column_type =~ /beta_lci|betalci/i\n groupkeys.each {|key| groups[key].betalcicol = i}\n elsif column_type =~ /beta/i or column_type =~ /^es$/i\n groupkeys.each {|key| groups[key].betacol = i}\n elsif column_type =~ /^n$|^sample_size$/i\n groupkeys.each {|key| groups[key].Ncol = i}\n elsif column_type =~ /cafcases/i\n groupkeys.each {|key| groups[key].cafcasescol = i}\n elsif column_type =~ /cafcontrols/i\n groupkeys.each {|key| groups[key].cafcontrolscol = i}\n elsif column_type =~ /^maf|caf$/i\n if column_type =~ /caf/i\n mafcoltitle = 'CAF'\n end\n groupkeys.each {|key| groups[key].mafcafcol = i}\n elsif column_type =~ /^or$/i\n groupkeys.each {|key| groups[key].orcol = i}\n elsif column_type =~ /^rank$/i\n groupkeys.each {|key| groups[key].rankcol = i}\t\t\t\t\n elsif column_type =~ /^upper_ci|uci$/i\n groupkeys.each {|key| groups[key].ucicol = i}\n elsif column_type =~ /lower_ci|lci/i\n groupkeys.each {|key| groups[key].lcicol = i}\n elsif column_type =~ /cases/i\n groupkeys.each {|key| groups[key].casescol = i }\n elsif column_type =~ /controls/i\n groupkeys.each {|key| groups[key].controlscol = i}\n elsif column_type =~ /study/i\n groupkeys.each {|key| groups[key].studycol = i}\n elsif column_type =~ /^power$/i\n groupkeys.each {|key| groups[key].powercol = i}\n else\n groupkeys.each {|key| groups[key].additional_cols[column_type] = i} \n end\n end\n end\n\n unless @snpid and @location and @chromnum\n puts \"ERROR: Need SNP, CHR, and POS columns in input file\"\n exit\n end\n # add groups to the grouplist\n grouporder.each do |g|\n namepcs = g.split /:/\n\n # add to default grouplist\n if namepcs.length == 1\n if !glisthash.has_key?(defaultkey)\n glisthash[defaultkey] = GroupList.new\n glisthash[defaultkey].mafcoltitle = mafcoltitle\n end\n glisthash[defaultkey].add_group(groups[g])\n else\n if !glisthash.has_key?(namepcs[1])\n glisthash[namepcs[1]] = GroupList.new\n glisthash[namepcs[1]].mafcoltitle = mafcoltitle\n end\n glisthash[namepcs[1]].add_group(groups[g])\n end\n end\n\n # need to match all colors when multiple grouplists\n if glisthash.length > 1\n # determine number of unique groups\n unique_names = Hash.new\n glisthash.each_value do |glist|\n glist.grouphash.each_key do |name|\n namepcs = name.split /:/\n unique_names[namepcs[0]] = 1\n end\n end\n colorhash = Hash.new\n unique_names.each_key do |name|\n#\t\t\tsnpTags.tags.has_key?(name) ? colorstr = snpTags.tags[name] : colorstr = GroupList.get_next_color\n\t\t\tcolorstr = GroupList.get_next_color\n colorhash[name] = colorstr\n\t\t\tgroupcolors[name]=colorstr\n end\n\n glisthash.each_value do |glist|\n glist.grouphash.each do |name, group|\n namepcs = name.split /:/\n group.colorstr = colorhash[namepcs[0]]\n end\n end\n\n end\n\t\n\t# set group list colors for the tags (if any)\n\tif(snpTags)\n\t\tsnpTags.tags.each_key do |key|\n\t\t\tif(groupcolors.has_key?(key))\n\t\t\t\tsnpTags.tags[key]=groupcolors[key]\n\t\t\telse\n\t\t\t\tsnpTags.tags[key]=GroupList.get_next_color\n\t\t\tend\n\t\tend\n\tend\n \nend", "def groups(array_of_names)\r\n\r\n\tnum_people = array_of_names.length \t\t#how many people do we have?\r\n\tgroups_5 = num_people % 4 \t#how many groups will have 5\r\n\tgroups_4 = (num_people - (groups_5 * 5)) / 4 # how many groups will have 4\r\n\ttotal_groups = groups_4 + groups_5 \t\t#how many total groups\r\n\r\n\tgroup_hash = Hash.new([])\t#new hash initialized to empty arrays\r\n\t\r\n\tnum_group = 0\r\n\tindex = 0\r\n\r\n\tgroups_5.times do\r\n\t\tpeople_in_group = []\r\n\t\t5.times do\r\n\t\t\tpeople_in_group << array_of_names[index]\r\n\t\t\tindex += 1\r\n\t\tend\r\n\t\tgroup_hash[\"Accountability Group #{num_group}\"] = people_in_group\r\n\t\tnum_group += 1\r\n\tend\r\n\r\n\tgroups_4.times do\r\n\t\tpeople_in_group = []\r\n\t\t4.times do\r\n\t\t\tpeople_in_group << array_of_names[index]\r\n\t\t\tindex += 1\r\n\t\tend\r\n\t\tgroup_hash[\"Accountability Group #{num_group}\"] = people_in_group\r\n\t\tnum_group += 1\r\n\tend\r\n\r\n\treturn group_hash\r\n\r\nend", "def group_maker(array)\n group_hash = {}\n arrays = array.each_slice(5).to_a\n arrays.each do |item|\n if item.length == 2\n arrays[0].push(item[0])\n arrays[1].push(item[1])\n num = arrays.index(item)+1\n group_hash[\"group #{num}\"] = item\n group_hash.delete_if {|k,v| v.length <= 2}\n \n elsif item.length == 1\n arrays[0].push(item[0])\n num = arrays.index(item)+1\n group_hash[\"group #{num}\"] = item\n group_hash.delete_if {|k,v| v.length <= 2}\n else\n num = arrays.index(item)+1\n group_hash[\"group #{num}\"] = item\n end\n end\n return group_hash\nend", "def order_subjects\n subjects = super\n \n add_debug \"order_subjects: #{subjects.inspect}\"\n\n # Order subjects by finding those with templates, and then by the template priority order\n prioritized_subjects = []\n other_subjects = []\n subjects.each do |s|\n template = find_template(s)\n next unless template\n \n priority = template[:priority] || 99\n add_debug \" priority(#{s}) = #{priority}\"\n prioritized_subjects[priority] ||= []\n prioritized_subjects[priority] << s\n end\n\n ordered_subjects = prioritized_subjects.flatten.compact\n \n other_subjects = subjects - ordered_subjects\n \n add_debug \"ordered_subjects: #{ordered_subjects.inspect}\\n\" + \n \"other_subjects: #{other_subjects.inspect}\"\n\n ordered_subjects + other_subjects\n end", "def enroll(subject)\n\t\tsubjects[subject] = []\n\t\tsubjects\n\tend", "def generate_entry(hash,type)\n entry = []\n for group in hash.keys\n if(group == \"no_group\") #no_group means all choices are mandatory\n for child_comp in hash[group]\n entry.push(\"#{type}:#{child_comp.id}\")\n end\n else #otherwise choose one of the grouped members\n group_group = \"#{type}\"\n for child_comp in hash[group]\n if(!(type==\"v\" && hash[group].length == 1)) #manditory valuefields are not prepended with :\n group_group += \":\"\n end\n group_group += \"#{child_comp.id}\"\n end\n entry.push(group_group)\n end\n end\n #logger.info(\"\\n\\n\\n\\n\\n entry:#{entry} join:#{entry.join(\"|\")} \\n\\n\\n\\n\\n\\n\")\n entry.join(\"|\")\n end", "def test_rule2_simpler\n student_a = Student.new(\"a\", [MONDAY_8, MONDAY_12], [WEDNESDAY_13, WEDNESDAY_18])\n student_b = Student.new(\"b\", [MONDAY_12, MONDAY_14], [WEDNESDAY_18, WEDNESDAY_19])\n student_c = Student.new(\"c\", [MONDAY_8, MONDAY_15], [WEDNESDAY_7, WEDNESDAY_20])\n student_d = Student.new(\"d\", [MONDAY_7, MONDAY_16], [WEDNESDAY_9, WEDNESDAY_21])\n group = StudentGroup.new([student_a, student_b, student_c, student_d])\n\n assert_equal \"12:00 PM EDT (16:00 UTC)\\n\\na\\nb\", group.monday_roster.to_s\n assert_equal \"6:00 PM EDT (22:00 UTC)\\n\\na\\nb\", group.wednesday_roster.to_s\n end", "def subjects\n subjects_array = object.syncable_subjects.to_a\n\n return subjects_array unless object.is_send?\n\n subjects_array << Subject.new(subject_code: \"U3\", subject_name: \"Special Educational Needs\")\n\n subjects_array\n end", "def formatted_subject(text)\n name = PersonMailer.global_prefs.app_name\n label = name.blank? ? \"\" : \"[#{name}] \"\n \"#{label}#{text}\"\n end", "def initialize_groups\n @groups = []\n @edges.each do |e|\n @groups.push([e[0]]) # single-element group\n @groups.push([e[1]]) # single-element group\n end\n @groups.uniq!\n end", "def group; end", "def meeting(s)\n new_arr = []\n names_arr = s.split(\";\").map { |full_name| full_name.scan(/(\\w.+):(\\w.+)/) }\n names_arr.each {|i| new_arr << [i[0][1].upcase, i[0][0].upcase] }\n sorted = new_arr.sort\n str = \"\"\n sorted.each do |ele|\n str << \"(#{ele[0]}, #{ele[1]})\"\n end\n p str\nend", "def list_groups(data)\n groups = []\n data.each_key { |k| groups.push(k.to_s) }\n puts groups.sort.join(\" \")\nend", "def test_rule2_more_complex\n student_a = Student.new(\"a\", [MONDAY_8, MONDAY_12], [WEDNESDAY_13, WEDNESDAY_18])\n student_b = Student.new(\"b\", [MONDAY_11, MONDAY_14], [WEDNESDAY_18, WEDNESDAY_19])\n student_c = Student.new(\"c\", [MONDAY_11, MONDAY_15], [WEDNESDAY_7, WEDNESDAY_19])\n student_d = Student.new(\"d\", [MONDAY_7, MONDAY_12], [WEDNESDAY_9, WEDNESDAY_21])\n group = StudentGroup.new([student_a, student_b, student_c, student_d])\n\n assert_equal \"11:00 AM EDT (15:00 UTC)\\n\\nb\\nc\", group.monday_roster.to_s\n assert_equal \"7:00 PM EDT (23:00 UTC)\\n\\nb\\nc\", group.wednesday_roster.to_s\n end", "def align_group(input_strings, type)\n\tp = LR_parser.new(type)\n\tmetas = []\n\tinput_strings.each { |str| metas.push(p.parse_meta(str)); }\n\tmetas.each {|m| m.separate_first!}\n\tmatcher = DPMatcher.new\n\tpairs_array = [];\n\tfor i in 0..metas.size-2 do \n\t\tpairs_array.push(matcher.generate_pairs(metas[i].value, metas[i+1].value));\n\tend\n\tr = Recreator.new(type)\n\tchains = r.generate_chains(pairs_array);\n\tlines = r.multiline_reconstruction(metas, chains)\n\treturn lines\nend", "def create_domains(split_cp_domain)\n # EXPECTATION:\n # # [\"com\", \"com\", \"com\"]\n # # [\"com\", \"leetcode.com\", \"leetcode.com\"]\n names_collection = [] # [\"com\", \"leetcode.com\", \"discuss.leetcode.com\"]\n i = 0\n aggregate_dp_dom = \"\"\n while (i < split_cp_domain.length) do\n current_dp_dom = split_cp_domain[split_cp_domain.length - (i + 1)] # com\n if (aggregate_dp_dom == \"\")\n aggregate_dp_dom = current_dp_dom # com\n else\n aggregate_dp_dom = \"#{current_dp_dom}.#{aggregate_dp_dom}\" # leetcode.com\n end\n names_collection[i] = aggregate_dp_dom\n i += 1\n end\n names_collection\nend", "def subject_sym\n subject_class.to_s.underscore.downcase.to_sym\n end", "def groups\n\nroster = [ \"Caroline Artz\", \"Syema Ailia\", \"Alan Alcesto\", \"Daniel Andersen\", \"James Artz\", \"Darius Atmar\", \"Brian Bensch\", \"Nicola Beuscher\", \"Kris Bies\", \"Logan Bresnahan\", \"William Brinkert\", \"Laura C.\", \"Scott Chou\", \"Bernice Anne W Chua\", \"Abraham Clark\", \"Jon Clayton\", \"Kevin Corso\", \"Jacob Crofts\", \"John D.\", \"Katy D.\", \"Emmanuel Kaunitz\", \"Amaar Fazlani\", \"Solomon Fernandez\", \"Edward Gemson\", \"Jamar Gibbs\", \"Chris Gomes\", \"Will Granger\", \"Christopher M. Guard\", \"Adell H.\", \"James Hwang\", \"Matt H.\", \"Michael H.\", \"Peter H.\", \"Ryan Ho\", \"Igor Kazimirov\", \"Walter Kerr\", \"Karla King\", \"Becky Lehmann\", \"Malia Lehrer\", \"Carolina Medellin\", \"Timothy Meixell\", \"Lorena Mesa\", \"Chris Miklius\", \"Joshua Monzon\", \"Shea Munion\", \"Bryan Munroe\", \"Neal Peters\", \"Trevor Newcomb\", \"Aleksandra Nowak\", \"Morgan O.\", \"Fatma Ocal\", \"Van Phan\", \"Luis Fernando Plaz\", \"Nalie Polen\", \"Alicia Quezada\", \"Celeen R.\", \"Jessie Richardson\", \"Gary S.\", \"Iulia S.\", \"Nimi Samocha\", \"Zach Schatz\", \"Schwartz\", \"Pratik Shah\", \"Josh Shin\", \"Shawn Spears\", \"Sasha ilor\", \"Nil Thacker\", \"Nasha Thapliyal\", \"Sabrina Unrein\", \"Brian Wagner\", \"Clinton Weber\", \"Gregory Wehmeier\", \"Michael Whelpley\", \"Alexander Williams\", \"Peter N Wood\", \"Caitlyn Y.\", \"Ryan Zell\",\"random name\"]\n#initial solution\n\n=begin\n group_arrays = []\n i = 0\n while i < roster.length\n group_arrays << roster[i..i+3]\n i += 4\n end\n\n extra = []\n i = 0\n group_arrays.each { |group|\n if group.length < 3\n extra = group #take contents of group and add it to a different group\n if group_arrays[i].length == 5\n i += 1\n end\n group_arrays[i].concat(extra)\n group.pop\n end\n }\n puts group_arrays.to_s\nend\n\n=end\n\n# If I run this program 3 times, it will return the exact same groups\n#The program could be set up to store past groups, but I'd have to make some updates\n#no groups would be impacted by 1 person leaving, once 2 people left I could run the code again though.\n#biggest issue is I can empty the last array, but it doesn't delete the brackets. so that's a thing.\n\n#refactored solution:\n\n group_arrays = []\n while roster.length > 0\n group_arrays << roster.slice!(0..3)\n end\n\n left_overs = group_arrays[-1]\n\n i = 0\n group_arrays.each { |array|\n if left_overs.length < 3 && left_overs.length > 0\n group_arrays[i].push(left_overs[0])\n left_overs.shift\n if group_arrays[i].length == 5\n i += 1\n end\n elsif array.length > 5\n left_overs.push(array[-1])\n array.pop\n end\n }\n puts group_arrays.to_s\nend", "def separator\n @parts.push(separator: true)\n end", "def group_entries entries\n entries.group_by do |title, _|\n begin\n Time.parse(title).strftime '%Y-%m-%d'\n rescue NoMethodError, ArgumentError\n time, = title.split ' ', 2\n Time.parse(time).strftime '%Y-%m-%d'\n end\n end\n end", "def hosts\n out = []\n out << \"group {\"\n out << ' filename \"deezy\";'\n Host.find_all_by_enabled(true).each do |host|\n out << [\n \" host #{host.hostname} { hardware ethernet #{host.mac}; \",\n \"#{\"fixed-address #{host.ip};\" unless host.ip.blank?}\",\n \"}\"\n ].join\n end\n out << \"}\"\n out << ''\n end", "def subject_names\n @subject_names ||= sw_subject_names\n end", "def text\n add_spaces(@text, @chars_per_group)\n end", "def groups\n @students.sort_by(&:fullname).each_slice((@students.count / 2.0).round).to_a\n end" ]
[ "0.5797202", "0.56708646", "0.54754895", "0.5387237", "0.521226", "0.51765233", "0.51142335", "0.5113042", "0.5083404", "0.50519574", "0.50195575", "0.50177157", "0.5016444", "0.50070834", "0.49938846", "0.49804804", "0.4949677", "0.4927427", "0.49213883", "0.49210402", "0.49146587", "0.49036217", "0.48855388", "0.48619518", "0.4861726", "0.48529875", "0.48400322", "0.48121706", "0.48095065", "0.48042756", "0.48042756", "0.48042756", "0.47988454", "0.47984546", "0.4781341", "0.47787642", "0.47566894", "0.47533983", "0.4752862", "0.4746048", "0.4744641", "0.47224343", "0.47200316", "0.4718154", "0.47180125", "0.47137257", "0.47052872", "0.47014445", "0.46997666", "0.46974424", "0.4694164", "0.46866697", "0.46648902", "0.46558523", "0.46491972", "0.46475363", "0.46469966", "0.4644071", "0.46420696", "0.46412265", "0.46371534", "0.46288222", "0.46287128", "0.46246874", "0.46216732", "0.4621548", "0.4620815", "0.4620007", "0.46193498", "0.46113852", "0.4610115", "0.46086153", "0.4607617", "0.46069065", "0.45921463", "0.45875657", "0.45766228", "0.4568461", "0.4567327", "0.45568973", "0.45559686", "0.45539314", "0.455262", "0.45524254", "0.45487076", "0.45422003", "0.4539001", "0.45311153", "0.45243067", "0.45090228", "0.45038208", "0.45026985", "0.44935387", "0.44923967", "0.44923452", "0.4487926", "0.4487778", "0.44873697", "0.4486998", "0.4485157" ]
0.50835097
8
Creates groupings of resources seprated by semicolons.
def resources_column list = [] resources.each { |rss| list << rss.name } list.join(';') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_group\n group new_resource.group do\n gid new_resource.gid\n system true\n end\n end", "def create_groups(people)\n number_people = people.length\n if number_people < 3\n group_quantity = 1\n else\n group_quantity = number_people / 3\n end\n group_number = 1\n groups_names = Hash.new(\"\")\n people.each do |name|\n if group_number <= group_quantity\n groups_names[group_number] += (name + \", \")\n group_number += 1\n else\n groups_names[1] += (name + \", \")\n group_number = 2\n end\n end\n groups_names.each do |group, name|\n print \"\\n\", \"Group \", group, \"\\n\"\n print name, \"\\n\"\n end\nend", "def build_grouping_body\n arr = []\n data.each do |_,group| \n arr << render_group(group, options)\n end\n output << arr.join(\",\\n\")\n end", "def hosts\n out = []\n out << \"group {\"\n out << ' filename \"deezy\";'\n Host.find_all_by_enabled(true).each do |host|\n out << [\n \" host #{host.hostname} { hardware ethernet #{host.mac}; \",\n \"#{\"fixed-address #{host.ip};\" unless host.ip.blank?}\",\n \"}\"\n ].join\n end\n out << \"}\"\n out << ''\n end", "def group(path, name)\n RubyAem::Resources::Group.new(@client, path, name)\n end", "def group_builder; end", "def create_xml_group\n Chef::Log.debug \"Creating xml group : '#{ new_resource.name }'\"\n file = ::File.new(\"#{node['opennms']['conf']['home']}/etc/xml-datacollection-config.xml\", \"r\")\n contents = file.read\n doc = REXML::Document.new(contents, { :respect_whitespace => :all })\n doc.context[:attribute_quote] = :quote \n source_el = doc.elements[\"/xml-datacollection-config/xml-collection[@name='#{new_resource.collection_name}']/xml-source[@url='#{new_resource.source_url}']\"]\n # handle xml-group element\n xg_el = source_el.add_element 'xml-group', { 'name' => new_resource.name, 'resource-type' => new_resource.resource_type, 'resource-xpath' => new_resource.resource_xpath }\n if !new_resource.key_xpath.nil?\n xg_el.add_attribute( 'key-xpath' => new_resource.key_xpath)\n end\n if !new_resource.timestamp_xpath.nil?\n xg_el.add_attribute( 'timestamp-xpath' => new_resource.timestamp_xpath)\n end\n if !new_resource.timestamp_format.nil?\n xg_el.add_attribute( 'timestamp-format' => new_resource.timestamp_format)\n end\n # handle xml-object elements\n if !new_resource.objects.nil?\n new_resource.objects.each do |name, details|\n xg_el.add_element 'xml-object', {'name' => name, 'type' => details['type'], 'xpath' => details['xpath']}\n end\n end\n out = \"\"\n formatter = REXML::Formatters::Pretty.new(2)\n formatter.compact = true\n formatter.write(doc, out)\n ::File.open(\"#{node['opennms']['conf']['home']}/etc/xml-datacollection-config.xml\", \"w\"){ |file| file.puts(out) }\nend", "def groups; end", "def groups; end", "def groups; end", "def make_grp_prj_periods\n grp = {}; prj = {}\n @period_fields.each do |period|\n grp[period] = '$' + period\n prj[period] = '$_id.' + period\n end\n return [grp, prj]\n end", "def build_groups\n groups = {}\n roles = %w[client server initial]\n roles.each do |role|\n groups[role] = build_roles(role)\n end\n groups\n end", "def build_groups # rubocop:disable Metrics/AbcSize\n group_array = []\n @data['controls'].each do |control|\n group = HappyMapperTools::Benchmark::Group.new\n group.id = control['id']\n group.title = control['gtitle']\n group.description = \"<GroupDescription>#{control['gdescription']}</GroupDescription>\" if control['gdescription']\n\n group.rule = HappyMapperTools::Benchmark::Rule.new\n group.rule.id = control['rid']\n group.rule.severity = control['severity']\n group.rule.weight = control['rweight']\n group.rule.version = control['rversion']\n group.rule.title = control['title'].tr(\"\\n\", ' ') if control['title']\n group.rule.description = \"<VulnDiscussion>#{control['desc'].tr(\"\\n\", ' ')}</VulnDiscussion><FalsePositives></FalsePositives><FalseNegatives></FalseNegatives><Documentable>false</Documentable><Mitigations></Mitigations><SeverityOverrideGuidance></SeverityOverrideGuidance><PotentialImpacts></PotentialImpacts><ThirdPartyTools></ThirdPartyTools><MitigationControl></MitigationControl><Responsibility></Responsibility><IAControls></IAControls>\"\n\n if ['reference.dc.publisher', 'reference.dc.title', 'reference.dc.subject', 'reference.dc.type', 'reference.dc.identifier'].any? { |a| @attribute.key?(a) }\n group.rule.reference = build_rule_reference\n end\n\n group.rule.ident = build_rule_idents(control['cci']) if control['cci']\n\n group.rule.fixtext = HappyMapperTools::Benchmark::Fixtext.new\n group.rule.fixtext.fixref = control['fix_id']\n group.rule.fixtext.fixtext = control['fix']\n\n group.rule.fix = build_rule_fix(control['fix_id']) if control['fix_id']\n\n group.rule.check = HappyMapperTools::Benchmark::Check.new\n group.rule.check.system = control['checkref']\n\n # content_ref is optional for schema compliance\n if @attribute['content_ref.name'] || @attribute['content_ref.href']\n group.rule.check.content_ref = HappyMapperTools::Benchmark::ContentRef.new\n group.rule.check.content_ref.name = @attribute['content_ref.name']\n group.rule.check.content_ref.href = @attribute['content_ref.href']\n end\n\n group.rule.check.content = control['check']\n\n group_array << group\n end\n @benchmark.group = group_array\n end", "def make_grp_prj_nodes\n grp = {}; prj = {}\n @nodes_fields.each do |node|\n grp[node] = '$' + node\n prj[node] = '$_id.' + node\n end\n return [grp, prj]\n end", "def whisper_groups\n {\n 'console'=>%w{console commandline shell irb terminal ascii},\n 'tag'=>%w{tag tagging taggable triple semantic},\n 'tree'=>%w{tree hierarchy outline},\n 'sites'=>%w{delicious freebase}\n # thor, table, cli, repl, menu\n }\n end", "def group_header(class_name)\n name_parts = class_name.split('::')\n group = name_parts[2]\n collection = name_parts[3]\n\n # split group and collection to words\n pattern = /(?=[A-Z])/\n\n group = group.split(pattern).join(' ')\n collection = collection.split(pattern).join(' ')\n\n # write group and collection to file\n file.write \"# #{group}\\n\\n\"\n file.write \"# #{collection} [/#{file_name}]\\n\\n\"\n end", "def hyrax_group_names\n groups\n end", "def links_group_by_separated(attribute, separator)\n links_group_by(attribute, links_duplicate_on(attribute, separator))\n end", "def get_file_groups globs\n \t\t pos = 1\n \t\t file_groups = { groups: [] }\n \t\t \n globs.each do |glob|\n # e.g { group1: { path: '*.*', files: [file1, file2]} }\n group_name = \"group#{pos}\"\n files_raw = Dir.glob(glob)\n\t\t\t\tfiles = files_raw.map do |f|\n\t \tURI.escape f\n end\n file_group_object = { name: group_name, path: glob, files: files , files_raw: files_raw}\n file_groups[group_name.to_sym] = file_group_object\n file_groups[:groups].push file_group_object\n pos += 1 \n end\n file_groups\n \t\tend", "def new_group(key)\n []\n end", "def build_group_header\n output << \" \\\"#{data.name}\\\":\"\n end", "def generate_inventory_groups\n groups_of_groups = {}\n defined_groups = []\n group_vars = {}\n inventory_groups = \"\"\n\n # Verify if host range patterns exist and warn\n if config.groups.any? { |gm| gm.to_s[RANGE_PATTERN] }\n @machine.ui.warn(I18n.t(\"vagrant.provisioners.ansible.ansible_host_pattern_detected\"))\n end\n\n config.groups.each_pair do |gname, gmembers|\n if gname.is_a?(Symbol)\n gname = gname.to_s\n end\n\n if gmembers.is_a?(String)\n gmembers = gmembers.split(/\\s+/)\n elsif gmembers.is_a?(Hash)\n gmembers = gmembers.each.collect{ |k, v| \"#{k}=#{v}\" }\n elsif !gmembers.is_a?(Array)\n gmembers = []\n end\n\n if gname.end_with?(\":children\")\n groups_of_groups[gname] = gmembers\n defined_groups << gname.sub(/:children$/, '')\n elsif gname.end_with?(\":vars\")\n group_vars[gname] = gmembers\n else\n defined_groups << gname\n inventory_groups += \"\\n[#{gname}]\\n\"\n gmembers.each do |gm|\n # TODO : Expand and validate host range patterns\n # against @inventory_machines list before adding them\n # otherwise abort with an error message\n if gm[RANGE_PATTERN]\n inventory_groups += \"#{gm}\\n\"\n end\n inventory_groups += \"#{gm}\\n\" if @inventory_machines.include?(gm.to_sym)\n end\n end\n end\n\n defined_groups.uniq!\n groups_of_groups.each_pair do |gname, gmembers|\n inventory_groups += \"\\n[#{gname}]\\n\"\n gmembers.each do |gm|\n inventory_groups += \"#{gm}\\n\" if defined_groups.include?(gm)\n end\n end\n\n group_vars.each_pair do |gname, gmembers|\n if defined_groups.include?(gname.sub(/:vars$/, \"\")) || gname == \"all:vars\"\n inventory_groups += \"\\n[#{gname}]\\n\" + gmembers.join(\"\\n\") + \"\\n\"\n end\n end\n\n return inventory_groups\n end", "def create\n file = Tempfile.new(\"onesecgroup-#{resource[:name]}-create.xml\")\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.TEMPLATE do\n xml.NAME resource[:name]\n xml.DESCRIPTION resource[:description]\n resource[:rules].each do |rule|\n xml.RULE do\n rule.each do |k, v|\n xml.send(k.upcase, v)\n end\n end\n end if resource[:rules]\n end\n end\n tempfile = builder.to_xml\n file.write(tempfile)\n file.close\n self.debug \"Creating secgroup using #{tempfile}\"\n onesecgroup('create', file.path)\n file.delete\n @property_hash[:ensure] = :present\n end", "def resourcegroups\n result = @http.get('/resourcegroups')\n result[1]\n end", "def group_divider (array_of_names)\n\tcounter = 0\n\tgroup_num = 0\n\tgroup_storage = []\n\tif array_of_names == nil\n\t\treturn nil\n\telsif\n\t\tarray_of_names.length < 3\n\t\tp \"It's no fun in a group less than 3 people.\"\n\telsif array_of_names.length == 3\n\t\tp \"Group 1: \" + array_of_names.join(\", \")\n\telsif array_of_names.length % 4 != 0\n\t\t\n\t\twhile counter < array_of_names.length \n\t\t\tgroup_storage << array_of_names[counter..counter + 3]\n\t\t\tcounter += 4\n\t\t\tif group_storage[group_num].length == 2\n\t\t\t\tgroup_storage.last << group_storage.first.pop\n\t\t\telsif group_storage[group_num].length == 1\n\t\t\t\tgroup_storage.first << group_storage.pop.pop\n\t\t\tend\n\t\t\tgroup_num += 1\n\t\tend\n\telse\n\t\t\n\t\twhile counter < array_of_names.length \n\t\t\tgroup_storage << array_of_names[counter..counter + 3]\n\t\t\tcounter += 4\n\t\tend\n\t\t\n\tend\n\t\n\tgroup_name_assign = 1\n\twhile group_name_assign <= group_storage.length\n\t\tp \"Group #{group_name_assign}: \" + group_storage[group_name_assign - 1].join(\", \")\n\t\tgroup_name_assign += 1\n\tend\t\nend", "def write_groups(groups, f)\n groups.each do |key, array|\n f.write(\"\\n[#{key}]\\n\")\n if array.count > 1\n array.each do |value|\n f.write(\"#{value}\\n\")\n end\n else\n f.write(\"#{array.join('')}\\n\")\n end\n end\n end", "def createGroup _args\n \"createGroup _args;\" \n end", "def group_by_id(instances)\n instances.group_by do |i|\n new_resource.unique_fields.map { |f| i['properties'][f] }\n end\n end", "def resource_groups\n refs = references(:resource_groups)\n\n return [] if refs.blank?\n\n refs = refs.map { |x| File.basename(x) }.uniq\n\n @resource_groups ||= if refs.size > record_limit\n set = Set.new(refs)\n collect_inventory(:resource_groups) { @rgs.list(:all => true) }.select do |resource_group|\n set.include?(File.basename(resource_group.id.downcase))\n end\n else\n collect_inventory_targeted(:resource_groups) do\n filter_my_region_parallel_map(refs) do |ref|\n safe_targeted_request { @rgs.get(ref) }\n end\n end\n end\n rescue ::Azure::Armrest::Exception => err\n _log.error(\"Error Class=#{err.class.name}, Message=#{err.message}\")\n []\n end", "def groups\n hyrax_groups.map(&:name)\n end", "def i_groups; end", "def discover_groups_string\n discover_groups.join(', ')\n end", "def create_groups\n Group.create(name: \"MWF Morning\", days: [\"Monday\", \"Wednesday\", \"Friday\"], \n start_time: Time.local(2014, 8, 25, 8, 30, 0),\n end_time: Time.local(2014, 8, 25, 11, 30, 0)\n )\n Group.create(name: \"TTH Morning\", days: [\"Tuesday\", \"Thursday\"], \n start_time: Time.local(2014, 8, 25, 8, 30, 0),\n end_time: Time.local(2014, 8, 25, 11, 30, 0)\n )\n Group.create(name: \"Afternoon\", days: [\"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\"], \n start_time: Time.local(2014, 8, 25, 12, 30, 0),\n end_time: Time.local(2014, 8, 25, 15, 30, 0)\n )\nend", "def group; end", "def grouping_sets\n raise Error, \"GROUP BY GROUPING SETS not supported on #{db.database_type}\" unless supports_grouping_sets?\n clone(:group_options=>:\"grouping sets\")\n end", "def groups\n @groups = init_groups\n end", "def group_lines\n @lines.rewind\n\n in_list = false\n wanted_type = wanted_level = nil\n\n block = LineCollection.new\n group = nil\n\n while line = @lines.next\n if line.level == wanted_level and line.type == wanted_type\n group.add_text(line.text)\n else\n group = block.fragment_for(line)\n block.add(group)\n\n if line.type == :LIST\n wanted_type = :PARAGRAPH\n else\n wanted_type = line.type\n end\n\n wanted_level = line.type == :HEADING ? line.param : line.level\n end\n end\n\n block.normalize\n block\n end", "def __group_entries(entries)\n entry_groups = {}\n entries.map do |entry|\n # group streams by their base paths (ignore ~decim endings)\n group_name = entry[:chunks].pop.gsub(UpdateStream.decimation_tag, '')\n __add_to_group(entry_groups, group_name, entry)\n end\n entry_groups\n end", "def generate_groups(groups, type)\r\n [].tap do |results|\r\n groups.each do |n, obj|\r\n group = {}\r\n group[\"name\"] = obj['name']\r\n group[\"code\"] = n\r\n group[\"risk_category\"] = \"AUTO\"\r\n group[type] = obj[type]\r\n results << group\r\n end\r\n end\r\nend", "def group\n klass.collection.group(\n :key => field_list,\n :cond => selector,\n :initial => { :group => [] },\n :reduce => Javascript.group\n ).collect do |docs|\n docs[\"group\"] = docs[\"group\"].collect do |attrs|\n Mongoid::Factory.from_db(klass, attrs)\n end\n docs\n end\n end", "def to_string\n h = ''\n h << \"Groups\\n\"\n groups.each do |group|\n h << \" #{group}\\n\"\n end\n \n h << \"\\nHosts:\\n\"\n hosts.each do |host|\n h << \" #{host}\\n\"\n end\n \n h << \"\\nRoles\\n\"\n roles.each do |role|\n h << \" #{role}\\n\"\n end\n\n h << \"\\nTop-level tasks\\n\"\n tasks.each do |task|\n h << \" #{task}\\n\"\n end\n\n h\n end", "def grouped(files); end", "def create\n start = Time.now\n debug \"Creating device group: \\\"#{resource[:full_path]}\\\"\"\n connection = self.class.get_connection(resource[:account])\n recursive_group_create(connection,\n resource[:full_path],\n resource[:description],\n resource[:properties],\n resource[:disable_alerting])\n debug \"Finished in #{(Time.now-start)*1000.0} ms\"\n end", "def create!\n misc = GroupCategory.find_by(slug: 'misc').id\n GROUP_NAMES.each do |name|\n # Make the group\n group = Group.where(\n name: name\n ).first_or_create(category_id: misc)\n # Set up an initial owner\n GroupMember.create!(user: owner, group: group, rank: :admin)\n end\n\n # Build up neighborhood, so the aozora groups have each other as neighbors\n GROUP_NAMES.permutation(2) do |from, to|\n src = Group.find_by(name: from)\n dst = Group.find_by(name: to)\n GroupNeighbor.create!(source: src, destination: dst)\n end\n end", "def resource_groups\n @client.resource_groups.list\n end", "def create_document groups\n doc = RDoc::Markup::Document.new\n doc.omit_headings_below = 2\n doc.file = @top_level\n\n doc << RDoc::Markup::Heading.new(1, File.basename(@file_name))\n doc << RDoc::Markup::BlankLine.new\n\n groups.sort_by do |day,| day end.reverse_each do |day, entries|\n doc << RDoc::Markup::Heading.new(2, day.dup)\n doc << RDoc::Markup::BlankLine.new\n\n doc.concat create_entries entries\n end\n\n doc\n end", "def create_document groups\n doc = RDoc::Markup::Document.new\n doc.omit_headings_below = 2\n doc.file = @top_level\n\n doc << RDoc::Markup::Heading.new(1, File.basename(@file_name))\n doc << RDoc::Markup::BlankLine.new\n\n groups.sort_by do |day,| day end.reverse_each do |day, entries|\n doc << RDoc::Markup::Heading.new(2, day.dup)\n doc << RDoc::Markup::BlankLine.new\n\n doc.concat create_entries entries\n end\n\n doc\n end", "def groups\n if groups_last_update.blank? || ((Time.now - groups_last_update) > 24 * 60 * 60)\n return groups!\n end\n group_list.split(\";?;\")\n end", "def group _args\n \"group _args;\" \n end", "def get_groups\n `id -nG #{name}`.split(' ')\n end", "def group(*) end", "def generate_resources_list\n resources = YARD::Registry.all(:resource).uniq.sort_by {|resource| resource.name.to_s}\n generate_full_list(resources, 'Resource', 'resources')\nend", "def compute_groups\n groups = []\n\n yard_methods = yard_object.meths.reject do |method|\n name = method.name.to_s\n name =~ /^_/\n end\n\n yard_methods.each do |yard_method|\n group = groups.find { |g| g.name == group_name_from_text(yard_method.group) }\n unless group\n group = CodeObjects::Group.new\n group.name = group_name_from_text(yard_method.group)\n group.html_description = markdown_h(yard_method.group.lines.drop(1).join)\n group.meths = []\n groups << group\n end\n\n\n # TODO: the attr_writer and readers are discerned on a who come first\n # basis.\n method = create_method(yard_method)\n group.meths << method unless group.meths.find { |m| m.name == method.name }\n end\n groups\n end", "def group_creator(name_list)\n\n\taccountability_groups = []\n\trandomized_names = name_list.shuffle #Used non-destructive shuffle so that I can call on list again for unit 2/3\n\n\twhile (randomized_names.length > 4)\n\t\taccountability_groups << randomized_names.pop(4)\t\n\tend\n\n\tcounter = 0\n\tuntil (randomized_names.length == 0)\n\t\taccountability_groups[counter] << randomized_names.pop\n\t\tcounter\t+= 1\n\tend\n\t\t\n\tcounter = 0\n\tuntil accountability_groups[counter] == nil\n\t\tputs \"Group \" + (counter + 1).to_s + \":\" ; puts accountability_groups[counter]\n\t\tputs\n\t\tcounter += 1 \n\tend\nend", "def create_group(stream, group)\n stream = stream_name(stream)\n connection.xgroup(:create, stream, \"#{stream}-#{group}\", '$',\n mkstream: true)\n end", "def group_resource\n return @group_resource if @group_resource\n @group_resource = Chef::Resource::Group.new(new_resource.group, run_context)\n @group_resource\n end", "def begin_group(kind); end", "def lex_group start_state, regexp, action = nil\n rule = Rule.new(start_state, regexp, action)\n rule.group = group\n self.group << rule\n end", "def ldap_group_list(refresh = false, separator = \"\\n\")\n @ldap_group_list = nil if refresh\n @ldap_group_list ||= ldap_groups(refresh).map{|v| v.name.upcase}.join(separator)\n end", "def make_groups(list_of_names)\n result = []\n num_people = list_of_names.length\n cur_group = []\n list_of_names.each do |name|\n cur_group.push(name)\n if cur_group.length == 4 || (cur_group.length == 3 && num_people == 3)\n result.push(cur_group)\n cur_group=[]\n end\n end\n # Right now the solution doesn't gracefully handle 6 people.\n # I should write a find_available function to find an open group to stick someone\n # in.\n if cur_group.length == 2\n name = cur_group.pop\n result[1].push(name)\n end\n if cur_group.length == 1\n name = cur_group.pop\n result[0].push(name)\n end\n return result\nend", "def create\n @resource = Resource.new(params[:resource])\n\n respond_to do |format|\n if @resource.save\n format.html { redirect_to(edit_admin_resource_path(@resource), :notice => 'Resource was successfully created. Now select association permissions and resource owner.') }\n format.xml { render :xml => @resource, :status => :created, :location => @resource }\n else\n @resource_groups = ResourceGroup.alphabetical.all\n format.html { render :action => \"new\" }\n format.xml { render :xml => @resource.errors, :status => :unprocessable_entity }\n end\n end\n end", "def initialize_host_groups\n self.host_groups = settings['host_groups'].split(',').flatten.compact.map(&:strip).uniq.map { |group_name | HostGroup.find_or_create(:name => group_name.strip) }\n end", "def ii_groups; end", "def associate_records_to_groups\n put_isos_into_iso_group\n put_agents_into_iso_group\n put_merchants_into_iso_group\n end", "def iii_groups; end", "def setupGroupsOfThumbnails(items, header)\n \n lastItem = items.size - 1\n currItem = 0\n\n retval = \"\"\n items.each do |item|\n #if a new row should be made\n if (currItem%3 == 0)\n retval << InitializeRow\n\n #if this is the first item, add the section heading\n if (currItem == 0)\n retval << createHeader(header)\n end\n\n retval << BeginThumbnailSet\n end\n\n \n retval << startIndivThumbnail(item.picture) \n case header\n when \"Organizations\"\n retval << createOrganizationCaption(item)\n when \"People to Know\"\n retval << createLeaderCaption(item) \n end\n\n retval << CreateEndThumbnailItem\n\n\n if (currItem == lastItem || currItem%3 == 2)\n retval << FinishThumbnailList\n end\n\n currItem += 1\nend \n\nreturn retval.html_safe \n end", "def add_hosts_group\n puppet_ip = any_hosts_as?(:loadbalancer) ? loadbalancer.ip : master.ip\n hosts_group = {\n \"name\" => \"Clamps Managed Hosts\",\n \"rule\" => [\"or\", [\"=\", %w[fact id], \"root\"]],\n \"parent\" => pe_infra_uuid,\n \"classes\" => {\n \"hosts\" => {\n \"purge_hosts\" => false,\n \"collect_all\" => true,\n \"host_entries\" => {\n \"puppet\" => { \"ip\" => puppet_ip }\n }\n }\n }\n }\n\n dispatcher.find_or_create_node_group_model(hosts_group)\nend", "def get_group(string); end", "def fill_breakable(sep=' ', width=sep.length)\n group { breakable sep, width }\n end", "def groups\n @groups ||= {}\n end", "def generate_entry(hash,type)\n entry = []\n for group in hash.keys\n if(group == \"no_group\") #no_group means all choices are mandatory\n for child_comp in hash[group]\n entry.push(\"#{type}:#{child_comp.id}\")\n end\n else #otherwise choose one of the grouped members\n group_group = \"#{type}\"\n for child_comp in hash[group]\n if(!(type==\"v\" && hash[group].length == 1)) #manditory valuefields are not prepended with :\n group_group += \":\"\n end\n group_group += \"#{child_comp.id}\"\n end\n entry.push(group_group)\n end\n end\n #logger.info(\"\\n\\n\\n\\n\\n entry:#{entry} join:#{entry.join(\"|\")} \\n\\n\\n\\n\\n\\n\")\n entry.join(\"|\")\n end", "def groupby_fields\n ids = {}\n ids.merge!(make_grp_prj_periods[0])\n ids.merge!(make_grp_prj_nodes[0])\n { '_id' => ids }\n end", "def resource_groups\n return @resource_groups unless @resource_groups.nil?\n\n refs = references(:resource_groups) || []\n @resource_groups = refs.map { |ems_ref| resource_group(ems_ref) }.compact\n end", "def create_groups(names)\n groups = []\n names.shuffle.each_slice(4) do |group|\n if group.count == 4\n groups << group\n else\n i = 0\n group.each do |name|\n groups[i] << name\n i += 1\n end\n end\n end\n p groups\nend", "def groups(recursive = false)\n Set.new() << self\n end", "def group_creator\n group = Random.new.rand(1..3)\n return group\nend", "def create_object_key\n $feed.record(\"group:#{id}\", { id: self.permalink, name: self.display_name } )\n end", "def create_groups(groupnames)\r\n groupnames.map {|groupname| @logger.debug(\"Checking #{groupname} for existence...\")\r\n if get_groupid(groupname) == nil\r\n\t\t\t\t@logger.debug(\"Looks like #{groupname} is empty, therefore creating it\")\r\n\t\t\t\tgroupobject = OpenNebula::Group.new(OpenNebula::Group.build_xml,@client)\r\n\t\t\t\trc = groupobject.allocate(groupname)\r\n\t\t\t\tif OpenNebula.is_error?(rc)\r\n \t\t\t\t@logger.error(\"Error occured while creating group: #{rc.message}\")\r\n \t\t end\r\n end\r\n }\r\n end", "def task_groups\n @task_groups ||= begin\n @definition.each_with_index.inject([]) do |task_groups, (action, i)|\n # the action has a catch, it's a singular task group\n if action['do'] && action['do']['catch']\n task_groups << TaskGroup.new(self)\n elsif action['do'] && i > 0 && is_a_validation?(@definition[i-1])\n task_groups << TaskGroup.new(self)\n elsif i == 0\n task_groups << TaskGroup.new(self)\n end\n\n task_groups[-1].add_action(action) && task_groups\n end\n end\n end", "def girl_groups; end", "def groups\n\t\t\t@groups ||= begin\n\t\t\t\tFile.readlines(File.join(@svcdir, 'group')).map { |g| g.strip }\n\t\t\trescue Exception => e\n\t\t\t\t[]\n\t\t\tend\n\t\tend", "def build_resources(param)\n resources = []\n param.each { |r|\n obj_parts = r.split(',')\n res = LessonPlanResource.new\n res.obj_id = obj_parts[0]\n res.obj_type = obj_parts[1]\n resources.push(res)\n }\n\n resources\n end", "def build_resources(param)\n resources = []\n param.each { |r|\n obj_parts = r.split(',')\n res = LessonPlanResource.new\n res.obj_id = obj_parts[0]\n res.obj_type = obj_parts[1]\n resources.push(res)\n }\n\n resources\n end", "def display_resource(group)\n \"Group ##{group.to_param}\"\n end", "def read_groups_string\n read_groups.join(', ')\n end", "def groups()\n\t\t\tend", "def createResourceGroup(resource_group_name)\n resource_group_params = Azure::ARM::Resources::Models::ResourceGroup.new.tap do |rg|\n rg.location = $region_dc\n end\n puts 'Create Resource Group...'\n print_item $resource_client.resource_groups.create_or_update(resource_group_name, resource_group_params)\nend", "def key_name_groups\n KEY_NAME_GROUPS.map { |kn| const_get kn }\n end", "def reduce_grouping_parenthenses(_production, _range, _tokens, theChildren)\n Regex::NonCapturingGroup.new(theChildren[1])\n end", "def groups_in_pairs\n\t #@group_locate = Group.instantiator(params[:id])\n @groups = [['[None]', nil]] + Group.in_pairs(groups = [], parent_name = \"\", list = [], params[:id])\n end", "def output_groups(names_array, size_of_group)\n\tgroup_id = 1\n\tuntil names_array.size == 0 do\n\t\tputs \"Group \" + group_id.to_s\n\t\tputs \"=================\"\n\t\tputs names_array.shift(size_of_group)\n\t\tputs\n\t\tgroup_id += 1\n\tend\nend", "def add_resource(*names)\n self.synchronize do\n # Recording membership first, used for ALL_UP event\n names.each do |name|\n g = OmfEc.experiment.group(name)\n if g # resource to add is a group\n @members += g.members\n self.add_resource(*g.members.uniq)\n else\n @members << name.to_s\n OmfEc.subscribe_and_monitor(name) do |res|\n info \"Config #{name} to join #{self.name}\"\n res.configure(membership: self.id)\n end\n end\n end\n end\n end", "def group(entry)\n push(\"$group\" => evolve(entry.__expand_complex__))\n end", "def groups\n quads\n end", "def group_locations_by_style(locations)\n locations.each_with_object({}) do |location, store|\n styles = []\n if color = location.color\n styles << \"color:#{color}\" \n end\n if size = location.size\n styles << \"size:#{size}\" \n end\n if icon = location.icon\n styles << \"icon:#{encode_url(icon)}\"\n end\n if label = location.label\n styles << \"label:#{label}\" \n end\n\n key = styles.join('|') \n val = \"|#{location.lat},#{location.lng}\"\n (store[key] ||= \"\") << val\n end\n end", "def align_group(input_strings, type)\n\tp = LR_parser.new(type)\n\tmetas = []\n\tinput_strings.each { |str| metas.push(p.parse_meta(str)); }\n\tmetas.each {|m| m.separate_first!}\n\tmatcher = DPMatcher.new\n\tpairs_array = [];\n\tfor i in 0..metas.size-2 do \n\t\tpairs_array.push(matcher.generate_pairs(metas[i].value, metas[i+1].value));\n\tend\n\tr = Recreator.new(type)\n\tchains = r.generate_chains(pairs_array);\n\tlines = r.multiline_reconstruction(metas, chains)\n\treturn lines\nend", "def resources &block\n rc = components.collect do |resource_name, component|\n [resource_name.to_s.singularize.to_sym, component[:resource], component.slice(:title, :exclude, :namespace)]\n end\n last = rc.slice!(-1)\n parents = rc.inject(Hash.new){|p, v| p.merge!(v[0]=>v[1])}\n yield(parents, last[0], last[2])\n end", "def create_example_groups(groups_count = 100)\n # FIXME: What if Example organization is not found?\n organization = Organization.where(:name => 'Example').first\n \n # Get example students\n users = User.where(:firstname => 'Student', :organization_id => organization.id).all\n user_counter = 0\n \n # Create groups and submissions\n for i in (1..groups_count)\n # Create group\n group = Group.new(:course_instance_id => self.id, :name => \"Group #{i}\", :max_size => 3)\n group.save(:validate => false)\n\n # Add users to group\n students_count = rand(3) # self.groupsizemin + rand(self.groupsizemax - self.groupsizemin + 1)\n for j in (0..students_count)\n user = users[user_counter]\n group.add_member(user) if user\n user_counter += 1\n end\n\n break if user_counter >= users.size\n end\n end", "def test_grouping\n make_dummy_source(\"http://groupme/source1\", N::FOAFX.Goat, N::FOAFX.Bee)\n make_dummy_source(\"http://groupme/source2\", N::FOAFX.Goat)\n make_dummy_source(\"http://groupme/source3\", N::FOAFX.Bee)\n results = Source.groups_by_property(:type, [ N::FOAFX.Goat, N::FOAFX.Bee ])\n assert_equal(2, results.size)\n assert_equal(2, results[N::FOAFX.Goat].size)\n assert_equal(2, results[N::FOAFX.Bee].size)\n end", "def create_set\n x = 1\n while Dir.exists?(File.join(@path, \"Packages Set %d\" % x)) do\n x = x.next\n end\n\n package_set = File.join(@path, \"Packages Set %d\" % x)\n Dir.mkdir(package_set)\n end", "def resources\n ([self] + parent_groups).reverse.inject({}) do |memo, group|\n begin\n memo.merge(group.poise_spec_helpers[:resources] || {})\n rescue NoMethodError\n memo\n end\n end\n end" ]
[ "0.57846665", "0.55669636", "0.5462681", "0.536778", "0.5353421", "0.52777594", "0.5269885", "0.526505", "0.526505", "0.526505", "0.5262926", "0.521771", "0.52125305", "0.52081764", "0.5191578", "0.5180895", "0.51791143", "0.51454633", "0.5092947", "0.5091832", "0.5085406", "0.5078778", "0.5073362", "0.5050197", "0.50027347", "0.49934873", "0.49867475", "0.49850196", "0.49751002", "0.49726596", "0.4962744", "0.49574623", "0.49556887", "0.49531096", "0.49517444", "0.49462786", "0.4946003", "0.49409497", "0.49330705", "0.49245763", "0.49238503", "0.49229914", "0.49174672", "0.49131703", "0.4908488", "0.48991296", "0.48991296", "0.4889107", "0.4875922", "0.487489", "0.4865571", "0.4858102", "0.48558787", "0.48437494", "0.48366803", "0.48256227", "0.48209786", "0.48124743", "0.47993228", "0.4798392", "0.47925025", "0.47915182", "0.4782886", "0.4781627", "0.47729337", "0.47675526", "0.47672734", "0.47665903", "0.4766116", "0.47633588", "0.47497174", "0.47462574", "0.47428256", "0.47307783", "0.47166517", "0.47157297", "0.47039345", "0.47022903", "0.46938506", "0.46891424", "0.46847594", "0.46839312", "0.46839312", "0.46812028", "0.46671864", "0.46662447", "0.46563518", "0.4653605", "0.46483418", "0.46482167", "0.4646785", "0.46438047", "0.46423978", "0.4637668", "0.46373528", "0.4636069", "0.46344537", "0.4633465", "0.46304655", "0.4625275", "0.46221402" ]
0.0
-1
Creates comma seperated list of resources.
def resource_list list = [] resources.each { |rss| list << rss.name } list.to_sentence end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_resources_list\n resources = YARD::Registry.all(:resource).uniq.sort_by {|resource| resource.name.to_s}\n generate_full_list(resources, 'Resource', 'resources')\nend", "def list\n puts local_resources.map { |name, resource| name }.join(\" \")\n end", "def manipulate_resource_list(resources)\n resources + options[:targets].map do |t|\n StaticResource.new(\n app.sitemap,\n t[:output]\n ) { \n File.read(File.expand_path(tmp_path(t), app.root))\n }\n end\n end", "def resource_list\n self.resources\n end", "def resources_column\n list = []\n resources.each { |rss| list << rss.name }\n list.join(';')\n end", "def list_resources\n resources = []\n addr = create_address(:sliceID => @@sliceID, :domain => @@domain)\n resource_prefix = \"#{addr.generate_address}/\"\n nodes = list_nodes(@@domain)\n nodes.each{|node|\n next if !node.include?(resource_prefix)\n node.slice!(resource_prefix)\n resources << node if !node.empty?\n }\n resources\n end", "def manipulate_resource_list(resources)\n return resources unless @generate_tag_pages\n\n resources + @blog_data.tags.map do |tag, articles|\n tag_page_resource(tag, articles)\n end\n end", "def manipulate_resource_list(resources)\n new_resources = []\n\n # Set up date pages if the appropriate templates have been specified\n @blog_data.articles.group_by { |a| a.date.year }.each do |year, year_articles|\n new_resources << year_page_resource(year, year_articles) if @generate_year_pages && @year_template\n\n year_articles.group_by { |a| a.date.month }.each do |month, month_articles|\n new_resources << month_page_resource(year, month, month_articles) if @generate_month_pages && @month_template\n\n month_articles.group_by { |a| a.date.day }.each do |day, day_articles|\n new_resources << day_page_resource(year, month, day, day_articles) if @generate_day_pages && @day_template\n end\n end\n end\n\n resources + new_resources\n end", "def resources\n @resources ||= []\n end", "def build_resources(param)\n resources = []\n param.each { |r|\n obj_parts = r.split(',')\n res = LessonPlanResource.new\n res.obj_id = obj_parts[0]\n res.obj_type = obj_parts[1]\n resources.push(res)\n }\n\n resources\n end", "def build_resources(param)\n resources = []\n param.each { |r|\n obj_parts = r.split(',')\n res = LessonPlanResource.new\n res.obj_id = obj_parts[0]\n res.obj_type = obj_parts[1]\n resources.push(res)\n }\n\n resources\n end", "def friendly_properly_list(arr)\n return nil if arr.empty? # resources w/o properties\n\n props = arr.map { |x| \"``#{x[\"name\"]}``\" }\n\n # build the text string containing all properties bolded w/ punctuation\n if props.size > 1\n props[-1] = \"and #{props[-1]}\"\n end\n text = props.size == 2 ? props.join(\" \") : props.join(\", \")\n text << ( props.size > 1 ? \" are the properties\" : \" is the property\" )\n text << \" available to this resource.\"\n text\n end", "def create_resources_table(flattened_resources)\n table = []\n if (flattened_resources.nil? || flattened_resources.size == 0)\n return table\n end\n\n # Headings.\n base_headings = [ 'resource', 'type', 'depends_on', 'instance', 'id' ]\n attr_headings = []\n flattened_resources.each do |r|\n r['attributes'].keys.each do |k|\n attr_headings << k unless attr_headings.include?(k)\n end\n end\n table << base_headings + attr_headings\n\n # Resource data corresponding to headings.\n flattened_resources.each do |r|\n table << get_resource_row(r, attr_headings)\n end\n\n table\nend", "def list_items\r\n list = \"\"\r\n items.each{ |item| list = list + item.name + \"\\n\"}\r\n list\r\n end", "def list_resource_tpl\n @resource_tpl\n end", "def list_resource\n find_resource!(:template, \"#{new_resource.conf_dir}/list.conf\")\n end", "def resources\n @resources.values\n end", "def list(abs_url = nil)\n @ro_resource_mixin.list(abs_url)\n end", "def compute_list(mixins = nil)\n mixins = deep_clone(mixins) if mixins\n @backend_instance.compute_list(mixins) || Occi::Core::Resources.new\n end", "def lists\n Resources::Lists.new(self)\n end", "def list_all\n init_ivars\n uri_list = @pages.map { |page| page.uri }\n\n uri_list.empty? ? ',' : uri_list.join(',')\n end", "def build_list_helpers(resource)\n @module.module_eval <<-end_eval\n def #{resource.singular}_list(opts={}, &block)\n content = capture(&block)\n opts[:class] = ResourcefulViews.resourceful_classnames('#{resource.singular}_list', *(opts.delete(:class) || '').split)\n concat(content_tag((opts[:ordered] ? :ol : :ul), content, opts))\n end\n def #{resource.singular}_item(*args, &block)\n opts = args.extract_options!\n opts[:class] = ResourcefulViews.resourceful_classnames('#{resource.singular}', *(opts.delete(:class) || '').split)\n opts[:id] = '#{resource.singular}_' + args.first.id.to_s unless args.empty?\n content = capture(&block)\n concat(content_tag(:li, content, opts))\n end\n end_eval\n end", "def get_resources\n routes_doc = get_routes_doc\n resources_names = routes_doc.get_resources_names - resources_black_list\n\n resources_names.map do |resource|\n puts \"Generating #{resource} documentation...\" if trace?\n ResourceDoc.new( resource, routes_doc.get_actions_route_info( resource ) )\n end\n end", "def resources\n @resources\n end", "def resources\n resources = []\n\n default_storage = {\n 'swift_zone' => 100,\n 'object_port'=>6000,\n 'container_port'=>6001,\n 'account_port'=>6002,\n 'mountpoints'=> \"1 1\\n2 1\",\n 'weight'=> 100,\n 'types'=>['container', 'object', 'account'],\n }\n\n self[:storages].each do |storage|\n merged_storage = default_storage.merge(storage)\n merged_storage['types'].collect do |type|\n port = merged_storage[\"#{type}_port\"]\n options = {\n :name=>\"#{merged_storage['storage_address']}:#{port}\",\n :mountpoints=>merged_storage['mountpoints'],\n :zone => merged_storage['swift_zone']\n }\n resources += [Puppet::Type.type(\"ring_#{type}_device\".to_sym).new(options)]\n end\n end\n resources\n end", "def to_s\n resources.sort_by(&:ipaddress).map(&:to_s).join(\"\\n\")\n end", "def to_s\n 'RDF::List[' + join(', ') + ']'\n end", "def resources\n @resources ||= @response[@resource_field].to_a\n end", "def generate_resources\n [\n {\n :name => \"Weather Uppsala 1\",\n :description => \"Sensor which measures the weather in different places from Uppsala\",\n :manufacturer => \"Ericsson\",\n :model => \"ee80\",\n # :make => \"2\",\n # :serial_num => \"1234-ABCD-987\",\n # :polling_freq => \"60\",\n # :data_overview => \"data data data\",\n # :location => \"Uppsala, Sweden\",\n # :uri => \"http =>//sensors.ericsson.se\",\n :tags => \"temperature, weather, humidity, ericsson\",\n :resource_type => \"sensor\",\n :active => \"true\",\n :user_id => @cid\n },\n\n {\n :name => \"Weather Uppsala 2\",\n :description => \"Sensor which measures the weather in Uppsala\",\n :manufacturer => \"Ericsson\",\n :model => \"ef90\",\n # :make => \"2\",\n # :serial_num => \"5678-ABCD-987\",\n # :polling_freq => \"60\",\n # :resource_type => \"sensor\",\n # :data_overview => \"data data data\",\n # :location => \"Uppsala, Sweden\",\n # :uri => \"http =>//sensors.ericsson.se\",\n :tags => \"temperature, weather, humidity, ericsson\",\n :resource_type => \"sensor\",\n :active => \"true\",\n :user_id => @cid\n },\n\n {\n :name => \"Siemens si5\",\n :description => \"Sensor which measures the pollution\",\n :manufacturer => \"Siemens\",\n :model => \"s7\",\n # :make => \"1\",\n # :serial_num => \"1679-FGD-987\",\n # :polling_freq => \"60\",\n # :resource_type => \"sensor\",\n # :data_overview => \"data data data\",\n # :location => \"Stockholm, Sweden\",\n # :uri => \"http =>//sensors.siemens.se\",\n :tags => \"pollution, air, siemens\",\n :resource_type => \"sensor\",\n :active => \"true\",\n :user_id => @cid\n }\n ]\nend", "def included_resources\n @included_resources ||= begin\n return [] if include_param.nil?\n\n include_param.split(RESOURCES_SEPARATOR_CHAR).uniq.reject { |resource| invalid_resource?(resource) }\n end\n end", "def resource_names\n JSON.parse(@body).fetch('Resources', {}).keys\n end", "def manipulate_resource_list(resources)\n\n\n index_file = app.index_file\n new_index_path = \"/#{index_file}\"\n\n # for each resource\n resources.each do |resource|\n\n # has custom_url in frontmatter\n if resource.raw_data[:custom_url]\n\n # set path as custom_url\n resource.destination_path = resource.raw_data[:custom_url] + new_index_path\n end\n end\n end", "def resources\n return @resources\n end", "def resources\n return @resources\n end", "def resources\n return @resources\n end", "def format_object_name_list(objects); end", "def make_tags_list\n\ttag_links = String.new\n\tget_tags.each do |tag|\n\t\ttag_links += \"<li> + \" + link_for_tag(tag, @site.config()[:base_url] + \"/tags/\") + \" (#{items_with_tag(tag).count.to_s})</li>\"\n\tend\n\ttag_links\nend", "def resource_association_links_for(resource, options = {})\n output = Array.new\n resource_associations(:has_many).each do |association|\n text = resource_human_name_for(association, 2)\n if controller_path.include?('/')\n namespace = controller.class.parent.name.underscore\n path = [namespace, resource, association.to_s.tableize]\n else\n path = [resource, association.to_s.tableize]\n end\n options.merge!(class: collection_table_button_classes)\n output << link_to(text, path, options)\n end\n output.join(' ').html_safe\n end", "def add_tags list\n unless @tags.empty?\n @tags += ','\n end\n @tags += list.join(',')\n end", "def generate_libraries_list\n libraries = options.objects if options.objects\n generate_full_list(libraries, 'Library', 'libraries')\nend", "def list\n Dir.glob(\"#{App.config.resource_directory}/*.yaml\").each do |res|\n puts File.basename(res, '.yaml')\n end\n end", "def to_a\n resources\n end", "def tag_list\n tags.collect do |tag|\n tag.name\n end.join(', ')\n end", "def generate_recipes_list\n recipes = YARD::Registry.all(:recipe).uniq.sort_by {|recipe| recipe.Name.to_s}\n generate_full_list(recipes, 'Recipe', 'recipes')\nend", "def write_url_list(filename, id_columns, format_string, options = {})\n FileUtils.mkdir_p('urls')\n\n File.open(File.join('urls', filename), 'w') do |f|\n facility_ids(id_columns, options).to_enum.each do |id|\n f.write(\"#{format_string % {id: id}}\\n\")\n end\n end\nend", "def build_list(model, fields, items, resource = @resource.to_resource, link_options = {}, association = nil)\n template = \"app/views/admin/#{resource}/_#{resource.singularize}.html.erb\"\n\n if File.exist?(template)\n render :partial => template.gsub('/_', '/'), :collection => items, :as => :item\n else\n build_table(model, fields, items, link_options, association)\n end\n end", "def resources &block\n rc = components.collect do |resource_name, component|\n [resource_name.to_s.singularize.to_sym, component[:resource], component.slice(:title, :exclude, :namespace)]\n end\n last = rc.slice!(-1)\n parents = rc.inject(Hash.new){|p, v| p.merge!(v[0]=>v[1])}\n yield(parents, last[0], last[2])\n end", "def tag_list\n #converting all tag objects to an array of tag names\n self.tags.collect do |tag|\n tag.name\n end.join(\", \") #join the array of tag names with a comma\n end", "def format_list(items); end", "def resources_path_names; end", "def generate_cookbooks_list\n cookbooks = YARD::Registry.all(:cookbook).uniq.sort_by{|cookbook| cookbook.name.to_s}\n generate_full_list(cookbooks, 'Cookbooks', 'cookbooks')\nend", "def string_resource(resource)\n mystring=\"\\t\" + resource[:type].downcase + '{\"' + resource[:title] + '\":'+\"\\n\"\n resource[:parameters].each_pair do |k,v|\n if v.is_a?(Array)\n indent = \" \" * k.to_s.size\n\n mystring+=\"\\t #{k} => [\\n\"\n v.each do |val|\n mystring+=\"\\t #{indent} #{val},\\n\"\n end\n mystring+=\"\\t #{indent} ]\\n\"\n else\n mystring+=\"\\t #{k} => #{v}\\n\"\n end\n end\n mystring+=\"\\t}\\n\"\nend", "def extract_titles(resources)\n titles = []\n\n resources.each do |resource|\n titles << resource[:resource_id]\n end\n\n titles\nend", "def resources _args\n \"resources _args;\" \n end", "def tag_list\n tags.join(\", \")\n end", "def to_resources_name\n pluralize.underscore\n end", "def list_resources(options)\n #debug \"options = \" + options.inspect\n body, format = parse_body(options)\n params = body[:options]\n #debug \"Body & Format = \", opts.inspect + \", \" + format.inspect\n\n debug 'ListResources: Options: ', params.inspect\n\n only_available = params[:only_available]\n slice_urn = params[:slice_urn]\n\n authorizer = options[:req].session[:authorizer]\n # debug \"!!!authorizer = \" + authorizer.inspect\n\n debug \"!!!USER = \" + authorizer.user.inspect\n debug \"!!!ACCOUNT = \" + authorizer.account.inspect\n # debug \"!!!ACCOUNT_URN = \" + authorizer.account[:urn]\n # debug \"!!!ACCOUNT = \" + authorizer.user.accounts.first.inspect\n\n if slice_urn\n @return_struct[:code][:geni_code] = 4 # Bad Version\n @return_struct[:output] = \"Geni version 3 no longer supports arguement 'geni_slice_urn' for list resources method, please use describe instead.\"\n @return_struct[:value] = ''\n return ['application/json', JSON.pretty_generate(@return_struct)]\n else\n resources = @am_manager.find_all_samant_leases(nil, $acceptable_lease_states, authorizer)\n comps = @am_manager.find_all_samant_components_for_account(nil, authorizer)\n # child nodes should not be included in listresources\n comps.delete_if {|c| ((c.nil?)||(c.to_uri.to_s.include?\"/leased\"))}\n if only_available\n debug \"only_available selected\"\n # TODO maybe delete also interfaces and locations as well\n comps.delete_if {|c| (c.kind_of?SAMANT::Uxv) && c.hasResourceStatus && (c.hasResourceStatus.to_uri == SAMANT::BOOKED.to_uri) }\n end\n resources.concat(comps)\n #debug \"the resources: \" + resources.inspect\n # TODO uncomment to obtain rspeck, commented out because it's very time-wasting\n #used_for_side_effect = OMF::SFA::AM::Rest::ResourceHandler.rspecker(resources, :Offering) # -> creates the advertisement rspec file inside /ready4translation (less detailed, sfa enabled)\n start = Time.now\n debug \"START CREATING JSON\"\n res = OMF::SFA::AM::Rest::ResourceHandler.omn_response_json(resources, options) # -> returns the json formatted results (more detailed, omn enriched)\n debug \"END CREATING JSON. total time = \" + (Time.now-start).to_s\n end\n\n @return_struct[:code][:geni_code] = 0\n @return_struct[:value] = res\n @return_struct[:output] = ''\n return ['application/json', JSON.pretty_generate(@return_struct)]\n rescue OMF::SFA::AM::InsufficientPrivilegesException => e\n @return_struct[:code][:geni_code] = 3\n @return_struct[:output] = e.to_s\n @return_struct[:value] = ''\n return ['application/json', JSON.pretty_generate(@return_struct)]\n end", "def tag_list\n self.tags.collect do |tag|\n tag.name\n end.join(\", \")\n end", "def concat(resources)\n relate_resources(resources)\n super\n end", "def resources_url options={}\n r=request.path\n options = case params[:action]\n when 'create','update','delete','destroy'; \"\"\n else resource_options(options)\n end\n return \"%s%s\" % [r,options] if r.match \"#{resource.class.to_s.tableize}$\"\n \"%s%s%s\" % [ r.split( resource.class.to_s.tableize)[0],resource.class.to_s.tableize, options]\n rescue Exception => e\n scoop_from_error e\n end", "def resources\n %w(tags posts bundles)\n end", "def tag_list\n self.tags.collect do |tag|\n tag.name\n end.join(\", \")\n end", "def resources\n @resources ||= {}\n end", "def create_default_resources\n resources = [:timber, :iron, :gold, :copper, :diamond, :clay, :marble,\n :coal, :oil, :gas, :water, :uranium]\n @resources = []\n resources.each do |r|\n @resources << Resource.new(r, 1000)\n end\n end", "def create_library_list\n printer = @output_directory.nil? ? Printer.new : FilePrinter.new(\"#{@output_directory}/libraries.make\")\n @project.libraries.each do |lib|\n library_sources_file = \"$(path_prefix)/#{lib.name}/library_sources.make\"\n printer.output <<~HEREDOC\n #{library_sources_file} : $(project_root_dir)/#{lib.path}/sources.rb\n \\t@set -euo pipefail; cd $(project_root_dir);\\\\\n \\tmkdir -p $(@D);\\\\\n \\techo \\\"Generating $@\\\";\\\\\n \\tmerle library_sources #{lib.name} > $@\n \\nlibrary_sources += #{library_sources_file}\n HEREDOC\n end\n printer.output 'all_libraries := ' + @project.libraries.map{ |lib| \"$(path_prefix)/#{lib.name}.lib\" }.join(\" \")\n end", "def ids_to_s(many_ids, id_sep = CompositePrimaryKeys::ID_SEP, list_sep = ',', left_bracket = '(', right_bracket = ')')\r\n many_ids.map {|ids| \"#{left_bracket}#{ids}#{right_bracket}\"}.join(list_sep)\r\n end", "def tag_list\n tags.collect(&:name).join(', ')\n end", "def tag_list\n tags.collect(&:name).join(', ')\n end", "def resources\n Typus::Configuration.roles.keys.map do |key|\n Typus::Configuration.roles[key].keys\n end.flatten.sort.uniq.delete_if { |x| models.include?(x) }\n end", "def resources\n body && [*body]\n end", "def tag_list\n tags.map(&:name).join(\", \")\n end", "def all\n setup_request \"#{@@resource_url}s\"\n end", "def resources\n typed_set(entities, Occi::Core::Resource)\n end", "def resources()\n end", "def tag_list\n\t\tself.tags.collect do |tag|\n\t\t\ttag.name\n\t\tend.join(\", \") #When we joined the array Ruby called the default #to_s method on every one of these Tag instances \n\tend", "def resources\n nodeset = query_root_node(\"gdacs:resources/gdacs:resource\", @@NAMESPACES)\n @items = []\n if !nodeset.nil?\n nodeset.each do |item|\n item_obj = SemanticCrawler::Gdacs::Resource.new(item)\n @items << item_obj\n end\n end\n @items\n end", "def list(options = {})\n url = build_url\n url << \"&$top=#{options[:top]}\" if options[:top]\n url << \"&$filter=#{options[:filter]}\" if options[:filter]\n\n response = rest_get(url)\n Azure::Armrest::ArmrestCollection.create_from_response(response, Azure::Armrest::ResourceGroup)\n end", "def tag_list\n tags.map(&:name).join(\", \")\n end", "def tag_list\n tags.map(&:name).join(\", \")\n end", "def tag_list\n tags.map(&:name).join(\", \")\n end", "def format_list(items)\n items.join('` or `')\n end", "def step_into_list(object, indent, start_indent)\n steps = [object.out_name].concat(object.all_resourcerefs\n .map(&:resource_ref)\n .map(&:out_name).reverse).uniq\n\n return indent(\"step_into: '#{steps[0]}',\", indent) if steps.length == 1\n\n format(\n [\n [\"step_into: %w[#{steps.join(' ')}],\"],\n [\"step_into: %w[#{steps.slice(0..-2).join(' ')}\",\n indent(\"#{steps.last(1).join(' ')}],\", 14)], # 14 = step_into: %w[\n [\"step_into: %w[#{steps.slice(0..-3).join(' ')}\",\n indent(\"#{steps.last(2).join(' ')}],\", 14)], # 14 = step_into: %w[\n [\n \"step_into: %w[#{steps[0]}\",\n indent(steps.slice(1..-2), 14), # 14 = step_into: %w[\n indent(\"#{steps.last(1).join}],\", 14)\n ]\n ], indent, start_indent\n )\n end", "def resourcegroups\n result = @http.get('/resourcegroups')\n result[1]\n end", "def formatted_file_list(title, source_files); end", "def ids_to_s(many_ids, id_sep = CompositePrimaryKeys::ID_SEP, list_sep = ',', left_bracket = '(', right_bracket = ')')\n many_ids.map {|ids| \"#{left_bracket}#{CompositePrimaryKeys::CompositeKeys.new(ids)}#{right_bracket}\"}.join(list_sep)\n end", "def generate_object_types_list\n #@items = options.objects if options.objects\n @items = [\n \"App Level Classes\",\n \"Entity Classes\",\n \"Collection Classes\",\n \"Geom Classes\",\n \"UI Classes\",\n \"Observer Classes\",\n \"Core Ruby Classes\"\n ]\n @list_title = \"Object Index\"\n @list_type = \"object_types\"\n\n # optional: the specified stylesheet class\n # when not specified it will default to the value of @list_type\n @list_class = \"class\"\n\n # Generate the full list html file with named feature_list.html\n # @note this file must be match the name of the type\n asset(url_for_list(@list_type), erb(:full_list))\nend", "def to_s\r\n @list.map{|el| el.to_s}.join ' | '\r\n end", "def tag_list\n tags.map(&:name).join(', ')\n end", "def create_batch urls\n function = 'batch/'\n\n post_data = {}\n post_data[:urls] = urls.join(',')\n\n request(@resource, function, nil, 'post', post_data)\n end", "def resources\n resources = []\n resource_path =\n Pathname.new(@config.project_dir) +\n SUPPORT_FILES +\n \"Pods-#{TARGET_NAME}-resources.sh\"\n\n File.open(resource_path) { |f|\n f.each_line do |line|\n matched = line.match(/install_resource\\s+(.*)/)\n\n next unless matched\n\n path = (matched[1].strip)[1..-2]\n\n path.sub!(\n \"${BUILD_DIR}/${CONFIGURATION}${EFFECTIVE_PLATFORM_NAME}\",\n \".build\"\n )\n\n next if File.extname(path) == \".framework\"\n\n resources << Pathname.new(@config.project_dir) + PODS_ROOT + path\n end\n }\n resources.uniq\n end", "def resources\n @resources ||= Marshal.load(Marshal.dump(@@resources))\n end", "def sp_resources_txt\n sp_resources_txt = ''\n sp_resources = Hash.new\n mini_map_cells.each do |cell|\n if not cell.sp_resource.blank? and sp_resources[cell.sp_resource.symbol].blank?\n sp_resources[cell.sp_resource.symbol] = cell.sp_resource.name\n sp_resources_txt += cell.sp_resource.name\n sp_resources_txt += ','\n end\n end\n sp_resources_txt.chop! if sp_resources_txt.last == ','\n return sp_resources_txt\n end", "def refresh_subresources\n %w( projects categories ).each do |attr|\n self[attr] = API.instance.ontology_resource(acronym, attr).map{|h| h['acronym']}.join(\"\\n\")\n end\n end", "def list_resources_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ResourcesApi.list_resources ...'\n end\n # resource path\n local_var_path = '/resource_set'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<String>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['protection_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: ResourcesApi#list_resources\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def file_list_string(pathnames, indent)\n spaces = ' ' * indent\n\n unless pathnames.empty?\n paths = pathnames.map { |pathname| \"'#{pathname.to_s}'\" }\n paths.join(\",\\n#{spaces}\")\n else\n spaces += '[]'\n end\n end", "def resource_groups\n return @resource_groups unless @resource_groups.nil?\n\n refs = references(:resource_groups) || []\n @resource_groups = refs.map { |ems_ref| resource_group(ems_ref) }.compact\n end", "def tag_list\n\t\t# for an instance of Article, do this\n\t\t# invoke the given block once for each element of `self`\n\t\tself.tags.collect do |tag|\n\t\t\ttag.name\n\t\tend.join(\", \")\n\n\t\t# tags.join(\", \")\n\t\t# the `join` method converts each element in the array to a string, \n\t\t# separated by the given `separator`. But it calls the `to_s` method on our object `tags`\n\tend", "def program_resource_str(program, all_resources)\n content = []\n ResourceType::RESOURCE_TYPES.each do |r_type|\n resources = all_resources.select { |k, v| k.eql? r_type }\n content += resources[r_type].map{ |rsrc| make_handle_str(rsrc, r_type) } if resources[r_type]\n end\n\n if content.count > 0\n render_program_row(\"Resources\", content.join(' '))\n end\n end", "def resources\n @data.keys\n end", "def resources\n self.collection.find({}, :sort => [:_id, :asc]).map do |hash|\n self.normalize hash\n end\n end" ]
[ "0.6936104", "0.6747082", "0.61592853", "0.61461926", "0.60896844", "0.6058486", "0.60176593", "0.5978648", "0.5978303", "0.59137356", "0.59137356", "0.5774169", "0.5719946", "0.57097274", "0.5532093", "0.5520681", "0.5493826", "0.5463864", "0.54344106", "0.54301393", "0.5415322", "0.5402361", "0.5387423", "0.53809196", "0.53784984", "0.53690356", "0.5360033", "0.5345788", "0.53452295", "0.5328728", "0.53161013", "0.53106534", "0.53086984", "0.53086984", "0.53086984", "0.529281", "0.5277521", "0.5265593", "0.5255792", "0.52430576", "0.52333254", "0.5231927", "0.52098054", "0.5205935", "0.5199724", "0.5198707", "0.5192843", "0.51882267", "0.5184076", "0.5181712", "0.5179272", "0.51707035", "0.5167406", "0.51625186", "0.5162167", "0.5160036", "0.5156924", "0.5152251", "0.51508796", "0.5147328", "0.51439565", "0.51408154", "0.51351976", "0.5132395", "0.513174", "0.51304734", "0.51286006", "0.51286006", "0.51262456", "0.5124643", "0.5115954", "0.5103771", "0.5099654", "0.50978994", "0.50877166", "0.5083162", "0.5077473", "0.5066554", "0.5066554", "0.5066554", "0.5055044", "0.50548905", "0.50421244", "0.5039075", "0.5037967", "0.50367355", "0.5033195", "0.5028907", "0.50241274", "0.50204664", "0.50203705", "0.50184464", "0.5006348", "0.49966547", "0.49965706", "0.49964955", "0.4995215", "0.4993245", "0.4991135", "0.498881" ]
0.71257883
0
Returns an array of names for search index.
def subject_search_index subjects.pluck(:name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def names\n @index.keys\n end", "def names\n @searches.names\n end", "def curated_search_index\n curated.pluck(:name)\n end", "def names\n Array(@name)\n end", "def index_name\n models.map { |m| m.index_name }\n end", "def names\n map(&:names).flatten\n end", "def indexes(_table_name, _name = nil)\n []\n end", "def indexes(table_name, name = nil)\n []\n end", "def indexes(table_name, name = nil)\n []\n end", "def search_indexes\n Search.indexes(self)\n end", "def keys\n index.keys.collect {|keys| keys.to_s }\n end", "def search_keys \n return search_field_definitions.keys\n end", "def names\n map(&:name)\n end", "def rss_search_index\n resources.pluck(:name)\n end", "def names\n map(&:name)\n end", "def find_indexes(plan)\n find_by_key(plan, \"Index Name\")\n end", "def indexes\n @indexes ||= []\n end", "def index_field_names\n Blacklight.config[:index_fields][:field_names]\n end", "def as_names\n __getobj__.map { |i| i.name }\n end", "def index_keys\n index_specifications.map(&:key)\n end", "def index_headers\n index_fields.map { |field| field.label }\n end", "def search_objects\n @searches.keys.map { |k| @search_objects[k] }\n end", "def return_names_array(doc)\n names = doc.css(\".search-content .teaser-item__title a span\")\n recipe_names = []\n names.each do |element|\n recipe_names << element.text\n end\n return recipe_names\n end", "def get_names\n @names\n end", "def convert_indexes_to_names(indexes)\n result = []\n indexes.each do |index|\n result << @vertices[index].name\n end\n\n result\n end", "def names\n @names ||= []\n end", "def names\n all.map { |item| item.name_sym }\n end", "def names\n @list.keys\n end", "def all_names\n @__names__\n end", "def names name = \"\"\n find_all_by_name( name ).map(&:name)\n end", "def list_names\n @lib.list_names\n end", "def names\n [name]\n end", "def get_service_names()\n return @mappings.get_names()\n end", "def all_names; end", "def all_names; end", "def names\n collect { |a| a.name }\n end", "def names\n\t\tquery_params = QueryFormat.names_format()\n\t\tbegin\n\t\t\tQueryFormat.transform_raw_parameters(params)\n\t\t\tquery = QueryFormat.create_solr_query(query_params, params, request.remote_ip)\n\t\t\tis_test = Rails.env == 'test' ? :test : :live\n\t\t\tis_test = :shards if params[:test_index]\n\t\t\tsolr = Solr.factory_create(is_test)\n\t\t\t@results = solr.names(query)\n\n\t\t\trespond_to do |format|\n\t\t\t\tformat.html # index.html.erb\n\t\t\t\tformat.json { render json: { results: @results }}\n\t\t\t\tformat.xml\n\t\t\tend\n\t\trescue ArgumentError => e\n\t\t\trender_error(e.to_s)\n\t\trescue SolrException => e\n\t\t\trender_error(e.to_s, e.status())\n\t\trescue Exception => e\n\t\t\tExceptionNotifier.notify_exception(e, :env => request.env)\n\t\t\trender_error(\"Something unexpected went wrong.\", :internal_server_error)\n\t\tend\n end", "def semantic_search_keys \n semantic_search_map.keys\n end", "def index_as\n Array(@index_as)\n end", "def index *args\n # delegate\n self.class.names.index *args\n end", "def names_array\n @names_array ||= fullname.split(',').map(&:strip)\n end", "def names\n @j_map.names()\n end", "def to_array\n @searches.map do |search|\n header = {}\n header.update(:index => search.indices.join(',')) unless search.indices.empty?\n header.update(:type => search.types.join(',')) unless search.types.empty?\n header.update(:search_type => search.options[:search_type]) if search.options[:search_type]\n header.update(:routing => search.options[:routing]) if search.options[:routing]\n header.update(:preference => search.options[:preference]) if search.options[:preference]\n body = search.to_hash\n [ header, body ]\n end.flatten\n end", "def found_words\n @word_index.keys\n end", "def list_known_names\n end", "def index_as\n Array(@index_as)\n end", "def names\n get('names')\n end", "def find_names(*types)\n return @actions.map(&:name) if types.empty?\n self.find(*types).map(&:name)\n end", "def names\n [@name] + @aliases\n end", "def get_item_names\n items = []\n Static.get_item_list.values.each do |f|\n items << f[\"name\"]\n end\n items\n end", "def keys(index_name = T.unsafe(nil)); end", "def return_name_search_results(names)\n if names == []\n puts \"Sorry, nothing found by that name.\"\n self.search_not_found\n else\n names.each do |item|\n puts \"#{names.index(item) + 1}. #{item.name }\"\n end \n end \n end", "def index_as\n if @index_as\n Array(@index_as)\n else\n self.proxied_term.index_as\n end\n end", "def keys\n [ name ]\n end", "def indexes\n @model.indexes.select{|index| index.columns.include? self.name}\n end", "def names; end", "def names; end", "def names; end", "def names; end", "def names; end", "def names; end", "def names; end", "def indexed_facets(model_name)\n tables.grep(/_#{model_name}_(\\w+)_index/) { $1 }\n end", "def index_name\n get_key('ALGOLIA_INDEX_NAME', 'index_name')\n end", "def index\n @tagnames = Tag.ascend_by_name.map { |t| t.name }.uniq\n end", "def index\n @product_names = @product_names.order(:id).search(params[:search], params[:page])\n end", "def all_name_strings\n names.collect { |a| a.name }\n end", "def text_indexes\n fields = self.class.text_indexes.keys\n fields.collect{|f| text_indexes_for(f)}.flatten\n end", "def index_name # :nologin: :norobots:\n query = find_or_create_query(:Name, :by => params[:by])\n show_selected_names(query, :id => params[:id].to_s, :always_index => true)\n end", "def field_indexes\r\n return @field_indexes\r\n end", "def item_names\n @registry.keys\n end", "def names\n self.codes.map do |x|\n Bio::AminoAcid.names[x]\n end\n end", "def names\n map(&:name).map(&:downcase).uniq\n end", "def indices\n @data.keys\n end", "def names\n [name] + @aliases\n end", "def names\n [name] + @aliases\n end", "def indexes\n raise 'not implemented'\n end", "def names\n if !block_given?\n return ::Vertx::Util::Utils.to_set(@j_del.java_method(:names, []).call()).map! { |elt| elt }\n end\n raise ArgumentError, \"Invalid arguments when calling names()\"\n end", "def names\n collect { |n, v|\n n\n }\n end", "def names\n\n get_list['list'].collect { |re, pa| re }\n end", "def keywords_for_index(_item)\n []\n end", "def getnames(address)\n @resolvers.each do |resolver|\n names = []\n resolver.each_name(address) { |name| names << name }\n return names unless names.empty?\n end\n []\n end", "def search_index\n part_of_index = params[:term]\n indexes = []\n \n if part_of_index\n indexes = PostIndex.where('\"index\" like ?', part_of_index + '%').select('\"index\", region, city').collect { |pi| {:value => pi.index, :label => pi.index + '-' + pi.city! } }\n end\n\n respond_to do |format|\n format.html { render :text => indexes.to_json }\n end\n end", "def names\n @names ||= [@name]\n end", "def find_all_storenames\n\n WiStore.find(:all).collect do |store|\n store.name\n end\n end", "def [] name\n if index = @searches.names.index(name)\n @collection[ index ]\n end\n end", "def names()\n names = []\n names.push \"q-\"\n return names\n end", "def names()\n\t\tnames = []\n\t\tnames.push \"help\"\n\t\treturn names\n\tend", "def index\n @nutrients = Nutrient.name_containing(params.dig(:q, :name_cont)).order(name: :asc)\n end", "def search_terms\n return @search_terms\n end", "def indexes(table_name, name = nil)#:nodoc:\n indexes = []\n current_index = nil\n (execute(\"SHOW KEYS FROM #{table_name}\", name) || []).each do |row|\n if current_index != row[2]\n next if row[2] == \"PRIMARY\" # skip the primary key\n current_index = row[2]\n indexes << ActiveRecord::ConnectionAdapters::IndexDefinition.new(row[0], row[2], row[1] == \"0\", [], row[10] == \"SPATIAL\")\n end\n indexes.last.columns << row[4]\n end\n indexes\n end", "def all\n # return an array of all the regions\n return NAMES\n end", "def indexed_database_names\n index_specifications.map do |spec|\n spec.options[:database] || database_name\n end.uniq\n end", "def indexes(table_name, name = nil)\n result = query(\"exec sp_helpindex '#{table_name}'\", name)\n \n indexes = []\n result.each do |row|\n if row[1].match('primary key') == nil\n indexes << IndexDefinition.new(table_name, row[0], row[1].match('unique') != nil, row[2].split(',').each {|x| x.strip!})\n end\n end\n \n indexes\n end", "def index\n @nametypes = Nametype.all\n end", "def list_names # :nologin:\n query = create_query(:Name, :all, :by => :name)\n show_selected_names(query)\n end", "def get_ead_names(get_ead_names = Array.new)\n NAME_FIELDS.each do |field|\n get_ead_names += search(\"//#{field}\") unless field == :corpname\n get_ead_names += search(\"//*[local-name()!='repository']/#{field}\") if field == :corpname\n end\n return clean_facets_array(get_ead_names.map(&:text))\n end", "def get_search_index(name)\n search_index = @data[:search_indexes][name]\n raise ProtobuffsErrorResponse.new(BeefcakeProtobuffsBackend::RpbErrorResp.new(:errcode => 0, :errmsg => 'notfound')) unless search_index\n\n BeefcakeProtobuffsBackend::RpbYokozunaIndexGetResp.new(\n :index => [BeefcakeProtobuffsBackend::RpbYokozunaIndex.new(search_index)]\n )\n end", "def index_column_names\n [\n [collection.first.class.column_names.reject { |column| index_rejected_columns.include?(column) }]\n ].flatten\n end", "def index\n @event_names = EventName.all\n end" ]
[ "0.7773075", "0.7314784", "0.6765376", "0.6730985", "0.6574911", "0.6524343", "0.65060306", "0.64950395", "0.64950395", "0.6449853", "0.6435959", "0.642979", "0.64021945", "0.6386188", "0.636248", "0.63411677", "0.6292613", "0.6280432", "0.6272861", "0.6235423", "0.6186352", "0.61666834", "0.6158265", "0.613926", "0.6133396", "0.60968125", "0.60967875", "0.60942376", "0.60926765", "0.60845655", "0.6071539", "0.6061519", "0.6038766", "0.60266", "0.60266", "0.6016315", "0.6015104", "0.6007115", "0.60056084", "0.59964126", "0.5970569", "0.5967057", "0.59640527", "0.5951357", "0.5936516", "0.5931132", "0.59280324", "0.5921514", "0.59150505", "0.59100336", "0.5909476", "0.5891463", "0.58786684", "0.5877783", "0.5869864", "0.5861223", "0.5861223", "0.5861223", "0.5861223", "0.5861223", "0.5861223", "0.5861223", "0.5857466", "0.584719", "0.58453226", "0.584113", "0.5838537", "0.58270454", "0.5822397", "0.5816648", "0.58118826", "0.58073807", "0.58024275", "0.5798733", "0.57985425", "0.57985425", "0.57927966", "0.5788526", "0.57834506", "0.5782476", "0.57718027", "0.5768551", "0.5762437", "0.5748643", "0.57442164", "0.57380396", "0.5731452", "0.57173616", "0.5707766", "0.5707007", "0.5705498", "0.57039285", "0.570358", "0.5692309", "0.56908524", "0.56812096", "0.5680567", "0.56803864", "0.5678533", "0.5671064" ]
0.6699449
4
Returns an array of names for search index.
def rss_search_index resources.pluck(:name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def names\n @index.keys\n end", "def names\n @searches.names\n end", "def curated_search_index\n curated.pluck(:name)\n end", "def names\n Array(@name)\n end", "def subject_search_index\n subjects.pluck(:name)\n end", "def index_name\n models.map { |m| m.index_name }\n end", "def names\n map(&:names).flatten\n end", "def indexes(_table_name, _name = nil)\n []\n end", "def indexes(table_name, name = nil)\n []\n end", "def indexes(table_name, name = nil)\n []\n end", "def search_indexes\n Search.indexes(self)\n end", "def keys\n index.keys.collect {|keys| keys.to_s }\n end", "def search_keys \n return search_field_definitions.keys\n end", "def names\n map(&:name)\n end", "def names\n map(&:name)\n end", "def find_indexes(plan)\n find_by_key(plan, \"Index Name\")\n end", "def indexes\n @indexes ||= []\n end", "def index_field_names\n Blacklight.config[:index_fields][:field_names]\n end", "def as_names\n __getobj__.map { |i| i.name }\n end", "def index_keys\n index_specifications.map(&:key)\n end", "def index_headers\n index_fields.map { |field| field.label }\n end", "def search_objects\n @searches.keys.map { |k| @search_objects[k] }\n end", "def return_names_array(doc)\n names = doc.css(\".search-content .teaser-item__title a span\")\n recipe_names = []\n names.each do |element|\n recipe_names << element.text\n end\n return recipe_names\n end", "def get_names\n @names\n end", "def convert_indexes_to_names(indexes)\n result = []\n indexes.each do |index|\n result << @vertices[index].name\n end\n\n result\n end", "def names\n all.map { |item| item.name_sym }\n end", "def names\n @names ||= []\n end", "def names\n @list.keys\n end", "def all_names\n @__names__\n end", "def names name = \"\"\n find_all_by_name( name ).map(&:name)\n end", "def list_names\n @lib.list_names\n end", "def names\n [name]\n end", "def get_service_names()\n return @mappings.get_names()\n end", "def all_names; end", "def all_names; end", "def names\n collect { |a| a.name }\n end", "def names\n\t\tquery_params = QueryFormat.names_format()\n\t\tbegin\n\t\t\tQueryFormat.transform_raw_parameters(params)\n\t\t\tquery = QueryFormat.create_solr_query(query_params, params, request.remote_ip)\n\t\t\tis_test = Rails.env == 'test' ? :test : :live\n\t\t\tis_test = :shards if params[:test_index]\n\t\t\tsolr = Solr.factory_create(is_test)\n\t\t\t@results = solr.names(query)\n\n\t\t\trespond_to do |format|\n\t\t\t\tformat.html # index.html.erb\n\t\t\t\tformat.json { render json: { results: @results }}\n\t\t\t\tformat.xml\n\t\t\tend\n\t\trescue ArgumentError => e\n\t\t\trender_error(e.to_s)\n\t\trescue SolrException => e\n\t\t\trender_error(e.to_s, e.status())\n\t\trescue Exception => e\n\t\t\tExceptionNotifier.notify_exception(e, :env => request.env)\n\t\t\trender_error(\"Something unexpected went wrong.\", :internal_server_error)\n\t\tend\n end", "def index_as\n Array(@index_as)\n end", "def semantic_search_keys \n semantic_search_map.keys\n end", "def index *args\n # delegate\n self.class.names.index *args\n end", "def names_array\n @names_array ||= fullname.split(',').map(&:strip)\n end", "def names\n @j_map.names()\n end", "def to_array\n @searches.map do |search|\n header = {}\n header.update(:index => search.indices.join(',')) unless search.indices.empty?\n header.update(:type => search.types.join(',')) unless search.types.empty?\n header.update(:search_type => search.options[:search_type]) if search.options[:search_type]\n header.update(:routing => search.options[:routing]) if search.options[:routing]\n header.update(:preference => search.options[:preference]) if search.options[:preference]\n body = search.to_hash\n [ header, body ]\n end.flatten\n end", "def found_words\n @word_index.keys\n end", "def list_known_names\n end", "def index_as\n Array(@index_as)\n end", "def names\n get('names')\n end", "def find_names(*types)\n return @actions.map(&:name) if types.empty?\n self.find(*types).map(&:name)\n end", "def names\n [@name] + @aliases\n end", "def get_item_names\n items = []\n Static.get_item_list.values.each do |f|\n items << f[\"name\"]\n end\n items\n end", "def keys(index_name = T.unsafe(nil)); end", "def return_name_search_results(names)\n if names == []\n puts \"Sorry, nothing found by that name.\"\n self.search_not_found\n else\n names.each do |item|\n puts \"#{names.index(item) + 1}. #{item.name }\"\n end \n end \n end", "def keys\n [ name ]\n end", "def index_as\n if @index_as\n Array(@index_as)\n else\n self.proxied_term.index_as\n end\n end", "def indexes\n @model.indexes.select{|index| index.columns.include? self.name}\n end", "def names; end", "def names; end", "def names; end", "def names; end", "def names; end", "def names; end", "def names; end", "def indexed_facets(model_name)\n tables.grep(/_#{model_name}_(\\w+)_index/) { $1 }\n end", "def index_name\n get_key('ALGOLIA_INDEX_NAME', 'index_name')\n end", "def index\n @tagnames = Tag.ascend_by_name.map { |t| t.name }.uniq\n end", "def index\n @product_names = @product_names.order(:id).search(params[:search], params[:page])\n end", "def all_name_strings\n names.collect { |a| a.name }\n end", "def text_indexes\n fields = self.class.text_indexes.keys\n fields.collect{|f| text_indexes_for(f)}.flatten\n end", "def index_name # :nologin: :norobots:\n query = find_or_create_query(:Name, :by => params[:by])\n show_selected_names(query, :id => params[:id].to_s, :always_index => true)\n end", "def field_indexes\r\n return @field_indexes\r\n end", "def item_names\n @registry.keys\n end", "def names\n self.codes.map do |x|\n Bio::AminoAcid.names[x]\n end\n end", "def names\n map(&:name).map(&:downcase).uniq\n end", "def names\n [name] + @aliases\n end", "def names\n [name] + @aliases\n end", "def indices\n @data.keys\n end", "def indexes\n raise 'not implemented'\n end", "def names\n if !block_given?\n return ::Vertx::Util::Utils.to_set(@j_del.java_method(:names, []).call()).map! { |elt| elt }\n end\n raise ArgumentError, \"Invalid arguments when calling names()\"\n end", "def names\n collect { |n, v|\n n\n }\n end", "def names\n\n get_list['list'].collect { |re, pa| re }\n end", "def keywords_for_index(_item)\n []\n end", "def getnames(address)\n @resolvers.each do |resolver|\n names = []\n resolver.each_name(address) { |name| names << name }\n return names unless names.empty?\n end\n []\n end", "def search_index\n part_of_index = params[:term]\n indexes = []\n \n if part_of_index\n indexes = PostIndex.where('\"index\" like ?', part_of_index + '%').select('\"index\", region, city').collect { |pi| {:value => pi.index, :label => pi.index + '-' + pi.city! } }\n end\n\n respond_to do |format|\n format.html { render :text => indexes.to_json }\n end\n end", "def names\n @names ||= [@name]\n end", "def find_all_storenames\n\n WiStore.find(:all).collect do |store|\n store.name\n end\n end", "def [] name\n if index = @searches.names.index(name)\n @collection[ index ]\n end\n end", "def names()\n names = []\n names.push \"q-\"\n return names\n end", "def names()\n\t\tnames = []\n\t\tnames.push \"help\"\n\t\treturn names\n\tend", "def search_terms\n return @search_terms\n end", "def index\n @nutrients = Nutrient.name_containing(params.dig(:q, :name_cont)).order(name: :asc)\n end", "def all\n # return an array of all the regions\n return NAMES\n end", "def indexes(table_name, name = nil)#:nodoc:\n indexes = []\n current_index = nil\n (execute(\"SHOW KEYS FROM #{table_name}\", name) || []).each do |row|\n if current_index != row[2]\n next if row[2] == \"PRIMARY\" # skip the primary key\n current_index = row[2]\n indexes << ActiveRecord::ConnectionAdapters::IndexDefinition.new(row[0], row[2], row[1] == \"0\", [], row[10] == \"SPATIAL\")\n end\n indexes.last.columns << row[4]\n end\n indexes\n end", "def indexed_database_names\n index_specifications.map do |spec|\n spec.options[:database] || database_name\n end.uniq\n end", "def index\n @nametypes = Nametype.all\n end", "def indexes(table_name, name = nil)\n result = query(\"exec sp_helpindex '#{table_name}'\", name)\n \n indexes = []\n result.each do |row|\n if row[1].match('primary key') == nil\n indexes << IndexDefinition.new(table_name, row[0], row[1].match('unique') != nil, row[2].split(',').each {|x| x.strip!})\n end\n end\n \n indexes\n end", "def get_ead_names(get_ead_names = Array.new)\n NAME_FIELDS.each do |field|\n get_ead_names += search(\"//#{field}\") unless field == :corpname\n get_ead_names += search(\"//*[local-name()!='repository']/#{field}\") if field == :corpname\n end\n return clean_facets_array(get_ead_names.map(&:text))\n end", "def list_names # :nologin:\n query = create_query(:Name, :all, :by => :name)\n show_selected_names(query)\n end", "def index_column_names\n [\n [collection.first.class.column_names.reject { |column| index_rejected_columns.include?(column) }]\n ].flatten\n end", "def get_search_index(name)\n search_index = @data[:search_indexes][name]\n raise ProtobuffsErrorResponse.new(BeefcakeProtobuffsBackend::RpbErrorResp.new(:errcode => 0, :errmsg => 'notfound')) unless search_index\n\n BeefcakeProtobuffsBackend::RpbYokozunaIndexGetResp.new(\n :index => [BeefcakeProtobuffsBackend::RpbYokozunaIndex.new(search_index)]\n )\n end", "def index\n @event_names = EventName.all\n end" ]
[ "0.7773802", "0.73141694", "0.6764161", "0.6732825", "0.6699125", "0.6574538", "0.65265703", "0.6503088", "0.64921474", "0.64921474", "0.6447115", "0.6438066", "0.6430039", "0.64040774", "0.63642204", "0.633911", "0.6291664", "0.62802523", "0.6275856", "0.6235167", "0.6187753", "0.6165447", "0.6160322", "0.614129", "0.61350936", "0.6098731", "0.60975", "0.6096111", "0.60938495", "0.608451", "0.6073022", "0.60626626", "0.60400313", "0.60279864", "0.60279864", "0.6018507", "0.60122913", "0.60070753", "0.60057676", "0.5995446", "0.5973592", "0.5968575", "0.5965509", "0.5951166", "0.59373456", "0.5932664", "0.59294266", "0.592122", "0.59174055", "0.591271", "0.59093827", "0.58890545", "0.5879505", "0.58791476", "0.58684105", "0.5862459", "0.5862459", "0.5862459", "0.5862459", "0.5862459", "0.5862459", "0.5862459", "0.585523", "0.58468044", "0.5846173", "0.5840468", "0.58398867", "0.5825549", "0.58206713", "0.5816862", "0.58135945", "0.5809246", "0.58029765", "0.5800413", "0.5800413", "0.5799274", "0.57906646", "0.57896", "0.5785225", "0.578475", "0.57728267", "0.57693535", "0.5761198", "0.5749121", "0.5743507", "0.5736236", "0.5733337", "0.5719661", "0.57074064", "0.5706585", "0.5705104", "0.5702448", "0.57019603", "0.5690016", "0.5689194", "0.56815165", "0.56804115", "0.5679006", "0.5677204", "0.5671854" ]
0.63864
14
Returns an array of names for search index.
def curated_search_index curated.pluck(:name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def names\n @index.keys\n end", "def names\n @searches.names\n end", "def names\n Array(@name)\n end", "def subject_search_index\n subjects.pluck(:name)\n end", "def index_name\n models.map { |m| m.index_name }\n end", "def names\n map(&:names).flatten\n end", "def indexes(_table_name, _name = nil)\n []\n end", "def indexes(table_name, name = nil)\n []\n end", "def indexes(table_name, name = nil)\n []\n end", "def search_indexes\n Search.indexes(self)\n end", "def keys\n index.keys.collect {|keys| keys.to_s }\n end", "def search_keys \n return search_field_definitions.keys\n end", "def names\n map(&:name)\n end", "def rss_search_index\n resources.pluck(:name)\n end", "def names\n map(&:name)\n end", "def find_indexes(plan)\n find_by_key(plan, \"Index Name\")\n end", "def indexes\n @indexes ||= []\n end", "def index_field_names\n Blacklight.config[:index_fields][:field_names]\n end", "def as_names\n __getobj__.map { |i| i.name }\n end", "def index_keys\n index_specifications.map(&:key)\n end", "def index_headers\n index_fields.map { |field| field.label }\n end", "def search_objects\n @searches.keys.map { |k| @search_objects[k] }\n end", "def return_names_array(doc)\n names = doc.css(\".search-content .teaser-item__title a span\")\n recipe_names = []\n names.each do |element|\n recipe_names << element.text\n end\n return recipe_names\n end", "def get_names\n @names\n end", "def convert_indexes_to_names(indexes)\n result = []\n indexes.each do |index|\n result << @vertices[index].name\n end\n\n result\n end", "def names\n all.map { |item| item.name_sym }\n end", "def names\n @names ||= []\n end", "def names\n @list.keys\n end", "def all_names\n @__names__\n end", "def names name = \"\"\n find_all_by_name( name ).map(&:name)\n end", "def list_names\n @lib.list_names\n end", "def names\n [name]\n end", "def get_service_names()\n return @mappings.get_names()\n end", "def all_names; end", "def all_names; end", "def names\n collect { |a| a.name }\n end", "def names\n\t\tquery_params = QueryFormat.names_format()\n\t\tbegin\n\t\t\tQueryFormat.transform_raw_parameters(params)\n\t\t\tquery = QueryFormat.create_solr_query(query_params, params, request.remote_ip)\n\t\t\tis_test = Rails.env == 'test' ? :test : :live\n\t\t\tis_test = :shards if params[:test_index]\n\t\t\tsolr = Solr.factory_create(is_test)\n\t\t\t@results = solr.names(query)\n\n\t\t\trespond_to do |format|\n\t\t\t\tformat.html # index.html.erb\n\t\t\t\tformat.json { render json: { results: @results }}\n\t\t\t\tformat.xml\n\t\t\tend\n\t\trescue ArgumentError => e\n\t\t\trender_error(e.to_s)\n\t\trescue SolrException => e\n\t\t\trender_error(e.to_s, e.status())\n\t\trescue Exception => e\n\t\t\tExceptionNotifier.notify_exception(e, :env => request.env)\n\t\t\trender_error(\"Something unexpected went wrong.\", :internal_server_error)\n\t\tend\n end", "def semantic_search_keys \n semantic_search_map.keys\n end", "def index_as\n Array(@index_as)\n end", "def index *args\n # delegate\n self.class.names.index *args\n end", "def names_array\n @names_array ||= fullname.split(',').map(&:strip)\n end", "def names\n @j_map.names()\n end", "def to_array\n @searches.map do |search|\n header = {}\n header.update(:index => search.indices.join(',')) unless search.indices.empty?\n header.update(:type => search.types.join(',')) unless search.types.empty?\n header.update(:search_type => search.options[:search_type]) if search.options[:search_type]\n header.update(:routing => search.options[:routing]) if search.options[:routing]\n header.update(:preference => search.options[:preference]) if search.options[:preference]\n body = search.to_hash\n [ header, body ]\n end.flatten\n end", "def found_words\n @word_index.keys\n end", "def list_known_names\n end", "def index_as\n Array(@index_as)\n end", "def names\n get('names')\n end", "def find_names(*types)\n return @actions.map(&:name) if types.empty?\n self.find(*types).map(&:name)\n end", "def names\n [@name] + @aliases\n end", "def get_item_names\n items = []\n Static.get_item_list.values.each do |f|\n items << f[\"name\"]\n end\n items\n end", "def keys(index_name = T.unsafe(nil)); end", "def return_name_search_results(names)\n if names == []\n puts \"Sorry, nothing found by that name.\"\n self.search_not_found\n else\n names.each do |item|\n puts \"#{names.index(item) + 1}. #{item.name }\"\n end \n end \n end", "def keys\n [ name ]\n end", "def index_as\n if @index_as\n Array(@index_as)\n else\n self.proxied_term.index_as\n end\n end", "def indexes\n @model.indexes.select{|index| index.columns.include? self.name}\n end", "def names; end", "def names; end", "def names; end", "def names; end", "def names; end", "def names; end", "def names; end", "def indexed_facets(model_name)\n tables.grep(/_#{model_name}_(\\w+)_index/) { $1 }\n end", "def index_name\n get_key('ALGOLIA_INDEX_NAME', 'index_name')\n end", "def index\n @tagnames = Tag.ascend_by_name.map { |t| t.name }.uniq\n end", "def all_name_strings\n names.collect { |a| a.name }\n end", "def index\n @product_names = @product_names.order(:id).search(params[:search], params[:page])\n end", "def text_indexes\n fields = self.class.text_indexes.keys\n fields.collect{|f| text_indexes_for(f)}.flatten\n end", "def index_name # :nologin: :norobots:\n query = find_or_create_query(:Name, :by => params[:by])\n show_selected_names(query, :id => params[:id].to_s, :always_index => true)\n end", "def field_indexes\r\n return @field_indexes\r\n end", "def item_names\n @registry.keys\n end", "def names\n self.codes.map do |x|\n Bio::AminoAcid.names[x]\n end\n end", "def names\n map(&:name).map(&:downcase).uniq\n end", "def names\n [name] + @aliases\n end", "def names\n [name] + @aliases\n end", "def indices\n @data.keys\n end", "def indexes\n raise 'not implemented'\n end", "def names\n if !block_given?\n return ::Vertx::Util::Utils.to_set(@j_del.java_method(:names, []).call()).map! { |elt| elt }\n end\n raise ArgumentError, \"Invalid arguments when calling names()\"\n end", "def names\n collect { |n, v|\n n\n }\n end", "def names\n\n get_list['list'].collect { |re, pa| re }\n end", "def keywords_for_index(_item)\n []\n end", "def getnames(address)\n @resolvers.each do |resolver|\n names = []\n resolver.each_name(address) { |name| names << name }\n return names unless names.empty?\n end\n []\n end", "def search_index\n part_of_index = params[:term]\n indexes = []\n \n if part_of_index\n indexes = PostIndex.where('\"index\" like ?', part_of_index + '%').select('\"index\", region, city').collect { |pi| {:value => pi.index, :label => pi.index + '-' + pi.city! } }\n end\n\n respond_to do |format|\n format.html { render :text => indexes.to_json }\n end\n end", "def names\n @names ||= [@name]\n end", "def find_all_storenames\n\n WiStore.find(:all).collect do |store|\n store.name\n end\n end", "def [] name\n if index = @searches.names.index(name)\n @collection[ index ]\n end\n end", "def names()\n names = []\n names.push \"q-\"\n return names\n end", "def names()\n\t\tnames = []\n\t\tnames.push \"help\"\n\t\treturn names\n\tend", "def index\n @nutrients = Nutrient.name_containing(params.dig(:q, :name_cont)).order(name: :asc)\n end", "def search_terms\n return @search_terms\n end", "def all\n # return an array of all the regions\n return NAMES\n end", "def indexes(table_name, name = nil)#:nodoc:\n indexes = []\n current_index = nil\n (execute(\"SHOW KEYS FROM #{table_name}\", name) || []).each do |row|\n if current_index != row[2]\n next if row[2] == \"PRIMARY\" # skip the primary key\n current_index = row[2]\n indexes << ActiveRecord::ConnectionAdapters::IndexDefinition.new(row[0], row[2], row[1] == \"0\", [], row[10] == \"SPATIAL\")\n end\n indexes.last.columns << row[4]\n end\n indexes\n end", "def indexed_database_names\n index_specifications.map do |spec|\n spec.options[:database] || database_name\n end.uniq\n end", "def index\n @nametypes = Nametype.all\n end", "def indexes(table_name, name = nil)\n result = query(\"exec sp_helpindex '#{table_name}'\", name)\n \n indexes = []\n result.each do |row|\n if row[1].match('primary key') == nil\n indexes << IndexDefinition.new(table_name, row[0], row[1].match('unique') != nil, row[2].split(',').each {|x| x.strip!})\n end\n end\n \n indexes\n end", "def list_names # :nologin:\n query = create_query(:Name, :all, :by => :name)\n show_selected_names(query)\n end", "def get_ead_names(get_ead_names = Array.new)\n NAME_FIELDS.each do |field|\n get_ead_names += search(\"//#{field}\") unless field == :corpname\n get_ead_names += search(\"//*[local-name()!='repository']/#{field}\") if field == :corpname\n end\n return clean_facets_array(get_ead_names.map(&:text))\n end", "def index_column_names\n [\n [collection.first.class.column_names.reject { |column| index_rejected_columns.include?(column) }]\n ].flatten\n end", "def get_search_index(name)\n search_index = @data[:search_indexes][name]\n raise ProtobuffsErrorResponse.new(BeefcakeProtobuffsBackend::RpbErrorResp.new(:errcode => 0, :errmsg => 'notfound')) unless search_index\n\n BeefcakeProtobuffsBackend::RpbYokozunaIndexGetResp.new(\n :index => [BeefcakeProtobuffsBackend::RpbYokozunaIndex.new(search_index)]\n )\n end", "def index\n @event_names = EventName.all\n end" ]
[ "0.77736807", "0.73146254", "0.67322487", "0.66995806", "0.6575117", "0.65269005", "0.6504813", "0.6493807", "0.6493807", "0.6447735", "0.6436123", "0.64295536", "0.64046013", "0.63852245", "0.63649106", "0.63398653", "0.6290591", "0.62811536", "0.62747383", "0.6235169", "0.61874634", "0.6165123", "0.61587965", "0.61410093", "0.613536", "0.60988057", "0.6097932", "0.609566", "0.60944355", "0.6085973", "0.6072939", "0.6063294", "0.6040278", "0.60281146", "0.60281146", "0.6018786", "0.601421", "0.6005497", "0.6004742", "0.599628", "0.5972506", "0.5968349", "0.59630376", "0.5949964", "0.5937946", "0.59304106", "0.5929235", "0.5922575", "0.5917625", "0.5911943", "0.5909717", "0.5890362", "0.58787847", "0.5877513", "0.58688337", "0.58627343", "0.58627343", "0.58627343", "0.58627343", "0.58627343", "0.58627343", "0.58627343", "0.58559227", "0.5847162", "0.58455306", "0.58404654", "0.58401215", "0.58263016", "0.58223325", "0.58161765", "0.5812662", "0.5809118", "0.58041614", "0.58011466", "0.58011466", "0.5797331", "0.57914776", "0.5790313", "0.57848305", "0.57840395", "0.5771347", "0.5769551", "0.5760574", "0.57502335", "0.57438344", "0.5736318", "0.5732563", "0.57189834", "0.5707339", "0.57056653", "0.5704123", "0.5703465", "0.5702558", "0.5691223", "0.5690029", "0.56825835", "0.56813633", "0.56789285", "0.5678881", "0.56717676" ]
0.67639464
2
Calls the association for vendor unless nil, and returns the vendors name.
def vendor_name vendor&.name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vendors\n fetch(@config[:sales_path], 'Sales.getVendors')\n end", "def denormalize_vendor_name\n self.vendor_name = vendor.try(:name) if vendor_id_changed?\n end", "def getVendors\n fetch(@config[:sales_path], 'Sales.getVendors')\n end", "def vendor\n FarMar::Vendor.all.find {|instance| instance.id == vendor_id}\n end", "def vendor\n FarMar::Vendor.all.find { |vendor| vendor.id == vendor_id }\n end", "def vendor\n FarMar::Vendor.find(self.vendor_id)\n end", "def vendor\n FarMar::Vendor.all.select { |vendor| vendor.vendor_id == vendor_id }\n end", "def vendor\n FarMar::Vendor.all.select { |vendor| vendor.vendor_id == vendor_id }\n end", "def vendor\n FarMar::Vendor.all.find { |vendor| vendor.id == @vendor_id }\n end", "def vendor\n FarMar::Vendor.find(@vendor_id)\n end", "def vendor\n FarMar::Vendor.find(@vendor_id)\n end", "def vendor\n id = self.vendor_id\n found_vendor = FarMar::Vendor.find(id)\n return found_vendor\n end", "def vendor\n @vendor || parse_and_return(:@vendor)\n end", "def display_resource(vendor)\n vendor.name\n end", "def vendor\n return array_of_instances(FarMar::Vendor.all, \"vendor_id\", vendor_id).first\n end", "def vendors\n FarMar::Vendor.by_market(self.id)\n end", "def vendor\n vendor_that_made_this_sale = nil\n vendors = FarMar::Vendor.all\n vendors.each do |vendor|\n if vendor.id == self.vendor_id\n vendor_that_made_this_sale = vendor\n return vendor_that_made_this_sale\n end#of if\n end#of do\n end", "def vendor(vendor_id)\n FarMar::Vendor.all.find { |vendor| vendor.id == vendor_id }\n end", "def vendor\n vendor_id = self.vendor_id\n vendor = FarMar::Vendor.find(vendor_id)\n return vendor\n end", "def vendors\n FarMar::Vendor.by_market(id)\n end", "def vendor\n sale_vendor = Vendor.new(:id, :name, :number_of_employees, :market_id)\n Vendor.all.each do |ven_id, ven|\n if ven_id == vendor_id\n sale_vendor = ven\n end\n end\n return sale_vendor\n end", "def vendor\n return FarMar::Vendor.find(@vendor_id)\n end", "def fetch_event_vendor_by_vendor_id vendor_id\n if !event_vendors.nil? && event_vendors.find_all{|item| item.vendor_id == vendor_id }.count > 0\n event_vendors.find_all{|item| item.vendor_id == vendor_id }.first\n else\n nil\n end\n end", "def fetch_event_vendor_by_vendor_id vendor_id\n if !event_vendors.nil? && event_vendors.find_all{|item| item.vendor_id == vendor_id }.count > 0\n event_vendors.find_all{|item| item.vendor_id == vendor_id }.first\n else\n nil\n end\n end", "def vendors ##DON'T NEED TO PASS IN AN ARGUMENT JUST THE VALUE FROM THE ARGUMENT!!!!\n # lookup every vendor that matches this market id\n FarMar::Vendor.by_market(@id)\n ##OMG YAY, REMEMBER THIS TO BRING IN CLASSES FOR DIFFERENT METHODS,\n ##bring in class object and method and pass in the id from market\n end", "def vendors\n FarMar::Vendor.market_vendors(@market_id)\n end", "def vendors\n return FarMar::Vendor.by_market(@market_id)\n end", "def get_Vendor\n getElement_text(\"cust_vendors\").click\n getElement_text(\"vendors\").click\n end", "def full_name\n [vendor, model].join(\" \")\n end", "def vendor\n return :qlogic if self[\"VendorName\"] =~ /qlogic|broadcom/i\n return :qlogic if self[\"PCIVendorID\"] == \"14e4\"\n\n return :mellanox if self[\"VendorName\"] =~ /mellanox/i\n return :mellanox if self[\"PCIVendorID\"] == \"15b3\"\n\n return :intel if self[\"VendorName\"] =~ /intel/i\n\n :intel if self[\"PCIVendorID\"] == \"8086\" # have seen cases where VendorName not populated\n end", "def find_or_create_vendor_name vendor, exception\n if exception.message =~ /Vendor class not found/\n # Try a heuristic to find an alternative vendor class\n classes = loadVendorClasses\n short_vendor = vendor.gsub(/^sun-/i, \"\")\n if short_vendor != vendor and !(short_vendor = classes.grep(/#{short_vendor}/i)).empty?\n short_vendor = short_vendor[0]\n else\n # OK. There does not appear to be a class with an abbreviated vendor name so lets try\n # and add the class and hope that it does not conflict with the same entry under another name\n installVendorClass vendor\n short_vendor = nil\n end\n else\n raise exception\n end\n short_vendor\n end", "def set_vendor\n @vendor = Vendor.find(params[:id])\n end", "def vendor\n CSV.foreach(VENDORS_CSV) do |line|\n return FarMar::Vendor.new(line) if line[0].to_i == vendor_id\n end\n end", "def vendor\n Vendor.all.find do |vendor|\n vendor.id.to_i == @vendor_id.to_i\n end\n end", "def set_vendor\n @vendor = Vendor.find(params[:id])\n end", "def set_vendor\n @vendor = Vendor.find(params[:id])\n end", "def set_vendor\n @vendor = Vendor.find(params[:id])\n end", "def set_vendor\n @vendor = Vendor.find(params[:id])\n end", "def vendor?\n !vendor.empty?\n end", "def set_vendor\n @vendor = Vendor.find(params[:id])\n end", "def set_vendor\n @vendor = Vendor.find(params[:id])\n end", "def vendors\n vendors_at_market = []\n vendors = FarMar::Vendor.all\n vendors.each do |vendor|\n if vendor.market_id == self.id # Since this is an instance method I am looking at the ID of the FarMar::Market object I am calling .vendors on (i.e. the \"self\")\n vendors_at_market << vendor\n end\n end\n return vendors_at_market\n end", "def vendor\n nic_view.vendor\n end", "def vendors\n vendors = CSV.read(VENDORS_CSV).select { |line| line[3].to_i == self.market_id }\n vendors.collect { |v| FarMar::Vendor.new(v)}\n end", "def venue_name\n venue.name if venue\n end", "def prefered_vendor\n vendors_array = vendors\n\n highest_revenue = 0\n best_vendor = nil\n\n vendors_array.each do |vendor|\n vendor_revenue = vendor.revenue\n if vendor_revenue > highest_revenue\n highest_revenue = vendor_revenue\n best_vendor = vendor\n end\n end\n\n return best_vendor\n end", "def vendor_search\n convention = Convention.find(params[\"id\"])\n @search_results = convention.convention_vendor_search(params[\"search\"])\n end", "def vendor_count\n @vendor_count ||= Vendor.count\n end", "def display_name\n self.device_name || \"#{vendor} #{model}\"\n end", "def find_by_key(key)\n result = nil\n @vendors.each do |vendor|\n result = vendor if vendor.vendor_keys.any? { |k| k.key == key }\n end\n result\n end", "def preferred_vendor\n # returns the vendor with the highest revenue\n vendors.max_by {|vendor| FarMar::Vendor.find(vendor.id).revenue}\n end", "def set_admin_vendor\n @vendor = Vendor.find(params[:id])\n end", "def preferred_vendor(date = nil)\n highest_selling_vendor_amount = 0\n highest_selling_vendor = \"\"\n if date == nil\n vendors.each do |vendor|\n if vendor.revenue > highest_selling_vendor_amount\n highest_selling_vendor_amount = vendor.revenue\n highest_selling_vendor = vendor\n end\n end\n return highest_selling_vendor\n # else\n # sales = FarMar::Sale.between(\"#{date} 00:00:00\", \"#{date} 24:59:59\")\n # # sales = FarMar::Sale.all\n # sales.each do |sale|\n # # purchase_time = DateTime.parse(sale.purchase_time)\n # vendors.each do |vendor|\n # # if purchase_time === date\n # if vendor.revenue > highest_selling_vendor_amount\n # highest_selling_vendor_amount = vendor.revenue\n # highest_selling_vendor = vendor\n # end\n # end\n # end\n # # end\n # return highest_selling_vendor\n end\n end", "def is_vendor?\n current_user && current_user.vendor\n end", "def set_record_source_vendor\n @bundle = params[:bundle_id] ? Bundle.available.find(params[:bundle_id]) : Bundle.default\n @vendor = Vendor.find(params[:vendor_id])\n @source = @vendor\n breadcrumbs_for_vendor_path\n @title = \"#{@vendor.name} Uploaded Patients\"\n end", "def vendor; end", "def products\n FarMar::Product.by_vendor(self.id)\n end", "def add_vendor\n vendor = @product_row[:vendor].match(/[\\D\\s]*/)\n vendors = Spree::Vendor.where(\"name ILIKE ?\", \"%#{vendor[0].strip}%\")\n if !(vendors.empty?)\n if(@product_row[:vendor].match(/goers/i))\n notes = notes = \"\" ? @product_row[:vendor] : notes + \", \" + @product_row[:vendor]\n end\n\n @new_product_vendor = Spree::ProductVendor.create :variant_id => @new_product_condition.id,\n :vendor_id => vendors.first.id,\n :vendor_part_number => @product_row[:vendor_part_number],\n :vendor_price => @product_row[:vendor_price],\n :notes => notes\n else\n @errors << { :part_number => @product_row[:name], :condition => @product_row[:condition], :message => \"Could not match vendor \" + @product_row[:vendor] }\n end\n end", "def preferred_vendor\n self.vendors.max_by { |vendor| vendor.revenue}\n end", "def get_vendor option\n where_clause = []\n\n option.each do |key, value|\n key = key.to_s\n case key\n when 'code'\n where_clause << \"code = #{hex_or_int(value)}\"\n when 'name'\n where_clause << \"name = '#{value}'\"\n else\n return Hash.new(nil)\n end\n end\n\n result = @handle.execute(\"SELECT * FROM vendors WHERE #{where_clause.join(\" AND \")} LIMIT 1;\").first\n\n return result || Hash.new(nil)\n end", "def set_vendor_item\n @product = Product.find(params[:product_id])\n @vendor_item = @product.vendor_items.find(params[:id])\n end", "def developer_names\n devs = []\n if developers\n for developer in developers\n devs << developer.name\n end\n end\n devs.split.join(\", \")\n end", "def software_name\n begin\n self.software.name\n rescue\n \"not found\"\n end\n end", "def vendor\n Reggora::Resources::Vendor.new(config)\n end", "def set_admin_vendor\n @admin_vendor = Vendor.find(params[:id])\n end", "def vendor\n @header.vendor\n end", "def exist?(name)\n @vendors.any? { |vendor| vendor.name == name }\n end", "def vendor_params\n params.require(:vendor).permit(:name)\n end", "def fetch_brand_object_and_vendors\n #determine where the id of the brand is stored\n brand_id = params[:id] || params[:brand_id]\n #find the row\n @manufacturer = Manufacturer.find_by_param(brand_id) || Manufacturer.find_by_name(brand_id)\n \n #error out if no row is found\n render_404 and return false if @manufacturer.blank?\n \n #find vendors if a user belongs to a premium firm\n if @premium\n sales_reps = @firm.sales_reps.includes(:office_sales_reps).where(:\"office_sales_reps.manufacturer_id\"=>@manufacturer.id).references(:office_sales_reps).group(:\"sales_reps.id\")\n @all_vendors_count = sales_reps.to_a.count\n @local_vendors_count = sales_reps.where(:\"office_sales_reps.office_id\"=>current_user.office.id).to_a.count if current_user.office.present?\n end\n end", "def find_association name\n associations.values.detect do |association|\n association.represents_sfdc_table? name\n end\n end", "def name\n self.company.name unless company.nil?\n end", "def name\n association.name\n end", "def gl_vendor()\n glGetString(GL_VENDOR)\n end", "def find(id)\n result = nil\n @vendors.each do |vendor|\n result = vendor if vendor.id == id\n end\n result\n end", "def valid_vendor?\n SUPPORTED_VENDORS.include?(@name)\n end", "def set_usr_vendor_property\n @user_contact = UsrContact.find(current_usr_contact )\n end", "def brand_name\n product.brand_name\n end", "def get_vendor_inventory_products\n\t\tis_unassigned_vendor = self.vendor.nil?\n\t\tif is_unassigned_vendor\n\t\t\treturn []\n\t\telse\n\t\t\t_inventory = self.vendor.inventory\n\t\t\treturn _inventory.products\n\t\tend\n\tend", "def set_vendorpart\n @vendorpart = Vendorpart.find(params[:id])\n end", "def initialize\n @vendors = []\n end", "def all_phones_vendor\n\t\tif self.phone.blank? && self.alt_phone.blank?\n\t\t\treturn \"Not shown\"\n\t\telsif self.alt_phone.blank?\n\t\t\treturn self.phone\n\t\telsif self.phone.blank?\n\t\t\treturn self.alt_phone\n\t\telse\n\t\t\treturn \"#{self.phone} / #{self.alt_phone}\"\n\t\tend\n\tend", "def show\n @products = @vendor.products\n end", "def set_vendors\n @promotion = Promotion.find(params[:promotion_id])\n end", "def remove_info_for_vendor vendor_id\n\n # Remove all container objects for this vendor. There should really never be more\n # than one.\n event_vendors_to_delete = event_vendors.find_all{|item| item.vendor_id == vendor_id }\n event_vendors.destroy(event_vendors_to_delete)\n\n # Remove all goods-related menu items where we are dealing with this vendor\n destroy_line_items(line_items.where(:payable_party_id => vendor_id, :payable_party_type => 'Vendor'))\n destroy_line_items(line_items.where(:billable_party_id => vendor_id, :billable_party_type => 'Vendor'))\n destroy_line_items(line_items.select{|li| (!li.inventory_item.nil? && li.inventory_item.vendor_id == vendor_id)})\n destroy_line_items(line_items.select{|li| (!li.menu_template.nil? && li.menu_template.vendor_id == vendor_id)})\n\n trigger_event_rollup\n end", "def vendors_and_regions\n fetch(@config[:finance_path], 'Finance.getVendorsAndRegions')\n end", "def set_vendor_profile\n @vendor_profile = VendorProfile.find(params[:id])\n end", "def VendorInfo()\r\n ret = _getproperty(1610743814, [], [])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end", "def agency_names(options = {})\n autolink = true unless options[:no_links]\n\n if agencies.present?\n agencies = model.agencies.map{|a| \"the #{h.link_to_if autolink, a.name, a.url}\" }\n else\n agencies = model.agencies.map(&:name)\n end\n\n agencies.to_sentence.html_safe\n end", "def gl_vendor\n glGetString(GL_VENDOR)\n end", "def brand_name\n product.brand_name\n end", "def products\n Product.find_by_vendor(@id)\n end", "def find(vendor_id)\n @client.get(\"/#{@model}/#{vendor_id}\")\n end", "def show\n # Check to see that a valid vendor id was sent in. If not, redirect to vendors index page\n if @vendor = Vendor.find_by(id: params[:id])\n # A valid vendor was passed via :id\n # get all reviews associated with this vendor\n @reviews = @vendor.vendor_reviews.paginate(:page => params[:page], :per_page => 5).order('created_at DESC')\n else\n flash[:warning] = \"The vendor you are looking for does not exist\"\n redirect_to vendors_path\n end\n end", "def set_vendor_cat\n @vendor_cat = VendorCat.find(params[:id])\n end", "def remove_info_for_vendor vendor_id\n\n # Remove all container objects for this vendor. There should really never be more\n # than one.\n event_vendors_to_delete = event_vendors.find_all{|item| item.vendor_id == vendor_id }\n event_vendors.destroy(event_vendors_to_delete)\n\n # Remove all goods-related menu items where we are dealing with this vendor\n line_items.destroy(line_items.where(:payable_party_id => vendor_id, :payable_party_type => 'Vendor'))\n line_items.destroy(line_items.where(:billable_party_id => vendor_id, :billable_party_type => 'Vendor'))\n line_items.destroy(line_items.select{|li| (!li.inventory_item.nil? && li.inventory_item.vendor_id == vendor_id)})\n line_items.destroy(line_items.select{|li| (!li.menu_template.nil? && li.menu_template.vendor_id == vendor_id)})\n\n trigger_event_rollup\n end", "def products\n FarMar::Product.by_vendor(id)\n end", "def products\n FarMar::Product.by_vendor(id)\n end", "def index\n @vendors = Vendor.all\n end", "def index\n @vendors = Vendor.all\n end", "def index\n @vendors = Vendor.all\n end" ]
[ "0.6861759", "0.67460877", "0.66345555", "0.65800905", "0.65171427", "0.64869577", "0.6462256", "0.6462256", "0.6458595", "0.6408482", "0.6378536", "0.6343719", "0.63358545", "0.6308895", "0.6294236", "0.6282399", "0.625751", "0.6251122", "0.62116283", "0.6205272", "0.615741", "0.6130124", "0.61112064", "0.61112064", "0.6075649", "0.6056752", "0.5934225", "0.58574724", "0.5801281", "0.5770184", "0.575322", "0.56613857", "0.5647611", "0.5601703", "0.55675066", "0.55675066", "0.55675066", "0.55675066", "0.5552915", "0.54903877", "0.54903877", "0.547525", "0.54613596", "0.54335415", "0.5415189", "0.5405378", "0.54004395", "0.5355781", "0.5342029", "0.5298759", "0.52869403", "0.5284719", "0.5262189", "0.52363765", "0.5234221", "0.52055496", "0.519112", "0.5178669", "0.5149013", "0.5137097", "0.51348746", "0.5103235", "0.509644", "0.508439", "0.5084083", "0.50836474", "0.50713015", "0.50347066", "0.5007232", "0.5005558", "0.49826074", "0.49644917", "0.4956598", "0.49547037", "0.49520782", "0.49498338", "0.49356005", "0.49343592", "0.49211407", "0.49078405", "0.49071246", "0.49016348", "0.48867887", "0.48818564", "0.4877939", "0.4874926", "0.48665443", "0.4856969", "0.4841104", "0.48397335", "0.48364258", "0.48263964", "0.48193866", "0.48058978", "0.4801397", "0.4799476", "0.4799476", "0.47989362", "0.47989362", "0.47989362" ]
0.7084646
0
Checks to see if the campus only designation is set
def campus_only? access == 'Campus Only Access (No Proxy)' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def design_data_filled_in?\n !self.description.blank? && \n !self.platform.blank? && \n !self.product_type.blank? && \n !self.project.blank? &&\n !self.design_directory.blank? &&\n !self.incoming_directory.blank?\n end", "def is_none_fields\n\t\tunless self.designation!=\"none\" && self.department!=\"none\"\n\t\t\tself.errors[:none] << \"=> You can't create none role\"\n\t\tend\n\tend", "def CA_only?\n course_assistant? && !instructor?\n end", "def CA_only?\n course_assistant? && (not instructor?)\n end", "def showCareerBox()\n if !current_profession.blank? or \n !c_previous_professions.blank? or \n !current_class.blank? or \n !c_previous_classes.blank? or \n !paragon_path.blank? or \n !epic_destiny.blank? or\n !level.blank? or\n !server.blank? or\n !guild.blank?\n\n return true\n else\n return false\n end\n end", "def is_organizer_optional=(value)\n @is_organizer_optional = value\n end", "def info_show_profession_of_faith\n chosen_baptized_catholic? && !baptized_catholic\n end", "def validate_selected_one_campus\n if campuses.empty?\n errors.add(:campuses, \"No se ha seleccionado un campus para publicar esta noticia\")\n end\n end", "def is_organizer_optional\n return @is_organizer_optional\n end", "def individual?\n employments.blank?\n end", "def is_designer?\n self.designer_role != nil\n end", "def formation_enabled\n $game_party.members.size >= 2 && !$game_system.formation_disabled\n end", "def read_only?\n checking_citizen_answers? || with_applicant?\n end", "def for_profit?\n !foreign? && !facility_code.nil? && facility_code[0] == \"2\"\n end", "def officer?\n self.admin? or\n self.position == \"chair\"\n end", "def occupied?\n !patient.nil?\n end", "def is_name_admin?\n\t\tunless self.designation != 'admin' \n\t\t\tself.errors[:admin_designation] << \"=> You can't assign the admin designation to another employees\"\n\t\tend\n\tend", "def mandatory_case_details?\n claim.court && claim.case_number && claim.supplier_number\n end", "def asf_chair_or_member?\n asf_member? or ASF.pmc_chairs.include? self\n end", "def can_be_officer?\n self.degree.to_sym == :master_mason\n end", "def has_province?\n !!province_c\n end", "def public?\n !foreign? && !facility_code.nil? && facility_code[0] == \"1\"\n end", "def cabinets_assigned?\n return gold_team_id.present? && blue_team_id.present?\n end", "def self_auditor_assigned?\n self.designer_id > 0\n end", "def has_county?\n !!province_c and !!county_c\n end", "def mandatory_case_details?\n claim.court && claim.case_number && claim.external_user\n end", "def is_advisor?\n not advisor_companies.empty?\n end", "def advised?\n advisor_company_affiliations.with_access.present?\n end", "def senior_member?\n\t\tsenior != true\n\tend", "def pain_generation_enabled?\n creditor_detail.present?\n end", "def fine_grain_discipline_requirements_present?(discipline)\n (request_staffs.detect{|rs| rs.discipline == discipline and rs.visit_type == nil} and\n request_staffs.detect{|rs| rs.discipline == discipline and rs.visit_type}) ? true : false\n end", "def field_is_required_for_collecting_area?(field_name)\n return false if collecting_area.blank?\n\n (REQUIRED_PER_COLLECTING_AREA[collecting_area.to_sym] || []).include?(field_name.to_sym)\n end", "def managed_only?\n !programme_dropdown? &&\n Programme.site_managed_programme.present? &&\n !Programme.can_create?\n end", "def cfe_call_required?\n return false if draft_selected? || legal_aid_application.provider_entering_merits?\n\n true\n end", "def faculty?\n\t\tmember_of.downcase.include? \"faculty\"\n\tend", "def read_only?\n provider_submitted? || checking_citizen_answers?\n end", "def non_quest_attribute\n !!(controller == \"inspirations\" || controller == \"family_members\" || controller == \"subscriptions\" || controller == \"disciplines\" || controller == \"priority_items\")\n end", "def status_restricted?\n (prospect || exstudent || student) &&\n !(prospect && exstudent && student)\n end", "def has_city?\n self.errors.add :base, \"Ad must have at least one city.\" if self.cities.blank?\n end", "def free?\n self.instructor.nil?\n end", "def uses_visit_attendance_options?\n\t\t!visit_attendance_options.blank?\n\tend", "def is_an_lcr_designer?\n designer = self.roles.detect { |r| r.name == 'Designer'}\n designer && !self.employee?\n end", "def can_create_competitors_at_lane_assignment?\n usa?\n end", "def can_create_competitors_at_lane_assignment?\n usa?\n end", "def is_relevant_for_educator?\n supported_schools.any? {|school| authorized_grade_levels(school.id).size > 0 }\n end", "def graduation_required?\n applicant_type == 'grad_student' || applicant_type == 'undergrad_student' ||\n applicant_type == 'school_student'\n end", "def assigned_course_or_script?\n assigned_courses.any? || any_visible_assigned_scripts?\n end", "def guard_defeated?\n return true if @goal_was_occupied\n guard_mission.squads.each do |squad|\n return false if not squad.annihilated? and not squad.retreated_from_fortress and squad.entried\n end\n return true\n end", "def group\n hospital.presence || university.presence || university_group.presence\n end", "def program_wide?\n location_id.nil? || always_show_on_attendance_pages?\n end", "def school_chose_cip?\n induction_records.first.school_cohort.core_induction_programme?\n end", "def university_pending?\n university && line_items_pending_any?\n end", "def is_supervisor?\n not under_supervision_clinics.empty?\n end", "def school_info_optional?\n true # update if/when A/B test is done and accepted\n end", "def in_construction?\n ways.detect {|w| !w.in_construction?}.nil?\n end", "def cfp_data_only_if_manages_proposals\n return true if manages_proposals\n self.cfp_open_date = self.cfp_close_date = nil\n self.public_proposals = false\n true\n end", "def is_booking_request?\n self.celebrity_id.present?\n end", "def obligatory?\n data[:obligatory] === true\n end", "def ptainstructor_is_valid?\n return self.ptainstructor_id != nil\n end", "def booked?\n collaboration.present?\n end", "def can_create_course?\n ptainstructors = Ptainstructor.find_by_semester_id(self.id)\n teachers = Teacher.find_by_semester_id(self.id)\n if ((ptainstructors == nil) or (teachers == nil))\n return false\n end\n return true\n end", "def validate_that_at_least_one_set_of_contact_info_is_present\n return if veteran_contact_info.present? || claimant_contact_info.present?\n\n errors.add :form_data, I18n.t('appeals_api.errors.contact_info_presence')\n end", "def at_least_one_active_procurement_building\n errors.add(:procurement_buildings, :invalid) unless procurement_buildings.map(&:active).any?(true)\n end", "def at_least_one_active_procurement_building\n errors.add(:procurement_buildings, :invalid) unless procurement_buildings.map(&:active).any?(true)\n end", "def organisation?\n session[:organisation] and session[:organisation].size > 0\n end", "def non_profit_admin?\n managed_organization.try(:type) == 'NonProfit'\n end", "def student?\n return self.eduPersonAffiliation==\"student\"\n end", "def can_edit_dev? \n (assigned_dev_id = params[:ticket][:assigned_dev_id]).blank? or (is_admin_or_pm? and is_team_member?(assigned_dev_id))\n end", "def can_put_in_foundation?\n (@pile_beneath.empty? && @card_to_drop.rank.ace?) ||\n (@card_beneath && foundation_conditions?(@card_beneath))\n end", "def caregiver?\n caregiver.nil?\n end", "def local?\n daycare_id.nil? ? false : true\n end", "def local?\n daycare_id.nil? ? false : true\n end", "def attending?\n institution_id == participant.try(:college_attending_id)\n end", "def any_present?\n if name.blank? and phone.blank? and license_plate.blank?\n errors.add :base, \"You must fill in at least one field\"\n end\n end", "def overridden_by_department?(cop); end", "def categorizing?\n instance_variable_defined?(:@required_forms)\n end", "def team_formation_allowed?(dd)\n dd.deadline_type_id == DeadlineHelper::DEADLINE_TYPE_TEAM_FORMATION\n end", "def is_valid?\n instructor_approved || (non_rejected_student_memberships.size >= assignment.group_min)\n end", "def claimed?\n !claimant.nil?\n end", "def mandatory_supporting_evidence?\n claim.documents.any? || claim.evidence_checklist_ids.any?\n end", "def only_one_organization_specified\n unless team.blank? ^ organization.blank?\n errors.push(:organization, 'is required and only one may be specified')\n end\n end", "def scholarly?\n false\n end", "def show?\n return true if user.admin? || is_in_company?(record)\n\n record.information_complete? ? true : false\n end", "def can_see_contest\n if (@contest.in_construction? && !(@signed_in && @contest.is_organized_by_or_admin(current_user.sk)))\n render 'errors/access_refused' and return\n end\n end", "def limit_modeling?\n !self[:modeling].nil? && self[:modeling] == false\n end", "def setup_accessible?\n setup || is_admin\n end", "def check_department\n if self.department_id.nil?\n self.department = Department.find_by_name(\"Management\")\n end\n end", "def can_abdicate?\n project = Project.find(self.project_id)\n participants = Participant.where(project_id: self.project_id).where.not(id: self.id)\n other_organizers = participants.any?{|f| f.can_organize? }\n if other_organizers.present?\n true\n end\n end", "def set_is_school_choice\n is_school_choice_array = subdistricts.map {|sd| sd[:school_choice_is]}\n\n self.is_school_choice = is_school_choice_array.include? true\n end", "def program_announcement_view?\n return false if User.current_user.is? :any, :in_group => [:geography], :center_id => self.center_id\n return false if User.current_user.is? :any, :in_group => [:pcc], :center_id => self.center_id\n return true if User.current_user.is? :program_announcement, :center_id => self.center_id and ANNOUNCED_STATES.include?(self.state)\n end", "def can_edit_letter?(organization)\n unless organization.new_record? || organization.approved? && current_contact.from_organization?\n true\n end\n end", "def edit_subject_areas?\n edit_settings? || owner?\n end", "def doctor_is_appropriate\n return if ailment.nil? || doctor.nil?\n\n unless doctor.is_appropriate_for?(ailment)\n errors[:doctor] << \"is not appropriate for this ailment\"\n end\n end", "def administrative?\n self.status == :administrative\n end", "def global?\n daycare_id.nil? ? true : false\n end", "def global?\n daycare_id.nil? ? true : false\n end", "def is_single_sex?\n self.cage_type.include?('single')\n end", "def company_no_required?\n return false if overseas?\n return false if lower_tier?\n\n %w[limitedCompany limitedLiabilityPartnership].include?(business_type)\n end", "def create?\n\t\tuser.course_grants > 0\n\tend", "def restrictible?\n config.restrictable.equal?(true)\n end" ]
[ "0.64387053", "0.6382764", "0.6297314", "0.629274", "0.6036108", "0.6029512", "0.5967276", "0.5959347", "0.59436333", "0.5917164", "0.59119636", "0.59104216", "0.5866875", "0.5866", "0.58163923", "0.58155763", "0.5809384", "0.57872176", "0.57797986", "0.5771028", "0.57668847", "0.5758918", "0.5722555", "0.57024896", "0.5696048", "0.5678428", "0.5670131", "0.56657237", "0.56424236", "0.56420165", "0.56324667", "0.5628616", "0.5615463", "0.56142783", "0.55848867", "0.558074", "0.558028", "0.55746555", "0.55708355", "0.55495316", "0.5544791", "0.5541866", "0.5539218", "0.5539218", "0.55332434", "0.55266833", "0.5519269", "0.551631", "0.5490356", "0.54887134", "0.5479849", "0.5479456", "0.54780596", "0.54759353", "0.5461061", "0.54549855", "0.5449495", "0.5441012", "0.54408634", "0.5438891", "0.5431253", "0.54311746", "0.54249525", "0.54249525", "0.5423907", "0.54184943", "0.54090685", "0.5408123", "0.5405707", "0.540102", "0.53995305", "0.53995305", "0.53994775", "0.5394945", "0.5387958", "0.5386751", "0.53866875", "0.5378369", "0.5365269", "0.5364318", "0.53637457", "0.5362036", "0.535998", "0.53591293", "0.5353955", "0.53533816", "0.5351681", "0.5347147", "0.5342303", "0.5341591", "0.53413785", "0.5340931", "0.53388304", "0.5337993", "0.5337376", "0.5337376", "0.53275836", "0.53269", "0.531819", "0.5312125" ]
0.71379286
0
Creates a hash to use in the lib_guides CSV. LibGuides requries the use of these fields vendor name url enable_proxy description more_info enable_new enable_trial types keywords target slug best_bets subjects desc_pos lib_note enable_popular enable_hidden internal_note owner resource_icons thumbnail content_id
def csv_hash { vendor: self.vendor_name, name: self.name, url: self.url, enable_proxy: self.access == 2 ? 1 : 0, description: self.description, more_info: '', enable_new: self.new_database.to_i, enable_trial: self.trial_database.to_i, types: self.resources.pluck(:name).join(';'), keywords: '', target: 0, slug: '', best_bets: self.curated.pluck(:name).join(';'), subjects: self.subjects.pluck(:name).join(';'), desc_pos: 1, lib_note: 0, enable_popular: self.popular.to_i, enable_hidden: 0, internal_note: '', owner: '', resource_icons: '', thumbnail: '', content_id: self.libguides_id } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash\n [id, url, external_id, first_name, last_name, middle_name, birth_date, gender, language, phone, allow_phone_contact, email, allow_email_contact, notes, date_created, date_modified, ext_date_created, ext_date_modified, doc_type, doc_issuer_info, doc_series, doc_number, department_code, department_name, doc_issue_date, doc_expiration_date, is_closed, merged_to, building_no, city, country_code, country_name, district, flat_no, house_no, region, room_no, settlement_type, street, raw_address, cards, view_url, preferences].hash\n end", "def hash\n [life_style_type, listing_action, contact_preference, under_offer_or_contract, auction, bond, available_from, property_details, is_new_development, statement_of_information, price, domain_ad_id, domain_agency_id, provider_ad_id, features, description, summary, inspection_details, media, contacts, other_enquiry_email, receive_emails_to_default_address, is_rural, supplementary].hash\n end", "def hash\n [client_id, secret, client_name, language, country_codes, user, products, additional_consented_products, required_if_supported_products, webhook, access_token, link_customization_name, redirect_uri, android_package_name, institution_data, account_filters, eu_config, institution_id, payment_initiation, deposit_switch, employment, income_verification, base_report, consumer_report_permissible_purpose, auth, transfer, update, identity_verification, statements, user_token, investments, investments_auth, hosted_link].hash\n end", "def hash\n [objective, property_types, status, sale_mode, channel, address_parts, advertiser_identifiers, apm_identifiers, bathrooms, bedrooms, building_area, building_area_sqm, carspaces, date_available, date_created, date_updated, date_minor_updated, date_listed, date_purged, description, dev_project_id, energy_efficiency_rating, features, geo_location, headline, id, inspection_details, is_new_development, land_area, land_area_sqm, media, price_details, property_id, provider_details, rental_details, sale_details, is_withdrawn, seo_url, error_message, virtual_tour_url, homepass_enabled, statement_of_information, number_of_dwellings, highlights].hash\n end", "def hash\n [key, name, description, kind, creation_date, include_in_snippet, temporary, maintainer_id, tags, variations, goal_ids, _version, custom_properties, _links, _maintainer, environments, archived_date, archived, client_side_availability, defaults].hash\n end", "def hash\n [client_id, secret, company_name, is_diligence_attested, products, create_link_customization, logo, legal_entity_name, website, application_name, technical_contact, billing_contact, customer_support_info, address, is_bank_addendum_completed, assets_under_management, redirect_uris].hash\n end", "def hash\n [adwords_grouping, adwords_label1, adwords_label2, adwords_label3, adwords_label4, adwords_label5, age_group, available_at_physical_store, book_author, book_format, book_isbn, book_publisher, category_description, color, condition, custom_label0, custom_label1, custom_label2, custom_label3, custom_label4, gender, google_product_category, music_artist, music_format, music_release_date, omit_from_feed, product_type, promotion_id1, promotion_id10, promotion_id2, promotion_id3, promotion_id4, promotion_id5, promotion_id6, promotion_id7, promotion_id8, promotion_id9, search_dts, search_lowest_price, search_lowest_url, search_position, shipping_label, size, video_director, video_format, video_rating, video_release_date, video_starring].hash\n end", "def hash\n [id, gl_class, gl_type_id, document_date, document_number, document_type, memo, description, attention, sales_territory, company, company_type, company_account_number, site, billing_terms, billing_terms_xref, due_days, due_date, email_delivery_flag, print_delivery_flag, agreement_pre_payment_flag, account_number, billing_type, gl_entry_ids, purchase_order, project, currency, total, sales_rep_id, sales_rep_name, taxable, taxable_total, tax_code, tax_group_rate, piggy_back_flag, tax_account_number, sales_tax, state_tax, county_tax, city_tax, taxable_amount1, taxable_amount2, taxable_amount3, taxable_amount4, taxable_amount5, tax_agency_xref, state_tax_xref, county_tax_xref, tax_id, tax_dp_applied_flag, use_avalara_flag, send_avalara_tax_flag, ship_to_company, ship_company_account_number, ship_company_type, ship_tax_id, ship_site, ship_contact, detail].hash\n end", "def hash\n [account_id, campaign_id, csp_id, reseller_id, status, create_date, auto_renewal, billed_date, brand_id, usecase, sub_usecases, description, embedded_link, embedded_phone, affiliate_marketing, number_pool, age_gated, direct_lending, subscriber_optin, subscriber_optout, subscriber_help, sample1, sample2, sample3, sample4, sample5, message_flow, help_message, reference_id, mock, next_renewal_or_expiration_date].hash\n end", "def hash\n [anchor, anchor_case_sensitive, anchor_horizontal_alignment, anchor_ignore_if_not_present, anchor_match_whole_word, anchor_units, anchor_x_offset, anchor_y_offset, bold, collaborative, conceal_value_on_document, created_by_display_name, created_by_user_id, custom_tab_id, disable_auto_size, editable, font, font_color, font_size, height, included_in_email, initial_value, italic, items, last_modified, last_modified_by_display_name, last_modified_by_user_id, locked, maximum_length, merge_field, name, payment_item_code, payment_item_description, payment_item_name, required, scale_value, selected, shared, stamp_type, stamp_type_metadata, tab_label, type, underline, validation_message, validation_pattern, width].hash\n end", "def hash\n [area_ids, capacities, merchant_newsletter_selection_required, area_selection_required, reservation_enquiry_enabled, minimum_capacity_for_enquiries, online_reservation_interval, special_terms, links, automatic_confirmation, ccv_enabled].hash\n end", "def hash\n [accounting, amember, auto_order, ccbill, channel_partner_item_mappings, chargeback, checkout, content, creation_dts, description, description_translated_text_instance_oid, digital_delivery, ebay, email_notifications, enrollment123, fulfillment_addons, gift_certificate, google_product_search, identifiers, inactive, instant_payment_notifications, internal, kit, kit_component_only, kit_definition, last_modified_dts, merchant_id, merchant_item_id, merchant_item_oid, options, parent_category_id, parent_category_path, payment_processing, physical, pricing, properties, realtime_pricing, recommend_replenishment_days, related, reporting, restriction, revguard, reviews, salesforce, shipping, tags, tax, third_party_email_marketing, variant_items, variations, wishlist_member].hash\n end", "def hash\n [id, document_date, gl_class, gl_type_id, gl_item_id, sales_code, description, cost, memo, tax_note, vendor_number, account_number, cost_account_number, inventory_account_number, vendor_account_number, item, item_description, sales_description, taxable, item_price, item_cost, unit_of_measure, quantity, total, currency, serialized_flag, serial_numbers, drop_shipped_flag, line_number, warehouse_bin, warehouse_site, sub_category, shipment_method, item_type_xref, inventory_xref, cogs_xref, uom_schedule_xref, price_level_xref, location_xref, tax_code, purchase_header_tax_group, tax_code_xref, tax_rate, tax_agency_xref].hash\n end", "def hash\n [affiliate_rate, campaign_id, category, client_review, create_date, currency_code, description, document_id, fee_amount, fee_type, financial_rate, financial_rate_term, financial_rate_term_unit, financial_rate_type, id, image, institution_name, is_active, metadata, minimum_contribution, minimum_contribution_term, minimum_contribution_term_unit, name, node_map, offer_link, offer_term, offer_term_unit, prerequisite, prerequisite_type, rating, secondary_id, subcategory, update_date].hash\n end", "def hash\n [actor, artist, aspect_ratio, audience_rating, author, back_finding, band_material_type, binding, bluray_region, brand, cero_age_rating, chain_type, clasp_type, color, cpu_manufacturer, cpu_speed, cpu_type, creator, department, director, display_size, edition, episode_sequence, esrb_age_rating, feature, flavor, format, gem_type, genre, golf_club_flex, golf_club_loft, hand_orientation, hard_disk_interface, hard_disk_size, hardware_platform, hazardous_material_type, item_dimensions, is_adult_product, is_autographed, is_eligible_for_trade_in, is_memorabilia, issues_per_year, item_part_number, label, languages, legal_disclaimer, list_price, manufacturer, manufacturer_maximum_age, manufacturer_minimum_age, manufacturer_parts_warranty_description, material_type, maximum_resolution, media_type, metal_stamp, metal_type, model, number_of_discs, number_of_issues, number_of_items, number_of_pages, number_of_tracks, operating_system, optical_zoom, package_dimensions, package_quantity, part_number, pegi_rating, platform, processor_count, product_group, product_type_name, product_type_subcategory, publication_date, publisher, region_code, release_date, ring_size, running_time, shaft_material, scent, season_sequence, seikodo_product_code, size, size_per_pearl, small_image, studio, subscription_length, system_memory_size, system_memory_type, theatrical_release_date, title, total_diamond_weight, total_gem_weight, warranty, weee_tax_value].hash\n end", "def hash\n [background_color_field_name, uppercase, metadata, barcode_symbology, min_length, integer, type, required, comb_value_offset, image_gravity, overflow, qrcode_color, color_field_required, background_color_field_required, id, image_scale_type, exclusive_minimum, height, number_condition_range_exclusive_max, invert_boolean_condition, shape_fill_color_field_name, static, shape_border_color_field_name, v_alignment, bold, shape_border_width, comb_number_of_cells, shape_border_color, comb, typeface, shape_type, condition, display_type, check_color, multiline_lines, multiline, true_text, name, font_size, page, alignment, max_length, auto_calculate_max_length, color_field_name, qrcode_color_field_name, number_condition_range_min, color, hidden, check_color_field_required, combined_field_format, description, shape_border_color_field_required, combined_field_names, title, number_condition_range_exclusive_min, combined_field_separator, exclusive_maximum, default, combined_field_type, date_time_format, qrcode_color_field_required, currency, false_text, strikethrough, character_spacing, number_condition_range_max, background_color, check_color_field_name, check_character, rotation, option_list, shape_fill_color, string_condition_type, shape_fill_color_field_required, decimal_places, include_time, width, x, maximum, y, signature_allow_draw, number_condition_type, opacity, minimum, signature_allow_type].hash\n end", "def hashed_fields_for_export\n hash = {}\n\n self.ordered_questions.map { |q| hash[q.answer_field] = q.text }\n\n hash.merge!({\n location_code: \"Location Code\",\n user_agent: \"User Agent\",\n page: \"Page\",\n referer: \"Referrer\",\n created_at: \"Created At\"\n })\n\n if self.organization.enable_ip_address?\n hash.merge!({\n ip_address: \"IP Address\"\n })\n end\n\n hash\n end", "def hash\n [format, text_compression, embed_full_fonts, compliance, sufficient_resolution, jpeg_quality, draw_slides_frame, show_hidden_slides, save_metafiles_as_png, password, embed_true_type_fonts_for_ascii, additional_common_font_families, notes_position, comments_position, comments_area_width, comments_area_color, show_comments_by_no_author, image_transparent_color, apply_image_transparent].hash\n end", "def guidebook_params\n\n split_val = \";\"\n organizer = params[:guidebook][:organizer_id] || params[:guidebook][:organizer]\n\n\n if organizer.class == String\n new_organizer = Organizer.find_by_name(organizer)\n\n unless new_organizer.nil?\n new_user = new_organizer.user\n params[:guidebook][:user] = new_user\n params[:guidebook][:organizer] = new_organizer\n end\n end\n\n if params[:guidebook][:tags] == \"\" or params[:guidebook][:tags].nil?\n params[:guidebook][:tags] = []\n else\n tags_to_array = params[:guidebook][:tags].split(split_val)\n tags = []\n tags_to_array.each do |t|\n tags.push Tag.find_or_create_by(name: t)\n end\n params[:guidebook][:tags] = tags\n end\n\n if params[:guidebook][:languages] == \"\" or params[:guidebook][:languages].nil?\n params[:guidebook][:languages] = []\n else\n langs_to_array = params[:guidebook][:languages].split(split_val)\n langs = []\n langs_to_array.each do |l|\n langs.push Language.find_or_create_by(name: l)\n end\n params[:guidebook][:languages] = langs\n end\n\n pkg_attr = params[:guidebook][:packages]\n\n if !pkg_attr.nil?\n post_data = []\n pkg_attr.each do |p|\n included_array = p[1][\"included\"].split(split_val)\n post_data.push Package.create(name: p[1][\"name\"], value: p[1][\"value\"], percent: p[1][\"percent\"], description: p[1][\"description\"], included: included_array)\n end\n params[:guidebook][:packages] = post_data\n end\n\n if params[:guidebook][:included] == \"\" or params[:guidebook][:included].nil?\n params[:guidebook][:included] = []\n else\n included_to_array = params[:guidebook][:included].split(split_val)\n included = []\n included_to_array.each do |i|\n included.push i\n end\n params[:guidebook][:included] = included\n end\n\n if params[:guidebook][:nonincluded] == \"\" or params[:guidebook][:nonincluded].nil?\n params[:guidebook][:nonincluded] = []\n else\n nonincluded_to_array = params[:guidebook][:nonincluded].split(split_val)\n nonincluded = []\n nonincluded_to_array.each do |i|\n nonincluded.push i\n end\n params[:guidebook][:nonincluded] = nonincluded\n end\n\n current_category = params[:guidebook][:category]\n\n if current_category == \"\" or current_category.nil?\n params[:guidebook][:category] = Category.find_or_create_by(name: 'Outras')\n else\n begin\n params[:guidebook][:category] = Category.find(current_category)\n rescue => e\n params[:guidebook][:category] = Category.find_or_create_by(name: current_category)\n end\n end\n\n params[:guidebook][:currency] = \"BRL\"\n\n # unpermitted params error even with all params provided\n #params.require(:guidebook).permit(:title, :currency, :picture, :organizer_id, :file, :value, :description, :status, :category_id, user: [:id, :name], organizer: [:id, :name], tags: [:id, :name], languages: [:id, :name], category: [:id, :name], packages_attributes: [:id, :name, :value, :description, :percent, :included], wheres_attributes: [:id, :name, :place_id, :background_id, :lat, :long, :city, :state, :country, :postal_code, :address, :google_id, :url], included: [], nonincluded: []).merge(params[:guidebook])\n params.require(:guidebook).permit!\n end", "def hash\n [id, summary, record_type, board, status, project, phase, wbs_code, company, site, site_name, address_line1, address_line2, city, state_identifier, zip, country, contact, contact_phone_number, contact_phone_extension, contact_email_address, type, sub_type, item, team, owner, priority, service_location, source, required_date, budget_hours, opportunity, agreement, severity, impact, external_x_ref, po_number, knowledge_base_category_id, knowledge_base_sub_category_id, allow_all_clients_portal_view, customer_updated_flag, automatic_email_contact_flag, automatic_email_resource_flag, automatic_email_cc_flag, automatic_email_cc, initial_description, initial_internal_analysis, initial_resolution, contact_email_lookup, process_notifications, skip_callback, closed_date, closed_by, closed_flag, date_entered, entered_by, actual_hours, approved, sub_billing_method, sub_billing_amount, sub_date_accepted, date_resolved, date_resplan, date_responded, resolve_minutes, res_plan_minutes, respond_minutes, is_in_sla, knowledge_base_link_id, resources, parent_ticket_id, has_child_ticket, knowledge_base_link_type, bill_time, bill_expenses, bill_products, predecessor_type, predecessor_id, predecessor_closed_flag, lag_days, lag_nonworking_days_flag, estimated_start_date, duration, location_id, business_unit_id, mobile_guid, sla, _info, custom_fields].hash\n end", "def hash\n [lead_id, salutation, title, first_name, last_name, organization_name, phone_number, mobile_phone_number, fax_number, email_address, website_url, owner_user_id, date_created_utc, date_updated_utc, converted, converted_date_utc, converted_contact_id, converted_organization_id, converted_opportunity_id, visible_to, responsible_user_id, industry, lead_status_id, lead_source_id, visible_team_id, employee_count, lead_rating, lead_description, visible_user_ids, customfields, address_street, address_city, address_state, address_postcode, address_country, tags, image_url].hash\n end", "def data\n return @data if @data\n google_hash, data = to_hash, BookData.new\n\n data.creator = google_hash[:creator]\n data.date = google_hash[:date]\n data.description = google_hash[:description]\n data.format = google_hash[:format]\n data.id = google_hash[:id]\n data.identifier = google_hash[:identifier]\n data.language = google_hash[:language]\n data.publisher = google_hash[:publisher]\n\n if google_hash[:rating] && google_hash[:rating][:attributes]\n data.rating = google_hash[:rating][:attributes][:average].to_f\n data.rating_max = google_hash[:rating][:attributes][:max].to_f\n data.rating_min = google_hash[:rating][:attributes][:min].to_f\n end\n\n data.subject = google_hash[:subject].map { |s| s.split(/ [\\-\\/] /) }.flatten.map(&:strip).uniq.sort\n data.title = google_hash[:title].uniq.join(\" \")\n data.updated = google_hash[:updated]\n data.category = google_hash[:category]\n data.embeddability = google_hash[:embeddability][:value]\n data.open_access = google_hash[:openAccess][:value]\n data.viewability = google_hash[:viewability][:value]\n\n google_hash[:link].each do |link|\n href = link.is_a?(Hash) ? link[:attributes][:href] : link.last[:href]\n rel = link.is_a?(Hash) ? link[:attributes][:rel] : link.last[:rel]\n data.send(\"#{rel[/thumbnail|info|annotation|alternate|self/]}_url=\", href)\n end\n\n @data = data\n end", "def hash\n [__meta, created_at, updated_at, name, slug, model, status, type, short_description, full_description, free_shipping, sku, price, cost_price, retail_price, sale_price, manage_inventory, stock_level, minimum_stock_level, maximum_sell_count, item_dimensions, package_dimensions, package_weight, require_shipping, availability, availability_date, allow_pre_order, brand, main_photo, photos, files, promotions, related_products, stock_status, categories, tax_class, option_set, variants].hash\n end", "def hash\n [id, first_name, last_name, type, company, site, address_line1, address_line2, city, state, zip, country, relationship, department, inactive_flag, default_merge_contact_id, security_identifier, manager_contact_id, assistant_contact_id, title, school, nick_name, married_flag, children_flag, significant_other, portal_password, portal_security_level, disable_portal_login_flag, unsubscribe_flag, gender, birth_day, anniversary, presence, mobile_guid, facebook_url, twitter_url, linked_in_url, communication_items, _info, custom_fields].hash\n end", "def to_hash\n hash = {\n \"id\" => id,\n \"title\" => title,\n \"code\" => code,\n \"section\" => section,\n \"department_id\" => department_id,\n \"instructor\" => instructor,\n \"term\" => term }\n end", "def link_tracking_csv_hash\n {\n name: self.name,\n count: self.tracking_count\n }\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 [description, filter, is_enabled, name, product_list].hash\n end", "def hash\n [id, field_type, mode, label, no_wrap, bold, required, appears_by_default, find_enabled, allow_new_choices, sort_as_given, carry_choices, foreign_key, unique, does_data_copy, field_help, audited, num_lines, max_length, append_only, allow_html, has_extension, units, decimal_places, comma_start, number_format, does_average, does_total, blank_is_zero, currency_symbol, currency_format, display_time, display_relative, display_month, default_today, display_day_of_week, display_timezone, work_week, start_field, duration_field, format, hours24, display_user, default_kind, default_value_luid, choices_luid, choices, composite_fields, target_table_id, target_field_id, source_field_id, use_new_window, link_text, exact, display_images, default_domain, display_email, appears_as, abbreviate, auto_save, target_table_name, display_as_link, sort_alpha, version_mode, max_versions, see_versions, width, xml_tag, formula, default_value, comments, master_choice_table_id, master_choice_field_id, snap_field_id, parent_field_id, lookup_target_field_id, lookup_reference_field_id, summary_reference_field_id, summary_target_field_id, summary_function, master_table_tag, permissions].hash\n end", "def hash\n [ach_type, routing_number, account_number, account_type, check_number, check_type, product_code, manual_id_info, supplement_id_info, agent_id, terminal_id, registration_id, registration_date, release_type, vip_customer, session_id, terminal_state, terminal_city, ach_bill_to].hash\n end", "def hash\n [anchor_allow_white_space_in_characters, anchor_allow_white_space_in_characters_metadata, anchor_case_sensitive, anchor_case_sensitive_metadata, anchor_horizontal_alignment, anchor_horizontal_alignment_metadata, anchor_ignore_if_not_present, anchor_ignore_if_not_present_metadata, anchor_match_whole_word, anchor_match_whole_word_metadata, anchor_string, anchor_string_metadata, anchor_tab_processor_version, anchor_tab_processor_version_metadata, anchor_units, anchor_units_metadata, anchor_x_offset, anchor_x_offset_metadata, anchor_y_offset, anchor_y_offset_metadata, bold, bold_metadata, conditional_parent_label, conditional_parent_label_metadata, conditional_parent_value, conditional_parent_value_metadata, custom_tab_id, custom_tab_id_metadata, document_id, document_id_metadata, error_details, font, font_color, font_color_metadata, font_metadata, font_size, font_size_metadata, form_order, form_order_metadata, form_page_label, form_page_label_metadata, form_page_number, form_page_number_metadata, height, height_metadata, italic, italic_metadata, locale_policy, merge_field, merge_field_xml, name, name_metadata, page_number, page_number_metadata, recipient_id, recipient_id_guid, recipient_id_guid_metadata, recipient_id_metadata, smart_contract_information, status, status_metadata, tab_group_labels, tab_group_labels_metadata, tab_id, tab_id_metadata, tab_label, tab_label_metadata, tab_order, tab_order_metadata, tab_type, tab_type_metadata, template_locked, template_locked_metadata, template_required, template_required_metadata, tooltip, tool_tip_metadata, underline, underline_metadata, value, value_metadata, width, width_metadata, x_position, x_position_metadata, y_position, y_position_metadata].hash\n end", "def libation_params\n params.require(:libation).permit(:user_id, :libation_name, :libation_type, :weight, :weight_type, :container_type, :country_made, :company_name, :website, :date_drank, :store_purchased, :city_purchased, :prov_purchased, :country_purchased, :colour, :pulp, :can_art, :can_design, :sweet, :juice, :sip_guzz, :flavour, :buy_again, :carbonated, :image, :image_cache, :comments, :remote_image_url)\n end", "def hash\n [id, rfc, legal_name, commercial_name, credit_days, credit_amount, payment_method, creation_date, status, sales_contact, credit_contact, loctaion, comments, price_list, payment_term_type, email, telephones, number, account_number, default_discount, client_source, account, addresses].hash\n end", "def hash\n [action_button, available_create_phone_call, license_id, customer_id, ukd, license_type_code, product_program, product_id, product_name, service_activate_on, expires_on, sales_on, activate_on, partner_amount, sales_contact_id, sales_contact_name, sales_contact_phone, support_partner_id, support_partner_name, sales_partner_id, sales_partner_name, support_system_user, support_system_user_id, product_type, support_action_type_name, support_action_name, support_result, support_result_date, old_support_action_type_name, new_partner_subscribe_id, payment_status, payment_status_name, main_product_id, successfully, sales_contact_email, support_action_id, last_visit_date, name, pin, inn, kpp, customer_type, edition_type, support_manager_ss, support_manager_e, activated_contact_id, activated_contact_name, activated_contact_phone, activated_contact_email, activity_id_to_account, activity_id_to_contact, max_sales_license].hash\n end", "def to_hash\n {\n :bibid => @bibid,\n :holding_id => @holding_id,\n :location_name => @location_name,\n :location_note => @location_note,\n :call_number => @call_number,\n :shelving_title => @shelving_title,\n :summary_holdings => @summary_holdings,\n :supplements => @supplements,\n :indexes => @indexes,\n :public_notes => @public_notes,\n :reproduction_note => @reproduction_note,\n :urls => @urls,\n :donor_info => @donor_info,\n :item_count => @item_count,\n :temp_locations => @temp_locations,\n :item_status => @item_status,\n :services => @services,\n :current_issues => @current_issues,\n :orders => @orders\n }\n end", "def hash\n [accounting_code, activation_codes, arbitrary_unit_cost, auto_order_last_rebill_dts, auto_order_schedule, barcode, channel_partner_item_id, cogs, component_unit_value, cost, country_code_of_origin, customs_description, description, discount, discount_quantity, discount_shipping_weight, distribution_center_code, edi, exclude_coupon, free_shipping, hazmat, height, item_index, item_reference_oid, kit, kit_component, length, manufacturer_sku, max_days_time_in_transit, merchant_item_id, mix_and_match_group_name, mix_and_match_group_oid, no_shipping_discount, options, packed_by_user, parent_item_index, parent_merchant_item_id, perishable_class, pricing_tier_name, properties, quantity, quantity_refunded, quickbooks_class, refund_reason, return_reason, ship_separately, shipped_by_user, shipped_dts, shipping_status, special_product_type, tags, tax_free, tax_product_type, taxable_cost, total_cost_with_discount, total_refunded, transmitted_to_distribution_center_dts, unit_cost_with_discount, upsell, weight, width].hash\n end", "def hash\n [contact, extensions, external_resources, info, integrations, org, schema_version, tags].hash\n end", "def hash\n [author_handle, author_name, created_at, description, id, is_read_only, layout_type, modified_at, notify_list, reflow_type, restricted_roles, tags, template_variable_presets, template_variables, title, url, widgets].hash\n end", "def to_hash\n {\n \"cask\" => @referenced_cask_name,\n \"formula\" => @referenced_formula_name,\n \"regex\" => @regex,\n \"skip\" => @skip,\n \"skip_msg\" => @skip_msg,\n \"strategy\" => @strategy,\n \"url\" => @url,\n }\n end", "def hash\n [ auto_compress_pictures , auto_recover , build_version , calc_mode , calc_stack_size , calculation_id , check_comptiliblity , check_excel_restriction , crash_save , create_calc_chain , data_extract_load , date1904 , display_drawing_objects , enable_macros , first_visible_tab , hide_pivot_field_list , is_default_encrypted , is_hidden , is_h_scroll_bar_visible , is_minimized , is_v_scroll_bar_visible , iteration , language_code , max_change , max_iteration , memory_setting , number_decimal_separator , number_group_separator , parsing_formula_on_open , precision_as_displayed , recalculate_before_save , re_calculate_on_open , recommend_read_only , region , remove_personal_information , repair_load , shared , sheet_tab_bar_width , show_tabs , update_adjacent_cells_border , update_links_type , window_height , window_left , window_top , window_width ].hash\n end", "def hash\n [color_mode, save_format, file_name, dml_rendering_mode, dml_effects_rendering_mode, zip_output, update_last_saved_time_property, update_sdt_content, update_fields, allow_negative_indent, css_class_name_prefix, css_style_sheet_file_name, css_style_sheet_type, document_split_criteria, document_split_heading_level, encoding, export_document_properties, export_drop_down_form_field_as_text, export_font_resources, export_fonts_as_base64, export_headers_footers_mode, export_images_as_base64, export_language_information, export_list_labels, export_original_url_for_linked_images, export_page_margins, export_page_setup, export_relative_font_size, export_roundtrip_information, export_text_box_as_svg, export_text_input_form_field_as_text, export_toc_page_numbers, export_xhtml_transitional, font_resources_subsetting_size_threshold, fonts_folder, fonts_folder_alias, html_version, image_resolution, images_folder, images_folder_alias, metafile_format, office_math_output_mode, pretty_format, resource_folder, resource_folder_alias, scale_image_to_shape_size, table_width_output_mode, export_cid_urls_for_mhtml_resources].hash\n end", "def hash\n [additional_properties, currency_code, description, inventory, min_inventory_threshold, not_available, not_displayable, original_price, price, published, sale_id, sale_name, sku, start_date, stop_date].hash\n end", "def hash\n [type, id, updated_at, version, is_deleted, catalog_v1_ids, present_at_all_locations, present_at_location_ids, absent_at_location_ids, item_data, category_data, item_variation_data, tax_data, discount_data, modifier_list_data, modifier_data].hash\n end", "def hash\n [property_code, property_name, location, address, total_price, min_daily_rate, contacts, amenities, awards, images, rooms, more_rooms_at_this_hotel].hash\n end", "def hash\n [click_rate_formatted, created_dts, deleted, email_campaign_uuid, email_communication_sequence_uuid, end_once_customer_purchases, end_once_customer_purchases_anywhere, esp_campaign_folder_uuid, esp_domain_user, esp_domain_uuid, esp_friendly_name, library_item_oid, memberships, merchant_id, name, open_rate_formatted, prevent_sending_due_to_spam, revenue_formatted, revenue_per_customer_formatted, scheduled_dts, screenshot_large_full_url, sms_esp_twilio_uuid, sms_phone_number, status, status_dts, storefront_oid].hash\n end", "def hash\n [name, description, timezone, currency, case_sensitivity, attributes, limits, campaign_priority, exclusive_campaigns_strategy, default_discount_scope, enable_cascading_discounts, enable_flattened_cart_items, attributes_settings, sandbox, enable_partial_discounts, default_discount_additional_cost_per_item_scope].hash\n end", "def hashed_fields_for_export\n raise InvalidArgument unless self.form\n\n hash = {}\n\n self.form.questions.map { |q| hash[q.answer_field] = q.text }\n\n hash.merge({\n ip_address: \"IP Address\",\n user_agent: \"User Agent\",\n page: \"Page\",\n referer: \"Referrer\",\n created_at: \"Created At\"\n })\n end", "def to_hash\n # Deliberately ignoring user (will be set in duplicate)\n {\n library_interactive_id: library_interactive_id,\n name: name,\n url_fragment: url_fragment,\n authored_state: authored_state,\n is_hidden: is_hidden,\n is_half_width: is_half_width,\n show_in_featured_question_report: show_in_featured_question_report,\n inherit_aspect_ratio_method: inherit_aspect_ratio_method,\n custom_aspect_ratio_method: custom_aspect_ratio_method,\n inherit_native_width: inherit_native_width,\n custom_native_width: custom_native_width,\n inherit_native_height: inherit_native_height,\n custom_native_height: custom_native_height,\n inherit_click_to_play: inherit_click_to_play,\n custom_click_to_play: custom_click_to_play,\n inherit_full_window: inherit_full_window,\n custom_full_window: custom_full_window,\n inherit_click_to_play_prompt: inherit_click_to_play_prompt,\n custom_click_to_play_prompt: custom_click_to_play_prompt,\n inherit_image_url: inherit_image_url,\n custom_image_url: custom_image_url,\n linked_interactives: linked_interactives_list,\n linked_interactive_item_id: linked_interactive_item_id\n }\n end", "def guides\n @guides ||= Guides::GuidesRetriever.get_guides(action).input\n end", "def guideline_params\n params.require(:guideline).permit(:description, :text, :brand_id)\n end", "def hash\n [additional_line_item_data, allow_invoice_download, allowed_payment_method_configurations, currency, id, integrated_payment_form_enabled, language, login_name, name, payment_app_version, payment_installed, payment_proxy_path, planned_purge_date, replace_payment_method_image, shop_name, show_payment_information, show_subscription_information, space_id, space_view_id, state, subscription_app_version, subscription_installed, subscription_proxy_path, version].hash\n end", "def hash\n [id, name, prefix_suffix_option, default_flag, inactive_flag, pre_payment_flag, invoice_pre_suffix, location_id, business_unit_id, restrict_location_flag, restrict_department_flag, sla_id, application_units, application_limit, application_cycle, application_unlimited_flag, one_time_flag, cover_agreement_time_flag, cover_agreement_product_flag, cover_agreement_expense_flag, cover_sales_tax_flag, carry_over_unused_flag, allow_overruns_flag, expired_days, limit, expire_when_zero, charge_to_firm_flag, employee_comp_rate, employee_comp_not_exceed, comp_hourly_rate, comp_limit_amount, bill_cycle_id, bill_one_time_flag, bill_terms_id, invoicing_cycle, bill_amount, taxable_flag, restrict_down_payment_flag, invoice_description, top_comment_flag, bottom_comment_flag, work_role, work_type, project_type_id, invoice_template_setup_id, bill_time, bill_expenses, bill_products, billable_time_invoice_flag, billable_expense_invoice_flag, billable_product_invoice_flag, copy_work_roles_flag, copy_work_types_flag, _info].hash\n end", "def to_h\n {\n id: id,\n user_key: user_key,\n feedback: feedback,\n feedback_type: feedback_type,\n is_approved: is_approved,\n is_deleted: is_deleted\n }\n end", "def initialize(param)\n if param.is_a?(Hash)\n @fields = build_model(param)\n @fields.default = ''\n else\n @fields = Hash.new('')\n @fields['cff-version'] = DEFAULT_SPEC_VERSION\n @fields['message'] = DEFAULT_MESSAGE\n @fields['title'] = param\n end\n\n %w[authors contact keywords references].each do |field|\n @fields[field] = [] if @fields[field].empty?\n end\n end", "def hash\n [id, id_account, webid, application_date, date, value, gross_value, nature, original_wording, simplified_wording, stemmed_wording, wording, id_category, state, date_scraped, rdate, vdate, bdate, coming, active, id_cluster, comment, last_update, deleted, original_value, original_gross_value, original_currency, commission, commission_currency, country, counterparty, card].hash\n end", "def hash\n [sequence_number, corporate_number, process, correct, update_date, change_date, name, name_image_id, kind, prefecture_name, city_name, street_number, address_image_id, prefecture_code, city_code, post_code, address_outside, address_outside_image_id, close_date, close_cause, successor_corporate_number, change_cause, assignment_date, latest, en_name, en_prefecture_name, en_city_name, en_address_outside, furigana, hihyoji].hash\n end", "def link_tracking_all_csv_hash\n {\n name: self.name,\n count: self.tracking_total_count\n }\n end", "def hash\n [color, cards, address_placement, custom_envelope, double_sided, extra_service, mail_type, return_envelope, bleed, file_original_url].hash\n end", "def hash\n [actual_value, additional_contact_client_first_name, additional_contact_client_id, additional_contact_client_is_primary, additional_contact_client_last_name, address_business_city, address_business_country, address_business_is_primary, address_business_line1, address_business_state, address_business_zip_code, address_other_city, address_other_country, address_other_is_primary, address_other_line1, address_other_state, address_other_zip_code, bill_rate, bonus, commission, company_id, company_name, compensation, compensation_details, custom_field1, custom_field10, custom_field11, custom_field12, custom_field13, custom_field14, custom_field15, custom_field16, custom_field17, custom_field18, custom_field19, custom_field2, custom_field20, custom_field21, custom_field22, custom_field23, custom_field24, custom_field25, custom_field26, custom_field27, custom_field28, custom_field29, custom_field3, custom_field30, custom_field4, custom_field5, custom_field6, custom_field7, custom_field8, custom_field9, description, discount, estimated_close_date, external_primary_key, fee, fee_percent, hourly_rate, is_lead, is_on_hold, job_title_id, job_title_name, job_types, lead_source_id, lead_source_name, margin, name, number_of_openings, opportunity_type_id, opportunity_type_name, parent_job_id, parent_job_name, pay_rate, potential_value, priority_id, priority_name, probability, salary, start_date, tags, total_hours, website_description, website_description_is_primary, website_other, website_other_is_primary].hash\n end", "def to_h\n {\n 'abstracts' => abstracts,\n 'doctypes' => doctypes,\n 'names' => names,\n 'pub_info' => pub_info,\n 'publishers' => publishers,\n 'titles' => titles\n }\n end", "def hash\n [token, active, notes, ip_address, password, phone, metadata, account_holder_group_token, identifications, business_name_legal, business_name_dba, office_location, in_current_location_since, website, date_established, general_business_description, history, business_type, international_office_locations, taxpayer_id, duns_number, primary_contact, incorporation, proprietor_or_officer, beneficial_owner1, beneficial_owner2, beneficial_owner3, beneficial_owner4, attester_name, attestation_consent, attester_title, attestation_date, proprietor_is_beneficial_owner].hash\n end", "def hash\n [id, identifier, name, status, type, address_line1, address_line2, city, state, zip, country, phone_number, fax_number, website, territory_id, market_id, account_number, default_contact, date_acquired, sic_code, parent_company, annual_revenue, number_of_employees, ownership_type, time_zone, lead_source, lead_flag, unsubscribe_flag, calendar_id, user_defined_field1, user_defined_field2, user_defined_field3, user_defined_field4, user_defined_field5, user_defined_field6, user_defined_field7, user_defined_field8, user_defined_field9, user_defined_field10, deleted_flag, date_deleted, deleted_by, mobile_guid, currency, _info, custom_fields].hash\n end", "def hash\n [id, remit_name, location, address_one, address_two, city, state, zip, country, phone, invoice_title, payable_name, topcomment, invoice_footer, quote_footer, overall_invoice_default, standard_invoice_actual, standard_invoice_fixed, progress_invoice, agreement_invoice, credit_memo_invoice, down_payment_invoice, misc_invoice, sales_order_invoice, exclude_do_not_bill_time_flag, exclude_do_not_bill_expense_flag, exclude_do_not_bill_product_flag, prefix_suffix_flag, prefix_suffix_text, charge_adj_to_firm_flag, no_watermark_flag, display_tax_flag, allow_restricted_dept_on_routing_flag, bill_ticket_separately_flag, bill_ticket_complete_flag, bill_ticket_unapproved_flag, bill_project_complete_flag, bill_project_unapproved_flag, progress_time_flag, restrict_project_downpayment_flag, bill_sales_order_complete_flag, bill_product_after_ship_flag, restrict_downpayment_flag, copy_non_service_products_flag, copy_service_products_flag, copy_agreement_products_flag, print_logo_flag, read_receipt_flag, delivery_receipt_flag, disable_routing_email_flag, email_template, localized_country, business_number, currency, custom_label, custom_text, company_code, exclude_avalara_flag, _info].hash\n end", "def tool_attributes(overrides = {})\n {\n name: \"Pros and Cons\",\n description: \"Weighing up pros and cons can speed up the decision-making process,\n improve your understanding of the situation and help you avoid decision-making\n paralysis.\",\n price: 10.00\n }.merge(overrides)\nend", "def hash\n [type, source, reason, queue, state, customer, contact, description, email, email2, watchers, comments, last_comment, ticket_number, performer, solution_date, solution_user, rating, rating_author, rating_date, rating_source, rating_comment, partner, parent_ticket, dispute, time_decision, incident_type_direction_id, license_id, is_approved, main_product_id, jira_service_id, is_gr, fields, created_by, created_on, modified_by, modified_on, id, name, state_code, status_code].hash\n end", "def hash\n [id, name, type, company, contact, phone_number, email, status, opportunity, ticket, agreement, campaign, notes, date_start, date_end, assigned_by, assign_to, schedule_status, reminder, where, notify_flag, _info, custom_fields].hash\n end", "def hash\n [admin_flag, allow_expenses_entered_against_companies_flag, allow_in_cell_entry_on_time_sheet, billable_forecast, calendar, calendar_sync_integration_flag, country, daily_capacity, days_tolerance, default_department_id, default_email, default_location_id, default_phone, disable_online_flag, enable_ldap_authentication_flag, enable_mobile_flag, enable_mobile_gps_flag, enter_time_against_company_flag, expense_approver, first_name, hide_member_in_dispatch_portal_flag, hire_date, home_email, home_extension, home_phone, hourly_cost, hourly_rate, id, identifier, inactive_date, inactive_flag, include_in_utilization_reporting_flag, last_login, last_name, license_class, mapi_name, middle_initial, minimum_hours, mobile_email, mobile_extension, mobile_phone, notes, office_email, office_extension, office_phone, project_default_board, project_default_department_id, project_default_location_id, reports_to, require_expense_entry_flag, require_start_and_end_time_on_time_entry_flag, require_time_sheet_entry_flag, restrict_default_sales_territory_flag, restrict_default_warehouse_bin_flag, restrict_default_warehouse_flag, restrict_department_flag, restrict_location_flag, restrict_project_default_department_flag, restrict_project_default_location_flag, restrict_schedule_flag, restrict_service_default_department_flag, restrict_service_default_location_flag, sales_default_location_id, schedule_capacity, schedule_default_department_id, schedule_default_location_id, security_level, security_location_id, security_role, service_default_board, service_default_department_id, service_default_location_id, service_location, service_teams, time_approver, time_reminder_email_flag, time_sheet_start_date, time_zone, title, type, vendor_number, warehouse, warehouse_bin, work_role, work_type, _info, system_flag].hash\n end", "def hash\n [content, desired_job_title, drivers_license, educational_level, first_name, id, job_type, last_updated_utc, latest_job_title, latitude, locality, longitude, max_expected_salary, min_expected_salary, skills, source, source_name, state, token, willing_to_relocate, willing_to_travel, work_experience, zip].hash\n end", "def to_hash\n {\n \"name\" => name,\n \"description\" => description,\n \"percent_payout\" => percent_payout,\n \"offer_url\" => offer_url,\n \"preview_url\" => preview_url,\n \"advertiser_id\" => advertiser_id,\n \"protocol\" => protocol,\n \"status\" => status,\n \"expiration_date\" => expiration_date.strftime('%Y-%m-%d')\n }\n end", "def hash\n [promo_level, listing_type, id, project_id, advertiser, price_details, media, property_details, headline, summary_description, has_floorplan, has_video, labels, auction_schedule, inspection_schedule, sold_data, listing_slug].hash\n end", "def hash\n [active, additional_properties, author, authored, banned, category, comments, contributors, created_date, embed, extension, height, id, length, location, long_description, mime_type, name, priority, privacy, published, short_description, size, tags, template, thumbnail, updated_date, uploader, views, width].hash\n end", "def hash\n [account_esign_id, allow_cd_withdraw, allow_cd_withdraw_metadata, change_email, change_email_other, company_name, company_phone, copy_cost_per_page, copy_fee_collection_method, copy_request_email, custom, enable_esign, esign_agreement, esign_text, language_code, must_agree_to_esign, pdf_id, use_brand, use_consumer_disclosure_within_account, use_consumer_disclosure_within_account_metadata, withdraw_address_line1, withdraw_address_line2, withdraw_by_email, withdraw_by_mail, withdraw_by_phone, withdraw_city, withdraw_consequences, withdraw_email, withdraw_other, withdraw_phone, withdraw_postal_code, withdraw_state].hash\n end", "def build_attachment(key, feature)\n attachment = {}\n attachment[:color] = get_attachment_color(feature)\n attachment[:title] = feature[\"title\"]\n attachment[:title_link] = \"http://caniuse.com/#search=#{key}\"\n attachment[:text] = feature[\"description\"]\n attachment[:fallback] = \"#{feature[\"title\"]} (http://caniuse.com/#feat=#{key}): #{feature[\"description\"]}\"\n attachment[:mrkdwn_in] = [\"text\", \"title\", \"fields\", \"fallback\"]\n fields = []\n fields << build_browser_support_field(feature)\n fields << build_support_field(feature)\n fields << build_spec_field(feature)\n fields << build_resources_field(feature)\n attachment[:fields] = fields\n attachment\nend", "def hash\n [class_id, object_type, contract, contract_status, contract_status_reason, contract_updated_time, covered_product_line_end_date, device_id, device_type, end_customer, end_user_global_ultimate, is_valid, item_type, maintenance_purchase_order_number, maintenance_sales_order_number, platform_type, product, purchase_order_number, reseller_global_ultimate, sales_order_number, service_description, service_end_date, service_level, service_sku, service_start_date, state_contract, warranty_end_date, warranty_type, registered_device, source].hash\n end", "def hash\n [code, start_date, end_date, notification_timeframe, condition_reason, condition_reason_text, condition_to_apply, place_limit_to_apply, number_of_educators_per1_coordinator, educator_limit, regions, number_of_home_visit, number_or_percentage_home_visit_type, number_or_percentage_home_visit, frequency_of_visit, personnels, records_to_be_provided_set].hash\n end", "def attributes\r\n hash = super\r\n hash.delete('author')\r\n hash.delete('images')\r\n hash[\"document_type\"] = document_type\r\n hash[\"section_name\"] = section_name\r\n hash\r\n end", "def generate_info_hash\n @info_hash = Hash[\n *instance_variables.map { |var|\n [var[1..-1].to_sym, instance_variable_get(var)] if var != '@content_data' && var != '@header_data'\n }.compact.flatten\n ]\n end", "def hash\n [allow_insecure_certificates, basic_auth, body, body_type, cookies, device_ids, follow_redirects, headers, locations, metadata, public_id, _retry, start_url, variables].hash\n end", "def hash\n [allow_embedding_post_script_fonts, custom_time_zone_info_data, dml3_d_effects_rendering_mode, dml_effects_rendering_mode, dml_rendering_mode, file_name, iml_rendering_mode, update_created_time_property, update_fields, update_last_printed_property, update_last_saved_time_property, zip_output, allow_negative_indent, css_class_name_prefix, css_style_sheet_file_name, css_style_sheet_type, document_split_criteria, document_split_heading_level, encoding, export_document_properties, export_drop_down_form_field_as_text, export_font_resources, export_fonts_as_base64, export_headers_footers_mode, export_images_as_base64, export_language_information, export_list_labels, export_original_url_for_linked_images, export_page_margins, export_page_setup, export_relative_font_size, export_roundtrip_information, export_text_input_form_field_as_text, export_toc_page_numbers, export_xhtml_transitional, font_resources_subsetting_size_threshold, fonts_folder, fonts_folder_alias, html_version, image_resolution, images_folder, images_folder_alias, metafile_format, office_math_output_mode, pretty_format, resolve_font_names, resource_folder, resource_folder_alias, scale_image_to_shape_size, table_width_output_mode, save_format].hash\n end", "def hash\n [id, opportunity_status_rec_i_ds, add_all_opportunity_statuses, remove_all_opportunity_statuses, opportunity_type_rec_i_ds, add_all_opportunity_types, remove_all_opportunity_types, restrict_view_by_opportunity_status_flag, restrict_view_by_opportunity_type_flag, acceptance_change_status_flag, acceptance_create_activity_flag, acceptance_opportunity_status, acceptance_send_email_flag, acceptance_email_from_first_name, acceptance_email_from_last_name, acceptance_email_subject, acceptance_email_body, acceptance_from_email, acceptance_email_activity_type, acceptance_email_assigned_by_member, rejection_change_status_flag, rejection_create_activity_flag, rejection_opportunity_status, rejection_send_email_flag, rejection_email_from_first_name, rejection_email_from_last_name, rejection_from_email, rejection_email_subject, rejection_email_body, rejection_email_activity_type, rejection_email_assigned_by_member, confirmation_send_email_flag, confirmation_email_use_default_company_email_address_flag, confirmation_email_from_first_name, confirmation_email_from_last_name, confirmation_from_email, confirmation_email_subject, confirmation_email_body, _info].hash\n end", "def guide_params\n params[:guide].permit(:subtype,\n :call_to_action_type,\n :call_to_action_label,\n :call_to_action_content,\n :call_to_action_reason,\n :contact_name,\n :contact_email,\n :contact_phone,\n :featured_image,\n :featured_image_alt,\n :featured_image_caption,\n :object_title,\n :object_embed_code,\n sections_attributes: [:id,\n :title,\n :body_content,\n :_destroy],\n content_item_attributes: [:id,\n :as_a,\n :i_need,\n :so_that,\n :title,\n :summary,\n :status,\n :organisation_id,\n associated_org_ids: [],\n label_ids: []]\n )\n end", "def hash\n [project_profile_type, property_types, id, name, start_date, end_date, address, viewing_address, displayable_address, enquiry_email_address, advertiser_identifiers, provider_details, media, project_url, headline, tagline, display_as_last_updated, modified_by, modified_date, created_by, created_date, background_colour, description, appointment_required, features, price_from, price_to, banner_url, big_banner_url, small_banner_url, logo_url, pdfs, inspection_details, number_of_floors, number_of_apartments, estimated_completion_date, starting_price, is_active].hash\n end", "def generate_info_hash\n @info_hash = Hash[\n *instance_variables.map { |var|\n [var[1..-1], instance_variable_get(var)] if var != '@content_data' && var != '@header_data'\n }.compact.flatten\n ]\n end", "def hash\n [id, name, based_on, custom_calendar, default_flag, application_order, hi_impact_hi_urgency, hi_impact_med_urgency, hi_impact_low_urgency, med_impact_hi_urgency, med_impact_med_urgency, med_impact_low_urgency, low_impact_hi_urgency, low_impact_med_urgency, low_impact_low_urgency, respond_hours, respond_percent, plan_within, plan_within_percent, resolution_hours, resolution_percent, _info].hash\n end", "def hash\n [id, name, default_flag, visible_logo_flag, company_info_flag, billing_terms_flag, summary_flag, discussion_flag, task_flag, task, configurations_flag, internal_notes_flag, resolution_flag, time_flag, time_member_flag, time_date_flag, time_start_end_flag, time_bill_flag, time_hours_flag, time_rate_flag, time_extended_amount_flag, time_work_type_flag, time_agreement_flag, time_notes_flag, time_manual_flag, time_manual_entry, time_tax_flag, expense_flag, expense_date_flag, expense_member_flag, expense_type_flag, expense_bill_flag, expense_amount_flag, expense_agreement_flag, expense_notes_flag, expense_tax_flag, expense_manual_flag, expense_manual_entry, product_flag, product_description_flag, product_bill_flag, product_quantity_flag, product_price_flag, product_extended_amount_flag, product_agreement_flag, product_manual_flag, product_manual_entry, product_tax_flag, technician_signoff_flag, customer_signoff_text_flag, customer_signoff_text, customer_signoff_fields_flag, billing_methods_text_flag, billing_methods_text, credit_card_fields_flag, default_ff_flag, _info].hash\n end", "def create_hash(doc, check_usable_entries = true)\n c32_patient = {}\n id_map = build_id_map(doc)\n @section_importers.each_pair do |section, importer|\n importer.check_for_usable = check_usable_entries\n c32_patient[section] = importer.create_entries(doc,id_map)\n end\n c32_patient\n end", "def create_hash(doc, check_usable_entries = false)\n ccr_patient = {}\n @section_importers.each_pair do |section, importer|\n importer.check_for_usable = check_usable_entries\n ccr_patient[section] = importer.create_entries(doc)\n end\n ccr_patient\n end", "def to_liquid_hash\n # Wrap fields in quotes where appropriate for Liquid\n @to_hash = Hash[ATTRS_FROM_RAW.map {|k| [k.to_s, format_with_quotes(k, self.send(k))]}]\n # Process subject_specialties hash into a hash with string keys\n @to_hash[\"subject_specialties\"] = Hash[@to_hash[\"subject_specialties\"].map {|k, v| [k.to_s, v.map {|s| format_with_quotes(k, s)}]}]\n @to_hash\n end", "def rowify fields=nil\n fields ||= [\n :project_number,\n :organization,\n :fiscal_year,\n :title,\n :scope,\n :project_type,\n :sogr,\n :shadow,\n :multi_year,\n :emergency,\n :ali,\n :requested,\n :allocated\n ]\n \n field_library = {\n project_number: {label: \"Project ID\", method: :project_number, url: nil},\n organization: {label: \"Organization\", method: :organization_name, url: nil},\n fiscal_year: {label: \"Year\", method: :fy_year, url: nil},\n title: {label: \"Title\", method: :title, url: nil},\n scope: {label: \"Scope\", method: :team_ali_code_scope, url: nil},\n project_type: {label: \"Project Type\", method: :capital_project_type_name, url: nil},\n sogr: {label: \"SOGR\", method: :sogr, url: nil},\n shadow: {label: \"Shadow\", method: :notional, url: nil},\n multi_year: {label: \"Multi-Year\", method: :multi_year, url: nil},\n emergency: {label: \"Emergency Project\", method: :emergency, url: nil},\n ali: {label: \"ALI\", method: :ali_code, url: nil},\n requested: {label: \"Requested\", method: :total_cost, url: nil},\n allocated: {label: \"Allocated\", method: :total_funds, url: nil}\n\n }\n\n row = {}\n fields.each do |field|\n row[field] = {label: field_library[field][:label], data: self.send(field_library[field][:method]).to_s, url: field_library[field][:url]} \n end\n return row \n end", "def hash\n [activity_id, blueprint_id, blueprint_location_id, blueprint_type_id, completed_character_id, completed_date, cost, duration, end_date, facility_id, installer_id, job_id, licensed_runs, output_location_id, pause_date, probability, product_type_id, runs, start_date, station_id, status, successful_runs].hash\n end", "def hash\n [deleted, edited_by_user, email_communication_sequence_email_uuid, email_communication_sequence_uuid, email_container_cjson, email_container_cjson_last_modified_dts, email_template_vm_path, filter_profile_equation_json, individually_render, library_item_oid, magic_link, merchant_id, pending_review, preview_text, rejected, requires_review, screenshot_large_full_url, screenshot_large_viewport_url, screenshot_small_full_url, screenshot_small_viewport_url, smart_sending, storefront_oid, subject, suspended_for_spam, transactional_email, version].hash\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 to_h\n h = {}\n @ledger.each do |name, libs|\n h[name] = (\n case libs\n when Array\n libs.map{ |lib| lib.to_h }\n else\n libs.to_h\n end\n )\n end\n h\n end", "def to_hash\n hash = super\n LicenseLicenseInfo.attribute_map.each_pair do |attr, param|\n value = self.send(attr)\n if value.nil?\n is_nullable = LicenseLicenseInfo.openapi_nullable.include?(attr)\n next if !is_nullable || (is_nullable && !instance_variable_defined?(:\"@#{attr}\"))\n end\n\n hash[param] = _to_hash(value)\n end\n hash\n end", "def hash\n [pulp_href, pulp_created, artifact, id, updated_date, description, issued_date, fromstr, status, title, summary, version, type, severity, solution, release, rights, pushcount, pkglist, references, reboot_suggested].hash\n end", "def serialize\n h= {\n id: solution.id,\n title: solution.title,\n team_name: solution.team_name,\n representative_email: solution.representative_email,\n representative_first_name: solution.representative_first_name, \n representative_last_name: solution.representative_last_name,\n representative_phone_num: solution.representative_phone_num,\n description: solution.description,\n explanation: solution.explanation,\n youtube_link: \"https://www.youtube.com/watch?v=#{solution.youtube_link}\",\n github_link: solution.github_link,\n web_link: solution.web_url,\n android_market_link: solution.android_mkt_url,\n ios_market_link: solution.ios_mkt_url,\n firebase_shared: solution.firebase_shared?,\n firebase_url: solution.firebase_url,\n market_probe: solution.file_file_name,\n ods: solution.sd_goal_id,\n ods_name: solution&.sd_goal.name,\n decidim_user_id: solution.decidim_user_id,\n decidim_user_email: solution&.user&.email,\n decidim_user_name: solution&.user&.name,\n created_at: solution.created_at,\n updated_at: solution.updated_at,\n }\n h[:categories]= solution.decidim_proposals_proposals.map do |p|\n \"<#{translated_attribute(p.category.try(:name))}>\"\n end.uniq\n h[:necessitats]= solution.decidim_proposals_proposals.map do |p|\n \"<#{Decidim::Proposals::ProposalPresenter.new(p).title}>\"\n end\n h\n end", "def guides\n @guides ||= Guides::GuidesRetriever.get_guides(action)\n end", "def hash\n [id, user_id, input_audio_id, output_audio_id, output_video_id, reference_audio_id, mode, status, failure_reason, target_loudness_mode, target_loudness, output_format, preset, bit_depth, sample_rate, review_comment, review_score, mastering_matching_level, progression, bass_preservation, mastering, mastering_algorithm, preserved, retry_count, mastering_reverb, mastering_reverb_gain, low_cut_freq, high_cut_freq, ceiling, ceiling_mode, oversample, limiting_error, video_title, video_status, expire_at, created_at, updated_at].hash\n end", "def to_hash\n { \n :seller_id => 6,\n :submitter_id => 6,\n :description => ''\n }.merge(super)\n end", "def rdfa_description_hash(about,options={})\n options[:typeof] ||= self.class.resource_model_uri\n options[:about] = about\n\n options\n end" ]
[ "0.58540606", "0.569996", "0.569961", "0.5690804", "0.5656755", "0.55939984", "0.5590626", "0.55799085", "0.55768716", "0.5380645", "0.53769743", "0.5376363", "0.53473294", "0.52938974", "0.52769786", "0.5270105", "0.52567416", "0.52555573", "0.5247419", "0.524464", "0.5188309", "0.5181168", "0.5174318", "0.5141375", "0.51260483", "0.50967866", "0.50862336", "0.5084573", "0.50633335", "0.50441146", "0.5025069", "0.501264", "0.50108063", "0.50000274", "0.49925023", "0.49892324", "0.49764624", "0.49705878", "0.4965724", "0.495909", "0.49566704", "0.49499744", "0.49466294", "0.49340248", "0.4933112", "0.49324366", "0.49317092", "0.49250823", "0.4922579", "0.49149543", "0.49137607", "0.49090517", "0.49026567", "0.4899939", "0.48937532", "0.48833495", "0.48694468", "0.48573887", "0.48501796", "0.48437428", "0.48435837", "0.48412323", "0.48410586", "0.48380435", "0.48378658", "0.48367423", "0.48309392", "0.48270768", "0.48268285", "0.48244396", "0.48148185", "0.48143196", "0.48020935", "0.48016053", "0.4791655", "0.47905493", "0.47893852", "0.47874376", "0.47748604", "0.47730565", "0.47719878", "0.47706097", "0.47675246", "0.47652724", "0.47574958", "0.47520143", "0.47459015", "0.47378656", "0.47349265", "0.47335517", "0.47286037", "0.47275457", "0.47220752", "0.47211385", "0.47191963", "0.471767", "0.47102436", "0.470698", "0.4704576", "0.47023094" ]
0.6994874
0
Creates a hash to use in the link_tracking CSV. name tracking_count
def link_tracking_csv_hash { name: self.name, count: self.tracking_count } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def link_tracking_all_csv_hash\n {\n name: self.name,\n count: self.tracking_total_count\n }\n end", "def tracking_total_count\n link_tracking.count\n end", "def hash\n [event_count, hour, index_id, index_name, org_name, public_id, retention].hash\n end", "def hash_with_meta\n to_hash.merge(leased: VLANLease.where(pool_id: id).count)\n end", "def duplicate_imports_info\n import_frequency_mapping = {}\n all_imports.uniq.each do |item|\n item_occurrence = all_imports.count(item)\n if item_occurrence > 1\n import_frequency_mapping[item.chomp] = item_occurrence\n end\n end\n import_frequency_mapping\n end", "def csv_hash\n {\n vendor: self.vendor_name,\n name: self.name,\n url: self.url,\n enable_proxy: self.access == 2 ? 1 : 0,\n description: self.description,\n more_info: '',\n enable_new: self.new_database.to_i,\n enable_trial: self.trial_database.to_i,\n types: self.resources.pluck(:name).join(';'),\n keywords: '',\n target: 0,\n slug: '',\n best_bets: self.curated.pluck(:name).join(';'),\n subjects: self.subjects.pluck(:name).join(';'),\n desc_pos: 1,\n lib_note: 0,\n enable_popular: self.popular.to_i,\n enable_hidden: 0,\n internal_note: '',\n owner: '',\n resource_icons: '',\n thumbnail: '',\n content_id: self.libguides_id\n }\n end", "def create_hash\n require 'digest/md5'\n digest_string = [self.id, self.url, self.referrer, self.created_at].join(\"\")\n self.record_hash = Digest::MD5.hexdigest(digest_string)\n end", "def load_tracking(tracking)\n @data.each{ |hash|\n id = hash[:id]\n track = tracking[id]\n next unless track\n hash[:track] ||= 0\n hash[:track] += track\n @total_track += track\n }\n end", "def set_hash(xml,s) #:nodoc:\r\n h = Hash.new\r\n xml.elements.each(s){|v| h[v.elements['name'].text] = v.elements['count'].text.to_i} \r\n h\r\n end", "def get_tracking_nums()\n\n begin\n @tracking_nums = {}\n db = SQLDb.new(DB_FILE)\n db.open\n db.query(\"SELECT TrackingNum, SalesContract.ID, Name, SSNUM from SalesContract, Patient WHERE ShippingSvc = 1 AND NOT TrackingNum IS NULL AND ((ShippingSts <> 2 AND ShippingSts <> 9) OR ShippingSts IS NULL) AND SalesContract.LocatorID = Patient.ID\")\n\n rows = db.data\n \n rows.each do |row|\n \n if row[3].to_s.rstrip.length == 9 #Check for the length of the SSN\n @tracking_nums[row[0].strip().gsub(' ','').upcase]= row[1]\n process_tracking_nums(row[0], row[3], row[2])\n\n else\n log_error(\"Incorrect SSN for \" + row[2].to_s)\n end\n end\n db.close\n \n save_results()\n \n\n rescue Exception =>ex\n puts ex.to_s\n log_error(ex.to_s)\n end\n\n end", "def count_hash(arr)\n count = {}\n arr.each {|e|\n count[e] ||= 0\n count[e] += 1\n }\n count\n end", "def order_tracking_number\n hash[\"OrderTrackingNumber\"]\n end", "def hash\n [agent_host_count, alibaba_host_count, apm_azure_app_service_host_count, apm_host_count, aws_host_count, azure_host_count, container_count, gcp_host_count, heroku_host_count, host_count, hour, infra_azure_app_service, opentelemetry_apm_host_count, opentelemetry_host_count, org_name, public_id, vsphere_host_count].hash\n end", "def new_tabulator_count(jurisdiction_definition, election_definition, file)\n jdinfo = jurisdiction_definition[\"jurisdiction_definition\"]\n edinfo = election_definition[\"election_definition\"]\n self.tabulator_count = \n {\"tabulator_count\"=>\n {\"election_ident\"=>edinfo[\"election\"][\"ident\"],\n \"jurisdiction_ident\"=>jdinfo[\"ident\"],\n \"audit_header\"=>\n {\"software\"=>\"TTV Tabulator\",\n \"file_ident\"=>file,\n \"operator\"=>\"Jeffrey Valjean Cook\",\n \"create_date\"=>Time.new.strftime(\"%Y-%m-%d %H:%M:%S\")},\n \"jurisdiction_definition\"=>jdinfo,\n \"election_definition\"=>edinfo,\n \"contest_count_list\"=>self.counts_contests.keys.collect { |k|\n self.counts_contests[k] },\n \"question_count_list\"=>self.counts_questions.keys.collect { |k|\n self.counts_questions[k] },\n \"counter_count_list\"=>[],\n \"state\"=>\"INITIAL\"}}\n end", "def store_externcount(count) #:nodoc:\n record = 0x0016 # Record identifier\n length = 0x0002 # Number of bytes to follow\n\n cxals = count # Number of external references\n\n header = [record, length].pack('vv')\n data = [cxals].pack('v')\n\n prepend(header, data)\n end", "def count_index(to_count)\n\tmy_hash = Hash.new{|hash, key| hash[key] = []}\n\tcount = 0\n\tto_count.split('').each do |letter|\n\t\tcount += 1\n\t\tmy_hash[letter].push(count)\n\tend\n\tmy_hash\t\nend", "def hash\n [date, campaign_revenue, total_campaign_revenue, campaign_refund, total_campaign_refund, campaign_discount_costs, total_campaign_discount_costs, campaign_refunded_discounts, total_campaign_refunded_discounts, campaign_free_items, total_campaign_free_items, coupon_redemptions, total_coupon_redemptions, coupon_rolledback_redemptions, total_coupon_rolledback_redemptions, referral_redemptions, total_referral_redemptions, coupons_created, total_coupons_created, referrals_created, total_referrals_created, added_loyalty_points, total_added_loyalty_points, deducted_loyalty_points, total_deducted_loyalty_points].hash\n end", "def hashNQS()\n @hash_nqs={}\n nqsReader=File.open(@nqsFile,\"r\")\n nqsReader.each do |line|\n cols=line.split(/\\s+/)\n \n name=cols[0]\n next if name==\"readName\"\n length=cols[1]\n dist=cols[2]\n qual=cols[3].to_i\n pass=cols[4]\n \n str_result=length+'.'+pass\n str=name+'.'+dist\n if @hash_nqs[str]==nil\n @hash_nqs[str]=str_result\n end\n end\n nqsReader.close\n $stderr.puts @hash_nqs.size\nend", "def hash\n [concatenated_path_down_count, administratively_down_count, no_diagnostic_count, path_down_count, reverse_concatenated_path_down_count, neighbor_signaled_session_down_count, control_detection_time_expired_count, echo_function_failed_count, forwarding_plane_reset_count].hash\n end", "def to_h\n {\n :image_redirect_count => redirect_count,\n :image_not_found_count => not_found_count,\n :image_forbidden_count => forbidden_count,\n :image_server_error_count => server_error_count,\n }\n end", "def hash\n [avatar, banner, created_at, description, handle, hidden_modules, link_count, modified_at, name, summary, user_count, visible_modules].hash\n end", "def fumbles_hash(stats_xml)\n {\n number: stats_xml[:number].to_i,\n lost: stats_xml[:lost].to_i\n }\n end", "def initialize\n @domain_counts = Hash.new\n end", "def occurences_count\n\t\t\t\t\t\tHash.new(0).tap do |result|\n\t\t\t\t\t\t each { |item| result[item] += 1 }\n\t\t\t\t\t\tend\n\t\t\t\tend", "def new_counter\n { current_load: 0, last_request_made_at: 0 }\n end", "def hash\n [channel_order_no, lines, created_at, updated_at, extra_data, track_trace_no, track_trace_url, return_track_trace_no, method, shipped_from_country_code, shipment_date].hash\n end", "def create_row_headers_index_hash\n collect_row_headers\n @row_hash = Hash[(0...@row_headers.size).zip(@row_headers)] # ==> {0=>0, 1=>734638, 2=>734639, 3=>734640, 4=>734641, 5=>734642, 6=>734643, 7=>734644, 8=>734645, 9=>734646}\nend", "def hash\n [label_id, status, shipment_id, shipment, ship_date, created_at, shipment_cost, insurance_cost, tracking_number, is_return_label, rma_number, is_international, batch_id, carrier_id, charge_event, outbound_label_id, service_code, test_label, package_code, validate_address, voided, voided_at, label_download_type, label_format, label_layout, trackable, label_image_id, carrier_code, tracking_status, label_download, form_download, insurance_claim, packages].hash\n end", "def counts\n @counts ||=\n begin\n h = {}\n by_label.each do |label, notes|\n h[label] = notes.size\n end\n h\n end\n end", "def counter_key\n @counter_key ||= [*name.downcase.split(\"::\"), :idcnt].join(\":\")\n end", "def popular_links\n result = {}\n urls[0...5].each do |url|\n result[url] = url.num_clicks\n end\n result\n end", "def hash\n [active_customers, actual_customers, bounce_count, bounce_percentage, bounce_percentage_formatted, customer_histogram, daily_stats, delivered_count, loyalty_program_type, max_active_customers, max_emails_per_day, max_emails_per_hour, max_emails_per_month, paused_for_spam, revenue, sent_emails_per_day, sent_emails_per_hour, sent_emails_per_month, sequence_send_count, spam_count, spam_percentage, spam_percentage_formatted, transactional_send_count].hash\n end", "def counts\n count = Hash.new(0)\n self.each{|ele| count[ele] += 1}\n count\n end", "def serializable_hash \n results.each.inject(empty_bins) do |histogram, result|\n histogram[result] = histogram[result] ? histogram[result] + 1 : 1; histogram\n end\n end", "def count_freq\n hash = Hash.new(0)\n self.each do |element|\n hash[element] +=1\n end\n return hash\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 hash\n [device, duration, error_count, step_count_completed, step_count_total].hash\n end", "def hash\n [id, next_send, rrule, session, last_sent, contact_name, parameters, type, summary, text_parameters, first_occurrence, last_occurrence, recipients_count, timezone, completed, avatar, created_at].hash\n end", "def hash\n [id, created, modified, company_name, domain_name, state, billing_email, plan_name, plan_expires, application_limit, user_limit, campaign_limit, api_limit, application_count, user_count, campaigns_active_count, campaigns_inactive_count, attributes].hash\n end", "def count=(v) self['Count'] = v end", "def to_hash( )\n\t\t\t@categories.inject(Hash.new) do |hash, (name, count_or_calc)|\n\t\t\t\thash[name] = count_or_calc if count_or_calc.is_a?(Numeric)\n\t\t\t\thash\n\t\t\tend\n\t\tend", "def build_tracking_id\n self.tracking_id ||= SecureRandom.base64(6)\n end", "def driver_ride_count(rides)\n ride_count = Hash.new{|hash, key| hash[key] = 0}\n\n rides.each do |ride|\n ride_count[ride[:driver_id]] += 1\n end\n\n return ride_count\nend", "def urlhist(path)\n\t\tu = Hash.new(0)\n\t\tcnt = 0\n\t\tf=File.open(path)\n\t\tf.readlines.each do |line|\n\t\t\tpart = line.split(' ')\n\t\t\turl = part[6]\n\t\t\tu[url] = u[url] + 1\n\t\t\tcnt +=1\t\n\t\tend\n\t\tu.sort.each do |k, v|\n\t\t\tprint \"The frequency of #{k} | \"\n\t\t\twhile v > 0\n\t\t\t\tprint \"#\"\n\t\t\t\tv-=1\n\t\t\tend\n\t\tputs \"\\n\"\n\t\tend\n\t\t\n\tend", "def hash\n [sequence_number, corporate_number, process, correct, update_date, change_date, name, name_image_id, kind, prefecture_name, city_name, street_number, address_image_id, prefecture_code, city_code, post_code, address_outside, address_outside_image_id, close_date, close_cause, successor_corporate_number, change_cause, assignment_date, latest, en_name, en_prefecture_name, en_city_name, en_address_outside, furigana, hihyoji].hash\n end", "def create_list(items)\r\n list_array = items.split(\" \")\r\n list_hash = {}\r\n list_array.each do |i| \r\n if list_hash[i]\r\n list_hash[i] += 1\r\n else\r\n list_hash[i] = 1\r\n end\r\n end\r\n p list_hash\r\n list_hash\r\nend", "def prod_to_hash(csv_name)\n\tprod_array = CSV.read(csv_name)\n\tprod_array.each_with_index do |line, index|\n\t\tnext if line[0] == \"Opportunity ID\" \n\t\tbreak if line[0] == nil\n\t\t@current_opp_list[line[0]] = Opportunity.new(line[@prods_opp], line[@prods_prod], line[@prods_access], line[@prods_status], \"unknown\")\n\t\t\n\tend\n\t\nend", "def create_list(grocery_items)\n grocery_list = Hash.new(0)\n grocery_items.split.each { |item| grocery_list[item] += 1 }\n grocery_list\nend", "def photos_count(info_count)\n x = info_count.inject(Hash.new(0)) { |h, e| h[e] += 1 ; h }\nend", "def hash\n [new_businessunitid, campaign_id, description, objective, new_url_script, new_url_menu, new_url_pricelist, new_min_interval, new_logic_number_1, new_logic_number_2, new_logic_number_3, new_logic_number_4, new_next_data, new_next_newcustomer, new_next_timezones, new_types_campaing, new_next_oldcustomer, new_redial_max, new_system_auto_avaya, new_apc_job, new_personal_phonecall, new_nedozvon_max, new_count_phonecall_log, new_maxday_callback, new_customertimefrom, new_customertimeto, new_interactive_script, new_isdemo_access, call_count, sub_type, sub_type_name, name, summary_call_count, my_call_count].hash\n end", "def hash\n [aborted_device_count, billable, config, create_time, device_count, display_name, errors_device_count, excluded_device_count, executed_test_case_count, execution_ratio, failed_test_case_count, finished_device_count, framework_id, framework_name, id, logs_file_id, message, number, project_id, project_name, row_index, running_device_count, screenshots_file_id, self_uri, start_time, started_by_display_name, started_by_id, state, succeeded_device_count, success_ratio, successful_test_case_count, tags, test_case_count, timeouted_device_count, total_device_count, ui_link, user_id, waiting_device_count, warning_device_count].hash\n end", "def create_track(talks)\n self.number_of_tracks(talks)\n tracks_num = Array.new(@number_of_tracks) { |x| x+1 } # e.g. [1, 2]\n tracks_num.each do |track_num|\n @tracks_hash['Track ' + track_num.to_s] = Track.new\n end\n end", "def hash\n [account_id, campaign_id, csp_id, reseller_id, status, create_date, auto_renewal, billed_date, brand_id, usecase, sub_usecases, description, embedded_link, embedded_phone, affiliate_marketing, number_pool, age_gated, direct_lending, subscriber_optin, subscriber_optout, subscriber_help, sample1, sample2, sample3, sample4, sample5, message_flow, help_message, reference_id, mock, next_renewal_or_expiration_date].hash\n end", "def create_list(items)\n hash = Hash.new(0)\n items.split(\" \").each do |item|\n hash[item] += 1\n end\n p hash\nend", "def create_route_hash( route, current, status, parsed, parse_pass_count, source_step_name, source_step_type, target_step_name, target_step_type )\n \n # We create a hash of route attributes.\n route_hash = {\n :current => current,\n :status => status,\n :parsed => parsed,\n :parse_pass_count => parse_pass_count,\n :source_step_name => source_step_name,\n :source_step_type => source_step_type,\n :target_step_name => target_step_name,\n :target_step_type => target_step_type\n }\n \n # We add the hash to the routes hash, keyed off the route.\n @routes[route] = route_hash\n end", "def hash\n [id, sender, receiver, text, status, contact_id, session_id, message_time, avatar, deleted, charset, charset_label, first_name, last_name, country, phone, price, parts_count, from_email, from_number].hash\n end", "def list_creator(inputed_list)\r\n\r\n grocery_hash = {}\r\n grocery_list = inputed_list.split\r\n\r\n grocery_list.each do |item| \r\n grocery_hash[item] = $grocery_hash[item].to_i + 1\r\n end\r\n\r\n p grocery_hash\r\n return $grocery_hash\r\nend", "def hash\n [article_number, name, quantity, unit_price, discount_percent, vat_percent, unit, temporary_reference, row_number, merchant_data].hash\n end", "def create_letter_to_number_hash\n letters = (\"a\"..\"z\")\n letter_number = Hash.new\n count = 0\n letters.each do |letter|\n letter_number[letter] = count\n count += 1\n end\n\n letter_number\nend", "def to_hash\n hsh = {\n id: id,\n status: status.to_sym,\n connect: running? ? connect.to_h : nil,\n time: info.wallclock_time.to_i / 60 # only update every minute\n }\n Digest::SHA1.hexdigest(hsh.to_json)\n end", "def initialize(counts: {}, total: counts.values.sum, size: 14, rounded: true)\n @counts = {}\n @total = total\n @size = size\n @rounded = rounded\n\n counts.each do |key, count|\n letter =\n case key\n when *config.letters then key\n when *config.aliases.keys then config.aliases.fetch(key)\n end\n @counts[letter] ||= 0\n @counts[letter] += count\n end\n end", "def generate_library_call_count_feature\n library_call_count_feature = Array.new(@indexes.length, 0)\n @indexes.each_with_index do |index, i|\n hash = JSON.parse(IO.read(@feature_dir + \"/library_calls/#{index.to_s}.json\"))\n library_call_count_feature[i] = hash.length\n end\n write_column_feature_to_file library_call_count_feature, \"library_call_count_feature.np\"\n end", "def running_count_key(tracking_key)\n parts = tracking_key.split(\".\")\n \"concurrent.count.#{parts[2..-1].join('.')}\"\n end", "def hash\n [name, value, timestamp, source_id, source_label, source, selected_by_user, selected_by_user_timestamp, source_vid, source_metadata, request_id, updated_by_user_id, persistence_timestamp, use_timestamp_as_persistence_timestamp].hash\n end", "def unique_visit\n parsed_result.each do |result|\n visit_hash[result.first] = result.last.uniq.count\n end\n visit_hash.sort_by{|k,v| v}.reverse.to_h\n end", "def hcount\n @hcount += 1\n end", "def hcount\n @hcount += 1\n end", "def count(r)\n c = Hash.new(0)\n r.each { |z| c[z] += 1}\n c\nend", "def count_elements (array_of_hashes)\n#array_of_hashes = [ {:name=>'blake'}, {:name=>'blake'}, {:name=>'ashley'} ]\ncount_hash=Hash.new(0)\narray_of_hashes.each {|hash|\n count_hash[hash]+=1\n }\n #puts new_hash\n #output: {{:name=>\"blake\"}=>2, {:name=>\"ashley\"}=>1}\n merge_count_hash= count_hash.keys.map { |key| \n \tkey[:count]=count_hash[key] \n \tkey\n }\nend", "def hash\n [activity_id, blueprint_id, blueprint_location_id, blueprint_type_id, completed_character_id, completed_date, cost, duration, end_date, facility_id, installer_id, job_id, licensed_runs, output_location_id, pause_date, probability, product_type_id, runs, start_date, station_id, status, successful_runs].hash\n end", "def usage_info\n { :session_messages => current_account.session_message_count.to_i,\n :marketing_messages => current_account.marketing_message_count.to_i,\n :prepaid_messages => current_account.subscription.prepaid_message_count.to_i }\n end", "def hash\n [ach_type, routing_number, account_number, account_type, check_number, check_type, product_code, manual_id_info, supplement_id_info, agent_id, terminal_id, registration_id, registration_date, release_type, vip_customer, session_id, terminal_state, terminal_city, ach_bill_to].hash\n end", "def hash\n [name, url].hash\n end", "def total_visit\n parsed_result.each do |result|\n visit_hash[result.first] = result.last.count\n end\n visit_hash.sort_by{|k,v| v}.reverse.to_h\n end", "def function_a\n#code\n\th = Hash.new\n\tFile.open('names.txt').each do |line|\n\t\ta = line.split\n\t\tif h[a[1].to_s] == nil\n\t\t\th[a[1].to_s] = a[0].chomp(',')\n\t\telsif h[a[1].to_s] != nil\n\t\t\tstr = h[a[1].to_s]\n\t\t\tstr = h[a[1].to_s] + \", \" + a[0].chomp(',')\n\t\t\th[a[1].to_s] = str\n\t\t\tnum = h[a[1].to_s].scan(/,/).count + 1\n\t\t\tputs a[1] + \" (\" + num.to_s + \"): [\" + h[a[1].to_s] + \"]\"\n\t\tend\n\tend\nend", "def get_item_frequency_counts orders\n\n counts = {}\n\n orders.each do |order|\n items = order['line_items']\n items.each do |item|\n id = item['product_id']\n if counts[id]\n counts[id] += 1\n else\n counts[id] = 1\n end\n end\n end\n\n counts\n\nend", "def hash\n [check_id, exceptions, key, links, port, proof, protocol, since, status].hash\n end", "def hash\n [label_layout, label_format, batch_id, external_batch_id, batch_notes, created_at, processed_at, errors, warnings, completed, forms, count, batch_shipments_url, batch_labels_url, batch_errors_url, label_download, form_download, status].hash\n end", "def hash\n [id, account_id, mode, failures_url, original_filename, state, total_mailpieces, failed_mailpieces, validated_mailpieces, bytes_processed, date_created, date_modified, required_address_column_mapping, optional_address_column_mapping, metadata, merge_variable_column_mapping].hash\n end", "def create_column_headers_index_hash\n collect_column_headers\n @column_hash = Hash[(0...@column_headers.size).zip(@column_headers)] # ==> {0=>102231711, 1=>103244134, 2=>103285344, 3=>103293593}\nend", "def seed_bag_count_hash(boolean)\n # boolean == 0 means unplanted seed bags\n # boolean == 1 means harvested crops\n seed_bag_array = self.crop_types.where(\"planted = ?\", 0).where(\"harvested = ?\", boolean)\n name_array = seed_bag_array.pluck(\"crop_name\")\n name_array.each_with_object(Hash.new(0)) do |crop_name, inv_hash|\n inv_hash[crop_name] += 1\n end\n # => {\"turnip\"=>2, \"radish\"=>5} for unplanted seed bags or harvested crops\n end", "def push_counts\n details = {\n total: Order.count,\n shipped: Order.where(shipped: true).count\n }\n Pusher['flamingmoe'].trigger('count', details)\n logger.debug(\"pushed count details to pusher.com: #{details.inspect}\")\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 init_tp_name_table(term_points)\n @count_of_tp = {}\n term_points.each do |term_point|\n @count_of_tp[term_point.ip] = -1 # use ip as counter key\n end\n end", "def count\n { value: @count, color: \"gray\" }\n end", "def hash_length\n super\n end", "def unique_share_count\n\t\tself.share_record.each_with_object([]) { |share,unique_shares_array|\n\t\t\tif unique_shares_array.select {|unique_share| share[:shared] == unique_share[:shared] }.count == 0\n\t\t\t\tunique_shares_array << share\n\t\t\tend\n\t\t}.count\n\tend", "def hash\n [ref, from, to, chg, line, loc, min, sale, plsp, incl, pror, proadj, tran, serv, dbt, adj, adjm, disc, opt, prop, bill, cust, lfln, date, qty, glref].hash\n end", "def count_difficulties\n hash = {}\n i = 0\n while i < 20\n hash[i] = 0\n i += 1\n end\n Drink.all.each do |drink|\n hash[drink.ingredient_cards.count] += 1\n end\n puts hash\nend", "def to_hash() end", "def hash\n [activity_id, activity_type_code, subject, actual_start, actual_end, state_code, status_code, scheduled_start, scheduled_end, owner_id, description, regarding_object_id, regarding_object_id_name, regarding_object_logical_name, owner_full_name, contact_id, contact_full_name, call_reason_status_name, decline_reason_status_name, call_result_status_name, party_id, activity_party_id, party_id_name, party_object_type_code, is_phone_call, next_call_date, campaign_name, cust_name, product_name, owner_avatar].hash\n end", "def build_hash hash, date, worked_hours, departur_hour\n hash[\"#{date.strftime(\"%F\")}\"] = {total: worked_hours, arrival_hour: date, departur_hour: departur_hour}\n hash[:total_worked] += worked_hours\n hash[:total_days] += 1\n return hash\n end", "def hash\n [host_list, total_matching, total_returned].hash\n end", "def populate_sources_stats\n # Iterate over each of a user's links, adding to the count of the corresponding source\n @user.links.all.each { |link| @sources_stats[link.source.name] += 1 }\n end", "def follower_ids_hash\n follower_ids_hash = Hash.new()\n store = PStore.new(FOLLOWER_IDS_PATH + self.twitter_id.to_s)\n store.transaction{follower_ids_hash = store[self.twitter_id]}\n if follower_ids_hash == nil\n follower_ids_hash = Hash.new(0)\n end\n return follower_ids_hash\n end", "def hash\n [rel, href].hash\n end", "def make_hash_with_count(passage)\n array_from_excerpt = strip_text(passage)#input from first question\n names_and_counts = Hash.new 0 #initializes at 0\n array_from_excerpt.each do |word|\n names_and_counts[word] += 1#for all subs. occurences, add 1\n end\n names_and_counts # must have the last line return the array!\nend", "def hash\n 0\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 nucleotide_counts\n hash = {}\n @valid_inputs.each do |i|\n hash[i] = @dna.count i\n end\n hash\n end" ]
[ "0.7942738", "0.655014", "0.5951549", "0.59169096", "0.56994236", "0.56967753", "0.56949496", "0.56888336", "0.5644522", "0.5614125", "0.55630755", "0.55587757", "0.555015", "0.5527527", "0.55229855", "0.55197436", "0.5477085", "0.54755986", "0.5457154", "0.5448609", "0.54378444", "0.5437476", "0.5395162", "0.53905696", "0.5387681", "0.5381002", "0.5380715", "0.5379507", "0.53776884", "0.53561896", "0.534976", "0.5344209", "0.5342462", "0.53419906", "0.53300804", "0.532349", "0.53108406", "0.53046554", "0.5300721", "0.5266221", "0.5261173", "0.52596015", "0.52563417", "0.52556753", "0.5252885", "0.52525324", "0.5252429", "0.52517617", "0.52480793", "0.52410346", "0.52276355", "0.5224985", "0.5222941", "0.52075756", "0.52002853", "0.51983315", "0.5195019", "0.5192884", "0.5172511", "0.516866", "0.5149742", "0.51441026", "0.5139084", "0.5135715", "0.5134393", "0.5129786", "0.5129786", "0.5128366", "0.51199895", "0.5103432", "0.5102966", "0.5083229", "0.50778943", "0.5074517", "0.50730366", "0.5069104", "0.5060592", "0.50568414", "0.5056298", "0.5051345", "0.5049514", "0.50451005", "0.50439847", "0.50423664", "0.5040372", "0.5037776", "0.50349486", "0.50270176", "0.5026921", "0.5024848", "0.5023024", "0.50219154", "0.50209594", "0.5016748", "0.5016237", "0.50137687", "0.5010157", "0.5009816", "0.50089544", "0.50083876" ]
0.82694614
0
Creates a hash to use in the link_tracking CSV. name tracking_count
def link_tracking_all_csv_hash { name: self.name, count: self.tracking_total_count } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def link_tracking_csv_hash\n {\n name: self.name,\n count: self.tracking_count\n }\n end", "def tracking_total_count\n link_tracking.count\n end", "def hash\n [event_count, hour, index_id, index_name, org_name, public_id, retention].hash\n end", "def hash_with_meta\n to_hash.merge(leased: VLANLease.where(pool_id: id).count)\n end", "def duplicate_imports_info\n import_frequency_mapping = {}\n all_imports.uniq.each do |item|\n item_occurrence = all_imports.count(item)\n if item_occurrence > 1\n import_frequency_mapping[item.chomp] = item_occurrence\n end\n end\n import_frequency_mapping\n end", "def csv_hash\n {\n vendor: self.vendor_name,\n name: self.name,\n url: self.url,\n enable_proxy: self.access == 2 ? 1 : 0,\n description: self.description,\n more_info: '',\n enable_new: self.new_database.to_i,\n enable_trial: self.trial_database.to_i,\n types: self.resources.pluck(:name).join(';'),\n keywords: '',\n target: 0,\n slug: '',\n best_bets: self.curated.pluck(:name).join(';'),\n subjects: self.subjects.pluck(:name).join(';'),\n desc_pos: 1,\n lib_note: 0,\n enable_popular: self.popular.to_i,\n enable_hidden: 0,\n internal_note: '',\n owner: '',\n resource_icons: '',\n thumbnail: '',\n content_id: self.libguides_id\n }\n end", "def create_hash\n require 'digest/md5'\n digest_string = [self.id, self.url, self.referrer, self.created_at].join(\"\")\n self.record_hash = Digest::MD5.hexdigest(digest_string)\n end", "def load_tracking(tracking)\n @data.each{ |hash|\n id = hash[:id]\n track = tracking[id]\n next unless track\n hash[:track] ||= 0\n hash[:track] += track\n @total_track += track\n }\n end", "def set_hash(xml,s) #:nodoc:\r\n h = Hash.new\r\n xml.elements.each(s){|v| h[v.elements['name'].text] = v.elements['count'].text.to_i} \r\n h\r\n end", "def get_tracking_nums()\n\n begin\n @tracking_nums = {}\n db = SQLDb.new(DB_FILE)\n db.open\n db.query(\"SELECT TrackingNum, SalesContract.ID, Name, SSNUM from SalesContract, Patient WHERE ShippingSvc = 1 AND NOT TrackingNum IS NULL AND ((ShippingSts <> 2 AND ShippingSts <> 9) OR ShippingSts IS NULL) AND SalesContract.LocatorID = Patient.ID\")\n\n rows = db.data\n \n rows.each do |row|\n \n if row[3].to_s.rstrip.length == 9 #Check for the length of the SSN\n @tracking_nums[row[0].strip().gsub(' ','').upcase]= row[1]\n process_tracking_nums(row[0], row[3], row[2])\n\n else\n log_error(\"Incorrect SSN for \" + row[2].to_s)\n end\n end\n db.close\n \n save_results()\n \n\n rescue Exception =>ex\n puts ex.to_s\n log_error(ex.to_s)\n end\n\n end", "def count_hash(arr)\n count = {}\n arr.each {|e|\n count[e] ||= 0\n count[e] += 1\n }\n count\n end", "def order_tracking_number\n hash[\"OrderTrackingNumber\"]\n end", "def hash\n [agent_host_count, alibaba_host_count, apm_azure_app_service_host_count, apm_host_count, aws_host_count, azure_host_count, container_count, gcp_host_count, heroku_host_count, host_count, hour, infra_azure_app_service, opentelemetry_apm_host_count, opentelemetry_host_count, org_name, public_id, vsphere_host_count].hash\n end", "def new_tabulator_count(jurisdiction_definition, election_definition, file)\n jdinfo = jurisdiction_definition[\"jurisdiction_definition\"]\n edinfo = election_definition[\"election_definition\"]\n self.tabulator_count = \n {\"tabulator_count\"=>\n {\"election_ident\"=>edinfo[\"election\"][\"ident\"],\n \"jurisdiction_ident\"=>jdinfo[\"ident\"],\n \"audit_header\"=>\n {\"software\"=>\"TTV Tabulator\",\n \"file_ident\"=>file,\n \"operator\"=>\"Jeffrey Valjean Cook\",\n \"create_date\"=>Time.new.strftime(\"%Y-%m-%d %H:%M:%S\")},\n \"jurisdiction_definition\"=>jdinfo,\n \"election_definition\"=>edinfo,\n \"contest_count_list\"=>self.counts_contests.keys.collect { |k|\n self.counts_contests[k] },\n \"question_count_list\"=>self.counts_questions.keys.collect { |k|\n self.counts_questions[k] },\n \"counter_count_list\"=>[],\n \"state\"=>\"INITIAL\"}}\n end", "def store_externcount(count) #:nodoc:\n record = 0x0016 # Record identifier\n length = 0x0002 # Number of bytes to follow\n\n cxals = count # Number of external references\n\n header = [record, length].pack('vv')\n data = [cxals].pack('v')\n\n prepend(header, data)\n end", "def count_index(to_count)\n\tmy_hash = Hash.new{|hash, key| hash[key] = []}\n\tcount = 0\n\tto_count.split('').each do |letter|\n\t\tcount += 1\n\t\tmy_hash[letter].push(count)\n\tend\n\tmy_hash\t\nend", "def hash\n [date, campaign_revenue, total_campaign_revenue, campaign_refund, total_campaign_refund, campaign_discount_costs, total_campaign_discount_costs, campaign_refunded_discounts, total_campaign_refunded_discounts, campaign_free_items, total_campaign_free_items, coupon_redemptions, total_coupon_redemptions, coupon_rolledback_redemptions, total_coupon_rolledback_redemptions, referral_redemptions, total_referral_redemptions, coupons_created, total_coupons_created, referrals_created, total_referrals_created, added_loyalty_points, total_added_loyalty_points, deducted_loyalty_points, total_deducted_loyalty_points].hash\n end", "def hashNQS()\n @hash_nqs={}\n nqsReader=File.open(@nqsFile,\"r\")\n nqsReader.each do |line|\n cols=line.split(/\\s+/)\n \n name=cols[0]\n next if name==\"readName\"\n length=cols[1]\n dist=cols[2]\n qual=cols[3].to_i\n pass=cols[4]\n \n str_result=length+'.'+pass\n str=name+'.'+dist\n if @hash_nqs[str]==nil\n @hash_nqs[str]=str_result\n end\n end\n nqsReader.close\n $stderr.puts @hash_nqs.size\nend", "def hash\n [concatenated_path_down_count, administratively_down_count, no_diagnostic_count, path_down_count, reverse_concatenated_path_down_count, neighbor_signaled_session_down_count, control_detection_time_expired_count, echo_function_failed_count, forwarding_plane_reset_count].hash\n end", "def to_h\n {\n :image_redirect_count => redirect_count,\n :image_not_found_count => not_found_count,\n :image_forbidden_count => forbidden_count,\n :image_server_error_count => server_error_count,\n }\n end", "def hash\n [avatar, banner, created_at, description, handle, hidden_modules, link_count, modified_at, name, summary, user_count, visible_modules].hash\n end", "def fumbles_hash(stats_xml)\n {\n number: stats_xml[:number].to_i,\n lost: stats_xml[:lost].to_i\n }\n end", "def initialize\n @domain_counts = Hash.new\n end", "def occurences_count\n\t\t\t\t\t\tHash.new(0).tap do |result|\n\t\t\t\t\t\t each { |item| result[item] += 1 }\n\t\t\t\t\t\tend\n\t\t\t\tend", "def new_counter\n { current_load: 0, last_request_made_at: 0 }\n end", "def hash\n [channel_order_no, lines, created_at, updated_at, extra_data, track_trace_no, track_trace_url, return_track_trace_no, method, shipped_from_country_code, shipment_date].hash\n end", "def create_row_headers_index_hash\n collect_row_headers\n @row_hash = Hash[(0...@row_headers.size).zip(@row_headers)] # ==> {0=>0, 1=>734638, 2=>734639, 3=>734640, 4=>734641, 5=>734642, 6=>734643, 7=>734644, 8=>734645, 9=>734646}\nend", "def hash\n [label_id, status, shipment_id, shipment, ship_date, created_at, shipment_cost, insurance_cost, tracking_number, is_return_label, rma_number, is_international, batch_id, carrier_id, charge_event, outbound_label_id, service_code, test_label, package_code, validate_address, voided, voided_at, label_download_type, label_format, label_layout, trackable, label_image_id, carrier_code, tracking_status, label_download, form_download, insurance_claim, packages].hash\n end", "def counts\n @counts ||=\n begin\n h = {}\n by_label.each do |label, notes|\n h[label] = notes.size\n end\n h\n end\n end", "def counter_key\n @counter_key ||= [*name.downcase.split(\"::\"), :idcnt].join(\":\")\n end", "def popular_links\n result = {}\n urls[0...5].each do |url|\n result[url] = url.num_clicks\n end\n result\n end", "def hash\n [active_customers, actual_customers, bounce_count, bounce_percentage, bounce_percentage_formatted, customer_histogram, daily_stats, delivered_count, loyalty_program_type, max_active_customers, max_emails_per_day, max_emails_per_hour, max_emails_per_month, paused_for_spam, revenue, sent_emails_per_day, sent_emails_per_hour, sent_emails_per_month, sequence_send_count, spam_count, spam_percentage, spam_percentage_formatted, transactional_send_count].hash\n end", "def counts\n count = Hash.new(0)\n self.each{|ele| count[ele] += 1}\n count\n end", "def serializable_hash \n results.each.inject(empty_bins) do |histogram, result|\n histogram[result] = histogram[result] ? histogram[result] + 1 : 1; histogram\n end\n end", "def count_freq\n hash = Hash.new(0)\n self.each do |element|\n hash[element] +=1\n end\n return hash\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 hash\n [device, duration, error_count, step_count_completed, step_count_total].hash\n end", "def hash\n [id, next_send, rrule, session, last_sent, contact_name, parameters, type, summary, text_parameters, first_occurrence, last_occurrence, recipients_count, timezone, completed, avatar, created_at].hash\n end", "def hash\n [id, created, modified, company_name, domain_name, state, billing_email, plan_name, plan_expires, application_limit, user_limit, campaign_limit, api_limit, application_count, user_count, campaigns_active_count, campaigns_inactive_count, attributes].hash\n end", "def count=(v) self['Count'] = v end", "def to_hash( )\n\t\t\t@categories.inject(Hash.new) do |hash, (name, count_or_calc)|\n\t\t\t\thash[name] = count_or_calc if count_or_calc.is_a?(Numeric)\n\t\t\t\thash\n\t\t\tend\n\t\tend", "def build_tracking_id\n self.tracking_id ||= SecureRandom.base64(6)\n end", "def driver_ride_count(rides)\n ride_count = Hash.new{|hash, key| hash[key] = 0}\n\n rides.each do |ride|\n ride_count[ride[:driver_id]] += 1\n end\n\n return ride_count\nend", "def urlhist(path)\n\t\tu = Hash.new(0)\n\t\tcnt = 0\n\t\tf=File.open(path)\n\t\tf.readlines.each do |line|\n\t\t\tpart = line.split(' ')\n\t\t\turl = part[6]\n\t\t\tu[url] = u[url] + 1\n\t\t\tcnt +=1\t\n\t\tend\n\t\tu.sort.each do |k, v|\n\t\t\tprint \"The frequency of #{k} | \"\n\t\t\twhile v > 0\n\t\t\t\tprint \"#\"\n\t\t\t\tv-=1\n\t\t\tend\n\t\tputs \"\\n\"\n\t\tend\n\t\t\n\tend", "def hash\n [sequence_number, corporate_number, process, correct, update_date, change_date, name, name_image_id, kind, prefecture_name, city_name, street_number, address_image_id, prefecture_code, city_code, post_code, address_outside, address_outside_image_id, close_date, close_cause, successor_corporate_number, change_cause, assignment_date, latest, en_name, en_prefecture_name, en_city_name, en_address_outside, furigana, hihyoji].hash\n end", "def create_list(items)\r\n list_array = items.split(\" \")\r\n list_hash = {}\r\n list_array.each do |i| \r\n if list_hash[i]\r\n list_hash[i] += 1\r\n else\r\n list_hash[i] = 1\r\n end\r\n end\r\n p list_hash\r\n list_hash\r\nend", "def prod_to_hash(csv_name)\n\tprod_array = CSV.read(csv_name)\n\tprod_array.each_with_index do |line, index|\n\t\tnext if line[0] == \"Opportunity ID\" \n\t\tbreak if line[0] == nil\n\t\t@current_opp_list[line[0]] = Opportunity.new(line[@prods_opp], line[@prods_prod], line[@prods_access], line[@prods_status], \"unknown\")\n\t\t\n\tend\n\t\nend", "def create_list(grocery_items)\n grocery_list = Hash.new(0)\n grocery_items.split.each { |item| grocery_list[item] += 1 }\n grocery_list\nend", "def photos_count(info_count)\n x = info_count.inject(Hash.new(0)) { |h, e| h[e] += 1 ; h }\nend", "def hash\n [new_businessunitid, campaign_id, description, objective, new_url_script, new_url_menu, new_url_pricelist, new_min_interval, new_logic_number_1, new_logic_number_2, new_logic_number_3, new_logic_number_4, new_next_data, new_next_newcustomer, new_next_timezones, new_types_campaing, new_next_oldcustomer, new_redial_max, new_system_auto_avaya, new_apc_job, new_personal_phonecall, new_nedozvon_max, new_count_phonecall_log, new_maxday_callback, new_customertimefrom, new_customertimeto, new_interactive_script, new_isdemo_access, call_count, sub_type, sub_type_name, name, summary_call_count, my_call_count].hash\n end", "def hash\n [aborted_device_count, billable, config, create_time, device_count, display_name, errors_device_count, excluded_device_count, executed_test_case_count, execution_ratio, failed_test_case_count, finished_device_count, framework_id, framework_name, id, logs_file_id, message, number, project_id, project_name, row_index, running_device_count, screenshots_file_id, self_uri, start_time, started_by_display_name, started_by_id, state, succeeded_device_count, success_ratio, successful_test_case_count, tags, test_case_count, timeouted_device_count, total_device_count, ui_link, user_id, waiting_device_count, warning_device_count].hash\n end", "def create_track(talks)\n self.number_of_tracks(talks)\n tracks_num = Array.new(@number_of_tracks) { |x| x+1 } # e.g. [1, 2]\n tracks_num.each do |track_num|\n @tracks_hash['Track ' + track_num.to_s] = Track.new\n end\n end", "def hash\n [account_id, campaign_id, csp_id, reseller_id, status, create_date, auto_renewal, billed_date, brand_id, usecase, sub_usecases, description, embedded_link, embedded_phone, affiliate_marketing, number_pool, age_gated, direct_lending, subscriber_optin, subscriber_optout, subscriber_help, sample1, sample2, sample3, sample4, sample5, message_flow, help_message, reference_id, mock, next_renewal_or_expiration_date].hash\n end", "def create_list(items)\n hash = Hash.new(0)\n items.split(\" \").each do |item|\n hash[item] += 1\n end\n p hash\nend", "def create_route_hash( route, current, status, parsed, parse_pass_count, source_step_name, source_step_type, target_step_name, target_step_type )\n \n # We create a hash of route attributes.\n route_hash = {\n :current => current,\n :status => status,\n :parsed => parsed,\n :parse_pass_count => parse_pass_count,\n :source_step_name => source_step_name,\n :source_step_type => source_step_type,\n :target_step_name => target_step_name,\n :target_step_type => target_step_type\n }\n \n # We add the hash to the routes hash, keyed off the route.\n @routes[route] = route_hash\n end", "def hash\n [id, sender, receiver, text, status, contact_id, session_id, message_time, avatar, deleted, charset, charset_label, first_name, last_name, country, phone, price, parts_count, from_email, from_number].hash\n end", "def list_creator(inputed_list)\r\n\r\n grocery_hash = {}\r\n grocery_list = inputed_list.split\r\n\r\n grocery_list.each do |item| \r\n grocery_hash[item] = $grocery_hash[item].to_i + 1\r\n end\r\n\r\n p grocery_hash\r\n return $grocery_hash\r\nend", "def hash\n [article_number, name, quantity, unit_price, discount_percent, vat_percent, unit, temporary_reference, row_number, merchant_data].hash\n end", "def create_letter_to_number_hash\n letters = (\"a\"..\"z\")\n letter_number = Hash.new\n count = 0\n letters.each do |letter|\n letter_number[letter] = count\n count += 1\n end\n\n letter_number\nend", "def to_hash\n hsh = {\n id: id,\n status: status.to_sym,\n connect: running? ? connect.to_h : nil,\n time: info.wallclock_time.to_i / 60 # only update every minute\n }\n Digest::SHA1.hexdigest(hsh.to_json)\n end", "def initialize(counts: {}, total: counts.values.sum, size: 14, rounded: true)\n @counts = {}\n @total = total\n @size = size\n @rounded = rounded\n\n counts.each do |key, count|\n letter =\n case key\n when *config.letters then key\n when *config.aliases.keys then config.aliases.fetch(key)\n end\n @counts[letter] ||= 0\n @counts[letter] += count\n end\n end", "def generate_library_call_count_feature\n library_call_count_feature = Array.new(@indexes.length, 0)\n @indexes.each_with_index do |index, i|\n hash = JSON.parse(IO.read(@feature_dir + \"/library_calls/#{index.to_s}.json\"))\n library_call_count_feature[i] = hash.length\n end\n write_column_feature_to_file library_call_count_feature, \"library_call_count_feature.np\"\n end", "def running_count_key(tracking_key)\n parts = tracking_key.split(\".\")\n \"concurrent.count.#{parts[2..-1].join('.')}\"\n end", "def hash\n [name, value, timestamp, source_id, source_label, source, selected_by_user, selected_by_user_timestamp, source_vid, source_metadata, request_id, updated_by_user_id, persistence_timestamp, use_timestamp_as_persistence_timestamp].hash\n end", "def unique_visit\n parsed_result.each do |result|\n visit_hash[result.first] = result.last.uniq.count\n end\n visit_hash.sort_by{|k,v| v}.reverse.to_h\n end", "def hcount\n @hcount += 1\n end", "def hcount\n @hcount += 1\n end", "def count(r)\n c = Hash.new(0)\n r.each { |z| c[z] += 1}\n c\nend", "def count_elements (array_of_hashes)\n#array_of_hashes = [ {:name=>'blake'}, {:name=>'blake'}, {:name=>'ashley'} ]\ncount_hash=Hash.new(0)\narray_of_hashes.each {|hash|\n count_hash[hash]+=1\n }\n #puts new_hash\n #output: {{:name=>\"blake\"}=>2, {:name=>\"ashley\"}=>1}\n merge_count_hash= count_hash.keys.map { |key| \n \tkey[:count]=count_hash[key] \n \tkey\n }\nend", "def hash\n [activity_id, blueprint_id, blueprint_location_id, blueprint_type_id, completed_character_id, completed_date, cost, duration, end_date, facility_id, installer_id, job_id, licensed_runs, output_location_id, pause_date, probability, product_type_id, runs, start_date, station_id, status, successful_runs].hash\n end", "def usage_info\n { :session_messages => current_account.session_message_count.to_i,\n :marketing_messages => current_account.marketing_message_count.to_i,\n :prepaid_messages => current_account.subscription.prepaid_message_count.to_i }\n end", "def hash\n [ach_type, routing_number, account_number, account_type, check_number, check_type, product_code, manual_id_info, supplement_id_info, agent_id, terminal_id, registration_id, registration_date, release_type, vip_customer, session_id, terminal_state, terminal_city, ach_bill_to].hash\n end", "def hash\n [name, url].hash\n end", "def total_visit\n parsed_result.each do |result|\n visit_hash[result.first] = result.last.count\n end\n visit_hash.sort_by{|k,v| v}.reverse.to_h\n end", "def function_a\n#code\n\th = Hash.new\n\tFile.open('names.txt').each do |line|\n\t\ta = line.split\n\t\tif h[a[1].to_s] == nil\n\t\t\th[a[1].to_s] = a[0].chomp(',')\n\t\telsif h[a[1].to_s] != nil\n\t\t\tstr = h[a[1].to_s]\n\t\t\tstr = h[a[1].to_s] + \", \" + a[0].chomp(',')\n\t\t\th[a[1].to_s] = str\n\t\t\tnum = h[a[1].to_s].scan(/,/).count + 1\n\t\t\tputs a[1] + \" (\" + num.to_s + \"): [\" + h[a[1].to_s] + \"]\"\n\t\tend\n\tend\nend", "def get_item_frequency_counts orders\n\n counts = {}\n\n orders.each do |order|\n items = order['line_items']\n items.each do |item|\n id = item['product_id']\n if counts[id]\n counts[id] += 1\n else\n counts[id] = 1\n end\n end\n end\n\n counts\n\nend", "def hash\n [check_id, exceptions, key, links, port, proof, protocol, since, status].hash\n end", "def hash\n [label_layout, label_format, batch_id, external_batch_id, batch_notes, created_at, processed_at, errors, warnings, completed, forms, count, batch_shipments_url, batch_labels_url, batch_errors_url, label_download, form_download, status].hash\n end", "def hash\n [id, account_id, mode, failures_url, original_filename, state, total_mailpieces, failed_mailpieces, validated_mailpieces, bytes_processed, date_created, date_modified, required_address_column_mapping, optional_address_column_mapping, metadata, merge_variable_column_mapping].hash\n end", "def create_column_headers_index_hash\n collect_column_headers\n @column_hash = Hash[(0...@column_headers.size).zip(@column_headers)] # ==> {0=>102231711, 1=>103244134, 2=>103285344, 3=>103293593}\nend", "def seed_bag_count_hash(boolean)\n # boolean == 0 means unplanted seed bags\n # boolean == 1 means harvested crops\n seed_bag_array = self.crop_types.where(\"planted = ?\", 0).where(\"harvested = ?\", boolean)\n name_array = seed_bag_array.pluck(\"crop_name\")\n name_array.each_with_object(Hash.new(0)) do |crop_name, inv_hash|\n inv_hash[crop_name] += 1\n end\n # => {\"turnip\"=>2, \"radish\"=>5} for unplanted seed bags or harvested crops\n end", "def push_counts\n details = {\n total: Order.count,\n shipped: Order.where(shipped: true).count\n }\n Pusher['flamingmoe'].trigger('count', details)\n logger.debug(\"pushed count details to pusher.com: #{details.inspect}\")\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 init_tp_name_table(term_points)\n @count_of_tp = {}\n term_points.each do |term_point|\n @count_of_tp[term_point.ip] = -1 # use ip as counter key\n end\n end", "def count\n { value: @count, color: \"gray\" }\n end", "def hash_length\n super\n end", "def unique_share_count\n\t\tself.share_record.each_with_object([]) { |share,unique_shares_array|\n\t\t\tif unique_shares_array.select {|unique_share| share[:shared] == unique_share[:shared] }.count == 0\n\t\t\t\tunique_shares_array << share\n\t\t\tend\n\t\t}.count\n\tend", "def hash\n [ref, from, to, chg, line, loc, min, sale, plsp, incl, pror, proadj, tran, serv, dbt, adj, adjm, disc, opt, prop, bill, cust, lfln, date, qty, glref].hash\n end", "def count_difficulties\n hash = {}\n i = 0\n while i < 20\n hash[i] = 0\n i += 1\n end\n Drink.all.each do |drink|\n hash[drink.ingredient_cards.count] += 1\n end\n puts hash\nend", "def to_hash() end", "def hash\n [activity_id, activity_type_code, subject, actual_start, actual_end, state_code, status_code, scheduled_start, scheduled_end, owner_id, description, regarding_object_id, regarding_object_id_name, regarding_object_logical_name, owner_full_name, contact_id, contact_full_name, call_reason_status_name, decline_reason_status_name, call_result_status_name, party_id, activity_party_id, party_id_name, party_object_type_code, is_phone_call, next_call_date, campaign_name, cust_name, product_name, owner_avatar].hash\n end", "def build_hash hash, date, worked_hours, departur_hour\n hash[\"#{date.strftime(\"%F\")}\"] = {total: worked_hours, arrival_hour: date, departur_hour: departur_hour}\n hash[:total_worked] += worked_hours\n hash[:total_days] += 1\n return hash\n end", "def hash\n [host_list, total_matching, total_returned].hash\n end", "def populate_sources_stats\n # Iterate over each of a user's links, adding to the count of the corresponding source\n @user.links.all.each { |link| @sources_stats[link.source.name] += 1 }\n end", "def follower_ids_hash\n follower_ids_hash = Hash.new()\n store = PStore.new(FOLLOWER_IDS_PATH + self.twitter_id.to_s)\n store.transaction{follower_ids_hash = store[self.twitter_id]}\n if follower_ids_hash == nil\n follower_ids_hash = Hash.new(0)\n end\n return follower_ids_hash\n end", "def hash\n [rel, href].hash\n end", "def make_hash_with_count(passage)\n array_from_excerpt = strip_text(passage)#input from first question\n names_and_counts = Hash.new 0 #initializes at 0\n array_from_excerpt.each do |word|\n names_and_counts[word] += 1#for all subs. occurences, add 1\n end\n names_and_counts # must have the last line return the array!\nend", "def hash\n 0\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 nucleotide_counts\n hash = {}\n @valid_inputs.each do |i|\n hash[i] = @dna.count i\n end\n hash\n end" ]
[ "0.82694614", "0.655014", "0.5951549", "0.59169096", "0.56994236", "0.56967753", "0.56949496", "0.56888336", "0.5644522", "0.5614125", "0.55630755", "0.55587757", "0.555015", "0.5527527", "0.55229855", "0.55197436", "0.5477085", "0.54755986", "0.5457154", "0.5448609", "0.54378444", "0.5437476", "0.5395162", "0.53905696", "0.5387681", "0.5381002", "0.5380715", "0.5379507", "0.53776884", "0.53561896", "0.534976", "0.5344209", "0.5342462", "0.53419906", "0.53300804", "0.532349", "0.53108406", "0.53046554", "0.5300721", "0.5266221", "0.5261173", "0.52596015", "0.52563417", "0.52556753", "0.5252885", "0.52525324", "0.5252429", "0.52517617", "0.52480793", "0.52410346", "0.52276355", "0.5224985", "0.5222941", "0.52075756", "0.52002853", "0.51983315", "0.5195019", "0.5192884", "0.5172511", "0.516866", "0.5149742", "0.51441026", "0.5139084", "0.5135715", "0.5134393", "0.5129786", "0.5129786", "0.5128366", "0.51199895", "0.5103432", "0.5102966", "0.5083229", "0.50778943", "0.5074517", "0.50730366", "0.5069104", "0.5060592", "0.50568414", "0.5056298", "0.5051345", "0.5049514", "0.50451005", "0.50439847", "0.50423664", "0.5040372", "0.5037776", "0.50349486", "0.50270176", "0.5026921", "0.5024848", "0.5023024", "0.50219154", "0.50209594", "0.5016748", "0.5016237", "0.50137687", "0.5010157", "0.5009816", "0.50089544", "0.50083876" ]
0.7942738
1
Elastic search settings using indexed json.
def as_indexed_json(_options) as_json( methods: [:vendor_name, :subject_search_index, :rss_search_index, :curated_search_index, :published, :keywords], only: [:id, :name, :vendor_name, :description, :title_search, :keywords] ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configure\n configure_with(elasticsearch: true)\n end", "def search_setup(index:'', type:'', source:[], query:nil)\n @logger.info('Setup the ES search options: ')\n @logger.info(\"index=#{index} type=#{type} source=#{source} query=#{query}\")\n\n @index = index\n @type = type\n @source = source.dup\n @query = query\n end", "def create_index_body\n index_body = {\n settings: {\n index: {\n number_of_shards: 1,\n number_of_replicas: 2,\n analysis: default_analysis\n }\n },\n mappings: {\n \"#{es_type_name}\": {\n dynamic_templates: [\n { keywords: { match: '_keyword_*', mapping: { type: 'keyword' } } },\n { floats: { match: '_float_*', mapping: { type: 'float' } } },\n { booleans: { match: '_boolean_*', mapping: { type: 'boolean' } } },\n { datetimes: { match: '_datetime_*', mapping: { type: 'date', format: 'basic_date_time_no_millis' } } }\n ],\n properties: es_attributes.merge(es_attributes)\n }\n }\n }\n end", "def elastic_index(options = {})\n \n options.symbolize_keys!\n Escargot.register_model(self)\n \n if respond_to?('single_collection_inherited?') and single_collection_inherited?\n ivars = %w[@index_name @update_index_policy @index_options @indexing_options @mapping @current_schema_version @previous_schema_version]\n ivars.each do |ivar|\n if passed_option = options[ivar[1..-1].to_sym]\n instance_variable_set ivar, passed_option\n else\n instance_variable_set ivar, superclass.instance_variable_get(ivar)\n end\n end\n else\n @index_name = options[:index_name] || self.name.underscore.gsub(/\\//,'-')\n @update_index_policy = options.include?(:updates) ? options[:updates] : :immediate\n \n if @update_index_policy\n after_save :update_index\n after_destroy :delete_from_index\n end\n \n @index_options = options[:index_options] || {}\n @indexing_options = options[:indexing_options] || {}\n @mapping = options[:mapping] || false\n @current_schema_version = options[:current_schema_version] || \"0\"\n @previous_schema_version = options[:previous_schema_version] || \"0\"\n end\n \n end", "def index(model)\n model.index\n ElasticMapper.index.refresh\nend", "def as_indexed_json(options={})\n # we want the indexing data at the \"top level\" of the document,\n # and not as sub-hash under the 'indexing-data' field\n record = as_json(except: [:indexing_data])\n\n if (indexing_data)\n index_data_hash = JSON.parse(indexing_data)\n if index_data_hash.is_a? Hash\n record = record.merge(index_data_hash)\n end\n end\n\n if (record['resource_type'].to_i == Resource::COLLECTION_OBJECT)\n record['on_display'] = record['on_display'] == 1 ? \"1\" : \"0\"\n end\n\n # pseudo fields\n record['author'] = [self.get_author_name(omit_email: true), self.get_author_name(omit_email: true, force_cataloguer: true), self.author_name]\n record['role'] = record['affiliation'] = self.roles.pluck(\"name\")\n \n \n record['tag'] = self.tags.pluck(\"tag\")\n record['keyword'] = self.vocabulary_terms.pluck(\"term\") + self.vocabulary_term_synonyms.pluck(\"synonym\")\n record['terms'] = (record['keywords'] ? record['keywords'].split(/\\|/) : []) + record['keyword'] + record['tag']\n\n record['start_date'] = record['start_date'].to_i\n record['end_date'] = record['end_date'].to_i\n\n # Index ACL values\n # record['read_users'] = ResourcesUser.where({resource_id: self.id, access: 1}).pluck(:user_id)\n# record['edit_users'] = ResourcesUser.where({resource_id: self.id, access: 2}).pluck(:user_id)\n# record['read_groups'] = ResourcesGroup.where({resource_id: self.id, access: 1}).pluck(:group_id)\n# record['edit_groups'] = ResourcesGroup.where({resource_id: self.id, access: 2}).pluck(:group_id)\n\n # ActiveRecord is not able to see existing records once a new record is created. Is this due to the query cache?\n # Tried to disable the query cache in this context but it didn't make a difference. Using raw SQL works so that's\n # what we do, despite it being ugly\n\n record['read_users'] = []\n record['edit_users'] = []\n record['read_groups'] = []\n record['edit_groups'] = []\n\n recs = ActiveRecord::Base.connection.execute(\"SELECT user_id FROM resources_users WHERE resource_id = \" + self.id.to_s + \" AND access = 1\")\n recs.each do |rec| \n record['read_users'].push(rec[0].to_i)\n end\n recs = ActiveRecord::Base.connection.execute(\"SELECT user_id FROM resources_users WHERE resource_id = \" + self.id.to_s + \" AND access = 2\")\n recs.each do |rec| \n record['edit_users'].push(rec[0].to_i)\n end\n recs = ActiveRecord::Base.connection.execute(\"SELECT group_id FROM resources_groups WHERE resource_id = \" + self.id.to_s + \" AND access = 1\")\n recs.each do |rec| \n record['read_groups'].push(rec[0].to_i)\n end\n recs = ActiveRecord::Base.connection.execute(\"SELECT group_id FROM resources_groups WHERE resource_id = \" + self.id.to_s + \" AND access = 2\")\n recs.each do |rec| \n record['edit_groups'].push(rec[0].to_i)\n end\n \n # break out other date types\n other_date_regexp = Regexp.new(\"\\\\(([^\\\\)]+)\\\\)\")\n if (m = other_date_regexp.match(record['other_dates']))\n record['other_date_types'] = m[1]\n end\n\n\n # index idno's of collection objects used as media\n collection_identifiers = []\n self.media_files.each do |m|\n if (m.sourceable.respond_to? (:get_collection_identifier))\n collection_identifiers.push(m.sourceable.get_collection_identifier)\n end\n end\n #puts collection_identifiers.inspect if (collection_identifiers.length > 0)\n record['related_collection_objects'] = collection_identifiers.join(\"; \")\n\n # index average rating for this resource\n record['rating'] = avg_rating.to_i\n\n record\n end", "def index_params\n { index: name.dataset.to_sym,\n body: {\n settings: self.class.index_settings,\n mappings: { properties: schema.to_properties } } }\n end", "def __elasticsearch__\n @adapter ||= Adapter.new(self)\n end", "def read options = {}\n opt = {}\n opt[:index] = options[:index] || @index\n if options[:type]\n unless options[:type].empty?\n opt[:type] = options[:type]\n end\n else\n options[:type] = TYPE\n end\n begin\n if options[:id]\n opt[:id] = options[:id]\n obj = @client.get opt\n # puts \"Read: #{obj.inspect}\"\n obj['_source']\n elsif options[:where]\n k, v = options[:where].first\n opt[:q] = \"#{k}:#{v}\"\n _search opt\n elsif options[:body]\n opt[:body] = options[:body]\n res = _search opt\n STDERR.puts \"Elasticsearch.read.body #{res.inspect}\"\n res\n else\n _search opt\n end\n rescue Elasticsearch::Transport::Transport::Errors::NotFound\n nil\n end\n end", "def configure_settings client, is_reload = nil\n configuration = JSON.parse File.read('/config/config.json')\n\n set :master_mutex, Mutex.new\n\n set :dev, (ENV['RACK_ENV'] == 'development')\n\n set :batch_size, (ENV['BATCH_SIZE'] || configuration[\"batch_size\"] || 100)\n\n set :max_batches, (ENV['MAX_BATCHES'] || configuration[\"max_batches\"])\n\n set :persist_indexes, ENV['PERSIST_INDEXES'] || configuration[\"persist_indexes\"]\n\n set :additive_indexes, ENV['ADDITIVE_INDEXES'] || configuration[\"additive_indexes\"]\n\n raw = ENV['ENABLE_RAW_DSL_ENDPOINT'] || configuration[\"enable_raw_dsl_endpoint\"]\n\n set :raw_dsl_endpoint, ['true','True','TRUE'].include?(raw)\n\n set :default_index_settings, configuration[\"default_settings\"]\n\n set :common_terms_cutoff_frequency, (ENV['COMMON_TERMS_CUTOFF_FREQUENCY'] || configuration[\"common_terms_cutoff_frequency\"] || 0.001)\n\n set :automatic_index_updates,\n (ENV[\"AUTOMATIC_INDEX_UPDATES\"] || configuration[\"automatic_index_updates\"])\n\n set :type_paths, Hash[\n configuration[\"types\"].collect do |type_def|\n [type_def[\"on_path\"], type_def[\"type\"]]\n end\n ]\n\n set :type_definitions, Hash[\n configuration[\"types\"].collect do |type_def|\n [type_def[\"type\"], type_def]\n end\n ]\n\n if settings.persist_indexes\n log.info \"Loading persisted indexes\"\n load_persisted_indexes configuration[\"types\"]\n else\n destroy_persisted_indexes client\n end\n\n # properties and types lookup-tables for updates\n # { <rdf_property> => [type, ...] }\n rdf_properties, rdf_types = configure_properties_types_lookup_tables configuration\n set :rdf_properties, rdf_properties\n set :rdf_types, rdf_types\n\n # Eager Indexing\n eager_indexing_groups = configuration[\"eager_indexing_groups\"] || []\n\n # if configuration[\"eager_indexing_sparql_query\"]\n # query_result = query configuration[\"eager_indexing_sparql_query\"]\n # eager_indexing_groups += query_result.map { |key, value| value.to_s }\n # end\n\n unless eager_indexing_groups.empty?\n settings.master_mutex.synchronize do\n eager_indexing_groups.each do |groups|\n settings.type_definitions.keys.each do |type|\n index = get_matching_index_name type, groups, []\n index_name = (index and index[:index]) || create_index(client, type, groups, [])\n\n unless settings.persist_indexes and index and client.index_exists index_name\n log.info \"Clearing index for type #{type} - #{index_name}.\"\n clear_index client, index_name\n index_documents client, type, index_name, groups\n Indexes.instance.set_status index_name, :valid\n else\n log.info \"Using persisted index: #{index_name}\"\n end\n end\n end\n end\n end\nend", "def index_document(opts = {})\n params = document_path(opts)\n params[:body] = as_indexed_json\n es_client.index params\n end", "def process_elasticsearch(target)\n {\n :schema => 'iglu:com.snowplowanalytics.snowplow.storage/elastic_config/jsonschema/1-0-0',\n :data => {\n :name => target['name'],\n :host => target['host'],\n :index => target['database'],\n :port => target['port'],\n :type => target['table'],\n :nodesWanOnly => target['es_nodes_wan_only'],\n :purpose => 'FAILED_EVENTS'\n }\n }\nend", "def as_indexed_json(options={})\n entry = Jbuilder.encode do |json|\n json.(self, :id, :title, :body, :tags, :category, :price,\n :geo_precision, :geo_location, :updated_at, :created_at)\n json.images self.ad_images, :id, :description, :weight\n json.main_image_url self.safe_image_url(:searchresult)\n json.user do |user|\n json.id self.user.id\n # FIXME: its very very ugly to index the feedback_score with the ad.\n json.rating self.user.feedback_score\n json.avatar_url self.user.safe_avatar_url\n end\n end\n # this is silly, but it's expected that as_indexed_json returns an\n # object, not a json strung that jbuilder gives us.\n JSON.parse(entry)\n end", "def index_offering_for_elasticsearch\n return lambda do |offer|\n var = offer[:name].gsub(/(\\s+)/, '_')\n return {\"index\": {\"_id\": \"#{var}\"}}\n end\nend", "def setup_index_template\n \n \n template_name = \"logstash-template\"\n template_wildcard = @index.gsub(/%{[^}+]}/, \"*\")\n template_config = {\n \"template\" => template_wildcard,\n \"settings\" => {\n \"number_of_shards\" => 5,\n \"index.compress.stored\" => true,\n \"index.query.default_field\" => \"@message\"\n },\n \"mappings\" => {\n \"_default_\" => {\n \"_all\" => { \"enabled\" => false } \n }\n }\n } # template_config\n\n @logger.info(\"Setting up index template\", :name => template_name,\n :config => template_config)\n begin\n success = false\n while !success\n response = @agent.put!(\"http://#{@host}:#{@port}/_template/#{template_name}\",\n :body => template_config.to_json)\n if response.error?\n body = \"\"\n response.read_body { |c| body << c }\n @logger.warn(\"Failure setting up elasticsearch index template, will retry...\",\n :status => response.status, :response => body)\n sleep(1)\n else\n success = true\n end\n end\n rescue => e\n @logger.warn(\"Failure setting up elasticsearch index template, will retry...\",\n :exception => e)\n sleep(1)\n retry\n end\n end", "def multi_index_elastic_search(params={})\n params = format_params(params)\n \n search = Tire.search params[:indexes], :load => false, :from => params[:offset] do \n query do\n boolean do\n should { match :name, \"#{params[:q]}*\", :type => :phrase_prefix }\n should { match :content, params[:q], :type => :phrase}\n end\n end\n facet \"item_type\" do terms :_type end\n highlight :content, :title\n sort { by \"_score\"}\n\n end\n end", "def stored_search_index\n @updated_search_index ||= begin\n if search_index_path.exist?\n require 'json'\n index = JSON.parse(search_index_path.read)\n index if index.is_a?(Hash) # TODO: should we also check if hash has correct hierarchy?\n end\n end\n end", "def as_elasticsearch\n elasticsearch_doc = super\n [:mime_type,:content_type,:file_type,:storage_location_id,:file_size,:file_entity_type,:file_name].each do |method|\n elasticsearch_doc[method.to_s] = self.send(method)\n end\n elasticsearch_doc\n end", "def search\n\n # define the elasticsearch result \"size\" (limit)\n limit = params['limit'].to_i\n # define the elasticsearch result \"from\" (offset)\n offset = params['offset'].to_i\n # Pass through\n hack = params['hack']\n # Default output\n searchResults = ''\n # If we have filters, we need to parse them\n if params['filters'].present?\n filters = []\n # For each of the filters format them and stuff them into an array\n params['filters'].each do |key, filter|\n\n if [\n 'properties.educationalAlignment.properties.targetName',\n 'properties.inLanguage',\n 'properties.isBasedOnUrl',\n 'properties.thumbnailUrl',\n 'properties.timeRequired',\n 'properties.typicalAgeRange',\n 'properties.url',\n 'properties.useRightsUrl'\n ].include?(key)\n searchKey = \"schema-org.#{key}.original\"\n matchTerm = 'term'\n else\n searchKey = \"schema-org.#{key}\"\n matchTerm = 'match'\n end\n\n if filter.keys.count > 1\n # This is more complex because this filter type needs the keys or'd together\n orFilters = []\n filter.keys.each do |f|\n orFilters << { 'query' => { matchTerm => { searchKey => f.to_s } } }\n end\n filters << { 'or' => orFilters }\n else\n # This should be simple, there is only one of this filter key\n filters << { 'query' => { matchTerm => { searchKey => filter.keys.first.to_s } } }\n end\n end\n\n # If the query is present we need to match it\n if params['query'].present?\n query = { 'match' => { '_all' => params['query'] } }\n filter = { 'and' => filters }\n # If no query is present then we can wildcard against anything\n else\n query = { 'match_all' => { } }\n filter = { 'and' => filters }\n end\n # if not filter is present then just match against query\n else\n query = { 'match' => { '_all' => params['query'] } }\n end\n\n # Build the payload from the various parts\n payload = {\n 'size' => limit,\n 'from' => offset,\n 'query' => {\n 'filtered' => {\n 'query' => query,\n 'filter' => filter\n }\n },\n \"facets\" => {\n \"intendedEndUserRole\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.intendedEndUserRole.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n },\n \"typicalAgeRange\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.typicalAgeRange.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n },\n \"educationalUse\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.educationalUse.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n },\n \"interactivityType\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.interactivityType.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n },\n \"learningResourceType\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.learningResourceType.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n },\n \"mediaType\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.mediaType.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n }\n }\n }\n\n#puts \"PAYLOAD\"; puts Rails.configuration.elastic_search_url; puts payload.to_json\n\n # Okay after all that mess, lets make the request\n request = RestClient::Request.new( :method => :get, :url => Rails.configuration.elastic_search_url, :payload => payload.to_json )\n # Since this can error lets catch it\n begin\n searchResults = request.execute\n results = JSON.parse(searchResults)\n results[:hack] = hack\n\n#puts \"RESPONSE\"; puts results.to_json\n\n respond_to do |format|\n format.json { render json: results }\n end\n rescue => e\n # @TODO Need to return the correct error type and then an error message to be shown to user.\n respond_to do |format|\n format.json { render json: searchResults }\n end\n#puts \"ERROR!\"; puts e.response\n end\n\n end", "def create_elasticsearch_index\n unless index.exists?\n index.create :mappings => mapping_to_hash, :settings => settings\n end\n rescue Errno::ECONNREFUSED => e\n STDERR.puts \"Skipping index creation, cannot connect to ElasticSearch\",\n \"(The original exception was: #{e.inspect})\"\n end", "def create_search_index\n Tire.index self.index_name\n end", "def index_options options\n defaults = {\n :type => 'string',\n :indexed => true,\n :stored => false,\n :multi_valued => false,\n :required => false,\n :copy_to => nil,\n }\n index_options = {}\n defaults.each_pair do |opt_name,default|\n if options.has_key?(opt_name)\n index_options[opt_name] = options[opt_name]\n else\n index_options[opt_name] = default \n end\n end\n index_options[:type] = index_options[:type].to_s\n index_options\n end", "def create_search_index\n Tire.index Person.index_name do\n create(\n settings: {\n analysis: {\n filter: {\n name_ngrams: {\n 'side' => 'front',\n 'max_gram' => 10,\n 'min_gram' => 1,\n 'type' => 'edgeNGram'\n }\n },\n analyzer: {\n full_name: {\n 'filter' => %w(standard lowercase asciifolding),\n 'type' => 'custom',\n 'tokenizer' => 'standard'\n },\n partial_name: {\n 'filter' => %w(standard lowercase asciifolding name_ngrams),\n 'type' => 'custom',\n 'tokenizer' => 'standard'\n },\n keyword: {\n 'filter' => %w(lowercase),\n 'tokenizer' => 'keyword'\n }\n }\n },\n store: {\n type: Rails.env.test? ? :memory : :niofs\n }\n },\n mappings: {\n person: {\n properties: {\n first_name: {\n fields: {\n partial: {\n search_analyzer: 'full_name',\n index_analyzer: 'partial_name',\n type: 'string'\n },\n first_name: {\n type: 'string',\n analyzer: 'full_name'\n }\n },\n type: 'multi_field'\n },\n last_name: {\n fields: {\n partial: {\n search_analyzer: 'full_name',\n index_analyzer: 'partial_name',\n type: 'string'\n },\n last_name: {\n type: 'string',\n analyzer: 'full_name'\n }\n },\n type: 'multi_field'\n },\n initials: {\n type: 'string',\n analyzer: 'simple'\n },\n profession: {\n type: 'string',\n analyzer: 'keyword'\n },\n email: {\n type: 'string',\n analyzer: 'simple'\n },\n login: {\n type: 'string',\n analyzer: 'simple'\n },\n year_entrance: {\n type: 'date',\n format: 'YYYY'\n },\n year_out: {\n type: 'date',\n format: 'YYYY'\n }\n }\n }\n }\n )\n end\n end", "def as_indexed_json(options={})\n \n self.as_json(\n only: [:content,:title,:name], \n include:{\n comments: { only: [:body]},\n tags: {only: [:name]}\n }\n )\n end", "def index\n @query = params[:q] || '*:*'\n query = Jbuilder.encode do |json|\n json.filter do\n json.missing do\n json.field \"parent_id\"\n end\n end\n json.query do\n json.query_string do\n json.query @query\n end\n end\n json.sort do\n json.node \"asc\"\n end\n end\n @themata = Thema.__elasticsearch__.search(query).page(params[:page]).records\n end", "def as_indexed_json(options={})\n {\n title: title,\n text: text,\n categories: categories.map(&:title),\n authors: authors.as_json(methods: [:full_name], only: [:full_name, :first_name, :last_name]),\n comments: comments.as_json(only: [:text, :author])\n }\n end", "def get_setting()\n if @analyzer == 'kuromoji'\n # use kuromoji. need to install kuromoji-plugin for elasticsearch\n pos_filter = { \"type\" => \"kuromoji_part_of_speech\", \"stoptags\" => [\"助詞-格助詞-一般\", \"助詞-終助詞\"]}\n greek_lowercase_filter = {\"type\" => \"lowercase\", \"langrage\" => \"greek\"}\n filter = { \"pos_filter\" => pos_filter, \"greek_lowercase_filter\" => greek_lowercase_filter }\n\n kuromoji = { \"type\" => \"kuromoji_tokenizer\", \"mode\" => \"search\" }\n tokenizer = { \"kuromoji\" => kuromoji }\n\n kuromoji_filter = [\"kuromoji_baseform\", \"pos_filter\", \"greek_lowercase_filter\", \"cjk_width\"]\n kuromoji_analyzer = { \"type\" => \"custom\", \"tokenizer\" => \"kuromoji\", \"filter\" => kuromoji_filter }\n analyzer = { \"#{@analyzer}\" => kuromoji_analyzer }\n\n analysis = { \"filter\" => filter, \"tokenizer\" => tokenizer, \"analyzer\" => analyzer }\n settings = { \"analysis\" => analysis }\n else\n raise \"[elasticsearch plugin]: undefined analyzer #{analyzer}\"\n end\n end", "def setting_index\n end", "def solr_during_indexing\n {\n \"has_model_ssim\" => [\"Collection\"],\n :id => object.id,\n \"title_tesim\" => [object.title.first.to_s],\n \"title_sim\" => [object.title.first.to_s],\n \"collection_type_gid_ssim\" => [object.collection_type_gid],\n \"ark_ssi\" => object.ark,\n \"ursus_id_ssi\" => Californica::IdGenerator.blacklight_id_from_ark(object.ark),\n \"member_ids_ssim\" => [],\n \"object_ids_ssim\" => [],\n \"member_of_collection_ids_ssim\" => [], \"collection_ids_ssim\" => [],\n \"generic_type_sim\" => [\"Collection\"],\n \"bytes_lts\" => 0,\n \"visibility_ssi\" => \"restricted\"\n }\n end", "def to_hash\n index_hash = {}\n index_hash['json_claz'] = self.class.name\n index_hash['id'] = id\n index_hash['settings_name'] = settings_name\n index_hash['cattype'] = cattype\n index_hash['flavor'] = flavor\n index_hash['image'] = image\n index_hash['catorder'] = catorder\n index_hash['url'] = url\n index_hash['envs'] = envs\n index_hash['options'] = options\n index_hash['plans'] = plans\n index_hash['created_at'] = created_at\n index_hash\n end", "def create_elasticsearch_addressbase_mapping\n index_mapping = addressbase_es_mappings\n uri = URI.parse(\"#{$ELASTIC_SEARCH_ENDPOINT}/\")\n conn = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Put.new \"#{$ELASTICSEARCH_ADDRESSBASE}/_mapping/#{$ELASTICSEARCH_POSTCODE_SEARCH}/\"\n request['Content-Type'] = 'application/json'\n request.body = index_mapping\n conn.request(request)\nend", "def elastic(esurl = nil)\n @elastic ||= ESClient.new esurl\n end", "def as_indexed_json(options={})\n as_json(except: [:id, :_id]).merge(url: self.url)\n end", "def to_indexed_json\n json = {\n :title => title,\n :name => name,\n :name_sort => name,\n :content => content,\n :summary => summary,\n :topics => topics.collect { |t| t.name },\n :creators => creators.collect { |c| c.name },\n :items => items.collect { |i| i.url },\n \n :format_facet => items.collect { |i| i.item_type},\n :world_maritime_university_program_facet => programs,\n :creator_nationality_facet => creator_countries,\n \n }\n json[:date] = date if date\n json.to_json\n end", "def as_indexed_json(option={})\n \t self.as_json(\n \t \t include: {\n \t \t \t department: { only: :name },\n \t \t \t bmet_model: { only: [:model_name, :manufacturer_name, :vendor_name]}\n\t\t })\n end", "def create_elasticsearch_addressbase_index\n uri = URI.parse(\"#{$ELASTIC_SEARCH_ENDPOINT}/\")\n conn = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Put.new \"#{$ELASTICSEARCH_ADDRESSBASE}\"\n conn.request(request)\nend", "def build_index\n @search = RSemantic::Search.new(@documents.map(&:text), @options)\n end", "def construct_index\n end", "def as_indexed_json(options={})\n self.as_json(\n include: { categories: { only: :title},\n authors: { methods: [:full_name, :department], only: [:full_name, :department] },\n comments: { only: :text }\n })\n end", "def as_indexed_json(_options = {})\n as_json(\n include: {\n city: {},\n room_location_service: {},\n photos: {},\n extras: {},\n owner: {}\n }\n ).merge location: { lat: latitude, lon: longitude }\n end", "def as_indexed_json(options={})\n\t\t\tfull_text = self.content\n\t\t\tfull_text = \"#{full_text}\\n#{self.posts.collect{|post| post.content }.join(\"\\n\")}\"\n\n\t\t\tas_json().merge( 'public' => (self.anyone? && self.active?), full_text: full_text )\n\t\tend", "def indexed\n meta(index: true)\n end", "def search_index\n part_of_index = params[:term]\n indexes = []\n \n if part_of_index\n indexes = PostIndex.where('\"index\" like ?', part_of_index + '%').select('\"index\", region, city').collect { |pi| {:value => pi.index, :label => pi.index + '-' + pi.city! } }\n end\n\n respond_to do |format|\n format.html { render :text => indexes.to_json }\n end\n end", "def reads_from_elasticsearch?\n IndexAndMapping.matches?(settings[:input])\n end", "def around\n ClimateControl.modify(ELASTICSEARCH_URL: elasticsearch_url) do\n super\n end\n end", "def client\n @client ||= Elasticsearch::Client.new host: @elasticsearch_host,\n port: @elasticsearch_port\nend", "def documentation_search store, generator, req, res\n json_index = @cache[store].fetch :json_index do\n @cache[store][:json_index] =\n JSON.dump generator.json_index.build_index\n end\n\n res.content_type = 'application/javascript'\n res.body = \"var search_data = #{json_index}\"\n end", "def index\n @search = params[\"search\"]\n if @search.present?\n client = Client.new(@search)\n response = client.call\n\n new_results = StoreSearch.new(@search, response).run\n if new_results\n scope_to_use = client.find_search_key || \"random\"\n\n if scope_to_use == \"category\"\n searches = Search.with_category(@search[\"category\"])\n @searches = Search.paginate(page: params[:page], per_page: 5).where(id: searches.map(&:id))\n # TODO recover former sintax\n # @searches = Search.paginate(page: params[:page], per_page: 5)\n # .with_category(@search[\"category\"])\n elsif scope_to_use == \"text\"\n @searches = Search.paginate(page: params[:page], per_page: 5)\n .with_text(@search[\"text\"])\n elsif scope_to_use == \"random\"\n @searches = Search.paginate(page: params[:page], per_page: 5)\n .created_randomly\n else\n @searches = Search.paginate(page: params[:page], per_page: 5)\n end\n else\n @searches = Search.paginate(page: params[:page], per_page: 5)\n end\n end\n \n @searches ||= Search.paginate(page: params[:page], per_page: 5)\n @search = Search.new()\n end", "def as_index_document()\n doc = {'format'=>'Node', 'title'=> title, 'id' => persistent_id, 'version'=>id, 'model' => model.id, 'model_name' => model.name, 'pool' => pool_id}\n doc.merge!(solr_attributes)\n doc.merge!(solr_associations)\n doc\n end", "def build_index!\n puts \"build_index!\"\n @indexes = {}\n \n @indexes = @resource_class.build_indexes(@resources)\n @indexes[:_default] ||= @default_order\n end", "def es_client\n @es_client = ::Elasticsearch::Client.new elasticsearch_opts\n end", "def hadoop_jobconf_options\n if reads_from_elasticsearch? || writes_to_elasticsearch?\n settings[:map_speculative] = 'false' if settings[:map_speculative].nil?\n settings[:reduce_speculative] = 'false' if settings[:reduce_speculative].nil?\n end\n \n super() + [].tap do |o|\n if (reads_from_elasticsearch? || writes_to_elasticsearch?)\n o << java_opt('es.config', settings[:es_config])\n o << java_opt('elasticsearch.transport', settings[:es_transport])\n o << java_opt('elasticsearch.transport.host', settings[:es_transport_host]) if settings[:es_transport] && settings[:es_transport_host]\n o << java_opt('elasticsearch.transport.port', settings[:es_transport_port]) if settings[:es_transport] && settings[:es_transport_port]\n end\n \n if reads_from_elasticsearch?\n o << java_opt('elasticsearch.input.index', input_index.index)\n o << java_opt('elasticsearch.input.mapping', input_index.mapping)\n o << java_opt('elasticsearch.input.splits', settings[:es_input_splits])\n o << java_opt('elasticsearch.input.query', settings[:es_query])\n o << java_opt('elasticsearch.input.request_size', settings[:es_request_size])\n o << java_opt('elasticsearch.input.scroll_timeout', settings[:es_scroll_timeout])\n end\n\n if writes_to_elasticsearch?\n o << java_opt('elasticsearch.output.index', output_index.index)\n o << java_opt('elasticsearch.output.mapping', output_index.mapping)\n o << java_opt('elasticsearch.output.index.field', settings[:es_index_field])\n o << java_opt('elasticsearch.output.mapping.field', settings[:es_mapping_field])\n o << java_opt('elasticsearch.output.id.field', settings[:es_id_field])\n o << java_opt('elasticsearch.output.bulk_size', settings[:es_bulk_size])\n end\n end.flatten.compact\n end", "def query_for_index(query, index)\n search_url = \"http://ajax.googleapis.com/ajax/services/search/#{index}?v=1.0&q=#{URI.escape(query)}\"\n @res[search_url] = ''\n \n @multi.add(Curl::Easy.new(search_url) do|cfg|\n cfg.headers['Referer'] = @referer\n cfg.on_body{|data| @res[cfg.url] << data; data.size }\n cfg.on_success {|easy| yield(JSON.parse(@res[easy.url])) }\n end)\n end", "def initialize(idx, opts = {})\n opts[:direct_idx] = opts.include?(:direct_idx) ? opts[:direct_idx] : false\n\n # direct set index(es)\n @config = ElasticsearchRasi::Config.new(idx, opts)\n default_config_connect_params!(@config.connect)\n\n @es = create_client(@config.connect)\n @es_another = create_another_clients(@config)\n end", "def index_songs_in_elasticsearch\n songs.find_each { |song| song.__elasticsearch__.index_document }\n end", "def as_indexed_json\n indexed_values\n end", "def index\n @@index ||= Ferret::Index::Index.new(default_index_params)\n end", "def index\n @@index ||= Ferret::Index::Index.new(default_index_params)\n end", "def index\n conditions = []\n params[:per_page] = perpage if params[:per_page].nil?\n params[:page] = 1 if params[:page].blank?\n unless params[:search].blank?\n conditions.push \"config_type like ? or key like ?\"\n conditions.push \"%#{params[:search]}%\"\n conditions.push \"%#{params[:search]}%\"\n end\n @kf_global_configs = Kf::GlobalConfig.order(\"id DESC\").paginate(:page => params[:page], :per_page => params[:per_page] ,:conditions => conditions)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @kf_global_configs }\n end\n end", "def create_elasticsearch_index\n unless index.exists?\n if index_name[/(.*)_alias$/]\n name_prefix = $1\n found_untimestamped_index = false\n timestamped_index_name = nil\n timestamp = nil\n Tire::Index.all.each do |index_name|\n if index_name[Regexp.new(\"^#{name_prefix}$\")]\n # ^^ look for an index without the _alias prefix in its name\n found_untimestamped_index = true\n elsif index_name[Regexp.new(\"^#{name_prefix}_(\\\\d{14})$\")] && (timestamp.blank? || $1.to_i > timestamp.to_i)\n # ^^ look for an index with a timestamp in its name, and store the newest one (timestamp)\n timestamp = $1\n timestamped_index_name = index_name\n end\n end\n if timestamp.present?\n response = Tire::Alias.create({name: index_name, indices: [timestamped_index_name]})\n log_alias_create(index_name, timestamped_index_name, response)\n elsif found_untimestamped_index\n response = Tire::Alias.create({name: index_name, indices: [name_prefix]})\n log_alias_create(index_name, name_prefix, response)\n else\n new_index = Tire.index(\"#{index_name.sub(/_alias$/, Time.now.strftime(\"_%Y%m%d%H%M%S\"))}\")\n response = new_index.create(:mappings => mapping_to_hash, :settings => settings)\n if log_index_create(response)\n response = Tire::Alias.create({name: index_name, indices: [new_index.name]})\n log_alias_create(index_name, new_index.name, response)\n end\n end\n else\n new_index = index\n response = new_index.create(:mappings => mapping_to_hash, :settings => settings)\n log_index_create(response)\n end\n end\n\n rescue *Tire::Configuration.client.__host_unreachable_exceptions => e\n STDERR.puts \"Skipping index creation, cannot connect to Elasticsearch\",\n \"(The original exception was: #{e.inspect})\"\n false\n end", "def as_indexed_json(options={})\n {\n title: title,\n text: text,\n categories: categories.map(&:title),\n authors: authors.as_json(methods: [:full_name], only: [:full_name, :first_name, :last_name]),\n comments: comments.as_json(only: [:text, :author])\n }\n end", "def as_indexed_json(options={})\n {\n title: title,\n text: text,\n categories: categories.map(&:title),\n authors: authors.as_json(methods: [:full_name], only: [:full_name, :first_name, :last_name]),\n comments: comments.as_json(only: [:text, :author])\n }\n end", "def index(*args)\n @config.index(args)\n end", "def set_index_options\n limit = params[:limit].to_i > 0 ? params[:limit].to_i : nil\n reverse = params[:reverse].present? ?\n params[:reverse].to_s.to_boolean(false) : nil\n with_group_members = params[:with_group_members].present? || params[:without_grouping].present? ?\n params[:with_group_members].to_s.to_boolean(false) || params[:without_grouping].to_s.to_boolean(false) : nil\n @index_options = params.permit(:filter, :filtered_by_type, :filtered_by_group_type, :filtered_by_group_id, :filtered_by_key, :later_than, :earlier_than, :routing_scope, :devise_default_routes)\n .to_h.symbolize_keys\n .merge(limit: limit, reverse: reverse, with_group_members: with_group_members)\n end", "def index_one_document hsh\n response = client.prepare_index(@index, @type).set_source(hsh.to_indexable_json).execute.action_get\n end", "def indexed\n self['indexed']\n end", "def set_index_options\n limit = params[:limit].to_i > 0 ? params[:limit].to_i : nil\n reverse = params[:reverse].present? ?\n params[:reverse].to_s.to_boolean(false) : nil\n @index_options = params.permit(:filter, :filtered_by_key, :routing_scope, :devise_default_routes)\n .to_h.symbolize_keys.merge(limit: limit, reverse: reverse)\n end", "def index\n @config_vars = ENVIRONMENT_VARIABLES_TO_PRINT\n @corpus_size = RLetters::Solr::CorpusStats.new.size\n @ping = RLetters::Solr::Connection.ping\n @solr_info = RLetters::Solr::Connection.info\n end", "def client\n Elasticsearch::Model.client\n end", "def as_indexed_json(options = {}) \n # self.as_json(options.merge(root: false)) \n properties.merge({objectId: obj_id, createdAt: created_at, updated_at: updated_at, id: id})\n end", "def as_indexed_json(options = {})\n {\n \"id\" => uid,\n \"uid\" => uid,\n \"name\" => name,\n \"display_name\" => display_name,\n \"client_ids\" => options[:exclude_associations] ? nil : client_ids,\n \"prefix_ids\" => options[:exclude_associations] ? nil : prefix_ids,\n \"contact_ids\" => options[:exclude_associations] ? nil : contact_ids,\n \"symbol\" => symbol,\n \"year\" => year,\n \"system_email\" => system_email,\n \"group_email\" => group_email,\n \"is_active\" => is_active,\n \"description\" => description,\n \"website\" => website,\n \"region\" => region,\n \"country_code\" => country_code,\n \"logo_url\" => logo_url,\n \"focus_area\" => focus_area,\n \"organization_type\" => organization_type,\n \"member_type\" => member_type,\n \"non_profit_status\" => non_profit_status,\n \"consortium_id\" => consortium_id,\n \"consortium_organization_ids\" =>\n options[:exclude_associations] ? nil : consortium_organization_ids,\n \"role_name\" => role_name,\n \"password\" => password,\n \"cache_key\" => cache_key,\n \"joined\" => joined.try(:iso8601),\n \"twitter_handle\" => twitter_handle,\n \"ror_id\" => ror_id,\n \"salesforce_id\" => salesforce_id,\n \"globus_uuid\" => globus_uuid,\n \"billing_information\" => {\n \"address\" => billing_address,\n \"organization\" => billing_organization,\n \"department\" => billing_department,\n \"postCode\" => billing_post_code,\n \"state\" => billing_state,\n \"country\" => billing_country,\n \"city\" => billing_city,\n },\n \"technical_contact\" => technical_contact,\n \"secondary_technical_contact\" => secondary_technical_contact,\n \"billing_contact\" => billing_contact,\n \"secondary_billing_contact\" => secondary_billing_contact,\n \"service_contact\" => service_contact,\n \"secondary_service_contact\" => secondary_service_contact,\n \"voting_contact\" => voting_contact,\n \"has_required_contacts\" => has_required_contacts,\n \"created\" => created.try(:iso8601),\n \"updated\" => updated.try(:iso8601),\n \"deleted_at\" => deleted_at.try(:iso8601),\n \"cumulative_years\" => cumulative_years,\n \"consortium\" => consortium.try(:as_indexed_json),\n \"contacts\" =>\n if options[:exclude_associations]\n nil\n else\n contacts.map { |m| m.try(:as_indexed_json, exclude_associations: true) }\n end,\n \"doi_estimate\" => doi_estimate\n }\n end", "def indexed=(val)\n self['indexed'] = 'val'\n end", "def as_indexed_json(options={})\n self.as_json(\n methods: [:creation_epoch],\n include: {\n page: {only: [:url, :title, :site_name, :description, :content, :image_url]},\n }\n )\n end", "def to_indexed_json\n {\n :id => id,\n :name => name,\n :summary => summary,\n :published => self.pubDate,\n :author => author,\n :feed_id => feed_id\n }.to_json\n end", "def with_settings(index_name: nil, connection: nil)\n Class.new(self).tap do |klass|\n klass.define_singleton_method(:index_name) { index_name } if index_name\n klass.define_singleton_method(:connection) { connection } if connection\n end\n end", "def setup_index\n @index_driver.setup_index\n end", "def default_options\n HashWithIndifferentAccess.new({\n :sunspot_index_queue_name => \"sunspot_index_queue\",\n :user => \"guest\",\n :pass => \"guest\",\n :host => \"localhost\",\n :port => \"5672\",\n :vhost => \"/\",\n :max_attempts_count => 5,\n :retry_interval => 300,\n :index_delay => 0\n })\n end", "def create_index index, mappings = nil, settings = nil\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}\")\n req = Net::HTTP::Put.new(uri)\n req.body = {\n mappings: mappings,\n settings: settings\n }.to_json\n\n result = run(uri, req)\n end", "def search(index, body)\n handler.search index: index, body: body\n end", "def as_indexed_json(_options = {})\n {\n \"id\" => uid,\n \"uid\" => uid,\n \"name\" => name,\n \"given_name\" => given_name,\n \"family_name\" => family_name,\n \"email\" => email,\n \"github\" => github,\n \"created\" => created,\n \"updated\" => updated,\n \"role_id\" => role_id,\n \"role_name\" => role_name,\n \"beta_tester\" => beta_tester,\n \"is_public\" => is_public,\n \"auto_update\" => auto_update,\n \"is_active\" => is_active,\n \"orcid_token\" => orcid_token,\n \"orcid_expires_at\" => orcid_expires_at,\n \"claims_count\" => claims_count,\n }\n end", "def index\n parsed_body['meta']['parameters']['index']\n end", "def run\n super\n\n # get options\n opt_elastic = _get_option(\"elastic\")\n opt_mongodb = _get_option(\"mongodb\")\n opt_couchdb = _get_option(\"couchdb\")\n opt_rsync = _get_option(\"rsync\")\n opt_sonarqube = _get_option(\"sonarqube\")\n opt_jenkins = _get_option(\"jenkins\")\n opt_gitlab = _get_option(\"gitlab\")\n opt_kibana = _get_option(\"kibana\")\n #opt_listing = _get_option(\"listing\")\n opt_cassandra = _get_option(\"cassandra\")\n opt_rethink = _get_option(\"rethink\")\n\n # Set the range of research\n first_page = _get_option(\"first_page\") || 1\n last_page = _get_option(\"last_page\") || 20\n\n range = first_page..last_page\n\n elastic_query = \"type:%22elasticsearch%22\"\n mongodb_query = \"type:%22mongodb%22\"\n couchdb_query = \"product:%22couchdb%22\"\n rsync_query = \"rsync port:%22873%22\"\n sonarqube_query = \"%22Title: SonarQube%22\"\n jenkins_query = \"%22Dashboard [Jenkins]%22\"\n gitlab_query = \"%22Sign in GitLab%22\"\n kibana_query = \"product:%22kibana%22\"\n listing_query = '%22Index of /%22'\n cassandra_query = \"type:%22cassandra%22\"\n rethink_query = \"type:%22rethinkdb%22\"\n\n entity_name = _get_entity_name\n entity_type = _get_entity_type_string\n\n db_source = nil\n\n # Make sure the key is set\n api_key = _get_task_config(\"binary_edge_api_key\")\n \n # Set the headers\n headers = { \"X-Key\" => \"#{api_key}\" }\n\n if opt_elastic == true\n query = elastic_query\n\t range.each do |page_num|\n \t result = search_binaryedge_string_query(query,headers,entity_name,page_num)\n check_elastic_results(result)\n end\n end\n\n if opt_kibana == true\n query = kibana_query\n\t range.each do |page_num|\n \t result = search_binaryedge_string_query(query,headers,entity_name,page_num)\n check_kibana_results(result)\n end\n end\n\n if opt_rsync == true\n query = rsync_query\n range.each do |page_num|\n result = search_binaryedge_string_query(query,headers,entity_name,page_num)\n check_rsync_results(result)\n end\n end\n\n if opt_jenkins == true\n query = jenkins_query\n range.each do |page_num|\n result = search_binaryedge_string_query(query,headers,entity_name,page_num)\n check_jenkins_results(result)\n end\n end\n\n if opt_gitlab == true\n query = gitlab_query\n range.each do |page_num|\n result = search_binaryedge_string_query(query,headers,entity_name,page_num)\n check_gitlab_results(result)\n end\n end\n\n if opt_sonarqube == true\n query = sonarqube_query\n range.each do |page_num|\n result = search_binaryedge_string_query(query,headers,entity_name,page_num)\n check_sonarqube_results(result)\n end\n end\n\n if opt_mongodb == true\n query = mongodb_query\n range.each do |page_num|\n result = search_binaryedge_string_query(query,headers,entity_name,page_num)\n check_mongodb(result)\n end\n end\n\n if opt_cassandra == true\n query = cassandra_query\n range.each do |page_num|\n result = search_binaryedge_string_query(query,headers,entity_name,page_num)\n check_cassandra_results(result)\n end\n end\n\n if opt_couchdb == true\n query = couchdb_query\n range.each do |page_num|\n result = search_binaryedge_string_query(query,headers,entity_name,page_num)\n check_couchdb_results(result)\n end\n end\n\n if opt_rethink == true\n query = rethink_query\n range.each do |page_num|\n result = search_binaryedge_string_query(query,headers,entity_name,page_num)\n check_rethinkdb_results(result)\n end\n end\n\n end", "def index\n\n # search query\n if params[:q].nil?\n @shops = Shop.all\n else\n @shops = Shop.search_with_elasticsearch(params[:q]).records\n end\n\n if params[:filter].present?\n if params[:filter] == 'name'\n @shops = @shops.order('title ASC')\n elsif params[:filter] == 'date'\n @shops = @shops.order('updated_at DESC')\n elsif params[:filter] == 'location'\n define_location\n @shops = @shops.near([@latitude, @longitude], 8_000_000, order: 'distance')\n end\n else\n @shops = @shops.order('updated_at DESC')\n end\n\n @shops = @shops.page(params[:page]).per(20)\n\n end", "def index_params\n params.require(:index).permit(:name, :definition)\n end", "def index\r\n build_index unless @index\r\n @index\r\n end", "def to_indexed_json\n to_json( \n #:only => [ :id, :name, :normalized_name, :url ],\n :methods => [:image_url, :initiator_name, :assigned_user_name,:title, :notable_type_data, :notable_type_title]\n )\n end", "def mapping\n @mapping ||= {}\n if block_given?\n @store_mapping = true and yield and @store_mapping = false\n create_elasticsearch_index\n else\n @mapping\n end\n end", "def index_on( field, opts={} )\n opts = Gnash.new( opts )\n design_document(true).add!( opts.merge!(:name => field) )\n unless indexes.include?( field )\n indexes << field.to_sym \n indexes << field.to_s \n end \n self \n end", "def elasticsearch_client\n Elasticsearch::Client.new hosts: @hosts, retry_on_failure: true\n end", "def index\n session[:search_params] = params[:setting] ? params[:setting] : nil\n\n session[:set_pager_number] = params[:set_pager_number] if params[:set_pager_number]\n\n if session[:set_pager_number].nil?\n session[:set_pager_number] = PER_PAGE\n end\n\n @o_all = Setting.\n search(session[:search_params]).\n order(sort_column + \" \" + sort_direction).\n paginate(:per_page => session[:set_pager_number], :page => params[:page])\n\n @params_arr = ['default_name']\n @params_arr = { :default_name => { \"type\" => 'text' } }\n\n @o_single = controller_name.classify.constantize.new\n end", "def elasticsearch_url\n @state[:elasticsearch_url] || \"#{self.elasticsearch_host}:#{self.elasticsearch_port}\"\n end", "def index activity\n default_fields = {\n \"user_id\" => activity.actor.id,\n \"action\" => activity.verb,\n \"published_date\" => activity.published,\n \"indexed_date\" => Time.new.strftime(\"%Y-%m-%dT%H:%M:%S\")\n }\n extended_fields = activity.extensions || {}\n @es_client.index index:'stream-sample',\n type: activity.object.type,\n body: default_fields.merge extended_fields\n end", "def reindex!\n self.__elasticsearch__.update_document if self.published?\n end", "def save(index_name: nil)\n index_name ||= model.pool.to_param\n Bindery::Persistence::ElasticSearch.client.indices.put_mapping index: index_name, type: model.to_param, body: model.to_elasticsearch\n end", "def elasticsearch_init(storage_name,\n allocated_storage: 5,\n instance_type: 't2.medium',\n properties: {},\n zone_name: nil)\n\n @es_key_name = gen_ssh_key_name(\"Elasticsearch#{storage_name}\", region, stack_name)\n pre_run { create_ssh_key(@es_key_name, region, force_create: false) }\n\n mapping 'AWSElasticsearchAMI', ElasticsearchBitnami.get_mapping\n\n parameter_allocated_storage \"Elasticsearch#{storage_name}\",\n default: allocated_storage,\n min: 5,\n max: 1024\n\n parameter_ec2_instance_type \"Elasticsearch#{storage_name}\", type: instance_type\n\n properties[:KeyName] = @es_key_name\n properties[:InstanceType] = ref(\"Elasticsearch#{storage_name}InstanceType\")\n\n version_tag = {\n Key: 'Version',\n Value: ElasticsearchBitnami.get_release_version\n }\n\n cluster_name_tag = {\n Key: 'ClusterName',\n Value: storage_name.downcase\n }\n\n plugin_tags = [version_tag, cluster_name_tag]\n\n # Set instance tags\n if properties.key?(:Tags) && !properties[:Tags].empty?\n properties[:Tags].concat(plugin_tags)\n else\n properties[:Tags] = plugin_tags\n end\n\n # Configure instance using user-data\n if !properties.key?(:UserData) || !properties[:UserData].empty?\n properties[:UserData] = Base64.encode64(read_user_data('elasticsearch'))\n end\n\n # Assign IAM role to instance\n properties[:IamInstanceProfile] = iam_instance_profile_with_full_access(storage_name, *%w(ec2 s3))\n\n storage_resource_name = \"Elasticsearch#{storage_name}\"\n instance_vpc storage_resource_name,\n find_in_map('AWSElasticsearchAMI', ref('AWS::Region'), :hvm),\n ref_application_subnets.first,\n [ref_private_security_group, ref_resource_security_group],\n depends_on: [],\n properties: properties\n\n # create s3 bucket for cluster snapshots\n account_id = aws_account_id\n bucket_name = \"elasticsearch-bitnami-#{region}-#{account_id}\"\n resource \"Elasticsearch#{storage_name}S3Bucket\",\n Type: 'AWS::S3::Bucket',\n DeletionPolicy: 'Retain',\n Properties: {\n BucketName: bucket_name\n }\n\n # create a DNS record in route53 for instance private ip\n record_name = %W(#{storage_name.downcase.dasherize} #{region} #{zone_name}).join('.')\n create_single_dns_record(\"#{storage_name}PrivateZone\",\n stack_name,\n zone_name,\n record_name,\n resource_records: [get_att(storage_resource_name, 'PrivateIp')])\n end", "def configure(uri, logger: nil)\n @importers = {}\n @logger = logger\n @es_uri = uri\n @client = Elasticsearch::Client.new transport: transport\n end", "def to_indexed_json\n {\n title: title, \n release_year: release_year,\n slug: self.slug\n }.to_json\n end", "def elasticsearch_params(page, per_page = 20)\n page ||= 1\n offset = (page.to_i - 1) * per_page.to_i\n\n {\n body: {\n sort: order_params,\n query: elasticsearch_query,\n aggs: aggregates,\n post_filter: {\n bool: {\n filter: [{\n in: {\n portal_ids: current_portal.self_and_descendants.pluck(:id)\n }\n }]\n }\n },\n size: per_page,\n from: offset\n },\n page: page,\n per_page: per_page\n }\n end", "def index\n @search = Order.search do\n # fulltext '\"84CYd601Dh0slEeJ ankur saini\"' do\n # with(:average_rating, 3..5)\n # field_list [:tracker_hash,:system_id]\n fulltext(params[:search])\n facet(:average_rating) do\n row(1.0..2.0) do\n with(:average_rating, 1.0..2.0)\n end\n row(2.0..3.0) do\n with(:average_rating, 2.0..3.0)\n end\n row(3.0..4.0) do\n with(:average_rating, 3.0..4.0)\n end\n row(4.0..5.0) do\n with(:average_rating, 4.0..5.0)\n end\n end\n # fulltext params[:search] do\n # boost_fields :system_id => 2.0\n # boost(2.0) { with(:response, true) }\n # fields(:tracker_hash)\n # fields(:system_id, :tracker_hash => 2.0)\n # query_phrase_slop 1\n # end\n # with(:published_at).less_than(Time.zone.now)\n # facet(:publish_month)\n # with(:publish_month, params[:month]) if params[:month].present?\n # with(:response, false)\n\n end\n # @orders = @search.results\n ids = @search.hits.map(&:primary_key)\n # debugger\n if ids.present?\n @orders = Order.where(:id => ids).order(\"field(id, #{ids.join(',')})\").paginate(page: params[:page], per_page: 4)\n else\n @orders = Order.where(:id => ids).paginate(page: params[:page], per_page: 4)\n end\n end", "def index\n set_index\n end" ]
[ "0.7030526", "0.6747123", "0.66243625", "0.6528794", "0.6452268", "0.64170325", "0.632356", "0.6316072", "0.6311838", "0.6299989", "0.6298615", "0.6267066", "0.62336135", "0.61609465", "0.61234146", "0.6109905", "0.6103727", "0.6103281", "0.6085973", "0.6042748", "0.600752", "0.60022527", "0.5993798", "0.59758544", "0.5959767", "0.594666", "0.59333014", "0.59115535", "0.59115535", "0.5899903", "0.5897391", "0.5894983", "0.5888407", "0.58856875", "0.58689654", "0.5858774", "0.5837043", "0.582282", "0.5810836", "0.5803246", "0.5800522", "0.5797707", "0.5795446", "0.57840943", "0.5770979", "0.5760486", "0.575971", "0.57550687", "0.5753941", "0.57501304", "0.57235336", "0.5718703", "0.57068294", "0.5696593", "0.5692516", "0.5681648", "0.56770146", "0.56770146", "0.56684554", "0.56644464", "0.56602746", "0.56602746", "0.56515175", "0.5648897", "0.5648721", "0.56421363", "0.56396574", "0.5634006", "0.5623658", "0.56208295", "0.56124085", "0.56090015", "0.56086093", "0.5605202", "0.560317", "0.5600841", "0.5599239", "0.55978256", "0.5588962", "0.5586802", "0.5585369", "0.557223", "0.55720675", "0.55718166", "0.55683243", "0.55675983", "0.5567285", "0.5566589", "0.55609137", "0.55593747", "0.5553371", "0.5549967", "0.5547929", "0.5543929", "0.55430883", "0.55313534", "0.55275035", "0.55233705", "0.5501646", "0.550079" ]
0.64681804
4
Minting a UUID creates a uuid for the record to use as a stable URL.
def mint_uuid self.url_uuid ||= Time.now.to_i end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assign_uuid\n self.id = UUIDTools::UUID.timestamp_create().to_s\n end", "def olduuid uuid\n\trf = uuid\n\trf.insert(8, \"-\")\n\trf.insert(13, \"-\")\n\trf.insert(18, \"-\")\n\trf.insert(23, \"-\")\n\treturn rf\nend", "def assign_uuid\n self.uuid ||= SecureRandom.urlsafe_base64(8)\n end", "def set_uuid\n self.uuid = SecureRandom.uuid\n end", "def set_uuid\n self.uuid = SecureRandom.uuid\n end", "def set_uuid\n self.id = SecureRandom.uuid\n end", "def add_uuid\n self.uuid ||= UUIDTools::UUID.timestamp_create().to_s\n end", "def set_uuid\n self.uuid = UUIDTools::UUID::timestamp_create.to_s if self.uuid.blank?\n end", "def create_uuid\n self.uuid = SecureRandom.hex(12)\n end", "def populate_uuid\n self.uuid = SecureRandom.uuid()\n end", "def assign_uuid\n self.uuid ||= \"_#{SecureRandom.uuid.tr('-', '_')}\"\n end", "def create_uuid\n if self.uuid.nil?\n valid_uid = false\n until valid_uid\n self.uuid = format_uuid(SecureRandom.hex(5))\n valid_uid = Voucher.find_by_uuid(self.uuid).nil?\n self.slug = self.uuid\n end\n end\n end", "def set_uuid\n @uuid = Uuid.find(params[:id])\n end", "def new_uuid\n UUIDTools::UUID.timestamp_create.hexdigest\n end", "def create_uuid_for_id\n if self.id.nil?\n self.id = SecureRandom.uuid\n #self.id = SecureRandom.uuid.gsub('-','').upcase\n end\n end", "def set_uuid\n self.id ||= SecureRandom.uuid\n end", "def uuid; end", "def uuid; end", "def to_param\n uuid\n end", "def to_param\n uuid\n end", "def to_param\n uuid\n end", "def uuid() = @uuid ||= SecureRandom.uuid", "def set_uuid\n self.uuid ||= SecureRandom.uuid\n end", "def uuid!\n @uuid ||= ::UUID.timestamp_create.to_s\n end", "def to_param\n uuid\n end", "def generate_uuid\n# self[:uuid] = UUID.sha1_create(UUID_OID_NAMESPACE, Time.now.utc.to_f.to_s).to_s\n end", "def set_uuid\n self.uuid = SecureRandom.uuid unless uuid =~ REGEX\n true\n end", "def assign_uuid\n self.uuid = UUIDTools::UUID.random_create.to_s\n self.document_number ||= Numerator.get_number\n end", "def to_param\n uuid\n end", "def create_guid\n self.guid = SecureRandom.uuid\n end", "def set_random_uuid\n self.uuid = SecureRandom.uuid\n end", "def uuid\n hex = ((0..15).to_a).zip((('0'..'9').to_a).concat(('a'..'f').to_a)).to_h\n result = \"\"\n 32.times do\n result << hex[rand(0..15)]\n end\n result.insert(8, '-')\n result.insert(13, '-')\n result.insert(18, '-')\n result.insert(23, '-')\n result\nend", "def uuid\n SecureRandom.uuid\nend", "def to_uri\n\"urn:uuid:\" + self.to_s\nend", "def test_id_to_uuid\n url = \"https://vault.heroku.com/apps/1234\"\n uuid = UUIDTools::UUID.sha1_create(UUIDTools::UUID_URL_NAMESPACE, url).to_s\n assert_equal(uuid, Vault::App.id_to_uuid(1234))\n end", "def UUID()\n uuid=SecureRandom.base64(32).gsub(\"/\",\"_\").gsub(/=+$/,\"\")\n end", "def generate_uuid\n hexadecimals = ('0'..'9').to_a.concat(('a'..'f').to_a)\n uuid = ''\n\n 32.times do\n uuid += hexadecimals.sample\n end\n uuid.insert(8, '-').insert(13, '-').insert(18, '-').insert(23, '-')\nend", "def get_new_uuid\n uuid = UUID.new\n return uuid.generate\n end", "def create_guid\n self.id ||= UUIDTools::UUID.random_create.to_s\n end", "def create_uuid\n characters = [*'a'..'f', *'0'..'9']\n \"#{characters.sample(8).join}-#{characters.sample(4).join}-#{characters.sample(4).join}-#{characters.sample(4).join}-#{characters.sample(12).join}\"\nend", "def uuid=(uuid)\n pattern = Regexp.new(/^$|^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/)\n if !uuid.nil? && uuid !~ pattern\n fail ArgumentError, \"invalid value for \\\"uuid\\\", must conform to the pattern #{pattern}.\"\n end\n\n @uuid = uuid\n end", "def uuid= new_uuid\n abort_if_unsaved!\n\n uuid_value = Uuidify::Uuid.uuid_to_sql_string(new_uuid)\n \n Uuidify::Uuid.where(:model_name => self.class.to_s, :model_id => self.id).first_or_create!.update_column(:model_uuid, uuid_value)\n end", "def uuid\n id = ''\n id << %w(0 1 2 3 4 5 6 7 8 9 a b c d e f).sample until id.size >= 32\n 4.times { |i| id.insert(8+i*5, '-') }\n id\nend", "def normalize_uuid(key)\n norm_key = key.downcase.gsub(/[-\\s]/, '')\n if 10 == norm_key.length\n \"#{norm_key[0..2]}-#{norm_key[3..5]}-#{norm_key[6..9]}\"\n else\n key\n end\n end", "def set_identifier\n self.identifier ||= SecureRandom.uuid\n end", "def create_uuid\n SecureRandom.uuid\n end", "def set_uuid(uuid=create_uuid)\n field = model.uuid_field\n meth = :\"#{field}=\"\n if respond_to?(field) && respond_to?(meth) && (model.uuid_overwrite? || get_column_value(field).nil?)\n set_column_value(meth, uuid)\n end\n end", "def int_to_uuid(num)\n '00000000-0000-0000-0000-%012d' % num.to_i\n end", "def generate_uuid\n return Digest::MD5.hexdigest \"#{SecureRandom.hex(10)}-#{DateTime.now.to_s}\"\nend", "def new_uuid\n string_values = ['1','2','3','4','5','6','7','8','9','a','b','c','d','e','f']\n uuid = \"\"\n 8.times {uuid += string_values.sample}\n uuid += \"-\"\n 3.times\n 4.times {uuid+= string_values.sample}\n uuid += \"-\"\n 12.times {uuid += string_values.sample}\n uuid\nend", "def create_uuid\n hex = (\"a\"..\"f\").to_a\n (0..9).each{|num| hex << num.to_s}\n \n uuid = \"\"\n uuid_format = [8,4,4,4,12]\n uuid_format.each do |num|\n num.times{ uuid += hex.sample}\n uuid += \"-\" if uuid.length < 36\n end\n uuid\nend", "def short_uuid\n uuid[0..7]\n end", "def generate_uuid_for_string(string)\n ary = Digest::SHA256.hexdigest(string).unpack(\"NnnnnN\")\n ary[2] = (ary[2] & 0x0fff) | 0x4000\n ary[3] = (ary[3] & 0x3fff) | 0x8000\n sprintf \"%08x-%04x-%04x-%04x-%04x%08x\", *ary\n end", "def assign_identifier\n self.id ||= SecureRandom.uuid\n end", "def gen_uuid\n `uuidgen -t`.chomp.delete('-')\nend", "def uuid\n @__uuid__ ||= Util::UUID.generate\n end", "def generate_uuid\n if [nil, \"\"].include?(uuid)\n self.uuid = Vidibus::Uuid.generate\n end\n end", "def test_hid_to_uuid\n url = \"https://vault.heroku.com/apps/1234\"\n uuid = UUIDTools::UUID.sha1_create(UUIDTools::UUID_URL_NAMESPACE, url).to_s\n assert_equal(uuid, Vault::App.hid_to_uuid('app1234@heroku.com'))\n end", "def uuid\n\t\t\t@uuid ||= SecureRandom.uuid\n\t\tend", "def uuid\n return @entity.uuid if @entity.uuid\n\n uuid = @entity.url.gsub('https://ucarecdn.com/', '')\n uuid.gsub(%r{/.*}, '')\n end", "def make_uuid()\n uuid = \"\"\n 8.times { uuid << rand(16).to_s(16) }\n uuid << \"-\"\n 3.times do\n 4.times { uuid << rand(16).to_s(16) }\n uuid << \"-\"\n end\n 12.times { uuid << rand(16).to_s(16) }\n \n uuid\nend", "def generate_uuid\n chars = ('a'..'z').to_a + ('A'..'Z').to_a + ('0'..'9').to_a\n self.uuid = (0..UUID_LEN-1).collect { chars[Kernel.rand(chars.length)] }.join\n end", "def convert_uuid!(comment=nil)\n v = get(16).bytes.map{|x| \"%02x\" % x}\n vv = [\n v[0,4].join,\n v[4,2].join,\n v[6,2].join,\n v[8,2].join,\n v[10,6].join,\n ].join(\"-\")\n out_with_comment! \"<uuid>#{vv}</uuid>\", comment\n end", "def format_uuid(raw)\n raise \"Uuid must be 10 digits\" unless 10 == raw.length\n \n \"#{raw[0..2]}-#{raw[3..5]}-#{raw[6..9]}\"\n end", "def _uid(uuid = @uuid)\n uuid && uuid[0,6]\n end", "def set_guid\n \tif self.guid.nil?\n \t\t# we have a create (to whom ever is reading this, I am sure I could use something like before_create instead, but I prefer this more controlled method)\n \t\tself.guid = Digest::MD5.hexdigest(\"#{uid}--#{Time.now.to_i}\")\n \t\tend\n end", "def uuid\n char = (0..9).collect { |n| n.to_s }\n char += ('a'..'f').to_a\n blocks = [8,4,4,4,12]\n \n uuid = ''\n blocks.each do |num|\n while num >= 0\n uuid << char.sample\n num -= 1\n end\n uuid += '-' \n end\n uuid.chop\nend", "def make_uuid()\n hex_set = %w(a b c d e f 1 2 3 4 5 6 7 8 9)\n uuid_string = ''\n counter = 1 \n 5.times do\n case counter\n when 1\n hex = 8\n when (2..4)\n hex = 4\n when 5\n hex = 12\n end \n hex.times { uuid_string << hex_set[rand(hex_set.size)] } \n uuid_string << '-' unless counter == 5\n counter += 1\n end\n uuid_string\nend", "def get_uuid\n characters = ('0'..'9').to_a + ('a'..'f').to_a\n dash_positions = [8, 13, 18, 23]\n uuid = []\n\n 32.times do\n uuid.push(characters.sample)\n end\n uuid.each_with_index{ |char, ind| uuid.insert(ind, '-') if dash_positions.include?(ind) }\n uuid.join\nend", "def to_param\n if uuid_changed? and uuid_was and !Vidibus::Uuid.validate(uuid)\n uuid_was\n else\n uuid\n end\n end", "def create_uuid()\n characters = []\n ('a'..'z').each { |let| characters << let}\n ('0'..'9').each { |num| characters << num}\n\n uuid = \"\"\n sections = [8, 4, 4, 4, 12]\n sections.each_with_index do |num, index|\n num.times { uuid += characters.sample }\n uuid += '-' unless index >= sections.size - 1\n end\n\n uuid\nend", "def create_uuid\n uuid = ''\n sections = [8, 4, 4, 4, 12]\n\n sections.each do |section|\n section.times { uuid += HEX.sample }\n uuid += '-' unless section == 12\n end\n \n uuid\nend", "def uuid\n buffer = canonicalize_uuid random_bytes(16).bytes\n hex = buffer.map { |b| format('%02x', b) }.join\n [0..7, 8..11, 12..15, 16..19, 20..31].map { |r| hex[r] }.join('-')\n end", "def link!(resource, uuid)\n build_link(resource, uuid).save!\n end", "def generate_slug!\n\t\tself.slug = self.id.to_s(36)\n\t\tsave\n\tend", "def suuid; uuid; end", "def create_uuid\n characters = []\n (0..9).each { |digit| characters << digit.to_s }\n ('a'..'f').each { |digit| characters << digit }\n \n uuid = \"\"\n sections = [8, 4, 4, 4, 12]\n sections.each_with_index do |section, index|\n section.times { uuid += characters.sample }\n uuid += '-' unless index >= sections.size - 1\n end\n \n uuid\nend", "def uuid2\n hexchars = (('0'..'9').to_a).concat(('a'..'f').to_a)\n sections = [8, 4, 4, 4, 12]\n result = ''\n\n sections.each do |section|\n section.times do\n result << hexchars.sample.to_s\n end\n result << '-'\n end\n\n result.chop # to cut off trailing char\nend", "def generate_short_url\n self.update_attribute :short_url, self.class.convert_to_base62(self.id)\n end", "def get_uuid\n rand_str = SecureRandom.hex\n timestamp = Time.now.to_i.to_s\n\n rand_str + timestamp\n end", "def unique_identifier\n Digest::MD5.hexdigest(@name.to_s)[0..9]\n end", "def generate_short_url\n # encode base 10 id as base 62 string as seen here https://gist.github.com/zumbojo/1073996\n i = id\n return Constants::ALPHABET[0] if i.zero?\n s = ''\n base = Constants::ALPHABET.length\n while i > 0\n s << Constants::ALPHABET[i.modulo(base)]\n i /= base\n end\n update_attributes(short_url: s.reverse)\n end", "def generate_uuid\n t = Thread.current\n\n unless t.key? :opaque_id_base\n t[:opaque_id_base] = (SecureRandom.urlsafe_base64(12) + \"%08x\").freeze\n t[:opaque_id_counter] = -1\n end\n\n t[:opaque_id_counter] += 1\n t[:opaque_id_counter] = 0 if t[:opaque_id_counter] > COUNTER_MAX\n t[:opaque_id_base] % t[:opaque_id_counter]\n end", "def hash #:nodoc:\n uuid.hash\n end", "def unique_id(slug)\n Zlib.crc32 slug\n end", "def initialize\n @uuid = \"_\" + UUID.new.generate\n end", "def build_UUID\n uuid = \"\"\n segment = \"\"\n character_set = ('a'..'f').to_a + (0..9).to_a\n\n sections = [8, 4, 4, 4, 12]\n uuid = sections.map do |section|\n segment = \"\"\n section.times do \n segment += character_set.sample.to_s \n end\n segment\n end.join('-')\nend", "def create_UUID\n characters =[]\n (0..9).each { |digit| characters << digit.to_s }\n ('a'..'f').each { |digit| characters << digit }\n\n uuid = \"\"\n sections = [8, 4, 4, 4, 12]\n sections.each_with_index do |section, index|\n section.times { uuid += characters.sample }\n uuid += '-' unless index >= section.size - 1\n end\n\n uuid\nend", "def create_uuid()\n possibles = ('a'..'z').to_a.concat((1..9).to_a)\n portions = [8, 4, 4, 4, 12]\n\n uuid = portions.map do |portion|\n uuid_string = ''\n portion.times { uuid_string += possibles.sample.to_s }\n uuid_string\n end\n\n uuid.join('-')\nend", "def generate_slug\n if self.id_changed? && !self.slug_changed?\n # this should not happen on regular DB setup, just a bit of insurance\n throw 'ID exceeded the storage limit' if self.id > TICKET_ID_LIMIT\n\n shifted_id = (Rails.application.secrets.ticket[:shift] + self.id) % TICKET_ID_LIMIT\n\n chunk1 = shifted_id / SLUG_FIRST_MULTIPLIER\n rest1 = shifted_id % SLUG_FIRST_MULTIPLIER\n\n chunk2 = rest1 / SLUG_SECOND_MULTIPLIER\n chunk3 = rest1 % SLUG_SECOND_MULTIPLIER\n\n slug = [\n rand(BASE62_LIMIT).b(10).to_s(Radix::BASE::B62).rjust(3, '0'),\n chunk1.to_s(16).upcase().rjust(2, '0'),\n chunk2.b(10).to_s(Radix::BASE::B62).rjust(3, '0'),\n chunk3.to_s(16).upcase().rjust(2, '0'),\n rand(BASE62_LIMIT).b(10).to_s(Radix::BASE::B62).rjust(3, '0'),\n ].join('-')\n\n self.update_attribute(:slug, slug)\n end\n end", "def short_uuid\n rand(36**8).to_s(36)\n end", "def new_resource_id!\n uuid = Viziwiki::new_uuid\n # TODO write lock with create only\n #do\n # uuid = Viziwiki::new_uuid\n #unless lock_resource (uuid)\n uuid\n end", "def to_formatted_uuid\n if size == 16 \n FAST_UUID.uuid_to_formatted(self)\n else\n self.freeze \n end \n end", "def assign_uid\n chars = ('a'..'z').to_a + ('A'..'Z').to_a + ('0'..'9').to_a\n uid = ''\n 1.upto(8) {\n i = rand(62)\n uid += chars[i]\n }\n self.uid = uid\n end", "def generate_and_add_slug\n if self.slug.nil? || self.slug.empty?\n self.slug = SecureRandom.hex 16\n end\n self\n end", "def create_uuid\n options = ('a'..'f').to_a + (0..9).to_a\n uuid = \"\"\n sections = [8, 4, 4, 4, 12]\n sections.each_with_index do |section, index|\n section.times {uuid += options.sample.to_s}\n uuid += '-' unless index >= sections.size - 1\n end\n\n uuid\nend", "def set_unique_id\n self.update_column(:unique_id, Digest::MD5.hexdigest(self.id.to_s+Time.now.to_s))\n end", "def set_uuid(uuid)\n request = Packet.create_request(COMMAND_ID_CORE_SET_UUID)\n request.add_tlv(TLV_TYPE_UUID, uuid.to_raw)\n\n client.send_request(request)\n\n true\n end", "def unique_identifier\n @u_id ||= \"T1\"\n @u_id = @u_id.succ\n end", "def create_uuid\n hex = ('0'..'9').to_a + ('a'..'f').to_a\n uuid = ''\n sections = [8,4,4,4,12]\n sections.each_with_index do |section, index|\n section.times { uuid += hex.sample }\n uuid += '-' unless index == sections.size - 1\n end\n p uuid\nend" ]
[ "0.7151515", "0.7116209", "0.70197177", "0.6967005", "0.6967005", "0.69323456", "0.69114065", "0.69034666", "0.6880051", "0.6832904", "0.6822393", "0.6807721", "0.6758876", "0.6692003", "0.66883385", "0.6672042", "0.66676366", "0.66676366", "0.66215223", "0.66215223", "0.66215223", "0.66162354", "0.66063464", "0.6563112", "0.6555452", "0.6555194", "0.6532387", "0.6522961", "0.652292", "0.6495325", "0.6461056", "0.64487916", "0.6440246", "0.6430512", "0.6425399", "0.641723", "0.6396405", "0.6393675", "0.63569945", "0.6350265", "0.6347887", "0.631276", "0.6303424", "0.63009983", "0.6294132", "0.62892044", "0.62803185", "0.6261754", "0.6261552", "0.62537265", "0.6240723", "0.62323034", "0.6215095", "0.62088776", "0.62059283", "0.6192304", "0.61879265", "0.61832577", "0.61682665", "0.6148153", "0.6145852", "0.61446476", "0.6120248", "0.61140144", "0.61134243", "0.6086198", "0.6082883", "0.60826004", "0.60785383", "0.6077624", "0.6076633", "0.6076497", "0.6072751", "0.60608053", "0.6055065", "0.6042396", "0.6036816", "0.603572", "0.60329247", "0.6032261", "0.60313004", "0.60234094", "0.6021787", "0.6019921", "0.601881", "0.6010533", "0.6005717", "0.5989402", "0.5984625", "0.5979787", "0.5973933", "0.5968977", "0.5965767", "0.59541315", "0.59497786", "0.5948793", "0.5939688", "0.5933921", "0.59215623", "0.5917635" ]
0.73970217
0
Some attributes are mostly going to be the same or provided as default values. These attributes will be set automatically unless the items is set by the user.
def set_defaults self.help ||= ENV['help_text'] self.help_url ||= ENV['help_url'] self.created_at ||= DateTime.current end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_attrs\n @default_attrs\n end", "def allowed_attributes=(_arg0); end", "def allowed_attributes=(_arg0); end", "def set_default_attributes\n self.attributes = default_attributes\n self.attributes.each do |key, value|\n # Scrub the attributes if there's no value\n attr_clean!(key) unless value\n end\n end", "def set_default_attrs\n self.state = 'Texas' if self.respond_to? :state\n self.origin = 'hunted' if self.respond_to? :origin\n self.gender = 'male' if self.respond_to? :gender\n if self.respond_to? :parts\n parts = Part::NAMES.map { |part_name| {name: part_name} }\n parts << { other: true }\n self.parts = parts\n end\n if self.respond_to? :taxidermy_parts\n taxidermy_parts = self.class::DEFAULT_TAXIDERMY_PARTS.map { |part_name| {name: part_name} }\n taxidermy_parts << { other: true }\n self.taxidermy_parts = taxidermy_parts\n end\n self\n end", "def defaulted_attrs\n given_attrs.reject {|attr| send(\"given_#{attr}?\")}\n end", "def default_attributes(custom = {})\n {}\n end", "def attributes\n @attributes ||= begin\n attrs = {}\n self.class.key_attrs.values.each { |a| attrs[a.name] = a.initial_value }\n self.class.other_attrs.values.each { |a| attrs[a.name] = a.initial_value }\n attrs\n end\n end", "def default_attribute_values\n # GUID defaults to the url attribute\n self.guid = self.url if self.guid.blank?\n\n # title defaults to the url attribute\n self.title = self.url if self.title.blank?\n\n # if the url attr is not actually a valid URL but the guid is, url attr takes the value of the guid attr\n if !(UrlValidator.valid_entry_url?(self.url)) && UrlValidator.valid_entry_url?(self.guid)\n self.url = self.guid\n # If the url was blank before but now has taken the value of the guid, default the title to this value\n self.title = self.url if self.title.blank?\n end\n\n # published defaults to the current datetime\n self.published = Time.zone.now if self.published.blank?\n end", "def data_attrs(_item)\n {}\n end", "def default_attributes=(v)\n cfg_set(:default_attributes, v)\n end", "def initialize\n super\n self.class.attributes.reject { |attr| attr.default.nil? }.each do |attr|\n send(\"#{attr.method_name}=\", attr.default)\n end\n end", "def initialize_attributes()\n @attributes ||= {}\n merged_attributes = {}\n defaults = self.class.schema.defaults(self)\n\n # Merge the defaults in where attributes don't have a value defined.\n defaults.each do |name, value|\n merged_attributes[name] = attributes[name] || value\n end\n @attributes = merged_attributes\n end", "def attributes; @attributes ||= []; end", "def attributes_protected_by_default\n []\n end", "def tributes *attrs\n if attrs.empty? \n @tributes ||= []\n else \n @tributes = attrs\n super *attrs\n end \n end", "def default_attributes\n cfg_get(:default_attributes)\n end", "def attributes_protected_by_default\n []\n end", "def attributes=(params)\n end", "def default_attributes\n {}\n end", "def default_attributes\n cfg_get(:default_attributes)\n end", "def default_attributes\n {}\n end", "def default_attributes\n {}\n end", "def override\n attributes.override\n end", "def init_default_attributes\n self.config_params ||= DEFAULT_CONFIG_PARAMS\n self.has_inventory = true\n end", "def default_attributes=(v)\n cfg_set(:default_attributes, v)\n end", "def attributes # :nodoc:\n @attributes ||= {}\n end", "def attributes\n @attributes = @attributes || {}\n end", "def attributes=(_arg0); end", "def attributes\n @attributes ||= {\n 'id' => nil,\n 'dzi_url' => nil,\n 'thumbnail_url' => nil,\n 'isc_row' => nil\n }\n end", "def default_attributes\n @default_attributes ||= {}\n end", "def attributes\n @attributes ||= {}.freeze\n end", "def update_attributes(attrs)\n super({})\n end", "def readonly_attributes(*attrs)\n self.attribute_definitions_readonly ||= ['CreatedDateUTC', 'UpdatedDateUTC']\n self.attribute_definitions_readonly += attrs.flatten\n end", "def initialize(attributes = {})\n @attributes = attributes\n super @attributes.slice(*self.class.special_attrs).merge(data: @attributes.except(*self.class.special_attrs))\n end", "def attributes\n @attributes ||= {}\n end", "def attributes\n @attributes ||= {}\n end", "def attributes\n @attributes ||= {}\n end", "def attributes\n @attributes ||= {}\n end", "def attributes\n @attributes ||= {}\n end", "def attributes\n @attributes ||= {}\n end", "def attributes\n @attributes ||= {}\n end", "def attributes\n @attributes ||= {}\n end", "def default_model_attrs\n @default_model_attrs ||= begin\n config[:model].constantize.netzke_attributes.map do |attr| \n attr.merge(\n :label => attr[:label] || attr[:name].humanize,\n :attr_type => attr[:attr_type].to_s\n )\n end\n end\n end", "def html_attributes_options(options)\n html_options = options.stringify_keys!\n self.default_options = {'data-role' => \"listview\", 'data-inset' => \"true\"}\n\n if html_options.has_key?('data-inset')\n self.default_options = default_options.merge({'data-inset' => html_options['data-inset']})\n end\n\n if html_options.has_key?('data-theme')\n self.default_options = default_options.merge({'data-theme' => html_options['data-theme']})\n end\n\n if html_options.has_key?('data-rel')\n self.default_options = default_options.merge({'data-rel' => html_options['data-rel']})\n end\n\n if html_options.has_key?('data-transition')\n self.default_options = default_options.merge({'data-transition' => html_options['data-transition']})\n end\n\n end", "def valid_attributes\r\n {\r\n :item_id => 2,\r\n :seller_id => 1,\r\n :bid_amount => 100,\r\n :highest_bidder => 2,\r\n :state => 1,\r\n :end_time => Time.now\r\n }\r\n end", "def set_attrs\n @rrules ||= []\n @exrules ||= []\n @rdates ||= []\n @exdates ||= []\n end", "def other_attrs\n @other_attrs ||= {}\n end", "def set_default_attributes\n self.quantity = 1\n\n case self.purchasable.class\n when Package\n self.description = \"Upgrade package to #{self.purchasable.name}\"\n # Hitung kekurangan dari paket sebelumnya\n old_package = self.invoice.contest_upgrade.old_package\n new_package = self.invoice.contest_upgrade.new_package\n price = new_package.calculate_sell_price - old_package.calculate_sell_price\n self.upgrade_price = price\n self.transaction_fee = 300000\n when Feature\n self.description = \"Upgrade feature to #{self.purchasable.name}\"\n if !self.free_upgrade\n self.upgrade_price = self.purchasable.price\n else\n self.upgrade_price = 0\n end\n end\n\n end", "def preinitialize(attrs = nil)\n @attributes = {}\n end", "def attributes(*args)\n attr_accessor(*args)\n end", "def attributes\n @attributes ||= {}\n @attributes\n end", "def attributes\n @attributes ||= get_field_by_type(ATTRIBUTE_FIELDS)\n end", "def default_attrs\n attrs = model_class.column_names.collect(&:to_sym)\n attrs - [:id, :position, :password]\n end", "def default_attributes\n @attributes = {\n :project => @name,\n :prefix => @prefix,\n :repositories => @repositories,\n :source => @source_project,\n :target => @target_project,\n :creation_date => \"#{Time.now}\",\n :last_mirror => \"0\",\n :date => \"#{Time.now}\",\n }\n end", "def initialize_attributes(attributes); end", "def readonly_attributes(*attrs)\n @readonly_attributes ||= [:created_at, :updated_at, :completed_at]\n if attrs.any?\n @readonly_attributes.map!(&:to_sym).concat(attrs).uniq!\n setup_attributes(@readonly_attributes, true)\n end\n @readonly_attributes\n end", "def attributes= new_attributes\n ingest_attributes(new_attributes)\n end", "def input_attributes\n super || default_attributes\n end", "def attributes(attributes = nil)\n @attributes = attributes if attributes\n @attributes\n end", "def set_defaults\n if self.has_attribute?(:hidden) && self.hidden.nil?\n self.hidden = true\n end\n if self.has_attribute?(:base_price)\n self.base_price ||= 0.0\n end\n end", "def attrs_authoritative\n @authority = :attributes\n self\n end", "def initialize(args={})\n super(ATTR_DEFAULTS.merge(args))\n end", "def attributes\n attrs = super\n if attrs['user'] && attrs['user']['id']\n attrs.merge!('user_id' => attrs['user']['id'])\n attrs.delete 'user'\n end\n attrs\n end", "def initialize attributes = {}\n @attributes = {}\n attributes.each { |attribute, value| set attribute, value }\n end", "def initialize(attributes = (blank=true; nil))\n if !blank\n attributes.symbolize_keys.each do |property, attribute|\n self.send(:\"#{property}=\", attribute)\n end\n end\n end", "def set_default_values\n if self.price.nil?\n self.price = 0.0\n end\n if self.rating.nil?\n self.rating = 0\n end\n if self.enabled.nil?\n self.enabled = false\n end\n if self.no_of_reviews.nil?\n self.no_of_reviews = 0\n end\n if self.no_of_registrations.nil?\n self.no_of_registrations = 0\n end\n end", "def fixed_attributes\n @_fixed_attributes ||= FixedAttributes.new(self)\n end", "def protected_attributes=(attributes = nil)\n attributes = attributes.is_a?(Hash) ? attributes.symbolize_keys : {}\n send :attributes=, attributes.only(:author, :email, :summary, :content, :attachment), false\n end", "def aggregate_treat_undefined_attributes_as_default_value?; end", "def set_defaults\n if self.has_attribute?(:extra_cost)\n self.extra_cost ||= 0.0\n end\n if self.has_attribute?(:stock)\n self.stock ||= 0.0\n end\n end", "def attributes_protected_by_default\n [\"key\"]\n end", "def initialize attr={}\n super\n self.attributes = attr\n end", "def attributes(value)\n @attributes = value\n self\n end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def assign_defaults!(attrs, defaults)\n defaults.each do |key, value|\n key = key.to_s\n\n if attrs[key].nil?\n attrs[key] = value\n end\n end\n end", "def initialize(attributes = {})\n attr_with_defaults = {\n daily_reminder: true,\n weekly_reminder: true,\n mine_only: false\n }.merge(attributes)\n super(attr_with_defaults)\n end", "def initialize(args = {})\n super(ATTR_DEFAULTS.merge(args))\n end", "def initialize(args = {})\n super(ATTR_DEFAULTS.merge(args))\n end", "def initialize(args = {})\n super(ATTR_DEFAULTS.merge(args))\n end", "def initialize(args = {})\n super(ATTR_DEFAULTS.merge(args))\n end", "def initialize(args = {})\n super(ATTR_DEFAULTS.merge(args))\n end", "def initialize(args = {})\n super(ATTR_DEFAULTS.merge(args))\n end", "def set_default_attribute_values(product)\n product.status = 1 if product.status.nil?\n product.visibility = self.simple_product_visibility.to_i\n\n if product.url_key.nil?\n url_key = product.name.to_s.strip.gsub(' ', '-').gsub(/[^\\w\\s]/, '').downcase\n product.set_attribute_value('url_key', url_key)\n end\n\n return product\n end", "def attributes=(*args)\n define_dynamic_answer_setters!\n super(*args)\n end", "def attributes(requested_attrs = nil, reload = false)\n @attributes = nil if reload\n @attributes ||= self.class._attributes_data.each_with_object({}) do |(key, attr), hash|\n next if attr.excluded?(self)\n next unless requested_attrs.nil? || requested_attrs.include?(key)\n hash[key] = attr.value(self)\n end\n end", "def create_attrib_item_values \n @base_attribs = []\n @attribs = params[:attrib]\n @attribs.keys.each do | key |\n @base_attribs << AttribItemValue.new(attrib_id: key, value: @attribs[key])\n #puts \"AttribItemValue: #{@base_attribs.last.attrib.id}, #{@base_attribs.last.value}\"\n end if @attribs\n #puts \"Attribs: #{@attribs}, @base_attribs: #{@base_attribs.size}\"\n modified_item_parms = item_params\n modified_item_parms[:attrib_values] = @base_attribs\n modified_item_parms\n end", "def set_attributes\n attributes :all\n end", "def attributes_protected_by_default\n ['id']\n end", "def safe_attributes=(attrs, user=User.current)\n if attrs.respond_to?(:to_unsafe_hash)\n attrs = attrs.to_unsafe_hash\n end\n\n return unless attrs.is_a?(Hash)\n\n if attrs['custom_field_values'].present?\n editable_custom_field_ids = editable_custom_field_values(user).map {|v| v.custom_field_id.to_s}\n attrs['custom_field_values'].select! {|k, v| editable_custom_field_ids.include?(k.to_s)}\n end\n\n if attrs['custom_fields'].present?\n editable_custom_field_ids = editable_custom_field_values(user).map {|v| v.custom_field_id.to_s}\n attrs['custom_fields'].select! {|c| editable_custom_field_ids.include?(c['id'].to_s)}\n end\n\n super(attrs, user)\n end", "def default_values\n self.priority ||= 0\n rescue ActiveModel::MissingAttributeError\n # This can be safely ignored: error is thrown only when NavItem.exists?() is called, because the\n # priority field isn't fetched\n end" ]
[ "0.70964587", "0.7087375", "0.7087375", "0.7031612", "0.7017653", "0.68992895", "0.68605715", "0.68526745", "0.67591155", "0.67345536", "0.6711007", "0.670625", "0.6694168", "0.6682259", "0.6671146", "0.6647209", "0.66237515", "0.66184133", "0.6611895", "0.66052705", "0.6532773", "0.652558", "0.652558", "0.6521467", "0.6517805", "0.65114695", "0.6472159", "0.64655536", "0.6456236", "0.6444277", "0.6414591", "0.64116377", "0.6362869", "0.63541836", "0.634647", "0.6344548", "0.6344548", "0.6344548", "0.6344548", "0.6344548", "0.63255066", "0.63255066", "0.63255066", "0.6316777", "0.63138723", "0.6301879", "0.6288077", "0.62790614", "0.6272673", "0.6270733", "0.62572044", "0.6251343", "0.62510824", "0.62491655", "0.62418103", "0.6241404", "0.62368286", "0.6230806", "0.62251914", "0.62230694", "0.6220134", "0.6214781", "0.62108254", "0.6207066", "0.6207007", "0.6205745", "0.61946774", "0.619317", "0.61859524", "0.61856174", "0.61843395", "0.6183043", "0.6180203", "0.61800045", "0.61654747", "0.61654747", "0.61654747", "0.61654747", "0.61654747", "0.61654747", "0.61654747", "0.61654747", "0.61654747", "0.61654747", "0.61654747", "0.61603934", "0.6160164", "0.6145361", "0.6145361", "0.6145361", "0.6145361", "0.6145361", "0.6145361", "0.6142825", "0.6135798", "0.6129937", "0.61157763", "0.61094666", "0.61039793", "0.6095351", "0.6091288" ]
0.0
-1
Sanitize the Description field
def sanitize_description self.description = Sanitize.fragment(self.description, Sanitize::Config::BASIC) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_description\n ActionView::Base.full_sanitizer.sanitize(description)\n end", "def sanitize_description(description)\n ActionController::Base.helpers.strip_tags(description)\n end", "def sanitize(str)\n DescriptionSanitizer.new.sanitize(str)\n end", "def strip_html_from_description\n self.description = ActionView::Base.full_sanitizer.sanitize(description)\n end", "def description= desc\n super(Rails::Html::FullSanitizer.new.sanitize(desc))\n end", "def clean_description(description)\n description.sub(/^<p>/, \"\").sub(/<\\/p> ?(\\n)?$/, \"\")\n end", "def prepare_description(description)\n # replace all the new line equivalents in html with \\n's\n desc = description.gsub(/<br\\/?>/, \"\\n\")\n desc = desc.gsub(\"<p></p>\", \"\\n\")\n \n # strip out all the rest of html tags\n desc = desc.gsub(/<\\/?[^>]*>/, \"\")\n desc = desc.gsub(\"&nbsp;\", \"\")\n \n # decode all special character symbols back into text\n return CGI::unescapeHTML(desc)\n end", "def raw_description\n if self.description\n Helper.strip_html(self.description).gsub(/\\s+/,\" \").strip\n else\n nil\n end\n end", "def clean_up_description\n self.description = CoursemologyFormatter.clean_code_block(description)\n end", "def clean_up_description\n self.description = CoursemologyFormatter.clean_code_block(description)\n end", "def sanitize_details\n self.details = ActionController::Base.helpers.sanitize(details, { :tags => ALLOWED_HTML_TAGS_IN_DETAILS } )\n end", "def run_clean_short_description\n self.short_description = HtmlMaid.clean_short_description(self.short_description)\n end", "def seo_desc(description)\n return \"\" if description.empty?\n\n truncate(strip_tags(description.gsub(\"\\n\", \" \").strip))\n end", "def _validate_description(d)\n if d == spec.summary\n results.add_warning('description', 'The description is equal to' \\\n ' the summary.')\n end\n\n if d.strip.empty?\n results.add_error('description', 'The description is empty.')\n elsif spec.summary && d.length < spec.summary.length\n results.add_warning('description', 'The description is shorter ' \\\n 'than the summary.')\n end\n end", "def description\n document.at(\"[@id='description']/span[1]\").innerHTML.goodreads_strip_tags.goodreads_strip_bad_description_content rescue nil\n end", "def formatted_description\n CGI.escapeHTML(description).split(/\\n|\\r\\n?/).join(\"<br />\").html_safe\n end", "def description\n desc = object.description.to_s\n desc = h.strip_tags(markdown.render(desc)).strip # Escape HTML and remove Markdown\n\n if desc.blank? or [\"[!\", \"[](\", \"===\", \"```\"].any? { |s| desc.include? s }\n \"<em>#{ DESCRIPTION_UNAVAILABLE }</em>\".html_safe\n else\n desc = \"#{ desc }.\" if /\\w/ =~ desc.last # Add trailing dot\n desc[0] = desc[0].upcase # Capitalize 1st letter\n desc.html_safe\n end\n end", "def sanitize_content\n self.title = helpers.sanitize(self.title)\n self.user_name = helpers.sanitize(self.user_name)\n end", "def sanitize\n self.summary = sanitize_string(summary)\n self.description = sanitize_string(description)\n self.post_install_message = sanitize_string(post_install_message)\n self.authors = authors.collect {|a| sanitize_string(a) }\n end", "def sanitize_data\n self.permalink = name if permalink.blank? && name\n self.permalink = permalink.squeeze(\" \").strip.gsub(' ', '-') if permalink\n if meta_keywords.blank? && description\n self.meta_keywords = [name[0..55],\n description.\n gsub(/\\d/, \"\"). # remove non-alpha numeric\n squeeze(\" \"). # remove extra whitespace\n gsub(/<\\/?[^>]*>/, \"\"). # remove hyper text\n split(' '). # split into an array\n map{|w| w.length > 2 ? w : ''}. # remove words less than 2 characters\n join(' ').strip[0..198] # join and limit to 198 characters\n ].join(': ')\n end\n self.meta_description = [name[0..55], description.gsub(/<\\/?[^>]*>/, \"\").squeeze(\" \").strip[0..198]].join(': ') if name.present? && description.present? && meta_description.blank?\n end", "def handle_nil_description\n self.description = \"\" if description.nil?\n end", "def handle_nil_description\n self.description = \"\" if description.nil?\n end", "def handle_nil_description\n self.description = \"\" if description.nil?\n end", "def short_description\n if self.description.nil?\n nil\n else\n self.description[%r{^[^\\n\\r]*}]\n end\n end", "def description\n desc = details.at(\"div.summary_text[itemprop='description']\").text.strip.clean_description rescue nil\n (desc.nil? || desc.empty?) ? nil : desc\n end", "def clear_desc_helper(description)\n return \"N/A\" if description.nil? || description.empty?\n\n tmp = description.dup\n tmp = tmp.delete \"#{1.chr}-#{31.chr}\".split.join ' '\n\n return tmp\n end", "def share_description(value) \n raw(value).gsub(\"<br>\", \" \").gsub(\"<br />\", \" \")\n end", "def remove_whitespace\n self.description = self.description.strip\n end", "def share_description(value)\n raw(value).gsub(\"<br>\", \" \").gsub(\"<br />\", \" \")\n end", "def sanitize_attributes\n if self.sanitize_level\n self.description = Sanitize.clean(self.description, self.sanitize_level)\n self.name = Sanitize.clean(self.name, self.sanitize_level)\n end\n end", "def to_description(text)\n text.strip.gsub(/\\s+/, ' ')\n end", "def filter_description(text, readmore, url)\n if text\n _text = Sanitize.fragment(text[0...1000] + '&hellip;', Sanitize::Config::RELAXED)\n if readmore && url\n _text = \"#{_text} <p><a class=\\\"event-read-more\\\" href=\\\"#{url}\\\">#{readmore}</a></p>\"\n end\n _text\n else\n \"<p><a class=\\\"event-read-more\\\" href=\\\"#{url}\\\">#{readmore}</a></p>\"\n end\nend", "def description\n text_attribute('description')\n end", "def validate_description\n if self.description.match(/<a[^<>]*>|\\&lt;a[^<>]*\\&gt;/i)\n return false \n else\n return true\n end\n end", "def line_item_description_text(description_text)\n if description_text.present?\n truncate(strip_tags(description_text.gsub('&nbsp;', ' ')), length: 100)\n else\n t('spree.product_has_no_description')\n end\n end", "def prog_alphanum_description\n if description !~ /[[:alnum:]]/\n errors.add(:description, \"can only contain letters or numbers\")\n end\n end", "def sanitize_attributes\n %w(author title description keyword).each do |field|\n self.send(\"#{field}=\",HTMLEntities.new.decode(self.send(field)))\n end\n end", "def html_description2\n ::Util.simple_format(self.description2)\n end", "def description_length\n \tif description.length > 80\n \t\terrors.add(:description, \"La descripción no puede ser mayor a 80 caracteres\")\n \tend\n end", "def clean\n self.short_msg = sanitize(short_msg)\n self.long_msg = sanitize(long_msg)\n end", "def get_description(tds)\n return CGI::unescapeHTML(clean_whitespace(tds[3].at('span').inner_text))\nend", "def get_description(tds)\n return CGI::unescapeHTML(clean_whitespace(tds[3].at('span').inner_text))\nend", "def format_description_title(obj)\n obj = obj.description if obj.respond_to?(:description)\n obj = obj.gsub(/\\s/i, ' ')\n obj.truncate(200, separator: ' ')\n end", "def format_title_description\n if description.present? && title.present?\n self.description = description.strip.capitalize\n self.title = title.strip.capitalize\n end\n end", "def format_title_description\n if description.present? && title.present?\n self.description = description.strip.capitalize\n self.title = title.strip.capitalize\n end\n end", "def format_title_description\n if description.present? && title.present?\n self.description = description.strip.capitalize\n self.title = title.strip.capitalize\n end\n end", "def set_meta_description\n html = html_overview || html_content || ''\n\n self.meta_description =\n html.\n gsub(/<\\/?[^>]*>/, ' '). # replace HTML tags with spaces\n gsub(/&\\w{1,9};|\"/, ''). # remove HTML special chars and double quotes\n gsub(/\\n+/, \" \"). # remove new lines\n gsub(/\\s+/, ' '). # remove duplicated spaces\n strip[0..200] # strip spaces and get first 200 chars\n end", "def descr_short\n descr = self[:descr].to_s.gsub(\"\\n\", \" \").gsub(/\\s{2,}/, \" \")\n descr = Knj::Strings.shorten(descr, 20)\n #descr = \"[#{_(\"no description\")}]\" if descr.to_s.strip.length <= 0\n return descr\n end", "def format_plain\n return \"\" if description.blank?\n\n # remove all tags, but no need or desire to escape punctuation etc into HTML entities\n str = Loofah.fragment(description).text(:encode_special_chars => false)\n\n if @truncate\n str = \"#{truncate(str, escape: false, length: @truncate, separator: /\\s/)}\"\n end\n\n return str\n end", "def description\n fields['description']\n end", "def sanitize_metadata\n return unless metadata_changed?\n sanitizers = {\n 'title' => [:html_entities],\n 'notes' => [:html, :css],\n 'endnotes' => [:html, :css],\n 'summary' => [:html]\n }\n sanitizers.each do |field, sanitizers|\n value = metadata[field]\n next if value.blank?\n self.metadata[field] = sanitized_value(value, sanitizers)\n end\n sanitize_associations\n end", "def description_html\n convert_html description\n end", "def sanitize!; end", "def formatted_scenario_description(description)\n # First check if the description has a div matching the current locale,\n # indicating that a localized version is available.\n localized = Loofah.fragment(description).css(\".#{I18n.locale}\")\n\n rendered = RDiscount.new(\n localized.inner_html.presence || description,\n :no_image, :smart\n ).to_html\n\n Rails::Html::SafeListSanitizer.new.sanitize(\n strip_external_links(rendered)\n ).html_safe\n end", "def description_present\n if description.blank?\n errors.add(:description, \"Can't be empty\")\n end\n end", "def truncate_short_description\n if self.short_description\n self.short_description = self.short_description[0..64]\n end\n end", "def sanitize_data\n sanitize_permalink\n assign_meta_keywords if meta_keywords.blank? && description\n sanitize_meta_description\n end", "def sanitize_bio(bio)\n permit_scrubber = Rails::Html::PermitScrubber.new\n permit_scrubber.tags = %w(h3 h4 p ul li ol strong em span sup sub)\n sanitize bio, tags: %w(h3 h4 p ul li ol strong em span sup sub), scrubber: permit_scrubber\n end", "def construct_supply_item_description(data)\n @description = @description.strip\n @description = @description.gsub(\"ß\",\"ss\")\n return @description\n end", "def html_to_rss_description(input)\n html = Loofah.fragment(input)\n html.scrub!(Scrubber.new)\n html.to_s\n end", "def set_Description(value)\n set_input(\"Description\", value)\n end", "def set_Description(value)\n set_input(\"Description\", value)\n end", "def set_Description(value)\n set_input(\"Description\", value)\n end", "def set_Description(value)\n set_input(\"Description\", value)\n end", "def set_Description(value)\n set_input(\"Description\", value)\n end", "def set_Description(value)\n set_input(\"Description\", value)\n end", "def set_Description(value)\n set_input(\"Description\", value)\n end", "def set_Description(value)\n set_input(\"Description\", value)\n end", "def set_Description(value)\n set_input(\"Description\", value)\n end", "def set_Description(value)\n set_input(\"Description\", value)\n end", "def set_Description(value)\n set_input(\"Description\", value)\n end", "def set_Description(value)\n set_input(\"Description\", value)\n end", "def _validate_summary(s)\n if s.length > 140\n results.add_warning('summary', 'The summary should be a short ' \\\n 'version of `description` (max 140 characters).')\n end\n if s =~ /A short description of/\n results.add_warning('summary', 'The summary is not meaningful.')\n end\n end", "def description\n description = \"\"\n end", "def validate_and_sanitize\n super\n end", "def set_Description(value)\n set_input(\"Description\", value)\n end", "def trim_desc(s)\n if s && s.length > 0\n s[0..254]\n else\n s\n end\n end", "def sanitize_attributes\n # Summary, content are sanitized with an HTML sanitizer, we want imgs etc to be present.\n # Other attributes are sanitized by stripping tags, they should be plain text.\n self.content = Sanitizer.sanitize_html self.content\n self.summary = Sanitizer.sanitize_html self.summary\n\n self.title = Sanitizer.sanitize_plaintext self.title\n self.author = Sanitizer.sanitize_plaintext self.author\n self.guid = Sanitizer.sanitize_plaintext self.guid\n self.url = Sanitizer.sanitize_plaintext self.url\n end", "def description\n field[:description]\n end", "def product_description(product)\n product.description.gsub(/^(.*)$/, '<p>\\1</p>')\n end", "def description(text='')\n return @description if text.blank?\n @description = text\n end", "def description(description)\n rules.last.description = description\n end", "def filtered_description(regexp)\n build_description_from(\n *nested_descriptions.collect do |description|\n description =~ regexp ? $1 : description\n end\n )\n end", "def description=(description)\n end", "def description\n unescape params['x_description']\n end", "def short_description(description)\n if description != nil\n \"#{description[0..25]}...\"\n else\n \"No description yet...\"\n end\n end", "def sanitize_data(value)\n HtmlSanitizer.sanitize(value)\n end", "def description\n read_attribute(:description).presence || self.original_description\n end", "def description; attributes[:description] || attributes[:desc] end", "def setDescription(description)\n @description = description.to_s\n end", "def sanitize_from_db(text, allowed_tags = NB.allowed_html_tags)\n text = sanitize_from_evernote(text)\n text = text.gsub(/#{ NB.truncate_after_regexp }.*\\Z/m, '')\n .gsub(/<br[^>]*?>/, \"\\n\")\n .gsub(/<b>|<h\\d>/, '<strong>')\n .gsub(%r{</b>|</h\\d>}, '</strong>')\n # OPTIMIZE: Here we need to allow a few more tags than we do on output\n # e.g. image tags for inline image.\n text = sanitize_by_settings(text, allowed_tags)\n text = format_blockquotes(text)\n text = format_code(text)\n text = remove_instructions(text)\n end", "def check_description(description)\r\n # Return error message if description is blank.\r\n return \"Description cannot be blank.\" if description == \"\"\r\n # Return error message if description is too long.\r\n if description.length > 140\r\n return \"Description was #{description.length} characters long; cannot exceed 140.\"\r\n end\r\n # Otherwise \"ok\"\r\n return \"ok\"\r\n end", "def description=(val)\n self[:description] = val\n end", "def description=(v)\n @description = v\n end", "def sanitize_as_html!\n Engine.clean!(self)\n end", "def sanitize_as_html!\n Engine.clean!(self)\n end", "def description_text\n\t\t\tif @data[\"description\"] \n\t\t\t\thtml_data = @data[\"description\"][\"text\"] \n\t\t\t\tparsed_data = Nokogiri::HTML(html_data)\n\t\t\t\tparsed_data.text\n\t\t\tend\n\t\tend", "def sanitize_params(form_params)\n super.tap do |params|\n params['title'] = Array.wrap(params['title']) if params.key?('title')\n params['description'] = Array.wrap(params['description']) if params.key?('description')\n end\n end", "def sanitize_inputs\n attributes.each do |attr_name, attr_value|\n next unless attr_value.is_a? String\n self[attr_name] = strip_markup attr_value\n end\n end", "def description(value)\n @ole.Description = value\n nil\n end" ]
[ "0.86052674", "0.818869", "0.79620963", "0.79508424", "0.7610957", "0.7522478", "0.73051304", "0.72501075", "0.7115807", "0.7115807", "0.7077657", "0.7049413", "0.688072", "0.6849992", "0.68337715", "0.67843926", "0.67068034", "0.66686803", "0.6633985", "0.6612287", "0.65980667", "0.65980667", "0.65980667", "0.6567012", "0.6559328", "0.65490973", "0.6500562", "0.6493904", "0.6477978", "0.6471336", "0.6450603", "0.64448494", "0.63986343", "0.6380241", "0.63249034", "0.63242126", "0.6315694", "0.63050795", "0.6283113", "0.6278397", "0.6272738", "0.6272738", "0.62481433", "0.62481", "0.62481", "0.62477237", "0.6239431", "0.62323266", "0.6221536", "0.61820674", "0.6165809", "0.6151893", "0.615019", "0.6150024", "0.61494005", "0.61439246", "0.6138419", "0.6124766", "0.61226773", "0.6122375", "0.6099117", "0.6099117", "0.6099117", "0.6099117", "0.6099117", "0.6099117", "0.6099117", "0.6099117", "0.6099117", "0.6099117", "0.6099117", "0.6099117", "0.6094647", "0.60701954", "0.6061995", "0.6052279", "0.6051566", "0.6040164", "0.60309726", "0.6028862", "0.60280097", "0.6026539", "0.6017893", "0.6013767", "0.6005533", "0.60027313", "0.5998037", "0.5993877", "0.59919935", "0.5982845", "0.5971883", "0.59669125", "0.5956238", "0.59539926", "0.5952139", "0.5952139", "0.59433895", "0.5942462", "0.59183216", "0.5916826" ]
0.85810536
1
2. From all the built in Ruby methods we've seen in class this week, choose three that you think are particularly helpful and create examples to show how they work. your three built in ruby methods
def add(a, b) a + b end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def how_it_works\r\n end", "def who_we_are\r\n end", "def methods; end", "def methods; end", "def methods; end", "def methods; end", "def methods() end", "def romeo_and_juliet; end", "def herald; end", "def probers; end", "def operations; end", "def operations; end", "def implementation; end", "def implementation; end", "def jack_handey; end", "def helpers; end", "def helpers; end", "def helpers; end", "def print4(nyc)\n\t4.times do puts nyc\n\n\tend\n\n#Prints an uppercase version of the argument given\ndef printupcase (live)\n\n\tputs live.upcase\nend\n\n#Object with two attributes and one method.\n\nclass Dog\nattr_accessor :name, :trait\n\nend\n\nfirst_dog = Dog.new\nfirst_dog.name = \"Bob\"\nfirst_dog.trait = \"annoying\"\n\ndef bark\n\tputs \"au au au\"\n\nend\nend", "def usage; end", "def usage; end", "def alternatives; end", "def custom; end", "def custom; end", "def r; end", "def r; end", "def private; end", "def what_is\n end", "def hello_world # \"def\" is short for \"defining a method\" and we are\n # defining a method called \"hello_world\"\n\n puts \"Hello World!\" # \"puts\" is used to print a value, which in our\n # our case is \"Hello World!\"\n\nend", "def king_richard_iii; end", "def most_interesting_man_in_the_world; end", "def bornin _method, _class = [\n Fixnum,\n Float,\n String,\n Array,\n Hash,\n Range,\n Regexp,\n Math\n]\n\n # to colorize output\n require 'colorize'\n\n # Check\n if _method==nil\n return puts \"=> please pass first arg as a string\".red\n end\n\n # the patten to grep for\n re = Regexp.new '^' + _method.to_s + '$'\n\n # born in BasicObject?\n if BasicObject.instance_methods(false).grep(re).size==1\n return puts \"=> #{_method} : \" +\n \". born in BasicObject as an instance method\".green\n # born in Kernel?\n elsif Kernel.instance_methods(false).grep(re).size==1\n return puts \"=> #{_method} : \" +\n \".. born in Kernel as an instance method\".green\n # born in Object?\n elsif Object.instance_methods(false).grep(re).size==1\n return puts \"=> #{_method} : \" +\n \"... born in Object as an instance method\".green\n # born in Module?\n elsif Module.instance_methods(false).grep(re).size==1\n return puts \"=> #{_method} : \" +\n \".... born in Module as an instance method\".green\n end\n\n # puts \"check what class is _class\"\n # check what class is _class\n if _class.class == String\n _class = eval(_class)\n elsif _class.class == Symbol\n _class = Kernel.const_get(_class.to_s)\n # relying on some very basic classes listed above when\n # _class was not passed as a param\n elsif _class.is_a? Array\n _class.each do |e|\n # puts \"Checking #{_method} in #{e} ...\"\n output = bornin2 _method, e\n output || break\n # return\n end\n else\n bornin2 _method, _class\n end\n\nend", "def weber; end", "def troop; end", "def main; end", "def apis; end", "def spice; end", "def what_am_i arg arg2\n \nend", "def p15\n\t\nend", "def scientist; end", "def silly_adjective; end", "def main\n\n end", "def ninety_nine_bottles_of_beer\nend", "def ninety_nine_bottles_of_beer\nend", "def ninety_nine_bottles_of_beer\nend", "def returns; end", "def overload; 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 specie; end", "def specie; end", "def specie; end", "def specie; end", "def villian; end", "def algorithms; end", "def algorithms; end", "def algorithms; end", "def algorithms; end", "def algorithms; end", "def gounod; end", "def heroine; end", "def anchored; end", "def main\n end", "def spouse; end", "def basic_feature(str)\n\tputs str + \" \" + str\n\tputs str * 3\n\tputs \"1\" + \"2\"\n\tputs \"1\" * 2\n\tputs str.size\n\tputs str.length\n\tputs str.capitalize\n\tputs str.reverse\n\tputs str.upcase\n\tputs str.downcase\n\tputs str.swapcase\nend", "def greeting(name)\n \"Hello and welcome to Ruby methods \" + name + \"!\"\nend", "def desc; end", "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 test_turn_putter_both\n pros = Prospector.new(0,0,0)\n assert pros.turn_putter(1,1).eql? \"\\tFound 1 ruby and 1 fake ruby in Enumerable Canyon\"\n end", "def berlioz; end", "def food_and_drink; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end" ]
[ "0.6660938", "0.6354154", "0.6224412", "0.6224412", "0.6224412", "0.6224412", "0.62087953", "0.61798763", "0.61152893", "0.60634315", "0.60519683", "0.60519683", "0.60419756", "0.60419756", "0.60176784", "0.5984283", "0.5984283", "0.5984283", "0.5979311", "0.59777045", "0.59777045", "0.5969681", "0.594951", "0.594951", "0.59349954", "0.59349954", "0.59325033", "0.592498", "0.592322", "0.5910234", "0.5898452", "0.588685", "0.5878568", "0.58689845", "0.58601874", "0.58530426", "0.5847393", "0.5827857", "0.57934403", "0.5791568", "0.578935", "0.57771146", "0.5774656", "0.5774656", "0.5774656", "0.57550806", "0.5754474", "0.573337", "0.573337", "0.573337", "0.573337", "0.573337", "0.573337", "0.573337", "0.573337", "0.573337", "0.573337", "0.573337", "0.573337", "0.5719216", "0.5719216", "0.5719216", "0.5719216", "0.571496", "0.56935877", "0.56935877", "0.56935877", "0.56935877", "0.56935877", "0.56899494", "0.5688272", "0.56869066", "0.56828594", "0.5681791", "0.56801665", "0.56765413", "0.56145304", "0.5614079", "0.55935186", "0.5593075", "0.5581517", "0.5578914", "0.5578914", "0.5578914", "0.5578914", "0.5578914", "0.5578914", "0.5578914", "0.5578914", "0.5578914", "0.5578914", "0.5578914", "0.5578914", "0.5578914", "0.5578914", "0.5578914", "0.5578914", "0.5578914", "0.5578914", "0.5578914", "0.5578914" ]
0.0
-1
GET /address_ranges/data.xml def data network_id = params[:id].split[0] site_id = params[:id].split[1] subnet_id = params[:id].split[2] if !subnet_id.nil? then
def dbaction # supporting code for dhtmlx db/grid #called for all db actions subnet_id = params[:id].split[2] first_address = params["c0"] last_address = params["c1"] description = params["c2"] @mode = params["!nativeeditor_status"] @id = params["gr_id"] case @mode when "inserted" address_range=AddressRange.new address_range.subnet_id = subnet_id address_range.first_address = first_address address_range.last_address = last_address address_range.description = description address_range.save! @tid = address_range.id when "deleted" address_range=AddressRange.find(@id) address_range.destroy @tid = @id when "updated" address_range=AddressRange.find(@id) address_range.subnet_id = subnet_id address_range.first_address = first_address address_range.last_address = last_address address_range.description = description address_range.save! @tid = @id end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subnet_id\n data[:subnet_id]\n end", "def addresses\n nodename = params[:node_id]\n @node = nodename == \"admin\" ? Node.admin.where(:available => true).first : Node.find_key(nodename)\n if params[:network]\n @net = Network.find_key(params[:network])\n res = {\n \"node\" => @node.name,\n \"network\" => @net.name,\n \"category\" => @net.category,\n \"addresses\" => @net.node_allocations(@node).map{|a|a.to_s}\n }\n render :json => res, :content_type=>cb_content_type(:addresses, \"object\")\n else\n res = []\n\n if params[:category]\n nets = Network.in_category(params[:category])\n else\n nets = Network.all\n end\n\n nets.each do |n|\n ips = n.node_allocations(@node)\n next if ips.empty?\n\n res << {\n \"node\" => @node.name,\n \"network\" => n.name,\n \"category\" => n.category,\n \"addresses\" => ips.map{|a|a.to_s}\n }\n end\n\n render :json => res, :content_type=>cb_content_type(:addresses, \"array\")\n end\n end", "def show\n @address_range = AddressRange.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @address_range }\n end\n end", "def subnets\n data.subnets\n end", "def uri_data_address(id)\n {\n project: GoogleTests::Constants::A_PROJECT_DATA[(id - 1) \\\n % GoogleTests::Constants::A_PROJECT_DATA.size],\n region: GoogleTests::Constants::A_REGION_DATA[(id - 1) \\\n % GoogleTests::Constants::A_REGION_DATA.size],\n name: GoogleTests::Constants::A_NAME_DATA[(id - 1) \\\n % GoogleTests::Constants::A_NAME_DATA.size]\n }\n end", "def uri_data_subnetwork(id)\n {\n project: GoogleTests::Constants::S_PROJECT_DATA[(id - 1) \\\n % GoogleTests::Constants::S_PROJECT_DATA.size],\n region: GoogleTests::Constants::S_REGION_DATA[(id - 1) \\\n % GoogleTests::Constants::S_REGION_DATA.size],\n name: GoogleTests::Constants::S_NAME_DATA[(id - 1) \\\n % GoogleTests::Constants::S_NAME_DATA.size]\n }\n end", "def addresses\n message = { nodes: { item: resource[:name]}}\n transport[wsdl].get(:get_address, message)\n end", "def multi_addr(addresses)\n get(\"addr/\"+addresses.join(\",\")+\"/balance?noCache=1\")\n end", "def ip_ranges\n data.ip_ranges\n end", "def index\n @address_ranges = AddressRange.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @address_ranges }\n end\n end", "def request_public_iprange(network_options, interface, env)\n return network_options[:ip_range] if network_options[:ip_range]\n subnet = IPAddr.new(network_options[:subnet])\n env[:ui].info(I18n.t(\n \"docker_provider.network_bridge_iprange_info\") + \"\\n\",\n prefix: false\n )\n range = nil\n while !range\n range = env[:ui].ask(I18n.t(\n \"docker_provider.network_bridge_iprange_request\",\n interface: interface,\n default_range: network_options[:subnet]) + \" \",\n prefix: false\n ).strip\n if range.empty?\n range = network_options[:subnet]\n end\n begin\n range = IPAddr.new(range)\n if !subnet.include?(range)\n puts \"we in here\"\n env[:ui].warn(I18n.t(\n \"docker_provider.network_bridge_iprange_outofbounds\",\n subnet: network_options[:subnet],\n range: \"#{range}/#{range.prefix}\"\n ) + \"\\n\", prefix: false)\n range = nil\n end\n rescue IPAddr::InvalidAddressError\n env[:ui].warn(I18n.t(\n \"docker_provider.network_bridge_iprange_invalid\",\n range: range) + \"\\n\", prefix: false)\n range = nil\n end\n end\n \"#{range}/#{range.prefix}\"\n end", "def subnets_ipam_data\n data = {}\n domain_subnets.each do |subnet|\n data[subnet.id] = { :ipam => subnet.ipam? }\n end\n data\n end", "def network_objects_add_2_ip(rule_name,data,sub_or_range)\n \n if sub_or_range == 1\n addr_list = data.split(',')\n input_base = 'subnet'\n select_val ='16'\n else\n addr_list = data.split(',')\n input_base = 'range'\n select_val ='2'\n end\n \n self.msg(rule_name, :debug, 'network_objects_add_2_ip', \"addr_list\" +addr_list.to_s)\n \n addr_list.each do |dual_ip_data|\n \n self.msg(rule_name, :debug, 'network_objects_add_2_ip', \"processing address\" +dual_ip_data.to_s)\n @ff.link(:href, 'javascript:mimic_button(\\'add: ...\\', 1)').click\n @ff.select_list(:name, 'net_obj_type').select_value(select_val)\n ip_data=dual_ip_data.split('/')\n \n if ip_data[0].size > 0 and ip_data[1].size > 0\n \n self.msg(rule_name, :debug, 'network_objects_add_2_ip', \"set ip \" + input_base +\": \" \\\n + ip_data[0] + \"/\" + ip_data[1])\n str_ip_data = ip_data[0].strip\n octets=str_ip_data.split('.')\n @ff.text_field(:name, input_base +'_00').set(octets[0])\n @ff.text_field(:name, input_base +'_01').set(octets[1])\n @ff.text_field(:name, input_base +'_02').set(octets[2])\n @ff.text_field(:name, input_base +'_03').set(octets[3])\n \n # set the subnet or range\n str_ip_data = ip_data[1].strip\n octets=str_ip_data.split('.')\n @ff.text_field(:name, input_base +'_10').set(octets[0])\n @ff.text_field(:name, input_base +'_11').set(octets[1])\n @ff.text_field(:name, input_base +'_12').set(octets[2])\n @ff.text_field(:name, input_base +'_13').set(octets[3])\n \n @ff.link(:text, 'Apply').click\n \n end # end of if..\n \n end # end of each...\n\n end", "def set_aws_subnet\n @aws_subnet = AwsSubnet.find(params[:id])\n end", "def gather_internet_vlan_details\n loop do\n answer = ask \\\n \"Please enter the IP range you'd like to use for your Internet-facing Network in CIDR \"\\\n 'notation (e.g. 158.251.218.81/29)'\n begin\n ip = IPAddress.parse(answer)\n if ip.prefix == 32\n say \"Please enter a range. You entered a single IP address.\".red\n else\n say \"Configuring internet-facing network as Address: #{ip.address} - Netmask: \"\\\n \"#{ip.netmask}\".green\n return ip\n end\n rescue\n say \"Invalid CIDR IP range.\".red\n end\n end\n end", "def getaddressesbyaccount(account)\n request :getaddressesbyaccount, account\n end", "def address_for(network); end", "def show_addresses(**params)\n get('addresses', params)\n end", "def request_static\n # reserve\n return AddressPool.create_or_get(self.network, subnet: self.subnet, iprange: self.iprange)\n end", "def get_subnets(client, vpc_id, vpc_name, subnet_type, subnet_hash)\n resp = get_vpc_subnets(client, vpc_id)\n resp.subnets.each do |subnet|\n if subnet_type == 'public'\n push_subnet(subnet, subnet_hash, vpc_name) if subnet['map_public_ip_on_launch'] \n elsif subnet_type == 'private'\n push_subnet(subnet, subnet_hash, vpc_name) unless subnet['map_public_ip_on_launch']\n end\n end\n subnet_hash\nend", "def retrieve_address\n address_id = params[:address_id] \n @address = Address.find(address_id)\n end", "def show\n @network_detail = Subnet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @network_detail }\n end\n end", "def subnets\n return get_request(address(\"subnets\"), @token)\n end", "def uri_data_network(id)\n {\n project: GoogleTests::Constants::N_PROJECT_DATA[(id - 1) \\\n % GoogleTests::Constants::N_PROJECT_DATA.size],\n name: GoogleTests::Constants::N_NAME_DATA[(id - 1) \\\n % GoogleTests::Constants::N_NAME_DATA.size]\n }\n end", "def uri_data_network(id)\n {\n project: GoogleTests::Constants::N_PROJECT_DATA[(id - 1) \\\n % GoogleTests::Constants::N_PROJECT_DATA.size],\n name: GoogleTests::Constants::N_NAME_DATA[(id - 1) \\\n % GoogleTests::Constants::N_NAME_DATA.size]\n }\n end", "def allocation_range\n (@iprange or @subnet).to_range\n end", "def GetSubnet()\n \"192.168.0.0/16\"\n end", "def GetSubnet()\n \"192.168.0.0/16\"\n end", "def parse(data)\n super data\n @ip_address = data[0..3].to_ip\n @subnet_mask = data[4..7].to_ip\n @standard_gateway = data[8..11].to_ip\n end", "def addresses network=nil\n if network\n data = on_network network\n ips = data.map { |v| (v.has_key? :ip) ? v[:ip] : nil }\n else\n vips.each_key.map { |k| vips[k][:ip] }\n end\n end", "def network_report\n get_resource_list('network', 'v2.0/networks', 'networks')\n @network_csv_array = []\n @network_print_array = []\n @resource_id_list.each do |networkid|\n network = rest_get(\"#{@resource_url}/v2.0/networks/#{networkid}\", @token_id)\n network_array = JSON.parse(network)['network']\n network_name = network_array['name']\n network_status = network_array['status']\n network_vlanid = network_array['provider:segmentation_id']\n network_physnet = network_array['provider:physical_network']\n network_mtu = network_array['mtu']\n subnet_id = network_array['subnets']\n unless subnet_id.empty?\n subnet_id.each do |subnetid|\n subnet_rest = rest_get(\"#{@resource_url}/v2.0/subnets/#{subnetid}\", @token_id)\n subnet_array = JSON.parse(subnet_rest)['subnet']\n @subnet_enable_dhcp = subnet_array['enable_dhcp']\n @subnet_dns_server = subnet_array['dns_nameservers']\n @subnet_startip = subnet_array['allocation_pools'][0]['start']\n @subnet_endip = subnet_array['allocation_pools'][0]['end']\n @subnet_gateway = subnet_array['gateway_ip']\n @subnet_cidr = subnet_array['cidr']\n end\n end\n @network_csv_array << [network_name, network_status, network_vlanid, network_physnet, network_mtu, @subnet_enable_dhcp, @subnet_dns_server, @subnet_startip, @subnet_endip, \\\n @subnet_gateway, @subnet_cidr]\n @network_print_headers = %w(Network_Name Network_VLANid Network_MTU Network_enable_dhcp Network_DNS_Servers Network_Start_IP Network_End_IP Network_Gateway Network_CIDR)\n @network_print_array << [network_name, network_vlanid, network_mtu, @subnet_enable_dhcp, @subnet_dns_server, @subnet_startip, @subnet_endip, @subnet_gateway, @subnet_cidr]\n end\n end", "def address_params\n end", "def set_iprange\n @iprange = Iprange.find(params[:id])\n end", "def show_address(id)\n get(\"addresses/#{id}\")\n end", "def perform(params)\n send_request_of_type(\n 'get',\n GlobalConstant::SaasApi.get_addresses_by_uuids,\n params\n )\n end", "def GetSubnet()\n \"192.168.3.0/24\"\n end", "def qos_add_2_ip(rule_name,data,sub_or_range)\n \n if sub_or_range == 1\n addr_list = data.split(',')\n input_base = 'subnet'\n select_val ='16'\n else\n addr_list = data.split(',')\n input_base = 'range'\n select_val ='2'\n end\n \n self.msg(rule_name, :debug, 'qos_add_rule', \"addr_list\" +addr_list.to_s)\n \n addr_list.each do |dual_ip_data|\n \n self.msg(rule_name, :debug, 'qos_add_rule', \"processing address\" +dual_ip_data.to_s)\n @ff.link(:href, 'javascript:mimic_button(\\'add: ...\\', 1)').click\n @ff.select_list(:name, 'net_obj_type').select_value(select_val)\n ip_data=dual_ip_data.split('/')\n \n if ip_data[0].size > 0 and ip_data[1].size > 0\n \n self.msg(rule_name, :debug, 'qos_add_rule', \"set ip \" + input_base +\": \" \\\n + ip_data[0] + \"/\" + ip_data[1])\n str_ip_data = ip_data[0].strip\n octets=str_ip_data.split('.')\n @ff.text_field(:name, input_base +'_00').set(octets[0])\n @ff.text_field(:name, input_base +'_01').set(octets[1])\n @ff.text_field(:name, input_base +'_02').set(octets[2])\n @ff.text_field(:name, input_base +'_03').set(octets[3])\n \n # set the subnet or range\n str_ip_data = ip_data[1].strip\n octets=str_ip_data.split('.')\n @ff.text_field(:name, input_base +'_10').set(octets[0])\n @ff.text_field(:name, input_base +'_11').set(octets[1])\n @ff.text_field(:name, input_base +'_12').set(octets[2])\n @ff.text_field(:name, input_base +'_13').set(octets[3])\n \n @ff.link(:text, 'Apply').click\n \n end # end of if..\n \n end # end of each...\n\n end", "def get_addresses\n parsed_script.get_addresses\n end", "def create_elasticsearch_addressbase_data(title_address_data)\n id = title_address_data[:uprn]\n uri = URI.parse(\"#{$ELASTIC_SEARCH_ENDPOINT}\")\n conn = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Post.new \"/#{$ELASTICSEARCH_ADDRESSBASE}/#{$ELASTICSEARCH_POSTCODE_SEARCH}/#{id}\"\n request['Content-Type'] = 'application/json'\n request.body = title_address_data.to_json\n conn.request(request)\nend", "def iprange_params\n params.require(:iprange).permit(:ip_block_start, :ip_block_end, :ip_range, :kladr_city_code, :city_id, :ip)\n end", "def show\n @ip_list = IPAddress(@network.network)\n @network_ips = @network.addresses\n end", "def available_ips\n range = conf['addresses']['range']\n unless(range.to_s.empty?)\n range = (range.split('-').first.split('.').last..range.split('-').last).map{|oct|\n \"#{range.split('-').first.split('.').slice(0,3).join('.')}.#{oct}\"\n }\n else\n range = []\n end\n (conf['addresses']['static'] + range).compact\nend", "def get_address\n booking = Booking.where(user_id: current_user.id).last\n pick_up_addr = PickupAddress.where(:booking_id => booking.id).last\n drop_off_addr = DropoffAddress.where(:booking_id => booking.id).last\n hash = {:pick_up_addr => pick_up_addr.address, :drop_off_addr => drop_off_addr.address}\n respond_to do |format|\n format.json { render :json => hash.to_json, :status => 200 }\n end\n end", "def getaddressesbyaccount(account)\n @api.request 'getaddressesbyaccount', account\n end", "def get_range_data(spreadsheet_id, ranges)\n req_url = spreadsheet_path(\"#{spreadsheet_id}/values:batchGet?#{ranges}\")\n Api.get_with_google_auth(req_url, @access_token).parse\n end", "def GetSubnet()\n # puts \"Error. GetSubnet not defined\"\n # exit 1\n return @rstack.GetSubnet()\n end", "def getaccountaddress(account)\n request :getaccountaddress, account\n end", "def show\n @ip_addr = IpAddr.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ip_addr }\n end\n end", "def get_address_and_loc\n id = params[:place_id].to_i\n place = Place.find(id)\n render json: { address: place.address, loc: place.neighborhood }\n end", "def subnet!(ip, options = {})\n path = \"/subnet/#{ip}\"\n perform_post path, :query => options\n end", "def addr_bound_params\n\t\t\tparams[:address][:addr_bounds_attributes][\"0\"][:addr_code].reject!{ |a| a.empty? }.sort\n\t\tend", "def get_ip_ranges_with_http_info(opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: IPRangesAPI.get_ip_ranges ...'\n end\n # resource path\n local_var_path = '/'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'IPRanges'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || []\n\n new_options = opts.merge(\n :operation => :get_ip_ranges,\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 :api_version => \"V1\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: IPRangesAPI#get_ip_ranges\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @aws_subnets = AwsSubnet.all\n end", "def ip; get_data_in_file :ip end", "def show\n @dhcp_range = DhcpRange.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dhcp_range }\n end\n end", "def init_subnets\n @@client.describe_subnets.subnets\n end", "def getO365 type=\"subnet\", service=nil\n\t\trt = Array.new\n\t\t@O365_Services.each do |s|\n\t\t\tif service.nil? || s[\"serviceArea\"].match(service) || s[\"id\"] == service then\n\t\t\t\tif type.match(\"subnet\") && s[\"ips\"] then\n\t\t\t\t\ts[\"ips\"].each do |ip|\n\t\t\t\t\t\ttemp_ip = IPAddr.new ip\n\t\t\t\t\t\trt.push temp_ip if temp_ip.ipv4?\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tif type.match(\"url\") && s[\"urls\"] then\n\t\t\t\t\ts[\"urls\"].each {|url| rt.push url}\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\treturn rt\n\tend", "def get(range:, id:)\n begin\n open(get_request_path(range,id)).read \n rescue => e\n \"error fetching spreadsheet id #{id} with range #{range}\" \n end\n end", "def address\n @countries=Country.all\n @roles=Role.all\n if params[:body][:country_id].empty? && params[:body][:state_id].empty? && params[:body][:city_id].empty?\n render :json=>{:header=>{:status=>200},:body=>{:countries=>@countries, :roles=>@roles, :states=>nil}}\n elsif params[:body][:country_id].present? && params[:body][:state_id].empty? && params[:body][:city_id].empty?\n @states=Country.find_by_id(params[:body][:country_id]).states\n render :json=>{:header=>{:status=>200},:body=>{:countries=>@countries, :roles=>@roles, :states=>@states}}\n elsif params[:body][:country_id].present? && params[:body][:state_id].present? && params[:body][:city_id].empty?\n @states=Country.find_by_id(params[:body][:country_id]).states\n @cities=State.find_by_id(params[:body][:state_id]).cities\n render :json=>{:header=>{:status=>200},:body=>{:countries=>@countries, :roles=>@roles, :states=>@states, :cities=>@cities}}\n elsif params[:body][:country_id].present? && params[:body][:state_id].present? && params[:body][:city_id].present?\n @states=Country.find_by_id(params[:body][:country_id]).states\n @cities=State.find_by_id(params[:body][:state_id]).cities\n @locations=City.find_by_id(params[:body][:state_id]).locations\n render :json=>{:header=>{:status=>200},:body=>{:countries=>@countries, :roles=>@roles, :states=>@states, :cities=>@cities, :locations=>@locations}}\n end\n end", "def get_subnets(aws)\n output = {}\n\n # if a route table is set as Main, the associated subnets are not included.\n # However, vpc_id is included. So, let's create a subnet - vpc_id lookup\n subnets = {}\n aws.ec2.describe_subnets[:subnets].each do | subnet |\n subnet_name = \"\"\n\n subnets[subnet[:subnet_id]] = {\n vpc_id: subnet[:vpc_id],\n availability_zone: subnet[:availability_zone],\n subnet_name: subnet_name,\n tags: subnet[:tags]\n }\n end\n\n route_tables = aws.ec2.describe_route_tables[:route_tables]\n route_tables.each do | route_table |\n default_route = nil\n\n # Check the default route (ipv4 or ipv6) whether it goes to \n # IGW or NAT instance, or something else (other)\n route_table[:routes].each do |route|\n if [\"0.0.0.0/0\",\"::/0\"].include?(route[:destination_cidr_block])\n if route[:gateway_id] =~ /^igw-/\n default_route = route[:gateway_id]\n elsif route[:network_interface_id] =~ /^eni-/ \n default_route = route[:network_interface_id]\n else\n default_route = \"other\"\n end\n end\n end\n\n route_table[:associations].each do |association|\n # For \"main\" association, we go through the subnet lookup for matching vpc_id\n # and assign it to the output if the vpc_id matches and there's no explicit association\n if association[:main]\n vpc_id = route_table[:vpc_id]\n subnets.each do | subnet_id, subnet_info |\n # if there is an explicit association, do nothing\n next if output.key?(subnet_id)\n \n if vpc_id == subnet_info[:vpc_id]\n output[subnet_id] = subnets[subnet_id]\n output[subnet_id][:route_table_id] = route_table[:route_table_id]\n output[subnet_id][:default_route] = default_route\n output[subnet_id][:routes] = route_table[:routes]\n end\n end\n # If the association is not main, the subnet is explicitly associated with the route table\n # if the subnet is already added to the output (from the main association), this will override it.\n else\n subnet_id = association[:subnet_id]\n output[subnet_id] = subnets[subnet_id]\n output[subnet_id][:route_table_id] = route_table[:route_table_id]\n output[subnet_id][:default_route] = default_route\n output[subnet_id][:routes] = route_table[:routes]\n end\n end\n\n end\n\n return output\nend", "def db_subnet_group\n data[:db_subnet_group]\n end", "def db_subnet_group\n data[:db_subnet_group]\n end", "def get_contract_addresses\n service_response = ClientManagement::GetContractAddresses.new(params).perform\n render_api_response(service_response)\n end", "def read(id=nil)\r\n request = Net::HTTP.new(@uri.host, @uri.port)\r\n if id.nil?\r\n response = request.get(\"#{@uri.path}.xml\") \r\n else\r\n response = request.get(\"#{@uri.path}/#{id}.xml\") \r\n end\r\n response.body\r\n end", "def new\n @address_range = AddressRange.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @address_range }\n end\n end", "def show\n id = params[:id].to_i - 1\n if (id < 0) or (id > @addresses.length)\n respond_to do |format|\n format.html { redirect_to \"/#{@user.name}\", alert: 'Address was not found.'}\n format.json { render json: @address }\n end\n else\n @address = @addresses[id]\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @address }\n end\n end\n \n end", "def get_subnet(address)\n addr = IPAddr.new(address)\n subnets = foreman('GET', '/api/subnets')\n subnet = subnets && subnets['results'] && subnets['results'].detect{ |x| IPAddr.new(x['network_address']).include?(addr) }\n subnet or raise Puppet::Error.new(\"Unable to locate subnet for address \\\"#{address}\\\"\")\n end", "def ip_adress_params\n params[:ip_adress]\n end", "def build_params_for_address()\n\n end", "def addresses; end", "def getNetwork(interface)\n net = Nokogiri::XML(\"#{interface}\").xpath(\"//ip\")\n if !net.empty?\n ip = net.attr('address').value\n netmask = net.attr('netmask').value\n end\n return ip, netmask\n end", "def addresses\n @client.request('getaddressesbyaccount', name)\n end", "def getvalues\r\n # Track via mixpanel\r\n MiscFunctions.mixPanelTrack(params[:street], params[:citystatezip], params[:product])\r\n\r\n # Determine if this is a bulk run or single property\r\n if (params[:street].nil? || params[:citystatezip].nil?) && params[:placeid].nil?\r\n @addresses = Address.all\r\n runID = \"Run: #{addresses.size}: #{Date.today.to_s}\"\r\n\r\n # Loop over records and compute PDQ score\r\n @addresses.each { |prop| PdqEngine.computeDecision(prop, params, runID) }\r\n \r\n else # if single property, create new address record or use place id if passed\r\n runID = \"#{params[:path].to_s.capitalize}: #{Date.today.to_s}\"\r\n\r\n # If we are provided a placeid (not active)\r\n if !params[:placeid].nil?\r\n geo_data = GeoFunctions.getGoogleGeoByPlaceId(params[:placeid])\r\n search_add = PdqEngine.computeDecision(geo_data, params, runID)\r\n\r\n else\r\n # These functions take \"unclean\" address from Billboard URL and clean it\r\n street = MiscFunctions.addressStringClean(params[:street])\r\n citystatezip = MiscFunctions.addressStringClean(params[:citystatezip])\r\n\r\n # Create an \"unclean\" (archive) lookup address\r\n hist_lookup_add = Address.new\r\n hist_lookup_add.street = street\r\n hist_lookup_add.citystatezip = citystatezip\r\n\r\n # Get Google place id\r\n geo_data = GeoFunctions.getGoogleGeoByAddress(street, citystatezip)\r\n search_add = PdqEngine.computeDecision(geo_data, params, runID, alt_lookup = hist_lookup_add)\r\n end\r\n @addresses = [search_add]\r\n end\r\n\r\n # update parameters to match clean-address format\r\n # params[:street] = a.street\r\n # params[:citystatezip] = a.citystatezip\r\n\r\n # Aggregate all output and render\r\n @allOutput = Output.all\r\n return render 'getvalues' if params[:path].nil?\r\n\r\n # Search here\r\n\r\n # If request coming from billboard\r\n # @calcedurl = URI.escape(\"/inspect/#{params[:street]}/#{params[:citystatezip]}\")\r\n @calcedurl = URI.escape(\"/inspect/#{search_add.street}/#{search_add.citystatezip}\")\r\n puts @calcedurl\r\n return render 'blank'\r\n end", "def get_vpc_subnets(client, vpc_id)\n resp = client.describe_subnets({\n filters: [{\n name: \"vpc-id\", \n values: [vpc_id]\n }], \n })\nend", "def range\n #@lines = Line.where(:no=> params[:id])\n line_range = params[:id].split(\"-\")\n @stanzas = Stanza.where(:section_id=>line_range[0]..line_range[2],:runningno=>line_range[1]..line_range[3]).order('no')\n lines = Array.new\n @stanzas.each {|s| lines << s.cached_lines }\n respond_to do |format|\n format.html #range.html.erb\n format.json {render :json => lines.to_json(:only =>[:line, :stanza_id],:methods=>[:section,:runningno,:share_url,:no])}\n end\n end", "def getReceiverAddress\n \n $addresses= ReceiverAddress.where(receiver_id: params[:id]);\n respond_to do |format|\n format.html #need for ajax with html datatype \n format.json { render json: $addresses }#need for ajax with json datatyp\n end\n end", "def subnet(options=nil)\n known_args = [:Bits, :IPCount, :NumSubnets, :Objectify, :Short]\n my_network = self.to_i(:network)\n my_mask = self.bits\n subnet_bits = my_mask + 1\n min_count = nil \n objectify = false\n short = false\n\n if (options)\n if (!options.kind_of? Hash)\n raise ArgumentError, \"Expected Hash, but #{options.class} provided.\"\n end\n NetAddr.validate_args(options.keys,known_args)\n\n if ( options.has_key?(:IPCount) )\n subnet_bits = NetAddr.ip_count_to_size(options[:IPCount], @version)\n end\n\n if ( options.has_key?(:Bits) )\n subnet_bits = options[:Bits]\n end\n\n if ( options.has_key?(:NumSubnets) )\n num_subnets = options[:NumSubnets]\n end\n\n if( options.has_key?(:Short) && options[:Short] == true )\n short = true\n end\n\n if( options.has_key?(:Objectify) && options[:Objectify] == true )\n objectify = true\n end\n\n end\n\n # get number of subnets possible with the requested subnet_bits\n num_avail = 2**(subnet_bits - my_mask)\n\n # get the number of bits in the next supernet and\n # make sure num_subnets is a power of 2\n bits_needed = 1\n num_subnets = num_avail if (!num_subnets)\n until (2**bits_needed >= num_subnets)\n bits_needed += 1\n end\n num_subnets = 2**bits_needed\n next_supernet_bits = subnet_bits - bits_needed\n\n\n # make sure subnet isnt bigger than available bits\n if (subnet_bits > @address_len)\n raise BoundaryError, \"Requested subnet (#{subnet_bits}) does not fit \" +\n \"within the bounds of IPv#{@version}.\"\n end\n\n # make sure subnet is larger than mymask\n if (subnet_bits < my_mask)\n raise BoundaryError, \"Requested subnet (#{subnet_bits}) is too large for \" +\n \"current CIDR space.\"\n end\n\n # make sure MinCount is smaller than available subnets\n if (num_subnets > num_avail)\n raise \"Requested subnet count (#{num_subnets}) exceeds subnets \" +\n \"available for allocation (#{num_avail}).\"\n end\n\n # list all 'subnet_bits' sized subnets of this cidr block\n # with a limit of num_subnets\n bitstep = 2**(@address_len - subnet_bits)\n subnets = self.enumerate(:Bitstep => bitstep, :Limit => num_subnets, :Objectify => true)\n\n # save our subnets\n new_subnets = []\n subnets.each do |subnet|\n if (!objectify)\n if (short && @version == 6)\n new_subnets.push(\"#{subnet.network(:Short => true)}/#{subnet_bits}\")\n else\n new_subnets.push(\"#{subnet.network}/#{subnet_bits}\")\n end\n else\n new_subnets.push( NetAddr.cidr_build(@version, subnet.to_i(:network), NetAddr.bits_to_mask(subnet_bits,version) ) )\n end\n end\n\n # now go through the rest of the cidr space and make the rest\n # of the subnets. we want these to be as tightly merged as possible\n next_supernet_bitstep = (bitstep * num_subnets)\n next_supernet_ip = my_network + next_supernet_bitstep\n until (next_supernet_bits == my_mask)\n if (!objectify)\n next_network = NetAddr.ip_int_to_str(next_supernet_ip, @version)\n next_network = NetAddr.shorten(next_network) if (short && @version == 6)\n new_subnets.push(\"#{next_network}/#{next_supernet_bits}\")\n else\n new_subnets.push(NetAddr.cidr_build(@version, next_supernet_ip, NetAddr.bits_to_mask(next_supernet_bits,version) ) )\n end\n\n next_supernet_bits -= 1\n next_supernet_ip = next_supernet_ip + next_supernet_bitstep\n next_supernet_bitstep = next_supernet_bitstep << 1\n end\n\n return(new_subnets)\n end", "def getData(data_of, id)\n url_data = stringGetUrlPath(data_of)\n url_request = \"#{url_data}/#{id}\"\n response_data = readData(url_request)\n return response_data\n end", "def ip_adress_report(ip_adress)\n merged_options = options.merge({ ip: ip_adress })\n response = RestClient.get endpoint(\"/ip-address/report\"), params: merged_options\n parse_response(response)\n end", "def operate_range\n exist_range = []\n connect.get_floating_ips_bulk.each do |element|\n exist_range << element.address\n end\n if @resource[:ensure] == :absent\n ip_range & exist_range\n else\n ip_range - exist_range\n end\n end", "def create_subnet(network, cidr)\n data = {\n 'subnet' => {\n 'network_id' => network,\n 'ip_version' => 4,\n 'cidr' => cidr\n } \n }\n return post_request(address(\"subnets\"), data, @token)\n end", "def net\n\n i = 0\n while i < @datas.count\n i += 1\n new_net = Net.new \n new_net.subnet = DHCPParser::Conf.get_subnet(@datas[\"net#{i}\"])\n new_net.netmask = DHCPParser::Conf.get_netmask(@datas[\"net#{i}\"])\n\n list_option = DHCPParser::Conf.get_list_option(@datas[\"net#{i}\"], true)\n new_net.option = list_option[0]\n new_net.differ = list_option[1]\n\n pool = DHCPParser::Conf.get_pool(@datas[\"net#{i}\"])\n new_net.pool[\"range\"] = pool[\"range\"]\n new_net.pool[\"allow\"] = pool[\"allow\"]\n new_net.pool[\"denny\"] = pool[\"denny\"]\n # set host\n index = 0 \n while index < pool[\"hosts\"].count\n index += 1\n host_name = pool[\"hosts\"][\"host#{index}\"][\"host\"]\n ethernet = pool[\"hosts\"][\"host#{index}\"][\"hardware_ethernet\"]\n address = pool[\"hosts\"][\"host#{index}\"][\"fixed-address\"] \n host = Host.new(host_name, ethernet, address)\n new_net.pool[\"hosts\"] << host\n end\n @array_net << new_net\n end\n return @array_net\n end", "def read_ip_address_pool_subnet_0_with_http_info(ip_pool_id, ip_subnet_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingIPManagementIPAddressPoolsIPPoolsApi.read_ip_address_pool_subnet_0 ...'\n end\n # verify the required parameter 'ip_pool_id' is set\n if @api_client.config.client_side_validation && ip_pool_id.nil?\n fail ArgumentError, \"Missing the required parameter 'ip_pool_id' when calling PolicyNetworkingIPManagementIPAddressPoolsIPPoolsApi.read_ip_address_pool_subnet_0\"\n end\n # verify the required parameter 'ip_subnet_id' is set\n if @api_client.config.client_side_validation && ip_subnet_id.nil?\n fail ArgumentError, \"Missing the required parameter 'ip_subnet_id' when calling PolicyNetworkingIPManagementIPAddressPoolsIPPoolsApi.read_ip_address_pool_subnet_0\"\n end\n # resource path\n local_var_path = '/infra/ip-pools/{ip-pool-id}/ip-subnets/{ip-subnet-id}'.sub('{' + 'ip-pool-id' + '}', ip_pool_id.to_s).sub('{' + 'ip-subnet-id' + '}', ip_subnet_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'IpAddressPoolSubnet')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingIPManagementIPAddressPoolsIPPoolsApi#read_ip_address_pool_subnet_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def uri_data_region(id)\n {\n project: GoogleTests::Constants::R_PROJECT_DATA[(id - 1) \\\n % GoogleTests::Constants::R_PROJECT_DATA.size],\n name: GoogleTests::Constants::R_NAME_DATA[(id - 1) \\\n % GoogleTests::Constants::R_NAME_DATA.size]\n }\n end", "def uri_data_region(id)\n {\n project: GoogleTests::Constants::R_PROJECT_DATA[(id - 1) \\\n % GoogleTests::Constants::R_PROJECT_DATA.size],\n name: GoogleTests::Constants::R_NAME_DATA[(id - 1) \\\n % GoogleTests::Constants::R_NAME_DATA.size]\n }\n end", "def uri_data_region(id)\n {\n project: GoogleTests::Constants::R_PROJECT_DATA[(id - 1) \\\n % GoogleTests::Constants::R_PROJECT_DATA.size],\n name: GoogleTests::Constants::R_NAME_DATA[(id - 1) \\\n % GoogleTests::Constants::R_NAME_DATA.size]\n }\n end", "def update\n\n respond_to do |format|\n if @network.update(network_params)\n format.html { redirect_to @network, notice: 'Network was successfully updated.' }\n format.json { render :show, status: :ok, location: @network }\n format.js {\n @ip_list = IPAddress(@network.network)\n @network_ips = @network.addresses\n render :update\n }\n else\n format.html { render :edit }\n format.json { render json: @network.errors, status: :unprocessable_entity }\n format.js {\n render :update\n }\n end\n end\n end", "def subnet_by_id(subnet_id_symbol)\n @subnet_ids[subnet_id_symbol]\n end", "def address\n @client.request('getaccountaddress', name)\n end", "def list_addresses\n Address.list(@id)\n end", "def ip_range_graph_info(ip)\n ipv4 = IPAddress::IPv4.new(ip)\n includes_proc = proc do |node_name|\n if @nodes_graph[node_name][:ipv4].nil?\n if node_cluster?(node_name)\n # Here the node is a cluster that is not an IP range.\n @nodes_graph[node_name][:includes].all? { |included_node_name| includes_proc.call(included_node_name) }\n else\n false\n end\n else\n ipv4.include?(@nodes_graph[node_name][:ipv4])\n end\n end\n {\n type: :cluster,\n connections: {},\n includes: [],\n ipv4: ipv4,\n includes_proc: includes_proc\n }\n end", "def on_getaddr\n #addrs = @node.addrs.select{|a| a.time > Time.now.to_i - 10800 }.shuffle[0..250]\n #p \"<< addr (#{addrs.size})\"\n #send_data P::Addr.pkt(*addrs)\n end", "def scan_ips(site_id, ip_addresses)\n xml = make_xml('SiteDevicesScanRequest', 'site-id' => site_id)\n hosts = REXML::Element.new('Hosts')\n ip_addresses.each do |ip|\n xml.add_element('range', 'from' => ip)\n end\n xml.add_element(hosts)\n\n _scan_ad_hoc(xml)\n end", "def read_ip_address_pool_subnet_with_http_info(ip_pool_id, ip_subnet_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingIPManagementIPAddressPoolsIPPoolsApi.read_ip_address_pool_subnet ...'\n end\n # verify the required parameter 'ip_pool_id' is set\n if @api_client.config.client_side_validation && ip_pool_id.nil?\n fail ArgumentError, \"Missing the required parameter 'ip_pool_id' when calling PolicyNetworkingIPManagementIPAddressPoolsIPPoolsApi.read_ip_address_pool_subnet\"\n end\n # verify the required parameter 'ip_subnet_id' is set\n if @api_client.config.client_side_validation && ip_subnet_id.nil?\n fail ArgumentError, \"Missing the required parameter 'ip_subnet_id' when calling PolicyNetworkingIPManagementIPAddressPoolsIPPoolsApi.read_ip_address_pool_subnet\"\n end\n # resource path\n local_var_path = '/global-infra/ip-pools/{ip-pool-id}/ip-subnets/{ip-subnet-id}'.sub('{' + 'ip-pool-id' + '}', ip_pool_id.to_s).sub('{' + 'ip-subnet-id' + '}', ip_subnet_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'IpAddressPoolSubnet')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingIPManagementIPAddressPoolsIPPoolsApi#read_ip_address_pool_subnet\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def getToolsAddressdiff( first_entity_id, second_entity_id)\n params = Hash.new\n params['first_entity_id'] = first_entity_id\n params['second_entity_id'] = second_entity_id\n return doCurl(\"get\",\"/tools/addressdiff\",params)\n end", "def read(id=nil)\n request = Net::HTTP.new(@uri.host, @uri.port)\n if id.nil?\n response = request.get(\"#{@uri.path}.xml\")\n else\n response = request.get(\"#{@uri.path}/#{id}.xml\")\n end\n\n response.body\n end", "def build_subnet_config(name_args)\n load_yaml\n get_vpc_id\n config[:vpc], config[:subnet] = name_args[0].split('.')\n begin\n config[:availability_zone] ||= get_az\n config[:route_table] ||= get_route_table\n config[:ip] ||= get_ip\n rescue YamlError => e\n ui.fatal(e.message)\n exit 1\n end\n end", "def display_subnet(alert)\n return alert[:subnet_name] if config[:show_friendly_names]\n alert[:subnet_id]\n end", "def getAddressInfo(path)\n Ipvalidation.validate(path)\n call(path)\n end", "def show\n @network = Network.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @network } \n end\n end" ]
[ "0.60472685", "0.56632274", "0.5532753", "0.5450384", "0.53905165", "0.53699905", "0.53358775", "0.53016347", "0.52924716", "0.52923197", "0.5280094", "0.5265751", "0.52422786", "0.5239111", "0.5212064", "0.52069634", "0.5182491", "0.51796633", "0.51438963", "0.5118444", "0.51102215", "0.509633", "0.50816566", "0.5054968", "0.5054968", "0.5048583", "0.5037684", "0.5037684", "0.50302356", "0.50146693", "0.5013397", "0.5011456", "0.4982362", "0.49781936", "0.4972861", "0.49569464", "0.49554533", "0.49405146", "0.49390063", "0.48842308", "0.48818183", "0.4866464", "0.48634493", "0.48610666", "0.48567152", "0.4854908", "0.48429477", "0.48391372", "0.4835404", "0.48274657", "0.4822341", "0.48199484", "0.48099145", "0.48092708", "0.48092312", "0.4809059", "0.4807059", "0.48049206", "0.48006827", "0.4800431", "0.47979245", "0.47979245", "0.47978544", "0.4793258", "0.47849706", "0.47631446", "0.4741512", "0.47377175", "0.47273928", "0.47254303", "0.47246748", "0.47236246", "0.4722648", "0.47178814", "0.47070304", "0.4702627", "0.4697335", "0.46966374", "0.46889347", "0.46864936", "0.46801266", "0.46791068", "0.46555048", "0.46528754", "0.46528754", "0.46528754", "0.46521184", "0.4627298", "0.46244535", "0.46197155", "0.46144405", "0.46101108", "0.45989805", "0.45975173", "0.45970324", "0.45940498", "0.45933124", "0.4592154", "0.45909908", "0.4580581" ]
0.5102735
21
GET /address_ranges GET /address_ranges.xml
def index @address_ranges = AddressRange.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @address_ranges } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addresses\n IbmCloudRest.get \"#{@uri}/addresses\"\n end", "def show\n @address_range = AddressRange.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @address_range }\n end\n end", "def addresses\n query(:address)\n end", "def addresses\n @client.request('getaddressesbyaccount', name)\n end", "def addresses\n message = { nodes: { item: resource[:name]}}\n transport[wsdl].get(:get_address, message)\n end", "def get_address_books\n self.class.get('https://api.yesgraph.com/v0/address-books', :headers => @options)\n end", "def show_addresses(**params)\n get('addresses', params)\n end", "def get_ip_ranges_with_http_info(opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: IPRangesAPI.get_ip_ranges ...'\n end\n # resource path\n local_var_path = '/'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'IPRanges'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || []\n\n new_options = opts.merge(\n :operation => :get_ip_ranges,\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 :api_version => \"V1\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: IPRangesAPI#get_ip_ranges\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def list_addresses\n Address.list(@id)\n end", "def new\n @address_range = AddressRange.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @address_range }\n end\n end", "def index\n @ag_addresses = Ag::Address.all\n end", "def index\n @dhcp_ranges = DhcpRange.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dhcp_ranges }\n end\n end", "def getRanges(path)\n @urlencode = URI.encode(path)\n call(RANGES_PATH + @urlencode)\n end", "def addresses; end", "def ip_ranges\n data.ip_ranges\n end", "def getaddressesbyaccount(account)\n request :getaddressesbyaccount, account\n end", "def all(options={})\n response = MLS.get('/addresses', options)\n MLS::Address::Parser.parse_collection(response.body)\n end", "def fetch_ranges\n begin\n res = Excon.get(\"#{url}.idx\")\n rescue Excon::Errors::Error\n raise \"Download of '#{url}.idx' failed\"\n end\n lines = res.body.lines.map { |line| line.split(\":\") }\n lines.each_index.each_with_object({}) do |i, ranges|\n # A typical line (before the split on `:`) looks like this:\n # `12:4593854:d=2016051118:TMP:2 mb:9 hour fcst:`\n line = lines[i]\n next_line = lines[i + 1] # NOTE: Will be `nil` on the last line\n\n # The fourth and fifth fields constitue the key to identify the records\n # defined in `Forecaster::Configuration`.\n key = \":#{line[3]}:#{line[4]}:\"\n\n # The second field is the first byte of the record in the GRIB2 file.\n ranges[key] = [line[1].to_i]\n\n # To get the last byte we need to read the next line.\n # If we are on the last line we won't be able to get the last byte,\n # but we don't need it according to the section 14.35.1 Byte Ranges\n # of RFC 2616.\n ranges[key] << next_line[1].to_i - 1 if next_line\n end\n end", "def multi_addr(addresses)\n get(\"addr/\"+addresses.join(\",\")+\"/balance?noCache=1\")\n end", "def index\n @reserved_addresses = ReservedAddress.all\n end", "def addresses\n @addresses\n end", "def index\n @product_ranges = ProductRange.find(:all)\n\n respond_to do |format|\n format.html # index.haml\n format.xml { render :xml => @product_ranges }\n end\n end", "def getaddressesbyaccount(account)\n @api.request 'getaddressesbyaccount', account\n end", "def get_contract_addresses\n service_response = ClientManagement::GetContractAddresses.new(params).perform\n render_api_response(service_response)\n end", "def addresses\n nodename = params[:node_id]\n @node = nodename == \"admin\" ? Node.admin.where(:available => true).first : Node.find_key(nodename)\n if params[:network]\n @net = Network.find_key(params[:network])\n res = {\n \"node\" => @node.name,\n \"network\" => @net.name,\n \"category\" => @net.category,\n \"addresses\" => @net.node_allocations(@node).map{|a|a.to_s}\n }\n render :json => res, :content_type=>cb_content_type(:addresses, \"object\")\n else\n res = []\n\n if params[:category]\n nets = Network.in_category(params[:category])\n else\n nets = Network.all\n end\n\n nets.each do |n|\n ips = n.node_allocations(@node)\n next if ips.empty?\n\n res << {\n \"node\" => @node.name,\n \"network\" => n.name,\n \"category\" => n.category,\n \"addresses\" => ips.map{|a|a.to_s}\n }\n end\n\n render :json => res, :content_type=>cb_content_type(:addresses, \"array\")\n end\n end", "def addresses\n Array(@addresses)\n end", "def describe_addresses( options = {} )\n options = { :public_ip => [] }.merge(options)\n params = pathlist(\"PublicIp\", options[:public_ip])\n return response_generator(:action => \"DescribeAddresses\", :params => params)\n end", "def call_address_service\n addresses = []\n success = call_ok?(:address_search, make_request) do |body|\n ServiceClient.iterate_element(body[:address_list]) do |address|\n add_address(addresses, address) unless address.nil?\n end\n end\n [success, addresses]\n end", "def ranges\n @toc_id = 'ranges'\n end", "def index\n @addresses = Address.all\n end", "def index\n @addresses = Address.all\n end", "def index\n if address_type==\"Address\"\n @addresses = Address.find(:all)\n else\n @addresses = Address.find_all_by_type(address_type)\n end\n @addresses ||= []\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @addresses }\n end\n end", "def get_aws_ips()\n content = open(\"https://ip-ranges.amazonaws.com/ip-ranges.json\").read\n resp = JSON.parse(content)['prefixes']\n ips = []\n resp.each do |prefix|\n ips << IPAddr.new(prefix['ip_prefix'])\n end\n return ips\nend", "def get_range\n\t\tRails.logger.info(\"HOST ------> #{request.host}\")\n\t\trespond({ topics: AToZEntry.select(:topic, :id).where(topic: params[:start]..params[:end]) })\n\tend", "def index\n\t\t@addresses = Address.all\t\n\tend", "def index\n @contacts = current_user.get_address_book_contacts\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @contacts }\n end\n end", "def index\n @addresses = Address.paginate :page => params[:page], :order => 'street ASC'\n #@addresses = Address.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @addresses }\n end\n end", "def get_address_book(user_id)\n self.class.get(\"https://api.yesgraph.com/v0/address-book/#{user_id}\",\n {\n :headers => @options\n }\n )\n end", "def ranges\n attributes.fetch(:ranges)\n end", "def index\n @account_addresses = AccountAddress.all\n end", "def ip_range\n ip = @resource[:name].split('-')\n ip_range = NetAddr.range NetAddr::CIDR.create(ip.first), NetAddr::CIDR.create(ip.last)\n ip_range.unshift(ip.first).push(ip.last)\n end", "def index\n\n @ipranges = Iprange.all\n\n render json: @ipranges\n\n end", "def address\n @client.request('getaccountaddress', name)\n end", "def index\n @client_addresses = ClientAddress.all\n end", "def index\n @person_addresses = PersonAddress.all\n end", "def index\n @ripple_addresses = RippleAddress.all\n end", "def get_addresses\n parsed_script.get_addresses\n end", "def getaddressesbyaccount(account)\n coind.getaddressesbyaccount account\n end", "def index\n @shooting_ranges = ShootingRange.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @shooting_ranges }\n end\n end", "def destroy\n @address_range = AddressRange.find(params[:id])\n @address_range.destroy\n\n respond_to do |format|\n format.html { redirect_to(address_ranges_url) }\n format.xml { head :ok }\n end\n end", "def index\n @user_addresses = UserAddress.all\n end", "def available_ips\n range = conf['addresses']['range']\n unless(range.to_s.empty?)\n range = (range.split('-').first.split('.').last..range.split('-').last).map{|oct|\n \"#{range.split('-').first.split('.').slice(0,3).join('.')}.#{oct}\"\n }\n else\n range = []\n end\n (conf['addresses']['static'] + range).compact\nend", "def create\n @address_range = AddressRange.new(params[:address_range])\n\n respond_to do |format|\n if @address_range.save\n format.html { redirect_to(@address_range, :notice => 'Address range was successfully created.') }\n format.xml { render :xml => @address_range, :status => :created, :location => @address_range }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @address_range.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @arrival_ranges = ArrivalRange.find(:all, :order => \"position ASC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @arrival_ranges }\n end\n end", "def addresses(rev=nil, &block)\n return to_enum(:addresses, rev) if ! block_given?\n sections.each { |s| s.addresses(rev).each { |a| yield a } }\n end", "def index\n @vendor_addresses = VendorAddress.all\n end", "def index\n @sales_addresses = Sales::Address.all\n end", "def from_ranges\n attributes.fetch(:fromRanges)\n end", "def addresses\n @addresses ||= init_addresses\n end", "def index\n @rranges = Rrange.all\n end", "def index\n @addresses_people = AddressesPerson.all\n end", "def get_range\n\t\tif params.has_key?(\"start\") and params.has_key?(\"end\")\n\t\t\tif params[\"end\"] == \"Z\"\n\t\t\t\t# had to do some hackish stuff to include Z\n\t\t\t\tfirst = AToZEntry.select(:topic, :id).where(topic: params[:start]..params[:end])\n\t\t\t\tprefix = 'Z'\n\t\t\t\tsecond = AToZEntry.select(:topic, :id).where(\"topic LIKE :prefix\", prefix: \"#{prefix}%\")\n\t\t\t\trespond({ status: 0, topics: first+second })\n\t\t\telse\n\t\t\t\trespond({ status: 0, topics: AToZEntry.select(:topic, :id).where(topic: params[:start]..params[:end]) })\n\t\t\tend\t\t\t\n\t\telse\n\t\t\trespond({ status: 1, error: \"Must supply :start and :end parameter.\" })\n\t\tend\t\n\tend", "def index\n\t\t@addresses = current_user.addresses\n\tend", "def show\n @range_specification = RangeSpecification.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @range_specification }\n end\n end", "def get_range ( addr )\n\tindex = addr - @base\n\tif index >= @size\n\t return \"Q\", 0\n\tend\n\tif @map[index] == \"L\"\n\t return \"L\", addr + 4\n\tend\n\tt = @map[index]\n\tloop {\n\t index = index + 1\n\t break if index >= @size\n\t break if @map[index] != t\n\t}\n\treturn t, @base + index\n end", "def allocation_range\n (@iprange or @subnet).to_range\n end", "def get_address\n booking = Booking.where(user_id: current_user.id).last\n pick_up_addr = PickupAddress.where(:booking_id => booking.id).last\n drop_off_addr = DropoffAddress.where(:booking_id => booking.id).last\n hash = {:pick_up_addr => pick_up_addr.address, :drop_off_addr => drop_off_addr.address}\n respond_to do |format|\n format.json { render :json => hash.to_json, :status => 200 }\n end\n end", "def index\n @post_addresses = PostAddress.all\n end", "def available_addresses\n @subnet.hosts(range: allocation_range, exclude: reserved_addresses)\n end", "def get_addresses apts\n return apts.map { |apt| apt.address }\n end", "def index\n @weventaddresses = Weventaddress.all\n end", "def show\n\t @addresses = @user.addresses\n end", "def get_range_data(spreadsheet_id, ranges)\n req_url = spreadsheet_path(\"#{spreadsheet_id}/values:batchGet?#{ranges}\")\n Api.get_with_google_auth(req_url, @access_token).parse\n end", "def index\n @address_books = AddressBook.all\n end", "def index\n @address_books = AddressBook.all\n end", "def index\n @address_books = AddressBook.all\n end", "def index\n @addresses = Address.scoped.order(sort_column + \" \" + sort_direction).paginate(:page => params[:page], :per_page => 30)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @addresses }\n end\n end", "def show\n @person = Person.find(params[:id])\n @addresses = @person.addresses\n end", "def addresses\n collect { |a| a.address }\n end", "def show\n @dhcp_range = DhcpRange.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dhcp_range }\n end\n end", "def addr_bound_params\n\t\t\tparams[:address][:addr_bounds_attributes][\"0\"][:addr_code].reject!{ |a| a.empty? }.sort\n\t\tend", "def getaccountaddress(account)\n request :getaccountaddress, account\n end", "def query_range(options)\n run_command('query_range', options)\n end", "def address_params\n end", "def to_range\n\t\tIP.parse(self.start_ip)..IP.parse(self.end_ip)\n\tend", "def searches\n Boundary.get(@url)\n end", "def index\n @electronic_addresses = ElectronicAddress.all\n end", "def index\n if params[:x1]\n @places = Place.by_bounds( params[:x1], params[:y1], params[:x2], params[:y2], params )\n end\n #@places = Place.without_nodes\n respond_with(@places)\n end", "def index\n @adresses = Adress.all\n end", "def init_addresses\n @@client.describe_addresses.addresses\n end", "def addresses\n options = (token && secret) ? {:access_token => token, :access_secret => secret} : {}\n @addresses ||= Address.find(username, options)\n end", "def addresses\n options = (token && secret) ? {:access_token => token, :access_secret => secret} : {}\n @addresses ||= Address.find(username, options)\n end", "def addresses\n format_entities('gd$structuredPostalAddress', :format_address)\n end", "def index\n @venue_addresses = VenueAddress.all\n end", "def get_segments\n return make_request(\"#{self.endpoint}/list/segments\")\n end", "def index\n @address_books = AddressBook.find(:all, :include => :addresses, :order => 'address_books.rank ASC, addresses.rank ASC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @address_books }\n end\n end", "def update\n @address_range = AddressRange.find(params[:id])\n\n respond_to do |format|\n if @address_range.update_attributes(params[:address_range])\n format.html { redirect_to(@address_range, :notice => 'Address range was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @address_range.errors, :status => :unprocessable_entity }\n end\n end\n end", "def test_inclusive_bounded_range_name_1_to_4_max_4\n header 'Range', 'name my-app-1..my-app-4; max=4'\n\n get '/'\n json_response = JSON.parse(last_response.body)\n\n assert last_response.ok?\n assert_equal Array, json_response.class\n assert_equal 4, json_response.count\n assert_equal 1, json_response.first['id']\n assert_equal 101, json_response.last['id']\n end", "def from_addresses\n return @from_addresses\n end", "def get_routing_sms_addresses_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RoutingApi.get_routing_sms_addresses ...\"\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/routing/sms/addresses\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'pageSize'] = opts[:'page_size'] if opts[:'page_size']\n query_params[:'pageNumber'] = opts[:'page_number'] if opts[:'page_number']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'SmsAddressEntityListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RoutingApi#get_routing_sms_addresses\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end" ]
[ "0.71258813", "0.70020956", "0.6716909", "0.6642833", "0.6642207", "0.6616891", "0.6436227", "0.6320094", "0.62539095", "0.6191286", "0.6138709", "0.61239856", "0.6113165", "0.60821533", "0.60797316", "0.6066117", "0.60290074", "0.59926397", "0.59444547", "0.59332615", "0.5902899", "0.590229", "0.5897955", "0.5893005", "0.5884807", "0.58624315", "0.5859061", "0.5852807", "0.5804991", "0.57663804", "0.57663804", "0.5759164", "0.5756738", "0.57485145", "0.57295394", "0.5691754", "0.5680879", "0.56766945", "0.5663243", "0.56550384", "0.5649555", "0.56468415", "0.5635363", "0.5615673", "0.5613437", "0.5597425", "0.55940694", "0.55868614", "0.55754906", "0.55692554", "0.55653816", "0.5562269", "0.5561416", "0.5553182", "0.55321646", "0.5512057", "0.550392", "0.54799885", "0.54790735", "0.54622495", "0.5462107", "0.5450233", "0.5441193", "0.54385906", "0.54377896", "0.54289776", "0.5406014", "0.53863406", "0.53845185", "0.5377557", "0.53735656", "0.5358325", "0.53574955", "0.5357276", "0.5357276", "0.5357276", "0.5353983", "0.535325", "0.5349242", "0.53385764", "0.5323029", "0.53216714", "0.53033626", "0.5277406", "0.52731735", "0.5267736", "0.52635664", "0.52566016", "0.5256111", "0.5252645", "0.524998", "0.524998", "0.52476907", "0.52372295", "0.5235895", "0.5225249", "0.52238446", "0.52197987", "0.5219134", "0.5215267" ]
0.764934
0
GET /address_ranges/1 GET /address_ranges/1.xml
def show @address_range = AddressRange.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @address_range } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @address_ranges = AddressRange.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @address_ranges }\n end\n end", "def addresses\n IbmCloudRest.get \"#{@uri}/addresses\"\n end", "def addresses\n message = { nodes: { item: resource[:name]}}\n transport[wsdl].get(:get_address, message)\n end", "def new\n @address_range = AddressRange.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @address_range }\n end\n end", "def get_address_books\n self.class.get('https://api.yesgraph.com/v0/address-books', :headers => @options)\n end", "def addresses\n @client.request('getaddressesbyaccount', name)\n end", "def show_addresses(**params)\n get('addresses', params)\n end", "def addresses\n query(:address)\n end", "def get_ip_ranges_with_http_info(opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: IPRangesAPI.get_ip_ranges ...'\n end\n # resource path\n local_var_path = '/'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'IPRanges'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || []\n\n new_options = opts.merge(\n :operation => :get_ip_ranges,\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 :api_version => \"V1\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: IPRangesAPI#get_ip_ranges\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def getaddressesbyaccount(account)\n request :getaddressesbyaccount, account\n end", "def list_addresses\n Address.list(@id)\n end", "def multi_addr(addresses)\n get(\"addr/\"+addresses.join(\",\")+\"/balance?noCache=1\")\n end", "def index\n @dhcp_ranges = DhcpRange.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dhcp_ranges }\n end\n end", "def index\n @ag_addresses = Ag::Address.all\n end", "def getRanges(path)\n @urlencode = URI.encode(path)\n call(RANGES_PATH + @urlencode)\n end", "def index\n if address_type==\"Address\"\n @addresses = Address.find(:all)\n else\n @addresses = Address.find_all_by_type(address_type)\n end\n @addresses ||= []\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @addresses }\n end\n end", "def addresses; end", "def addresses\n nodename = params[:node_id]\n @node = nodename == \"admin\" ? Node.admin.where(:available => true).first : Node.find_key(nodename)\n if params[:network]\n @net = Network.find_key(params[:network])\n res = {\n \"node\" => @node.name,\n \"network\" => @net.name,\n \"category\" => @net.category,\n \"addresses\" => @net.node_allocations(@node).map{|a|a.to_s}\n }\n render :json => res, :content_type=>cb_content_type(:addresses, \"object\")\n else\n res = []\n\n if params[:category]\n nets = Network.in_category(params[:category])\n else\n nets = Network.all\n end\n\n nets.each do |n|\n ips = n.node_allocations(@node)\n next if ips.empty?\n\n res << {\n \"node\" => @node.name,\n \"network\" => n.name,\n \"category\" => n.category,\n \"addresses\" => ips.map{|a|a.to_s}\n }\n end\n\n render :json => res, :content_type=>cb_content_type(:addresses, \"array\")\n end\n end", "def fetch_ranges\n begin\n res = Excon.get(\"#{url}.idx\")\n rescue Excon::Errors::Error\n raise \"Download of '#{url}.idx' failed\"\n end\n lines = res.body.lines.map { |line| line.split(\":\") }\n lines.each_index.each_with_object({}) do |i, ranges|\n # A typical line (before the split on `:`) looks like this:\n # `12:4593854:d=2016051118:TMP:2 mb:9 hour fcst:`\n line = lines[i]\n next_line = lines[i + 1] # NOTE: Will be `nil` on the last line\n\n # The fourth and fifth fields constitue the key to identify the records\n # defined in `Forecaster::Configuration`.\n key = \":#{line[3]}:#{line[4]}:\"\n\n # The second field is the first byte of the record in the GRIB2 file.\n ranges[key] = [line[1].to_i]\n\n # To get the last byte we need to read the next line.\n # If we are on the last line we won't be able to get the last byte,\n # but we don't need it according to the section 14.35.1 Byte Ranges\n # of RFC 2616.\n ranges[key] << next_line[1].to_i - 1 if next_line\n end\n end", "def call_address_service\n addresses = []\n success = call_ok?(:address_search, make_request) do |body|\n ServiceClient.iterate_element(body[:address_list]) do |address|\n add_address(addresses, address) unless address.nil?\n end\n end\n [success, addresses]\n end", "def index\n @product_ranges = ProductRange.find(:all)\n\n respond_to do |format|\n format.html # index.haml\n format.xml { render :xml => @product_ranges }\n end\n end", "def index\n @addresses = Address.paginate :page => params[:page], :order => 'street ASC'\n #@addresses = Address.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @addresses }\n end\n end", "def create\n @address_range = AddressRange.new(params[:address_range])\n\n respond_to do |format|\n if @address_range.save\n format.html { redirect_to(@address_range, :notice => 'Address range was successfully created.') }\n format.xml { render :xml => @address_range, :status => :created, :location => @address_range }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @address_range.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @reserved_addresses = ReservedAddress.all\n end", "def destroy\n @address_range = AddressRange.find(params[:id])\n @address_range.destroy\n\n respond_to do |format|\n format.html { redirect_to(address_ranges_url) }\n format.xml { head :ok }\n end\n end", "def getaddressesbyaccount(account)\n @api.request 'getaddressesbyaccount', account\n end", "def get_contract_addresses\n service_response = ClientManagement::GetContractAddresses.new(params).perform\n render_api_response(service_response)\n end", "def show\n @range_specification = RangeSpecification.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @range_specification }\n end\n end", "def index\n @addresses = Address.all\n end", "def index\n @addresses = Address.all\n end", "def all(options={})\n response = MLS.get('/addresses', options)\n MLS::Address::Parser.parse_collection(response.body)\n end", "def index\n\t\t@addresses = Address.all\t\n\tend", "def describe_addresses( options = {} )\n options = { :public_ip => [] }.merge(options)\n params = pathlist(\"PublicIp\", options[:public_ip])\n return response_generator(:action => \"DescribeAddresses\", :params => params)\n end", "def index\n @contacts = current_user.get_address_book_contacts\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @contacts }\n end\n end", "def get_address_book(user_id)\n self.class.get(\"https://api.yesgraph.com/v0/address-book/#{user_id}\",\n {\n :headers => @options\n }\n )\n end", "def address\n @client.request('getaccountaddress', name)\n end", "def get_aws_ips()\n content = open(\"https://ip-ranges.amazonaws.com/ip-ranges.json\").read\n resp = JSON.parse(content)['prefixes']\n ips = []\n resp.each do |prefix|\n ips << IPAddr.new(prefix['ip_prefix'])\n end\n return ips\nend", "def index\n @shooting_ranges = ShootingRange.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @shooting_ranges }\n end\n end", "def index\n @ripple_addresses = RippleAddress.all\n end", "def ip_ranges\n data.ip_ranges\n end", "def get_range\n\t\tRails.logger.info(\"HOST ------> #{request.host}\")\n\t\trespond({ topics: AToZEntry.select(:topic, :id).where(topic: params[:start]..params[:end]) })\n\tend", "def show\n @address = Address.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @address }\n end\n end", "def index\n @person_addresses = PersonAddress.all\n end", "def index\n if params[:x1]\n @places = Place.by_bounds( params[:x1], params[:y1], params[:x2], params[:y2], params )\n end\n #@places = Place.without_nodes\n respond_with(@places)\n end", "def show\n @dhcp_range = DhcpRange.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dhcp_range }\n end\n end", "def ip_range\n ip = @resource[:name].split('-')\n ip_range = NetAddr.range NetAddr::CIDR.create(ip.first), NetAddr::CIDR.create(ip.last)\n ip_range.unshift(ip.first).push(ip.last)\n end", "def getaddressesbyaccount(account)\n coind.getaddressesbyaccount account\n end", "def index\n @account_addresses = AccountAddress.all\n end", "def show\n @person = Person.find(params[:id])\n @addresses = @person.addresses\n end", "def index\n\n @ipranges = Iprange.all\n\n render json: @ipranges\n\n end", "def index\n @client_addresses = ClientAddress.all\n end", "def available_ips\n range = conf['addresses']['range']\n unless(range.to_s.empty?)\n range = (range.split('-').first.split('.').last..range.split('-').last).map{|oct|\n \"#{range.split('-').first.split('.').slice(0,3).join('.')}.#{oct}\"\n }\n else\n range = []\n end\n (conf['addresses']['static'] + range).compact\nend", "def update\n @address_range = AddressRange.find(params[:id])\n\n respond_to do |format|\n if @address_range.update_attributes(params[:address_range])\n format.html { redirect_to(@address_range, :notice => 'Address range was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @address_range.errors, :status => :unprocessable_entity }\n end\n end\n end", "def addresses\n @addresses\n end", "def get_range ( addr )\n\tindex = addr - @base\n\tif index >= @size\n\t return \"Q\", 0\n\tend\n\tif @map[index] == \"L\"\n\t return \"L\", addr + 4\n\tend\n\tt = @map[index]\n\tloop {\n\t index = index + 1\n\t break if index >= @size\n\t break if @map[index] != t\n\t}\n\treturn t, @base + index\n end", "def show\n @user_address = UserAddress.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user_address }\n end\n end", "def index\n @user_addresses = UserAddress.all\n end", "def show_address(id)\n get(\"addresses/#{id}\")\n end", "def index\n @sales_addresses = Sales::Address.all\n end", "def ranges\n @toc_id = 'ranges'\n end", "def index\n @addresses_people = AddressesPerson.all\n end", "def index\n @arrival_ranges = ArrivalRange.find(:all, :order => \"position ASC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @arrival_ranges }\n end\n end", "def get_address\n booking = Booking.where(user_id: current_user.id).last\n pick_up_addr = PickupAddress.where(:booking_id => booking.id).last\n drop_off_addr = DropoffAddress.where(:booking_id => booking.id).last\n hash = {:pick_up_addr => pick_up_addr.address, :drop_off_addr => drop_off_addr.address}\n respond_to do |format|\n format.json { render :json => hash.to_json, :status => 200 }\n end\n end", "def addresses\n Array(@addresses)\n end", "def getnewaddress\n @api.request 'getnewaddress'\n end", "def address\n AddressBuilder.new(opts).to_xml\n end", "def get_addresses\n parsed_script.get_addresses\n end", "def getaccountaddress(account)\n request :getaccountaddress, account\n end", "def index\n @rranges = Rrange.all\n end", "def allocation_range\n (@iprange or @subnet).to_range\n end", "def addresses(rev=nil, &block)\n return to_enum(:addresses, rev) if ! block_given?\n sections.each { |s| s.addresses(rev).each { |a| yield a } }\n end", "def index\n @weventaddresses = Weventaddress.all\n end", "def test_inclusive_bounded_range_name_1_to_4_max_4\n header 'Range', 'name my-app-1..my-app-4; max=4'\n\n get '/'\n json_response = JSON.parse(last_response.body)\n\n assert last_response.ok?\n assert_equal Array, json_response.class\n assert_equal 4, json_response.count\n assert_equal 1, json_response.first['id']\n assert_equal 101, json_response.last['id']\n end", "def index\n @vendor_addresses = VendorAddress.all\n end", "def show\n @address_type = AddressType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @address_type }\n end\n end", "def index\n @addresses = Address.scoped.order(sort_column + \" \" + sort_direction).paginate(:page => params[:page], :per_page => 30)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @addresses }\n end\n end", "def index\n @electronic_addresses = ElectronicAddress.all\n end", "def index\n @address_books = AddressBook.all\n end", "def index\n @address_books = AddressBook.all\n end", "def index\n @address_books = AddressBook.all\n end", "def show\n\t @addresses = @user.addresses\n end", "def show\n @product_range = ProductRange.find(params[:id])\n\n respond_to do |format|\n format.html # show.haml\n format.xml { render :xml => @product_range }\n end\n end", "def index\n @post_addresses = PostAddress.all\n end", "def show\n @address_book_item = AddressBookItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @address_book_item }\n end\n end", "def get_range\n\t\tif params.has_key?(\"start\") and params.has_key?(\"end\")\n\t\t\tif params[\"end\"] == \"Z\"\n\t\t\t\t# had to do some hackish stuff to include Z\n\t\t\t\tfirst = AToZEntry.select(:topic, :id).where(topic: params[:start]..params[:end])\n\t\t\t\tprefix = 'Z'\n\t\t\t\tsecond = AToZEntry.select(:topic, :id).where(\"topic LIKE :prefix\", prefix: \"#{prefix}%\")\n\t\t\t\trespond({ status: 0, topics: first+second })\n\t\t\telse\n\t\t\t\trespond({ status: 0, topics: AToZEntry.select(:topic, :id).where(topic: params[:start]..params[:end]) })\n\t\t\tend\t\t\t\n\t\telse\n\t\t\trespond({ status: 1, error: \"Must supply :start and :end parameter.\" })\n\t\tend\t\n\tend", "def index\n\t\t@addresses = current_user.addresses\n\tend", "def address_params\n end", "def index\n @customers_addresses = CustomersAddress.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers_addresses }\n end\n end", "def index\n @entity_end_point_rels = EntityEndPointRel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entity_end_point_rels }\n end\n end", "def index\n @address_books = AddressBook.find(:all, :include => :addresses, :order => 'address_books.rank ASC, addresses.rank ASC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @address_books }\n end\n end", "def test_inclusive_unbounded_range_id_1_order_desc\n header 'Range', 'id 1..; order=desc'\n\n get '/'\n json_response = JSON.parse(last_response.body)\n\n assert last_response.ok?\n assert_equal Array, json_response.class\n assert_equal 200, json_response.count\n assert_equal 201, json_response.first['id']\n assert_equal 2, json_response.last['id']\n end", "def get_range(key1, key2)\n @store_.get_range(key1, key2)\n end", "def get_range_data(spreadsheet_id, ranges)\n req_url = spreadsheet_path(\"#{spreadsheet_id}/values:batchGet?#{ranges}\")\n Api.get_with_google_auth(req_url, @access_token).parse\n end", "def get_routing_sms_addresses_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RoutingApi.get_routing_sms_addresses ...\"\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/routing/sms/addresses\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'pageSize'] = opts[:'page_size'] if opts[:'page_size']\n query_params[:'pageNumber'] = opts[:'page_number'] if opts[:'page_number']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'SmsAddressEntityListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RoutingApi#get_routing_sms_addresses\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def addresses\n @addresses ||= init_addresses\n end", "def index\n @addresses = Address.paginate(:page => params[:page], :per_page => 30).order('updated_at DESC')\n end", "def index\n @adresses = Adress.all\n end", "def get_listings_xml(url)\n @client.get_content(url)\n end", "def rdfs_range\n end", "def show\n @ip_addr = IpAddr.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ip_addr }\n end\n end" ]
[ "0.7589515", "0.6680216", "0.64837545", "0.6442109", "0.6379526", "0.6326249", "0.6319453", "0.6297263", "0.61365956", "0.6007442", "0.59893113", "0.598717", "0.59617144", "0.5916575", "0.5892676", "0.5883728", "0.58831286", "0.5863897", "0.58419794", "0.5834285", "0.5825903", "0.5791281", "0.5749692", "0.5745409", "0.573232", "0.57282025", "0.5711001", "0.570217", "0.56767106", "0.56767106", "0.5659279", "0.565261", "0.56386864", "0.5630055", "0.56153214", "0.55945134", "0.55876446", "0.5576797", "0.5570022", "0.55423224", "0.55413175", "0.5489426", "0.54830307", "0.54723614", "0.54676867", "0.54667145", "0.5459508", "0.5455917", "0.54477066", "0.54281235", "0.54174286", "0.54054856", "0.5405461", "0.54044473", "0.5384495", "0.5375248", "0.5373335", "0.53722745", "0.5371804", "0.5371546", "0.53696376", "0.534666", "0.53328705", "0.5331819", "0.5328755", "0.5317382", "0.5311718", "0.5306953", "0.52991813", "0.52845603", "0.525701", "0.5255065", "0.52547807", "0.5244167", "0.5238767", "0.52283543", "0.52188987", "0.5206425", "0.5206425", "0.5206425", "0.5199052", "0.51941097", "0.518839", "0.51873773", "0.51838917", "0.5178779", "0.51720506", "0.51616734", "0.5146465", "0.5144883", "0.51342624", "0.51235867", "0.51230556", "0.5122581", "0.5119623", "0.51146466", "0.51003927", "0.50991917", "0.5097016", "0.50876826" ]
0.7181083
1
GET /address_ranges/new GET /address_ranges/new.xml
def new @address_range = AddressRange.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @address_range } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @address_range = AddressRange.new(params[:address_range])\n\n respond_to do |format|\n if @address_range.save\n format.html { redirect_to(@address_range, :notice => 'Address range was successfully created.') }\n format.xml { render :xml => @address_range, :status => :created, :location => @address_range }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @address_range.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @range_specification = RangeSpecification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @range_specification }\n end\n end", "def index\n @address_ranges = AddressRange.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @address_ranges }\n end\n end", "def new\n @address = Address.new\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @address }\n end\n end", "def getnewaddress\n @api.request 'getnewaddress'\n end", "def new\n @address_book = AddressBook.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @address_book }\n end\n end", "def getnewaddress(account = nil)\n request :getnewaddress, account\n end", "def new\n @address_type = AddressType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @address_type }\n end\n end", "def new\n @address = Address.new\n @url = { controller: '/addresses', action: :create }\n end", "def new\n @person = Person.new\n @person.build_address\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end", "def new\n @user_address = UserAddress.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user_address }\n end\n end", "def new\n @address = Address.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @address }\n end\n end", "def new\n @address = Address.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @address }\n end\n end", "def new\n @address = Address.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @address }\n end\n end", "def new\n @arrival_range = ArrivalRange.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @arrival_range }\n end\n end", "def new\n @ip_addr = IpAddr.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ip_addr }\n end\n end", "def show\n @address_range = AddressRange.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @address_range }\n end\n end", "def new\n @node = Node.new\n @node.addresses.build\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @node }\n end\n end", "def new_address(account_name=nil)\n request('getnewaddress', account_name)\n end", "def new\n @dhcp_range = DhcpRange.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dhcp_range }\n end\n end", "def new_address\n @client.new_address(name)\n end", "def getnewaddress(account = nil)\n @api.request 'getnewaddress', account\n end", "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @location_region }\n end\n end", "def new\n build_resource({})\n resource.build_user_address\n respond_with self.resource\n end", "def create_address\n create_resource :address, {}\n end", "def new\n @lookup_set = LookupSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_set }\n end\n end", "def new\n @product_range = ProductRange.new\n\n respond_to do |format|\n format.html # new.haml\n format.xml { render :xml => @product_range }\n end\n end", "def new\n @origin = OriginAddr.new\n \n drop_breadcrumb('新增')\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @origin }\n end\n end", "def new\n @address_book_item = AddressBookItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @address_book_item }\n end\n end", "def new\n @shooting_range = ShootingRange.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shooting_range }\n end\n end", "def new\n @taddress = Taddress.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @taddress }\n end\n end", "def new\n @lookup_source = LookupSource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_source }\n end\n end", "def new\n @contributor_address = ContributorAddress.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contributor_address }\n end\n end", "def new\n @sub_region = SubRegion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sub_region }\n end\n end", "def new\n @domain_mapping = DomainMapping.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @domain_mapping }\n end\n end", "def create\n @address_book = AddressBook.new(params[:address_book])\n\n respond_to do |format|\n if @address_book.save\n flash[:notice] = :address_book_created.l\n format.html { redirect_to(address_books_url) }\n format.xml { render :xml => @address_book, :status => :created, :location => @address_book }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @address_book.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @region = parent.regions.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @region }\n end\n end", "def new\n @user_address = UserAddress.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_address }\n end\n end", "def new\n @addresstype = Addresstype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @addresstype }\n end\n end", "def new\n @uri_type = UriType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @uri_type }\n end\n end", "def new\n @pharmacy_range = PharmacyRange.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pharmacy_range }\n end\n end", "def new\n @title = \"New region\"\n @region = RegionTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @region }\n end\n end", "def new\n @event = Event.new\n @event.build_address\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @event }\n end\n end", "def new\n @place = Place.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @place }\n end\n end", "def new\n @place = Place.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @place }\n end\n end", "def new\n @place = Place.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @place }\n end\n end", "def new\n @place = Place.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @place }\n end\n end", "def new\n @place = Place.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @place }\n end\n end", "def new\n @place = Place.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @place }\n end\n end", "def new\n @place = Place.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @place }\n end\n end", "def create_new_addr_bounds(addr_codes)\n\t\t\taddr_codes.each do |ac|\n\t\t\t\t@address.addr_bounds.create(addr_code: ac)\n\t\t\tend\n\t\tend", "def new\n @customers_address = CustomersAddress.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customers_address }\n end\n end", "def new\n @address = Address.new\n end", "def new\n @location_tag = LocationTag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @location_tag }\n end\n end", "def create\n @addresses = Address.paginate(:page => params[:page], :per_page => 30).order('updated_at DESC')\n @address = Address.create(params[:address])\n end", "def create_address_book(principal_uri, url, properties)\n end", "def new\n @land = Land.new\n @address=Address.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @land }\n end\n end", "def new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @location }\n end\n end", "def new\n @technocal_client_address = TechnocalClientAddress.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @technocal_client_address }\n end\n end", "def new\n @address = Address.new\n render :partial => \"addresses/new\"\n end", "def new\n @balance = scope.new\n @routes = current_user.locations.collect(&:routes).flatten\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @balance }\n end\n end", "def new\n @pool = Pool.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pool }\n end\n end", "def new\n @pinrequest = Pinrequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pinrequest }\n end\n end", "def new\n @lookup = Lookup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lookup }\n end\n end", "def new\n @offset = Offset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offset }\n end\n end", "def new\n @pneighbour = Pneighbour.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pneighbour }\n end\n end", "def new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @location }\n end\n end", "def new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @location }\n end\n end", "def new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @location }\n end\n end", "def new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @location }\n end\n end", "def new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @location }\n end\n end", "def new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @location }\n end\n end", "def new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @location }\n end\n end", "def new\n @resource_allocation = ResourceAllocation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resource_allocation }\n end\n end", "def new\n @location = Location.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @location }\n end\n end", "def new \n @address=Address.new\nend", "def new\n @location = Location.new\n @pages = {}\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @location }\n end\n end", "def new\n @ipsearch = Ipsearch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ipsearch }\n end\n end", "def create\n @range_specification = RangeSpecification.new(params[:range_specification])\n\n respond_to do |format|\n if @range_specification.save\n format.html { redirect_to(@range_specification, :notice => 'Range specification was successfully created.') }\n format.xml { render :xml => @range_specification, :status => :created, :location => @range_specification }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @range_specification.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @lookup_rad = LookupRad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_rad }\n end\n end", "def new\n @reservation = Reservation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @reservation }\n end\n end", "def new\n @island = Island.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @island }\n end\n end", "def new\n @domain = Domain.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @domain }\n end\n end", "def new\n @lookup_scantask = LookupScantask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_scantask }\n end\n end", "def new\n @code_postal_ville = CodePostalVille.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @code_postal_ville }\n end\n end", "def new\n @lookup_eligibility_ineligibility = LookupEligibilityIneligibility.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_eligibility_ineligibility }\n end\n end", "def new\n @address = current_user.addresses.new\n @address.phones.build\n @address.faxs.build\n @address.emails.build\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @address }\n end\n end", "def new\n @neighborhood = Neighborhood.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @neighborhood }\n end\n end", "def new\n @old_route_tag = OldRouteTag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @old_route_tag }\n end\n end", "def new\n @entity_end_point_rel = EntityEndPointRel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entity_end_point_rel }\n end\n end", "def new\n @adress = Adresse.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @adress }\n end\n end", "def new\n @place = @event.places.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @place }\n end\n end", "def new_rest\n @item_usage = ItemUsage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item_usage }\n end\n end", "def new\n @people = People.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @people }\n end\n end", "def new_address\n scope = current_user && current_user.addresses || Address\n @new_address ||= scope.find_or_create_by(\n address: params[:address],\n city: City.find_or_create_by(name: city)\n )\n end", "def index\n @reserved_addresses = ReservedAddress.all\n end", "def new\n @lookup_demographicrelativerelationship = LookupDemographicrelativerelationship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_demographicrelativerelationship }\n end\n end", "def new\n @contacts = Contact.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contacts }\n end\n end", "def destroy\n @address_range = AddressRange.find(params[:id])\n @address_range.destroy\n\n respond_to do |format|\n format.html { redirect_to(address_ranges_url) }\n format.xml { head :ok }\n end\n end", "def new\n render_contact_partials\n\n @location = Location.new\n @location.contacts = [{:phone => [{}]}]\n\n respond_to do |format|\n format.html # new.html.haml\n format.xml { render :xml => @location }\n end\n end" ]
[ "0.7020179", "0.6578958", "0.6534841", "0.64456725", "0.636473", "0.63185894", "0.6191496", "0.61611456", "0.6108384", "0.6108164", "0.61023813", "0.60937256", "0.60937256", "0.60937256", "0.60822916", "0.60728127", "0.6062728", "0.60596687", "0.60425746", "0.6027718", "0.60194576", "0.595442", "0.5952616", "0.59336114", "0.58798385", "0.58645356", "0.5861366", "0.5853107", "0.5842931", "0.58321553", "0.5827348", "0.5826201", "0.57476175", "0.5731454", "0.57009864", "0.5685387", "0.5661806", "0.5655954", "0.56475645", "0.5627173", "0.5625846", "0.5622793", "0.56029844", "0.5600127", "0.5600127", "0.5600127", "0.5600127", "0.5600127", "0.5600127", "0.5600127", "0.55983925", "0.55926263", "0.5574397", "0.55685645", "0.55624753", "0.5546749", "0.554392", "0.55397147", "0.5530832", "0.55245733", "0.550911", "0.550877", "0.55073446", "0.5478596", "0.54751617", "0.5470616", "0.5465722", "0.5465375", "0.5465375", "0.5465375", "0.5465375", "0.5465375", "0.5465375", "0.5462542", "0.54603505", "0.545754", "0.5448187", "0.544623", "0.5443235", "0.54353523", "0.5431605", "0.54279345", "0.5427591", "0.54251355", "0.54248685", "0.54233426", "0.5413307", "0.5410444", "0.5403627", "0.539024", "0.53893626", "0.53841263", "0.53839076", "0.5377743", "0.5370783", "0.5369406", "0.53652245", "0.53618455", "0.53536403", "0.5349866" ]
0.7757886
0
POST /address_ranges POST /address_ranges.xml
def create @address_range = AddressRange.new(params[:address_range]) respond_to do |format| if @address_range.save format.html { redirect_to(@address_range, :notice => 'Address range was successfully created.') } format.xml { render :xml => @address_range, :status => :created, :location => @address_range } else format.html { render :action => "new" } format.xml { render :xml => @address_range.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @address_ranges = AddressRange.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @address_ranges }\n end\n end", "def set_Addresses(value)\n set_input(\"Addresses\", value)\n end", "def set_Addresses(value)\n set_input(\"Addresses\", value)\n end", "def set_Addresses(value)\n set_input(\"Addresses\", value)\n end", "def new\n @address_range = AddressRange.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @address_range }\n end\n end", "def create_new_addr_bounds(addr_codes)\n\t\t\taddr_codes.each do |ac|\n\t\t\t\t@address.addr_bounds.create(addr_code: ac)\n\t\t\tend\n\t\tend", "def destroy\n @address_range = AddressRange.find(params[:id])\n @address_range.destroy\n\n respond_to do |format|\n format.html { redirect_to(address_ranges_url) }\n format.xml { head :ok }\n end\n end", "def rrange_params\n params.require(:rrange).permit(:name, :zone_id)\n end", "def address_params\n end", "def iprange_params\n params.require(:iprange).permit(:ip_block_start, :ip_block_end, :ip_range, :kladr_city_code, :city_id, :ip)\n end", "def update\n @address_range = AddressRange.find(params[:id])\n\n respond_to do |format|\n if @address_range.update_attributes(params[:address_range])\n format.html { redirect_to(@address_range, :notice => 'Address range was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @address_range.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @addresses = Address.paginate(:page => params[:page], :per_page => 30).order('updated_at DESC')\n @address = Address.create(params[:address])\n end", "def addr_bound_params\n\t\t\tparams[:address][:addr_bounds_attributes][\"0\"][:addr_code].reject!{ |a| a.empty? }.sort\n\t\tend", "def create_elasticsearch_addressbase_data(title_address_data)\n id = title_address_data[:uprn]\n uri = URI.parse(\"#{$ELASTIC_SEARCH_ENDPOINT}\")\n conn = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Post.new \"/#{$ELASTICSEARCH_ADDRESSBASE}/#{$ELASTICSEARCH_POSTCODE_SEARCH}/#{id}\"\n request['Content-Type'] = 'application/json'\n request.body = title_address_data.to_json\n conn.request(request)\nend", "def addresses\n IbmCloudRest.get \"#{@uri}/addresses\"\n end", "def ip_range\n ip = @resource[:name].split('-')\n ip_range = NetAddr.range NetAddr::CIDR.create(ip.first), NetAddr::CIDR.create(ip.last)\n ip_range.unshift(ip.first).push(ip.last)\n end", "def addresses\n nodename = params[:node_id]\n @node = nodename == \"admin\" ? Node.admin.where(:available => true).first : Node.find_key(nodename)\n if params[:network]\n @net = Network.find_key(params[:network])\n res = {\n \"node\" => @node.name,\n \"network\" => @net.name,\n \"category\" => @net.category,\n \"addresses\" => @net.node_allocations(@node).map{|a|a.to_s}\n }\n render :json => res, :content_type=>cb_content_type(:addresses, \"object\")\n else\n res = []\n\n if params[:category]\n nets = Network.in_category(params[:category])\n else\n nets = Network.all\n end\n\n nets.each do |n|\n ips = n.node_allocations(@node)\n next if ips.empty?\n\n res << {\n \"node\" => @node.name,\n \"network\" => n.name,\n \"category\" => n.category,\n \"addresses\" => ips.map{|a|a.to_s}\n }\n end\n\n render :json => res, :content_type=>cb_content_type(:addresses, \"array\")\n end\n end", "def test_save_as_range\n remote_file_name = 'TestSaveAsRange.docx'\n\n upload_file File.join(local_test_folder, local_file), remote_data_folder + '/' + remote_file_name\n\n request_document_parameters = RangeDocument.new({:DocumentName => remote_data_folder + '/NewDoc.docx'})\n request = SaveAsRangeRequest.new(name: remote_file_name, range_start_identifier: 'id0.0.0', document_parameters: request_document_parameters, range_end_identifier: 'id0.0.1', folder: remote_data_folder)\n\n result = @words_api.save_as_range(request)\n assert_equal false, result.nil?\n end", "def create_address\n create_resource :address, {}\n end", "def call_address_service\n addresses = []\n success = call_ok?(:address_search, make_request) do |body|\n ServiceClient.iterate_element(body[:address_list]) do |address|\n add_address(addresses, address) unless address.nil?\n end\n end\n [success, addresses]\n end", "def create\n @dhcp_range = DhcpRange.new(params[:dhcp_range])\n\n respond_to do |format|\n if @dhcp_range.save\n format.html { redirect_to @dhcp_range, notice: 'Dhcp range was successfully created.' }\n format.json { render json: @dhcp_range, status: :created, location: @dhcp_range }\n else\n format.html { render action: \"new\" }\n format.json { render json: @dhcp_range.errors, status: :unprocessable_entity }\n end\n end\n end", "def postEntityInvoice_address( entity_id, building_number, address1, address2, address3, district, town, county, province, postcode, address_type)\n params = Hash.new\n params['entity_id'] = entity_id\n params['building_number'] = building_number\n params['address1'] = address1\n params['address2'] = address2\n params['address3'] = address3\n params['district'] = district\n params['town'] = town\n params['county'] = county\n params['province'] = province\n params['postcode'] = postcode\n params['address_type'] = address_type\n return doCurl(\"post\",\"/entity/invoice_address\",params)\n end", "def create(address, options={})\n \tparams = {:address => address}\n Mailgun.submit :post, list_url, params.merge(options)\n end", "def addresses; end", "def process_addresses(params)\n assign_attributes(params)\n save(validate: false)\n add_email!\n add_addresses!\n save\n end", "def ranges\n @toc_id = 'ranges'\n end", "def create\n if params[:daterange].present?\n daterange = params[:daterange].split(' - ')\n from = daterange.first.rstrip\n to = daterange.last.lstrip\n \n begin \n ClientApi.book_create params[:link], from, to, current_user.email \n redirect_to availabilities_path, notice: 'La Reserva ha sido creada correctamente'\n rescue\n flash[:error]= 'La Reserva ya existe o se ha detectado algun conflicto.'\n redirect_to availabilities_path\n end \n else\n redirect_to :root\n end\n end", "def create_elasticsearch_addressbase_mapping\n index_mapping = addressbase_es_mappings\n uri = URI.parse(\"#{$ELASTIC_SEARCH_ENDPOINT}/\")\n conn = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Put.new \"#{$ELASTICSEARCH_ADDRESSBASE}/_mapping/#{$ELASTICSEARCH_POSTCODE_SEARCH}/\"\n request['Content-Type'] = 'application/json'\n request.body = index_mapping\n conn.request(request)\nend", "def postEntityPostal_address( entity_id, building_number, address1, address2, address3, district, town, county, province, postcode, address_type, do_not_display)\n params = Hash.new\n params['entity_id'] = entity_id\n params['building_number'] = building_number\n params['address1'] = address1\n params['address2'] = address2\n params['address3'] = address3\n params['district'] = district\n params['town'] = town\n params['county'] = county\n params['province'] = province\n params['postcode'] = postcode\n params['address_type'] = address_type\n params['do_not_display'] = do_not_display\n return doCurl(\"post\",\"/entity/postal_address\",params)\n end", "def add_address(params)\n ad = AnubisNetwork::Model::AddAddress.new\n ad_arr = Array.new\n ad.domain_id = params[:domain_id]\n params[:address].each do |address|\n add = AnubisNetwork::Model::Address.new\n add.address = address\n ad_arr.push(add)\n end\n\n ad.address = ad_arr\n ad.import_type = params[:import_type]\n payload = ad.to_xmldoc_r\n result = @connection.rest_request(\n method: :post,\n path: \"/mps_setup/add_address/\",\n body: payload,\n session: params[:session]\n )\n xml = result.body.sub(/(?<=\\<n:add_addressResponse).*?(?=\\>)/,\"\")\n xml = xml.gsub(/(?=n:add_addressResponse).*?(?=\\>)/,\"add_addressResponse\")\n return Hash.from_xml(xml).to_json\n\n end", "def get_ip_ranges_with_http_info(opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: IPRangesAPI.get_ip_ranges ...'\n end\n # resource path\n local_var_path = '/'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'IPRanges'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || []\n\n new_options = opts.merge(\n :operation => :get_ip_ranges,\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 :api_version => \"V1\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: IPRangesAPI#get_ip_ranges\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @address_range = AddressRange.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @address_range }\n end\n end", "def create\n @ag_address = Ag::Address.new(ag_address_params)\n\n respond_to do |format|\n if @ag_address.save\n format.html { redirect_to @ag_address, notice: 'Address was successfully created.' }\n format.json { render :show, status: :created, location: @ag_address }\n else\n format.html { render :new }\n format.json { render json: @ag_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def validate_ip_ranges\n raise ActionController::RoutingError.new('Not Found') unless ::SfDbSync::IPConstraint.new.matches?(request)\n end", "def create\n @range_specification = RangeSpecification.new(params[:range_specification])\n\n respond_to do |format|\n if @range_specification.save\n format.html { redirect_to(@range_specification, :notice => 'Range specification was successfully created.') }\n format.xml { render :xml => @range_specification, :status => :created, :location => @range_specification }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @range_specification.errors, :status => :unprocessable_entity }\n end\n end\n end", "def addresses\n message = { nodes: { item: resource[:name]}}\n transport[wsdl].get(:get_address, message)\n end", "def range_type_params\n params.require(:range_type).permit(:name, :description)\n end", "def create(params = {})\n wrapped_params = { address: params }\n\n @client.make_request(:post, 'end_shippers', MODEL_CLASS, wrapped_params)\n end", "def create\n @arrival_range = ArrivalRange.new(params[:arrival_range])\n\n respond_to do |format|\n if @arrival_range.save\n format.html { redirect_to @arrival_range, notice: 'Arrival range was successfully created.' }\n format.json { render json: @arrival_range, status: :created, location: @arrival_range }\n else\n format.html { render action: \"new\" }\n format.json { render json: @arrival_range.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @reserved_addresses = ReservedAddress.all\n end", "def addresses\n @client.request('getaddressesbyaccount', name)\n end", "def combine_ranges(code, ranges); end", "def create_and_verify(params = {})\n wrapped_params = {}\n wrapped_params[:address] = params\n\n @client.make_request(:post, 'addresses/create_and_verify', MODEL_CLASS, wrapped_params).address\n end", "def create\n @rrange = Rrange.new(rrange_params)\n\n respond_to do |format|\n if @rrange.save\n format.html { redirect_to @rrange, notice: 'Rrange was successfully created.' }\n format.json { render :show, status: :created, location: @rrange }\n else\n format.html { render :new }\n format.json { render json: @rrange.errors, status: :unprocessable_entity }\n end\n end\n end", "def build_params_for_address()\n\n end", "def create\n @address = Address.new(address_params)\n @num = 1\n while Address.where([\"address_id = ?\", @num]).size > 0\n @num = @num+1\n end\n @address.address_id = @num\n @address.user_email = current_user.email\n respond_to do |format|\n if @address.save\n format.html { redirect_to home_path, notice: 'Address was successfully created.' }\n format.json { render :show, status: :created, location: @address }\n else\n format.html { render :new }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @dhcp_ranges = DhcpRange.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dhcp_ranges }\n end\n end", "def resource_params\n params.require(:address).permit(:place, :codigopostal, :estado, :municipio, :colonia, :domicilio, :country)\n end", "def addresses\n query(:address)\n end", "def multi_addr(addresses)\n get(\"addr/\"+addresses.join(\",\")+\"/balance?noCache=1\")\n end", "def ip_ranges\n data.ip_ranges\n end", "def authorize_port_range(sg, port_range, protocol, ip_range)\n rules = ip_permissions(sg)\n rules.create(parent_group_id: sg.id, from_port: port_range.min, to_port: port_range.max, ip_range: {\"cidr\" => ip_range}, ip_protocol: protocol)\n end", "def allocate_ip(range, node, suggestion = nil)\n logger.debug(\"Entering Network#{BarclampNetwork::NetworkUtils.log_name(self)}.allocate_ip(range: #{range}, node: #{BarclampNetwork::NetworkUtils.log_name(node)}, suggestion: #{suggestion}\")\n\n # Validate inputs\n return [400, \"No range specified\"] if range.nil?\n return [400, \"No node specified\"] if node.nil?\n\n # If the node already has an IP on this network then just return success\n results = BarclampNetwork::AllocatedIpAddress.where(:node_id => node.id).where(:network_id => id)\n if results.length > 0\n allocated_ip = results.first.ip\n logger.info(\"Network.allocate_ip: node #{BarclampNetwork::NetworkUtils.log_name(node)} already has address #{allocated_ip} on network #{BarclampNetwork::NetworkUtils.log_name(self)}, range #{range}\")\n net_info = build_net_info(node)\n net_info[\"address\"] = allocated_ip\n return [200, net_info]\n end\n\n subnet_addr = IPAddr.new(subnet.cidr)\n netmask_addr = subnet.get_netmask()\n\n # Find the ip range\n ip_range = ip_ranges.where(:name => range).first\n return [404, \"IP range not found\"] if ip_range.nil?\n\n index = IPAddr.new(ip_range.start_address.get_ip) & ~netmask_addr\n index = index.to_i\n stop_address = IPAddr.new(ip_range.end_address.get_ip) & ~netmask_addr\n stop_address = subnet_addr | (stop_address.to_i + 1)\n address = subnet_addr | index\n\n logger.debug(\"Starting address: #{address.to_s}\")\n\n if suggestion\n logger.info(\"Allocating with suggestion: #{suggestion}\")\n subsug = IPAddr.new(suggestion) & netmask_addr\n if subnet_addr == subsug\n if allocated_ips.where(:ip => suggestion).length == 0\n logger.info(\"Using suggestion: node #{BarclampNetwork::NetworkUtils.log_name(node)}, network #{BarclampNetwork::NetworkUtils.log_name(self)} #{suggestion}\")\n address = suggestion\n found = true\n end\n end\n end\n\n allocation_successful = false\n tries=5\n while !allocation_successful and tries>0\n if !found\n # Snag all the allocated IPs for this network and convert to a hash\n ips={}\n for allocated_ip in allocated_ips(true) do\n ips[allocated_ip.ip] = true\n end\n\n while !found do\n unless ips.key?(address.to_s)\n found = true\n break\n end\n index = index + 1\n address = subnet_addr | index\n break if address == stop_address\n end\n end\n\n if found\n begin\n BarclampNetwork::AllocatedIpAddress.transaction do\n ip_addr = BarclampNetwork::AllocatedIpAddress.new( :ip => address.to_s )\n ip_addr.node = node\n ip_addr.network = self\n ip_addr.save!\n\n node_ref = BarclampNetwork::NodeRef.new()\n node_ref.node = node\n node_ref.network = self\n node_ref.save!\n\n node.set_attrib(\"ip_address\", nil, 0, BarclampNetwork::AttribIpAddress)\n end\n\n allocation_successful = true\n net_info = build_net_info(node)\n net_info[\"address\"] = address.to_s\n rescue ActiveRecord::RecordNotUnique => ex\n found = false\n tries -= 1\n logger.warn(\"#{address.to_s} has already been allocated. Retrying...\")\n end\n else\n logger.info(\"Network.allocate_ip: no addresses available: node #{node.id}, network #{id}, range #{range}\")\n return [404, \"No addresses available\"]\n end\n end\n\n if !found and tries == 0\n logger.error(\"Network.allocate_ip: retries exceeded while allocating IP address for node #{BarclampNetwork::NetworkUtils.log_name(node)} network #{BarclampNetwork::NetworkUtils.log_name(self)} range #{range}\")\n return [404, \"Unable to allocate IP address due to retries exceeded\"]\n end\n\n logger.info(\"Network.allocate_ip: Assigned: node #{node.id}, network #{id}, range #{range}, ip #{address}\")\n [200, net_info]\n end", "def set_iprange\n @iprange = Iprange.find(params[:id])\n end", "def call\n begin\n context[:organization_addresses].each do |address|\n address = context.organization.organization_addresses.new(\n city: address[:city],\n street: address[:street],\n house_number: address[:house_number],\n phone: address[:phone])\n address.save\n end\n rescue => e\n context.fail!(message: e)\n end\n end", "def create_address_book(principal_uri, url, properties)\n end", "def address_params\n params.require(:address).permit(:vlan_id,\n :user_id,\n :ip,\n :mac_address,\n :usage,\n :start_date,\n :end_date,\n :application_form,\n :assigner,\n :recyclable)\n end", "def divide_individually(array_with_number_of_addresses)\n possible_ranges = []\n num = self.to_num()\n bits_to_move = 32 - @bits\n remaining_addresses = self.free\n array_with_number_of_addresses.each() {|number_of_addresses_for_subnet|\n if (2 ** bits_to_move) < number_of_addresses_for_subnet\n puts \"WARNING: could not allocate #{number_of_addresses_for_subnet} anymore (max #{(2 ** bits_to_move)})\"\n next\n end \n bits_to_move = [(Math.log(number_of_addresses_for_subnet+1)/Math.log(2)).to_i, bits_to_move].min \n possible_range = IpMask.create_from_num(num, 32 - bits_to_move)\n unless self.are_all_in_range?(possible_range)\n puts \"WARNING: the selected range '#{possible_range}' is outside the base range\"\n next\n end\n num += number_of_addresses_for_subnet\n puts \"[alloc #{number_of_addresses_for_subnet}] \\tpossible range: #{possible_range}\"\n possible_ranges << possible_range\n remaining_addresses -= (2 ** bits_to_move)\n #puts \"[to allocate = #{number_of_addresses_for_subnet}] => free = #{possible_range.free}\"\n }\n possible_ranges\n end", "def post_fundingsources_addresses_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FundingSourcesApi.post_fundingsources_addresses ...'\n end\n # resource path\n local_var_path = '/fundingsources/addresses'\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[:debug_body] || @api_client.object_to_http_body(opts[:'body'])\n\n # return_type\n return_type = opts[:debug_return_type] || 'CardholderAddressResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || []\n\n new_options = opts.merge(\n :operation => :\"FundingSourcesApi.post_fundingsources_addresses\",\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: FundingSourcesApi#post_fundingsources_addresses\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @ag_addresses = Ag::Address.all\n end", "def create\n @range_type = RangeType.new(range_type_params)\n\n respond_to do |format|\n if @range_type.save\n format.html { redirect_to @range_type, notice: 'Range type was successfully created.' }\n format.json { render :show, status: :created, location: @range_type }\n else\n format.html { render :new }\n format.json { render json: @range_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_address\n \n params[:place]\n address = ReceiverAddress.new(:label => params[:place], \n :city_id => params[:city_id], \n :address => params[:address])\n @receive.document = \"234\"\n @receiver.receiver_addresses << address\n respond_to do |format|\n format.html { render @receiver, action ='new'}\n end\n end", "def index\n @post_addresses = PostAddress.all\n end", "def add_range(left, right)\n \n end", "def add_range(left, right)\n \n end", "def expand_ranges(ranges)\n result = []\n ranges = ranges.split(',')\n ranges.each do |range|\n if(range.include? '-')\n range = range.split('-')\n a = range[0].to_i\n b = range[1].to_i\n [a..b].each do |i|\n result.push(i)\n end\n else\n result.push(range)\n end\n end\n\n return result\n end", "def addresses\n Array(@addresses)\n end", "def create\n @user_address = UserAddress.new(params[:user_address])\n\n respond_to do |format|\n if @user_address.save\n format.html { redirect_to(@user_address, :notice => 'User address was successfully created.') }\n format.xml { render :xml => @user_address, :status => :created, :location => @user_address }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user_address.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @address_book = AddressBook.new(params[:address_book])\n\n respond_to do |format|\n if @address_book.save\n flash[:notice] = :address_book_created.l\n format.html { redirect_to(address_books_url) }\n format.xml { render :xml => @address_book, :status => :created, :location => @address_book }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @address_book.errors, :status => :unprocessable_entity }\n end\n end\n end", "def address\n AddressBuilder.new(opts).to_xml\n end", "def address_params\n params.require(:address).permit(:address, :coverage_type_id)\n end", "def from_addresses=(value)\n @from_addresses = value\n end", "def make_request\n { RequestParameters: {}, SearchParameters: { 'ins1:Postcode' => postcode.upcase },\n SelectionOptions: { 'ins1:MaximumNumberOfRows' => 200, 'ins1:IncludeNonGeographicAddresses' => false,\n 'ins1:IncludeBFPOAddresses' => false, 'ins1:IncludeMultiResidenceAddresses' => false,\n 'ins1:IncludeNIAddresses' => true } }\n end", "def populate_address_list_from_params\n @address_list = []\n params.each do |key, value|\n next unless key.start_with? 'address_list_'\n\n address = Address.new.from_json(value)\n @address_list << address\n end\n end", "def resource_params\n params.require(:address).permit(\n :city_name,\n :postal_code,\n :address,\n :description,\n :identity_id,\n :country_id\n )\n end", "def create\n\t\t@address = current_user.addresses.new(address_params)\n\t\t@earring = Earring.find(@address.detail.earring_id)\n\n\t\trespond_to do |format|\n\t\t\tif @address.save\n\t\t\t\tformat.html { redirect_to \"/confirm\" }\n\t\t\t\tformat.json { render action: 'show', status: :created, location: @address }\n\t\t\telse\n\t\t\t\tformat.html { redirect_to \"/addresses/new?d=#{@address.detail.id}\" }\n\t\t\t\tformat.json { render json: @address.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def create\n @address_book = AddressBook.new(address_book_params)\n\n respond_to do |format|\n if @address_book.save\n format.html { redirect_to @address_book, notice: 'Address book was successfully created.' }\n format.json { render :show, status: :created, location: @address_book }\n else\n format.html { render :new }\n format.json { render json: @address_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sales_address = Sales::Address.new(sales_address_params)\n\n respond_to do |format|\n if @sales_address.save\n format.html { redirect_to sales_seller_address_path(@sales_seller, @sales_address), notice: \"Endereço adicionado com sucesso!\" }\n format.json { render :show, status: :created, location: @sales_address }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @sales_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def twodstructureregion_params\n params.require(:twodstructureregion).permit(:start, :end, :regiontype)\n end", "def set_address_type\n\n end", "def allocation_range\n (@iprange or @subnet).to_range\n end", "def addresses=(addresses)\n set_collection(CapsuleCRM::Address, addresses)\n end", "def person_address_params\n params.require(:person_address).permit(:person_address_id, :person_id, :preferred, :address1, :address2, :city_village, :state_province, :postal_code, :country, :latitude, :longitude, :creator, :date_created, :voided, :voided_by, :date_voided, :voided_by, :date_voided, :voided_reason, :county_district, :neighborhood_cell, :region, :subregion, :township_division, :uuid)\n end", "def allow_ip_ranges_only?(ip_range_list)\n allow_ip_range_list(ip_range_list, true)\n end", "def post_fundingsources_addresses(opts = {})\n data, _status_code, _headers = post_fundingsources_addresses_with_http_info(opts)\n data\n end", "def permit_request_params\n params.permit(:address)\n end", "def fill_in_with_multiple_addresses!\n expect(page).to have_content(CHOOSE_EXISTING)\n page.first('#button-new-address').trigger('click')\n fill_in_checkout_address!\n page.first('.addresses__address-use a').trigger('click')\n end", "def to_range\n\t\tIP.parse(self.start_ip)..IP.parse(self.end_ip)\n\tend", "def address_nodes # :nodoc:\n @address_nodes\n end", "def address_params\n params.require(:address).permit(:address_id, :line_1, :line_2, :city, :state, :zip_code, :county, :country, :community_id, :school_district)\n end", "def create\n @address = current_customer.addresses.build(\n province: Province.find(params[:province_id].to_i),\n country_code: params[:country_code],\n is_primary_address: address_params[:is_primary_address].to_i == 1,\n address_line_one: address_params[:address_line_one],\n address_line_two: address_params[:address_line_two],\n address_additional: address_params[:address_additional],\n city: address_params[:city],\n postal_code: address_params[:postal_code]\n )\n\n respond_to do |format|\n if @address.save\n format.html { redirect_to @address, notice: \"Address was successfully created.\" }\n format.json { render :show, status: :created, location: @address }\n else\n format.html { render :new }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end", "def addresses\n format_entities('gd$structuredPostalAddress', :format_address)\n end", "def create\n @account_address = AccountAddress.new(account_address_params)\n\n respond_to do |format|\n if @account_address.save\n format.html { redirect_to @account_address, notice: 'Account address was successfully created.' }\n format.json { render :show, status: :created, location: @account_address }\n else\n format.html { render :new }\n format.json { render json: @account_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post_address = PostAddress.new(post_address_params)\n\n respond_to do |format|\n if @post_address.save\n format.html { redirect_to @post_address, notice: 'Adress skapad.' }\n format.json { render action: 'show', status: :created, location: @post_address }\n else\n format.html { render action: 'new' }\n format.json { render json: @post_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def address_params\n params.require(:address).permit(:first_name, \n :last_name, \n :address_line_1, \n :address_line_2, \n :city, \n :state, \n :country, \n :addressable_id, \n :addressable_type,\n :uuid)\n end", "def set_addresses=(v)\n self.addresses = build_addresses(v)\n end", "def addressbook_params\n params.permit(:name, :email, :address, :phone, :organisation_id)\n end", "def callback_addresses\n request_api = \"#{api_call('api')}/namaster\"\n url = URI.parse(request_api)\n req = Net::HTTP.new(url.host, url.port)\n req.use_ssl = USE_SSL\n http = Net::HTTP::Get.new(url.request_uri)\n http['apiKey'] = api_call('key')\n res = req.request(http)\n result = JSON.parse(res.body)\n if Address.save_name_and_address_from_api(result)\n render :nothing => true, :layout => false, :status => 201\n else\n render :nothing => true, :layout => false, :status => 401\n end\n end", "def create\n @address = Address.new(params[:address])\n @address.type = params[:address][:address_type] unless params[:address][:address_type].blank?\n \n respond_to do |format|\n if @address.save\n flash[:notice] = 'Address was successfully created.'\n format.html { redirect_to( address_path(@address.id) ) }\n format.xml { render :xml => @address, :status => :created, :location => @address }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @address.errors, :status => :unprocessable_entity }\n end\n end\n end", "def addresses(rev=nil, &block)\n return to_enum(:addresses, rev) if ! block_given?\n sections.each { |s| s.addresses(rev).each { |a| yield a } }\n end" ]
[ "0.618804", "0.57795507", "0.57795507", "0.57795507", "0.5689063", "0.56120056", "0.55950505", "0.55307364", "0.54745066", "0.5470775", "0.5408936", "0.5361865", "0.53574586", "0.5313097", "0.5311192", "0.53001124", "0.52669245", "0.52386886", "0.5228782", "0.52141345", "0.51823837", "0.5182241", "0.5156433", "0.5149028", "0.5146414", "0.51360244", "0.5128233", "0.5117162", "0.5115607", "0.51091564", "0.509556", "0.50873816", "0.5061281", "0.50266254", "0.5024083", "0.5020373", "0.50168395", "0.5016625", "0.5002102", "0.49879104", "0.49758124", "0.49729103", "0.49634838", "0.49525043", "0.49503893", "0.49467444", "0.49351972", "0.49268296", "0.49210653", "0.49157703", "0.49133188", "0.4895423", "0.48944995", "0.48919475", "0.48813727", "0.48810205", "0.48799342", "0.4879615", "0.48747072", "0.4846487", "0.48463345", "0.48401955", "0.48184466", "0.48124835", "0.48124835", "0.4799366", "0.47989896", "0.47984782", "0.47858816", "0.4777202", "0.47763675", "0.47717884", "0.47654206", "0.47591835", "0.47587565", "0.47443655", "0.47424322", "0.473818", "0.47379866", "0.47372758", "0.47325745", "0.47270796", "0.47264862", "0.4723937", "0.4721886", "0.47151682", "0.47101262", "0.46996692", "0.4682179", "0.4681745", "0.46780804", "0.46719426", "0.4669812", "0.46690008", "0.46661434", "0.4657575", "0.46500662", "0.46476436", "0.46475023", "0.46471786" ]
0.676713
0
PUT /address_ranges/1 PUT /address_ranges/1.xml
def update @address_range = AddressRange.find(params[:id]) respond_to do |format| if @address_range.update_attributes(params[:address_range]) format.html { redirect_to(@address_range, :notice => 'Address range was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @address_range.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @address_range = AddressRange.find(params[:id])\n @address_range.destroy\n\n respond_to do |format|\n format.html { redirect_to(address_ranges_url) }\n format.xml { head :ok }\n end\n end", "def create\n @address_range = AddressRange.new(params[:address_range])\n\n respond_to do |format|\n if @address_range.save\n format.html { redirect_to(@address_range, :notice => 'Address range was successfully created.') }\n format.xml { render :xml => @address_range, :status => :created, :location => @address_range }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @address_range.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @address_ranges = AddressRange.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @address_ranges }\n end\n end", "def update_address(id, params)\n put(\"addresses/#{id}\", address: params, change_case: false)\n end", "def update\n respond_to do |format|\n if @ag_address.update(ag_address_params)\n format.html { redirect_to @ag_address, notice: 'Address was successfully updated.' }\n format.json { render :show, status: :ok, location: @ag_address }\n else\n format.html { render :edit }\n format.json { render json: @ag_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @address_range = AddressRange.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @address_range }\n end\n end", "def set_Addresses(value)\n set_input(\"Addresses\", value)\n end", "def set_Addresses(value)\n set_input(\"Addresses\", value)\n end", "def set_Addresses(value)\n set_input(\"Addresses\", value)\n end", "def update\n respond_to do |format|\n if @reserved_address.update(reserved_address_params)\n format.html { redirect_to vlan_path(find_vlan(@reserved_address)), notice: 'Reserved address was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @reserved_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @range_specification = RangeSpecification.find(params[:id])\n\n respond_to do |format|\n if @range_specification.update_attributes(params[:range_specification])\n format.html { redirect_to(@range_specification, :notice => 'Range specification was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @range_specification.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @address = Address.find(params[:id])\n @address.update_attributes(params[:address])\n @addresses = Address.paginate(:page => params[:page], :per_page => 30).order('updated_at DESC')\n end", "def update\n @address = @addressable.addresses.find_by_id(params[:id])\n\n respond_to do |format|\n if @address.update_attributes(params[:address])\n format.html { redirect_to current_user, notice: 'address was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @address_book = AddressBook.find(params[:id])\n\n respond_to do |format|\n if @address_book.update_attributes(params[:address_book])\n flash[:notice] = :address_book_updated.l\n format.html { redirect_to(address_books_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @address_book.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @arrival_range = ArrivalRange.find(params[:id])\n\n respond_to do |format|\n if @arrival_range.update_attributes(params[:arrival_range])\n format.html { redirect_to @arrival_range, notice: 'Arrival range was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @arrival_range.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @address_range = AddressRange.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @address_range }\n end\n end", "def update\n if @address.update(address_params)\n render json: @address\n else\n render json: @address.errors, status: :unprocessable_entity\n end\n end", "def set_iprange\n @iprange = Iprange.find(params[:id])\n end", "def update\n respond_to do |format|\n if @address_book.update(address_book_params)\n format.html { redirect_to @address_book, notice: 'Address book was successfully updated.' }\n format.json { render :show, status: :ok, location: @address_book }\n else\n format.html { render :edit }\n format.json { render json: @address_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @address_book.update(address_book_params)\n format.html { redirect_to @address_book, notice: 'Address book was successfully updated.' }\n format.json { render :show, status: :ok, location: @address_book }\n else\n format.html { render :edit }\n format.json { render json: @address_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @allowed_ip_ranges = args[:allowed_ip_ranges] if args.key?(:allowed_ip_ranges)\n end", "def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def update\n @dhcp_range = DhcpRange.find(params[:id])\n\n respond_to do |format|\n if @dhcp_range.update_attributes(params[:dhcp_range])\n format.html { redirect_to @dhcp_range, notice: 'Dhcp range was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dhcp_range.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(address, new_address, options={})\n params = {:address => new_address}\n Mailgun.submit :put, list_url(address), params.merge(options)\n end", "def test_save_as_range\n remote_file_name = 'TestSaveAsRange.docx'\n\n upload_file File.join(local_test_folder, local_file), remote_data_folder + '/' + remote_file_name\n\n request_document_parameters = RangeDocument.new({:DocumentName => remote_data_folder + '/NewDoc.docx'})\n request = SaveAsRangeRequest.new(name: remote_file_name, range_start_identifier: 'id0.0.0', document_parameters: request_document_parameters, range_end_identifier: 'id0.0.1', folder: remote_data_folder)\n\n result = @words_api.save_as_range(request)\n assert_equal false, result.nil?\n end", "def update\n respond_to do |format|\n if @address.update(address_params)\n format.html { redirect_to admin_path(current_user), notice: 'Address was successfully updated.' }\n format.json { render :show, status: :ok, location: @address }\n else\n format.html { render admin_path(current_user), error: 'Issue.' }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_address_book(address_book_id, prop_patch)\n end", "def create_elasticsearch_addressbase_mapping\n index_mapping = addressbase_es_mappings\n uri = URI.parse(\"#{$ELASTIC_SEARCH_ENDPOINT}/\")\n conn = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Put.new \"#{$ELASTICSEARCH_ADDRESSBASE}/_mapping/#{$ELASTICSEARCH_POSTCODE_SEARCH}/\"\n request['Content-Type'] = 'application/json'\n request.body = index_mapping\n conn.request(request)\nend", "def update\n respond_to do |format|\n if @address.update(address_params)\n format.html { redirect_to @address, notice: \"Address was successfully updated.\" }\n format.json { render :show, status: :ok, location: @address }\n else\n format.html { render :edit }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @address.update(address_params)\n format.html { redirect_to @address, notice: 'Address was successfully updated.' }\n format.json { render :show, status: :ok, location: @address }\n else\n format.html { render :edit }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_address_book\n @address_book = AddressBook.find(params[:id])\n end", "def set_address_book\n @address_book = AddressBook.find(params[:id])\n end", "def set_address_book\n @address_book = AddressBook.find(params[:id])\n end", "def update\n if @contact.address.update(address_params)\n render json: @contact.address\n else\n render json: @contact.errors, status: :unprocessable_entity\n end\n end", "def update\n @address = Address.find(params[:id])\n\n respond_to do |format|\n if @address.update_attributes(params[:address])\n format.html { redirect_to @address, notice: 'Address was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @address = Address.find(params[:id])\n\n respond_to do |format|\n if @address.update_attributes(params[:address])\n format.html { redirect_to @address, notice: 'Address was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @address = Address.find(params[:id])\n\n respond_to do |format|\n if @address.update_attributes(params[:address])\n format.html { redirect_to @address, notice: 'Address was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @address = Address.find(params[:id])\n\n respond_to do |format|\n if @address.update_attributes(params[:address])\n format.html { redirect_to @address, notice: 'Address was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @address = current_user.addresses.find(params[:id])\n\n respond_to do |format|\n if @address.update_attributes(params[:address])\n format.html { redirect_to user_address_path(current_user, @address), notice: 'Address was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @address = Address.find(params[:id])\n\n respond_to do |format|\n if @address.update_attributes(params[:address])\n format.html { redirect_to @address, :notice => 'Address was successfully updated.' }\n format.json { render :json => @address }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @address.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_addresslist\n @addresslist = Addresslist.find(params[:id])\n @cancel_path = addresslist_path(@addresslist)\n end", "def update\n @user_address = UserAddress.find(params[:id])\n\n respond_to do |format|\n if @user_address.update_attributes(params[:user_address])\n format.html { redirect_to(@user_address, :notice => 'User address was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user_address.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n authorize @address\n\n respond_to do |format|\n if @address.update(@pars)\n flash[:success] = \"Address was successfully updated. #{@pars.inspect}\"\n format.html { redirect_to addresses_path }\n format.json { render json: {locale: I18n.locale,\n user_id: @user_id,\n recyclable: @address.recyclable} }\n else\n flash[:danger] = \"There was a problem updating the address.\"\n format.html { render action: 'edit' }\n format.json { render json: @address.errors,\n status: :unprocessable_entity }\n end\n end\n end", "def update\n @address = current_user.addresses.find(params[:id])\n respond_to do |format|\n if @address.update_attributes(params[:address])\n format.html { redirect_to \"/#{current_user.name}\", notice: 'Address was successfully updated.' }\n format.json { head :no_content }\n else\n @address.phones.build\n @address.faxs.build\n @address.emails.build\n format.html { render action: \"edit\" }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @address.update(address_params)\n format.html { redirect_to home_path, notice: 'Address was successfully updated.' }\n format.json { render :show, status: :ok, location: @address }\n else\n format.html { render :edit }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @range_type.update(range_type_params)\n format.html { redirect_to @range_type, notice: 'Range type was successfully updated.' }\n format.json { render :show, status: :ok, location: @range_type }\n else\n format.html { render :edit }\n format.json { render json: @range_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @address_type = AddressType.find(params[:id])\n\n respond_to do |format|\n if @address_type.update_attributes(params[:address_type])\n format.html { redirect_to(@address_type, :notice => 'AddressType was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @address_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_deposit_address\n service_response = ClientManagement::UpdateDepositAddress.new(params).perform\n render_api_response(service_response)\n end", "def update\n # @address = Address.find(params[:id])\n @address = Address.find_by_permalink!(params[:id])\n \n respond_to do |format|\n if @address.update_attributes(params[:address])\n \n flash[:notice] = 'Address was successfully updated.'\n format.html { redirect_to(@address) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @address.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n user = User.find(params[:id])\n if user.address.update(address_params)\n render status: :ok\n else\n render status: :unprocessable_entity #was :bad_request\n end\n end", "def update\n respond_to do |format|\n if @address.update(address_params)\n format.html { redirect_to edit_company_path(@company), notice: 'Address was successfully updated.' }\n format.json { render :show, status: :ok, location: @address }\n else\n format.html { render :edit }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @address.update(address_params)\n format.html { redirect_to root_path, notice: 'Address was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end", "def set_address\n end", "def create_address\n create_resource :address, {}\n end", "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend", "def update\n respond_to do |format|\n if @ip_address.update(ip_address_params)\n format.html { redirect_to ip_addresses_path, notice: 'Ip address was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ip_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def touch_addresses\n if changes.include?(:bill_address_id) && self.bill_address.present?\n self.bill_address.touch\n end\n\n if changes.include?(:ship_address_id) && self.ship_address.present?\n self.ship_address.touch\n end\n end", "def address1_set(address)\n self.address1.set address\n end", "def set_Address1(value)\n set_input(\"Address1\", value)\n end", "def update\n respond_to do |format|\n if @account_address.update(account_address_params)\n format.html { redirect_to @account_address, notice: 'Account address was successfully updated.' }\n format.json { render :show, status: :ok, location: @account_address }\n else\n format.html { render :edit }\n format.json { render json: @account_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @person_address.update(person_address_params)\n format.html { redirect_to @person_address, notice: 'Person address was successfully updated.' }\n format.json { render :show, status: :ok, location: @person_address }\n else\n format.html { render :edit }\n format.json { render json: @person_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ip_addr = IpAddr.find(params[:id])\n\n respond_to do |format|\n if @ip_addr.update_attributes(params[:ip_addr])\n flash[:notice] = 'IpAddr was successfully updated.'\n format.html { redirect_to(@ip_addr) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ip_addr.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @address_book.update(address_book_params)\n format.html { redirect_to @address_book, notice: '更新完成!Address book updated!' }\n format.json { render :show, status: :ok, location: @address_book }\n else\n format.html { render :edit }\n format.json { render json: @address_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def iprange_params\n params.require(:iprange).permit(:ip_block_start, :ip_block_end, :ip_range, :kladr_city_code, :city_id, :ip)\n end", "def set_addresses=(v)\n self.addresses = build_addresses(v)\n end", "def call\n begin\n context[:organization_addresses].each do |address|\n address = context.organization.organization_addresses.new(\n city: address[:city],\n street: address[:street],\n house_number: address[:house_number],\n phone: address[:phone])\n address.save\n end\n rescue => e\n context.fail!(message: e)\n end\n end", "def update\n @organization = Organization.find(params[:id])\n unless params[:address].nil?\n if @organization.address\n @organization.address.update_attributes(params[:address])\n end\n end\n #if @address\n #updated_attributes = {name: org['name'], website: org['website'], org_type: org['org_type'], address_id: @address.id}\n #else\n #updated_attributes = {name: org['name'], website: org['website'], org_type: org['org_type'], address_id: nil}\n #end\n\n respond_to do |format|\n if @organization.update_attributes(params[:organization])# and @address.update_attributes(params[:address])\n format.html { redirect_to @organization, notice: 'Organization was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @address.update(address_params)\n format.html { redirect_to @address, notice: 'Form was updated successfully!' }\n format.json { render :show, status: :ok, location: @address }\n else\n format.html { render :edit }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user_address = UserAddress.find(params[:id])\n\n respond_to do |format|\n if @user_address.update_attributes(params[:user_address])\n format.html { redirect_to @user_address, notice: 'User address was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_reserved_address\n @reserved_address = ReservedAddress.find(params[:id])\n end", "def contract_address_update_template\n 'contract_address_update'\n end", "def update\n respond_to do |format|\n if @rrange.update(rrange_params)\n format.html { redirect_to @rrange, notice: 'Rrange was successfully updated.' }\n format.json { render :show, status: :ok, location: @rrange }\n else\n format.html { render :edit }\n format.json { render json: @rrange.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_address\n @address = Address.find(params[:id])\n end", "def set_address\n @address = Address.find(params[:id])\n end", "def set_address\n @address = Address.find(params[:id])\n end", "def set_address\n @address = Address.find(params[:id])\n end", "def update\n respond_to do |format|\n if @ripple_address.update(ripple_address_params)\n format.html { redirect_to @ripple_address, notice: 'Ripple address was successfully updated.' }\n format.json { render :show, status: :ok, location: @ripple_address }\n else\n format.html { render :edit }\n format.json { render json: @ripple_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @post_address.update(post_address_params)\n format.html { redirect_to @post_address, notice: 'Adress uppdaterad.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def []=( addr, val )\n range( addr ).value = val\n end", "def update\n @shooting_range = ShootingRange.find(params[:id])\n\n respond_to do |format|\n if @shooting_range.update_attributes(params[:shooting_range])\n format.html { redirect_to(@shooting_range, :notice => 'Shooting range was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @shooting_range.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @user_address.update(user_address_params)\n format.html { redirect_to @user_address, notice: \"User address was successfully updated.\" }\n format.json { render :show, status: :ok, location: @user_address }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @user_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_address\n @address = Address.find params[:id]\n end", "def set_address\n @address = Address.find params[:id]\n end", "def update\n respond_to do |format|\n if @user_address.update(user_address_params)\n format.html { redirect_to user_addresses_path, notice: 'User address was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end", "def update\n respond_to do |format|\n if @client_address.update(client_address_params)\n format.html { redirect_to @client_address, notice: 'Client address was successfully updated.' }\n format.json { render :show, status: :ok, location: @client_address }\n else\n format.html { render :edit }\n format.json { render json: @client_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def addresses=(addresses)\n set_collection(CapsuleCRM::Address, addresses)\n end", "def update\n respond_to do |format|\n if @venue_address.update(venue_address_params)\n format.html { redirect_to @venue_address, notice: 'Venue address was successfully updated.' }\n format.json { render :show, status: :ok, location: @venue_address }\n else\n format.html { render :edit }\n format.json { render json: @venue_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_address\n @address = Address.find(params[:id])\n end", "def set_address\n @address = Address.find(params[:id])\n end", "def set_address\n @address = Address.find(params[:id])\n end", "def set_address\n @address = Address.find(params[:id])\n end", "def set_address\n @address = Address.find(params[:id])\n end", "def set_address\n @address = Address.find(params[:id])\n end", "def set_address\n @address = Address.find(params[:id])\n end", "def set_address\n @address = Address.find(params[:id])\n end", "def set_address\n @address = Address.find(params[:id])\n end", "def set_address\n @address = Address.find(params[:id])\n end", "def set_address\n @address = Address.find(params[:id])\n end", "def set_address\n @address = Address.find(params[:id])\n end" ]
[ "0.6048564", "0.6047081", "0.5803277", "0.5617189", "0.55028325", "0.5500738", "0.549334", "0.549334", "0.549334", "0.5490639", "0.54773134", "0.5451156", "0.5450174", "0.544981", "0.5437329", "0.5435551", "0.5423937", "0.5389015", "0.5377304", "0.5377304", "0.53731817", "0.5362334", "0.5313652", "0.5311809", "0.5298831", "0.5290102", "0.5284414", "0.5267441", "0.52646786", "0.5262512", "0.5235508", "0.5235508", "0.5235508", "0.5225151", "0.52051276", "0.52051276", "0.52051276", "0.52051276", "0.5202339", "0.5198526", "0.5189527", "0.51782644", "0.51701933", "0.5157637", "0.5152542", "0.5133258", "0.5132139", "0.51180977", "0.5106539", "0.509983", "0.50903326", "0.50840354", "0.5069393", "0.5043138", "0.50261253", "0.50228083", "0.5009371", "0.50080943", "0.50025517", "0.49893612", "0.49826974", "0.49810547", "0.49769428", "0.49765778", "0.4972433", "0.4972078", "0.49626827", "0.49618134", "0.49578357", "0.49507964", "0.49486202", "0.49430254", "0.49426192", "0.49360883", "0.49360883", "0.49360883", "0.49360883", "0.4922523", "0.49172753", "0.49169424", "0.49140513", "0.4905953", "0.49038085", "0.49038085", "0.49033526", "0.48971936", "0.48918846", "0.4891409", "0.4889777", "0.4889777", "0.4889777", "0.4889777", "0.4889777", "0.4889777", "0.4889777", "0.4889777", "0.4889777", "0.4889777", "0.4889777", "0.4889777" ]
0.6945595
0
DELETE /address_ranges/1 DELETE /address_ranges/1.xml
def destroy @address_range = AddressRange.find(params[:id]) @address_range.destroy respond_to do |format| format.html { redirect_to(address_ranges_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n # @address = Address.find(params[:id])\n @address = Address.find_by_permalink!(params[:id])\n @address.destroy\n\n respond_to do |format|\n format.html { redirect_to(addresses_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @addresses = Address.paginate(:page => params[:page], :per_page => 5).order('updated_at DESC')\n @address = Address.find(params[:id])\n @error = nil\n\n begin\n @address.destroy\n rescue ActiveRecord::DeleteRestrictionError => e\n @error = e.message\n end\n end", "def destroy\n @address = Address.find(params[:id])\n @address.destroy\n\n respond_to do |format|\n format.html { redirect_to(:action=>'index') }\n format.xml { head :ok }\n end\n end", "def destroy\n @user_address = UserAddress.find(params[:id])\n @user_address.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_addresses_url) }\n format.xml { head :ok }\n end\n end", "def delete_address(id)\n delete(\"addresses/#{id}\")\n end", "def delete_elasticsearch_addressbase_data\n uri = URI.parse(\"#{$ELASTIC_SEARCH_ENDPOINT}/\")\n conn = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Delete.new \"#{$ELASTICSEARCH_ADDRESSBASE}\"\n request['Content-Type'] = 'application/json'\n conn.request(request)\nend", "def delete_address_book(address_book_id)\n end", "def destroy\n @ip_addr = IpAddr.find(params[:id])\n @ip_addr.destroy\n\n respond_to do |format|\n format.html { redirect_to(ip_addrs_url) }\n format.xml { head :ok }\n end\n end", "def delete_address_list(id)\n delete(\"addressGroups/#{id}\")\n end", "def destroy\n @ag_address.destroy\n respond_to do |format|\n format.html { redirect_to ag_addresses_url, notice: 'Address was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n @addresses = Address.where(person_id: params[:id])\n @addresses.each do |c|\n Address.find(c.id).destroy\n end\n Person.find(params[:id]).destroy\n redirect_to :action => 'list'\n end", "def destroy\n @address_book = AddressBook.find(params[:id])\n @address_book.destroy\n flash[:notice] = :address_book_deleted.l\n\n respond_to do |format|\n format.html { redirect_to(address_books_url) }\n format.xml { head :ok }\n end\n end", "def delete\n @carddav_backend.delete_address_book(@address_book_info['id'])\n end", "def delete_address(address)\n address.delete!\n end", "def destroy\n @dhcp_range = DhcpRange.find(params[:id])\n @dhcp_range.destroy\n\n respond_to do |format|\n format.html { redirect_to dhcp_ranges_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @address_type = AddressType.find(params[:id])\n @address_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(address_types_url) }\n format.xml { head :ok }\n end\n end", "def delete_address(name,region)\n data = false\n conn = @ec2_main.environment.connection\n if conn != nil\n response = conn.delete_address(name,region)\n if response.status == 200\n data = response.body\n else\n data = {}\n end\n else\n raise \"Connection Error\"\n end\n return data\n end", "def destroy\n @address = Address.find(params[:id])\n @address.destroy\n\n respond_to do |format|\n format.html { redirect_to addresses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @address = Address.find(params[:id])\n @address.destroy\n\n respond_to do |format|\n format.html { redirect_to addresses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @address = Address.find(params[:id])\n @address.destroy\n\n respond_to do |format|\n format.html { redirect_to addresses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @address = Address.find(params[:id])\n @address.destroy\n\n respond_to do |format|\n format.html { redirect_to addresses_url }\n format.json { head :no_content }\n end\n end", "def delete\n @address = Address.find(params[:address_id])\n end", "def destroy\n @address.destroy\n respond_to do |format|\n format.html { redirect_to admin_path(current_user), notice: 'Address was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @address.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Address was successfully destroyed.' }\n end\n end", "def delete_address\n @mailing_list_address.destroy if @ok\n render 'update_addresses'\n end", "def destroy\n\t\t@address = Address.find(params[:id])\n\t\t@address.coordinates.each do |c|\n\t\t\tc.destroy\n\t\tend\n\t\tredirect_to address_url(@address)\n\tend", "def destroy\n @address = current_user.addresses.find(params[:id])\n @address.destroy\n\n respond_to do |format|\n format.html { redirect_to user_addresses_path(current_user) }\n format.json { head :no_content }\n end\n end", "def destroy\n @address_book.destroy\n respond_to do |format|\n format.html { redirect_to address_books_url, notice: '删除完成!Address book destroyed!' }\n format.json { head :no_content }\n end\n end", "def destroy\n @contributor_address = ContributorAddress.find(params[:id])\n @contributor_address.destroy\n\n respond_to do |format|\n format.html { redirect_to contributor_addresses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @address.destroy\n respond_to do |format|\n format.html { redirect_to addresses_url, notice: \"Address was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @address.destroy\n respond_to do |format|\n format.html { redirect_to addresses_url, notice: \"Address was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @address.destroy\n respond_to do |format|\n format.html { redirect_to addresses_url, notice: 'Address was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @address = Address.find(params[:id])\n @address.destroy\n\n respond_to do |format|\n format.html { render :partial => 'addresses/list' }\n end\n end", "def destroy\n @technocal_client_address = TechnocalClientAddress.find(params[:id])\n @technocal_client_address.destroy\n\n respond_to do |format|\n format.html { redirect_to(technocal_client_addresses_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @address_book.destroy\n respond_to do |format|\n format.html { redirect_to address_books_url, notice: 'Address book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @address_book.destroy\n respond_to do |format|\n format.html { redirect_to address_books_url, notice: 'Address book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete!\n PoolNode.rmdir(@id)\n super\n Address.delete(@id)\n Subnet.delete(@subnet)\n end", "def destroy\n @post_address.destroy\n respond_to do |format|\n format.html { redirect_to post_addresses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customers_address = CustomersAddress.find(params[:id])\n @customers_address.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_addresses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @address_book_item = AddressBookItem.find(params[:id])\n @address_book_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(address_book_items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user_address = UserAddress.find(params[:id])\n @user_address.destroy\n\n respond_to do |format|\n format.html { redirect_to user_addresses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @address.destroy\n\n render :nothing => true\n end", "def destroy\n @ip_address.destroy\n respond_to do |format|\n format.html { redirect_to ip_addresses_path }\n format.json { head :no_content }\n end\n end", "def delete(address)\n \tMailgun.submit :delete, list_url(address)\n end", "def destroy\n @electronic_address.destroy\n respond_to do |format|\n format.html { redirect_to electronic_addresses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @address.destroy\n respond_to do |format|\n format.html { redirect_to edit_company_path(@company), notice: 'Address was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @address.destroy\n respond_to do |format|\n format.html { redirect_to url_back, notice: 'Address was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @address = current_user.addresses.find(params[:id])\n @address.destroy\n\n respond_to do |format|\n format.html { redirect_to addresses_url }\n format.json { head :no_content }\n format.js { render :js => \"$(this).parent().parent().remove(); this.preventDefault();\" } \n end\n end", "def destroy\n @account_address.destroy\n respond_to do |format|\n format.html { redirect_to account_addresses_url, notice: 'Account address was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @billing_address = BillingAddress.find(params[:id])\n @billing_address.destroy\n\n respond_to do |format|\n format.html { redirect_to billing_addresses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @range_specification = RangeSpecification.find(params[:id])\n @range_specification.destroy\n\n respond_to do |format|\n format.html { redirect_to(range_specifications_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @ripple_address.destroy\n respond_to do |format|\n format.html { redirect_to ripple_addresses_url, notice: 'Ripple address was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @taddress = Taddress.find(params[:id])\n @taddress.destroy\n \n respond_to do |format|\n format.html { redirect_to taddresses_url }\n format.json { head :ok }\n end\n end", "def delete_old_addresses\n\n # Fetch token id\n # delete if any address present in token addresses table and client_wallet_addresses table\n\n token_id = @token_details.id\n ClientWalletAddress.where(client_id: @client_id, sub_environment: GlobalConstant::Base.sub_environment_name ).destroy_all\n token_addresses = TokenAddresses.where(token_id: token_id, kind: GlobalConstant::TokenAddresses.owner_address_kind).first\n\n if token_addresses.present? && token_addresses.known_address_id.present?\n SaasApi::WalletAddress::RemoveKnownAddress.new.perform({known_address_id: token_addresses.known_address_id, client_id: @client_id})\n token_addresses.destroy!\n end\n\n success\n\n end", "def destroy\n @user_address.destroy\n respond_to do |format|\n format.html { redirect_to user_addresses_path, notice: 'User address was successfully destroyed.' }\n end\n end", "def destroy\n @address_record.destroy\n respond_to do |format|\n format.html { redirect_to address_records_url, notice: 'Address record was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @person_address.destroy\n respond_to do |format|\n format.html { redirect_to person_addresses_url, notice: 'Person address was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def deleteEntityInvoice_address( entity_id)\n params = Hash.new\n params['entity_id'] = entity_id\n return doCurl(\"delete\",\"/entity/invoice_address\",params)\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def destroy\n @sulabh_address.destroy\n respond_to do |format|\n format.html { redirect_to sulabh_addresses_url, notice: 'Sulabh address was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end", "def destroy\n @mortgage_address.destroy\n respond_to do |format|\n format.html { redirect_to mortgage_addresses_url, notice: 'Mortgage address was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @address.destroy\n respond_to do |format|\n format.html { redirect_to addresses_url, notice: 'Form was deleted successfully!' }\n format.json { head :no_content }\n end\n end", "def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end", "def destroy\n @sales_address.destroy\n respond_to do |format|\n format.html { redirect_to sales_seller_addresses_path(@sales_seller), notice: \"Endereço removido com sucesso!\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @client_address.destroy\n respond_to do |format|\n format.html { redirect_to client_addresses_url, notice: 'Client address was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_address_group(id)\n delete(\"addressGroups/#{id}\")\n end", "def test_remove_range\n remote_file_name = 'TestRemoveRange.docx'\n\n upload_file File.join(local_test_folder, local_file), remote_data_folder + '/' + remote_file_name\n\n request = RemoveRangeRequest.new(name: remote_file_name, range_start_identifier: 'id0.0.0', range_end_identifier: 'id0.0.1', folder: remote_data_folder)\n\n result = @words_api.remove_range(request)\n assert_equal false, result.nil?\n end", "def destroy\n @user_address.destroy\n respond_to do |format|\n format.html { redirect_to user_addresses_url, notice: \"User address was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def delete_segment_batch(segment_id_array)\n payload = segment_id_array.to_s\n url = \"#{@base_url}/segments_batch\"\n return RestClient::Request.execute(:method => :delete, :url => url, :payload => payload){|response, request, result| response }\n end", "def destroy\n @host_address.destroy\n respond_to do |format|\n format.html { redirect_to host_addresses_url, notice: 'Host address was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_range( ref )\n delete( Element.new( sheet, ref ) )\n end", "def destroy\n @pharmacy_range = PharmacyRange.find(params[:id])\n @pharmacy_range.destroy\n\n respond_to do |format|\n format.html { redirect_to(pharmacy_ranges_url) }\n format.xml { head :ok }\n end\n end", "def delete_virtual_address\n super\n end", "def destroy\n @user_address_book_item = UserAddressBookItem.find(params[:id])\n @user_address_book_item.destroy\n end", "def destroy\n @shooting_range = ShootingRange.find(params[:id])\n @shooting_range.destroy\n\n respond_to do |format|\n format.html { redirect_to(shooting_ranges_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @arrival_range = ArrivalRange.find(params[:id])\n @arrival_range.destroy\n\n respond_to do |format|\n format.html { redirect_to arrival_ranges_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @address_detail.destroy\n respond_to do |format|\n format.html { redirect_to address_details_url, notice: 'Address detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"/organizations/#{org_id}/railguns/#{id}\")\n end", "def destroy\n @customer_address.destroy\n respond_to do |format|\n format.html { redirect_to customer_addresses_url, notice: 'Customer address was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @config_xml = ConfigXml.find(params[:id])\n @config_xml.destroy\n\n respond_to do |format|\n format.html { redirect_to(config_xmls_url) }\n format.xml { head :ok }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end", "def destroy\n @sub_region = SubRegion.find(params[:id])\n @sub_region.destroy\n\n respond_to do |format|\n format.html { redirect_to(sub_regions_url) }\n format.xml { head :ok }\n end\n end", "def delink_addresses\n delink_addresses_validation\n save\n end", "def destroy\n @segment = Segment.find(params[:id])\n @segment.destroy\n\n respond_to do |format|\n format.html { redirect_to(worldreach_segments_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @delivery_address = DeliveryAddress.find(params[:id])\n @delivery_address.destroy\n\n respond_to do |format|\n format.html { redirect_to delivery_addresses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @adress = Adresse.find(params[:id])\n @adress.destroy\n\n respond_to do |format|\n format.html { redirect_to adresses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @domain_mapping = DomainMapping.find(params[:id])\n @domain_mapping.destroy\n\n respond_to do |format|\n format.html { redirect_to(domain_mappings_url) }\n format.xml { head :ok }\n end\n end", "def remove(address_or_id)\n delete(\"#{domain}/complaints/#{address_or_id}\")\n end", "def destroy\n @addresses_person.destroy\n respond_to do |format|\n format.html { redirect_to addresses_people_url, notice: 'Addresses person was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @venue_address.destroy\n respond_to do |format|\n format.html { redirect_to venue_addresses_url, notice: 'Venue address was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @vendor_address.destroy\n respond_to do |format|\n format.html { redirect_to vendor_addresses_url, notice: 'Vendor address was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n find_vlan(@reserved_address)\n @reserved_address.destroy\n redirect_to vlan_path(@vlan) \n end", "def destroy\n @node_config = NodeConfig.destroy(params[:id])\n xml=@node_config.to_xml\n json=@node_config.to_json\n @node_config.destroy\n\n respond_to do |format|\n format.html { redirect_to(node_configs_url) }\n format.json { render :json => json}\n format.xml { render :xml => xml}\n end\n end", "def destroy\n @addresstype = Addresstype.find(params[:id])\n @addresstype.destroy\n\n respond_to do |format|\n format.html { redirect_to addresstypes_url }\n format.json { head :no_content }\n end\n end", "def delete(name, action, seqno)\n configure([\"no route-map #{name} #{action} #{seqno}\"])\n end", "def destroy\n @ip_adress.destroy\n respond_to do |format|\n format.html { redirect_to ip_adresses_url, notice: 'Ip adress was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @address_search.destroy\n respond_to do |format|\n format.html { redirect_to address_searches_url, notice: 'Address search was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"#{uri_prefix}/virtual_dns/#{id}\")\n end", "def delete(contactname)\n\n end", "def delete_pool_member pool_name, address, port\n response = RestClient.delete(\"http://#{@host}/loadbalancers/tenant/#{@tenant}/pools/#{pool_name}/services/#{address + '%3a' + port.to_s}\",\n :content_type => :json,\n :accept => :json,\n :'X-Auth-Token' => @keystone_token)\n case response.code\n when 202\n parse_jobids response\n when 204\n []\n else\n raise LBModelException.new \"Expected HTTP 202 or 204 but got #{response.code} instead\"\n end\n end" ]
[ "0.6621146", "0.6513962", "0.64668447", "0.64514786", "0.64365184", "0.639238", "0.6360946", "0.6347938", "0.6303641", "0.6299742", "0.6296713", "0.62823236", "0.6269874", "0.6232789", "0.621946", "0.62039477", "0.6174779", "0.61666787", "0.61666787", "0.61666787", "0.61666787", "0.61409", "0.61150193", "0.6102701", "0.6102571", "0.6097058", "0.6082348", "0.60725546", "0.6060162", "0.6043141", "0.6043141", "0.6041783", "0.60406065", "0.6017486", "0.6001822", "0.6001822", "0.6000731", "0.5999188", "0.5976356", "0.5974389", "0.5971484", "0.5970087", "0.59551984", "0.59547794", "0.5937046", "0.58996475", "0.5897937", "0.5889522", "0.587797", "0.58663446", "0.58581924", "0.58343065", "0.5827705", "0.58168817", "0.5810159", "0.5801819", "0.58011746", "0.57907134", "0.578802", "0.57857436", "0.5773184", "0.5763435", "0.57498354", "0.57485557", "0.5747517", "0.57459795", "0.57442594", "0.57426894", "0.5726346", "0.56930363", "0.5690745", "0.56808287", "0.56746787", "0.56633544", "0.56622344", "0.5657865", "0.56330526", "0.562813", "0.56274515", "0.56186455", "0.56184775", "0.5614884", "0.55921763", "0.559041", "0.55788493", "0.5568382", "0.555383", "0.55451614", "0.5543803", "0.553094", "0.55270463", "0.5526205", "0.5509392", "0.5507884", "0.5499805", "0.54930586", "0.5488477", "0.5485749", "0.54841745", "0.54728705" ]
0.74123067
0
Returns INTEGER counting days in current month.
def days_in_current_month current_month = Time.now.month current_year = Time.now.year return Time.days_in_month(current_month, current_year) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def days_in_month\n raw = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][self.month]\n self.month == 2 && leap_year? ? raw + 1 : raw\n end", "def days_in_month\n Time.send(\"month_days\", self.year, self.month)\n end", "def days_in_month\n @date_time_value.days_in_month\n end", "def day_of_month\n return self.day_of_year if self.month == 1\n ((self.day_of_year - 1) - DAYS_IN_MONTH.slice(0, (month - 1)).inject(:+)) + 1\n end", "def days_in_month(month=nil)\n month ||= Date.today.month\n days_in_mon = Date.civil(Date.today.year, month, -1).day\n end", "def days_in_month(year, month)\n Date.new(year, month, -1).day\n end", "def get_days_month(date=nil)\n date ||= @date\n\n return @schedule.days if @schedule.days > 0\n\n if @schedule.days_month != 'specific'\n if @schedule.days_month == 'last' && @schedule.days_month_day == nil\n return 0b0 | (1 << date.at_end_of_month.day)\n end\n end\n\n return 0b0 | (1 << @schedule.start_date.day)\n end", "def days_in_month(year, month)\n (Date.new(year, 12, 31) << (12-month)).day\n end", "def month\n running_days = 0\n DAYS_IN_MONTH.each_with_index do |days, idx|\n running_days += days\n return idx + 1 if self.day_of_year <= running_days\n end\n end", "def days_in_month(year, month)\n return (Date.new(year, 12, 31) << (12 - month)).day\n end", "def days\n @days ||= months.map(&:days).flatten\n end", "def days\n Advert.days_for_months(months)\n end", "def days_in_month(month, year = current.year)\n if month == 2 && ::Date.gregorian_leap?(year)\n 29\n else\n COMMON_YEAR_DAYS_IN_MONTH[month]\n end\n end", "def count_of_days_in(month)\n 28 + (month + (month / 8)) % 2 + 2 % month + 2 * (1 / month)\nend", "def get_number_of_month(m)\n (1..is_leap?[adjust_set_month(m)]).to_a\n end", "def this_month\n day(Time.now)\n end", "def monthly_dry_days(day)\n month_result_string(day).count('1')\n end", "def days_in_month(month, year = Time.now.year)\n\t return 29 if month == 2 && Date.gregorian_leap?(year)\n\t return COMMON_YEAR_DAYS_IN_MONTH[month]\n\tend", "def days_in_month(month, year = Time.now.year)\n return 29 if month == 2 && Date.gregorian_leap?(year)\n DAYS_IN_MONTH[month]\n end", "def days_in_month(month, year = Time.now.year)\n return 29 if month == 2 && Date.gregorian_leap?(year)\n DAYS_IN_MONTH[month]\n end", "def get_number_of_month\n (1..is_leap?[adjust_set_month]).to_a\n end", "def days_in_month(month, year)\n (month == 2 && is_leap_year?(year)) ? 29 : DAYS_IN_A_MONTH[month]\n end", "def monthDays(y, m)\n if ((@@lunar_info[y - 1900] & (0x10000 >> m)) == 0)\n return 29\n else\n return 30\n end\n end", "def days\n self * SECONDS_IN_DAY\n end", "def daysinmonth(year, month)\n return (Date.new(year, 12, 31) << (12-month)).day\n end", "def daysinmonth(year, month)\n return (Date.new(year, 12, 31) << (12-month)).day\n end", "def nwday_of_month(n)\n self + (nwday_day(n) - day).days\n end", "def day_in_month(year, month, day)\n return Date.new(year, month, day).wday\n end", "def inspect\n \"the day of the month is the \" +\n ordinal_list(@days)\n end", "def month_days(month = current_month)\n\t\tmonth_sum = month_summary(month)\n\t\tmonth_days = []\n\t\tmonth_sum.each { |day| month_days << short_date(day['date']) unless day['summary'].nil? }\n\t\tmonth_days\n\tend", "def days\n self.to_i * 86_400\n end", "def day_of_month\n start_on.day.to_s\n end", "def month_length(date)\n return Date.new(date.year, date.month, -1).day\n end", "def months() 30 * days end", "def get_days(year,month)\r\n # the number of days within a month is determined by the year\r\n case month\r\n when \"January\", \"March\", \"May\", \"July\", \"August\", \"October\", \"December\"\r\n days = 31\r\n when \"April\", \"June\", \"September\", \"November\"\r\n days = 30\r\n else\r\n if year.to_i % 400 == 0 # feb has 28 days when a year divisible by 400\r\n days = 28\r\n elsif year.to_i % 4 == 0\r\n days = 29\r\n else\r\n days = 28\r\n end\r\n end # end statement for case month when ...\r\n return days\r\n end", "def ordinalDate\n ordinal = DAYS_THUS_FAR[@month].to_i + @day.to_i\n if leapYear? && @month > 2\n ordinal = ordinal + 1\n end\n return ordinal\n end", "def days; self * DAY; end", "def days; self * DAY; end", "def month_number\n date.month\n end", "def day_of_month(*days)\n merge(mday: days)\n end", "def days_in_month(month, year)\n days_per_month = { 1 => 31, 2 => 28 + (leap?(year) ? 1 : 0), 3 => 31, 4 => 30, 5 => 31, 6 => 30, 7 => 31, 8 => 31, 9 => 30, 10 => 31, 11 => 30, 12 => 31 } \n if (month == 0)\n return days_per_month[12]\n elsif (month < 0)\n return days_per_month[month % 13]\n else\n return days_per_month[month] \n end\n end", "def daily\n (0..Stats.days_in_month).collect { |d| redis.get(\"#{prefix_daily}:#{Time.now.year}:#{Time.now.month}:#{d}\").to_i }\n end", "def days\n monday..sunday\n end", "def day_of_year\n count = @t_day\n @@days_in_months.each_index do |key|\n break if key >= @t_month\n val = @@days_in_months[key]\n \n if key == 2 and Datet.gregorian_leap?(@t_year)\n count += 29\n else\n count += val.to_i\n end\n end\n \n return count\n end", "def days\n return \"There are #{self * (24 * 60 * 60)} seconds in #{self} days\"\n end", "def yday\n m = (@month-2 < 0) ? 0 : @month-2\n (@month==1) ? @day : @day + JDaysInMonth[0..m].inject(0) {|sum, n| sum + n }\n end", "def days \n object.days\n end", "def days_booked(yearmonth = nil)\n return days_booked_for_month(yearmonth) if !yearmonth.nil? \n\n curdate = self.planbeg\n days = 0\n until curdate > self.planend do\n days += days_booked_for_month(curdate)\n curdate = curdate >> 1\n end\n \n return days\n end", "def months ; self * 30.days ; end", "def nights_left_in_a_month(day,month,year)\n\n nights_left = days_in_month(month,year) - day \n return nights_left\n\nend", "def test_january\n jan = Month.new(1,2000)\n days = jan.num_of_days_in_month\n assert_equal 31, days\n end", "def months\n self.to_i * 2_592_000\n end", "def days\n\t\tif self.date.past?\n\t\t\t'Past'\n\t\telse\n\t\t\t((self.date - Date.today).to_i).to_s + ' Days'\n\t\tend\n\tend", "def month\n sunday = @monday + 6\n return 1 if sunday.month == 1 && sunday.year == @year\n return 12 if @monday.month == 12 && @monday.year == @year\n (@monday + 2).month\n end", "def day_in_year\n day = self.day\n \n 1.upto(self.month - 1) do |month_no|\n day += Datet.days_in_month(self.year, month_no)\n end\n \n return day\n end", "def mday() end", "def days(n)\n n * 3600 * 24\nend", "def mday\n return self.to_a[IDX_DAY]\n end", "def test_01d_number_of_days_in_a_weird_leap_year\n cal = IndividualMonth.new(2100, 2)\n assert_equal(28, cal.number_days_in_a_month)\n end", "def calc_days_in_month month, year\n months_with_30 = [4, 6, 9, 11]\n months_with_31 = [1, 3, 5, 7, 8, 10, 12]\n if months_with_30.include? month\n 30\n elsif months_with_31.include? month\n 31\n elsif (year % 4 == 0) && !(year % 100 == 0) || (year % 400 == 0)\n 29\n else\n 28\n end\n end", "def days_until_xmas(date)\n return 0\nend", "def month() end", "def months\n\t\treturn self * 30.days\n\tend", "def months\n\t\treturn self * 30.days\n\tend", "def test_01c_number_of_days_in_a_weird_leap_year\n cal = IndividualMonth.new(2000, 2)\n assert_equal(29, cal.number_days_in_a_month)\n end", "def day_of_month\n ordinal = case @time.day\n when 1 then \"st\"\n when 2 then \"nd\"\n when 3 then \"rd\"\n else \"th\"\n end\n \"#{@time.day}#{ordinal}\"\n end", "def current_cycle_day_count\n count = (Time.now.to_date - self.started.to_date).to_i\n if count <= 30\n return 30\n else\n return count\n end\n end", "def getEndOfMonthDay\n Date.civil(@month1.strftime('%Y').to_i, @month1.strftime('%m').to_i, -1).day.to_i\n end", "def test_01b_number_of_days_in_a_normal_nonleap_year \n cal = IndividualMonth.new(2013, 2)\n assert_equal(28, cal.number_days_in_a_month)\n end", "def fmwday\n beginning_of_month.wday\n end", "def ides_of_month(month)\n [MARCH, MAY, JULY, OCTOBER].include?(month) ? 15 : 13\n end", "def test_01e_number_of_days_in_some_months_will_be_31\n cal = IndividualMonth.new(2012, 3)\n assert_equal(31, cal.number_days_in_a_month)\n end", "def mday\n end", "def find_day_of_month(day=@day, first_day_of_month=@first_day_of_month)\r\n day = ((day - 1) + first_day_of_month) % 7\r\n return 7 if day == 0\r\n day\r\n end", "def orders_number_current_month\n Order.where('extract(year from date) = ?', year_now).where('extract(month from date) = ?', month_now).count\n end", "def day_number\n\t\t(self.to_i+self.utc_offset) / 86400\n\tend", "def month\n Thread.current[:datet_mode] = :months\n return @t_month\n end", "def day_count\n (self.start_date - Date.today.in_time_zone(self.user.time_zone).to_date).abs.round + 1\n end", "def day_months\n return create_monthly_dates day(1) if monthly?\n return mid_term_day_months if charged_in_code == LEGACY_MID_TERM\n day_months = []\n 1.upto(maximum_dates) do |index|\n break if empty_due_on? month: month(index), day: day(index)\n day_months << DueOnImportable.new(month(index), day(index))\n end\n day_months\n end", "def add_days_of_month(month, year)\n\tdays = 0\n\t[1,3,5,7,8,10,12].include?(month) ? days += 31 : nil\n\t[4,6,9,11].include?(month) ? days += 30 : nil\n\tif month == 2 \n\t\t((year % 4 == 0) && (year > 1900)) ? days += 29 : days += 28\n\t\tend\n\treturn days\n\tend", "def month; end", "def month; end", "def month\n months = %w{January February March April May June July August September October November December}\n months[Time.now.month - 1]\n end", "def current_month_orders_count\n @current_month_orders_count ||= object.orders.from_current_month.count\n end", "def days ; self * 24.hours ; end", "def make_days\n month = (1..@day_num).collect do |day|\n Day.new(Date.parse(\"#{@year}-#{@month}-#{day}\"))\n end\n\n month[0].date.wday.times { month.insert(0, Day.new(Date.new))}\n month\n end", "def days\n Thread.current[:datet_mode] = :days\n return self\n end", "def increment_by_days count\n new_day = @day\n new_month = @month\n new_year = @year \n \n while count > 0\n days_to_next_month = days_in_month(new_month, new_year) - new_day + 1\n \n if (days_to_next_month > count)\n new_day = new_day + count\n count = 0 \n else\n new_day = 1\n new_month = new_month + 1\n if (new_month > 12)\n new_month = 1\n new_year = new_year + 1\n end\n \n count = count - days_to_next_month \n end\n end\n \n return MyDate.new new_day, new_month, new_year\n end", "def to_i\n self.day.to_i\n end", "def day_of_month(days, *extras)\n merge(mday: days.array_concat(extras))\n end", "def calc_months_till\n (calc_days_till / 31.0).round(2)\n end", "def nth_negative_instance_of_day_in_month(date)\n # How many days are there in this month? We'll grab the first of next month, then roll\n # back a day to see.\n next_month = Time.utc(date.year, (date.month % 12) + 1)\n next_month = Time.utc(next_month.year + 1, next_month.month) if next_month < date\n month_days = (next_month - 86400).day\n return -1 - ((month_days - date.day) / 7)\n end", "def end_of_month\n #self - ((self.mday-1).days + self.seconds_since_midnight)\n last_day = ::Time.days_in_month(month, year)\n change(:day => last_day, :hour => 23, :min => 59, :sec => 59, :usec => 0)\n end", "def days() 24 * hours end", "def nth_wday_of_month(w, d)\n self + (nth_wday_day(w, d) - day).days\n end", "def day\n Thread.current[:datet_mode] = :days\n return @t_day\n end", "def day_number_utc\n\t\tself.to_i / 86400\n\tend", "def to_i\n year * 100 + month\n end", "def to_day\n Month::DAYS[self.wday]\n end", "def time_month; Time.now.month; end" ]
[ "0.7958529", "0.7760566", "0.77477634", "0.7633565", "0.7561991", "0.7361875", "0.73452634", "0.7280365", "0.72696865", "0.72352314", "0.7186616", "0.71821344", "0.71554923", "0.71471286", "0.69383425", "0.69253033", "0.6899651", "0.6887485", "0.6853021", "0.6853021", "0.6833925", "0.6738625", "0.6704301", "0.66886455", "0.6658089", "0.6658089", "0.6631965", "0.65578574", "0.6551305", "0.6526442", "0.6512666", "0.65114254", "0.64802086", "0.6463367", "0.64468247", "0.6445273", "0.64277375", "0.64277375", "0.63931835", "0.635354", "0.6353364", "0.6326084", "0.6325675", "0.6312689", "0.6285363", "0.6273238", "0.6271673", "0.6259318", "0.6245311", "0.62447184", "0.6240273", "0.62250715", "0.6223916", "0.61998135", "0.6178702", "0.6177794", "0.61615616", "0.6161509", "0.6159961", "0.6159066", "0.6147412", "0.6128213", "0.61240494", "0.61240494", "0.61096185", "0.60852706", "0.6053842", "0.6040477", "0.6025991", "0.6023956", "0.6021541", "0.60167843", "0.60150087", "0.60102594", "0.6007727", "0.5981586", "0.5975911", "0.5972328", "0.5966086", "0.5965785", "0.59566516", "0.59566516", "0.5955212", "0.5941506", "0.59247166", "0.59067786", "0.59057474", "0.5887356", "0.587923", "0.5869052", "0.5857778", "0.5851572", "0.58433634", "0.5841086", "0.58398426", "0.5835172", "0.5832441", "0.58236986", "0.5810445", "0.5800847" ]
0.8186216
0
Returns a BOOLEAN based on slot availability.
def check_slot(day, slot) events = Event.where(day: day) used_slots = events.pluck(:slot) if used_slots.include? slot return false else return true end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def slot_valid? \n\t\tavailable_slots = self.resource.available_time_slot(self.date_of_booking.strftime(\"%Y%m%d\") )\n\t\tavailable_slots.each do | slot |\n\t\t\treturn if slot[1] == self.slot.to_i\n\t\tend\n\t\t\tself.errors[:slot_invalid] << \"=> This slot is invalid\"\n\tend", "def is_available?\n return @status == :AVAILABLE\n end", "def available?\n Holdings::Status::Available.new(@callnumber).available?\n end", "def available?\n status == :available\n end", "def is_available?\n return self.available_inventory > 0\n end", "def is_available?\n count_available > 0\n end", "def available?\n self.active == true and self.quantity_available > 0\n end", "def full?\n slots_available.zero?\n end", "def available?\n Holdings::Status::Available.new(@item).available?\n end", "def equipped?\n EquipSlot.equipable_slots.include? slot\n end", "def available?\n @subnet.state == 'available'\n end", "def valid_slot\n Slots::Slot.new(from: booking_slots.constraints.series.find{ |slot| slot.in_the_future?}, constraints: booking_slots.constraints)\n end", "def available?\n @available_at <= Time.now && !rented?\n end", "def is_available?\n stock > 0\n end", "def is_slot_alloted?\n\t\tif self.company.bookings.find_by_date_of_booking(self.date_of_booking)\n\t\t\tif self.new_record?\n\t\t\t\tdays_booking = self.company.bookings.where(date_of_booking: self.date_of_booking)\n\t\t\telse\n\t\t\t\tdays_booking = self.company.bookings.where(date_of_booking: self.date_of_booking).where.not(id: self.id)\n\t\t\tend\n\t\t\tdays_booking.each do |x|\n\t\t\t\tunless x.slot != self.slot\n\t\t\t\t\tself.errors[:allocated_slot] << \"=> This slot is already alloted\"\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def is_available\n return @is_available\n end", "def currently_available?\n #Time.zone.now < available_until\n true\n end", "def available?(date)\n availability.occurs_at?(date)\n end", "def availability\n end", "def dual_wield?\r\n slot_type == 1\r\n end", "def availability\n end", "def available?\n true\n end", "def available?\n @vpc.state == 'available'\n end", "def available?\n true\n end", "def available?\n false\n end", "def available?(wday)\n return (self.availability.to_s.to_i(2) & (2**wday)) > 0\n end", "def available?\n self.available_count > 0\n end", "def availability\n STATUS_TO_AVAILABILITY[self.status]\n end", "def valid?\n @slot_first && @slot_last && @slot_time\n end", "def has_slot?(slot)\n slots.include? valid_slot_name!(slot)\n end", "def is_slot_already_passed?\n\t\tunless self.date_of_booking != Time.zone.now.beginning_of_day \n\t\t\tunless self.resource.next_time_slots.include?(self.resource.timeslots[self.slot])\n\t\t\t\tself.errors[:slot_avaibility] << \"=> This slot is already passed\"\n\t\t\tend\n\t\tend\n\tend", "def available?\n @dbi.db_instance_status == 'available'\n end", "def available?\n @dbi.db_instance_status == 'available'\n end", "def valid?\n court_slots.any?\n end", "def has_slot?(slotname)\n v = send(slotname)\n\n (v.nil? && slotnames.include?(slotname.to_s)) ? true : !!v\n rescue SlotNotFoundError\n false\n end", "def vacant?\n reservation ? false : true\n end", "def available?\n return false\n end", "def is_available\n\t\tself.stock_qty > 0\n\tend", "def available?()\n #This is a stub, used for indexing\n end", "def returnable?\n AVAILABLE == status\n end", "def available?\n if tenant == false && @units != @number\n return true\n else \n return false\n end\n end", "def has_vacancy?\n @rooms.values.any? { |room| room.available_space() > 0 }\n end", "def availability_by_timeslot(ts)\n self.capacity - self.bookings_total_by_timeslot(ts)\n end", "def available?\n self.state.eql? \"closed\"\n end", "def available?\n @available && connected?\n end", "def available_on?(day, hour)\n @availability[day].include?(hour)\n end", "def available?\n (!self.available_on.nil? && self.available_on <= Date.today)\n end", "def available?\n if @available_rooms.length > 0\n return true\n end\n end", "def check_availability(opts)\n begin\n check_availability!(opts)\n rescue ActiveBookings::AvailabilityError\n false\n end\n end", "def slotAvailable?(topic_id)\n SignUpTopic.slotAvailable?(topic_id)\n end", "def slotAvailable?(topic_id)\n SignUpTopic.slotAvailable?(topic_id)\n end", "def slotAvailable?(topic_id)\n SignUpTopic.slotAvailable?(topic_id)\n end", "def available?\n self.in_stock? || self.backorderable?\n end", "def reservation_available\n if timeslot_contains_reservations?\n errors.add(:base, I18n.t('reservation.reservation_available'))\n end\n end", "def slot_empty?(slot, event)\n return ((slot.id + @slots_size).to_datetime <= event.start.to_datetime or\n slot.id >= event.finish.to_datetime)\n end", "def can_schedule?(slot, employee, position, location)\n !existing_shifts.user_scheduled_at(employee.id, slot.x, slot.y) &&\n !existing_shifts.user_scheduled_during_day(employee.id, slot.x, location.id) &&\n !existing_shifts.user_scheduled_at(employee.id, slot.x, slot.y) &&\n slot.not_full? &&\n slot.position_room_available?(position.name) &&\n !minmax_not_eligible(slot, employee) &&\n not_during_time_off(slot, employee)\n end", "def is_working?\n !self.aircraft_unavailabilities.where('? BETWEEN start_at AND end_at', DateTime.now).any?\n end", "def seats_available?\n (capacity - total_enrollments) > 0\n end", "def can_equip?(item, slot)\n item.allowed_slot == slot && items.include?(item)\n end", "def available?\n in_stock? || backorderable?\n end", "def available\r\n @available\r\n end", "def available?\n vehicle.nil?\n end", "def valid?\n court && slot\n end", "def available?(game_datetime)\n self.availabilities.\n where(:day => game_datetime.wday).\n where('available_from <= ?', game_datetime.to_time).\n where('available_to >= ?', game_datetime.to_time).\n present?\n end", "def update_lots_availability\n response = Typhoeus.get(\"https://api.data.gov.sg/v1/transport/carpark-availability\",\n headers: http_headers)\n if response.code == 200\n status, data = true, JSON.parse(response.response_body)\n else\n status, data = false, {error: {message: 'API end point failed', response_code: response.code }}\n end\n [status, data]\n end", "def available\n @available ||= product.available(inventory, lot_code)\n end", "def available?\n idle.any?\n end", "def tba?\n (!self.available_on.nil? && self.available_on > self.class.upcoming_on)\n end", "def positive_availability?\n target_api.availability.positive?\n end", "def is_available=(value)\n @is_available = value\n end", "def responded_with_availability?\n !interview_availabilities.empty?\n end", "def available?(date_range)\n if reservations.length == 0\n return true\n end\n if reservations.any? {|r| r.overlap?(date_range)}\n return false\n else\n return true\n end\n end", "def available?(reservations = [])\n return true if self.class == Reservation && self.status != 'reserved'\n all_res = reservations.dup\n all_res << self if self.class != Reservation\n all_res.uniq!\n eq_objects_needed = same_model_count(all_res)\n if equipment_model.num_available(start_date, due_date) < eq_objects_needed\n errors.add(:base, equipment_model.name + \" is not available for the full time period requested.\\n\")\n return false\n end\n return true\n end", "def available?(resource_type, resource_value)\n get_resource(resource_type).value - resource_value >= 0\n end", "def timeslot_contains_reservations?\n return start_dt.blank? || end_dt.blank? || existing_reservations?\n end", "def available?\n return true unless coliding_locks.any?\n end", "def check_rbs_availability!; end", "def available?\n session_bus = DBus::SessionBus.instance\n session_bus.service('org.a11y.Bus').exists?\n end", "def already_used?\n p \"Checking already used\"\n vehicle.present? and state == 1\n end", "def control_availability\n dpms_availability\n end", "def special_weapon_slot?(slot)\n ['Main Hand', 'Held In Off-hand', 'One-Hand', 'Off Hand', 'Shield'].include? slot\n end", "def data_available?\n true\n end", "def ballot_registered?\n @ballot_registered\n end", "def room_available\n !self.rooms.where(available: true).blank?\n end", "def ready_to_bill?\n status == READY\n end", "def slots_available\r\n begin\r\n serverinfo = $ts.command('serverinfo')\r\n res_slots = serverinfo['virtualserver_reserved_slots']\r\n max_clients = serverinfo['virtualserver_maxclients']\r\n clients_online = serverinfo['virtualserver_clientsonline']\r\n max_clients - (res_slots + clients_online)\r\n rescue\r\n puts '[ERROR] problem getting available slots'\r\n raise 'slots_available'\r\n end\r\nend", "def available?\n AvailableResponse.new(request(:get, '/information')).success?\n end", "def available?\n check_elements_for_compliance { |e| !e.available? }\n end", "def availability\n @availability ||= begin\n xml = @client.fetch(:record_availability, :id => self.id)\n doc = Nokogiri::XML(xml)\n\n returning({}) do |hash|\n doc.xpath('//holding').each do |xdata|\n holding = xdata.xpath('name').text\n hash[holding] = xdata.xpath('available').text == 'true'\n end\n end\n end\n end", "def reserved?(product)\n product.status == 'Reserved'\n end", "def wait_available_slot\n while true\n index = available_slot\n return index if index\n sleep 0.01\n end\n end", "def available_for?(reservation)\n return false if staff_only? && !reservation.staff? # TODO handle staff reservations properly\n return false unless ready_for_checkout?\n return false if reservation.start_date.blank? || reservation.end_date.blank?\n if reservation.staff?\n reservation_start_date_with_buffer = reservation.start_date + 1.second\n reservation_end_date = reservation.end_date - 1.second\n else\n reservation_start_date_with_buffer = reservation.start_date - 1.day - (category.buffer_days_between_checkouts.to_i * 1.day)\n reservation_end_date = reservation.end_date\n end\n conditions = [['(start_date <= :start_date AND end_date >= :end_date)'],\n ['(start_date <= :end_date AND end_date >= :end_date)'],\n ['(start_date <= :start_date AND end_date >= :end_date)'],\n ['(start_date >= :start_date AND end_date <= :end_date)'],\n ['(start_date >= :start_date AND start_date <= :end_date)'],\n \t\t['(end_date >= :start_date AND end_date <= :end_date)']]\n reservations.find(:all, :conditions => [\"submitted = true\n AND equipment_reservation_id != #{reservation.id} \n AND (#{conditions.join(\" OR \")})\", \n { :start_date => reservation_start_date_with_buffer, :end_date => reservation_end_date }]).empty?\n end", "def available?\n !version.nil?\n end", "def out_of_stock?\n quantity.zero? || reserved_count == quantity\n end", "def nick_has_slot? nick, &block\n raise ArgumentError.new 'Need a block!' if block.nil?\n if @info_cache.key?(nick) && @info_cache[nick][:slots] &&\n Time.now < @info_cache[nick][:updated_at] + 1.minute\n block.call @info_cache[nick][:slots] > 0\n end\n\n info nick do |map|\n if map.nil?\n # Timed out? No slots...\n block.call false\n elsif map[:interest].nil?\n # No interest given, assume has a slot\n block.call true\n elsif match = info[:interest].match(/.*?<.*S:(\\d+).*>/)\n debug 'slots', \"User: #{nick} has #{match[1]} open slots\"\n block.call match[1].to_i > 0\n else\n # Couldn't parse, assume has a slot\n block.call true\n end\n end\n\n end", "def available?(start_date, end_date)\n unless self.reservations.any? { |res| start_date.to_date.between?(res.checkin, res.checkout) || end_date.to_date.between?(res.checkin, res.checkout)} \n true\n end\n end", "def usable?\n false\n end", "def is_available?(date, start_time)\n\t\tcase date.wday\n\t\t\twhen 1\n\t\t\t\tself.monday_available_from <= start_time && start_time <= self.monday_available_to\n\t\t\twhen 2\n\t\t\t\tself.tuesday_available_from <= start_time && start_time <= self.tuesday_available_to\n\t\t\twhen 3\n\t\t\t\tself.wednesday_available_from <= start_time && start_time <= self.wednesday_available_to\n\t\t\twhen 4\n\t\t\t\tself.thursday_available_from <= start_time && start_time <= self.thursday_available_to\n\t\t\twhen 5\n\t\t\t\tself.friday_available_from <= start_time && start_time <= self.friday_available_to\n\t\t\twhen 6\n\t\t\t\tself.saturday_available_from <= start_time && start_time <= self.saturday_available_to\n\t\t\twhen 7\n\t\t\t\tself.sunday_available_from <= start_time && start_time <= self.sunday_available_to\n\t\t\telse\n\t\t\t\tfalse\n\t\tend\n\tend", "def is_available\n return unless start_time.present? && end_time.present?\n\n reservation_hours = (end_time - start_time) / 1.hour\n day = start_time.wday\n st = start_time\n et = reservation_hours > 24 ? end_time.end_of_day : end_time\n while reservation_hours > 0 do\n unless available_at(st, et, day)\n errors.add(:start_time, I18n.t('activerecord.errors.models.reservation.attributes.date.available_hours'))\n return\n end\n if overnight?\n st = start_time.beginning_of_day\n end\n et = reservation_hours > 24 ? end_time.end_of_day : end_time\n day = (day + 1) % 7\n reservation_hours -= 24\n end\n end", "def ringready?\n output = riak_admin 'ringready'\n output =~ /^TRUE/ || $?.success?\n end" ]
[ "0.7627097", "0.737149", "0.7333801", "0.73134935", "0.72310144", "0.7158929", "0.7096491", "0.7093107", "0.70566785", "0.7049002", "0.702692", "0.698504", "0.6945829", "0.6935982", "0.6927607", "0.6905851", "0.68834406", "0.6797803", "0.67975616", "0.6796499", "0.6795932", "0.67937505", "0.6776836", "0.67685556", "0.6757005", "0.67416817", "0.6725928", "0.6714354", "0.67123497", "0.6707138", "0.6660569", "0.66480094", "0.66480094", "0.66404337", "0.6628455", "0.6609962", "0.6588436", "0.6554253", "0.6544901", "0.6522125", "0.6514528", "0.65050125", "0.6498462", "0.64959824", "0.649371", "0.6490207", "0.6481446", "0.6458321", "0.64289856", "0.6417423", "0.6417423", "0.6417423", "0.6412114", "0.6407314", "0.6396686", "0.63808846", "0.6370533", "0.63667774", "0.6366688", "0.6349466", "0.6321815", "0.6317429", "0.63149136", "0.6304066", "0.6288974", "0.6286662", "0.6280163", "0.62647027", "0.62616026", "0.62425196", "0.6226787", "0.62178314", "0.6217466", "0.6216587", "0.6206451", "0.620471", "0.6202329", "0.6196897", "0.619207", "0.61881083", "0.6165871", "0.61603755", "0.6154824", "0.6152105", "0.6130975", "0.61266303", "0.61246073", "0.61231786", "0.61191964", "0.6106338", "0.6102715", "0.60991645", "0.6085165", "0.6080531", "0.60745054", "0.6073424", "0.6072758", "0.60721874", "0.60584223", "0.6052972" ]
0.6909431
15
Moves the current history pointer to the previous element (that is one step further in the past) and returns the newly pointed element.
def prev @history_idx += 1 if @history_idx < @history.length - 1 current end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prev(current)\n l = current\n l = l[0,1] if (l.length > 0 and l[0,1] == '\\n')\n l = l[-1,1] if (l.length > 0 and l[-1,1] == '\\n')\n if (@position > 0)\n if (@position == (@history.length - 1))\n @history[@history.length - 1] = l\n end\n @position = @position - 1\n return @history[@position]\n end\n return current\n end", "def previous_history()\r\n @history_offset!=0 ? @the_history[@history_offset-=1] : nil\r\n end", "def previous\n @pointer -= 1\n end", "def previous_history\n history_size = @history.size\n\n @history_index = if @history_index && @history_index < history_size\n [@history_index + 1, history_size - 1].min\n else\n 0\n end\n\n self.value = @history[@history_index]\n end", "def previous_element; end", "def previous\n at(position - 1)\n end", "def prev(object)\n return nil if elements.index(object) == 0\n elements[elements.index(object) - 1]\n end", "def undo()\n return @history.pop\n end", "def previous\n validates_possibility_of :previous\n self.index -= 1\n self.current\n end", "def next_history\n if @history_index && @history_index > 0\n @history_index -= 1\n else\n @history_index = @history.size - 1\n end\n\n self.value = @history[@history_index]\n end", "def next_history()\r\n (@history_offset == @history_length) ? nil : @the_history[@history_offset+=1]\r\n end", "def previous\n self.offset(-1)\n end", "def next(current)\n if (@position < @history.length - 1)\n @position = @position + 1\n return @history[@position]\n end\n return current\n end", "def previous\n\t first? ? nil : locate - 1\n\tend", "def prev\n prev? ? @current - 1 : nil\n end", "def prev_item\n @current -= 1 if @current > 0\n\n items\n end", "def previous_item\n index = self.simple_acts_as_list_scope.index(self)\n index == 0 ? nil : self.simple_acts_as_list_scope[index - 1]\n end", "def prev_item\n storage.rotate!(-1)\n\n update\n end", "def prev_item\n storage.rotate!(-1)\n\n update\n end", "def get_prev()\n return @prev_node\n end", "def prev_item\n storage.rotate!(-1)\n\n update\n end", "def prev_element\n\t\treturn prev_element_of @current_node\n\tend", "def next\n @history_idx -= 1 if @history_idx > -1\n current\n end", "def prev_by_history\n unless has_previous_version?\n # This undo record type has no previous version information.\n return nil\n end\n\n undo_log = roll_ptr[:undo_log]\n older_undo_page = @undo_page.space.page(undo_log[:page])\n\n unless older_undo_page and older_undo_page.is_a?(Innodb::Page::UndoLog)\n # The page was probably re-used for something else.\n return nil\n end\n\n older_undo_record = new_subordinate(older_undo_page,\n undo_log[:offset])\n\n unless older_undo_record and table_id == older_undo_record.table_id\n # The record space was probably re-used for something else.\n return nil\n end\n\n unless older_undo_record.trx_id.nil? or trx_id >= older_undo_record.trx_id\n # The trx_id should not be newer; but may be absent (for insert).\n return nil\n end\n\n older_undo_record\n end", "def previous\n first? ? nil : @collection[index - 1]\n end", "def previous_item(column=nil)\n column = column || default_orderable_column\n orderable_scoped(column).where(orderable_column(column) => send(column) - 1).first\n end", "def previous\n self.new_record? ? nil : Slide.where(:lesson_id => self.lesson_id, :position => (self.position - 1)).first\n end", "def previous\n DOM::Element.from_node `#{@el}.previousElementSibling || Opal.nil`\n end", "def previous_step\n (history.keys.last.to_i - 1).to_s\n end", "def back\n history_navigate(delta: -1)\n end", "def previous_element_sibling\n n = self.previous_sibling\n while n do\n if n.node_type == ELEMENT_NODE then\n break\n end\n n = n.previous_sibling\n end\n return n\n end", "def forward\n history_navigate(delta: 1)\n end", "def get_prev()\n\t\t\treturn @prev\n\t\tend", "def prev\n\t\t\t\t@index -= 1\n\t\t\t\tself._update\n\t\t\t\tself\n\t\t\tend", "def previous\n @tokens.at(@current - 1)\n end", "def previous(query)\n unless query.nil?\n index = query.find_index(self.id)\n if index\n prev_id = query[index-1] unless index.zero?\n self.class.find_by_id(prev_id)\n end\n end\n end", "def previous\n tokens[@current - 1]\n end", "def history\n @history.dup\n end", "def previous\n raise NameError, \"Already at the start of the series\" if start?\n @count -= 1\n self\n end", "def previous_step\n self.step_flow.previous_step if can_decrement_step\n end", "def advance\n @current += 1 unless at_end?\n return previous\n end", "def previous\n @previous ||= Changeset.where([\"id < ? AND repository_id = ?\", id, repository_id]).order('id DESC').first\n end", "def add_previous_sibling_and_get(node, html)\n\t\tresult = node.add_previous_sibling(make_node(html, node.document))\n\t\tresult = result[0] if result.is_a?(Array)\n\t\treturn result\n\tend", "def previous\n before.ascending.last\n end", "def prev\n unless self.tll_prev.nil?\n return self.class.unscoped.where(_id: self.tll_prev).first\n end\n\n nil\n end", "def rl_get_previous_history(count, key)\r\n if (count < 0)\r\n return (rl_get_next_history(-count, key))\r\n end\r\n if (count == 0)\r\n return 0\r\n end\r\n # either not saved by rl_newline or at end of line, so set appropriately.\r\n if (@_rl_history_saved_point == -1 && (@rl_point!=0 || @rl_end!=0))\r\n @_rl_history_saved_point = (@rl_point == @rl_end) ? -1 : @rl_point\r\n end\r\n\r\n # If we don't have a line saved, then save this one.\r\n rl_maybe_save_line()\r\n\r\n # If the current line has changed, save the changes.\r\n rl_maybe_replace_line()\r\n\r\n temp = old_temp = nil\r\n while (count>0)\r\n temp = previous_history()\r\n if temp.nil?\r\n break\r\n end\r\n old_temp = temp\r\n count -= 1\r\n end\r\n\r\n # If there was a large argument, and we moved back to the start of the\r\n # history, that is not an error. So use the last value found.\r\n if (temp.nil? && old_temp)\r\n temp = old_temp\r\n end\r\n\r\n if temp.nil?\r\n rl_ding()\r\n else\r\n rl_replace_from_history(temp, 0)\r\n _rl_history_set_point()\r\n end\r\n\r\n 0\r\n end", "def previous\n\t self.class.where(\"id < ?\", id).last\n\tend", "def prev(element_id)\n prev(element_id, from: target)\n end", "def store_previous\n end", "def prev\n\t\tself - 1\n\tend", "def prev\n post_comments = self.post.comments #in order of id\n index = post_comments.index(self)\n new_index = index - 1\n if new_index < 0\n return nil\n else\n return post_comments[new_index]\n end\n end", "def previous\n return nil unless fund_item && previous_perspective\n fund_item.fund_editions.previous_to( self )\n end", "def previous\n end", "def previous\n end", "def prev\n\t\tTask.order(:position).where(\"position < ?\", position).last\n\tend", "def prev\n ret = nil\n # If we're not the first valid value, look for the previous one\n if (@index && (@index > 0))\n # Check the cache first for the predecessor\n if (@@STEAK_CACHE[@index - 1])\n ret = @@STEAK_CACHE[@index - 1]\n # If it wasn't in the cache, create and return a new instance\n else\n ret = Steak.new(@index - 1)\n end\n end\n ret\nend", "def shift\n val = @tail.prev.obj\n @tail.prev = @tail.prev.prev\n @tail.prev.next = @tail\n val\n end", "def to_previous_line\n @history.save_line(line || \"\")\n\n if @history.to_previous_line and line = @history.current_line\n replace_line line\n end\n end", "def previous\n\t\t@result = nil\n\t\t@skip = (@skip || 0) - get_resultcount\n\t\t@skip = [0, @skip].max\n\t\treturn self\n\tend", "def move_prev\n self.step -= 1\n 'prev'\n end", "def prev\n\t\t@prev\n\tend", "def get_previous_node(item)\n raise ArgumentError, 'Previous node does not exist' if @length < 2\n\n previous_node = @front_node\n\n until previous_node.next_node.nil? || previous_node.next_node.item == item\n previous_node = previous_node.next_node\n end\n\n unless previous_node.next_node.item == item\n raise ArgumentError, 'Item is not present'\n end\n\n previous_node\n end", "def focus_prev\n i = focusables.index(@focused) || 0\n new_i = i.zero? ? focusables.length - 1 : i - 1\n self.focused = focusables[new_i] if focusables[new_i]\n end", "def get_earlier\n # Do nothing if there is no history\n return if @history.empty?\n # If we're at the last value, return if the current text is the\n # same as that value. By doing this, we can avoid redrawing unnecessarily.\n if @history_index == 0\n return if @history[@history_index] == self.text\n else\n @history_index -= 1\n end\n self.text = @history[@history_index]\n # Drag the cursor to the very end of the input\n @helper.cursor = self.text.scan(/./m).length\n self.refresh\n end", "def shift\n return nil if @head == nil\n ret = @head\n @head = @head.next_node if @head != nil\n @head.previous = nil\n return ret.value\n end", "def previous\n Expression.where('id < ? AND collection_id = ?', self.id, self.collection_id).order('id DESC').limit(1).first\n end", "def previous(n=1)\n self - n\n end", "def prev_element_of(node)\n\t\treturn valid(node) ? node.previous_element : nil\n\tend", "def prev(name = nil)\n elements = self.class.all_siblings(self)\n elements = elements.where(:name => name) if name\n elements.where(\"position < ?\", self.position).order(\"position ASC\").limit(1)\n end", "def rl_beginning_of_history(count, key)\r\n rl_get_previous_history(1 + where_history(), key)\r\n end", "def redoPrevious\n if !@undoRedo.redoStack.empty?\n n2 = @undoRedo.redoStack.pop()\n n1 = @undoRedo.redoStack.pop()\n\n @undoRedo.undoStack << n2\n @undoRedo.undoStack << n1\n \n \n ajoutPont(n2,n1)\n end\n\n return self\n end", "def find_prev(*args)\n find(:prev, *args)\n end", "def find_prev(*args)\n find(:prev, *args)\n end", "def previous_node\n return nil if @traversal_position.previousNode.nil?\n Neo4j.load(@traversal_position.previousNode.getId)\n end", "def before_last_page\n #@history[@history.size - 2][1].dup\n self[self.size - 2][:page].dup\n end", "def undo\n if(@history != nil)\n @history.undo\n end\n end", "def get_Previous()\n \t return @outputs[\"Previous\"]\n \tend", "def get_Previous()\n \t return @outputs[\"Previous\"]\n \tend", "def get_Previous()\n \t return @outputs[\"Previous\"]\n \tend", "def get_Previous()\n \t return @outputs[\"Previous\"]\n \tend", "def get_Previous()\n \t return @outputs[\"Previous\"]\n \tend", "def peek\n item = pop\n push(item)\n item\n end", "def rewind\n @history_idx = -1\n end", "def last(n = 1)\n return @history[-n] ;\n end", "def back\n @index -= 1 if @index > 0\n end", "def previous_sibling\n return nil if parent.nil? # self is root\n return nil if 1 == parent.children.size # self is parent's only child\n if 0 == own_child_index\n return nil # self is first child\n else\n # return previous sibling\n parent.children[own_child_index - 1]\n end\n end", "def TreeView_GetPrevSibling(hwnd, hitem) TreeView_GetNextItem(hwnd, hitem, TreeViewGetNextItem[:PREVIOUS]) end", "def previous_sibling\n return @links[:previous_sibling]\n end", "def previous\n return nil if self.position == self.sentence.segments.count - 1\n self.sentence.segments[self.position+1]\n end", "def prev(name = nil)\n elements = page.elements.published.where(Element.arel_table[:position].lt(position))\n elements = elements.named(name) if name.present?\n elements.reorder(\"position DESC\").limit(1).first\n end", "def previous\n self.class.where(\"id < ?\", id).where(:punto_venta_id => self.punto_venta_id).last\n end", "def remove_history(which)\r\n if (which < 0 || which >= @history_length || @history_length == 0 || @the_history.nil?)\r\n return nil\r\n end\r\n return_value = @the_history[which]\r\n @the_history.delete_at(which)\r\n @history_length-=1\r\n return_value\r\n end", "def last\n @history.last\n end", "def previous_node\n peer = nil\n if !parent.nil? and parent.respond_to?(:children)\n index = parent.children.index(self)\n peer = index > 0 ? parent.children[index - 1] : nil\n end\n peer\n end", "def previous\n @previous ||= WikiContent::Version.\n reorder('version DESC').\n includes(:author).\n where(\"wiki_content_id = ? AND version < ?\", wiki_content_id, version).first\n end", "def pop()\n head = @head\n if head == nil then\n return nil\n end\n @head = head.prev\n return head.val\n end", "def insertBack(object=nil) #we need more of these\n tempNode = Node.new(object)\n tempNode.next = @last\n tempNode.prev = @last.prev\n @last.prev.next = tempNode\n @last.prev = tempNode\n @size += 1\n return @last.prev \n \n end", "def previous\n layout.rows[number-1] unless first?\n end", "def pop\n # return nil if @length == 0\n # Tim did a fancy private method.....\n if @tail.nil?\n old_tail = nil\n else\n old_tail = @tail.value\n if @tail.previous.nil?\n @tail = nil\n else\n new_tail = @tail.previous\n @tail = new_tail\n end\n @length -= 1\n end\n # @tail.previous = new_tail.previous \n return old_tail\n\n end", "def previous\n self.class.last(\n :conditions => {\n :user_id => self.user_id,\n :id_lt => self.id})\n end" ]
[ "0.7648471", "0.76401293", "0.7209635", "0.72022784", "0.7194428", "0.7159589", "0.7047654", "0.7037475", "0.6994902", "0.6948232", "0.689169", "0.68300444", "0.6796553", "0.67949843", "0.67706877", "0.6741709", "0.67394346", "0.6704532", "0.6704532", "0.670226", "0.66865456", "0.6685691", "0.6671947", "0.6666818", "0.6633358", "0.6537002", "0.65263104", "0.6512729", "0.64715344", "0.64712083", "0.6432014", "0.64188534", "0.6396079", "0.63783056", "0.637588", "0.63149273", "0.6313728", "0.6298815", "0.6292089", "0.62876344", "0.6269603", "0.6264892", "0.6256428", "0.6253037", "0.62442803", "0.62318814", "0.6228762", "0.62260276", "0.62189794", "0.6210672", "0.6208001", "0.6205517", "0.6198078", "0.6198078", "0.61891335", "0.6185205", "0.6179331", "0.6175757", "0.6171765", "0.6154045", "0.61503154", "0.6134684", "0.61300486", "0.6109189", "0.6096508", "0.6088122", "0.6077738", "0.6076188", "0.60694206", "0.6064106", "0.6054543", "0.6054171", "0.6054171", "0.605085", "0.60403836", "0.6033182", "0.60185957", "0.60185957", "0.60185957", "0.60185957", "0.60185957", "0.6008076", "0.60058045", "0.60040814", "0.59896064", "0.59869474", "0.5986499", "0.5984384", "0.5981863", "0.59793806", "0.59752834", "0.595829", "0.5952378", "0.59460634", "0.5945653", "0.5931599", "0.5930456", "0.5922947", "0.5917289", "0.5914473" ]
0.77930534
0
Moves the current history pointer to the next element (thaat is one step closer to the presetn) and returns the newly pointed element
def next @history_idx -= 1 if @history_idx > -1 current end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_history()\r\n (@history_offset == @history_length) ? nil : @the_history[@history_offset+=1]\r\n end", "def next_history\n if @history_index && @history_index > 0\n @history_index -= 1\n else\n @history_index = @history.size - 1\n end\n\n self.value = @history[@history_index]\n end", "def next(current)\n if (@position < @history.length - 1)\n @position = @position + 1\n return @history[@position]\n end\n return current\n end", "def advance\n @current += 1 unless at_end?\n return previous\n end", "def prev\n @history_idx += 1 if @history_idx < @history.length - 1\n current\n end", "def move_later\n nekst = self.next\n self.append_to(nekst) if nekst\n end", "def prev(current)\n l = current\n l = l[0,1] if (l.length > 0 and l[0,1] == '\\n')\n l = l[-1,1] if (l.length > 0 and l[-1,1] == '\\n')\n if (@position > 0)\n if (@position == (@history.length - 1))\n @history[@history.length - 1] = l\n end\n @position = @position - 1\n return @history[@position]\n end\n return current\n end", "def previous_element; end", "def next(prev)\n @_model.fbe_shift(prev)\n end", "def next(prev)\n @_model.fbe_shift(prev)\n end", "def next(prev)\n @_model.fbe_shift(prev)\n end", "def next(prev)\n @_model.fbe_shift(prev)\n end", "def next(prev)\n @_model.fbe_shift(prev)\n end", "def next(prev)\n @_model.fbe_shift(prev)\n end", "def next(prev)\n @_model.fbe_shift(prev)\n end", "def next(prev)\n @_model.fbe_shift(prev)\n end", "def next\n update_current(list_index_of(@current))\n end", "def previous_history()\r\n @history_offset!=0 ? @the_history[@history_offset-=1] : nil\r\n end", "def previous\n validates_possibility_of :previous\n self.index -= 1\n self.current\n end", "def next\n peek.tap { @position += 1 }\n end", "def prev_item\n @current -= 1 if @current > 0\n\n items\n end", "def next_element\n validates_possibility_of :next\n self.index += 1\n self.current\n end", "def shift\n val = @tail.prev.obj\n @tail.prev = @tail.prev.prev\n @tail.prev.next = @tail\n val\n end", "def next\n unless @push.nil?\n t = @push\n @push = nil\n return t\n end\n return nil if @input.nil?\n return nil if @input.size == 0\n return nil if @index >= @input.size\n\n t = @input[@index]\n @index += 1\n t\n end", "def add_to_history(item)\n found = nil\n Readline::HISTORY.each_with_index do |h,i|\n if h == item\n found = i\n break\n end\n end\n Readline::HISTORY.delete_at(found) if found\n Readline::HISTORY.push(item)\nend", "def rl_beginning_of_history(count, key)\r\n rl_get_previous_history(1 + where_history(), key)\r\n end", "def prev(object)\n return nil if elements.index(object) == 0\n elements[elements.index(object) - 1]\n end", "def move_next\n\t\tself.current = self.current&.next\n\tend", "def move_next\n\t\tself.current = self.current&.next\n\tend", "def succ\n @nxt || self\n end", "def next()\n result = current\n @index += 1\n @got_next_element = false\n @next_element = nil\n result\n end", "def shift\n return nil if @head == nil\n ret = @head\n @head = @head.next_node if @head != nil\n @head.previous = nil\n return ret.value\n end", "def forward\n history_navigate(delta: 1)\n end", "def rewind\n @history_idx = -1\n end", "def next\n @next||=after.first\n end", "def prev_item\n storage.rotate!(-1)\n\n update\n end", "def prev_item\n storage.rotate!(-1)\n\n update\n end", "def next\n at(position + 1)\n end", "def previous\n @pointer -= 1\n end", "def advance\n @to = @to.next\n end", "def move_prev\n self.step -= 1\n 'prev'\n end", "def moveto_next\n return if @range.empty?\n if index = @range.index(self.pos)\n @index = index\n end\n @index += 1\n @index %= @range.size\n moveto @range[@index]\n end", "def new_step\n # noinspection RubyMismatchedReturnType\n index(index&.succ || 0)\n end", "def prev_item\n storage.rotate!(-1)\n\n update\n end", "def prev\n prev? ? @current - 1 : nil\n end", "def next\n last? ? nil : locate + 1\n end", "def last(n = 1)\n return @history[-n] ;\n end", "def insertBack(object=nil) #we need more of these\n tempNode = Node.new(object)\n tempNode.next = @last\n tempNode.prev = @last.prev\n @last.prev.next = tempNode\n @last.prev = tempNode\n @size += 1\n return @last.prev \n \n end", "def previous\n\t first? ? nil : locate - 1\n\tend", "def prev\n ret = nil\n # If we're not the first valid value, look for the previous one\n if (@index && (@index > 0))\n # Check the cache first for the predecessor\n if (@@STEAK_CACHE[@index - 1])\n ret = @@STEAK_CACHE[@index - 1]\n # If it wasn't in the cache, create and return a new instance\n else\n ret = Steak.new(@index - 1)\n end\n end\n ret\nend", "def to_next_line\n @history.save_line(line || \"\")\n\n if @history.to_next_line and line = @history.current_line\n replace_line line\n end\n end", "def shift\n return nil if @head.nil?\n node = @head\n @head = @head.next\n return node\n end", "def previous\n at(position - 1)\n end", "def next!\r\n @cur = @cache[@idx+=1]\r\n end", "def fwd_after_peek\n @pos = @head_pos\n end", "def next(object)\n elements[elements.index(object) + 1]\n end", "def myNextFunc(list, last)\n list << last\nend", "def peek\n item = pop\n push(item)\n item\n end", "def rl_get_next_history(count, key)\r\n if (count < 0)\r\n return (rl_get_previous_history(-count, key))\r\n end\r\n if (count == 0)\r\n return 0\r\n end\r\n rl_maybe_replace_line()\r\n\r\n # either not saved by rl_newline or at end of line, so set appropriately.\r\n if (@_rl_history_saved_point == -1 && (@rl_point!=0 || @rl_end!=0))\r\n @_rl_history_saved_point = (@rl_point == @rl_end) ? -1 : @rl_point\r\n end\r\n temp = nil\r\n while (count>0)\r\n temp = next_history()\r\n if temp.nil?\r\n break\r\n end\r\n count -= 1\r\n end\r\n\r\n if temp.nil?\r\n rl_maybe_unsave_line()\r\n else\r\n rl_replace_from_history(temp, 0)\r\n _rl_history_set_point()\r\n end\r\n 0\r\n end", "def extraer_final()\n @head=head.prev\n end", "def at(index)\n\t\t@current_node = @head\n\n\t\tindex.times do \n\t\t\t@current_node = @current_node.next_node\n\t\tend\n\n\t\treturn @current_node\n\tend", "def next_item\n storage.rotate!\n\n update\n end", "def next_item\n storage.rotate!\n\n update\n end", "def retreat\n @position = @position - 1 rescue -1\n self[@position + 1]\n end", "def at(index)\n curr = head\n index.downto(1) do |_|\n break if curr.nil?\n\n curr = curr.next\n end\n curr\n end", "def previous\n first? ? nil : @collection[index - 1]\n end", "def advance_head\n\t\t\t@head_index += 1\n\t\t\t@head_index = 0 if @head_index == @queue.size\n\t\tend", "def unshift(val)\n self.double_link_linked_list.prepend(val)\n end", "def nxt_meat\n\t# Get the index of the next meat\n\ttmp_index = ($meat.index(get_meat) + 1).modulo($meat.length)\n\t\n\t# Move to the next meat pair\n\t$cur_meat = $meat[tmp_index]\nend", "def shift_first \n @head=@head.next\n @head.prev=nil\n end", "def previous_history\n history_size = @history.size\n\n @history_index = if @history_index && @history_index < history_size\n [@history_index + 1, history_size - 1].min\n else\n 0\n end\n\n self.value = @history[@history_index]\n end", "def get_next_mock_input\n @mock_input_index += 1\n @mock_input_tape[@mock_input_index-1]\n end", "def shift\n @store.store.each_with_index do |ele, i|\n if ele != nil\n val = ele\n @store.store[i] = nil\n @count -= 1\n return val\n end\n end\n\n return nil if @count == 0\n end", "def next\n @pointer += 1\n end", "def next_item\n @current += 1 if @current < last\n\n items\n end", "def item_at_head\n\t\t\t@head.next\n\t\tend", "def current; peek(0) end", "def shift!\n shifted = @queue.shift\n\n return nil if shifted.nil?\n shifted[0]\n end", "def shift\n current_node = @head\n @head = current_node.next_node\n end", "def shift_elements(index)\n while index < @length - 1\n @cache[index] = @cache[index+1]\n index += 1\n end\n end", "def next\n next? ? @current + 1 : nil\n end", "def next_step\n (history.keys.last.to_i + 1).to_s\n end", "def update_current(next_idx)\n @current = @list[next_idx]\n end", "def extract_head\n raise \"Error la lista no puede estar vacia\" unless (@nodos > 1)\n @nodos = @nodos-1\n segundo = @head.next\n segundo.prev = nil\n oldhead = @head\n @head = segundo\n oldhead\n end", "def advance; end", "def advance; end", "def advance; end", "def next_item\n storage.rotate!\n\n update\n end", "def shift\n if @elements.empty?\n return nil\n end\n\n swap(0,@elements.size-1)\n ele = @elements.pop\n heapify(0)\n ele\n end", "def advance n\n @index += n\n self\n end", "def shift()\n # If our ttl is zero, skip\n if @queue.length < 1\n return nil\n end\n # Get next from queue\n this = @queue.shift\n puts \"QUEUE ->: %3d %s\" % [this['ttl'], this['url']]\n # Do we already have this page?\n if ! @store.exists?(this['url'])\n # Get page and read links\n p = Page.new(this['url'], nil, this['ttl'])\n # Add each link to the queue (if it doesn't alreaady exist)\n p.links.each do |l|\n if l['ttl'] > 0 and !@store.exists?(l['href'])\n self.push(l['href'], l['ttl'])\n end\n end\n # Store the links\n @store.add(this['url'], p.links)\n end\n end", "def undo()\n return @history.pop\n end", "def swap_with_next i\n #if first_item >= first_item.next_list_item\n\n end", "def to(position)\n first position + 1\n end", "def to(position)\n first position + 1\n end", "def get_later\n if @history.empty?\n # If there is no history, clear the current input.\n # If there is no input, return so that we don't refresh the text unnecessarily.\n return if self.text.empty?\n self.text = \"\"\n elsif @history_index < @history.length-1\n # Change the text accordingly\n @history_index += 1\n self.text = @history[@history_index]\n @helper.cursor = self.text.scan(/./m).length\n else\n # If we're reached the earliest item in history, clear the current input.\n @history_index = @history.length\n self.text = \"\"\n end\n self.refresh\n end", "def insert_at(node, index)\n target = self.at(index)\n target_prev = target.prev\n set_next_and_prev(target_prev, node)\n set_next_and_prev(node, target)\n self.size += 1\n end", "def unshift\n self\n end", "def shift\n if self.empty\n return nil\n else\n if @tail == @head\n @tail = nil\n @head = nil\n else\n @head = @head.next\n return @head\n end\n end\n end", "def at(n)\n return nil if n >= count\n first(n+1).pop\n end" ]
[ "0.73704445", "0.7265829", "0.7068525", "0.67087567", "0.6537481", "0.6415236", "0.63090694", "0.62513655", "0.6246461", "0.6246461", "0.6246461", "0.6246461", "0.6246461", "0.6246461", "0.6246461", "0.6246461", "0.6227113", "0.6213634", "0.61494094", "0.61464626", "0.61122674", "0.6088509", "0.6087465", "0.60778964", "0.60616654", "0.60558814", "0.604651", "0.60295105", "0.60295105", "0.6012232", "0.6003413", "0.5983955", "0.5982421", "0.5958555", "0.5936794", "0.5923189", "0.5923189", "0.59096193", "0.5906322", "0.5857264", "0.5853123", "0.585037", "0.58496827", "0.58205914", "0.5791795", "0.579032", "0.5789547", "0.5788205", "0.57865894", "0.57777375", "0.5762714", "0.5750269", "0.57428306", "0.5738693", "0.57200074", "0.57158947", "0.5710805", "0.5710184", "0.5694007", "0.5686033", "0.56856066", "0.5685392", "0.5685392", "0.56846005", "0.56836367", "0.56817925", "0.56811625", "0.56747895", "0.5669748", "0.5668978", "0.5659233", "0.5656855", "0.5649679", "0.5649577", "0.56459254", "0.56445944", "0.5644358", "0.5627372", "0.5625363", "0.56207806", "0.5607476", "0.55996305", "0.55829877", "0.55735296", "0.55625194", "0.55625194", "0.55625194", "0.55622196", "0.55591863", "0.55547583", "0.555327", "0.55523235", "0.5546502", "0.554584", "0.554584", "0.5542185", "0.55413014", "0.55301553", "0.552881", "0.5527814" ]
0.73061115
1
Returns the currently pointed element from the history along with it's id
def current if @history_idx < 0 [ @history_idx, nil ] else [ @history_idx, @history[@history_idx] ] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_location\n return @history[-1]\n end", "def one_history\n history = History.find(@id)\n history\n end", "def current_history()\r\n return ((@history_offset == @history_length) || @the_history.nil?) ? nil : @the_history[@history_offset]\r\n end", "def last\n @history.last\n end", "def previous\n\t self.class.where(\"id < ?\", id).last\n\tend", "def prev\n @history_idx += 1 if @history_idx < @history.length - 1\n current\n end", "def previous_id\n self.class.where('id < ?', self.id).pluck(:id).last\n end", "def last_event\n history.last\n end", "def last_event\n history.last\n end", "def history\n History\n end", "def history\n @history.dup\n end", "def history\n return @history\n end", "def history\n return @history\n end", "def parent\n has_parent? and history.first\n end", "def current_element\n @elements.last\n end", "def current_element\n @_element_stack.last\n end", "def previous\n self.class.where(\"id < ?\", id).where(:punto_venta_id => self.punto_venta_id).last\n end", "def next(current)\n if (@position < @history.length - 1)\n @position = @position + 1\n return @history[@position]\n end\n return current\n end", "def prev_id\n self[:prev_id]\n end", "def history\n self.class.history.of(self)\n end", "def history\n self.class.history.of(self)\n end", "def previous_history()\r\n @history_offset!=0 ? @the_history[@history_offset-=1] : nil\r\n end", "def prev(element_id)\n prev(element_id, from: target)\n end", "def next_history()\r\n (@history_offset == @history_length) ? nil : @the_history[@history_offset+=1]\r\n end", "def focused_element_id\n page.evaluate_script(\"document.activeElement.id\")\n end", "def navigate_to_history_entry(entry_id:)\n {\n method: \"Page.navigateToHistoryEntry\",\n params: { entryId: entry_id }.compact\n }\n end", "def previous_id\n self.class.where(\"id < ? and quiz_id = ?\", self.id, self.quiz_id).pluck(:id).last\n end", "def where_history()\r\n @history_offset\r\n end", "def get_element id\n @elements[id.to_s]\n end", "def latest_inki_object_in_history(id)\n object = ObjectVersion.where(\n :format => 1,\n :model_id => id, \n :inki_model_name => self.to_s\n ).order(\"created_at DESC\").first\n if not object\n return nil \n else\n object.to_inki_object\n\t\t\tend\n\t\tend", "def previous\n Expression.where('id < ? AND collection_id = ?', self.id, self.collection_id).order('id DESC').limit(1).first\n end", "def current_entry; end", "def previous\n if id == Photo.first.id\n Photo.first\n else\n Photo.where(\"id < ?\", id).last\n end\n end", "def current\n @last\n end", "def previous_element; end", "def prev_element\n\t\treturn prev_element_of @current_node\n\tend", "def next\n @history_idx -= 1 if @history_idx > -1\n current\n end", "def history\n return nil unless tracked?\n @history ||= $repo.log.path(@name)\n end", "def previous_post\n self.class.first(:conditions => [\"id < ?\", id], :order => \"id desc\")\n end", "def history\n @parent ? @parent.history + [@name] : []\n end", "def previous\n \tWork.first(:conditions => ['id < ?', id], :order => \"id desc\")\n\tend", "def history_get(offset)\r\n local_index = offset - @history_base\r\n return (local_index >= @history_length || local_index < 0 || @the_history.nil?) ?\r\n nil : @the_history[local_index]\r\n end", "def current\n all.last\n end", "def parent_last_screen\n # print \"parent_last_screen: \" + id.to_s + \" - \" + title + \"\\n\"\n return screens.last if !screens.empty?\n previous_screen \n end", "def identifier\n @identifier ||= self.revlist.last\n end", "def get_prev()\n return @prev_node\n end", "def last_id\n # hashs are ordered, so just return the latest entry\n @entries.keys.last\n end", "def set_history_item\n @history_item = HistoryItem.find(params[:id])\n end", "def prev\n prev_id == 0 ? nil : story.cards.find(prev_id)\n end", "def current_event_id\n return @data[@index][:id]\n end", "def previous\n self.class.last(\n :conditions => {\n :user_id => self.user_id,\n :id_lt => self.id})\n end", "def undo()\n return @history.pop\n end", "def get_by_id(entry_id)\n fetch(entry_id).shift\n end", "def position(command)\n history.index(command.to_s)\n end", "def get_prev()\n\t\t\treturn @prev\n\t\tend", "def previous\n \t# CashbookIndex.where(\"id < ?\", id).order(\"id DESC\").first || CashbookIndex.last\n \tCashbookIndex.where(\"id < ?\", id).order(\"id DESC\").first || CashbookIndex.last\n\n \tend", "def prev_address\n list_entry[:prev]\n end", "def look\n @store[@top]\n end", "def look\n @store[@top]\n end", "def look\n @store[@top]\n end", "def look\n @store[@top]\n end", "def look\n @store[@top]\n end", "def look\n @store[@top]\n end", "def previous\n @previous ||= Changeset.where([\"id < ? AND repository_id = ?\", id, repository_id]).order('id DESC').first\n end", "def peek\n store.last\n end", "def prev(current)\n l = current\n l = l[0,1] if (l.length > 0 and l[0,1] == '\\n')\n l = l[-1,1] if (l.length > 0 and l[-1,1] == '\\n')\n if (@position > 0)\n if (@position == (@history.length - 1))\n @history[@history.length - 1] = l\n end\n @position = @position - 1\n return @history[@position]\n end\n return current\n end", "def id\n key = self.key\n key.first if key.size == 1\n end", "def next_history\n if @history_index && @history_index > 0\n @history_index -= 1\n else\n @history_index = @history.size - 1\n end\n\n self.value = @history[@history_index]\n end", "def prev\n if self[:prev_id]\n Likewise::Link.find_by_id self[:prev_id]\n end\n end", "def id\n @hash['id']\n end", "def previous(query)\n unless query.nil?\n index = query.find_index(self.id)\n if index\n prev_id = query[index-1] unless index.zero?\n self.class.find_by_id(prev_id)\n end\n end\n end", "def last\n asc(:id).last\n end", "def last\n order(:id).reverse.limit(1)\n end", "def id\n @hash[\"id\"]\n end", "def previous_screen\n # print \"previous_screen: \" + id.to_s + \" - \" + title + \"\\n\"\n if !has_siblings? || !higher_item\n return nil if is_root?\n return parent.parent_last_screen\n end\n higher_item.last_screen\n end", "def prev(object)\n return nil if elements.index(object) == 0\n elements[elements.index(object) - 1]\n end", "def current_entry\n @currentEntry || @current_entry\n end", "def history_items\n return @history_items\n end", "def set_history\n @history = History.find(params[:id])\n end", "def set_history\n @history = History.find(params[:id])\n end", "def set_history\n @history = History.find(params[:id])\n end", "def ref\n @id\n end", "def previous\n\t first? ? nil : locate - 1\n\tend", "def history\r\n []\r\n end", "def current_item\n current_window.item\n end", "def current\n @stack.last\n end", "def last_step_page\n history.values.last\n end", "def prev\n unless self.tll_prev.nil?\n return self.class.unscoped.where(_id: self.tll_prev).first\n end\n\n nil\n end", "def current\n @current\n end", "def id\n @position\n end", "def hash\n id\n end", "def last_id()\n #This is a stub, used for indexing\n end", "def history; end", "def history; end", "def history; end", "def get_position_of_id(target_id, ary)\n ary.each_index do |i|\n current_id = ary[i][0]\n if current_id == target_id\n return ary[i][1]\n end\n end\n end", "def current\n storage[0]\n end", "def current_state\n last_state_on_history = self.ad_history_states.last\n last_state_on_history = AdHistoryState.new if last_state_on_history.nil?\n last_state_on_history.ad_state = AdState.first if last_state_on_history.ad_state.nil?\n last_state_on_history.ad_state\n end", "def index()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Native.SegmentHistoryElement_index(@handle.ptr)\n result\n end", "def get_current_rev\n\t\t\tid = read_command_output( 'hg', '-q', 'identify' )\n\t\t\treturn id.chomp\n\t\tend" ]
[ "0.65622884", "0.6502884", "0.6416421", "0.6365359", "0.62487894", "0.62214184", "0.62133664", "0.6163559", "0.6163559", "0.60247284", "0.60121375", "0.59883136", "0.59883136", "0.59878427", "0.59863865", "0.5984071", "0.5968507", "0.5968024", "0.5948142", "0.5945666", "0.5945666", "0.59277654", "0.59229976", "0.58905065", "0.5869777", "0.5815204", "0.5791329", "0.5782992", "0.5782961", "0.57373375", "0.5711691", "0.56916213", "0.5683755", "0.56817096", "0.5678981", "0.56752396", "0.5672568", "0.56718314", "0.5632095", "0.5631258", "0.56308544", "0.56301403", "0.56279945", "0.5612298", "0.5608986", "0.5604656", "0.5604467", "0.5582645", "0.5573291", "0.55569303", "0.55280614", "0.552227", "0.5512528", "0.5503714", "0.55012375", "0.5498374", "0.54878795", "0.5487675", "0.5487675", "0.5487675", "0.5487675", "0.5487675", "0.5487675", "0.548332", "0.5480367", "0.5479047", "0.5472337", "0.5462754", "0.546252", "0.5451462", "0.5451221", "0.5447533", "0.54360545", "0.5433892", "0.54195267", "0.54128224", "0.541174", "0.54081583", "0.5401453", "0.53989017", "0.5397576", "0.5391366", "0.53908634", "0.53906685", "0.53900564", "0.53886735", "0.53828317", "0.5368643", "0.5368382", "0.5365856", "0.53657424", "0.53610635", "0.53606737", "0.53606737", "0.53606737", "0.5355307", "0.5348787", "0.53467715", "0.5345831", "0.53394824" ]
0.6372182
3
Resets the history pointer to the buffer element (that is the one before the first stored history element)
def rewind @history_idx = -1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def invalidate_history!\n @history = nil\n end", "def clear_history\n while ! Readline::HISTORY.empty? do\n Readline::HISTORY.pop\n end\n end", "def reset_buffer(new_buf = '')\n @buf.replace new_buf\n @index = 0\n end", "def reset_buffer(new_buf = '')\n @buf.replace new_buf\n @index = 0\n end", "def undo buffer\n @frames[buffer].undo buffer\n end", "def pop\n self.size -= 1\n Readline::HISTORY.pop\n end", "def next_history\n if @history_index && @history_index > 0\n @history_index -= 1\n else\n @history_index = @history.size - 1\n end\n\n self.value = @history[@history_index]\n end", "def undo\n if(@history != nil)\n @history.undo\n end\n end", "def next_history()\r\n (@history_offset == @history_length) ? nil : @the_history[@history_offset+=1]\r\n end", "def history\n @history.dup\n end", "def previous_history()\r\n @history_offset!=0 ? @the_history[@history_offset-=1] : nil\r\n end", "def buffer_prev\n buffer_update_info\n if @_buffer_ctr < 1\n buffer_last\n return\n end\n @_buffer_ctr -= 1 if @_buffer_ctr > 0\n x = @_buffer_ctr\n l = @_buffers[x]\n if l\n populate_buffer_from_filename x\n l = @_buffers[x]\n $log.debug \"bp calling set_content with #{l.class} \"\n set_content l, @_buffers_conf[x]\n buffer_update_position\n end\n end", "def clear_history()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n Native.RunEditor_clear_history(@handle.ptr)\n end", "def restore_original_value\n @buffer = @original_value.dup\n # earlier commented but trying again, since i am getting IndexError in insert 2188\n # Added next 3 lines to fix issue, now it comes back to beginning.\n cursor_home\n\n @repaint_required = true\n end", "def reset\n @push = @temp\n @index = @mark\n end", "def history\n @memory.rewind\n @memory.read\n end", "def clear\n synchronize do\n erase_history\n end\n end", "def previous_history\n history_size = @history.size\n\n @history_index = if @history_index && @history_index < history_size\n [@history_index + 1, history_size - 1].min\n else\n 0\n end\n\n self.value = @history[@history_index]\n end", "def reset\n @current = nil\n @pos = 0\n end", "def reset!\n @buffer = buffer.reset!\n end", "def reset\n clear\n @position = 0\n @current_index = 0\n end", "def reset!\n @buffer = ''\n end", "def restore_original_value\n $log.debug \" FIELD: buffer:#{@buffer}. orig:#{@original_value}: \"\n $log.debug \" original value is null \" unless @original_value\n $log.debug \" buffer value is null \" unless @buffer\n @buffer = @original_value.dup\n # earlier commented but trying again, since i am getting IndexError in insert 2188\n # Added next 3 lines to fix issue, now it comes back to beginning.\n cursor_home\n\n @repaint_required = true\n end", "def undo()\n return @history.pop\n end", "def reset_buffer(new_buf = '')\n @buf.replace Bytes.force_binary_encoding(new_buf)\n @index = 0\n end", "def add_to_history(item)\n found = nil\n Readline::HISTORY.each_with_index do |h,i|\n if h == item\n found = i\n break\n end\n end\n Readline::HISTORY.delete_at(found) if found\n Readline::HISTORY.push(item)\nend", "def _rl_start_using_history()\r\n using_history()\r\n @_rl_saved_line_for_history = nil\r\n end", "def history=(_arg0); end", "def history=(_arg0); end", "def initialize\n @index = 0\n @history = []\n end", "def replace_history_entry (which, line, data)\r\n if (which < 0 || which >= @history_length)\r\n return nil\r\n end\r\n temp = Struct.new(:line,:timestamp,:data).new\r\n old_value = @the_history[which]\r\n temp.line = line.delete(0.chr)\r\n temp.data = data\r\n temp.timestamp = old_value.timestamp.dup\r\n @the_history[which] = temp\r\n old_value\r\n end", "def init_history history\n\n history.set_editable false\n history.set_can_focus false\n history.set_justification 1\n\n end", "def reset\n @buffer = ''\n @length = 0\n @position = 0\n end", "def buffer\n Readline::HISTORY.to_a\n end", "def remove_history(which)\r\n if (which < 0 || which >= @history_length || @history_length == 0 || @the_history.nil?)\r\n return nil\r\n end\r\n return_value = @the_history[which]\r\n @the_history.delete_at(which)\r\n @history_length-=1\r\n return_value\r\n end", "def reset\n @pointer = 0\n self\n end", "def history_set_pos(pos)\r\n if (pos > @history_length || pos < 0 || @the_history.nil?)\r\n return (0)\r\n end\r\n @history_offset = pos\r\n 1\r\n end", "def prev\n @history_idx += 1 if @history_idx < @history.length - 1\n current\n end", "def loop_once\n return super if SqueezeHistory.disabled?\n begin\n input, last_input = history[-1], history[-2]\n rescue IndexError # EditLine is really broken, to_a is needed for it\n array = history.to_a\n input, last_input = array[-1], array[-2]\n end\n history.pop if input.to_s.strip == '' ||\n (history.size > 1 && input == last_input)\n super\n end", "def clear_history\n if @args[0] == 'clear'\n @history.clear\n else\n false\n end\n end", "def redo\n if(@history != nil)\n @history.redo\n end\n end", "def creat_empty_history\n new_history = {\n \"Records\": []\n }\n @history = new_history\n @history\n end", "def reset(filename)\n @history = []\n @history_idx = -1\n\n unless filename.nil? or !File.exists? filename\n @history = File.readlines(filename).map { |l| l.rstrip }.reverse\n end\n\n @backend = File.open filename, \"a+\" unless filename.nil?\n end", "def redo buffer\n @frames[buffer].redo buffer\n end", "def clear_accumulation_buffer!\n @buffer = \"\"\n @buffer_mode = nil\n @buffered_lines = []\n end", "def rewind\n @pos = 0\n end", "def rewind\n @pos = 0\n end", "def rl_beginning_of_history(count, key)\r\n rl_get_previous_history(1 + where_history(), key)\r\n end", "def rewind\n @pos = 0\n self\n end", "def rewind\n @list_index = 1\n @co_index = 1\n \n nil\n end", "def rewind\n seek_index(0)\n end", "def get_later\n if @history.empty?\n # If there is no history, clear the current input.\n # If there is no input, return so that we don't refresh the text unnecessarily.\n return if self.text.empty?\n self.text = \"\"\n elsif @history_index < @history.length-1\n # Change the text accordingly\n @history_index += 1\n self.text = @history[@history_index]\n @helper.cursor = self.text.scan(/./m).length\n else\n # If we're reached the earliest item in history, clear the current input.\n @history_index = @history.length\n self.text = \"\"\n end\n self.refresh\n end", "def interactive_history_back e\n if not @history.at_beginning\n store_in_history\n @history.back\n restore_from_history\n end\n end", "def reset\n @prev_pos = @pos = 0\n @match = nil\n self\n end", "def reset\n dup.reset!\n end", "def restore_from_history\n if current = @history.current\n @topic = current.topic\n _load_topic(topic) do\n @info.yview_moveto current.yview\n set_cursor current.cursor\n end\n end\n end", "def swap\n Vedeu.log(type: :buffer, message: \"Buffer swapping: '#{name}'\")\n\n @previous = front\n @front = back\n @back = nil\n\n store\n\n true\n end", "def history=(value)\n @history = value\n end", "def history=(value)\n @history = value\n end", "def unstifle_history()\r\n if (@history_stifled)\r\n @history_stifled = false\r\n return (@history_max_entries)\r\n else\r\n return (-@history_max_entries)\r\n end\r\n end", "def make_history_line_current(entry)\r\n _rl_replace_text(entry.line, 0, @rl_end)\r\n _rl_fix_point(1)\r\n if (@rl_editing_mode == @vi_mode)\r\n # POSIX.2 says that the `U' command doesn't affect the copy of any\r\n # command lines to the edit line. We're going to implement that by\r\n # making the undo list start after the matching line is copied to the\r\n # current editing buffer.\r\n rl_free_undo_list()\r\n end\r\n if (@_rl_saved_line_for_history)\r\n @_rl_saved_line_for_history = nil\r\n end\r\n end", "def reset\n @index = -1\n @element = nil\n @value = nil\n end", "def history\r\n []\r\n end", "def store_in_history\n if current = @history.current\n current.cursor = @info.index('insert')\n current.yview = @info.yview[0]\n end\n end", "def back_one\n @lines.pop\n refresh\n end", "def reset_metrics_buffer\n @@metrics_buffer = []\n end", "def clean_buffer; self.input_buffer = self.input_buffer[self.input_buffer.length-4,self.input_buffer.length-1]; end", "def clear_unused_steps\n log_action('Clearing future steps from the back link history')\n current_step_keys = history.select { |k, _v| k <= previous_step }.keys\n session[:back_link_history] = history.slice(*current_step_keys)\n end", "def history\n # blank\n end", "def rewind\n @seen.clear\n super\n end", "def rewind(pos = self.last_position)\n self.position = pos\n end", "def history\n @history ||= LEAP::Motion::Utils::History.new(options[:history_size])\n end", "def undo_dirty_event!\n decrement_version!\n @_dirty_events.pop\n\n self\n end", "def to_previous_line\n @history.save_line(line || \"\")\n\n if @history.to_previous_line and line = @history.current_line\n replace_line line\n end\n end", "def reset()\n @current = [1,2,3]\n end", "def forward\n history_navigate(delta: 1)\n end", "def rewind\n @cursor = 0\n end", "def append_history(_str)\r\n end", "def reset\n @entries = []\n @owner = nil\n @curr_bucket = nil\n @curr_text = ''\n end", "def rl_maybe_save_line()\r\n if @_rl_saved_line_for_history.nil?\r\n @_rl_saved_line_for_history = Struct.new(:line,:timestamp,:data).new\r\n @_rl_saved_line_for_history.line = @rl_line_buffer.dup\r\n @_rl_saved_line_for_history.timestamp = nil\r\n @_rl_saved_line_for_history.data = @rl_undo_list\r\n end\r\n 0\r\n end", "def history; end", "def history; end", "def history; end", "def interactive_history_forward e\n if not @history.at_end\n store_in_history\n @history.foreward\n restore_from_history\n end\n end", "def swap\n Vedeu.log(type: :output, message: \"Buffer swapping: '#{name}'\")\n\n @previous = front\n @front = back\n @back = nil\n\n store\n\n true\n end", "def reset_url_history(role) \n cookie_name = (role.to_s + \"_url_history\").to_sym\n history = get_url_history(cookie_name, URL_HISTORY_SIZE)\n history.reset\n save_url_history(cookie_name, \"/\", history)\n end", "def initialize_buffer\r\n @buffer = []\r\n @pointer = 0\r\n def @buffer.clear\r\n @pointer = 0\r\n super\r\n end\r\n end", "def rewind()\n #This is a stub, used for indexing\n end", "def clear_history\n #TODO: Use Delete Private Data Dialog?\n opera_desktop_action(\"Clear visited history\")\n opera_desktop_action(\"Clear typed in history\")\n end", "def clear_history\n #TODO: Use Delete Private Data Dialog?\n opera_desktop_action(\"Clear visited history\")\n opera_desktop_action(\"Clear typed in history\")\n end", "def rewind\n @read_index = -1\n end", "def clear\n @monitor.synchronize {\n new_buffer\n }\n end", "def update_steps_history # rubocop:disable Metrics/AbcSize\n if history.nil?\n log_action('Creating first step into the back link history')\n session[:back_link_history] = { '1' => page }\n elsif last_step_page != page\n return clear_unused_steps if back_button && history\n\n log_action('Adding step to the back link history')\n session[:back_link_history][next_step] = page\n end\n end", "def rewind\n @offset = 0\n end", "def rl_end_of_history(count, key)\r\n rl_maybe_replace_line()\r\n using_history()\r\n rl_maybe_unsave_line()\r\n 0\r\n end", "def reset\n @buffer.string = @buffer.read; nil\n end", "def reset\n @storage = []\n end", "def shift_first \n @head=@head.next\n @head.prev=nil\n end", "def reset\n @state = :entry\n end", "def rl_get_previous_history(count, key)\r\n if (count < 0)\r\n return (rl_get_next_history(-count, key))\r\n end\r\n if (count == 0)\r\n return 0\r\n end\r\n # either not saved by rl_newline or at end of line, so set appropriately.\r\n if (@_rl_history_saved_point == -1 && (@rl_point!=0 || @rl_end!=0))\r\n @_rl_history_saved_point = (@rl_point == @rl_end) ? -1 : @rl_point\r\n end\r\n\r\n # If we don't have a line saved, then save this one.\r\n rl_maybe_save_line()\r\n\r\n # If the current line has changed, save the changes.\r\n rl_maybe_replace_line()\r\n\r\n temp = old_temp = nil\r\n while (count>0)\r\n temp = previous_history()\r\n if temp.nil?\r\n break\r\n end\r\n old_temp = temp\r\n count -= 1\r\n end\r\n\r\n # If there was a large argument, and we moved back to the start of the\r\n # history, that is not an error. So use the last value found.\r\n if (temp.nil? && old_temp)\r\n temp = old_temp\r\n end\r\n\r\n if temp.nil?\r\n rl_ding()\r\n else\r\n rl_replace_from_history(temp, 0)\r\n _rl_history_set_point()\r\n end\r\n\r\n 0\r\n end" ]
[ "0.6910569", "0.6810145", "0.6697332", "0.6697332", "0.6679277", "0.6674285", "0.66414785", "0.6491298", "0.64660424", "0.6448663", "0.641956", "0.64177734", "0.6415567", "0.6381573", "0.63773525", "0.63536155", "0.63415563", "0.63090706", "0.6292373", "0.62809396", "0.6217566", "0.6214235", "0.6197588", "0.61708736", "0.6167896", "0.6166187", "0.6150669", "0.61411685", "0.61411685", "0.6120538", "0.6099909", "0.60898864", "0.60857356", "0.6072561", "0.606773", "0.6028223", "0.5993372", "0.5978649", "0.5972354", "0.59693927", "0.59651643", "0.59506625", "0.5940712", "0.5933222", "0.592553", "0.59101224", "0.59101224", "0.58784205", "0.58518153", "0.5839927", "0.58229494", "0.5814244", "0.5810292", "0.5805155", "0.58006257", "0.579761", "0.5790588", "0.5788336", "0.5788336", "0.5772803", "0.5771722", "0.57631284", "0.57466877", "0.57428515", "0.5728661", "0.56975275", "0.56963533", "0.5692799", "0.5687662", "0.5686364", "0.56826", "0.56781983", "0.5657348", "0.5645751", "0.5644341", "0.5642647", "0.5625401", "0.56128633", "0.56087255", "0.56061244", "0.56035846", "0.56035846", "0.56035846", "0.55905515", "0.55834186", "0.5581338", "0.5580207", "0.55720794", "0.5559908", "0.5559908", "0.55436134", "0.55419236", "0.55414873", "0.5530891", "0.55271333", "0.55248684", "0.5523168", "0.551632", "0.5516219", "0.55135334" ]
0.78869045
0
Remove the contents of this history object and rereads the contents from the specified file if possible
def reset(filename) @history = [] @history_idx = -1 unless filename.nil? or !File.exists? filename @history = File.readlines(filename).map { |l| l.rstrip }.reverse end @backend = File.open filename, "a+" unless filename.nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_history_pop(file)\n file_history = $file_history.to_h\n current_history = file_history.pop\n file_history.each_pair do |index, file_name|\n if file_name == current_history\n $file_history.delete_field(\"#{index}\")\n break\n end\n end\n end", "def remove_file(file)\n index = @repo.index\n index.remove file\n\n @affected_files << file\n end", "def remove file\n file.delete\n @files -= [file]\n end", "def file_revert(file, ref)\n if file_revisions(file).map { |r| r[:commit] }.include? ref\n file = file.gsub(%r{^/}, '')\n full_path = File.expand_path(file, @root)\n content = File.read(file_revision_at(file, ref))\n File.open(full_path, 'w') { |f| f.puts content }\n end\n end", "def remove_release_from_history(release, release_file)\n release_history = capture(\"cat #{release_file}\").split\n\n # Remove release if it exists\n release_history.delete_at release_history.index(release) unless release_history.index(release).nil?\n\n # Save\n first_rel = true\n release_history.each do |rel|\n if first_rel\n try_sudo \"echo '#{rel}' > #{release_file}\"\n first_rel = false\n else\n try_sudo \"echo '#{rel}' >> #{release_file}\"\n end\n end\nend", "def restore\n return unless File.exist?(Setting[:histfile])\n\n File.readlines(Setting[:histfile]).reverse_each { |l| push(l.chomp) }\n end", "def delete_file\n @file = []\n end", "def uncache file \n refresh = nil\n begin\n is_a_file = F === file\n path = (is_a_file ? file.path : file.to_s) \n stat = (is_a_file ? file.stat : F.stat(file.to_s)) \n refresh = tmpnam(F.dirname(path))\n ignoring_errors do\n F.link(path, refresh) rescue F.symlink(path, refresh)\n end\n ignoring_errors do\n F.chmod(stat.mode, path)\n end\n ignoring_errors do\n F.utime(stat.atime, stat.mtime, path)\n end\n ignoring_errors do\n open(F.dirname(path)){|d| d.fsync}\n end\n ensure \n ignoring_errors do\n F.unlink(refresh) if refresh\n end\n end\n end", "def remove(filename); end", "def rm_file(file)\n @files.delete(file.path)\n end", "def remove(log, author=nil, date=nil)\n\t raise NotExist.new(\"not exist: #{@file.inspect}:#{@head_rev}\") if @state == 'dead'\n\t contents = @file.checkout(@head_rev) {|c, a| c}\n\t return mkrev(contents, log, author, date, 'dead')\n\tend", "def remove(filename)\n not_implemented('remove')\n end", "def remove(file); @actions << Action::RemoveAction.new(file); end", "def rm_file(file)\n @files.delete(file.path)\n end", "def reopen_file!\n @file_contents = FileContents.new(file_path, @file_metadata)\n end", "def remove_movie_from_list(filepath)\n\t\tFile.open(@source, 'w+') do |file|\n\t\t\tlines = self.get_source_content\n\t\t\tlines.delete(filepath)\n\t\t\tfile.puts lines.join(\"\\n\")\n\t\tend\n\tend", "def undo\n\t\tremake = CreateFileCommand.new(filePath, fileContent)\n\t\tremake.execute\n\tend", "def hist_file\n hfile = File.open(\"#{self.history_file}\", 'r')\n hfile.each do |line|\n line.chomp!\n ::Readline::HISTORY.push(line)\n end\n hfile.close\n end", "def unlink(*path, last)\n hash = path.empty? ? self : read(*path)\n return nil unless hash.is_a?(Hash) || hash.is_a?(Array)\n\n hash.delete(last)\n end", "def remove_watch(file)\n @files.delete(file)\n end", "def del\n File.delete(@file)\n end", "def clear_redo(filename)\n filename ||= Doing.setting('doing_file')\n backups = Dir.glob(\"undone*___#{File.basename(filename)}\", base: backup_dir).sort.reverse\n backups.each do |file|\n FileUtils.rm(File.join(backup_dir, file))\n end\n end", "def remove_file(file)\n file = File.expand_path(file, @app.root)\n \n if @local_data.has_key?(file)\n @app.cache.remove(:raw_template, file)\n @local_data.delete(file) \n end\n end", "def remove!\n with_callbacks(:remove) do\n delete_file\n @file = nil\n @cache_id = nil\n end\n end", "def remove_content\n File.unlink(filename) if File.exist?(filename)\n end", "def destroy_dirty_file!(file)\n system(\"trashtrash #{file}\")\n end", "def rmFile(file, logkey='')\n\tMcmlln::Tools.deleteFile(file)\nrescue => logstring\nensure\n\tMcmlln::Tools.logtoJson(@log_hash, logkey, logstring)\nend", "def rmFile(file, logkey='')\n\tMcmlln::Tools.deleteFile(file)\nrescue => logstring\nensure\n\tMcmlln::Tools.logtoJson(@log_hash, logkey, logstring)\nend", "def rollback!\n files.each { |file, contents| rollback_file(file, contents) }\n @files = {}\n end", "def undelete(list)\n manifests = living_parents.map do |p|\n manifest.read changelog.read(p).manifest_node\n end\n \n # now we actually restore the files\n list.each do |file|\n unless dirstate[file].removed?\n UI.warn \"#{file} isn't being removed!\"\n else\n m = manifests[0] || manifests[1]\n data = file(f).read m[f]\n add_file file, data, m.flags(f) # add_file is wwrite in the python\n dirstate.normal f # we know it's clean, we just restored it\n end\n end\n end", "def remove!(entry)\n rel_path = Wide::PathUtils.relative_to_base(base_path, entry.path)\n\n cmd = cmd_prefix.push('rm', '-f', \"path:#{rel_path}\")\n shellout(Escape.shell_command(cmd))\n\n raise CommandFailed.new(\"Failed to remove file #{src_path} in the Mercurial repository in #{base_path}\") if $? && $?.exitstatus != 0\n end", "def delete_file(file, version)\n # remove filename, may remove digest if that was last file associated with that digest.\n my_state = get_state(version) # Creates version & copies state from prior version if doesn't exist.\n\n unless version == version_id_list.max\n raise OcflTools::Errors::CannotEditPreviousVersion, \"Can't edit prior versions! Only version #{version_id_list.max} can be modified now.\"\n end\n\n my_digest = get_digest(file, version)\n # we know it's here b/c self.get_digest would have crapped out if not.\n my_array = my_state[my_digest] # Get [Array] of files that have this digest in this version.\n my_array.delete(file) # Delete the array value that matches file.\n if !my_array.empty?\n # update the array with (fewer) items.\n my_state[my_digest] = my_array\n else\n # delete the key.\n my_state.delete(my_digest)\n end\n # put results back into State.\n set_state(version, my_state)\n end", "def remove_file(file)\n path = file_to_path(file)\n return false unless path\n \n path = normalize_path(path)\n if @pages.has_key?(path)\n page(path).delete()\n @pages.delete(path)\n end\n end", "def rollback_file(file, contents)\n if contents.present?\n File.open(file, \"w\") { |f| f << contents }\n else\n File.delete(file)\n begin\n dir = File.dirname(file)\n until dir == Rails.root\n Dir.rmdir(dir) # delete current folder\n dir = dir.split(\"/\")[0..-2].join(\"/\") # select parent folder\n end\n rescue Errno::ENOTEMPTY # Directory not empty\n end\n end\n end", "def unlink_from_work\n work = file_set.parent\n # monkey patch\n work.total_file_size_subtract_file_set! file_set\n # monkey patch\n return unless work && (work.thumbnail_id == file_set.id || work.representative_id == file_set.id || work.rendering_ids.include?(file_set.id))\n work.thumbnail = nil if work.thumbnail_id == file_set.id\n work.representative = nil if work.representative_id == file_set.id\n work.rendering_ids -= [file_set.id]\n work.save!\n end", "def file_delete(file)\n\t\tputs \"Delete entries to the local site store from file: #{file}\" if @verbose\n\t\traise \"File non-exist. Please check your file path and name again: #{file}\" unless File.exist?(file)\n\t\tsites=file_2_list(file)\n\t\tchanges=Array.new\n\t\tchanges=bulk_delete(sites) unless sites.nil? or sites.empty?\n\trescue => ee\n\t\tputs \"Exception on method file_delete: #{ee} for file: #{file}\" if @verbose\n\tend", "def clear\n if ::File.exists?(@file) \n @log.info(\"Deleted id list file.\")\n ::File.delete(@file)\n end\n end", "def rmFile(file, logkey='')\n if File.file?(file)\n Mcmlln::Tools.deleteFile(file)\n else\n logstring = 'n-a'\n end\nrescue => logstring\nensure\n Mcmlln::Tools.logtoJson(@log_hash, logkey, logstring)\nend", "def pop\n self.size -= 1\n Readline::HISTORY.pop\n end", "def delete_file\n File.unlink file\n end", "def delete_file\n File.unlink file\n end", "def reset\n FileUtils.remove_file(@path)\n end", "def unmap_file(path)\n path = path.to_s\n @files.delete path\n end", "def unmap_file(path)\n path = path.to_s\n @files.delete path\n end", "def delete\n @file = nil\n # file.delete\n end", "def notify_file_rm(file)\r\n @files[file] = { exist: false }\r\n unregister_file_from_dirs(file)\r\n end", "def remove!\n FileUtils.rm(File.join(remote_path, remote_file))\n end", "def remove_from_project(file_ref)\n group = file_ref.parents[-1]\n\n mark_change_in_group(relative_path(group))\n puts \" #{basename(file_ref)} - removed\"\n\n # If the file is gone, any build phase that refers to must also remove the\n # file. Without this, the project will have build file references that\n # contain no actual file.\n @project.native_targets.each do |target|\n target.build_phases.each do |phase|\n if phase.include?(file_ref)\n phase.remove_file_reference(file_ref)\n end\n end\n end\n\n file_ref.remove_from_project\n end", "def remove_file src\n src = src.src if src.respond_to? :src # if passed an OpenStruct e.g.\n trace { \"remove_file: removing file '#{src}' [nuget model: package]\" }\n @files = @files.reject { |f| f.src == src }\n end", "def remove_lines(target_file, args)\n new_file = []\n original_lines = IO.readlines(target_file)\n if args[:line] != nil && args[:lines] == nil\n args[:line] -= 1\n original_lines.slice!(args[:line])\n elsif args[:lines] != nil && args[:line] == nil\n args[:lines].map! {|x| x -= 1}\n args[:lines].each do |y|\n original_lines[y] = nil\n end\n elsif args[:lines] != nil && args[:line] != nil\n puts\n puts \"You have used an incorrect syntax for the FileUtils.remove_lines method.\".red\n puts \"You have specified a\" + \" :line\".red_bold + \" argument at the same time as a \" + \":lines\".red_bold + \" argument, only one can be used at a time.\"\n raise ArgumentError\n end\n if args[:pattern] != nil then\n original_lines.each do |line|\n if line =~ /#{args[:pattern]}/\n original_lines[original_lines.find_index(line)] = nil\n end\n end\n end\n original_lines.compact!\n new_file += original_lines\n File.open(target_file, \"w\") do |x|\n x.puts new_file\n end\n end", "def rm(file)\n cmd_exec(\"rm -rf #{file}\")\n end", "def remove_file_from_bundle\n bundle = object.study_file_bundle\n if bundle.present?\n bundle.original_file_list.delete_if {|file| file['file_type'] == object.file_type} # this edits the list in place, but is not saved\n object.update(study_file_bundle_id: nil)\n bundle.save\n end\n end", "def destroy\n file&.delete\n end", "def rm(path)\n file = scope.get(path)\n return if !file\n file.remove!\n end", "def del_file( file_path )\n\n path_to_dot_git = File.join( @git_folder_path, \".git\" )\n git_rm_cmd = \"git --git-dir=#{path_to_dot_git} --work-tree=#{@git_folder_path} rm #{file_path}\"\n log.info(x) { \"[git] file remove command => #{git_rm_cmd}\" }\n %x[#{git_rm_cmd}];\n log.info(x) { \"[git] has removed #{file_path} from repo and working copy.\" }\n\n end", "def remove_line_references(name, file)\n source = IO.readlines name\n source.reject! { |line| line =~ /^#line\\s(\\d+)\\s\"[^\"]+\"/ }\n File.open(name, \"w\") { |f| f.puts source }\nend", "def load_and_delete_file( filepath )\n obj = load( filepath )\n delete_file( filepath )\n obj\n end", "def change(file)\n @previous = dup if change?(file)\n set(file)\n end", "def remove_local_file(file, user)\n logger.debug(\"removing local file #{file.uid} by user #{user.dxuser}\")\n UserFile.transaction do\n # Use find_by(file.id) since file.reload may raise ActiveRecord::RecordNotFound\n file = UserFile.find_by(id: file.id)\n return unless file\n\n Event::FileDeleted.create_for(file, user)\n file.destroy!\n end\n end", "def close_file(path)\n @watch.unwatch(path)\n _sincedb_write\n end", "def unlink_from_work\n work = parent_for(file_set: file_set)\n return unless work && (work.thumbnail_id == file_set.id || work.representative_id == file_set.id || work.rendering_ids.include?(file_set.id))\n work.thumbnail = nil if work.thumbnail_id == file_set.id\n work.representative = nil if work.representative_id == file_set.id\n work.rendering_ids -= [file_set.id]\n work.save!\n end", "def remove filename\n return false unless source_hash.key?(filename)\n source_hash.delete filename\n true\n end", "def rmwhite_file(strfile)\n print(\"Cleaning: \" + strfile + \"\\n\")\n \n # Read the file\n begin\n lines = File.open(strfile).readlines()\n rescue\n print(\"Cannot open: \" + strfile + \"\\n\")\n return\n end\n \n # Write back\n begin \n File.open(strfile, \"w\") do |file|\n lines.each { |line| file.puts(line.rstrip()) }\n end\n rescue => e\n print(e.class.to_s + \": Cannot write back to: \" + strfile + \"\\n\")\n end\nend", "def test_remove_a_file\n a.rm(\"one\").commit(\"a removed one\")\n \n assert_equal nil, a['one']\n assert_equal \"one content\", b['one']\n \n b.pull\n \n assert_equal nil, a['one']\n assert_equal nil, b['one']\n \n assert_log_equal [\n \"a added one\",\n \"a removed one\"\n ], b\n end", "def update_recent(file_name)\n # Read in the list of recently opened files\n recent_files = []\n File.open(RECENT_LOC, 'r') do |recent|\n recent_files = recent.read.split(\"\\n\")\n end\n\n # If file is already in recent_files, move it to the beginning\n # Otherwise, just add it to the beginning\n abs_path = File.expand_path(file_name)\n recent_files.delete(abs_path) if recent_files.include?(abs_path)\n recent_files.prepend(abs_path)\n\n # Write updated list of recent files back into file\n File.open(RECENT_LOC, 'w') do |recent|\n recent.puts recent_files.join(\"\\n\")\n end\n\n puts recent_files\nend", "def unlink_from_work\n work = parent_for(file_set: file_set)\n return unless work && (work.thumbnail_id == file_set.id || work.representative_id == file_set.id || work.rendering_ids.include?(file_set.id))\n work.thumbnail = nil if work.thumbnail_id == file_set.id\n work.representative = nil if work.representative_id == file_set.id\n work.rendering_ids -= [file_set.id]\n work.save!\n end", "def remove_file(rev, full_path, expected_revision_int)\n unless file_exists?(rev, full_path)\n raise Repository::FileDoesNotExistConflict, full_path\n end\n act_rev = get_latest_revision\n if act_rev.revision_identifier != expected_revision_int.to_i\n raise Repository::FileOutOfSyncConflict, full_path\n end\n filename = File.basename(full_path)\n path = File.dirname(full_path)\n files_set = rev.files_at_path(path)\n rev.files.delete_at(rev.files.index(files_set[filename])) # delete file, but keep contents\n rev\n end", "def revert_file(filename,commit_id,repo=self.repo)\n post_revert(\"#{filename}\",commit_id,repo)\n end", "def destroy(file=@file)\n if self.legacy?\n return unless @password.send(:rm_file, self) \n end\n super\n end", "def read_me_delete( file_set: )\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"id=#{id}\",\n \"read_me_file_set_id=#{read_me_file_set_id}\",\n \"file_set.id=#{file_set.id}\",\n \"\" ] if umrdr_work_behavior_debug_verbose\n return unless Array( read_me_file_set_id ).first == file_set.id\n self[:read_me_file_set_id] = nil\n save!( validate: false )\n end", "def replace(file)\n puts \"removing file ~/.#{file}\"\n file_path = File.join(Dir.home, \".#{file}\")\n cmd = \"rm #{file_path}\"\n system(cmd)\n create_symbolic_link(file)\nend", "def clear_history\n while ! Readline::HISTORY.empty? do\n Readline::HISTORY.pop\n end\n end", "def forget(file); @actions << Action::ForgetAction.new(file); end", "def remove_watch(file)\n @watcher.rm_watch(file)\n end", "def remove_file(file)\n if @data['info'].key?('files')\n pieces = String.new\n n = 0\n @data['info']['files'].each do |f|\n p = (f['length'] / @data['info']['piece length'].to_f).ceil\n if ::File.join(f['path']) != file\n s = n * PIECE_SIZE\n e = s + p * PIECE_SIZE - 1\n pieces << @data['info']['pieces'][s..e]\n end\n n += p\n end\n @data['info']['pieces'] = pieces\n @data['info']['files'].delete_if { |f| ::File.join(f['path']) == file }\n\n if @data['info']['files'].length == 1\n @data['info']['name'] = ::File.basename(::File.join(@data['info']['files'].first['path']))\n @data['info']['length'] = @data['info']['files'].first['length']\n @data['info'].delete('files')\n end\n return\n end\n\n return unless @data['info']['name'] == file\n\n @data['info'].delete('name')\n @data['info'].delete('length')\n @data['info'].pieces = String.new\n end", "def rm_rf_ie file, options = {}\n rm_rf file, options if File.exist?(file)\n end", "def delete(filename); end", "def reload\n @a.clear\n if File::exists? @file\n begin\n Zlib::GzipReader.open(@file) do |gz|\n x = JSON.parse(gz.read)\n x.each{|k,v| @a.store(k,v)}\n end\n rescue Zlib::Error\n raise \"We could not reload #{@file} it may be corrupted\"\n rescue JSON::ParserError\n end \n else\n Zlib::GzipWriter.open(a).close \n end\n end", "def replace_file(file, target)\n LOGGER.info \"Replacing #{file}\".blue\n system %(rm -rf \"#{target}\")\n link_file(file, target)\nend", "def clear_history()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n Native.RunEditor_clear_history(@handle.ptr)\n end", "def undo \n if(@hasExecuted==true and (File::exist?(@newPath)))\n File::delete(@newPath)\n @hasExecuted=false\n end\n end", "def drop\n File.unlink @file if File.exist?(@file)\n self\n end", "def strip_file(file, to)\n @src_files = [] if @src_files.nil?\n\n @src_files.push file\n @dst_dir = to\n end", "def destroy_file\n object = self.class.bucket.objects.find(full_filename)\n object.destroy\n end", "def undo\n if(@history != nil)\n @history.undo\n end\n end", "def _delete_unused_associations_file(file)\n if file && File.file?(file)\n File.unlink(file)\n end\n end", "def remove_file\n @assignment = Assignment.find(params[:id])\n if ((@assignment.facebook_user.id == @fb_user.id) or (@assignment.is_author? @fb_user))\n @assignment.remove_file(params[:path])\n ZipWorker.asynch_zip_assignment(:id => @assignment.id)\n render :partial => \"file_removed\", :layout => false\n end\n end", "def remove_this_file_from_backtrace(backtrace)\n regexp = %r\"#{Regexp.quote(__FILE__)}\"o\n line_number = 0\n until regexp =~ backtrace[line_number] || line_number == 0\n line_number += 1\n end\n backtrace.slice!(line_number..-1)\n end", "def rewind\n @file.rewind\n end", "def destroy_file\n FileUtils.rm(full_filename) if File.exists?(full_filename)\n end", "def file_delete(file)\n\t\tputs \"Delete the local host repository entries from file: #{file}\"\n\t\traise \"File non-exist. Please check your file path and name again: #{file}\" unless File.exist?(file)\n\t\thosts=file_2_list(file)\n\t\tchanges=bulk_delete(hosts)\n\t\tputs \"Delete done.\"\n\t\treturn changes\n\trescue => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\"\n\tend", "def remove_file!\n begin\n super\n rescue Fog::Storage::Rackspace::NotFound\n self.file = nil\n self.send(:write_attribute, :file, nil)\n end\n end", "def undo()\r\n #need to manipulate strings by taking file name off of OldFilePath and adding it onto NewFilePath\r\n oldname = @OldFilePath.basename\r\n @NewFilePath = \"#{@NewFilePath}/#{oldname}\"\r\n origfolder = @OldFilePath.dirname\r\n @OldFilePath = origfolder\r\n\r\n FileUtils.mv(@NewFilePath, @OldFilePath)\r\n end", "def set_history_file_delete\n @history_file_delete = HistoryFileDelete.find(params[:id])\n end", "def file_history_push(file)\n file_history = $file_history.to_h\n file_history.each_pair do |index, file_name|\n if file_name == \"\"\n file_name = file\n $file_history[\"#{index}\"] = \"#{file_name}\"\n break\n end\n end\n end", "def undo()\r\n oldname = @FilePath.basename\r\n @CopiedFilePath = \"#{@CopiedFilePath}/#{oldname}\"\r\n origfolder = @FilePath.dirname\r\n @FilePath = origfolder\r\n FileUtils.mv(@CopiedFilePath, @FilePath)\r\n end", "def removetag1\n if hastag1?\n newsize = @file.stat.size(filename) - TAGSIZE\n @file.truncate(newsize)\n @tag1.clear\n end\n self\n end", "def unreference_source_files\n set_reference_source_file(@encoding_job, false)\n redirect_to play_encoding_job_path(@encoding_job)\n end", "def rm_r\n util.rm_r(path)\n end", "def remove(path)\n obj = self\n chdir do\n super \n obj.git.rm({}, '-f', '-r', path)\n end\n end" ]
[ "0.71817815", "0.63751286", "0.6349643", "0.6238109", "0.6167352", "0.6147301", "0.613519", "0.60584646", "0.6045717", "0.5993199", "0.5970578", "0.595704", "0.5955714", "0.5949767", "0.59279424", "0.59141594", "0.5882294", "0.5870342", "0.5870315", "0.5845483", "0.5841303", "0.5833519", "0.58332664", "0.581843", "0.5810712", "0.58068985", "0.5773543", "0.5773543", "0.5771241", "0.575941", "0.57446367", "0.56828076", "0.5670803", "0.5619994", "0.5619623", "0.5571089", "0.55663955", "0.5561296", "0.55606514", "0.5553507", "0.5553507", "0.55507237", "0.55479306", "0.55479306", "0.5531611", "0.5523252", "0.5510641", "0.5505563", "0.55037284", "0.5501558", "0.550087", "0.5499456", "0.5497382", "0.54938084", "0.54865706", "0.5468451", "0.5466685", "0.5459865", "0.544332", "0.54363066", "0.5418596", "0.54140806", "0.5408096", "0.5401882", "0.53895175", "0.53772616", "0.5364237", "0.5359224", "0.5354118", "0.5339742", "0.53169835", "0.5310709", "0.5301807", "0.52993715", "0.52954257", "0.52947783", "0.52726656", "0.52690434", "0.5267276", "0.5262932", "0.52627176", "0.5260155", "0.52478826", "0.5242733", "0.52341133", "0.52279854", "0.5224349", "0.5223548", "0.5221715", "0.5221245", "0.52200806", "0.5209607", "0.52020305", "0.5199919", "0.51989305", "0.51908576", "0.5173237", "0.5170081", "0.5166403", "0.51636785" ]
0.6485957
1
finds an executable in a bin/ subdirectory of kit
def find_executable(name) @project.from_directory do Find.find("kit") do |path| next unless path =~ /bin\/#{name}$/ log.debug("found #{name} executable: #{path}") return path end end log.debug("#{name} executable not found") nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_executable(name)\n @project.from_directory do\n Find.find(\"kit\") do |path|\n next unless path =~ /bin\\/#{name}$/\n\n log.debug(\"found #{name} executable: #{path}\")\n return path\n end\n end\n\n log.debug(\"#{name} executable not found\")\n fail ExecutableNotFoundError, name\n end", "def find_executable(bin,*paths)\n Application.find_executable(bin,*paths)\n end", "def find_executable( bin, *paths )\n paths = Launchy.path.split( File::PATH_SEPARATOR ) if paths.empty?\n paths.each do |path|\n file = File.join( path, bin )\n if File.executable?( file ) then\n Launchy.log \"#{self.name} : found executable #{file}\"\n return file\n end\n end\n Launchy.log \"#{self.name} : Unable to find `#{bin}' in #{paths.join(\", \")}\"\n return nil\n end", "def find_executable(bin,*paths)\n paths = ENV['PATH'].split(File::PATH_SEPARATOR) if paths.empty?\n paths.each do |path|\n file = File.join(path,bin)\n if File.executable?(file) then\n Launchy.log \"#{self.name} : found executable #{file}\"\n return file\n end\n end\n Launchy.log \"#{self.name} : Unable to find `#{bin}' in #{paths.join(', ')}\"\n return nil\n end", "def which(*bins)\n bins.flatten.each do |bin|\n ENV[\"PATH\"].split(\":\").each do |dir|\n full_path = File.join(dir, bin)\n return full_path if File.exist? full_path\n end\n end\n nil\nend", "def find_executable_in_path(command_name)\n ENV['PATH'].split(/;|:/).each do |dir|\n path = File.join(dir, command_name)\n return path if File.executable?(path)\n end\n return nil\n end", "def find_executable_in_path(command_name)\n ENV['PATH'].split(/;|:/).each do |dir|\n path = File.join(dir, command_name)\n return path if File.executable?(path)\n end\n return nil\n end", "def mock_executable_dir(executable_name)\n File.join(\"kit\", executable_name, \"bin\")\n end", "def find_binary( name )\n\t\treturn ENV[ name.to_s.upcase ] if ENV.key?( name.to_s.upcase )\n\n\t\tdirs = ENV['PATH'].split( File::PATH_SEPARATOR )\n\t\tdirs += dirs.\n\t\t\tfind_all {|dir| dir.end_with?('bin') }.\n\t\t\tmap {|dir| dir[0..-4] + 'libexec' }\n\n\t\tpaths = dirs.collect {|dir| File.join(dir, name) }\n\t\tfound = paths.find {|path| File.executable?(path) } or\n\t\t\traise \"Unable to find %p in your PATH, or in corresponding 'libexec' directories.\" %\n\t\t\t\t[name]\n\n\t\treturn found\n\tend", "def which0(cmd, &found_exe)\n # call expand_path(f, nil) == expand_path(f) for relative/abs path cmd\n find_executable(nil, cmd, &found_exe) if File.basename(cmd) != cmd\n\n search_paths.each do |path|\n find_executable(path, cmd, &found_exe)\n end\n end", "def which(cmd)\r\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\r\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\r\n exts.each { |ext|\r\n exe = File.join(path, \"#{cmd}#{ext}\")\r\n return exe if File.executable? exe\r\n }\r\n end\r\n return nil\r\nend", "def lookup_executable(args)\n executable = args[:executable]\n matches = packages_providing(\"*#{executable}\").join(\"\\n\")\n puts \"packages which provide executable:\\n#{matches}\".bold.blue\nend", "def find_executable_in_path(command_name)\n # must search all known (executable) path extensions unless the\n # explicit extension was given. this handles a case such as 'curl'\n # which can either be on the path as 'curl.exe' or as a command shell\n # shortcut called 'curl.cmd', etc.\n use_path_extensions = 0 == File.extname(command_name).length\n path_extensions = use_path_extensions ? ENV['PATHEXT'].split(/;/) : nil\n\n # must check the current working directory first just to be completely\n # sure what would happen if the command were executed. note that linux\n # ignores the CWD, so this is platform-specific behavior for windows.\n cwd = Dir.getwd\n path = ENV['PATH']\n path = (path.nil? || 0 == path.length) ? cwd : (cwd + ';' + path)\n path.split(/;/).each do |dir|\n if use_path_extensions\n path_extensions.each do |path_extension|\n path = File.join(dir, command_name + path_extension)\n return path if File.executable?(path)\n end\n else\n path = File.join(dir, command_name)\n return path if File.executable?(path)\n end\n end\n return nil\n end", "def which(executable)\n if File.executable?(exec = File.join(Dir.pwd, 'bin', executable))\n exec\n else\n executable\n end\n end", "def which(executable)\n if File.executable?(exec = File.join(Dir.pwd, 'bin', executable))\n exec\n else\n executable\n end\n end", "def which(executable)\n if File.executable?(exec = File.join(Dir.pwd, 'bin', executable))\n exec\n else\n executable\n end\n end", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which(cmd)\r\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\r\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\r\n exts.each do |ext|\r\n exe = File.join(path, \"#{cmd}#{ext}\")\r\n return exe if File.executable?(exe) && !File.directory?(exe)\r\n end\r\n end\r\n nil\r\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n }\n end\n\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n end\n end\n # return nil\n end", "def find_shell_wrapper_or_executable prog\n @bindir.each do |dir|\n fname = File.join(dir, \"#{prog}.sh\")\n\n# $stderr.print \"Checking '#{fname}'\\n\"\n\n return fname if File.executable_real? fname\n end\n\n return find_executable(prog)\n end", "def which(bin, *path)\n path = path + ['/usr/bin', '/usr/sbin', '/usr/local/bin', '/usr/local/sbin']\n path += ENV['PATH'].split(File::PATH_SEPARATOR)\n path.flatten.uniq.each do |dir|\n dest = File.join(dir, bin)\n return dest if FileTest.file? dest and FileTest.executable? dest\n end\n return false\n rescue StandardError => e\n logger.warn e\n return false\n end", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = \"#{path}/#{cmd}#{ext}\"\n return exe if File.executable? exe\n }\n end\nreturn nil\nend", "def which(executable)\n if File.executable?(exec = File.join(Dir.pwd, 'bin', executable))\n exec\n else\n executable\n end\n end", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n end\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n end\n end\n nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n end\n end\n nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n end\n end\n nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n end\n end\n nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n end\n end\n\n nil\nend", "def bin\n File.join(@root, 'bin')\n end", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV[\"PATHEXT\"] ? ENV[\"PATHEXT\"].split(\";\") : [\"\"]\n ENV[\"PATH\"].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n end\n end\n nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each {|ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n }\n end\n nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which_path(bin_name)\n bin_path = `which #{bin_name}`.strip\n bin_path.empty? ? nil : bin_path\n end", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n end\n end\n nil\n end", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = \"#{path}/#{cmd}#{ext}\"\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = \"#{path}/#{cmd}#{ext}\"\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = \"#{path}/#{cmd}#{ext}\"\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = \"#{path}/#{cmd}#{ext}\"\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = \"#{path}/#{cmd}#{ext}\"\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = \"#{path}/#{cmd}#{ext}\"\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = \"#{path}/#{cmd}#{ext}\"\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which(cmd)\r\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\r\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\r\n exts.each do |ext|\r\n exe = File.join(path, \"#{cmd}#{ext}\")\r\n return exe if File.executable?(exe) && !File.directory?(exe)\r\n end\r\n end\r\n nil\r\n end", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n }\n end\n return nil\n end", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n }\n end\n return nil\n end", "def which(cmd)\n\t# Stolen from http://stackoverflow.com/questions/210872\n\texts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n\tENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n\t\texts.each { |ext|\n\t\t\texe = File.join(path, \"#{cmd}#{ext}\")\n\t\t\treturn exe if File.executable? exe\n\t\t}\n\tend\n \treturn nil\nend", "def bin\n return \"#{@protk_dir}/bin\"\n end", "def which(cmd)\n\texts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n\tENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n\t\texts.each do |ext|\n\t\t\texe = File.join(path, \"#{cmd}#{ext}\")\n\t\t\treturn exe if File.executable? exe\n\t\tend\n\tend\n\treturn nil\nend", "def binary_exists(binary)\n print_status(\"Trying to find binary(#{binary}) on target machine\")\n binary_path = shell_command_token(\"which #{binary}\").to_s.strip\n if binary_path.eql?(\"#{binary} not found\") || binary_path == \"\"\n print_error(binary_path)\n return nil\n else\n print_status(\"Found #{binary} at #{binary_path}\")\n return binary_path\n end\n end", "def which(cmd)\n # Could actually rather check that this command with the .exe suffix\n # is somewhere, instead of allowing the suffix to change, but that\n # is probably fine\n if OS.windows? && (cmd.end_with? '.exe')\n # 5 is length of \".exe\"\n cmd = cmd[0..-5]\n end\n\n exts = pathExtsAsArray\n pathAsArray.each do |path|\n exts.each do |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n end\n end\n nil\nend", "def find_executables\n\t\tpaths = self.project_files.find_all do |path|\n\t\t\tpath.start_with?( 'bin/' )\n\t\tend\n\t\treturn paths.map {|path| path[%r{^bin/(.*)}, 1] }\n\tend", "def which(cmd)\n # Could actually rather check that this command with the .exe suffix\n # is somewhere, instead of allowing the suffix to change, but that\n # is probably fine\n if OS.windows?\n if cmd.end_with? \".exe\"\n # 5 is length of \".exe\"\n cmd = cmd[0..-5]\n end\n end\n \n exts = pathExtsAsArray\n pathAsArray.each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n }\n end\n return nil\nend", "def which(cmd)\n path = \"/usr/local/bin/#{cmd}\"\n if not File.exists?(path)\n path = \"/sw/bin/#{cmd}\"\n end\n return path;\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n }\n end\n\n nil\n end", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = \"#{path}/#{cmd}#{ext}\"\n return exe if File.executable? exe\n }\n end\n return nil\n end", "def bin_path\n '/usr/local/bin'.p\n end", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |dir|\n exts.each do |ext|\n path = File.join(dir, \"#{cmd}#{ext}\")\n if File.executable?(path) && File.file?(path)\n return path\n end\n end\n end\n nil\n end", "def which(cmd)\n exts = ENV[\"PATHEXT\"] ? ENV[\"PATHEXT\"].split(\";\") : [\"\"]\n\n ENV[\"PATH\"].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n end\n end\n\n nil\n end", "def find_in_path(utility)\n path = (ENV['PATH'] || \"\").split(File::PATH_SEPARATOR)\n suffixes = self.class.on_windows? ? self.class.windows_executable_extensions : [\"\"]\n\n path.each do |dir|\n suffixes.each do |sfx|\n file = File.join(dir, utility + sfx)\n return true if File.executable?(file)\n end\n end\n\n false\n end", "def bin_path(_opts)\n '/bin'\n end", "def bin_path(_opts)\n '/bin'\n end", "def bin_path(_opts)\n '/bin'\n end", "def search_command(command, macroname, force, abort)\n path = @macros[macroname]\n\n if (!path) or path == '' or force\n if path = File .which(command)\n\t@macros[macroname] = path\n end\n end\n\n if path and File .executable?(path)\n print \"#{command} is .. #{path}\\n\"\n else\n search_abort(command, macroname) if abort\n return nil\n end\n end", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each {|ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n }\n end\n return nil\n end", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n end\n end\n nil\n end", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n end\n end\n nil\n end", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n end\n end\n nil\n end", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = \"#{path}/#{cmd}#{ext}\"\n return exe if File.executable? exe\n end\n end\n return nil\n end", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = \"#{path}/#{cmd}#{ext}\"\n return exe if File.executable? exe\n end\n end\n return nil\n end", "def embedded_bin(bin)\n windows_safe_path(\"#{install_dir}/embedded/bin/#{bin}\")\n end", "def find_program( *names )\n system_path = ENV.read( 'PATH', Array )\n [ names ].flatten!.find do | prog |\n system_path.find { | d | File.executable?( d / prog ) }\n end\n end", "def search(f_name) \r\n yield ENV['PATH'].split(';').map {|p| File.join p, f_name}.find {|p| File.file? p and File.executable? p}\r\nend", "def start_script(root)\n return nil unless root\n candidates = Dir.glob(File.join(root, 'bin/*'))\n if candidates.size == 1\n candidates.first\n else\n Dir.glob(File.join(root, 'bin'))\n candidates.find { |candidate| Pathname.new(\"#{candidate}.bat\").exist? }\n end\n end", "def start_script(root)\n return nil unless root\n\n candidates = (root + 'bin/*').glob\n\n if candidates.size == 1\n candidates.first\n else\n candidates.find { |candidate| Pathname.new(\"#{candidate}.bat\").exist? }\n end\n end", "def whichfile(cmd)\n\n Chef::Log.debug(\"Executing which #{cmd}\")\n\n shell = Mixlib::ShellOut.new(\"which \" + cmd, :env => { 'PATH' => '/usr/bin:/usr/local/bin:/bin' })\n shell.run_command\n\n unless shell.exitstatus == 0\n return false\n else\n return true\n end\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = \"#{ path }/#{ cmd }#{ ext }\"\n return exe if File.executable?(exe)\n end\n end\n\n nil\n end", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = \"#{ path }/#{ cmd }#{ ext }\"\n return exe if File.executable?(exe)\n end\n end\n\n nil\n end", "def which cmd\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = \"#{path}/#{cmd}#{ext}\"\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which cmd\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = \"#{path}/#{cmd}#{ext}\"\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which(cmd); end", "def which(cmd); end" ]
[ "0.7895467", "0.77567035", "0.7591221", "0.74290407", "0.69405586", "0.67673683", "0.67673683", "0.6649963", "0.66474813", "0.6564241", "0.6562498", "0.6555854", "0.6535594", "0.65153646", "0.65153646", "0.65153646", "0.6509538", "0.6509538", "0.6509538", "0.6509538", "0.6509538", "0.6509538", "0.6509538", "0.6509538", "0.6509538", "0.6509538", "0.6509538", "0.6509538", "0.6509538", "0.6509538", "0.6493091", "0.6459141", "0.64589965", "0.64583415", "0.64477146", "0.64397955", "0.6413591", "0.640441", "0.64007735", "0.64007735", "0.64007735", "0.64007735", "0.6399536", "0.63894135", "0.6386181", "0.6386181", "0.6386181", "0.6386181", "0.6381451", "0.6375425", "0.63741255", "0.63741255", "0.63652414", "0.63625824", "0.63540196", "0.63540196", "0.63540196", "0.63540196", "0.63540196", "0.63540196", "0.63540196", "0.6340118", "0.6336858", "0.6336858", "0.6318626", "0.62977797", "0.62798536", "0.62737066", "0.62703717", "0.626547", "0.6260571", "0.6255262", "0.6252156", "0.62515146", "0.6233775", "0.6232369", "0.62263364", "0.62103677", "0.6205666", "0.6205666", "0.6205666", "0.62045604", "0.61927307", "0.61927193", "0.6181609", "0.6181609", "0.618075", "0.618075", "0.6166882", "0.6161562", "0.61599475", "0.61424595", "0.6135048", "0.6125779", "0.61013764", "0.6086326", "0.60691404", "0.60691404", "0.6068238", "0.6068238" ]
0.802898
0
runs an external executable, returns true on success
def run_executable(full_commandline) log.debug "running #{full_commandline}" Process.wait(Process.spawn(full_commandline)) $CHILD_STATUS.exitstatus == 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(cmd)\n puts \"#{cmd}\"\n success = system(cmd)\n exit $?.exitstatus unless success\nend", "def run_local(cmd)\n require 'English'\n\n system cmd\n return unless $CHILD_STATUS.exitstatus != 0\n puts 'exit code: ' + $CHILD_STATUS.exitstatus.to_s\n exit\nend", "def run_and_success?(cmd)\n run(cmd).success?\n end", "def run_local(cmd)\n require 'English'\n\n system cmd\n return unless $CHILD_STATUS.exitstatus != 0\n\n puts 'exit code: ' + $CHILD_STATUS.exitstatus.to_s\n abort('Shell command failed, assuming you want to abort'.foreground(:red))\nend", "def safesystem(*args)\n program = args[0]\n\n # Scan path to find the executable\n # Do this to help the user get a better error message.\n if !program.include?(\"/\") and !program_in_path?(program)\n raise ExecutableNotFound.new(program)\n end\n\n @logger.debug(\"Running command\", :args => args)\n \n status = Open4::popen4(*args) do |pid, stdin, stdout, stderr|\n stdin.close\n\n @logger.debug(\"Process is running\", :pid => pid)\n @logger.pipe(stdout => :info, stderr => :error)\n end\n success = (status.exitstatus == 0)\n\n if !success\n raise ProcessFailed.new(\"#{program} failed (exit code #{status.exitstatus})\" \\\n \". Full command was:#{args.inspect}\")\n end\n return success\n end", "def check_for_executable; end", "def exec(_cmd, _args = {})\n false\n end", "def executable?() end", "def executable_real?() end", "def run(cmd)\n result = `#{cmd}`\n raise Castanaut::Exceptions::ExternalActionError if $?.exitstatus > 0\n result\n end", "def system(cmd)\n puts cmd\n res = Kernel.system(cmd)\n if !res \n puts \"Failed running: #{cmd}\"\n exit 2\n end\nend", "def executable?; true; end", "def executable?; true; end", "def run_cmd(cmd)\n print_e(\"Run: #{cmd}\")\n exit_code = system(cmd)\n fail SystemCallError, cmd unless exit_code\n exit_code\n end", "def check(exec, name, url)\n return unless `which #{exec}`.empty?\n puts \"#{name} not found.\\nInstall it from #{url}\"\n exit\nend", "def check(exec, name, url)\n return unless `which #{exec}`.empty?\n puts \"#{name} not found.\\nInstall it from #{url}\"\n exit\nend", "def check(exec, name, url)\n return unless `which #{exec}`.empty?\n puts \"#{name} not found.\\nInstall it from #{url}\"\n exit\nend", "def check(exec, name, url)\n return unless `which #{exec}`.empty?\n puts \"#{name} not found.\\nInstall it from #{url}\"\n exit\nend", "def check(exec, name, url)\n return unless `which #{exec}`.empty?\n puts \"#{name} not found.\\nInstall it from #{url}\"\n exit\nend", "def isExecutable(cmd)\n\treturn File.executable? cmd\nend", "def exec?(cmd, options={})\n exit_status, stdout, stderr, cmd = exec(cmd, options)\n return (exit_status == 0)\n end", "def check(exec, name, url, install=nil)\n return unless `which #{exec}`.empty?\n \n puts \"#{name} not found. (#{url})\"\n puts \"\\nInstall via:\\n#{install}\" if install\n\n exit(1)\nend", "def system_check(cmd)\n success = system cmd\n raise \"Error running '#{cmd}'\" unless success \nend", "def run_cmd(cmd)\n Mixlib::ShellOut.new(cmd).run_command.exitstatus == 0\nend", "def run_test_file(executable)\n @last_cmd = executable\n @last_out = \"\"\n @last_err = \"\"\n ret = Host.run_and_output(executable.to_s.shellescape)\n\n # print any stack traces found during a failure\n print_stack_dump(executable) unless ret\n\n ret\n end", "def require_executable(name)\n print \"Checking for #{name}... \"\n\n exists = false\n\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |directory|\n path = File.join(directory, name)\n\n if File.executable?(path)\n exists = true\n break\n end\n end\n\n if exists\n puts 'yes'\n else\n abort 'no'\n end\n end", "def execute(cmd)\n if system(cmd)\n n 'Build succeeded', 'hspec', :success\n else\n n 'Build failed', 'hspec', :failed\n end\nend", "def run_cmd cmd\n info cmd\n status = system(cmd)\n if status\n info(\"Woot! Woot! - command succeeded #{cmd}\")\n else\n error(\"Gahhhh! Bad status from #{cmd}\")\n end\n status\n end", "def system_check(cmd)\n puts \"=> '#{cmd}'\"\n success = system cmd\n raise \"Error running '#{cmd}'\" unless success \nend", "def test_file_exists?(host, file_rel_path)\n host.execute(\"test -f \\\"#{get_test_file_path(host, file_rel_path)}\\\"\",\n :acceptable_exit_codes => [0, 1]) do |result|\n return result.exit_code == 0\n end\nend", "def run_in_shell(cmd, ret = false)\n\treturn `#{cmd}` if ret\n\tsystem cmd\nend", "def shell_run\n success = ruby('rubytest', *config.to_shellwords)\n exit -1 unless success\n end", "def run\n system(command)\n $?\n end", "def run\n system(command)\n $?\n end", "def try_to_run(command, verbose = false)\n r = system \"#{command}\";\n return r if r;\n $stderr.puts \"Process '#{command}' exited with #{$?.exitstatus}\"\n exit ($?.exitstatus)\nend", "def _run_command(command)\n require \"posix-spawn\"\n\n pid, stdin, stdout, stderr = POSIX::Spawn.popen4(command)\n Process.waitpid(pid)\n\n # $?.exitstatus contains exit status do something with it if non zero raise error maybe\n end", "def executable?(path)\n raise \"`executable?' method does not support Windows systems\" if session.platform == 'windows'\n\n cmd_exec(\"test -x '#{path}' && echo true\").to_s.include? 'true'\n end", "def executable?\n ::File.executable?(@path)\n end", "def run_system\n sys = system(command)\n #binding.pry # false when no vpn. # true when finished. hurray!\n end", "def run\n raise \"`#{ real_command }' failed\" unless Kernel.system( real_command )\n end", "def executable?\n true\n end", "def main\n if system(ARGV.join(\" \"))\n exit 0\n else\n main\n end\nend", "def exe(cmd)\n puts \"executing: #{cmd}\"\n out = `#{cmd}`\n puts out\n out\n end", "def runCommand(commandlines)\n commandlines.each {|commandline| convertCommand(commandline)}\n return true\n rescue SystemCallError => e\n puts e.class.name\n puts e.message\n false\n end", "def run(path)\n if File.exist? path\n puts(path) ; system(\"ruby \" + path) \n end\nend", "def exec cmd\n puts cmd\n system cmd or die\nend", "def run_cmd\n @run_cmd ||= local_suite_files.empty? ? nil : \"#{sudo}#{jr_bin} test\"\n end", "def run(options={})\n formatter = get_formatter(options)\n @output, success = run_command(cmd(options), formatter)\n\n return false unless success\n return check_for_output(formatter)\n end", "def _execute_build_command command\n puts command.green\n process = IO.popen(command) do |io|\n io.each {|line| puts line}\n io.close\n end\n\n ec = $?\n @exit_code = ec.exitstatus\n return @exit_code == 0\n end", "def run_success(*command, **opts, &b)\n\t\t\tstatus, _out, _error = run(*command, **opts, &b)\n\t\t\tstatus.success?\n\t\tend", "def run(cmd)\n print \"-> #{cmd}...\"\n system cmd\n print \"ok\\n\"\nend", "def system!(*args)\n log \"Executing #{args}\"\n if system(*args)\n log \"#{args} succeeded\"\n else\n log \"#{args} failed\"\n abort\n end\nend", "def system!(*args)\n log \"Executing #{args}\"\n if system(*args)\n log \"#{args} succeeded\"\n else\n log \"#{args} failed\"\n abort\n end\nend", "def run(command)\n $CommandLog.info command\n \n status = POpen4::popen4(command) do |stdout, stderr|\n puts stdout.read.strip\n $Log.error stderr.read.strip\n end\n \n status && status.exitstatus == 0 ? true : false\nend", "def run_it *a, &b\n exit_status, stdout, stderr = systemu *a, &b\n\n puts stdout unless stdout.empty?\n STDERR.puts stderr unless stderr.empty?\n\n exit_status\n end", "def run_script(script, *args)\n output = Better::Tempfile.new('output')\n begin\n output.close\n \n ruby = File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name']) + Config::CONFIG['EXEEXT']\n command = [ruby, File.join(File.dirname(__FILE__), script), output.path, *args]\n \n if system(*command)\n File.read(output.path)\n else\n raise \"Command failed: #{command.join(' ')}\"\n end\n ensure\n output.close if !output.closed?\n output.unlink\n end\nend", "def runSystemSafe(*cmd_and_args)\n onError 'Empty runSystemSafe command' if cmd_and_args.empty?\n\n if !File.exist?(cmd_and_args[0]) || !Pathname.new(cmd_and_args[0]).absolute?\n # check that the command exists if it is not a full path to a file\n requireCMD cmd_and_args[0]\n end\n\n system(*cmd_and_args)\n $CHILD_STATUS.exitstatus\nend", "def execute(command)\n system command\n code = $?.exitstatus\n if code > 0\n LOGGER.warn \"Failed to execute command `#{command}` with code #{code}.\"\n false\n else\n true\n end\n end", "def verify!(executable, *args, &block); end", "def runTest()\n # open program\n stdin, stdout, stderr, wait_thr = Open3.popen3(@definition.executable, *@definition.arguments)\n\n # put input template to program\n if File.file?(@definition.stdin)\n expect_stdin = IO.readlines(@definition.stdin)\n else\n expect_stdin = [ ]\n end\n\n expect_stdin.each do |x| stdin.puts x end\n stdin.close\n\n # store program output\n result_stdout = stdout.readlines\n result_stderr = stderr.readlines\n stdout.close\n stderr.close\n\n # retreive exit status\n result_status = wait_thr.value.exitstatus\n\n # compare program stdout\n if File.file?(@definition.stdout)\n expect_stdout = IO.readlines(@definition.stdout)\n else\n expect_stdout = [ ]\n end\n mismatch_stdout = compare(expect_stdout, result_stdout)\n\n # compare program stderr\n if File.file?(@definition.stderr)\n expect_stderr = IO.readlines(@definition.stderr)\n else\n expect_stderr = [ ]\n end\n mismatch_stderr = compare(expect_stderr, result_stderr)\n\n # compare program output files\n mismatch_files = false\n @definition.files.each do |output_file, file|\n if File.file?(file)\n expect_file = IO.readlines(file)\n else\n expect_file = [ ]\n end\n\n if File.file?(output_file)\n result_file = IO.readlines(output_file)\n else\n result_file = [ ]\n end\n mismatch_files |= compare(expect_file, result_file)\n end\n\n # compare program status\n mismatch_status = @definition.status != result_status\n\n # debugging output\n if @environment.verbose\n if mismatch_stdout\n puts \"mismatch in stdout\"\n end\n if mismatch_stderr\n puts \"mismatch in stderr\"\n end\n if mismatch_files\n puts \"mismatch in files\"\n end\n if mismatch_status\n puts \"mismatch in status\"\n end\n end\n\n # check the test results\n if !mismatch_stdout && !mismatch_stderr && !mismatch_files && ! mismatch_status\n return_value = false\n else\n return_value = true\n end\n\n return return_value\n end", "def runExe(lExeFileName)\n rOutput = nil\n\n change_dir(File.dirname(lExeFileName)) do\n begin\n rOutput = backquote_RBTest(\"./#{File.basename(lExeFileName)}\")\n rescue Exception\n log_err \"Exception during executable run \\\"#{lExeFileName}\\\": #{$!}\\n#{$!.backtrace.join(\"\\n\")}\"\n assert(false)\n end\n end\n\n return rOutput\n end", "def run_android(test_file = nil)\n wait_for_valid_device\n cmd = 'bundle exec ruby ./lib/run.rb android'\n cmd = %(#{cmd} \"#{test_file}\") if test_file\n bash cmd\nend", "def __valid_executable?(filename, &block)\n is_executable =\n if __transport_connection\n __transport_connection.file(filename).stat[:mode] & 1 && !__transport_connection.file(filename).directory?\n else\n File.executable?(filename) && !File.directory?(filename)\n end\n return false unless is_executable\n\n block ? yield(filename) : true\n end", "def run *args\n puts args.first.join ' '\n status, stdout, stderr = systemu *args\n puts stdout, stderr unless status.success?\nend", "def programChecker(cmd)\n if which(cmd).nil?\n abort(\"EXITING: Please install #{cmd} before continuing\")\n end\nend", "def printAndRun(com)\n\t\t$stderr.puts com\n\t\tif not system(com)\n\t\t\t$stderr.printf \"Error while running command: '\"+com+\"'\\n\"\n\t\t\t$stderr.printf \"Error code: %d\\n\",$?\n\t\t\texit 1\n\t\tend\n\tend", "def testBasicBinary\n execTest('Applications/Basic', [], 'ReleaseInfo_Exe.rb', :ExpectCalls => [\n [ 'system',\n {\n :Dir => /^.*$/,\n :Cmd => /^exerb\\.bat --version$/\n },\n { :Execute => $RBPTest_ExternalTools ? true : Proc.new { true } }\n ],\n [ 'system',\n {\n :Dir => /^.*\\/Releases\\/#{RUBY_PLATFORM}\\/UnnamedVersion\\/Normal\\/\\d\\d\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d\\/Release$/,\n :Cmd => /^exerb\\.bat -o ExeName.exe .*\\/EXE_windows_Gen\\.rb$/\n },\n { :Execute => $RBPTest_ExternalTools ? true : Proc.new { true } }\n ],\n [ 'system',\n {\n :Dir => /^.*$/,\n :Cmd => /^.*\\/edicon\\.exe .*\\/Releases\\/#{RUBY_PLATFORM}\\/UnnamedVersion\\/Normal\\/\\d\\d\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d\\/Release\\/ExeName.exe .*\\/Icon\\.ico$/\n },\n { :Execute => $RBPTest_ExternalTools ? true : Proc.new {\n FileUtils::touch \"#{Dir.glob(\"Releases/#{RUBY_PLATFORM}/*/*/*\")[0]}/Release/ExeName.exe\"\n true\n } }\n ]\n ]) do |iReleaseDir, iReleaseInfo|\n checkReleaseInfo(iReleaseDir, iReleaseInfo)\n checkReleaseNotes(iReleaseDir, iReleaseInfo)\n lExeFileName = \"#{iReleaseDir}/Release/ExeName.exe\"\n assert(File.exists?(lExeFileName))\n # Unless the Executable file can contain other rb files (please Crate come faster !), files are still present.\n assert(File.exists?(\"#{iReleaseDir}/Release/Main.rb\"))\n if $RBPTest_ExternalTools\n # Test it in Ruby's environment\n assert_equal(\"#{getRubySignature}\nRuby found in environment. Using it directly.\n> start rubyw -w \\\"#{iReleaseDir}/Release/Main.rb\\\" \\n\", runExe(lExeFileName))\n # TODO: Test it without Ruby's environment\n end\n end\n end", "def run(command,use_shell=true,working_dir)\n\t# Necessary if command take advantage of any shell features such as\n\t# IO pipining\n\tif use_shell\n\t\tcommand = \"cmd /S /C \\\"#{command}\\\"\"\n\tend\n\n\tbegin\n\t\tputs \"Executing: #{command}\"\n\t\tp = Runtime.getRuntime.exec(command,[].to_java(:string),java.io.File.new(working_dir))\n\t\t\n\t\t# RegRipper sends output to the error stream. This must be read in order to prevent the process from locking\n\t\tstd_err_reader = BufferedReader.new(InputStreamReader.new(p.getErrorStream))\n\t\twhile ((line = std_err_reader.readLine()).nil? == false)\n\t\t\t#puts line\n\t\tend\n\t\t\n\t\tp.waitFor\n\t\tputs \"Execution completed:\"\n\t\treader = BufferedReader.new(InputStreamReader.new(p.getInputStream))\n\t\twhile ((line = reader.readLine()).nil? == false)\n\t\t\tputs line\n\t\tend\n\trescue Exception => e\n\t\tputs e.message\n\t\tputs e.backtrace.inspect\n\tensure\n\t\tp.destroy\n\tend\nend", "def success?\n status == Process::EXIT_SUCCESS\n end", "def run_installer_command(cmd)\n `#{cmd}`\n end", "def start\n Dir.chdir @working_directory do\n Aruba.platform.with_environment(environment) do\n @exit_status = system(command, *arguments) ? 0 : 1\n end\n end\n end", "def _external(cmd, opts={})\n #log :info, \"cmd is ||#{cmd.inspect}||\"\n log :info, \"starting [#{cmd.join(' ')}]\" if !opts.has_key?(:silent)\n\n start = Time.now\n outfile = Tempfile.new\n pid = Process.spawn(*cmd, out: outfile.fileno, err: :out)\n SUBPROCS << pid # add to halt list\n\n begin\n _, status = Process.wait2(pid)\n rescue Errno::ECHILD\n # our subproc was killed, usually by our shutdown routine\n exit_code = 1\n else\n exit_code = status.exitstatus\n end\n\n SUBPROCS.delete(pid) # remove from halt list\n diff = format_time_diff(start)\n\n outfile.rewind\n result = outfile.read\n outfile.close!\n\n log :info, \"ran [#{cmd.join(' ')}] in #{diff}\" if !opts.has_key?(:silent)\n \n if exit_code > 0 && !$shutdown\n log :error, \"command [#{cmd.join(' ')}] returned an error (code #{exit_code}), with the following output\"\n log :error, result\n end\n\n if opts.has_key?(:timing)\n return exit_code, result, diff\n else\n return exit_code, result\n end\nend", "def run_command(cmd, exit_on_error = false)\n Bundler.with_clean_env do\n system(cmd)\n status = $CHILD_STATUS.exitstatus\n\n return false unless status != 0\n return true unless exit_on_error\n exit status\n end\nend", "def do_action(cmd)\n rc = LocalCommand.run(esx_cmd(cmd))\n\n if rc.code == 0\n return [true, rc.stdout]\n else\n err = \"Error executing: #{cmd} err: #{rc.stderr} out: #{rc.stdout}\"\n OpenNebula.log_error(err)\n return [false, rc.code]\n end\nend", "def run(cmd)\n puts(cmd)\n system(cmd)\nend", "def runSystemSafe(*cmdAndArgs)\n if cmdAndArgs.length < 1\n onError \"Empty runSystemSafe command\"\n end\n\n if !File.exists? cmdAndArgs[0] or !Pathname.new(cmdAndArgs[0]).absolute?\n # check that the command exists if it is not a full path to a file\n requireCMD cmdAndArgs[0]\n end\n\n system(*cmdAndArgs)\n $?.exitstatus\nend", "def test_helloworld\n with_fixture 'helloworld' do\n assert system(\"ruby\", ocra, \"helloworld.rb\", *DefaultArgs)\n assert File.exist?(\"helloworld.exe\")\n assert system(\"helloworld.exe\")\n end\n end", "def verify_output()\n STDERR.print \"Checking output \"\n expected = IO.popen(%W(ls -1UA #{TARGET_DIR})) {|c| c.read }\n\n [ true, false ].each do |with_std|\n cmd = [ BIN_PATH, \"-p\" ]\n cmd << \"-s\" if with_std\n cmd << TARGET_DIR\n\n output = IO.popen(%W(ls -1UA #{TARGET_DIR})) {|c| c.read }\n if expected != output\n STDERR.puts \" [failed] #{cmd * \" \"}\"\n exit 1\n end\n\n STDERR.print \".\"\n end\n\n STDERR.puts \" OK\"\nend", "def run!\n title(label)\n\n inside do\n Strainer.ui.debug \"Running '#{command}'\"\n speak(command)\n defined?(PTY) ? run_as_pty(command) : run_as_system(command)\n\n unless $?.success?\n Strainer.ui.error label_with_padding + Strainer.ui.set_color('Terminated with a non-zero exit status. Strainer assumes this is a failure.', :red)\n Strainer.ui.error label_with_padding + Strainer.ui.set_color('FAILURE!', :red)\n false\n else\n Strainer.ui.success label_with_padding + Strainer.ui.set_color('SUCCESS!', :green)\n true\n end\n end\n end", "def RunSCRSwitchTest_BinaryExists\n exec_file = Builtins.sformat(\"%1%2\", @chroot_path, @test_binary_exists)\n test_result = FileUtils.Exists(exec_file)\n\n ReportTest(\n # Test progress\n Builtins.sformat(_(\"Checking for binary %1...\"), exec_file),\n test_result\n )\n\n test_result\n end", "def run_or_fail(cmd, redact: nil)\n put_command(cmd, redact: redact)\n Open3.popen3(*cmd) do |i, o, e, t|\n i.close\n if not t.value.success?\n STDERR.write red_term_text(e.read)\n exit t.value.exitstatus\n end\n end\n end", "def ct_runscript_running(opts)\n pid = lxc_ct(opts[:id]).attach(\n stdin: opts[:stdin],\n stdout: opts[:stdout],\n stderr: opts[:stderr]\n ) do\n setup_exec_env\n LXC.run_command(opts[:script])\n end\n\n _, status = Process.wait2(pid)\n ok(exitstatus: status.exitstatus)\n end", "def test_exec()\n\t\ttempfile = Tempfile.new('sampleexec', './')\n\t\twrite_sampleexec(tempfile)\n\t\ttempfile.close(false)\n\t\tFileUtils.chmod(0700, tempfile.path)\n\n\t\t# test via direct call\n\t\toutput = Cfruby::Exec::exec(tempfile.path)\n\t\tassert_equal(output.length, 2)\n\t\tassert_equal(10, output[0].length, \"expected 10 lines of stdout\")\n\t\tassert_equal(10, output[1].length, \"expected 10 lines of stderr\")\n\n\t\t# test via the String exec() helper method\n\t\ttempfile.path.exec\n\t\tassert_equal(output.length, 2)\n\t\tassert_equal(10, output[0].length, \"expected 10 lines of stdout\")\n\t\tassert_equal(10, output[1].length, \"expected 10 lines of stderr\")\t\t\n\tend", "def sys cmd\n puts cmd\n system cmd\n raise \"Running '#{cmd}' failed\" if $? != 0\nend", "def run_shell_cmd(args)\n system(*args)\n raise \"command exited with a nonzero status code #{$?.exitstatus} (command: #{args.join(' ')})\" if !$?.success?\n end", "def exec_cmd(str, chdir)\n\tputs \"$ #{str.cyan.italic}\"\n\tOpen3.popen3(str, :chdir=>chdir) do |stdin, stdout, stderr, wait_thr|\n\t exit_status = wait_thr.value\n\t unless exit_status.success?\n\t abort \"Fail\".red\n\t end\n\tend\nend", "def execute\n raise errors.to_sentences unless valid?\n\n # default failing command\n result = false\n\n # protect command from recursion\n mutex = Mutagem::Mutex.new('revenc.lck')\n lock_successful = mutex.execute do\n result = system_cmd(cmd)\n end\n\n raise \"action failed, lock file present\" unless lock_successful\n result\n end", "def executable_installed?\n @cli.system_call 'which gcloud'\n $?.success?\n end", "def run(cmd)\n log cmd\n system(cmd) or fail \"Command Failed: [#{cmd}]\"\n end", "def run(cmd)\n log cmd\n system(cmd) or fail \"Command Failed: [#{cmd}]\"\n end", "def exec(command, &on_output)\n status = nil\n shell.execute(command) do |process|\n process.on_output(&on_output)\n process.on_error_output(&on_output)\n process.on_finish { |p| status = p.exit_status }\n end\n shell.session.loop(1) { status.nil? }\n status\n end", "def executable?\n @executable\n end", "def ct_exec_running(opts)\n pid = lxc_ct(opts[:id]).attach(\n stdin: opts[:stdin],\n stdout: opts[:stdout],\n stderr: opts[:stderr]\n ) do\n setup_exec_env\n LXC.run_command(opts[:cmd])\n end\n\n _, status = Process.wait2(pid)\n ok(exitstatus: status.exitstatus)\n end", "def run_command(cmd)\n IO.popen(cmd) do |stdout|\n stdout.reject(&:empty?)\n end.unshift($CHILD_STATUS.exitstatus.zero?)\nend", "def execute_externally?\n @execution_mode == :external\n end", "def execute cmd, identifier = ''\n success = true\n\n Open3.popen3(cmd) do |stdin, stdout, stderr, wait_thr|\n err = to_safe_string(stderr.read)\n if err != ''\n write(err, identifier, 'error')\n success = false\n end \n out = to_safe_string(stdout.read)\n if out != ''\n write(out, identifier, 'default')\n end\n end\n return success\n end", "def run\n exe_file, result = compile\n\n if result.failed?\n puts result.error\n return\n end\n\n if cases.empty?\n puts 'No test case found!'\n return\n end\n\n cmd = TTY::Command.new(printer: :progress)\n exe_output = File.join(@temp_dir, 'output')\n\n cases.each do |input, output|\n cmd.run!(exe_file, in: input, out: exe_output)\n identical = FileUtils.compare_file(output, exe_output)\n identical ? puts('Passed') : puts('Failed')\n end\n end", "def application_run()\n # we return a Bash exit value which means that rc == 0 is success\n # and anything else is failure. assume we fail then prove otherwise.\n rc = 1\n begin\n if self.respond_to? :application_lock\n applock = self.application_lock\n Log.Debug(\"[LOCKING '#{applock}'...]\") {\n ::Brewed::Path::Lock.lock_file(applock) do\n rc = _application_run\n end\n }\n else\n rc = _application_run\n end\n\n rescue => exp\n msg = Log.exception_to_string exp\n Log.Out msg\n\n rc = 1\n if self.respond_to? :application_fail\n m = self.application_fail msg\n msg = m unless m.nil?\n else\n msg += \"\\n\\nexit status: FAILED!\"\n end\n\n abort \"EXCEPTION #{exp.class.to_s}: #{exp.message}\"\n end\n\n # output the application's success message or our default\n msg =\n if rc == 0\n (self.respond_to? :application_success) ?\n self.application_success : \"exit status: SUCCESS!\"\n else\n \"exit status: FAILED!\"\n end\n\n Log.Out msg\n\n rc\n end", "def sh(command)\n _, _, err_io, thread = Open3.popen3(command)\n thread.join\n\n process_status = thread.value\n if process_status.success?\n true\n else\n raise Error, err_io.read\n end\n rescue Errno::ENOENT => err\n msg = \"#{err.message}. Do you have `#{SOX_COMMAND}' installed?\"\n raise Error, msg\n end", "def check_script(path)\n binary=path.split(' ')[0]\n raise \"#{path} does not exist\" unless File.exist? binary\n raise \"#{path} is not executable\" unless File.executable? binary\n path\n end" ]
[ "0.6728844", "0.67173827", "0.66895247", "0.6555961", "0.6529454", "0.6493891", "0.6481035", "0.6436771", "0.6343834", "0.6307714", "0.6292022", "0.6257594", "0.6257594", "0.6257037", "0.6249493", "0.6249493", "0.6249493", "0.6249493", "0.6249493", "0.6241809", "0.6240104", "0.6236891", "0.6232857", "0.62261504", "0.622161", "0.6195431", "0.6189857", "0.6186458", "0.61723024", "0.61704916", "0.61416906", "0.6082844", "0.6077662", "0.6077662", "0.6071135", "0.60492957", "0.60468775", "0.6004042", "0.5988801", "0.59622604", "0.5957921", "0.5942054", "0.59380114", "0.5932262", "0.5930297", "0.58919775", "0.58848286", "0.58740723", "0.58711976", "0.58631104", "0.58362347", "0.5833539", "0.5833539", "0.58335197", "0.58001816", "0.57973236", "0.57962257", "0.5792242", "0.57918304", "0.5791483", "0.5790408", "0.57889307", "0.5782263", "0.57806337", "0.5779234", "0.5777683", "0.5769328", "0.5768744", "0.5768078", "0.57644475", "0.5760888", "0.57602054", "0.57511336", "0.5746021", "0.57370085", "0.57252395", "0.5723883", "0.57226354", "0.5719749", "0.5713356", "0.5713175", "0.57087576", "0.57012826", "0.570043", "0.5696792", "0.56932455", "0.5689194", "0.5673735", "0.5673559", "0.5673559", "0.5669036", "0.5667571", "0.5663162", "0.5648194", "0.5643481", "0.563741", "0.5635808", "0.56065375", "0.560305", "0.56026065" ]
0.68685037
0
Returns the PortalState object
def portal_state PortalState.new(@attributes.fetch('portalstate', {})) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def state\n object.state_code\n end", "def state\n State.instance\n end", "def state\n return @state\n end", "def state\n return @state\n end", "def state\n return @state\n end", "def state\n return @state\n end", "def state\n return @state\n end", "def state\n return @state\n end", "def state\n return @state\n end", "def state\n return @state\n end", "def state\n return @state\n end", "def state\n return @state\n end", "def get_game_state\n @game_state\n end", "def state\n @gameState.state\n end", "def state\n @state.first\n end", "def state\n @state\n end", "def state\n @@states[@state]\n end", "def state\n @game.state\n end", "def get_state\n return @driver.execute_script('''var a = window.ThreesGame.__class__.state\n return a[0]''')\n end", "def state\n states.first\n end", "def state\n @state\n end", "def state\n @state\n end", "def state\n return self.endpoint.state(self.id)\n end", "def state\n @state ||= getStateData()\n end", "def get_state\n @client.get_state\n end", "def state\n @current_state\n end", "def state\r\n\t\t\t`#{BITS::BITSADMIN} /getstate {#{@id}}`\r\n\t\tend", "def getState()\n\t\t\tif @_state.nil? then\n\t\t\t\traise Statemap::StateUndefinedException\n\t\t\tend\n\t\t\treturn @_state\n\t\tend", "def state()\n Fl::Framework::List::ListItem.state_from_db(read_attribute(:state))\n end", "def local_state\n if allow_login?\n {\n id: user.id.to_s,\n email: user.email,\n expiration: nil,\n name: conzealand_contact.to_s,\n display_name: conzealand_contact.badge_display,\n roles: local_roles,\n }\n else\n # stub result which looks like 404 response from TFN\n {\n \"roles\": []\n }\n end\n end", "def state\n info[:state]\n end", "def state\n data.state\n end", "def state\n data.state\n end", "def state()\n info[:state]\n end", "def state\n data[:state]\n end", "def state\n domain_info[:state]\n end", "def state\n domain_info[:state]\n end", "def gamestate\n\t\t@game_state\n\tend", "def get_SaleState()\n \t return @outputs[\"SaleState\"]\n \tend", "def state\n data['State']\n end", "def state\n @obj_env\n end", "def state\n \n session[ flow_session_name ].fetch( state_session_name )\n \n end", "def state_obj; @_hegemon_states[@_hegemon_state]; end", "def state\n @__state\n end", "def state\n ret = request('getState')\n STATE_TO_STR[ ret['statecode'] ]\n end", "def get_power_state\n response = @client.rest_get(@data['uri'] + '/powerState')\n response.body\n end", "def current_state\n last_state_on_history = self.ad_history_states.last\n last_state_on_history = AdHistoryState.new if last_state_on_history.nil?\n last_state_on_history.ad_state = AdState.first if last_state_on_history.ad_state.nil?\n last_state_on_history.ad_state\n end", "def state\n @state.last\n end", "def state\n @state.last\n end", "def states\n @states ||= {}\n end", "def state\n self.user.state if self.user\n end", "def set_portal\n @portal = Portal.find(params[:id])\n end", "def set_portal\n @portal = Portal.find(params[:id])\n end", "def state\n status.state name\n end", "def state\n object.human_state_name\n end", "def state\n self['STATE'].to_i\n end", "def state\n self['STATE'].to_i\n end", "def state\n self['STATE'].to_i\n end", "def state\n self['STATE'].to_i\n end", "def state\n self['STATE'].to_i\n end", "def state\n self['STATE'].to_i\n end", "def state\n self.well_info.state\n end", "def state\n self[:ST]\n end", "def get_state\n@state.keys\nend", "def state\n status[\"state\"]\n end", "def get_list_state\n TransportGuideState.get_list_guide_state\n end", "def state\n address.state\n end", "def power_state(action = \"status\")\n connection.fetch(:hosts, :power, \"id\" => manager_ref, \"power_action\" => action).first[\"power\"]\n end", "def get_state(division)\n challenge_states.find_by(division: division).state\n end", "def game_state\n if @game_state.nil?\n @game_state = GameState.new(@player_count,@mode, 6, 7)\n end\n @game_state\n end", "def s\n @state_wrapper ||= EntwinedWrapperObject.new(@subgame_state.state, @subgame_state)\n end", "def state\n @conversation_state\n end", "def get_timer_state\n return current_user.timer.get_state\n end", "def get_state(instance)\n if instance.new? then @states[:create] else @states[:update] end\n end", "def get_state(instance)\n if instance.new? then @states[:create] else @states[:update] end\n end", "def get_PaymentState()\n \t return @outputs[\"PaymentState\"]\n \tend", "def state\n if (interpreter = @interpreter)\n @interpreter.state\n else\n nil\n end\n end", "def get_state\n send_request(FUNCTION_GET_STATE, [], '', 2, '? ?')\n end", "def get_state(key)\n proxy.getState(key)\n end", "def game_state\n end", "def get_current_game_state(lobby_id)\n find_lobby(lobby_id).game_state\n end", "def action_state\n return @action_state\n end", "def new\n\t\t@state = State.new\n\tend", "def __state_internal\n @state\n end", "def states\r\n @states.collect {|id| $data_states[id] }\r\n end", "def state\n # Determine the ID of the state here.\n state_id = nil\n state_id = :not_created if !@driver.uuid\n state_id = @driver.read_state if !state_id\n state_id = :unknown if !state_id\n\n # Translate into short/long descriptions\n short = state_id.to_s.gsub('_', ' ')\n long = I18n.t(\"vagrant_parallels.commands.status.#{state_id}\")\n\n # If machine is not created, then specify the special ID flag\n if state_id == :not_created\n state_id = Vagrant::MachineState::NOT_CREATED_ID\n end\n\n # Return the state\n Vagrant::MachineState.new(state_id, short, long)\n end", "def all_state(id)\n $app_sessions[id][:state]\nend", "def state\n @state.blank? ? nil : @state\n end", "def to_state\n State.new state, success?, operation_instance\n end", "def get_state(name)\n name = name.to_sym\n (@states.detect { |st| st.name == name }).value\n end", "def player_state\n @ole.PlayerState\n end", "def state\n params['state']\n end", "def get_state(key)\n @state[key]\n end", "def create\n @portal = Portal.new(params[:portal])\n\n respond_to do |format|\n if @portal.save\n flash[:notice] = 'Portal was successfully created.'\n format.html { redirect_to(@portal) }\n format.xml { render :xml => @portal, :status => :created, :location => @portal }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @portal.errors, :status => :unprocessable_entity }\n end\n end\n end", "def publishing_state\n\n PublishingState.get(publishing_state_id)\n\n end", "def state\n end", "def new_state\n State.new(self, logger)\n end", "def state\n self.instance_variables.map { |variable| self.instance_variable_get variable }\n end", "def state\n self.instance_variables.map { |variable| self.instance_variable_get variable }\n end", "def state\n self.instance_variables.map { |variable| self.instance_variable_get variable }\n end" ]
[ "0.59792286", "0.59518296", "0.5929874", "0.5929874", "0.5929874", "0.5929874", "0.5929874", "0.5929874", "0.5929874", "0.5929874", "0.5929874", "0.5929874", "0.5906659", "0.5902567", "0.5850017", "0.584304", "0.5839588", "0.57897943", "0.57891196", "0.57562983", "0.57551974", "0.57473224", "0.57225883", "0.5718346", "0.5713843", "0.57058096", "0.5678051", "0.56622976", "0.5597802", "0.55883855", "0.55773365", "0.55550873", "0.55550873", "0.55488193", "0.5502082", "0.5486681", "0.5486681", "0.54670304", "0.545935", "0.5440292", "0.54277426", "0.5424677", "0.54146224", "0.5379947", "0.535618", "0.5353198", "0.5351971", "0.53399795", "0.53399795", "0.5276", "0.52681744", "0.5216167", "0.5216167", "0.5208056", "0.5206465", "0.52035505", "0.52035505", "0.52035505", "0.52035505", "0.52035505", "0.52035505", "0.5179949", "0.51774925", "0.51736253", "0.5155946", "0.51469696", "0.51115876", "0.5111135", "0.5100107", "0.5090574", "0.50827503", "0.508148", "0.50783306", "0.50632477", "0.50632477", "0.5059611", "0.504116", "0.5036813", "0.50286883", "0.5026098", "0.5020998", "0.50162524", "0.5007623", "0.49912512", "0.49844685", "0.49812528", "0.49668348", "0.4957744", "0.49488842", "0.49477226", "0.49384832", "0.49360472", "0.49297798", "0.49151272", "0.49100935", "0.4907734", "0.49066252", "0.4881725", "0.4881725", "0.4881725" ]
0.87963104
0
Returns the SoftwareUpdate object
def software_update SoftwareUpdate.new(@attributes.fetch('swupdate', {})) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_info\n @update_info ||= AssUpdater::UpdateInfo.new(self)\n end", "def GetSuSEUpdate\n ParseInstallationKernelCmdline() if !@cmdline_parsed\n @suse_update\n end", "def swversion\n @attributes.fetch('swversion', nil)\n end", "def SetSystemUpdate\n if FileUtils.Exists(Installation.run_update_file)\n Mode.SetMode(\"update\")\n\n Builtins.foreach(\n [\n \"language\", # language already selected\n \"disks_activate\", # disks activated before running upgrade\n \"mode\", # always doing update, is already preselected\n \"update_partition\", # no mounting\n \"prepdisk\"\n ]\n ) { |m| ProductControl.DisableModule(m) } # disks already mounted, it is dummy in update anyway\n end\n\n nil\n end", "def get_web_proxy_update\n response = request(:get, \"/devmgr/v2/upgrade\")\n status(response, 200, 'Failed to web proxy upgrade detail')\n JSON.parse(response.body)\n end", "def set_software\n @software = Software.find(params[:id])\n end", "def set_software\n @software = Software.find(params[:id])\n end", "def service\n softlayer_client[:Software_Component].object_with_id(self.id)\n end", "def set_soft_update\n @soft_update = SoftUpdate.find(params[:id])\n end", "def set_opening_software\n @opening_software = OpeningSoftware.find(params[:id])\n end", "def update\n @software = Software.find(params[:id])\n\n respond_to do |format|\n if @software.update_attributes(params[:software])\n flash[:notice] = 'Software was successfully updated.'\n format.html { redirect_to(@software) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @software.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @software = Software.find(params[:id])\n\n respond_to do |format|\n if @software.update_attributes(params[:software])\n format.html { redirect_to(@software, :notice => 'Software was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @software.errors, :status => :unprocessable_entity }\n end\n end\n end", "def optional\n updates = fetch_updates\n updates.select { |update|\n @update_mgmt.optional?(update)\n }.map { |update| # rubocop:disable Style/MultilineBlockChain\n WindowsUpdate.new(update)\n }\n end", "def latest\n #rug can only get a list of *all* available packages?\n output = rug \"list-updates\"\n\n if output =~ /#{Regexp.escape @resource[:name]}\\s*\\|\\s*([^\\s\\|]+)/\n return $1\n else\n # rug didn't find updates, pretend the current\n # version is the latest\n return @property_hash[:ensure]\n end\n end", "def latest\n #zypper can only get a list of *all* available packages?\n output = zypper \"list-updates\"\n\n if output =~ /#{Regexp.escape @resource[:name]}\\s*\\|.*?\\|\\s*([^\\s\\|]+)/\n return $1\n else\n # zypper didn't find updates, pretend the current\n # version is the latest\n return @property_hash[:ensure]\n end\n end", "def index\n @title_main = \"Lista de actualizaciones\"\n @soft_updates = SoftUpdate.all\n @soft_update = SoftUpdate.new\n end", "def update\n library\n end", "def update\n respond_to do |format|\n if @software.update(software_params)\n format.html { redirect_to root_path, notice: 'Software was successfully updated.' }\n format.json { render :show, status: :ok, location: @software }\n else\n format.html { render :edit }\n format.json { render json: @software.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @software.update(software_params)\n format.html { redirect_to @software, notice: 'Software was successfully updated.' }\n format.json { render :show, status: :ok, location: @software }\n else\n format.html { render :edit }\n format.json { render json: @software.errors, status: :unprocessable_entity }\n end\n end\n end", "def windows_update_for_business\n return @windows_update_for_business\n end", "def show\n authorize! :manage, @product , :message => \"Access denied.\"\n @latest_update_version = @product.versions.last_updated\n @latest_update_documents = @product.documents.last_updated\n @latest_update_packages = @product.package_files.last_updated\n end", "def get_update_ver\n uversion = node.java.uversion\n (uversion.nil? || uversion.empty?) ? node[:java][\"#{node.java.version}u\"]['version'] : uversion\n end", "def update\n fail ESP::NotImplementedError\n end", "def version\n\t\treturn @version ||= self.find_version\n\tend", "def update!(**args)\n @maintenance_mode_time = args[:maintenance_mode_time] if args.key?(:maintenance_mode_time)\n @support_end_date = args[:support_end_date] if args.key?(:support_end_date)\n @support_expiration_time = args[:support_expiration_time] if args.key?(:support_expiration_time)\n @version = args[:version] if args.key?(:version)\n end", "def tool\n @bulk_update = BulkUpdate.new\n end", "def update_type\n spec['UpdateType']\n end", "def update_for\n update_for_items.collect(&:package)\n end", "def _check_for_updates\n @update_info = CCProcess.complete(\"sdk-manage --target --upgradable '#{@name}'\")\n @last_update_check = Time.now\n rescue CCProcess::Failed\n \"\"\n end", "def set_software_record\n @software_record = SoftwareRecord.find(params[:id])\n end", "def swversion\n config[\"swversion\"]\n end", "def update!(**args)\n @available_package = args[:available_package] if args.key?(:available_package)\n @create_time = args[:create_time] if args.key?(:create_time)\n @id = args[:id] if args.key?(:id)\n @installed_package = args[:installed_package] if args.key?(:installed_package)\n @origin_type = args[:origin_type] if args.key?(:origin_type)\n @type = args[:type] if args.key?(:type)\n @update_time = args[:update_time] if args.key?(:update_time)\n end", "def set_update\n @update = Update.find(params[:id])\n end", "def set_update\n @update = Update.find(params[:id])\n end", "def set_update\n @update = Update.find(params[:id])\n end", "def retrieve\n return if retrieved_at && retrieved_at.utc > DateTime.now.utc - 1.hour\n \n rubygems_info = Gems.info name\n new_attributes = {\n name: rubygems_info['name'], \n version: rubygems_info['version'], \n info: rubygems_info['info'],\n retrieved_at: DateTime.now\n }\n update_attributes(new_attributes, as: :internal)\n end", "def version_object\n @definitions.fetch_version(version)\n end", "def getUIversion\n return GameUniverseToUI.new(@currentStation, @currentEnemy)\n end", "def update\n respond_to do |format|\n if @opening_software.update(opening_software_params)\n format.html { redirect_to @opening_software, notice: 'Opening software was successfully updated.' }\n format.json { render :show, status: :ok, location: @opening_software }\n else\n format.html { render :edit }\n format.json { render json: @opening_software.errors, status: :unprocessable_entity }\n end\n end\n end", "def latest\n hash = self.class.pkglist(:justme => @resource[:name])\n hash[:avail] if hash\n end", "def update!(**args)\n @applied_capabilities = args[:applied_capabilities] if args.key?(:applied_capabilities)\n @create_time = args[:create_time] if args.key?(:create_time)\n @creator = args[:creator] if args.key?(:creator)\n @date_options = args[:date_options] if args.key?(:date_options)\n @disable_time = args[:disable_time] if args.key?(:disable_time)\n @disabler = args[:disabler] if args.key?(:disabler)\n @display_hints = args[:display_hints] if args.key?(:display_hints)\n @id = args[:id] if args.key?(:id)\n @integer_options = args[:integer_options] if args.key?(:integer_options)\n @lifecycle = args[:lifecycle] if args.key?(:lifecycle)\n @lock_status = args[:lock_status] if args.key?(:lock_status)\n @properties = args[:properties] if args.key?(:properties)\n @publisher = args[:publisher] if args.key?(:publisher)\n @query_key = args[:query_key] if args.key?(:query_key)\n @schema_capabilities = args[:schema_capabilities] if args.key?(:schema_capabilities)\n @selection_options = args[:selection_options] if args.key?(:selection_options)\n @text_options = args[:text_options] if args.key?(:text_options)\n @update_time = args[:update_time] if args.key?(:update_time)\n @updater = args[:updater] if args.key?(:updater)\n @user_options = args[:user_options] if args.key?(:user_options)\n end", "def update\n @software_type = SoftwareType.find(params[:id])\n\n respond_to do |format|\n if @software_type.update_attributes(params[:software_type])\n format.html { redirect_to(admin_software_type_path(@software_type), :notice => 'Software type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @software_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @dsp_available = args[:dsp_available] if args.key?(:dsp_available)\n @unlock_with_hotword_available = args[:unlock_with_hotword_available] if args.key?(:unlock_with_hotword_available)\n end", "def update(options = {})\n result = check_policies_for_update(options)\n if !force_update?(options) && (result.status == :reject)\n return Struct.new(:status) do\n alias_method :success?, :status\n end.new(false)\n end\n\n wss_client = WssAgent::Client.new\n result = wss_client.update(WssAgent::Specifications.list(options))\n if result.success?\n WssAgent.logger.debug result.data\n puts result.message\n else\n WssAgent.logger.debug \"synchronization errors occur: status: #{result.status}, message: #{result.message}, data: #{result.data}\"\n ap \"error: #{result.status}/#{result.data}\", color: { string: :red }\n end\n\n result\n end", "def update\n mode == \"update\" || mode == \"autoupgrade\"\n end", "def latest\n upd = latest_info\n unless upd.nil?\n # FIXME: there could be more than one update for a package\n # because of multiarch\n return \"#{upd[:epoch]}:#{upd[:version]}-#{upd[:release]}\"\n else\n # Yum didn't find updates, pretend the current\n # version is the latest\n raise Puppet::DevError, \"Tried to get latest on a missing package\" if properties[:ensure] == :absent\n return properties[:ensure]\n end\n end", "def latest\n upd = latest_info\n unless upd.nil?\n # FIXME: there could be more than one update for a package\n # because of multiarch\n return \"#{upd[:epoch]}:#{upd[:version]}-#{upd[:release]}\"\n else\n # Yum didn't find updates, pretend the current\n # version is the latest\n raise Puppet::DevError, \"Tried to get latest on a missing package\" if properties[:ensure] == :absent\n return properties[:ensure]\n end\n end", "def update\n install\n end", "def software_name\n begin\n self.software.name\n rescue\n \"not found\"\n end\n end", "def update!(**args)\n @instance = args[:instance] if args.key?(:instance)\n @last_run_id = args[:last_run_id] if args.key?(:last_run_id)\n @name = args[:name] if args.key?(:name)\n @os_policy_assignment = args[:os_policy_assignment] if args.key?(:os_policy_assignment)\n @os_policy_compliances = args[:os_policy_compliances] if args.key?(:os_policy_compliances)\n @update_time = args[:update_time] if args.key?(:update_time)\n end", "def software_name\n self.class.const_get(:SOFTWARE_NAME)\n end", "def update!(**args)\n @applied_capabilities = args[:applied_capabilities] if args.key?(:applied_capabilities)\n @create_time = args[:create_time] if args.key?(:create_time)\n @creator = args[:creator] if args.key?(:creator)\n @disable_time = args[:disable_time] if args.key?(:disable_time)\n @disabler = args[:disabler] if args.key?(:disabler)\n @display_hints = args[:display_hints] if args.key?(:display_hints)\n @id = args[:id] if args.key?(:id)\n @lifecycle = args[:lifecycle] if args.key?(:lifecycle)\n @lock_status = args[:lock_status] if args.key?(:lock_status)\n @properties = args[:properties] if args.key?(:properties)\n @publish_time = args[:publish_time] if args.key?(:publish_time)\n @publisher = args[:publisher] if args.key?(:publisher)\n @schema_capabilities = args[:schema_capabilities] if args.key?(:schema_capabilities)\n @update_time = args[:update_time] if args.key?(:update_time)\n @updater = args[:updater] if args.key?(:updater)\n end", "def update(args = {})\n object\n end", "def update\n # Install in pacman can be used for update, too\n self.install\n end", "def update\n # Install in pacman can be used for update, too\n self.install\n end", "def update\n @software_report = SoftwareReport.find(params[:id])\n\n respond_to do |format|\n if @software_report.update_attributes(params[:software_report])\n flash[:notice] = 'SoftwareReport was successfully updated.'\n format.html { redirect_to(@software_report) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @software_report.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n self.install\n end", "def update\n self.install\n end", "def update\n self.install\n end", "def important\n updates = fetch_updates\n updates\n .select { |update|\n @update_mgmt.important?(update)\n }.map { |update| # rubocop:disable Style/MultilineBlockChain\n WindowsUpdate.new(update)\n }\n end", "def last_update\n Time.parse(@record.SystemModstamp)\n end", "def update\n respond_to do |format|\n if @product_software.update_attributes(product_software_params)\n format.html { redirect_to([:admin, @product_software], notice: 'Product Software was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render action: \"edit\" }\n format.xml { render xml: @product_software.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_currentupdate\n @currentupdate = Currentupdate.find(params[:id])\n\n end", "def get_firmware_upgrade_details(sys_id)\n response = request(:get, \"/devmgr/v2/storage-systems/#{sys_id}/cfw-upgrade/\")\n response\n #status(response, 200, 'Failed to get firmware upgrade details')\n # if response.status == 422\n # fail(\"Error : #{response.body}\")\n # end\n # JSON.parse(response.body)\n end", "def latest\n # Refresh package metadata before looking for latest versions\n pkg(:refresh)\n\n lines = pkg(:list, \"-Hvn\", @resource[:name]).split(\"\\n\")\n\n # remove certificate expiration warnings from the output, but report them\n cert_warnings = lines.select { |line| line =~ /^Certificate/ }\n unless cert_warnings.empty?\n Puppet.warning(_(\"pkg warning: %{warnings}\") % { warnings: cert_warnings.join(', ') })\n end\n\n lst = lines.select { |line| line !~ /^Certificate/ }.map { |line| self.class.parse_line(line) }\n\n # Now we know there is a newer version. But is that installable? (i.e are there any constraints?)\n # return the first known we find. The only way that is currently available is to do a dry run of\n # pkg update and see if could get installed (`pkg update -n res`).\n known = lst.find { |p| p[:status] == 'known' }\n if known\n options = ['-n']\n options.concat(join_options(@resource[:install_options])) if @resource[:install_options]\n return known[:ensure] if exec_cmd(command(:pkg), 'update', *options, @resource[:name])[:exit].zero?\n end\n\n # If not, then return the installed, else nil\n (lst.find {|p| p[:status] == 'installed' } || {})[:ensure]\n end", "def update\n nil\n end", "def version\n @firmware_version ||= littlewire.version\n end", "def getUIversion\n GameUniverseToUI.new(@currentSpaceStation, @currentEnemy)\n end", "def update_feedback\n @f = WorkerFeedback.first\n @mode = @f.status || '???'\n @mode_update_time = @f.updated_at\n @camera_model = @f.model_name || '???'\n @gphoto_version = @f.gphoto_version || '???'\n end", "def update\n @admin_template_software = TemplateSoftware.find(params[:id])\n\n respond_to do |format|\n if @admin_template_software.update_attributes(params[:admin_template_software])\n format.html { redirect_to admin_template_software_url, notice: '공지사항이 수정되었습니다.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_template_software.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @maintenance_mode_time = args[:maintenance_mode_time] if args.key?(:maintenance_mode_time)\n @skaffold_support_state = args[:skaffold_support_state] if args.key?(:skaffold_support_state)\n @status = args[:status] if args.key?(:status)\n @support_expiration_time = args[:support_expiration_time] if args.key?(:support_expiration_time)\n end", "def is_feature_update\n return @is_feature_update\n end", "def update\n @experiment_software = ExperimentSoftware.find(params[:id])\n\n respond_to do |format|\n if @experiment_software.update_attributes(params[:experiment_software])\n format.html { redirect_to @experiment_software, :notice => 'Experiment software was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @experiment_software.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sw_dev.update(sw_dev_params)\n format.html { redirect_to @sw_dev, notice: 'Sw dev was successfully updated.' }\n format.json { render :show, status: :ok, location: @sw_dev }\n else\n format.html { render :edit }\n format.json { render json: @sw_dev.errors, status: :unprocessable_entity }\n end\n end\n end", "def outdated?; end", "def version\n response = get('/getVersion', {}, false)\n ApiVersion.new(response.body['version'], response.body['builddate'])\n end", "def update\n create\n end", "def set_sw_dev\n @sw_dev = SwDev.find(params[:id])\n end", "def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @deployed_models = args[:deployed_models] if args.key?(:deployed_models)\n @description = args[:description] if args.key?(:description)\n @display_name = args[:display_name] if args.key?(:display_name)\n @enable_private_service_connect = args[:enable_private_service_connect] if args.key?(:enable_private_service_connect)\n @encryption_spec = args[:encryption_spec] if args.key?(:encryption_spec)\n @etag = args[:etag] if args.key?(:etag)\n @labels = args[:labels] if args.key?(:labels)\n @model_deployment_monitoring_job = args[:model_deployment_monitoring_job] if args.key?(:model_deployment_monitoring_job)\n @name = args[:name] if args.key?(:name)\n @network = args[:network] if args.key?(:network)\n @predict_request_response_logging_config = args[:predict_request_response_logging_config] if args.key?(:predict_request_response_logging_config)\n @traffic_split = args[:traffic_split] if args.key?(:traffic_split)\n @update_time = args[:update_time] if args.key?(:update_time)\n end", "def set_weekly_update\n @weekly_update = WeeklyUpdate.find(params[:id])\n end", "def version\n new_resource.version || latest_version\n end", "def update\n @software_test = SoftwareTest.find(params[:id])\n\n respond_to do |format|\n if @software_test.update_attributes(params[:software_test])\n format.html { redirect_to @software_test, notice: 'Software test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @software_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def outdated; end", "def update!(**args)\n @continued_conversation_enabled = args[:continued_conversation_enabled] if args.key?(:continued_conversation_enabled)\n @device_model_type = args[:device_model_type] if args.key?(:device_model_type)\n @dsp_available = args[:dsp_available] if args.key?(:dsp_available)\n @hotword_in_navigation_enabled = args[:hotword_in_navigation_enabled] if args.key?(:hotword_in_navigation_enabled)\n @hotword_setting = args[:hotword_setting] if args.key?(:hotword_setting)\n @lockscreen_enabled = args[:lockscreen_enabled] if args.key?(:lockscreen_enabled)\n @opa_eligibility_state = args[:opa_eligibility_state] if args.key?(:opa_eligibility_state)\n @opa_eligible = args[:opa_eligible] if args.key?(:opa_eligible)\n @sdk_version = args[:sdk_version] if args.key?(:sdk_version)\n @speaker_id_model_present = args[:speaker_id_model_present] if args.key?(:speaker_id_model_present)\n @speaker_id_recognition_enabled = args[:speaker_id_recognition_enabled] if args.key?(:speaker_id_recognition_enabled)\n @trusted_voice_enabled = args[:trusted_voice_enabled] if args.key?(:trusted_voice_enabled)\n @unlock_with_hotword_available = args[:unlock_with_hotword_available] if args.key?(:unlock_with_hotword_available)\n @user_migrated_to_declined = args[:user_migrated_to_declined] if args.key?(:user_migrated_to_declined)\n @voice_match_setting = args[:voice_match_setting] if args.key?(:voice_match_setting)\n end", "def update!(**args)\n @consumer_defined_name = args[:consumer_defined_name] if args.key?(:consumer_defined_name)\n @create_time = args[:create_time] if args.key?(:create_time)\n @labels = args[:labels] if args.key?(:labels)\n @maintenance_policy_names = args[:maintenance_policy_names] if args.key?(:maintenance_policy_names)\n @maintenance_schedules = args[:maintenance_schedules] if args.key?(:maintenance_schedules)\n @maintenance_settings = args[:maintenance_settings] if args.key?(:maintenance_settings)\n @name = args[:name] if args.key?(:name)\n @producer_metadata = args[:producer_metadata] if args.key?(:producer_metadata)\n @provisioned_resources = args[:provisioned_resources] if args.key?(:provisioned_resources)\n @slm_instance_template = args[:slm_instance_template] if args.key?(:slm_instance_template)\n @slo_metadata = args[:slo_metadata] if args.key?(:slo_metadata)\n @software_versions = args[:software_versions] if args.key?(:software_versions)\n @state = args[:state] if args.key?(:state)\n @tenant_project_id = args[:tenant_project_id] if args.key?(:tenant_project_id)\n @update_time = args[:update_time] if args.key?(:update_time)\n end", "def update!(**args)\n @consumer_defined_name = args[:consumer_defined_name] if args.key?(:consumer_defined_name)\n @create_time = args[:create_time] if args.key?(:create_time)\n @labels = args[:labels] if args.key?(:labels)\n @maintenance_policy_names = args[:maintenance_policy_names] if args.key?(:maintenance_policy_names)\n @maintenance_schedules = args[:maintenance_schedules] if args.key?(:maintenance_schedules)\n @maintenance_settings = args[:maintenance_settings] if args.key?(:maintenance_settings)\n @name = args[:name] if args.key?(:name)\n @producer_metadata = args[:producer_metadata] if args.key?(:producer_metadata)\n @provisioned_resources = args[:provisioned_resources] if args.key?(:provisioned_resources)\n @slm_instance_template = args[:slm_instance_template] if args.key?(:slm_instance_template)\n @slo_metadata = args[:slo_metadata] if args.key?(:slo_metadata)\n @software_versions = args[:software_versions] if args.key?(:software_versions)\n @state = args[:state] if args.key?(:state)\n @tenant_project_id = args[:tenant_project_id] if args.key?(:tenant_project_id)\n @update_time = args[:update_time] if args.key?(:update_time)\n end", "def create\n @soft_update = SoftUpdate.new(soft_update_params)\n\n respond_to do |format|\n if @soft_update.save\n format.html { redirect_to @soft_update, notice: 'Soft update was successfully created.' }\n format.json { render :show, status: :created, location: @soft_update }\n else\n format.html { render :new }\n format.json { render json: @soft_update.errors, status: :unprocessable_entity }\n end\n end\n end", "def version\n @version_obj ||= fetcher.get(Fastly::Version, service_id, version_number)\n end", "def version\n @version_obj ||= fetcher.get(Fastly::Version, service_id, version_number)\n end", "def latest_stored_update\n active_model_configurations\n .select(:updated_at)\n .reorder('')\n .order('updated_at desc nulls last')\n .limit(1)\n .pluck(:updated_at)\n .first\n end", "def update!(**args)\n @install_gpu_drivers = args[:install_gpu_drivers] if args.key?(:install_gpu_drivers)\n @instance_template = args[:instance_template] if args.key?(:instance_template)\n @policy = args[:policy] if args.key?(:policy)\n end", "def get_version()\n\t\t\tkparams = {}\n\t\t\tclient.queue_service_action_call('system', 'getVersion', 'string', kparams)\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\treturn client.do_queue()\n\t\tend", "def site_fields_requiring_upgrade\n @attributes[:site_fields_requiring_upgrade]\n end", "def get_build_info(site, product_id, product_version, eclipse_version, build_info)\n info = OpenStruct.new\n info.name = site.products[product_id].name\n info.product_id = product_id\n info.product_name = site.products[product_id].name\n info.version = product_version\n info.archived = (build_info[:archived] unless build_info.nil?) || false\n info.release_date = build_info[\"release_date\"] unless (build_info.nil? || !build_info.has_key?(\"release_date\"))\n #puts \" Release date: #{info.version}: #{info.release_date}\"\n info.renamed_as = build_info[\"renamed_as\"] unless build_info.nil?\n info.eclipse_version = eclipse_version\n info.eclipse_name = build_info[\"eclipse_name\"] unless build_info.nil?\n info.build_type = get_build_type(site, product_id, product_version)\n info.build_type_label = get_build_type_label(site, product_id, product_version, info.build_type, info.archived)\n info.blog_announcement_url = build_info[\"blog_announcement_url\"] unless build_info.nil?\n info.release_notes_url = build_info[\"release_notes_url\"] unless build_info.nil?\n #info.supported_jbt_is_version = build_info[\"supported_jbt_is_version\"] unless build_info.nil?\n info.required_jbt_core_version = build_info[\"required_jbt_core_version\"] unless build_info.nil?\n info.required_devstudio_version = build_info[\"required_devstudio_version\"] unless build_info.nil?\n #info.supported_devstudio_is_version = build_info[\"supported_devstudio_is_version\"] unless build_info.nil?\n unless site.whatsnew_pages[product_id].nil? || site.whatsnew_pages[product_id][product_version].nil? then\n info.whatsnew_url = site.whatsnew_pages[product_id][product_version].output_path\n end\n info.installers = build_info[\"installers\"] unless build_info.nil?\n info.update_site_url = build_info[\"update_site_url\"] unless build_info.nil?\n info.marketplace_url = build_info[\"marketplace_url\"] unless build_info.nil?\n info.marketplace_install_url = build_info[\"marketplace_install_url\"] unless build_info.nil?\n info.zips = build_info[\"zips\"] unless build_info.nil?\n #info.archived = build_info[\"archived\"] unless build_info.nil?\n return info\n end", "def update\n create\n end", "def system\n return @system\n end", "def get_update\n \"Replacement status: #{replacement_status_type}\"\n end", "def update\n super if defined? super\n @systems.each_value do |system|\n system.update\n end\n end", "def latest_ust\n self.delta_pack[\"latestUST\"]\n end", "def update\n respond_to do |format|\n if @software.update(software_params)\n format.html {\n if params[:return_to]\n return_to = URI.parse(params[:return_to]).path\n redirect_to(return_to, notice: \"Software was successfully updated.\")\n else\n redirect_to([:admin, @software], notice: 'Software was successfully updated. If you replaced the file, please wait while the system propagates the changes to our content delivery network.')\n end\n }\n format.xml { head :ok }\n website.add_log(user: current_user, action: \"Updated software: #{@software.name}\")\n else\n format.html { render action: \"edit\" }\n format.xml { render xml: @software.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.5878141", "0.58539855", "0.54987025", "0.5446719", "0.5428455", "0.5419265", "0.5419265", "0.54175717", "0.5409225", "0.53936625", "0.53472394", "0.53249264", "0.53140825", "0.5305173", "0.5304717", "0.5264395", "0.5261148", "0.5254372", "0.5246036", "0.52016485", "0.5173937", "0.51530606", "0.5124217", "0.5120327", "0.51048994", "0.5099308", "0.5080321", "0.5073498", "0.5061143", "0.50515026", "0.50495493", "0.5037053", "0.50368696", "0.50368696", "0.50368696", "0.5012481", "0.4999646", "0.4998076", "0.49970472", "0.4987662", "0.49853307", "0.49537253", "0.49494788", "0.49382937", "0.49344984", "0.49331492", "0.49331492", "0.49249163", "0.4920657", "0.4917598", "0.4895426", "0.48939005", "0.4886523", "0.48863757", "0.48863757", "0.48839957", "0.48831567", "0.4882792", "0.4882792", "0.48827353", "0.48790002", "0.48648444", "0.48640954", "0.4848317", "0.48477945", "0.4836627", "0.48304445", "0.4826411", "0.48261815", "0.48248985", "0.48070544", "0.48050705", "0.48047858", "0.48047748", "0.48026812", "0.47781765", "0.4768634", "0.47658044", "0.4754198", "0.47534028", "0.47493443", "0.4748791", "0.4748331", "0.47473735", "0.4745795", "0.4745795", "0.4744035", "0.47431815", "0.47431815", "0.47429517", "0.4742476", "0.47373188", "0.4724212", "0.47192082", "0.4718586", "0.47136322", "0.471326", "0.47014436", "0.4699061", "0.46919006" ]
0.8493367
0
Returns the WhitelistUsers collection
def whitelist_users WhitelistUsers.new(@attributes.fetch('whitelist', {})) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_whitelist\n return FavouriteGroup.find(:first, :conditions => { :user_id => self.id, :name => FavouriteGroup::WHITELIST_NAME } )\n end", "def users\n gateway_check\n @users\n end", "def getUsers\n return @Users \n end", "def list_users\n @users = User.find(:all)\n end", "def users\n watches_unique_by_user.map(&:user)\n end", "def users\n return @users\n end", "def list\n get('users')['users']\n end", "def users\n Collection.new(klass: User, client: @client, belongs_to: self)\n end", "def users\n gateway_check\n unavailable_servers_check\n @users\n end", "def returning_users\n []\n end", "def users\n @users_collection ||= DataStore.users_for_project(self)\n end", "def users\n raise \"No users are defined\" unless user_role.users.count.positive?\n user_role.users\n end", "def users\n @users\n end", "def users_list\n\t\t\tpost= { \"token\" => @token }\n\t\t\tdocxml = nil\n\t\t\tdocxml=nessus_request('users/list', post)\n\t\t\tif docxml.nil?\n\t\t\t\treturn\n\t\t\tend\n\t\t\tusers=Array.new\n\t\t\tdocxml.root.elements['contents'].elements['users'].each_element('//user') { |user|\n\t\t\t\tentry=Hash.new\n\t\t\t\tentry['name']=user.elements['name'].text\n\t\t\t\tentry['admin']=user.elements['admin'].text\n\t\t\t\tentry['lastlogin']=user.elements['lastlogin'].text\n\t\t\t\tusers.push(entry)\n\t\t\t}\n\t\t\treturn users\n\t\tend", "def get_users\n users = call(CMD_GET_USERS)[:users]\n users.map {|account| User.new(account) }\n end", "def users\n users = Backlogjp.base._command \"getUsers\", self.id\n users.map {|hash| User.new(hash)}\n end", "def list\n @all_users = User.find(:all)\n end", "def getUserList\n @userList\n end", "def all_users()\n User.all\n end", "def get_users\n\t\t\t@users = User.all.where(:on_beverage_list => true).order('firstname, lastname')\n\t\tend", "def users\n return @canonical_user_pool if @canonical_user_pool\n Egi::Fedcloud::Vmhound::Log.debug \"[#{self.class}] Retrieving all users\"\n check_retval @user_pool.info!\n\n @canonical_user_pool = []\n @user_pool.each { |user| @canonical_user_pool << canonical_user(user) }\n @canonical_user_pool\n end", "def users\n call(\"UserGroup\", \"get_user_collection_from_role\", \"roleName\" => @name).xpath(\"//spdir:User\", NS).map do |row|\n attributes = clean_attributes(row.attributes)\n User.new(@site, attributes[\"LoginName\"])\n end\n end", "def list_users\n BrickFTP::API::User.all\n end", "def list_users\n BrickFTP::API::User.all\n end", "def list\n response = @client.get(\"/users\")\n response[\"users\"].map {|u| User.new(@client, u) }\n end", "def users\n @users = User.find(:all)\n end", "def user_keys\n self.whitelists.map{|whitelist| whitelist.user_key}.uniq\n end", "def get_whitelist\n @whitelist ||= []\n end", "def list\n\t\t# retrieve all users\n @users = User.find(:all)\n end", "def users\n []\n end", "def all\n response = conn.get do |request|\n request.url \"/v1/admin/users.json\"\n end\n\n response.body[\"users\"].map {|attributes| Nuwe::User.new(attributes)}\n end", "def whitelist_users?\n self.whitelist_users.any?\n end", "def get_whitelist\n self.class.get_whitelist\n end", "def users model = User.bands\n @users ||= find_users model\n end", "def admin\n @userList = User.all\n end", "def visible_users\n is_superadmin? ? User.all : title.users\n end", "def users\n @users = User.all\n end", "def users\n @users ||= rows.map { |r| UserImport::User.new(r) }\n end", "def list\n log \"retrieving users list from #{users_path}\"\n response = identity_client.get(users_path)\n records = JSON.load(response.body)[\"users\"]\n records.map { |record|\n record[\"username\"]\n }.map { |username|\n Raca::User.new(@account, username)\n }\n end", "def list_of_users\n\tusers=[]\n\tfor username in Dir.entries(\"/Users\")\n\t\tif !username.start_with?(\".\")\n\t\t\tusers.push(username)\n\t\tend\n\tend\n\treturn users\nend", "def users\n unless @users\n userListService = $viewContext.getViewService(OTUserListService.java_class)\n @users = userListService.getUserList().sort_by { |user| #sort users by name\n (user.name && !user.name.empty?) ? user.name.downcase.split.values_at(-1, 0) : [''] \n }\n end\n @users\n end", "def users\n unless @users\n userListService = $viewContext.getViewService(OTUserListService.java_class)\n @users = userListService.getUserList().sort_by { |user| #sort users by name\n (user.name && !user.name.empty?) ? user.name.downcase.split.values_at(-1, 0) : [''] \n }\n end\n @users\n end", "def users\n\t\t\telems = []\n\t\t\tget_resource_link(:users, \"users\", \"user\").each do |data|\n\t\t\t\telems << data\n\t\t\t\t# elems << User.new(data)\n\t\t\tend\n\t\t\telems\n\t\tend", "def permitted_users_id\n\treturn_user_ids = Array.new\n\tif !self.venue_id.nil?\n\t return_user_ids = ActiveInVenue.where(venue_id: self.venue_id).where.not(user_id: self.user_id).map(&:user_id)\n end\n\tif self.allow_nearby\n\t\treturn_user_ids = return_user_ids | User.where.not(id: self.user_id).near([self.latitude, self.longitude], 25, units: :km).map(&:id)\n\tend\n\tblack_list = BlockUser.blocked_user_ids(self.user_id)\n \tcontent_black_list = ShoutReportHistory.where(reportable_id: self.id).where(reportable_type: 'Shout').map(&:reporter_id)\n \treturn_user_ids = return_user_ids - black_list - content_black_list\n\n \t# only user pusher for online users\n \tonline_users_ids = User.where(id: return_user_ids).where(pusher_private_online: true).map(&:id)\n \treturn online_users_ids\n end", "def users\n users = Set.new\n\n @channels.each do |channel|\n users.merge(channel.users)\n end\n\n users\n end", "def users\n User.where(network_id: context[:current_network]&.id)\n end", "def show_Users\n theUsers = User.select{ |user| user.group_id == self.id}\n theUsers\n end", "def white_listed\n @white_listed ||= []\n end", "def list_users\n self.class.get('/users')\n end", "def all\n result = Client.request(:get, 'users')\n\n if result.is_a?(Result::Success)\n result.body[:users].map { |data| User.new(data) }\n else\n []\n end\n end", "def list_all_users\n\n end", "def users_list\r\n @users_list = User.order_by_asc('name').find(:all, :conditions => [\"group_id <> ?\", Group.get_guest.id])\r\n if params[:users]\r\n @users_list = User.get_user_list params\r\n end\r\n end", "def risky_users\n return @risky_users\n end", "def lists\n load_user_lists\n end", "def getAllApprovedUsers()\n users = [] \n docs = @usersColl.find({ \"approval_status.code\" => 1 }, { :username => 1 })\n index = 0\n docs.each do |doc|\n users[index] = doc[:username]\n index += 1\n end # End of docs iteration\n return users\n end", "def banned_users\n @banned_users = Array.new\n User.all.each do |f|\n if(f.banned)\n @banned_users << {'banned_user' => User.find(f.id)}\n end\n end\n end", "def users\n users = []\n if current_user.lead?\n users = object.users.select { |u| u.id != current_user.id }\n users = users.unshift(current_user)\n elsif current_user.dev?\n vms_v = object.vms.select { |vm| vm.is_jenkins }\n users = vms_v.flat_map(&:user).uniq.select { |u| u.id != current_user.id }\n users = users.unshift(current_user)\n else\n users <<= current_user\n end\n users.map { |u| u.id }\n end", "def visible_users\n User.where.not(type: :AutotestUser)\n end", "def users\n return @users_array\n \tend", "def admins\n User.where(id: memberships.admin.pluck(:user_id)).all\n end", "def index\n @users_collections = Users::Collection.all\n end", "def my_users\n self.users + [self.user]\n end", "def users\n set_attributes_for(User)\n User.find(:all)\n end", "def apps_permissions_users_list\n return {} unless !skip_info? && is_app_token? && is_not_excluded?\n semaphore.synchronize {\n @apps_permissions_users_list_raw ||= access_token.get('/api/apps.permissions.users.list')\n @apps_permissions_users_list ||= @apps_permissions_users_list_raw.parsed['resources'].inject({}){|h,i| h[i['id']] = i; h}\n }\n end", "def index\n @users = User.find_all_with_authorization(current_user)\n end", "def users(list_id)\n Iterable.request(conf, '/lists/getUsers', listId: list_id).get\n end", "def all_users\n result = []\n api.search(accounts_dn, ::LDAP::LDAP_SCOPE_SUBTREE, accounts_filter) do |user|\n result << user.to_hash\n end\n result\n end", "def users\n Webmail::User.in(group_ids: id)\n end", "def get_all_users\n @users = []\n User.all.each do |user|\n @users << user.to_hash\n end\n end", "def show_users\n @users = User.all\n end", "def getAllOnlineUsers\n return false if !@usrData\n @usrData[login]\n end", "def all_users\n Skype.find_users_of_type \"ALL_USERS\"\n end", "def blocked_users\n Skype.find_users_of_type \"USERS_BLOCKED_BY_ME\"\n end", "def users(except_for = nil)\n return @users if except_for.nil?\n @users - [except_for]\n end", "def get_all_users\n @users = []\n results = User.all\n results.each do |user|\n @users << user.to_hash\n end\n end", "def user_whitelist\r\n return [:user_id, :first_name, :last_name, :email, :account_type, :password, :password_confirmation, :security_question_id, :security_question_answer]\r\n end", "def index\n @whitelist_followers = WhitelistFollower.all\n end", "def index\n return unless authenticated_admin?\n @users = User.all\n end", "def user_list\n @user=User.all\n end", "def users\n ::Syncano::QueryBuilder.new(self, ::Syncano::Resources::User)\n end", "def users\n self.class.get(\"/user\", @options).parsed_response[\"items\"]\n end", "def users\n get(:users)['Users'].map do |details|\n User.new(details['Url'], party: self, details: details)\n end\n end", "def get_all_users\n @users = []\n\n User.all.each do|user|\n @users << user.to_hash\n end\n end", "def users\n @users ||= Harvest::API::Users.new(credentials)\n end", "def users\n user_arr = []\n accounts.each do |s|\n user_arr << User.find(s.user.id)\n end\n user_arr\n end", "def users\n @attributes[:users]\n end", "def users\n signups.map do |signup|\n user_id = signup.user_id\n User.all.find {|user| user.id == user_id}\n end\n end", "def users()\n\t\t\t\tusers = UserList.new()\n\n if dscl?\n # The dscl version is still limited\n idlist = `#{DSCLBIN} . -list /Users UniqueID`\n grouplist = `#{DSCLBIN} . -list /Users PrimaryGroupID`\n idlist.each do | line |\n user = UserInfo.new()\n name,id = line.split\n user.username = name\n user.uid = id.to_i\n users[name] = user\n end\n else\n # get the list of users using niutil\n textlist = `niutil -list . /users`\n textlist.each() { |line|\n line.strip!()\n user = UserInfo.new()\n user.username = line[/^[0-9]+\\s+(\\S+)$/, 1]\n userlist = `niutil -read . /users/#{user.username}`\n userlist.each() { |subline|\n subline.strip!()\n case(subline)\n when(/^home:/)\n user.homedir = subline[/:\\s*(.*)$/, 1]\n when(/^uid:/)\n user.uid = subline[/:\\s*(.*)$/, 1].to_i()\n when(/^gid:/)\n user.gid = subline[/:\\s*(.*)$/, 1].to_i()\n when(/^realname:/)\n user.fullname = subline[/:\\s*(.*)$/, 1]\n end\n }\n users[user.username] = user\n }\n end\n\t\t\t\treturn(users)\n\t\t\tend", "def find_users\n if @dir.exist?\n return @dir.entries.each_with_object([]) do |entry, users|\n user_name = entry.basename\n user = User.new(user_name, self)\n if user.exist?\n users << user\n end\n end\n else\n return []\n end\n end", "def all_users\n `dscl . list /Users`.split(\"\\n\").delete_if { |e| e =~ /^_/ }\n end", "def users\n @users_by_href.values\n end", "def user_list(offset = 0, limit = 100)\n api.get('user', offset: offset, limit: limit)\n end", "def index\n @user_collections = UserCollection.all\n end", "def set_users\n @users = User.all.where(user_type: \"chw\")\n end", "def list_users\n http_get(:uri=>\"/users\", :fields=>x_cookie)\n end", "def users\n get('get_users')\n end", "def admins\n app_users.select(&:admin?)\n end", "def users\n users_array = []\n if serialization_options[:include_users] == true\n # NOTE: object here refers to the ActiveRecord model object. self refers to the serializer object itself.\n object.users.each do |user|\n # NOTE: You can pass serialization_options to serializable_hash.\n users_array << UserSerializer.new(user, {}).serializable_hash({})\n end\n end\n return users_array\n end", "def list_users\n r = execute(make_xml('UserListingRequest'))\n if r.success\n res = []\n r.res.elements.each('//UserSummary') do |user_summary|\n res << {\n :auth_source => user_summary.attributes['authSource'],\n :auth_module => user_summary.attributes['authModule'],\n :user_name => user_summary.attributes['userName'],\n :full_name => user_summary.attributes['fullName'],\n :email => user_summary.attributes['email'],\n :is_admin => user_summary.attributes['isAdmin'].to_s.chomp.eql?('1'),\n :is_disabled => user_summary.attributes['disabled'].to_s.chomp.eql?('1'),\n :site_count => user_summary.attributes['siteCount'],\n :group_count => user_summary.attributes['groupCount']\n }\n end\n res\n else\n false\n end\n end", "def users\n GroupMembers.new(:id => id).get.items\n end" ]
[ "0.682823", "0.67415094", "0.6709476", "0.669769", "0.6677032", "0.6606394", "0.65836114", "0.6573908", "0.6542157", "0.6536618", "0.65181386", "0.6490743", "0.64857095", "0.64775896", "0.64578116", "0.6447137", "0.6427343", "0.64268154", "0.6416052", "0.63747704", "0.6372644", "0.6369014", "0.634951", "0.634951", "0.6344847", "0.6335986", "0.6328741", "0.6317157", "0.63124245", "0.6302795", "0.6273925", "0.62485164", "0.62352383", "0.6215299", "0.62088555", "0.6184032", "0.6182139", "0.617712", "0.6158598", "0.6155358", "0.6149108", "0.6149108", "0.61437404", "0.61326134", "0.6131524", "0.6122656", "0.6116349", "0.61126035", "0.61119735", "0.61085147", "0.6102913", "0.60984737", "0.60928667", "0.60926086", "0.60906917", "0.60897696", "0.6088415", "0.60882205", "0.6067032", "0.6043716", "0.60426825", "0.6029817", "0.60234356", "0.6017938", "0.60087305", "0.60063684", "0.59978336", "0.5970727", "0.5969375", "0.59678775", "0.596646", "0.5964995", "0.59646297", "0.59621316", "0.5962006", "0.59572697", "0.59554446", "0.59549856", "0.59545434", "0.5953503", "0.5949364", "0.5945408", "0.5944982", "0.5941515", "0.59409916", "0.5939894", "0.59382564", "0.5925446", "0.59243065", "0.5923217", "0.5920046", "0.5918942", "0.5918117", "0.5899155", "0.5894216", "0.5892854", "0.5888242", "0.5887341", "0.5882505", "0.5878655" ]
0.7653604
0
Query method for Whitelist Users
def whitelist_users? self.whitelist_users.any? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def users_by_name # :norobots:\n if is_in_admin_mode?\n query = create_query(:User, :all, by: :name)\n show_selected_users(query)\n else\n flash_error(:permission_denied.t)\n redirect_to(action: \"list_rss_logs\")\n end\n end", "def users_by_name\n if in_admin_mode?\n query = create_query(:User, :all, by: :name)\n show_selected_users(query)\n else\n flash_error(:permission_denied.t)\n redirect_to(action: \"list_rss_logs\")\n end\n end", "def whitelist_users\n WhitelistUsers.new(@attributes.fetch('whitelist', {}))\n end", "def list_all_users\n\n end", "def query\n ::User.all\n end", "def users_list\r\n @users_list = User.order_by_asc('name').find(:all, :conditions => [\"group_id <> ?\", Group.get_guest.id])\r\n if params[:users]\r\n @users_list = User.get_user_list params\r\n end\r\n end", "def explore\n @users = User.where(\"username LIKE ?\", \"\")\n end", "def load_whitelist\n query = \"select peer_id from users\"\n end", "def get_whitelist\n return FavouriteGroup.find(:first, :conditions => { :user_id => self.id, :name => FavouriteGroup::WHITELIST_NAME } )\n end", "def get_users(request); end", "def user_whitelist\r\n return [:user_id, :first_name, :last_name, :email, :account_type, :password, :password_confirmation, :security_question_id, :security_question_answer]\r\n end", "def list\n @all_users = User.find(:all)\n end", "def visible_users\n User.where.not(type: :AutotestUser)\n end", "def list\n\t\t# retrieve all users\n @users = User.find(:all)\n end", "def user_search\n @users = User.admin_search(params[:query])\n end", "def users\n \n @users = User.where(:enabled => true)\n @users = @users.where(:role => params[:role].upcase) if params[:role]\n @users = @users.where(:id => params[:id]) if params[:id]\n respond_to do |format|\n format.xml { render :xml => @users.to_xml }\n end\n \n end", "def users_permitted_to( priv, obj )\n User.where(\"id in (#{users_permitted_sql( priv, obj )})\").to_a\n end", "def get_users\n\t\t\t@users = User.all.where(:on_beverage_list => true).order('firstname, lastname')\n\t\tend", "def index\n @users = User.find_all_with_authorization(current_user)\n end", "def index\n authorize Admin\n @admins = User.find_by_sql([\"select * from users where role = ?\",2])\n end", "def possible_users\n ids = []\n ids = condition.scan(/\\d+/) if condition.present?\n User.where(:id => ids)\n end", "def user_query(list)\n\t\treturn nil if !list\n\n\t\tif !list.kind_of?(Array)\n\t\t\ttmp = list\n\t\t\tlist = Array.new\n\t\t\tlist << tmp\n\t\tend\n\n\t\treturn nil if list.empty?\n\n\t\tActiveRecord::Base.silence_auto_explain do\n\t \t# no automatic EXPLAIN is triggered here\n\t\t\treturn SitrackTracking.find_by_sql(\n\t\t\t\t'SELECT p.accountNo, p.firstName, p.lastName, p.preferredName, s.email, s.mobilePhone, s.homePhone, s.otherPhone ' +\n\t\t\t\t'FROM ministry_person AS p ' +\n\t\t\t\t'LEFT JOIN ministry_staff AS s ON p.personID = s.person_id ' +\n\t\t\t\t\"WHERE p.accountNo IN (#{list.map{|u| \"'#{u}'\"}.join(',')})\"\n\t\t\t\t)\n\t\tend\n\tend", "def list_users\n @users = User.find(:all)\n end", "def list(garbage, start)\n @all_user = session_user.agency.users\n @start = start.to_i || 0\n @limit = request.params[\"limit\"] || UserListingLength\n @user = @all_user[@start .. (@start+@limit)-1] # FIXME: Do it with sequel!\n @uparted = @user.partition{|u| @user.index(u) % 2 == 0 }\n end", "def search_users\n unless @current_admin.is_super_admin\n unless @current_admin.privilages.include? '1'\n flash[:authority_error]=\"You are not authorized to navigate to this page \"\n redirect_to admin_index_path\n empty_user_id\n return\n end\n end\n empty_user_id\n @check=0\n @searched_user=User.new\n end", "def list\n @search = {}\n @search[:editor] = true if filter_params[:editor] == '1'\n @search[:admin] = true if filter_params[:admin] == '1'\n @text = ['username ilike :text', text: \"%#{filter_params[:text]}%\"] if filter_params[:text].present?\n @pagy, @users = pagy(User.where(@search).where(@text))\n end", "def list_users\n self.class.get('/users')\n end", "def find_all_usernames\n execute_sql(:read, :user) do\n table.select(:username).map do |row|\n row[:username]\n end\n end\n end", "def user_list(user)\n List.find_by(restaurant: self, user: user)\n end", "def filter_users\n allowed_keys=[\"email\", \"admin\"]\n filtering_keys=allowed_keys & params.keys\n filtering_keys.each {|key| filter_by_key(key)}\n end", "def users\n gateway_check\n @users\n end", "def searchUsers\n # if current_user.rolable.class.name == \"Charity\"\n # return User.where.not(rolable_type: 'Business')\n # # list_a = User.where(rolable_type: 'Business').order(:rolable_id).pluck(:id, :rolable_id)\n # # search_list = Business.order(:id).pluck(:id, :name)\n\n # # search_list.each_with_index do |x, index|\n # # x[0] = list_a[index][0]\n # # end\n # # sea\n # # search_list = Business.where(active: true).pluck(:name)\n # # search_list.each do |b|\n # # list << b.name\n # # current_user\n # elsif current_user.rolable.class.name == \"Business\"\n # return User.where(rolable_type: 'Charity')\n # # list_a = User.where(rolable_type: 'Charity').order(:rolable_id).pluck(:id, :rolable_id)\n # # search_list = Charity.order(:id).pluck(:id, :name)\n # # search_list.each_with_index do |x, index|\n # # x[0] = list_a[index][0]\n # # end\n # # # search_list.each do |c|\n # # # list << c.name\n # # # end\n # end\n return User.where.not(rolable_type: 'Donor')\n end", "def permitted_users_id\n\treturn_user_ids = Array.new\n\tif !self.venue_id.nil?\n\t return_user_ids = ActiveInVenue.where(venue_id: self.venue_id).where.not(user_id: self.user_id).map(&:user_id)\n end\n\tif self.allow_nearby\n\t\treturn_user_ids = return_user_ids | User.where.not(id: self.user_id).near([self.latitude, self.longitude], 25, units: :km).map(&:id)\n\tend\n\tblack_list = BlockUser.blocked_user_ids(self.user_id)\n \tcontent_black_list = ShoutReportHistory.where(reportable_id: self.id).where(reportable_type: 'Shout').map(&:reporter_id)\n \treturn_user_ids = return_user_ids - black_list - content_black_list\n\n \t# only user pusher for online users\n \tonline_users_ids = User.where(id: return_user_ids).where(pusher_private_online: true).map(&:id)\n \treturn online_users_ids\n end", "def users\n gateway_check\n unavailable_servers_check\n @users\n end", "def index\n #@users = User.all\n if current_user && current_user.role == 'Admin'\n if params[:c]\n @users = User.where(\"name LIKE '%#{params[:c]}%'\").select(\"distinct users.* \")\n else\n q = params[:q] ? \"name LIKE '%#{params[:q]}%'\" : \"\"\n @users = User.where(q).order(:created_at).reverse\n end\n else\n redirect_to '/'\n end\n end", "def user_list\n @user=User.all\n end", "def getUserList\n @userList\n end", "def index\n @users = policy_scope(User)\n .includes(:avatar, :main, :rank)\n .order(created_at: :desc)\n .page(params[:page])\n\n @users = @users.where(hidden: false) unless params[:hidden]\n\n authorize @users\n end", "def index\n\t\t@users = User.paginate(:page => params[:page], :per_page => 5)\n\t\tauthorize @users\n\tend", "def admin\n @userList = User.all\n end", "def search\n @users ||= User.search_user(params[:search])\n authorize! :read, @user\n end", "def list_users(query = {})\n aws_service_client.list_users(query)\n end", "def show_users\n @users = User.where(store: false, admin: false)\n end", "def users_permitted_to( priv )\n sql = self.class.users_permitted_sql( priv, self )\n User.where(\"id in (#{sql})\")\n end", "def index\n @users = User.all\n authorize @users\n end", "def index\n @users = User.select{ |_| can? :read, _ }\n end", "def users\n User.where(network_id: context[:current_network]&.id)\n end", "def index_user # :nologin: :norobots:\n if is_in_admin_mode? || find_query(:User)\n query = find_or_create_query(:User, by: params[:by])\n show_selected_users(query, id: params[:id].to_s, always_index: true)\n else\n flash_error(:runtime_search_has_expired.t)\n redirect_to(action: \"list_rss_logs\")\n end\n end", "def users(*params)\n puts \"Users:\"\n\n @users.each do |user|\n muted = @muted_users.include?(user)\n puts \"#{user}#{muted ? ' (muted)' : ''}\"\n end\n end", "def index\n # authorize! :index, @user, :message => 'Not authorized as an administrator.'\n @users = User.all\n end", "def users(*params)\n puts \"Users:\"\n @users.each do |user|\n muted = @muted_users.include?(user)\n puts \"#{user}#{muted ? \" (muted)\" : \"\"}\"\n end\n end", "def get_user_info(list)\n\trequire 'net/http'\n\tNet::HTTP.get(ENV[\"VERITAS-USER-SERVER\"] + \"/users?user_ids=#{list}\")\nend", "def getAllOnlineUsers\n return false if !@usrData\n @usrData[login]\n end", "def list_current_users *args\r\n puts \"not implemented yet\"\r\n end", "def list_user(param = '1110')\n @group_users.each { |item| puts item.info(param) }\n end", "def user_keys\n self.whitelists.map{|whitelist| whitelist.user_key}.uniq\n end", "def list\n get('users')['users']\n end", "def new_list_users\n\n end", "def blocked_users\n Skype.find_users_of_type \"USERS_BLOCKED_BY_ME\"\n end", "def searchUsers(word)\n @cuid = isSignedIn ? current_user.id : nil\n @w = word.downcase()\n @usUnf = User.all # users unfiltered\n @us = []\n @usUnf.each do |u|\n @friendOrAdmin = areFriends(@cuid, u.id) || ((@cuid != nil) ? (User.find_by(id: @cuid).admin == true) : false)\n if u.username.downcase().include?(@w) || \n (@friendOrAdmin ? \n ((u.fname != nil) ? u.fname.downcase().include?(@w) : false) || \n ((u.lname != nil) ? u.lname.downcase().include?(@w) : false)\n : false)\n @us.push(u)\n end\n end\n return @us\n end", "def index\n\t\t\n\t\t# @admins=User.where(admin: true)\n\t #Only show users that aren't admin(only the community are shown)\n\t @users = User.where(admin: false).order(\"first_name ASC\")\n\n\t if params[:search_user].present?\t\n\t \t#Storing user with capital letter on first letter of name and rest downcase.\n\n user_search= params[:search_user].downcase.split(\" \")\n \t\n @users= @users.where(\"first_name ILIKE ? OR last_name ILIKE ? OR last_name ILIKE ?\", \"#{user_search[0]}\", \"#{user_search[1]}\",\"#{user_search[0]}\")\n \n end\n end", "def query_users(options = nil)\n policy = create_policy(options, AdminPolicy, default_admin_policy)\n command = AdminCommand.new\n command.query_users(@cluster, policy)\n end", "def index\n @whitelist_followers = WhitelistFollower.all\n end", "def list_users\n \t#p params[:search]\n \tif params[:search].nil?\n \t\t@users= User.all\n \telse\n \t\t@users= User.search_users(params)#this function from model\n \tend\n end", "def list_users\n tp @users, :real_name, :slack_id, :user_name => {:display_method => :name}\n end", "def list_users_for_all_tenants(args = {}) \n get(\"/users.json/global\", args)\nend", "def list_users_for_all_tenants(args = {}) \n get(\"/users.json/global\", args)\nend", "def show \n available_users\n end", "def user_list(offset = 0, limit = 100)\n api.get('user', offset: offset, limit: limit)\n end", "def index\n return permission_denied unless \\\n (params[:id].to_s == @current_user.id.to_s) || \n (params[:email].to_s == @current_user.email.to_s)\n\n @users = User.where(params.permit(:id, :email))\n\n if @users\n render status: :ok,\n json: @users.as_json\n else\n render status: :not_found,\n json: {\n error: \"Users not found\"\n }\n end\n end", "def admins\n User.where(id: memberships.admin.pluck(:user_id)).all\n end", "def list_user_names(iam)\r\n list_users_response = iam.list_users\r\n list_users_response.users.each do |user|\r\n puts user.user_name\r\n end\r\nend", "def get_users_list\n service_response = AdminManagement::Users::UserList.new(params).perform\n render_api_response(service_response)\n end", "def users\n ::Syncano::QueryBuilder.new(self, ::Syncano::Resources::User)\n end", "def admin(user_id)\n return [db.execute(\"SELECT * FROM users WHERE user_id=?\", user_id), db.execute(\"SELECT * FROM users\")]\nend", "def users\n Ecore::User.where(\"group_ids LIKE '%#{id}%'\").all\n end", "def index\n @users = policy_scope(User)\n end", "def list(filter=KalturaNotImplemented, pager=KalturaNotImplemented)\n\t\t\tkparams = {}\n\t\t\t# A filter used to exclude specific types of users\n\t\t\tclient.add_param(kparams, 'filter', filter);\n\t\t\t# A limit for the number of records to display on a page\n\t\t\tclient.add_param(kparams, 'pager', pager);\n\t\t\tclient.queue_service_action_call('user', 'list', kparams);\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil;\n\t\t\tend\n\t\t\treturn client.do_queue();\n\t\tend", "def list_users(workspace)\n puts \"\\nUser List\\n\\n\"\n tp workspace.users, \"id\", \"name\", \"real_name\", \"status_text\", \"status_emoji\"\nend", "def index\n unless params[:display_name]\n redirect_to admin_dashboard_path, notice: 'Please enter a user display name.'\n end\n\n @users = User.where(display_name: params[:display_name])\n end", "def worlize_friends\n User.where(:guid => self.worlize_friend_guids)\n end", "def list\n flash[:notice] = \"Het volg-systeem is neergestort als een mir. Iedereen volgt gewoon iedereen. Wel zo communistisch en makkelijk\";\n @user = User.find(:all)\n end", "def list_users?\n user.present? && user.admin?\n end", "def listing\n @user = User.all\n unless current_user.admin?\n redirect_to dashboard_show_path\n end \n end", "def research_individual\n @users = Array.new()\n User.all.each do |u|\n if !u.admin?\n @users.push(u)\n end\n end\n end", "def index\n\n #hide shadowbanned users for non admins\n if current_user && current_user.is_admin?\n @users = User.where.not(id: User.get_default_user.id).paginate(page: params[:page], per_page: 50)\n else\n shadowbanned_ids = []\n shadowbanned_ids << User.get_default_user.id\n User.all.each do |userr|\n if userr.shadowbanned?\n shadowbanned_ids << userr.id\n end\n end \n @users = User.where.not(id: shadowbanned_ids).paginate(page: params[:page], per_page: 50)\n end\n \n respond_to do |format|\n format.html\n format.json\n format.json_api { render(json: @users, links: { self: users_path }) }\n end\n end", "def users_eligible_for_cc_list\n User.find(:all, :conditions => 'active=1',:order => 'last_name') -\n Role.find_by_name('HCL Manager').active_users -\n Role.find_by_name('Manager').active_users -\n Role.find_by_name('ECO Admin').active_users -\n Role.lcr_designers -\n self.users\n end", "def grants_individual\n @users = Array.new()\n User.all.each do |u|\n if !u.admin?\n @users.push(u)\n end\n end\n end", "def all_users\n query = users.to_sql + \"\\nUNION\\n\" + User.where(id: super_admin_id).to_sql\n User.find_by_sql(query)\n end", "def index\n @users = GuestUsers::User.where(host: current_user) || []\n end", "def all\n @users = User.order(\"name\").where.not(:role => 0).page(params[:page]).per(1)\n end", "def visible_users\n is_superadmin? ? User.all : title.users\n end", "def users(filter = {})\n handler[:people].filter(filter)\n end", "def index\n @users = policy_scope(User).page(params.fetch(:page, 1)).per(params.fetch(:per, 25))\n end", "def index\n authorize User\n\n @users = !!params[:search] ? User.search_includes(params[:search]) : User.all_includes\n\n @users = User.filter_with(@users, params[:filter]) if !!params[:filter]\n\n @users = User.sort_num_desc(@users, params[:sort_by]) if !!params[:sort_by]\n end", "def related_users_query(list_id)\n <<-SQL\n SELECT DISTINCT \"users\".*\n FROM \"users\"\n INNER JOIN \"users_lists\"\n ON \"users\".\"id\" = \"users_lists\".\"user_id\"\n WHERE \"users_lists\".\"list_id\" IN (\n SELECT \"lists\".\"id\"\n FROM \"lists\"\n INNER JOIN \"users_lists\"\n ON \"lists\".\"id\" = \"users_lists\".\"list_id\"\n WHERE \"users_lists\".\"user_id\" = #{id}\n )\n AND NOT \"users\".\"id\" IN (\n SELECT \"users_lists\".\"user_id\"\n FROM \"users_lists\"\n WHERE \"users_lists\".\"list_id\" = #{list_id}\n );\n SQL\n end", "def list_users(page, filter = nil)\n return unless filter.nil? || filter.valid?\n\n user_values = User.all(self).values\n users = user_values.select { |u| filter.include?(u) } unless filter.nil?\n users_filtered, pagination_collection = Pagination.paginate_record(users, page, 10)\n [users_filtered, pagination_collection]\n end", "def index\n #authorize(User.new)\n @users = User.all #policy_scope(User)\n end", "def active_users\n return User.find_by_sql(\"SELECT users.* from users inner join roles_users ru on users.id=ru.user_id\n INNER JOIN roles r on ru.role_id=r.id\n WHERE users.activo=true AND r.name='#{self.name}'\")\n end", "def admin\n @admin_users = User.where(isAdmin:true).where(isApproved:true).paginate(:page => params[:admin_users_page], :per_page => 10)\n end" ]
[ "0.68652636", "0.68292683", "0.67734873", "0.67207664", "0.65663326", "0.6551462", "0.6504705", "0.6501677", "0.64822584", "0.6419143", "0.63757586", "0.6364806", "0.6333981", "0.6321455", "0.6303495", "0.62948185", "0.6293664", "0.62763095", "0.62755", "0.6229366", "0.62248325", "0.6223643", "0.6212256", "0.62029845", "0.6201572", "0.61966395", "0.6185382", "0.61811", "0.6172139", "0.61635244", "0.6160901", "0.6153859", "0.6149253", "0.6143116", "0.614237", "0.6127228", "0.612229", "0.6121064", "0.6120949", "0.61074686", "0.61004615", "0.608846", "0.6086395", "0.60860825", "0.60850513", "0.60731643", "0.6068618", "0.60674804", "0.60518074", "0.6051038", "0.6051032", "0.604175", "0.60412467", "0.6037415", "0.60327584", "0.60309726", "0.6026041", "0.60258573", "0.6019406", "0.601403", "0.600839", "0.59963816", "0.59962326", "0.59925765", "0.59910506", "0.59881604", "0.59881604", "0.59879285", "0.5987834", "0.5981774", "0.59736586", "0.5969242", "0.5967099", "0.59632015", "0.5962416", "0.5949706", "0.59496874", "0.5944993", "0.593995", "0.5932662", "0.59249395", "0.5924683", "0.59241945", "0.5920518", "0.59200984", "0.59192497", "0.5919221", "0.591607", "0.59146005", "0.59118474", "0.5910763", "0.5900617", "0.58965874", "0.5896249", "0.58957356", "0.5894835", "0.5890771", "0.5889037", "0.5888107", "0.58826226" ]
0.61839944
27
Returns the proxy port used
def proxyport @attributes.fetch('proxyport', 0) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def proxy_port\n proxy? ? @options['proxy_port'].to_i : nil\n end", "def proxyport\n config[\"proxyport\"]\n end", "def proxy_port; end", "def port\n return @forwarded_port || @port\n end", "def proxy_port\n ENV[\"CHEF_API_PROXY_PORT\"] || config[\"CHEF_API_PROXY_PORT\"]\n end", "def server_port\n AgileProxy.config.server_port\n end", "def webserver_port\n AgileProxy.config.webserver_port\n end", "def getPort()\n return @uri.port\n end", "def port\n @port ||= target.split(':',2).last.to_i\n end", "def port\n return @port.to_i\n end", "def port\n if @port == DEFAULT_HTTP_PORT\n DEFAULT_SSL_PORT\n else\n @port\n end\n end", "def port\n @port ||= use_ssl ? 636 : 389\n end", "def port\n unless defined?(@port)\n @port = solr_url.port if solr_url\n @port ||= user_configuration_from_key('solr', 'port')\n @port ||= default_port\n @port = @port.to_i\n end\n @port\n end", "def port\n request.port\n end", "def proxyport=(value)\n Curl.set_option(:proxyport, value_for(value, :int), handle)\n end", "def port\n @port || (secure ? 443 : 80)\n end", "def port\n @port ||= opts.fetch(:port, parsed_uri.port)\n end", "def port\n get_value :port\n end", "def local_port\n get('beef.http.port') || '3000'\n end", "def port\n @hash[\"Listen\"].to_i\n end", "def port\n @connection.port\n end", "def remote_port\n return @remote_port\n end", "def port\n @uri.port\n end", "def find_http_proxy\n ret = [nil, nil]\n\n # check the platform. If we're running in windows then we need to \n # check the registry\n if @opt['use_proxy'] || @opt['proxy_url']\n if @opt['proxy_url'] && @opt['proxy_url'].size > 0\n uri = parse_url(@opt['proxy_url'], 'proxy URL')\n ret = [uri.host, uri.port]\n elsif RUBY_PLATFORM =~ /win32/i\n # Find a proxy in Windows by checking the registry.\n # this code shamelessly copied from Raggle :D\n\n require 'win32/registry'\n\n Win32::Registry::open(\n Win32::Registry::HKEY_CURRENT_USER,\n 'Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings'\n ) do |reg|\n # check and see if proxy is enabled\n if reg.read('ProxyEnable')[1] != 0\n # get server, port, and no_proxy (overrides)\n server = reg.read('ProxyServer')[1]\n np = reg.read('ProxyOverride')[1]\n\n server =~ /^([^:]+):(.+)$/\n ret = [$1, $2]\n\n # don't bother with no_proxy support\n # ret['no_proxy'] = np.gsub(/;/, ',') if np && np.length > 0\n end\n end\n else\n # handle UNIX systems\n PROXY_ENV_VARS.each do |env_var|\n if ENV[env_var]\n # if we found a proxy, then parse it\n ret = ENV[env_var].sub(/^http:\\/\\/([^\\/]+)\\/?$/, '\\1').split(':')\n ret[1] = ret[1].to_i if ret[1]\n break\n end\n end\n # $stderr.puts \"DEBUG: http_proxy = #{ENV['http_proxy']}, ret = [#{ret.join(',')}]\"\n end\n else \n # proxy is disabled\n ret = [nil, nil]\n end\n\n # return host and port\n ret\n end", "def port\n configuration.port\n end", "def port\n configuration.port\n end", "def get_defined_proxy\n prime_proxy = ENV.select { |k,v| v if k =~ /http_proxy/i }.first\n if prime_proxy.nil?\n prime_proxy = ENV.select { |k,v| v if k =~ /all_proxy/i }.first\n end\n return nil if prime_proxy.nil?\n\n URI.parse(prime_proxy[1])\n end", "def port\n @socket.connect_address.ip_port\n rescue SocketError\n # Not bound to any local port\n rescue IOError\n # Socket has been closed\n end", "def port\n 7779\n end", "def port\n 20000 + ($$ % 40000)\n end", "def port\n conf['api']['port'].to_s\n end", "def getproxy\n proxy = (ENV['HTTP_PROXY'] == nil)? ENV['http_proxy'] : ENV['HTTP_PROXY']\n return proxy\n end", "def port\n connect_address.ip_port\n rescue SocketError\n # Not bound to any local port\n rescue IOError\n # Socket has been closed\n end", "def proxy_address\n proxy? ? @options['proxy_address'] || '127.0.0.1' : nil\n end", "def port\n raise \"Http-server not spawned yet. Call Hayabusa#start to spawn it.\" if !@httpserv\n return @httpserv.server.addr[1]\n end", "def getproxy\n proxy = (ENV['HTTP_PROXY'] == nil)? ENV['http_proxy'] : ENV['HTTP_PROXY']\n return proxy\n end", "def actual_port; end", "def actual_port; end", "def http_port\n use_ssl? ? 443 : 80\n end", "def port\n @manager.primary_pool.port\n end", "def find_http_proxy\n ret = [nil, nil]\n\n # check the platform. If we're running in windows then we need to \n # check the registry\n if @use_proxy\n if RUBY_PLATFORM =~ /win32/i\n # Find a proxy in Windows by checking the registry.\n # this code shamelessly copied from Raggle :D\n\n require 'win32/registry'\n\n Win32::Registry::open(\n Win32::Registry::HKEY_CURRENT_USER,\n 'Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings'\n ) do |reg|\n # check and see if proxy is enabled\n if reg.read('ProxyEnable')[1] != 0\n # get server, port, and no_proxy (overrides)\n server = reg.read('ProxyServer')[1]\n np = reg.read('ProxyOverride')[1]\n\n server =~ /^([^:]+):(.+)$/\n ret = [$1, $2]\n\n # don't bother with no_proxy support\n # ret['no_proxy'] = np.gsub(/;/, ',') if np && np.length > 0\n end\n end\n else\n # handle UNIX systems\n PROXY_ENV_VARS.each do |env_var|\n if ENV[env_var]\n # if we found a proxy, then parse it\n ret = ENV[env_var].sub(/^http:\\/\\/([^\\/]+)\\/?$/, '\\1').split(':')\n ret[1] = ret[1].to_i if ret[1]\n break\n end\n end\n # $stderr.puts \"DEBUG: http_proxy = #{ENV['http_proxy']}, ret = [#{ret.join(',')}]\"\n end\n else \n # proxy is disabled\n ret = [nil, nil]\n end\n\n # return host and port\n ret\n end", "def port\n @port ||=\n if user_configuration.has_key?('solr')\n user_configuration['solr']['port']\n end || 8983\n end", "def socket_port; end", "def port\n @request_spec_server.port\n end", "def port\n conf['port'] || '80'\n end", "def port\n @port\n end", "def port\n @port\n end", "def port\n @port\n end", "def getPort()\n return @port\n\tend", "def proxy_addr; end", "def proxyaddress\n config[\"proxyaddress\"]\n end", "def port\n return @port if @port\n\n @server = TCPServer.new('127.0.0.1', 0)\n @port = @server.addr[1].to_i\n @server.close\n\n return @port\n end", "def port\n @options[:port]\n end", "def port\n self.port\n end", "def port\n ssl ? 443 : 80\n end", "def port\n options.fetch(:port, \"8080\").to_s\n end", "def port\n data[:port]\n end", "def true_port\r\n port = servlet_response.getLocalPort\r\n $log.debug(\"True port is #{port}\")\r\n port\r\n end", "def server_port; end", "def getproxyuri\n proxy = self.getproxy\n proxy_uri = (proxy != nil )? URI.parse(proxy) : nil\n return proxy_uri\n end", "def base_port\n (options[:port] || env[\"PORT\"] || ENV[\"PORT\"] || 5000).to_i\n end", "def local_port\n return @local_port\n end", "def server_port ; @env['SERVER_PORT' ].to_i ; end", "def http_proxy_uri\n @tools.http_proxy_url\n end", "def port\n nodes[0][1].to_i\n end", "def client_port\n host_settings['client_port']\nend", "def public_port\n return get('beef.http.public.port') unless get('beef.http.public.port').nil?\n\n return '443' if public_https_enabled?\n return '80' unless public_host.nil?\n\n nil\n end", "def proxy_uri\n @proxy_uri ||= URI.parse(config(\"proxy-uri\"))\n end", "def getproxyuri\n proxy = self.getproxy\n proxy_uri = (proxy != nil )? URI.parse(proxy) : nil\n return proxy_uri\n end", "def port\n @port || 161\n end", "def proxy?\n @options.has_key?('proxy_port')\n end", "def port; end", "def port; end", "def port; end", "def port; end", "def port; end", "def port; end", "def port; end", "def port; end", "def obtain_port\n server = TCPServer.new(\"127.0.0.1\", 0)\n port = server.addr[1]\n server.close\n port\n end", "def port\n ENV.fetch('PORT', 8983)\n end", "def tunnel_port\n super\n end", "def proxy\n ENV['BETTERY_PROXY']\n end", "def port\n conf['dashboard']['port'].to_s\n end", "def default_port\n if secure?\n 443\n else\n 80\n end\n end", "def default_port\n if secure?\n 443\n else\n 80\n end\n end", "def default_port\n case scheme\n when 'http' then 80\n when 'https' then 443\n end\n end", "def port(opts={})\n # Check if port was specified in options hash\n pnum = opts[:port]\n return pnum if pnum\n\n # Check if we have an SSH forwarded port\n pnum = nil\n env.vm.vm.network_adapters.each do |na|\n pnum = na.nat_driver.forwarded_ports.detect do |fp|\n fp.name == env.config.ssh.forwarded_port_key\n end\n\n break if pnum\n end\n\n return pnum.hostport if pnum\n\n # This should NEVER happen.\n raise Errors::SSHPortNotDetected\n end", "def port; config[:port]; end", "def get_open_port\n socket = Socket.new(:INET, :STREAM, 0)\n socket.bind(Addrinfo.tcp(\"127.0.0.1\", 0))\n port = socket.local_address.ip_port\n socket.close\n port\n end", "def port\n p = attributes['port'].to_i\n (p == 0 ? nil : p)\n end", "def default_port\n data.default_port\n end", "def listening_port\n @dbi.endpoint.port\n end", "def listening_port\n @dbi.endpoint.port\n end", "def port\n end", "def port_string\n (protocol == 'http://' && port == 80) || (protocol == 'https://' && port == 443) ? '' : \":#{port}\"\n end", "def port\n @attributes[:port]\n end", "def proxy\n ENV['HYPERKIT_PROXY']\n end", "def default_port\n transport.default_port\n end", "def proxy\n ENV['RANCHER_PROXY']\n end" ]
[ "0.86089253", "0.8600521", "0.8303187", "0.7876044", "0.78747964", "0.7765817", "0.7693235", "0.7467699", "0.7377824", "0.73467517", "0.72186893", "0.72100395", "0.7141232", "0.713795", "0.707537", "0.7060432", "0.7047115", "0.7039476", "0.70242447", "0.699499", "0.69777703", "0.69705766", "0.6945724", "0.69435036", "0.69258237", "0.69258237", "0.691411", "0.6902182", "0.68639845", "0.6848756", "0.68417495", "0.683825", "0.68225807", "0.6812585", "0.68107665", "0.679694", "0.67903465", "0.67903465", "0.67811465", "0.67420805", "0.6730136", "0.6727593", "0.67242163", "0.6713347", "0.6670871", "0.66707885", "0.66707885", "0.66707885", "0.66644317", "0.66588247", "0.66584635", "0.6639542", "0.66353714", "0.6602297", "0.6601475", "0.66010803", "0.65839165", "0.65524626", "0.6526879", "0.6511934", "0.6511258", "0.6510343", "0.6481775", "0.6465947", "0.6463434", "0.6450269", "0.643993", "0.6429134", "0.64250344", "0.64247674", "0.6424517", "0.64177144", "0.64177144", "0.64177144", "0.64177144", "0.64177144", "0.64177144", "0.64177144", "0.64177144", "0.6399698", "0.6397258", "0.63936526", "0.63848656", "0.637963", "0.63410074", "0.63410074", "0.6304042", "0.62996846", "0.6298476", "0.62917256", "0.6283551", "0.62745166", "0.6272953", "0.6272953", "0.6261956", "0.6260108", "0.6259208", "0.6257156", "0.6231403", "0.61764437" ]
0.85889125
2
Returns the proxy address used
def proxyaddress @attributes.fetch('proxyaddress', 'none') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def proxy_addr; end", "def proxyaddress\n config[\"proxyaddress\"]\n end", "def proxy_address\n proxy? ? @options['proxy_address'] || '127.0.0.1' : nil\n end", "def getproxyuri\n proxy = self.getproxy\n proxy_uri = (proxy != nil )? URI.parse(proxy) : nil\n return proxy_uri\n end", "def getproxyuri\n proxy = self.getproxy\n proxy_uri = (proxy != nil )? URI.parse(proxy) : nil\n return proxy_uri\n end", "def get_defined_proxy\n prime_proxy = ENV.select { |k,v| v if k =~ /http_proxy/i }.first\n if prime_proxy.nil?\n prime_proxy = ENV.select { |k,v| v if k =~ /all_proxy/i }.first\n end\n return nil if prime_proxy.nil?\n\n URI.parse(prime_proxy[1])\n end", "def http_proxy_uri\n @tools.http_proxy_url\n end", "def proxy_uri\n @proxy_uri ||= URI.parse(config(\"proxy-uri\"))\n end", "def getproxy\n proxy = (ENV['HTTP_PROXY'] == nil)? ENV['http_proxy'] : ENV['HTTP_PROXY']\n return proxy\n end", "def get_public_ip_address\n get_proxy.get_public_ip_address\n end", "def getproxy\n proxy = (ENV['HTTP_PROXY'] == nil)? ENV['http_proxy'] : ENV['HTTP_PROXY']\n return proxy\n end", "def proxy_address\n ENV[\"CHEF_API_PROXY_ADDRESS\"] || config[\"CHEF_API_PROXY_ADDRESS\"]\n end", "def proxy\n ENV['BETTERY_PROXY']\n end", "def proxy_uri; end", "def proxy_uri; end", "def proxy\n\t\t\tself.options[:proxy]\n\t\tend", "def spice_proxy_url\n service = core_client.get_service('spice-proxy', @namespace)\n host = service.spec.externalIPs.first\n port = service.spec.ports.first.port\n url = URI::Generic.build(\n scheme: 'http',\n host: host,\n port: port,\n )\n url.to_s\n end", "def proxy_port; end", "def proxyport\n config[\"proxyport\"]\n end", "def proxy_url\n URI.join(cas_url, 'proxy').to_s\n end", "def proxy_url\n URI.join(cas_url, 'proxy').to_s\n end", "def proxy\n @proxy\n end", "def proxy\n ENV['RANCHER_PROXY']\n end", "def find_http_proxy\n ret = [nil, nil]\n\n # check the platform. If we're running in windows then we need to \n # check the registry\n if @opt['use_proxy'] || @opt['proxy_url']\n if @opt['proxy_url'] && @opt['proxy_url'].size > 0\n uri = parse_url(@opt['proxy_url'], 'proxy URL')\n ret = [uri.host, uri.port]\n elsif RUBY_PLATFORM =~ /win32/i\n # Find a proxy in Windows by checking the registry.\n # this code shamelessly copied from Raggle :D\n\n require 'win32/registry'\n\n Win32::Registry::open(\n Win32::Registry::HKEY_CURRENT_USER,\n 'Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings'\n ) do |reg|\n # check and see if proxy is enabled\n if reg.read('ProxyEnable')[1] != 0\n # get server, port, and no_proxy (overrides)\n server = reg.read('ProxyServer')[1]\n np = reg.read('ProxyOverride')[1]\n\n server =~ /^([^:]+):(.+)$/\n ret = [$1, $2]\n\n # don't bother with no_proxy support\n # ret['no_proxy'] = np.gsub(/;/, ',') if np && np.length > 0\n end\n end\n else\n # handle UNIX systems\n PROXY_ENV_VARS.each do |env_var|\n if ENV[env_var]\n # if we found a proxy, then parse it\n ret = ENV[env_var].sub(/^http:\\/\\/([^\\/]+)\\/?$/, '\\1').split(':')\n ret[1] = ret[1].to_i if ret[1]\n break\n end\n end\n # $stderr.puts \"DEBUG: http_proxy = #{ENV['http_proxy']}, ret = [#{ret.join(',')}]\"\n end\n else \n # proxy is disabled\n ret = [nil, nil]\n end\n\n # return host and port\n ret\n end", "def proxy\n ENV['HYPERKIT_PROXY']\n end", "def find_http_proxy\n ret = [nil, nil]\n\n # check the platform. If we're running in windows then we need to \n # check the registry\n if @use_proxy\n if RUBY_PLATFORM =~ /win32/i\n # Find a proxy in Windows by checking the registry.\n # this code shamelessly copied from Raggle :D\n\n require 'win32/registry'\n\n Win32::Registry::open(\n Win32::Registry::HKEY_CURRENT_USER,\n 'Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings'\n ) do |reg|\n # check and see if proxy is enabled\n if reg.read('ProxyEnable')[1] != 0\n # get server, port, and no_proxy (overrides)\n server = reg.read('ProxyServer')[1]\n np = reg.read('ProxyOverride')[1]\n\n server =~ /^([^:]+):(.+)$/\n ret = [$1, $2]\n\n # don't bother with no_proxy support\n # ret['no_proxy'] = np.gsub(/;/, ',') if np && np.length > 0\n end\n end\n else\n # handle UNIX systems\n PROXY_ENV_VARS.each do |env_var|\n if ENV[env_var]\n # if we found a proxy, then parse it\n ret = ENV[env_var].sub(/^http:\\/\\/([^\\/]+)\\/?$/, '\\1').split(':')\n ret[1] = ret[1].to_i if ret[1]\n break\n end\n end\n # $stderr.puts \"DEBUG: http_proxy = #{ENV['http_proxy']}, ret = [#{ret.join(',')}]\"\n end\n else \n # proxy is disabled\n ret = [nil, nil]\n end\n\n # return host and port\n ret\n end", "def proxy\n return @proxy\n end", "def http_proxy_uri\n @http_proxy_uri ||= begin\n keys = %w( HTTP_PROXY HTTP_PROXY_USER HTTP_PROXY_PASS )\n env = Hash[ENV.\n map{|k, v| [k.upcase, v]}.\n select{|k, v| keys.include?(k)}.\n reject{|k, v| v.nil? || v.empty?}]\n\n uri = env[\"HTTP_PROXY\"] or return\n uri = \"http://#{uri}\" unless uri =~ /^(https?|ftp|file):/\n uri = URI.parse(uri)\n uri.user ||= env[\"HTTP_PROXY_USER\"]\n uri.password ||= env[\"HTTP_PROXY_PASS\"]\n uri\n end\n end", "def proxy\n ENV['NEARMISS_PROXY']\n end", "def public_hostname\n get_proxy.get_public_hostname\n end", "def spice_proxy_url\n @conn.spice_proxy_url\n end", "def server_host\n AgileProxy.config.server_host\n end", "def host\n return @forwarded_host || @host\n end", "def proxy\n return @proxy if @proxy\n return if not Utility.is_windows?\n\n handle = WinProxy.open(@@HTTP_header['User-Agent'], 1, nil, nil, 0)\n return @proxy if handle.null?\n\n options = WinProxy::Options.new\n options[:flags] = 1\n options[:auto_detect_flags] = 2\n options[:auto_logon] = 1\n info = WinProxy::Info.new\n res = WinProxy.get_proxy(handle, (uri.to_s + \"\\0\").encode('utf-16le'), options, info)\n return @proxy if res == 0 # the call failed so return default proxy\n return unless info.proxy?\n\n puts \"TODO: handle proxy bypass - #{info[:bypass].read_16bit_c_string}\" unless info[:bypass].null?\n\n proxies = info[:proxy].read_16bit_c_string.strip.split(';').select {|p| not p.empty? }.map {|p| p.split(':') }\n @proxy = proxies[0]\n @proxy << '80' if @proxy.length == 1\n @proxy += proxy_userpass(proxies.map {|p| p[0] })\n\n WinProxy.free(info[:proxy])\n WinProxy.free(info[:bypass]) unless info[:bypass].null?\n\n @proxy\n end", "def proxyport\n @attributes.fetch('proxyport', 0)\n end", "def webserver_host\n AgileProxy.config.webserver_host\n end", "def proxy_port\n proxy? ? @options['proxy_port'].to_i : nil\n end", "def http_proxy\n @http_proxy ||= begin\n proxy = get_env('HTTP_PROXY') || return\n proxy = \"http://#{proxy}\" unless proxy =~ /^https?:/\n uri = URI.parse(proxy)\n uri.user ||= get_env('HTTP_PROXY_USER')\n uri.password ||= get_env('HTTP_PROXY_PASS')\n uri\n end\n end", "def http_proxy; end", "def endpoint\n \"#{scheme}://#{host}#{suffix}#{reverse_proxy_path}\"\n end", "def address\n if !self.config\n return \"\"\n end\n\n if self.config['serverport']\n \"#{self.config['serveraddr']}:#{self.config['serverport']}\"\n else\n self.config['serveraddr']\n end\n end", "def using_proxy?; end", "def retrieve_proxy(proxy_name)\n @proxy_map[proxy_name]\n end", "def find_proxy(env=ENV)\n raise BadURIError, \"relative URI: #{self}\" if self.relative?\n name = self.scheme.downcase + '_proxy'\n proxy_uri = nil\n if name == 'http_proxy' && env.include?('REQUEST_METHOD') # CGI?\n # HTTP_PROXY conflicts with *_proxy for proxy settings and\n # HTTP_* for header information in CGI.\n # So it should be careful to use it.\n pairs = env.reject {|k, v| /\\Ahttp_proxy\\z/i !~ k }\n case pairs.length\n when 0 # no proxy setting anyway.\n proxy_uri = nil\n when 1\n k, _ = pairs.shift\n if k == 'http_proxy' && env[k.upcase] == nil\n # http_proxy is safe to use because ENV is case sensitive.\n proxy_uri = env[name]\n else\n proxy_uri = nil\n end\n else # http_proxy is safe to use because ENV is case sensitive.\n proxy_uri = env.to_hash[name]\n end\n if !proxy_uri\n # Use CGI_HTTP_PROXY. cf. libwww-perl.\n proxy_uri = env[\"CGI_#{name.upcase}\"]\n end\n elsif name == 'http_proxy'\n unless proxy_uri = env[name]\n if proxy_uri = env[name.upcase]\n warn 'The environment variable HTTP_PROXY is discouraged. Use http_proxy.'\n end\n end\n else\n proxy_uri = env[name] || env[name.upcase]\n end\n\n if proxy_uri.nil? || proxy_uri.empty?\n return nil\n end\n\n if self.hostname\n require 'socket'\n begin\n addr = IPSocket.getaddress(self.hostname)\n return nil if /\\A127\\.|\\A::1\\z/ =~ addr\n rescue SocketError\n end\n end\n\n name = 'no_proxy'\n if no_proxy = env[name] || env[name.upcase]\n no_proxy.scan(/(?!\\.)([^:,\\s]+)(?::(\\d+))?/) {|host, port|\n if (!port || self.port == port.to_i)\n if /(\\A|\\.)#{Regexp.quote host}\\z/i =~ self.host\n return nil\n elsif addr\n require 'ipaddr'\n return nil if\n begin\n IPAddr.new(host)\n rescue IPAddr::InvalidAddressError\n next\n end.include?(addr)\n end\n end\n }\n end\n URI.parse(proxy_uri)\n end", "def proxy?\n self.proxy_host and self.proxy_host.match(/\\A\\S+\\z/)\n end", "def host\n @headers['HTTP_X_FORWARDED_HOST'] || @headers['HTTP_HOST'] \n end", "def remote_addr; end", "def address\n @address ||= \"#{@options[:host]}:#{@options[:port]}\"\n end", "def proxy_vars\n Hash[[:address,:user,:pass,:port].map do |x|\n [x, default_proxy.instance_variable_get(\"@proxy_#{x}\")]\n end]\n end", "def smart_proxy_domain\n if proxy_base_domain =~ /^#{appname}/\n return proxy_base_domain \n end\n proxy_domains\n end", "def get_proxy(identifier); end", "def get_proxy(identifier); end", "def addr\n @addr ||= @stream.connection.socket.peeraddr[3] rescue nil\n end", "def proxy_pass; end", "def get_ip_address\n rpc_get_fact_direct('host_ip')\n end", "def proxy_target\n @target\n end", "def proxy_details\n unless @grid_url.nil?\n grid_base_url = @grid_url.split(GRID_REG_REL_PATH)[0] # grid hostname:port\n @session_id = grid_session_id # get the test's session id\n @proxy_url = get_grid_proxy_url(grid_base_url, @session_id)\n @proxy_details = get_grid_proxy_details(grid_base_url, @proxy_url)\n return @proxy_details['request']['configuration']\n end\n return NA_STRING\n end", "def find_proxy(env=ENV)\n raise BadURIError, \"relative URI: #{self}\" if self.relative?\n name = self.scheme.downcase + '_proxy'\n proxy_uri = nil\n if name == 'http_proxy' && env.include?('REQUEST_METHOD') # CGI?\n # HTTP_PROXY conflicts with *_proxy for proxy settings and\n # HTTP_* for header information in CGI.\n # So it should be careful to use it.\n pairs = env.reject {|k, v| /\\Ahttp_proxy\\z/i !~ k }\n case pairs.length\n when 0 # no proxy setting anyway.\n proxy_uri = nil\n when 1\n k, _ = pairs.shift\n if k == 'http_proxy' && env[k.upcase] == nil\n # http_proxy is safe to use because ENV is case sensitive.\n proxy_uri = env[name]\n else\n proxy_uri = nil\n end\n else # http_proxy is safe to use because ENV is case sensitive.\n proxy_uri = env.to_hash[name]\n end\n if !proxy_uri\n # Use CGI_HTTP_PROXY. cf. libwww-perl.\n proxy_uri = env[\"CGI_#{name.upcase}\"]\n end\n elsif name == 'http_proxy'\n if RUBY_ENGINE == 'jruby' && p_addr = ENV_JAVA['http.proxyHost']\n p_port = ENV_JAVA['http.proxyPort']\n if p_user = ENV_JAVA['http.proxyUser']\n p_pass = ENV_JAVA['http.proxyPass']\n proxy_uri = \"http://#{p_user}:#{p_pass}@#{p_addr}:#{p_port}\"\n else\n proxy_uri = \"http://#{p_addr}:#{p_port}\"\n end\n else\n unless proxy_uri = env[name]\n if proxy_uri = env[name.upcase]\n warn 'The environment variable HTTP_PROXY is discouraged. Use http_proxy.', uplevel: 1\n end\n end\n end\n else\n proxy_uri = env[name] || env[name.upcase]\n end\n\n if proxy_uri.nil? || proxy_uri.empty?\n return nil\n end\n\n if self.hostname\n begin\n addr = IPSocket.getaddress(self.hostname)\n return nil if /\\A127\\.|\\A::1\\z/ =~ addr\n rescue SocketError\n end\n end\n\n name = 'no_proxy'\n if no_proxy = env[name] || env[name.upcase]\n return nil unless URI::Generic.use_proxy?(self.hostname, addr, self.port, no_proxy)\n end\n URI.parse(proxy_uri)\n end", "def fiddler_proxy()\n '--proxy=127.0.0.1:8888'\n end", "def cur_user_host_address\n DocumentHelper.cur_user_host_address(nil)\n end", "def local_ip\n Synchronizer.config['local_url']\n end", "def find_proxy_target(options = {})\n end", "def hostname\n (request.env['HTTP_X_FORWARDED_SERVER'] =~ /[a-z]*/) ? request.env['HTTP_X_FORWARDED_SERVER'] : request.env['HTTP_HOST']\n end", "def remote_ip\n return self[\"client-ip\"] || @forwarded_for || @peeraddr[3]\n end", "def get_address\n parsed_script.get_address\n end", "def server_name\n return @forwarded_server || @config[:ServerName]\n end", "def addr\n return @addr if @addr\n @addr = P::Addr.new\n @addr.time, @addr.service, @addr.ip, @addr.port =\n Time.now.tv_sec, @version.services, @host, @port\n @addr\n end", "def http_proxy(addr=nil, port = nil)\n default_options[:http_proxyaddr] = addr\n default_options[:http_proxyport] = port\n end", "def start_addr\n base_address\n end", "def legitimate_proxy?; end", "def local_ip_address\n conf['base_address'] ||\n %x{ip addr show #{conf['base_interface'] || 'br0'} | grep inet}.split(' ')[1].to_s.strip.split('/').first.to_s\nend", "def get_proxy_from_env\n env_proxy = ENV['http_proxy'] || ENV['HTTP_PROXY']\n\n return nil if env_proxy.nil? or env_proxy.empty?\n\n uri = URI.parse env_proxy\n\n if uri and uri.user.nil? and uri.password.nil? then\n # Probably we have http_proxy_* variables?\n uri.user = escape(ENV['http_proxy_user'] || ENV['HTTP_PROXY_USER'])\n uri.password = escape(ENV['http_proxy_pass'] || ENV['HTTP_PROXY_PASS'])\n end\n\n uri\n end", "def host_with_port\n WaterManager.singleton.http_host\n end", "def proxy=value\n @proxy=value.is_a?(URI) ? value:URI.parse(value)\n end", "def proxy_params\n params[:proxy]\n end", "def http_proxy_parts; end", "def proxy\n @proxy ||= Proxy.new self\n end", "def proxy?\n !@proxy.to_s.strip.empty?\n end", "def host\n\t\t\t# FIXME: This is both a hack and the best way I know to do this.\n\t\t\tSocket.getaddrinfo(Socket.gethostname, 0)[0][2]\n\t\tend", "def parse_proxy_uri(html_node)\n full_addr = ::Base64.decode64(html_node.at_css(\"li script\").html.match(/'(.+)'/)[1])\n URI.parse(\"http://#{full_addr}\")\n end", "def default_proxy\n @default_proxy ||= (\n proxy = ENV['http_proxy'] || ENV['HTTP_PROXY']\n if proxy\n if proxy !~ /^(\\w+):\\/\\// then\n proxy = \"http://#{proxy}\"\n end\n ENV['http_proxy'] = proxy\n proxy_uri = URI.parse(ENV['http_proxy'])\n Net::HTTP::Proxy(proxy_uri.host, proxy_uri.port, proxy_uri.user, proxy_uri.password)\n else\n Net::HTTP\n end\n )\n end", "def getAddress()\n \"#{@mcAddress}:#{@port}\"\n end", "def http_proxy addr, opts={}\n return Net::HTTP unless addr\n\n host, port = addr.split \":\"\n port ||= opts[:port] || 8080\n\n user = opts[:username]\n pass = opts[:password]\n\n Kronk::Cmd.verbose \"Using proxy #{addr}\\n\" if host\n\n Net::HTTP::Proxy host, port, user, pass\n end", "def addr; @configuration['addr']; end", "def get_ip_address\n request.remote_ip\n end", "def fetch_location\n session[:forwarding_url]\n end", "def proxy?\n @options.has_key?('proxy_port')\n end", "def real_ip\n return @real_ip if @real_ip\n begin\n orig, Socket.do_not_reverse_lookup = Socket.do_not_reverse_lookup, true # turn off reverse DNS resolution temporarily\n\n UDPSocket.open do |s|\n s.connect '64.233.187.99', 1\n @real_ip = s.addr.last\n end\n ensure\n Socket.do_not_reverse_lookup = orig\n end\n @real_ip\n end", "def forwarded_for\n @forwarded_for ||= IPs.parse(@headers[HTTP_X_FORWARDED_FOR])\n end", "def src_addr_on_header\n request.headers['X-Forwarded-For'] || request.headers['REMOTE_ADDR']\n end", "def proxy=(value)\n\t\t\t@proxy = value\n\t\tend", "def remote_i_p_address\n return @remote_i_p_address\n end", "def getHost()\n return @uri.host\n end", "def true_address\r\n addr = servlet_response.getLocalName\r\n $log.debug(\"True address/hostname is #{addr}\")\r\n addr\r\n end", "def proxyusage\r\n\t\t\t`#{BITS::BITSADMIN} /getproxyusage {#{@id}}`\r\n\t\tend", "def address() @address; end", "def user_ip\n \trequest.location\n end", "def set_proxy(address,port,user=nil,password=nil)\n @proxy_server={:address=>address,:port=>port,\n :user=>user, :password=>password}\n return self\n end", "def proxy_port\n ENV[\"CHEF_API_PROXY_PORT\"] || config[\"CHEF_API_PROXY_PORT\"]\n end", "def proxy=(value)\n @proxy = value\n end" ]
[ "0.8522537", "0.8298533", "0.817057", "0.78508836", "0.78034043", "0.77898365", "0.7744084", "0.762997", "0.7431872", "0.7399757", "0.7360031", "0.7341048", "0.73363435", "0.73061025", "0.73061025", "0.7090859", "0.70897204", "0.70839137", "0.70624447", "0.7024565", "0.7024565", "0.7018374", "0.70092875", "0.7005884", "0.70047885", "0.70035344", "0.6993881", "0.6991496", "0.69540256", "0.68575233", "0.6843415", "0.6841509", "0.6792022", "0.67918485", "0.67346114", "0.671165", "0.6698998", "0.66951543", "0.6660191", "0.65587324", "0.6551962", "0.6515077", "0.6509465", "0.6506416", "0.64889205", "0.6421574", "0.6396604", "0.6366678", "0.6340791", "0.6340599", "0.634056", "0.634056", "0.6339394", "0.6339327", "0.6334799", "0.6334532", "0.62895083", "0.62839335", "0.6263451", "0.6252973", "0.625147", "0.62464684", "0.621731", "0.62173", "0.62069786", "0.6200589", "0.6187387", "0.6181894", "0.61794794", "0.6163043", "0.614875", "0.61478984", "0.6138092", "0.613355", "0.6132681", "0.6118778", "0.61054015", "0.6100324", "0.60988474", "0.6096469", "0.60899866", "0.60883653", "0.6084507", "0.6074613", "0.60712177", "0.60659915", "0.6057547", "0.6057232", "0.6051358", "0.6047221", "0.60438013", "0.60402745", "0.6036357", "0.6033466", "0.6032171", "0.6031958", "0.6030241", "0.602524", "0.60242826", "0.6022552" ]
0.821397
2
Returns the mac address used
def mac @attributes.fetch('mac', nil) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mac_addr\n if (mac_addr = @host.at('tag[name=mac-addr]'))\n mac_addr.inner_text\n end\n end", "def mac_address\n @mac_address ||= raw_data[22..27].join(':')\n end", "def mac\n File.open(\"/sys/class/net/#{@name}/address\") do |f|\n f.read.chomp\n end\n end", "def mac_address\n if NicView.empty_mac?(self[\"CurrentMACAddress\"])\n self[\"PermanentMACAddress\"]\n elsif self[\"PermanentMACAddress\"]\n self[\"CurrentMACAddress\"]\n end\n end", "def mac_eth0\n eth0.mac_address\n end", "def tap_mac\n\t\t@sock.local_address.to_sockaddr[-6,6]\n\tend", "def tap_mac\n\t\t@sock.local_address.to_sockaddr[-6,6]\n\tend", "def read_mac_address\n end", "def mac\n @mac || REXML::XPath.first(@definition, \"//domain/devices/interface/mac/@address\").value\n end", "def tap_mac\n @sock.local_address.to_sockaddr[-6, 6]\n end", "def getMAC\n tmpmac = \"\"\n if Stage.initial\n tmpmac = Convert.to_string(SCR.Read(path(\".etc.install_inf.HWAddr\")))\n end\n cleanmac = Builtins.deletechars(tmpmac != nil ? tmpmac : \"\", \":\")\n cleanmac\n end", "def address\n @mac_address ||= addresses.first\n end", "def mac_address\n unless @mac\n octets = 3.times.map { rand(255).to_s(16) }\n @mac = \"525400#{octets[0]}#{octets[1]}#{octets[2]}\"\n end\n @mac\n end", "def mac_address\n mac = nil\n\n ovf.xpath(\"//*[local-name()='Machine']/*[local-name()='Hardware']/*[local-name()='Network']/*[local-name()='Adapter']\").each do |net|\n if net.attribute(\"enabled\").value == \"true\"\n mac = net.attribute(\"MACAddress\").value\n break\n end\n end\n\n if mac\n return mac\n else\n fail Errors::BoxAttributeError, error_message: 'Could not determine mac address'\n end\n end", "def read_mac_address\n execute(\"showvminfo\", @uuid, \"--machinereadable\").split(\"\\n\").each do |line|\n return $1.to_s if line =~ /^macaddress1=\"(.+?)\"$/\n end\n\n nil\n end", "def mac_address\n mac = nil\n\n ovf.elements.each(\"//vbox:Machine/Hardware//Adapter\") do |ele|\n if ele.attributes['enabled'] == 'true'\n mac = ele.attributes['MACAddress']\n break\n end\n end\n\n if mac\n return mac\n else\n raise Errors::BoxAttributeError, :error_message => 'Could not determine mac address'\n end\n end", "def mac_address\n super\n end", "def mac\n config[\"mac\"]\n end", "def getMAC(interface)\n cmd = `ifconfig #{interface}`\n mac = cmd.match(/(([A-F0-9]{2}:){5}[A-F0-9]{2})/i).captures\n @log.debug \"MAC of interface '#{interface}' is: #{mac.first}\"\n return mac.first\n end", "def read_mac_address\n execute(:get_network_mac, VmId: vm_id)\n end", "def address\n return @mac_address if defined? @mac_address and @mac_address\n re = %r/[^:\\-](?:[0-9A-F][0-9A-F][:\\-]){5}[0-9A-F][0-9A-F][^:\\-]/io\n cmds = '/sbin/ifconfig', '/bin/ifconfig', 'ifconfig', 'ipconfig /all', 'cat /sys/class/net/*/address'\n\n null = test(?e, '/dev/null') ? '/dev/null' : 'NUL'\n\n output = nil\n cmds.each do |cmd|\n begin\n r, w = IO.pipe\n ::Process.waitpid(spawn(cmd, :out => w))\n w.close\n stdout = r.read\n next unless stdout and stdout.size > 0\n output = stdout and break\n rescue\n # go to next command!\n end\n end\n raise \"all of #{ cmds.join ' ' } failed\" unless output\n\n @mac_address = parse(output)\n end", "def arp_src_mac; self[:arp_src_mac].to_s; end", "def read_mac_address\n hw_info = read_settings.fetch('Hardware', {})\n shared_ifaces = hw_info.select do |name, params|\n name.start_with?('net') && params['type'] == 'shared'\n end\n\n raise Errors::SharedInterfaceNotFound if shared_ifaces.empty?\n\n shared_ifaces.values.first.fetch('mac', nil)\n end", "def mac\n options[:mac]\n end", "def get_mac_address\n IO.popen(\"ifconfig\") do |io|\n while line = io.gets\n return $1 if (line =~ /HWaddr ([A-Z0-9:]+)/)\n end\n end\n return nil\nend", "def arp_dest_mac; self[:arp_dest_mac].to_s; end", "def base_mac_address\n super\n end", "def generate_mac\n if locate_config_value(:macaddress).nil?\n ('%02x' % (rand(64) * 4 | 2)) + (0..4).reduce('') { |s, _x|s + ':%02x' % rand(256) }\n else\n locate_config_value(:macaddress)\n end\n end", "def get_macaddr\n currentEth = currentAddr = nil; macaddrs = {}\n `ifconfig`.split(\"\\n\").map! do |line|\n maybeEth = line.match(/([a-z]+[0-9]+): .*/)\n currentEth = maybeEth[1].strip if !maybeEth.nil?\n maybeAddr = line.match(/ether ([0-9 A-Ea-e \\:]+)/)\n currentAddr = maybeAddr[1].strip if !maybeAddr.nil?\n if currentEth != nil && currentAddr != nil\n macaddrs[currentEth] = currentAddr\n currentEth = currentAddr = nil\n end\n end\n macaddrs\nend", "def get_mac_address(addresses)\n detected_addresses = addresses.detect { |address, keypair| keypair == { \"family\" => \"lladdr\" } }\n if detected_addresses\n detected_addresses.first\n else\n \"\"\n end\n end", "def format_mac_address\n self.mac_address = self.mac_address.to_s.upcase.gsub(/[^A-F0-9]/,'')\n end", "def true_mac_address\n super\n end", "def true_mac_address\n super\n end", "def arp_saddr_mac\n\t\tEthHeader.str2mac(self[:arp_src_mac].to_s)\n\tend", "def dev_addr(mac, family='lladdr')\n interface_node = node['network']['interfaces']\n addr = mac.downcase\n interface_node.select do |dev, data|\n data['addresses'].select do |id, prop|\n\treturn dev if id.downcase == addr && prop['family'] == family\n end\n end\n return nil\n end", "def mac_address(prefix: T.unsafe(nil)); end", "def node_mac(name)\n %x{grep 'mac address' /etc/libvirt/qemu/#{name}.xml 2>/dev/null}.match(/((..:){5}..)/).to_s\nend", "def mac_address\n raise ::Fission::Error,\"VM #{@name} does not exist\" unless self.exists?\n\n line=File.new(vmx_path).grep(/^ethernet0.generatedAddress =/)\n if line.nil?\n #Fission.ui.output \"Hmm, the vmx file #{vmx_path} does not contain a generated mac address \"\n return nil\n end\n address=line.first.split(\"=\")[1].strip.split(/\\\"/)[1]\n return address\n end", "def mac?\n @mac\n end", "def ip\n arp = Cheetah.run([\"arp\", \"-n\"], stdout: :capture)\n entry = arp.lines.find { |a| a.include?(mac) }\n return nil if entry.nil?\n entry.split(\" \")[0]\n end", "def mac_masquerade_address\n super\n end", "def mac_masquerade_address\n super\n end", "def generate_mac\n crc32 = Zlib.crc32(self.id.to_s)\n offset = crc32.modulo(255)\n\n digits = [ %w(0),\n %w(0),\n %w(0),\n %w(0),\n %w(5),\n %w(e),\n %w(0 1 2 3 4 5 6 7 8 9 a b c d e f),\n %w(0 1 2 3 4 5 6 7 8 9 a b c d e f),\n %w(5 6 7 8 9 a b c d e f),\n %w(3 4 5 6 7 8 9 a b c d e f),\n %w(0 1 2 3 4 5 6 7 8 9 a b c d e f),\n %w(0 1 2 3 4 5 6 7 8 9 a b c d e f) ]\n mac = \"\"\n for x in 1..12 do\n mac += digits[x-1][offset.modulo(digits[x-1].count)]\n mac += \":\" if (x.modulo(2) == 0) && (x != 12)\n end\n mac\n end", "def manufacturer_id\n mac[0..7]\n end", "def format_mac_address\n\t\tself.mac_address = self.mac_address.to_s().upcase().gsub( /[^A-F0-9]/, '' )\n\tend", "def ip_by_mac(mac)\n %x{arp -a | grep #{mac}}.split(' ')[1].to_s.sub('(', '').sub(')', '')\nend", "def generate_mac \n (\"%02x\"%(rand(64)*4|2))+(0..4).inject(\"\"){|s,x|s+\":%02x\"%rand(256)}\n end", "def get_ipmi_mac_address(channel)\n mac = get_ipmi_field(channel, 'MAC Address')\n mac or raise Puppet::Error.new(\"Unable to get IPMI MAC address\")\n end", "def get_mac_address(pool, num)\n end_num = num.to_s(16)\n # mac_address = pool.starting_mac_address\n mac_address = '002440'\n mac_address = mac_address.ljust(12, \"0\")\n mac_address[mac_address.size - end_num.size, mac_address.size]= end_num\n mac_address = mac_address[0,2] + ':' + mac_address[2, 2] + ':' + mac_address[4,2] + ':' + mac_address[6,2] + ':' + mac_address[8,2] + ':' + mac_address[10,2]\n return mac_address\n end", "def mac_for_instance(num=nil)\n num = next_instance_to_start if num.nil?\n num = num.to_i if num.is_a?(String) and num =~ /^\\d+$/\n if !num.is_a? Fixnum or num < 0 or num > 255 \n raise TypeError, _('Argument must be an integer between 0 and 255')\n end\n offset = sprintf('%02x', num)\n mac = mac_base_addr.gsub(/00$/, offset)\n\n mac\n end", "def get_fusion_vm_mac(options)\n options['mac'] = \"\"\n options['search'] = \"ethernet0.address\"\n options['mac'] = get_fusion_vm_vmx_file_value(options)\n if not options['mac']\n options['search'] = \"ethernet0.generatedAddress\"\n options['mac'] = get_fusion_vm_vmx_file_value(options)\n end\n return options['mac']\nend", "def src_mac\n self[:sender_mac]\n end", "def dest_mac\n self[:dest_mac]\n end", "def mac_to_txt(mac)\n mac.map {|s| s.to_s(16)}.join \":\"\nend", "def macify\n split(\":\").map {|a| a[0].chr == \"0\" ? a[1].chr : a}.join(\":\")\n end", "def get_last_mac_num(mac)\n num = mac.gsub(':', '')[6,6].hex\n return num\n end", "def id\n m = /ether\\s+(\\S+)/.match(`ifconfig wlan0`)\n return nil if m.nil?\n mac = m[1] # WLAN mac address\n return nil if mac.nil?\n MAC2ID[mac.downcase]\n end", "def resolve_to_mac(input)\n if valid_mac?(input)\n return input\n end\n lookup_in_ethers(input)\n end", "def read_mac_addresses\n read_vm_option('mac').strip.gsub(':', '').split(' ')\n end", "def get_mac_for_interface(interfaces, interface)\n interfaces[interface][:addresses].find { |k, v| v[\"family\"] == \"lladdr\" }.first unless interfaces[interface][:addresses].nil? || interfaces[interface][:flags].include?(\"NOARP\")\n end", "def pretty\n\t\tmacocts = []\n\t\tmac_addr.each_byte { |o| macocts << o }\n\t\tmacocts += [0] * (6 - macocts.size) if macocts.size < 6\n\t\treturn sprintf(\n\t\t\t\t\"#{mac_name}\\n\" +\n\t\t\t\t\"Hardware MAC: %02x:%02x:%02x:%02x:%02x:%02x\\n\" +\n\t\t\t\t\"IP Address : %s\\n\" +\n\t\t\t\t\"Netmask : %s\\n\" +\n\t\t\t\t\"\\n\", \n\t\t\t\tmacocts[0], macocts[1], macocts[2], macocts[3], \n\t\t\t\tmacocts[4], macocts[5], ip, netmask)\n\tend", "def mac_address_given?\n if new_resource.mac_address\n raise \"new_resource.mac_address was given and is invalid\" unless valid_mac?(new_resource.mac_address)\n end\n if valid_mac?(new_resource.name)\n return \"name\" if name_and_mac_both_given_and_match?\n elsif new_resource.mac_address\n return \"mac_addr\"\n else\n return false\n end\n end", "def multicast_mac(options=nil)\n known_args = [:Objectify]\n objectify = false\n\n if (options)\n if (!options.kind_of? Hash)\n raise ArgumentError, \"Expected Hash, but #{options.class} provided.\"\n end\n NetAddr.validate_args(options.keys,known_args)\n\n if (options.has_key?(:Objectify) && options[:Objectify] == true)\n objectify = true\n end\n end\n\n if (@version == 4)\n if (@ip & 0xf0000000 == 0xe0000000)\n # map low order 23-bits of ip to 01:00:5e:00:00:00\n mac = @ip & 0x007fffff | 0x01005e000000\n else\n raise ValidationError, \"#{self.ip} is not a valid multicast address. IPv4 multicast \" +\n \"addresses should be in the range 224.0.0.0/4.\"\n end\n else\n if (@ip & (0xff << 120) == 0xff << 120)\n # map low order 32-bits of ip to 33:33:00:00:00:00\n mac = @ip & (2**32-1) | 0x333300000000\n else\n raise ValidationError, \"#{self.ip} is not a valid multicast address. IPv6 multicast \" +\n \"addresses should be in the range ff00::/8.\"\n end\n end\n\n eui = NetAddr::EUI48.new(mac)\n eui = eui.address if (!objectify)\n\n return(eui)\n end", "def arp_dest_mac= i; typecast \"arp_dest_mac\", i; end", "def arp_src_mac= i; typecast \"arp_src_mac\", i; end", "def calc_mac(base_mac, i = 1)\n mac_array = base_mac.split(/:/)\n\n mac_array[-1] = sprintf(\"%02x\", mac_array.last.hex + i).upcase\n mac_array.join(\":\")\nend", "def hwaddr(iface=nil)\n @hwaddr[iface || default_iface]\n end", "def mac(string)\n Digest::SHA256.new.update(string).hexdigest.upcase\n end", "def mac?\n mac_internal?\n end", "def manufacturer\n Mac.manufacturer(mac)\n end", "def get_gdom_mac(options)\n message = \"Information:\\tGetting guest domain \"+options['name']+\" MAC address\"\n command = \"ldm list-bindings #{options['name']} |grep '#{options['vmnic']}' |awk '{print $5}'\"\n output = execute_command(options,message,command)\n options['mac'] = output.chomp\n return options['mac']\nend", "def random_mac(oui=nil)\n mac_parts = [oui||DEFAULT_OUI]\n [0x7f, 0xff, 0xff].each do |limit|\n mac_parts << \"%02x\" % rand(limit + 1)\n end\n mac_parts.join('-')\nend", "def mac_addresses\n network_response = network_info\n return network_response unless network_response.successful?\n\n response = Response.new :code => 0\n response.data = network_response.data.values.collect { |n| n['mac_address'] }\n\n response\n end", "def mac_addresses\n network_response = network_info\n return network_response unless network_response.successful?\n\n response = Response.new :code => 0\n response.data = network_response.data.values.collect { |n| n['mac_address'] }\n\n response\n end", "def empirical_mac(entry)\n ping = Mixlib::ShellOut.new('ping', entry[:ip_address], '-c', '1')\n ping.run_command\n unless ping.status.success?\n puts \"Ping to #{entry[:hostname]} (#{entry[:ip_address]}) failed, \" \\\n 'checking ARP anyway.'\n end\n\n arp = Mixlib::ShellOut.new('arp', '-an')\n arp.run_command\n arp_entry = arp.stdout.split(\"\\n\")\n .map(&:chomp)\n .select { |l| l.include?(entry[:ip_address]) }\n .first\n match_data =\n /(\\w\\w:\\w\\w:\\w\\w:\\w\\w:\\w\\w:\\w\\w) .ether./.match(arp_entry.to_s)\n if !match_data.nil? && match_data.captures.count == 1\n mac = match_data[1]\n puts \"Found #{mac} for #{entry[:hostname]} (#{entry[:ip_address]})\"\n mac\n else\n raise 'Could not find ARP entry for ' \\\n \"#{entry[:hostname]} (#{entry[:ip_address]})!\"\n end\n end", "def device_ipaddress; end", "def device_ipaddress; end", "def ip_address\n raise ::Fission::Error,\"VM #{@name} does not exist\" unless self.exists?\n\n unless mac_address.nil?\n lease=LeasesFile.new(\"/var/db/vmware/vmnet-dhcpd-vmnet8.leases\").find_lease_by_mac(mac_address)\n if lease.nil?\n return nil\n else\n return lease.ip\n end\n else\n # No mac address was found for this machine so we can't calculate the ip-address\n return nil\n end\n end", "def mac_mri?; end", "def eui_64(mac)\n if @family != Socket::AF_INET6\n raise Exception, \"EUI-64 only makes sense on IPv6 prefixes.\"\n elsif self.length != 64\n raise Exception, \"EUI-64 only makes sense on 64 bit IPv6 prefixes.\"\n end\n if mac.is_a? Integer\n mac = \"%:012x\" % mac\n end\n if mac.is_a? String\n mac.gsub!(/[^0-9a-fA-F]/, \"\")\n if mac.match(/^[0-9a-f]{12}/).nil?\n raise ArgumentError, \"Second argument must be a valid MAC address.\"\n end\n e64 = (mac[0..5] + \"fffe\" + mac[6..11]).to_i(16) ^ 0x0200000000000000\n IPAddr.new(self.first.to_i + e64, Socket::AF_INET6)\n end\n end", "def get_vbox_vm_mac(client_name)\n message = \"Getting:\\tMAC address for \"+client_name\n command = \"VBoxManage showvminfo #{client_name} |grep MAC |awk '{print $4}'\"\n vbox_vm_mac = execute_command(message,command)\n vbox_vm_mac = vbox_vm_mac.chomp\n vbox_vm_mac = vbox_vm_mac.gsub(/\\,/,\"\")\n return vbox_vm_mac\nend", "def dell_mac_addresses\n macs = []\n result = run_command([\"delloem\", \"mac\"])\n result.each_line do |line|\n data = line.split(' ')\n if data[0].to_i.to_s == data[0].to_s\n macs << mac = {:index => data[0], :address => data[1]}\n unless data[2].blank?\n mac[:enabled] = data[2] == 'Enabled'\n else\n mac[:enabled] = true\n end\n end\n end\n macs\n end", "def chaddr\n @chaddr[0,@hlen].each_byte.map{|b| ('0'+b.to_s(16).upcase)[-2,2]}.join(':')\n end", "def random_mac_addr(provider)\n symbol = provider.to_sym\n case symbol\n when :virtualbox\n PROVIDER_MAC_PREFIXES[:virtualbox] + 3.times.map { '%02x' % rand(0..255) }.join\n when :libvirt\n PROVIDER_MAC_PREFIXES[:libvirt] + 3.times.map { '%02x' % rand(0..255) }.join\n when :vmware_fusion\n PROVIDER_MAC_PREFIXES[:vmware] + 3.times.map { '%02x' % rand(0..255) }.join\n when :vmware\n PROVIDER_MAC_PREFIXES[:vmware] + 3.times.map { '%02x' % rand(0..255) }.join\n when :parallels\n PROVIDER_MAC_PREFIXES[:parallels] + 3.times.map { '%02x' % rand(0..255) }.join\n when :hyper_v\n PROVIDER_MAC_PREFIXES[:hyper_v] + 3.times.map { '%02x' % rand(0..255) }.join\n else\n raise \"Unsupported provider #{provider}\"\n end\nend", "def getAddress()\n \"#{@mcAddress}:#{@port}\"\n end", "def generate_unique_mac\n sprintf('b88d12%s', (1..3).map{\"%0.2X\" % rand(256)}.join('').downcase)\n end", "def hwaddr\n begin\n exists? && IO.read(\"/sys/class/net/#{name}/address\").strip\n rescue Errno::ENOENT\n end.tap do |address|\n raise Errors::UnknownInterface, \"Interface #{name} not found on this machine\" unless address\n end\n end", "def add_mac_colon!\n unless mac.include? ':'\n self.mac = mac.to_s.chars.each_slice(2).map(&:join).join(':')\n end\n end", "def add_mac_colon!\n unless mac.include? ':'\n self.mac = mac.to_s.chars.each_slice(2).map(&:join).join(':')\n end\n end", "def default_ip_command\n %q( awk \"/$mac/ {print \\$1}\" /proc/net/arp )\n end", "def get_mac_address_of_nic_on_requested_vlan\n args = {\n :value_of_vlan_option => get_option(:vlan),\n :dest_cluster => dest_cluster,\n :destination => destination\n }\n source.ext_management_system.ovirt_services.get_mac_address_of_nic_on_requested_vlan(args)\n end", "def lookup(mac, opts = {})\n lapsed!\n data = prefix_table[Address.new(mac).prefix]\n if data.nil?\n opts[:raising] ? raise(NotFoundOuiVendor, \"OUI not found for MAC: #{mac}\") : (return nil)\n end\n Address.new(mac, data)\n end", "def arp_saddr_mac= mac\n\t\tmac = EthHeader.mac2str(mac)\n\t\tself[:arp_src_mac].read(mac)\n\t\tself.arp_src_mac\n\tend", "def calc_mac(post)\n string = '';\n post.sort_by {|sym| sym.to_s}.map do |key,value|\n if key != 'MAC'\n if string.length > 0\n string += '&'\n end\n string += \"#{key}=#{value}\"\n end\n end\n post[:MAC] = OpenSSL::HMAC.hexdigest('sha256', hexto_sring(@options[:password]), string)\n end", "def has_euca_mac?\n !!(Facter.value(:macaddress) =~ %r{^[dD]0:0[dD]:})\n end", "def base_multicast_address\n return nil if !connection_address\n connection_address.split('/', 2).first\n end", "def getMacAddrByName(x, y, cname = \"ath0\", domain = \"grid\") \n qs = <<MAC_QS\nSELECT devices.mac \n FROM devices \n LEFT JOIN nodes ON devices.motherboard_id = nodes.motherboard_id \n LEFT JOIN locations ON nodes.location_id = locations.id \n LEFT JOIN testbeds ON locations.testbed_id = testbeds.id\nWHERE testbeds.node_domain='#{domain}' \n AND locations.x=#{x} \n AND locations.y=#{y} \n AND canonical_name='#{cname}';\nMAC_QS\n\n addr = nil\n runQuery(qs) { |mac|\n addr = mac\n }\n return addr\n end", "def test_gen_mac_multicast_locally_administered\n mac = RFauxFactory.gen_mac(multicast: true, locally: true)\n first_octect = mac.split(':')[0].to_i(16)\n mask = 0b00000011\n assert_equal first_octect & mask, 3\n end", "def get_parallels_vm_mac(options)\n message = \"Information:\\tGetting MAC address for \"+options['name']\n command = \"prlctl list --info #{options['name']} |grep net0 |grep mac |awk '{print $4}' |cut -f2 -d=\"\n vm_mac = execute_command(options,message,command)\n vm_mac = vm_mac.chomp\n vm_mac = vm_mac.gsub(/\\,/,\"\")\n return vm_mac\nend", "def ndp_lladdr\n EthHeader.str2mac(self[:ndp_lla].to_s)\n end" ]
[ "0.8577535", "0.85565656", "0.83986217", "0.8306547", "0.8284183", "0.81908435", "0.81908435", "0.81875575", "0.8141835", "0.8112279", "0.8035434", "0.79994595", "0.7986507", "0.7977764", "0.76764923", "0.7654493", "0.76028806", "0.7597326", "0.7542881", "0.74836046", "0.7463573", "0.74579585", "0.74201405", "0.7404387", "0.73700243", "0.7339935", "0.7311889", "0.72994375", "0.72423446", "0.72167975", "0.72062993", "0.71707124", "0.71707124", "0.7125916", "0.71079916", "0.7085309", "0.7084564", "0.7077525", "0.7066134", "0.70401895", "0.7002614", "0.7002614", "0.6989435", "0.69844913", "0.6971829", "0.6908414", "0.68961626", "0.6859546", "0.68311703", "0.68062115", "0.6727589", "0.67159224", "0.6667874", "0.6650166", "0.6635676", "0.662706", "0.65834874", "0.65825945", "0.6570214", "0.6569682", "0.6543813", "0.65239733", "0.64796937", "0.6471867", "0.6464498", "0.6460061", "0.6457927", "0.6450966", "0.6437747", "0.63604695", "0.6341938", "0.6329507", "0.63221645", "0.63221645", "0.63146347", "0.63109994", "0.63109994", "0.63034624", "0.63007396", "0.62689614", "0.62586313", "0.62583935", "0.6253999", "0.6243593", "0.6237754", "0.62342125", "0.6200091", "0.61905605", "0.61905605", "0.617554", "0.61680967", "0.61587566", "0.61564726", "0.6140273", "0.61385065", "0.61323845", "0.6116193", "0.6069338", "0.605098", "0.6049791" ]
0.80773234
10
Returns the DHCP status
def dhcp @attributes.fetch('dhcp', false) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dhcp?\n config[\"dhcp\"]\n end", "def status\n logger.info \"Retrieving Vagrant status for #{description}\"\n output = connection.execute!(:status).stdout\n Derelict::Parser::Status.new(output)\n end", "def status\n\n\t\tstat = vzctl('status', ctid).split(\" \")\n\t\tif exists?\n\t\t\tif resource[:ensure].to_s == \"installed\"\n\t\t\t\treturn :installed\n\t\t\telsif stat[4] == \"running\"\n\t\t\t\treturn :running\n\t\t\telsif stat[4] == \"down\"\n\t\t\t\treturn :stopped\n\t\t\telse \n\t\t\t\treturn :absent\n\t\t\tend\n\t\telse\n\t\t\tdebug \"Domain %s status: absent\" % [resource[:name]]\n\t\t\tdebug resource.should(:ensure)\n\t\t\treturn :absent\n\t\tend\n\tend", "def status\n dist_service( service_name, 'status' )\n end", "def status\n\t\t# puts \"Status #{@ip} ...\"\n\t\toutput = `#{ipmi_command} chassis power status`\n\t\t# p output\n\t\tif output =~ /on/\n\t\t\t@status = true\n\t\telsif output =~ /off/\n\t\t\t@status = false\n\t\tend\n\tend", "def status\n log('Fetching status')\n\n return not_enabled unless Vedeu::Configuration.drb?\n\n if drb_running?\n log('Running')\n\n :running\n\n else\n log('Stopped')\n\n :stopped\n\n end\n end", "def dhcp_options\n @dhcp_options ||= init_dhcp_options\n end", "def status\n log('Fetching status')\n\n return not_enabled unless Vedeu.config.drb?\n\n if drb_running?\n log('Running')\n\n :running\n\n else\n log('Stopped')\n\n :stopped\n\n end\n end", "def check_osx_dhcpd(options)\n check_osx_dhcpd_installed()\n create_osx_dhcpd_plist()\n service = \"dhcp\"\n check_osx_service_is_enabled(service)\n return\nend", "def get_status\n send_command(0x79)\n end", "def drb_status!\n Vedeu.bind(:_drb_status_) { Vedeu::Distributed::Server.status }\n end", "def health_status\n data.health_status\n end", "def dhcpd\n ensure_authenticated!\n allow :put\n\n unless request.content_type == 'application/json'\n raise UnsupportedMediaType, request.content_type\n end\n\n if params[:vlan].nil? || params[:vlan][:action].nil? ||\n (params[:vlan][:action] != 'start' &&\n params[:vlan][:action] != 'stop')\n raise UnprocessableEntity, \"An action ('start' or 'stop') should be provided\"\n end\n\n @kavlan.dhcpd(params[:id], params[:vlan])\n\n render plain: '',\n status: 204\n end", "def status\n\t\t\tif `svstat #{@svcdir}` =~ /: (up|down)/\n\t\t\t\tst = $1.to_sym\n\t\t\t\tst = :unmonitored if GOD and st == :down\n\t\t\telse\n\t\t\t\tst = :unknown\n\t\t\tend\n\t\t\tst\n\t\tend", "def dhcp_options_id\n @vpc.dhcp_options_id\n end", "def status\n\t\tcase (s = Databass.pg_ctl(path, :status))\n\t\twhen 3 then :stopped\n\t\twhen 0 then :running\n\t\telse raise \"Unknown response from pg_ctl status: #{s}\"\n\t\tend\n\tend", "def status\n\n\t\tif exists? \n\t\t\t# 1 = running, 3 = paused|suspend|freeze, 5 = stopped \n\t\t\tif resource[:ensure].to_s == \"installed\"\n\t\t\t\treturn \"installed\"\n\t\t\telsif dom.info.state != 5\n\t\t\t\tdebug \"Domain %s status: running\" % [resource[:name]]\n\t\t\t\treturn \"running\"\n\t\t\telse\n\t\t\t\tdebug \"Domain %s status: stopped\" % [resource[:name]]\n\t\t\t\treturn \"stopped\"\n\t\t\tend\n\t\telse\n\t\t\tdebug \"Domain %s status: absent\" % [resource[:name]]\n\t\t\treturn \"absent\"\n\t\tend\n\n\tend", "def status\n\n\t\tif exists? \n\t\t\t# 1 = running, 3 = paused|suspend|freeze, 5 = stopped \n\t\t\tif resource[:ensure].to_s == \"installed\"\n\t\t\t\treturn \"installed\"\n\t\t\telsif dom.info.state != 5\n\t\t\t\tdebug \"Domain %s status: running\" % [resource[:name]]\n\t\t\t\treturn \"running\"\n\t\t\telse\n\t\t\t\tdebug \"Domain %s status: stopped\" % [resource[:name]]\n\t\t\t\treturn \"stopped\"\n\t\t\tend\n\t\telse\n\t\t\tdebug \"Domain %s status: absent\" % [resource[:name]]\n\t\t\treturn \"absent\"\n\t\tend\n\n\tend", "def health_status\n return @health_status\n end", "def health_status\n return @health_status\n end", "def health_status\n return @health_status\n end", "def health_status\n return @health_status\n end", "def getStatus\r\n\t\t\t\t\treturn @status\r\n\t\t\t\tend", "def init_dhcp_options\n @@client.describe_dhcp_options.dhcp_options\n end", "def status\n begin\n Timeout::timeout(5) do\n ping '-q', '-c', '1', '-W', '3', @resource[:name]\n end\n rescue Timeout::Error, Puppet::ExecutionFailure\n return :down\n end\n :up\n end", "def status\n service.get(\"\")\n end", "def read_dhcp_server_status_with_http_info(config_id, connectivity_path, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingIPManagementDHCPDHCPServerConfigsApi.read_dhcp_server_status ...'\n end\n # verify the required parameter 'config_id' is set\n if @api_client.config.client_side_validation && config_id.nil?\n fail ArgumentError, \"Missing the required parameter 'config_id' when calling PolicyNetworkingIPManagementDHCPDHCPServerConfigsApi.read_dhcp_server_status\"\n end\n # verify the required parameter 'connectivity_path' is set\n if @api_client.config.client_side_validation && connectivity_path.nil?\n fail ArgumentError, \"Missing the required parameter 'connectivity_path' when calling PolicyNetworkingIPManagementDHCPDHCPServerConfigsApi.read_dhcp_server_status\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingIPManagementDHCPDHCPServerConfigsApi.read_dhcp_server_status, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingIPManagementDHCPDHCPServerConfigsApi.read_dhcp_server_status, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/dhcp-server-configs/{config-id}/status'.sub('{' + 'config-id' + '}', config_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'connectivity_path'] = connectivity_path\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'include_mark_for_delete_objects'] = opts[:'include_mark_for_delete_objects'] if !opts[:'include_mark_for_delete_objects'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'DhcpServerStatus')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingIPManagementDHCPDHCPServerConfigsApi#read_dhcp_server_status\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def getStatus\n @status\n end", "def get_status\n\t\tstatus\n\tend", "def config_status\n config = getconfig\n result = {}\n\n result[:autoboot] = config[:autoboot] ? config[:autoboot].intern : :absent\n result[:pool] = config[:pool]\n result[:shares] = config[:shares]\n if dir = config[\"inherit-pkg-dir\"]\n result[:inherit] = dir.collect { |dirs| dirs[:dir] }\n end\n if datasets = config[\"dataset\"]\n result[:dataset] = datasets.collect { |dataset| dataset[:name] }\n end\n result[:iptype] = config[:\"ip-type\"]\n if net = config[\"net\"]\n result[:ip] = net.collect do |params|\n if params[:defrouter]\n \"#{params[:physical]}:#{params[:address]}:#{params[:defrouter]}\"\n elsif params[:address]\n \"#{params[:physical]}:#{params[:address]}\"\n else\n params[:physical]\n end\n end\n end\n\n result\n end", "def status\n case @status\n when 0 then :off\n when 1 then :on\n end\n end", "def status\n instance_get(:status)\n end", "def read_state\n read_vm_option('status').strip.to_sym\n end", "def remote_status\n Rails.logger.debug(\"Get remote_status\")\n begin\n status = switcher.switched?\n (status == true) ? result = Status::ON : result = Status::OFF\n Rails.logger.debug(\"result = #{result}\")\n rescue => exception\n Rails.logger.info(\"remote_status error: \\n = #{exception}\")\n result = Status::UNKNOWN\n end\n result\n end", "def read_dhcp_server_status(config_id, connectivity_path, opts = {})\n data, _status_code, _headers = read_dhcp_server_status_with_http_info(config_id, connectivity_path, opts)\n data\n end", "def mg_dhcp_settings\r\n MGDHCPSettingsController.instance\r\n end", "def read_dhcp_server_status_0_with_http_info(config_id, connectivity_path, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingIPManagementDHCPDHCPServerConfigsApi.read_dhcp_server_status_0 ...'\n end\n # verify the required parameter 'config_id' is set\n if @api_client.config.client_side_validation && config_id.nil?\n fail ArgumentError, \"Missing the required parameter 'config_id' when calling PolicyNetworkingIPManagementDHCPDHCPServerConfigsApi.read_dhcp_server_status_0\"\n end\n # verify the required parameter 'connectivity_path' is set\n if @api_client.config.client_side_validation && connectivity_path.nil?\n fail ArgumentError, \"Missing the required parameter 'connectivity_path' when calling PolicyNetworkingIPManagementDHCPDHCPServerConfigsApi.read_dhcp_server_status_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingIPManagementDHCPDHCPServerConfigsApi.read_dhcp_server_status_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingIPManagementDHCPDHCPServerConfigsApi.read_dhcp_server_status_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/dhcp-server-configs/{config-id}/status'.sub('{' + 'config-id' + '}', config_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'connectivity_path'] = connectivity_path\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'include_mark_for_delete_objects'] = opts[:'include_mark_for_delete_objects'] if !opts[:'include_mark_for_delete_objects'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'DhcpServerStatus')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingIPManagementDHCPDHCPServerConfigsApi#read_dhcp_server_status_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def config_status\n config = getconfig\n result = {}\n\n result[:autoboot] = (config[:autoboot]) ? config[:autoboot].to_sym : :true\n result[:pool] = config[:pool]\n result[:shares] = config[:shares]\n dir = config['inherit-pkg-dir']\n if dir\n result[:inherit] = dir.map { |dirs| dirs[:dir] }\n end\n datasets = config['dataset']\n if datasets\n result[:dataset] = datasets.map { |dataset| dataset[:name] }\n end\n result[:iptype] = config[:'ip-type'] if config[:'ip-type']\n net = config['net']\n if net\n result[:ip] = net.map do |params|\n if params[:defrouter]\n \"#{params[:physical]}:#{params[:address]}:#{params[:defrouter]}\"\n elsif params[:address]\n \"#{params[:physical]}:#{params[:address]}\"\n else\n params[:physical]\n end\n end\n end\n\n result\n end", "def management_ip_dhcp_configured?\n !!running_config.match(%r{interface ManagementEthernet \\d+/\\d+.*?\\s+ip address\\s+dhcp})\n end", "def get_vault_status\n str = Helpers.create_random_string(50)\n @locked = false\n @authorized = true\n @online = true\n _, code = get_json(str)\n if code == 503\n @locked = true\n elsif code == 502 || code == 504\n @online = false\n elsif code < 300 || code == 404\n @locked = false\n elsif code == 401 || code == 403\n @authorized = false\n end\n @online && !@locked && @authorized\n end", "def state\n if @lxc_details.nil?\n :missing\n else\n status = nil\n with_proxmox do |proxmox|\n vm_id_str = @lxc_details[:vm_id].to_s\n status =\n if proxmox_get(proxmox, \"nodes/#{@lxc_details[:pve_node]}/lxc\").any? { |data_info| data_info['vmid'] == vm_id_str }\n status_info = proxmox_get(proxmox, \"nodes/#{@lxc_details[:pve_node]}/lxc/#{@lxc_details[:vm_id]}/status/current\")\n # Careful that it is possible that somebody destroyed the VM and so its status is missing\n status = status_info.key?('status') ? status_info['status'].to_sym : :missing\n status = :exited if status == :stopped\n status\n else\n :missing\n end\n end\n status\n end\n end", "def status\n return :not_confirmed unless confirmed?\n return :disabled unless enabled?\n \n :enabled\n end", "def control_availability\n dpms_availability\n end", "def address_status\n params['AddressStatus']\n end", "def status\n data[:status]\n end", "def status_from_cache ip\n clean_cache\n node['cloudflare']['threat_control']['status_cache'].fetch(ip)['status'].to_sym\nrescue KeyError\n # not found\n :none\nend", "def read_guest_ip_dhcp\n mac_addr = read_mac_address.downcase\n leases_file = '/Library/Preferences/Parallels/parallels_dhcp_leases'\n leases = {}\n begin\n File.open(leases_file).grep(/#{mac_addr}/) do |line|\n _, ip, exp, dur, = line.split /([\\d.]*)=\"(\\d*),(\\d*),(\\w*),(\\w*)\".*/\n leases[ip] = exp.to_i - dur.to_i\n end\n rescue Errno::EACCES\n raise Errors::DhcpLeasesNotAccessible, leases_file: leases_file.to_s\n rescue Errno::ENOENT\n # File does not exist\n # Perhaps, it is the fist start of Parallels Desktop\n return ''\n end\n\n return '' if leases.empty?\n\n # Get the most resent lease and return an associated IP\n leases.max_by { |_ip, lease_time| lease_time }.first\n end", "def vserver_status_to_string(code)\n case code\n when 0 then :DISABLED\n when 1 then :ALL_UP\n when 2 then :PARTIAL_UP\n when 3 then :FUNC_UP\n when 4 then :DOWN\n else :UNKNOWN\n end\nend", "def show_vm_status(vmname)\r\n current = {:errormsg => \"\", :status => \"\", :time => \"\", :vmstatus => \"\"}\r\n\r\n conn_opts=get_cli_connection\r\n Chef::Log.debug(\"#{conn_opts[:host]}...show vm name=#{vmname}\")\r\n Net::SSH.start( conn_opts[:host], conn_opts[:user], :password => conn_opts[:password], :port => conn_opts[:port] ) do|ssh|\r\n output = ssh.exec!(\"show vm name=#{vmname}\")\r\n output.each_line do |line|\r\n if line.match(/Status:/)\r\n current[:status]=line.split[1].strip\r\n elsif line.match(/Time:/)\r\n line[\"Time: \"]=\"\"\r\n current[:time]=line.strip\r\n elsif line.match(/ Status = /)\r\n current[:vmstatus]=line.split('=')[1].strip\r\n elsif line.match(/Error Msg:/)\r\n line[\"Error Msg: \"]=\"\"\r\n current[:errormsg]=line.strip\r\n end\r\n end\r\n end\r\n return current\r\n end", "def status\n if @object.deadpooled_on\n 'deadpooled'\n elsif @object.acquired_by.any?\n 'acquired'\n elsif @object.initial_public_offering.present?\n 'IPOed'\n else\n 'alive'\n end\n end", "def ping(host = @host, options = {})\n super(host)\n\n lhost = Socket.gethostname\n\n cs = \"winmgmts:{impersonationLevel=impersonate}!//#{lhost}/root/cimv2\"\n wmi = WIN32OLE.connect(cs)\n\n query = \"select * from win32_pingstatus where address = '#{host}'\"\n\n unless options.empty?\n options.each{ |key, value|\n if value.is_a?(String)\n query << \" and #{key} = '#{value}'\"\n else\n query << \" and #{key} = #{value}\"\n end\n }\n end\n\n status = Struct::PingStatus.new\n\n wmi.execquery(query).each{ |obj|\n status.address = obj.Address\n status.buffer_size = obj.BufferSize\n status.no_fragmentation = obj.NoFragmentation\n status.primary_address_resolution_status = obj.PrimaryAddressResolutionStatus\n status.protocol_address = obj.ProtocolAddress\n status.protocol_address_resolved = obj.ProtocolAddressResolved\n status.record_route = obj.RecordRoute\n status.reply_inconsistency = obj.ReplyInconsistency\n status.reply_size = obj.ReplySize\n status.resolve_address_names = obj.ResolveAddressNames\n status.response_time = obj.ResponseTime\n status.response_time_to_live = obj.ResponseTimeToLive\n status.route_record = obj.RouteRecord\n status.route_record_resolved = obj.RouteRecordResolved\n status.source_route = obj.SourceRoute\n status.source_route_type = obj.SourceRouteType\n status.status_code = obj.StatusCode\n status.timeout = obj.Timeout\n status.timestamp_record = obj.TimeStampRecord\n status.timestamp_record_address = obj.TimeStampRecordAddress\n status.timestamp_record_address_resolved = obj.TimeStampRecordAddressResolved\n status.timestamp_route = obj.TimeStampRoute\n status.time_to_live = obj.TimeToLive\n status.type_of_service = obj.TypeOfService\n }\n\n status.freeze # Read-only data\n end", "def display_status\n # Provisioning Status has priority\n if display_provisioning_status != 'Done'\n return display_provisioning_status\n end\n\n case status\n when 'running'\n 'Running'\n when 'stopping'\n 'Shutting Down'\n when 'shutoff'\n 'Powered Off'\n else\n status\n end\n end", "def availability\n STATUS_TO_AVAILABILITY[self.status]\n end", "def status\n cmd = \"#{@vzctl} status #{@ctid}\"\n status = execute(cmd).split(/\\s/)\n Log.debug(\"Container (#{@ctid}) status requested: #{status}\")\n status.drop(2)\n end", "def status\n info['status']\n end", "def get_status\n @reply['status']\n end", "def dhcp_lease_provider\n logger = ::Ohai::Log\n if RUBY_PLATFORM =~ /mswin|mingw|windows/\n timeout = Time.now + 20 * 60 # 20 minutes\n while Time.now < timeout\n ipconfig_data = `ipconfig /all`\n match_result = ipconfig_data.match(/DHCP Server.*\\: (\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})/)\n unless match_result.nil? || match_result[1].nil?\n return match_result[1]\n end\n # it may take time to resolve the DHCP Server for this instance, so sleepy wait.\n logger.info(\"ipconfig /all did not contain any DHCP Servers. Retrying in 10 seconds...\")\n sleep 10\n end\n else\n leases_file = %w{/var/lib/dhcp/dhclient.eth0.leases /var/lib/dhcp3/dhclient.eth0.leases /var/lib/dhclient/dhclient-eth0.leases /var/lib/dhclient-eth0.leases /var/lib/dhcpcd/dhcpcd-eth0.info}.find{|dhcpconfig| File.exist?(dhcpconfig)}\n unless leases_file.nil?\n lease_file_content = File.read(leases_file)\n\n dhcp_lease_provider_ip = lease_file_content[/DHCPSID='(\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})'/, 1]\n return dhcp_lease_provider_ip unless dhcp_lease_provider_ip.nil?\n\n # leases are appended to the lease file, so to get the appropriate dhcp lease provider, we must grab\n # the info from the last lease entry.\n #\n # reverse the content and reverse the regex to find the dhcp lease provider from the last lease entry\n lease_file_content.reverse!\n dhcp_lease_provider_ip = lease_file_content[/(\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}) reifitnedi-revres-pchd/, 1]\n return dhcp_lease_provider_ip.reverse unless dhcp_lease_provider_ip.nil?\n end\n end\n # no known defaults so we must fail at this point.\n raise \"Cannot determine dhcp lease provider for cloudstack instance\"\n end", "def status\n\t\treturn @status\n\tend", "def get_Status()\n \t return @outputs[\"Status\"]\n \tend", "def status\n info[\"Status\"]\n end", "def get_network_device_wireless_status(options = {})\r\n # Validate required parameters.\r\n validate_parameters(\r\n 'network_id' => options['network_id'],\r\n 'serial' => options['serial']\r\n )\r\n # Prepare query url.\r\n _path_url = '/networks/{networkId}/devices/{serial}/wireless/status'\r\n _path_url = APIHelper.append_url_with_template_parameters(\r\n _path_url,\r\n 'networkId' => options['network_id'],\r\n 'serial' => options['serial']\r\n )\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body) unless\r\n _context.response.raw_body.nil? ||\r\n _context.response.raw_body.to_s.strip.empty?\r\n decoded\r\n end", "def status\n @status\n end", "def status\n @status\n end", "def get_status\n @connection.get(\"/\").body\n end", "def read_guest_ip_prlctl\n vm_info = json { execute_prlctl('list', @uuid, '--full', '--json') }\n ip = vm_info.first.fetch('ip_configured', '')\n ip == '-' ? '' : ip\n end", "def get_status status_code\n status = STATUSES[status_code]\n if status\n status\n else\n status = STATUSES['IV']\n end\n end", "def db_instance_status\n data[:db_instance_status]\n end", "def get_locator_led_status(handle:, **kwargs)\n led_mo = nil\n led_status = String.new\n if _is_valid_arg(\"chassis_id\", kwargs)\n led_mo = _get_chassis_locator_led_state(handle, kwargs)\n end\n\n if _is_valid_arg(\"server_id\", kwargs) or \\\n handle.platform == IMC_PLATFORM::TYPE_CLASSIC\n led_mo = _get_server_locator_led_state(handle, kwargs)\n end\n if !led_mo.nil?\n led_status = led_mo.oper_state\n end\n return led_status\nend", "def status\n STATUSES[self.status_id]\n end", "def health_check\n JSON.parse(@client.get('status').body)\n end", "def get_deploy_target_status\n status = %x{ssh -o ConnectTimeout=5 #{Deployinator.deploy_host} uptime | awk '{print $2}' }.rstrip\n if status != 'up'\n status = \"<b>DOWN!</b>\"\n end\n \"#{Deployinator.deploy_host} is #{status}\"\n end", "def status\n status = stats.fetch @resource[:name], nil\n debug \"Got status: '#{status}'\"\n return :absent unless status\n return :present if [:present, :absent].include? @resource[:ensure]\n return :up if status == 'UP'\n return :down if status == 'DOWN'\n :present\n end", "def status\n data.status\n end", "def wifi_status\n\n # initialize return hash\n return_hash = {}\n \n # run iwconfig utility\n wifi_status = `iwconfig`\n \n # check current wifi ssid\n return_hash[:current_ssid] = wifi_status.match(/ESSID:.+?\\n/).to_s[6..-1].strip.gsub('\"', '') # remove quotes\n \n # return false if no connection\n return false if return_hash[:current_ssid] == \"off/any\"\n \n # get remaining params\n return_hash[:frequency] = wifi_status.match(/Frequency:\\S+? GHz/).to_s[10..-1].strip\n return_hash[:mac] = wifi_status.match(/Access Point: \\S{2}(:\\S{2}){5}/).to_s[12..-1].strip\n return_hash[:quality] = wifi_status.match(/Quality=\\S+?\\s/).to_s[8..-1].strip\n return_hash[:signal] = wifi_status.match(/Signal level=.+?\\n/).to_s[13..-1].strip\n \n return return_hash\nend", "def acquire_maintenance_data\n result = Diplomat::Health.node(config[:node]).select do |check|\n check['CheckID'] == '_node_maintenance'\n end\n if !result.empty?\n { enabled: true, reason: result.first['Notes'] }\n else\n { enabled: false, reason: nil }\n end\n rescue Faraday::ConnectionFailed => e\n warning \"Connection error occurred: #{e}\"\n rescue Faraday::ClientError => e\n if e.response[:status] == 403\n critical %(ACL token is not authorized to access resource: #{e.response[:body]})\n else\n unknown \"Exception occurred when checking consul service: #{e}\"\n end\n rescue StandardError => e\n unknown \"Exception occurred when checking consul node maintenance: #{e}\"\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status(address, options = {})\n StatusDatagram.new(address, @options.merge(options))\n end" ]
[ "0.6808077", "0.6267389", "0.6238432", "0.6195908", "0.6152561", "0.610695", "0.6074891", "0.60657024", "0.6051591", "0.6026054", "0.5983046", "0.59187996", "0.58491516", "0.58484167", "0.58290845", "0.5809957", "0.5771963", "0.5771963", "0.57662857", "0.57662857", "0.57662857", "0.57662857", "0.57525957", "0.57521254", "0.5737801", "0.572183", "0.57197577", "0.5708855", "0.5671702", "0.5662006", "0.56491154", "0.5629685", "0.5596522", "0.5590433", "0.55722106", "0.5564961", "0.5558968", "0.55472517", "0.5543404", "0.55327785", "0.5527583", "0.55223584", "0.5515423", "0.550731", "0.55049103", "0.5504205", "0.5496716", "0.54874414", "0.548428", "0.5477331", "0.5471838", "0.5467711", "0.5464977", "0.5462645", "0.54538906", "0.54500806", "0.5444858", "0.54386973", "0.54317635", "0.54311556", "0.5426982", "0.54217184", "0.54217184", "0.5421571", "0.54189825", "0.54103464", "0.5408549", "0.54073566", "0.5398837", "0.5397382", "0.539675", "0.5394416", "0.53934485", "0.5381954", "0.5380647", "0.53806263", "0.538051", "0.538051", "0.538051", "0.538051", "0.538051", "0.538051", "0.538051", "0.538051", "0.538051", "0.538051", "0.538051", "0.538051", "0.538051", "0.538051", "0.538051", "0.538051", "0.538051", "0.538051", "0.538051", "0.538051", "0.538051", "0.538051", "0.538051", "0.537169" ]
0.6974938
0
Returns the gateway used
def gateway @attributes.fetch('gateway', nil) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gateway\n self.class.gateway\n end", "def gateway\n @config[:gateway]\n end", "def gateway\n if @@gateway\n return @@gateway if @@gateway.is_a? ActiveMerchant::Billing::Gateway\n @@gateway = @@gateway.to_s.classify.constantize.gateway\n else\n Gateway.default_gateway\n end\n end", "def gateway_name\n gateway[:name]\n end", "def inspect; 'GATEWAY'; end", "def payment_gateway_type\n gateway_setting.gateway_type\n end", "def gateway\n relation.gateway\n end", "def gateway\n begin\n \"#{self.service_name}Gateway\".classify.gateway(self.config_file_name)\n rescue\n self.class.gateway(self.config_file_name)\n end\n end", "def default_gw_ipaddr\n ip = case `/bin/uname -s`.rstrip\n when 'Linux'\n `/sbin/ip route get 8.8.8.8`.split(\"\\n\")[0].split.last\n when 'SunOS'\n `/sbin/ifconfig $(/usr/sbin/route -n get 1.1.1.1 | awk '$1 == \"interface:\" {print $2}') | awk '$1 == \"inet\" { print $2 }'`\n else\n raise \"Unsupported platform to detect gateway IP address: #{`/bin/uname`}\"\n end\n ip = ip.rstrip\n raise \"Failed to run command lines or empty result\" if ip == '' || $?.exitstatus != 0\n ip\n end", "def gateway?\n context.transport_manager.gateways.include?(self)\n end", "def gateway\n @gateway ||= PAYMENT_CLASS.new(\n :login => PAYMENT_LOGIN,\n :password => PAYMENT_PASSWORD,\n :signature => PAYMENT_SIGNATURE # Ignored for some gateway types; see \"config/payment_gateway.yml\"\n )\n end", "def gateway_url\n if sandbox?\n GATEWAY_SANDBOX_URL\n else\n GATEWAY_URL\n end\n end", "def gw(gw = nil)\n if gw\n @gw = @salticid.host(gw)\n else\n @gw\n end\n end", "def gateway_class\n @gateway_class ||= \"Webapps::Gateway::#{self.class.name.split('::').last}::#{@gateway_type.titleize}\".constantize\n end", "def tunnel\n if gw\n # We have a gateway host.\n @tunnel ||= gw.gateway_tunnel\n end\n end", "def gateway\n raise 'No Gateway secret configured' unless ENV['GATEWAY_SECRET_KEY']\n ChargeIO::Gateway.new(\n :site => ENV['GATEWAY_URI'],\n :secret_key => ENV['GATEWAY_SECRET_KEY']\n )\n end", "def gateway_url\n if developer?\n File.join \"/pagseguro_developer/create\"\n else\n GATEWAY_URL\n end\n end", "def payment_gateway\n return Spree::BogusGateway.new if ENV['RAILS_ENV'] == \"development\" and Spree::Gateway::Config[:use_bogus]\n\n # retrieve gateway configuration from the database\n gateway_config = GatewayConfiguration.find :first\n config_options = {}\n gateway_config.gateway_option_values.each do |option_value|\n key = option_value.gateway_option.name.to_sym\n config_options[key] = option_value.value\n end\n gateway = gateway_config.gateway.clazz.constantize.new(config_options)\n\n return gateway\n end", "def gateway_client\n @gateway_client ||= get_gateway_client({client_id: @client_id, gateway_type: gateway_type})\n end", "def gateway(arg=nil)\n set_or_return(:gateway, arg, :kind_of => String)\n end", "def payment_gateway_server\n if defined?(::PAYMENT_GATEWAY)\n ::PAYMENT_GATEWAY\n else\n ActiveMerchant::Billing::Base.mode = (['production', 'staging'].include?(ENV['RAILS_ENV']) ? :production : :test)\n ActiveMerchant::Billing::AuthorizeNetGateway.new(\n :login => AUTH_NET_LOGIN, # global constants from environment file\n :password => AUTH_NET_TXN_KEY,\n :test => ['production', 'staging'].include?(ENV['RAILS_ENV'])\n )\n end\n end", "def cim_gateway\n @provider\n end", "def gateway(token)\n request(\n __method__,\n :get,\n \"#{api_base}/gateway\",\n Authorization: token\n )\n end", "def gateway(token)\n request(\n __method__,\n :get,\n \"#{api_base}/gateway\",\n Authorization: token\n )\n end", "def gateway_credentials\n gateway[:credentials]\n end", "def gateway(a_config_file_name=nil)\n unless @@gateway\n payflow_pro_config = config(a_config_file_name)\n gw = ActiveMerchant::Billing::PayflowGateway.new({\n :login => @@payflow_pro_login,\n :password => @@payflow_pro_password,\n :partner => @@payflow_pro_partner,\n :certification_id => @@payflow_pro_certification_id\n }.merge(payflow_pro_config[:mode] == 'test' ? { :test => true } : {}))\n else\n gw = @@gateway\n end\n gw\n end", "def payment_gateway_options\n gateway_setting.symbolized_settings\n end", "def is_gateway?(pool)\n dt = DeviceType.find(:first, :include => :serial_number_prefixes, \n :conditions => \"serial_number_prefixes.prefix = '#{pool.starting_serial_number[0,3]}'\")\n if dt.nil?\n throw \"no row in serial_number_prefixes table for prefix #{pool.starting_serial_number[0,3]}\"\n else\n return dt.mac_address_type == 1\n end\n end", "def adapter_for(gateway)\n @gateway_map.fetch(gateways[gateway])\n end", "def network\n lines, errs = networksetup(\"getairportnetwork #{options[:device_id]}\")\n lines.join('\\n') =~ /Current Wi-Fi Network: (.+)$/i\n $1\n end", "def request_public_gateway(network_options, interface, env)\n subnet = IPAddr.new(network_options[:subnet])\n gateway = nil\n while !gateway\n gateway = env[:ui].ask(I18n.t(\n \"docker_provider.network_bridge_gateway_request\",\n interface: interface,\n default_gateway: network_options[:gateway]) + \" \",\n prefix: false\n ).strip\n if gateway.empty?\n gateway = network_options[:gateway]\n end\n begin\n gateway = IPAddr.new(gateway)\n if !subnet.include?(gateway)\n env[:ui].warn(I18n.t(\"docker_provider.network_bridge_gateway_outofbounds\",\n gateway: gateway,\n subnet: network_options[:subnet]) + \"\\n\", prefix: false)\n end\n rescue IPAddr::InvalidAddressError\n env[:ui].warn(I18n.t(\"docker_provider.network_bridge_gateway_invalid\",\n gateway: gateway) + \"\\n\", prefix: false)\n gateway = nil\n end\n end\n gateway.to_s\n end", "def gateway(file_name=nil)\n unless @@gateway\n authorize_net_config = config(file_name)\n @@gateway = ActiveMerchant::Billing::AuthorizeNetGateway.new({\n :login => authorize_net_config[:login_id],\n :password => authorize_net_config[:transaction_key]\n }.merge(authorize_net_config[:mode] == 'test' ? { :test => true } : {}))\n end\n @@gateway\n end", "def gateway_type\n fail 'unimplemented method gateway_type'\n end", "def get_next_hop\n return @m_next_hop\n end", "def gateway(gateway)\n @options[:gateway] = gateway\n end", "def get_gateway_by_id(gateway_id)\r\n valid_id?(gateway_id)\r\n url = CLX.paths[:gateway] + '/' + gateway_id.to_s\r\n @http_client.get(url)\r\n end", "def delivery_gateway\n super ||\n static_gateway && \"::StaticGateway::#{static_gateway}\".safe_constantize&.new\n end", "def net\n @net\n end", "def gateway\n Braintree::Gateway.new(\n environment: :sandbox,\n merchant_id: ENV['BRAINTREE_MERCHANT_ID'],\n public_key: ENV['BRAINTREE_PUBLIC_KEY'],\n private_key: ENV['BRAINTREE_PRIVATE_KEY']\n )\n end", "def prepare_gateway\n ActiveMerchant::Billing::Base.mode = gateway_mode\n begin\n @gateway = ActiveMerchant::Billing.const_get(\"#{gateway_name}Gateway\").new(gateway_credentials)\n @result[:gateway] = true\n end\n @result[:gateway]\n end", "def gateway_mode\n @config[:test].present? ? :test : :production\n end", "def routing\n if Vagrant::Util::Platform.darwin?\n @gateway = `route -n get default | grep 'gateway' | awk '{print $2}'`.delete(\"\\n\")\n elsif Vagrant::Util::Platform.linux?\n # Not tested\n @gateway = `ip route show`[/default.*/][/\\d+\\.\\d+\\.\\d+\\.\\d+/]\n end\n\n $vagrant.vm.provision :shell,\n run: \"always\",\n path: File.join(__dir__, \"../\", \"/utils/routing.py\"),\n args: \"#{@gateway}\"\n end", "def gateway_error\n message\n end", "def get_prefered_network_address\n return self.network_addr_ext\n # return (self.network_addr_int.blank?) ? self.network_addr_ext : self.network_addr_int\n #return ( Rails.env == 'production' && !self.network_addr_int.blank?) ? self.network_addr_int : self.network_addr_ext \n end", "def gateway\n ActiveMerchant::Billing::Base.mode = :test\n\n @gateway ||= \n ActiveMerchant::Billing::PaypalRecurringGateway.new(\n :login => 'nk_tes_1218714620_biz_api1.mail.ru',\n :password => '1218714626',\n :signature => 'An5ns1Kso7MWUdW4ErQKJJJ4qi4-A-b1ANj9g14qW6XOboBut7nnhDdn'\n )\n @gateway\n end", "def find_or_build_gateway_setting\n (payment_gateway_setting || build_payment_gateway_setting)\n end", "def provider_payment_gateway\n provider_account&.payment_gateway(sca: payment_detail.payment_method_id.present?)\n end", "def mg_lan_settings\r\n MGLANSettingsController.instance\r\n end", "def gateway_error_code\n nil\n end", "def mg_dhcp_settings\r\n MGDHCPSettingsController.instance\r\n end", "def gateway(*args)\n begin\n @gateway ||= self.class.gateway(*args)\n rescue Exception => x\n payment_errors[:gateway] = x.message\n public_payment_errors[:gateway] = 'failed to initialize'\n end\n end", "def info_by_gateway(_params, _gateway)\n _keys = case _gateway\n when :paysto\n ['PAYSTO_SUM', 'PAYSTO_INVOICE_ID', 'PAYSTO_SHOP_ID', 'PAYSTO_DESC', 'PAYSTO_TTL', 'PAYSTO_PAYMENT_ID', 'PAYSTO_REQUEST_MODE']\n else\n []\n end\n\n _keys.map do |_key|\n [_key, _params[_key.to_sym]].join(':')\n end.join(';')\n end", "def info_by_gateway(_params, _gateway)\n _keys = case _gateway\n when :paysto\n ['PAYSTO_SUM', 'PAYSTO_INVOICE_ID', 'PAYSTO_SHOP_ID', 'PAYSTO_DESC', 'PAYSTO_TTL', 'PAYSTO_PAYMENT_ID', 'PAYSTO_REQUEST_MODE']\n else\n []\n end\n\n _keys.map do |_key|\n [_key, _params[_key.to_sym]].join(':')\n end.join(';')\n end", "def gateway_check\n raise \"A gateway connection is necessary to call this method! You'll have to do it inside any event (e.g. `ready`) or after `bot.run :async`.\" unless connected?\n end", "def network\n @network ||= :bitcoin\n end", "def network\n @_network\n end", "def device_ipaddress; end", "def device_ipaddress; end", "def network\n @network ||= Network.default\n end", "def gateway_options\n process_keys\n options = base_options\n\n config.proxy_port.nil? or options.merge!(:port => config.proxy_port)\n config.proxy_password.nil? or options.merge!(:password => config.proxy_password)\n config.proxy_keys.nil? or options.merge!(:keys => config.proxy_keys)\n\n config.ui.logger.debug { \"gateway_options(#{options.inspect})\" }\n options\n end", "def payment_gateway_type=(type)\n gateway_setting.gateway_type = type\n end", "def wn_dmtu\n get_link(link='dmtu')\n end", "def minimal_gateway_options\n {:email => order.user.email, \n :customer => order.user.email, \n :ip => order.ip_address, \n :order_id => order.number,\n :shipping => order.ship_amount * 100,\n :tax => order.tax_amount * 100, \n :subtotal => order.item_total * 100} \n end", "def settings\n self.network[self.class]\n end", "def gateway_check\n return if connected?\n\n raise \"A gateway connection is necessary to call this method! You'll have to do it inside any event (e.g. `ready`) or after `bot.run :async`.\"\n end", "def detect_reachable_ip\n if RUBY_VERSION >= \"1.9.2\"\n require 'socket'\n possible_ips = Socket.ip_address_list.reject { |ip| !ip.ipv4? || ip.ipv4_loopback? }\n return possible_ips.first.ip_address unless possible_ips.empty?\n end\n if detect_os[:platform] == \"windows\"\n output = `ipconfig`\n ip_regex = /IP(?:v4)?.*?([0-9]+(?:\\.[0-9]+){3})/i\n gateway_regex = /Gateway[^0-9]*([0-9]+(?:\\.[0-9]+){3})?/i\n ip_matches = output.split(/\\n/).select { |s| s =~ ip_regex }\n gateway_matches = output.split(/\\n/).select { |s| s =~ gateway_regex }\n possible_ips = ip_matches.zip(gateway_matches)\n possible_ips.map! do |ip,gateway|\n [ip.match(ip_regex)[1], gateway.match(gateway_regex)[1]]\n end\n possible_ips.reject! { |ip,gateway| ip == \"127.0.0.1\" || gateway.nil? }\n return possible_ips[0][0]\n elsif ENV['SSH_CONNECTION']\n return ENV['SSH_CONNECTION'].split(/\\s+/)[-2]\n else\n if Pathname.which(\"ifconfig\")\n ip_output = `ifconfig -a 2> /dev/null`.chomp\n elsif File.executable?(\"/sbin/ifconfig\")\n ip_output = `/sbin/ifconfig -a 2> /dev/null`.chomp\n else\n ip_output = `ip addr 2> /dev/null`.chomp\n end\n possible_ips = ip_output.scan(/inet (?:addr:)?([0-9\\.]+)/).flatten\n possible_ips.reject! { |ip| ip == \"127.0.0.1\" }\n return possible_ips.first\n end\n end", "def first_hop()\n @hops.find { |hop| !hop.ip.nil? && hop.ip != \"0.0.0.0\" }\n end", "def get_server\n get_general['server']\n end", "def mg_connectivity_monitoring_destinations\r\n MGConnectivityMonitoringDestinationsController.instance\r\n end", "def ogonegateway\n @gateway ||= ActiveMerchant::Billing::OgoneGateway.new(\n :login => opts[:pspid],\n :user => opts[:user],\n :password => opts[:pass],\n # :signature => \"\", # SHA-IN - must match ePDQ account configuration\n :signature_encryptor => \"none\" # Can be \"none\" (default), \"sha1\", \"sha256\" or \"sha512\".\n # Must be the same as the one configured in your Ogone account.\n )\n end", "def hostip\n static_network_config[\"ipAddress\"]\n end", "def gateway_options\n options = { :email => order.email,\n :customer => order.email,\n :ip => order.last_ip_address,\n :order_id => gateway_order_id } # This is the changed line\n\n options.merge!({ :shipping => order.ship_total * 100,\n :tax => order.tax_total * 100,\n :subtotal => order.item_total * 100 })\n\n options.merge!({ :currency => currency })\n\n options.merge!({ :billing_address => order.bill_address.try(:active_merchant_hash),\n :shipping_address => order.ship_address.try(:active_merchant_hash) })\n\n options.merge!(:discount => promo_total) if respond_to?(:promo_total)\n options\n end", "def bhc_used_for_grower_delivery; Account.get(self.bhc_used_for_grower_delivery__c); end", "def bhc_used_for_grower_delivery; Account.get(self.bhc_used_for_grower_delivery__c); end", "def phone\n @phone ||= Phone::Gateway.new(client)\n end", "def get_gandi_ipv4\n get_record('A') if ipv4_available?\n end", "def hop\n @mainChain.hop\n\n end", "def dedicated_ip\n @attributes[:dedicated_ip]\n end", "def get_recommended_value\n get_item( 'cli::network::ipaddress' ).value\n end", "def host\n active_backend.host\n end", "def get_public_ip_address\n get_proxy.get_public_ip_address\n end", "def after_init\n self.gateway ||= \"google\"\n end", "def wireless_settings\r\n WirelessSettingsController.instance\r\n end", "def _gateway_for_ip(ip)\n ip.split('.').tap(&:pop).push(1).join('.')\n end", "def os\n @host\n end", "def [](name)\n gateways.fetch(name)\n end", "def gateway_has_express_support\n gateway().respond_to?( :express )\n end", "def wireless\n @wireless ||= Wireless.new self\n end", "def wireless\n @wireless ||= Wireless.new self\n end", "def network\n cidr.network.to_s\n end", "def get_carrier\n return self.sendcmd(\"modem.get_carrier\")\n end", "def network\n TestLab::Utility.network(self.address)\n end", "def last_hop_pool\n super\n end", "def nic\n a = execute_wmi_query(\"select * from Win32_NetworkAdapterConfiguration where InterfaceIndex='#{adapter.InterfaceIndex}'\")\n wmi_object_array(a).first\n end", "def used_ips\n @used_ips ||= Host.used_ips\n end", "def network_configuration\n dns = settings.provider.network.dns\n dns = dns.split(\",\") if dns.is_a?(String)\n {\n \"ip\"=>public_ip,\n \"netmask\"=>settings.provider.network.netmask,\n \"gateway\"=>settings.provider.network.gateway,\n \"dns\"=>dns,\n \"cloud_properties\"=>{\n \"name\"=>settings.provider.network.name\n }\n }\n end", "def get_zapp_server\n return self.plant_attributes[self.plant.intern][self.env.intern][:host], self.plant_attributes[self.plant.intern][self.env.intern][:soap_port]\n end", "def payment_gateway(**options)\n return if payment_gateway_type.blank?\n\n PaymentGateway.implementation(payment_gateway_type, options).new(payment_gateway_options || {})\n end", "def cr_network_config\n @node[\"network\"]\n end", "def connection_factory\n @connection_factory ||= begin\n if exists?(:gateway)\n logger.debug \"establishing connection to gateway `#{fetch(:gateway).inspect}'\"\n GatewayConnectionFactory.new(fetch(:gateway), self)\n else\n DefaultConnectionFactory.new(self)\n end\n end\n end" ]
[ "0.82660246", "0.82635844", "0.77210945", "0.770198", "0.7528919", "0.73281276", "0.7274262", "0.7189334", "0.7007405", "0.6917774", "0.6885537", "0.6833338", "0.68140954", "0.6789828", "0.6786159", "0.66711706", "0.66595435", "0.6642318", "0.6640139", "0.6520583", "0.65199417", "0.6389478", "0.6366115", "0.6366115", "0.6338971", "0.6272081", "0.6262581", "0.62506926", "0.6249895", "0.61992306", "0.61957496", "0.61775005", "0.6162245", "0.61579293", "0.6151492", "0.61212766", "0.60437685", "0.6041055", "0.6001055", "0.59541404", "0.59214866", "0.58892226", "0.58837616", "0.5809949", "0.57584125", "0.5693639", "0.5687685", "0.5670561", "0.565669", "0.56389123", "0.56292194", "0.5614035", "0.5614035", "0.5586263", "0.55843204", "0.5569783", "0.55666214", "0.55666214", "0.5563245", "0.5562282", "0.5552496", "0.5549603", "0.5544358", "0.55410063", "0.5499472", "0.54740644", "0.54514885", "0.54484737", "0.5445945", "0.5442035", "0.5433286", "0.53862303", "0.5383417", "0.5383417", "0.5376219", "0.53460443", "0.5345644", "0.53348887", "0.5332997", "0.5324015", "0.5323235", "0.53187245", "0.5317225", "0.53150636", "0.5310664", "0.53080785", "0.529062", "0.5289109", "0.5289109", "0.52746284", "0.5272836", "0.5263107", "0.52556235", "0.52342075", "0.5212762", "0.52107114", "0.5201586", "0.51925087", "0.51923627", "0.519148" ]
0.8059231
2
Returns the IP Address of the bridge
def ipaddress @attributes.fetch('ipaddress', nil) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ip_address\n Socket.ip_address_list.find { |ai| ai.ipv4? && !ai.ipv4_loopback? }.ip_address\n end", "def overlay_ip\n self.overlay_cidr.split('/')[0] if self.overlay_cidr\n end", "def device_ipaddress; end", "def device_ipaddress; end", "def get_internal_ip_address\r\n sock = UDPSocket.new\r\n sock.connect('1.0.0.1', 1) #@igd_location.split('//').last.split('/').first.split(':').first\r\n return sock.addr.last\r\n rescue Exception\r\n return \"127.0.0.1\"\r\n end", "def local_ip_address\n conf['base_address'] ||\n %x{ip addr show #{conf['base_interface'] || 'br0'} | grep inet}.split(' ')[1].to_s.strip.split('/').first.to_s\nend", "def get_ip_address\n rpc_get_fact_direct('host_ip')\n end", "def ip\n if ifconfig =~ /inet addr:([0-9.]+)/\n $1\n else\n \"0.0.0.0\"\n end\n end", "def ipaddress\n @network_payload['IP']\n end", "def hostip\n static_network_config[\"ipAddress\"]\n end", "def host_ip\n Socket.gethostbyname(@backend.host)[3].unpack('CCCC') rescue [0, 0, 0, 0]\n end", "def ip\n ssh.exec!(\"/sbin/ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'\").chomp\n end", "def ip\n TestLab::Utility.ip(self.address)\n end", "def ip_address; end", "def ip_address; end", "def ip_address; end", "def ip_address; end", "def ip_address; end", "def ip_address; end", "def ip\n @ip ||= Socket.ip_address_list.detect{|intf| intf.ipv4_private?}.ip_address\n end", "def ipaddress\n config[\"ipaddress\"]\n end", "def ip_address(env)\n ip_address_record(env)[:address]\n end", "def to_ipaddr\n unless ip_addr?\n lookup = `host #{to_s} | grep address`.split(/\\s+/)\n return to_s unless lookup.length == 4\n lookup[3]\n else \n to_s\n end\n end", "def detect_reachable_ip\n if RUBY_VERSION >= \"1.9.2\"\n require 'socket'\n possible_ips = Socket.ip_address_list.reject { |ip| !ip.ipv4? || ip.ipv4_loopback? }\n return possible_ips.first.ip_address unless possible_ips.empty?\n end\n if detect_os[:platform] == \"windows\"\n output = `ipconfig`\n ip_regex = /IP(?:v4)?.*?([0-9]+(?:\\.[0-9]+){3})/i\n gateway_regex = /Gateway[^0-9]*([0-9]+(?:\\.[0-9]+){3})?/i\n ip_matches = output.split(/\\n/).select { |s| s =~ ip_regex }\n gateway_matches = output.split(/\\n/).select { |s| s =~ gateway_regex }\n possible_ips = ip_matches.zip(gateway_matches)\n possible_ips.map! do |ip,gateway|\n [ip.match(ip_regex)[1], gateway.match(gateway_regex)[1]]\n end\n possible_ips.reject! { |ip,gateway| ip == \"127.0.0.1\" || gateway.nil? }\n return possible_ips[0][0]\n elsif ENV['SSH_CONNECTION']\n return ENV['SSH_CONNECTION'].split(/\\s+/)[-2]\n else\n if Pathname.which(\"ifconfig\")\n ip_output = `ifconfig -a 2> /dev/null`.chomp\n elsif File.executable?(\"/sbin/ifconfig\")\n ip_output = `/sbin/ifconfig -a 2> /dev/null`.chomp\n else\n ip_output = `ip addr 2> /dev/null`.chomp\n end\n possible_ips = ip_output.scan(/inet (?:addr:)?([0-9\\.]+)/).flatten\n possible_ips.reject! { |ip| ip == \"127.0.0.1\" }\n return possible_ips.first\n end\n end", "def public_ip_address\n public_ip_addresses.first\n end", "def remote_ip\n get_peername[2,6].unpack('nC4')[1..4].join('.')\n end", "def address(public_ip)\n addresses(public_ip)[0]\n end", "def get_public_ip()\n return open('http://ipinfo.io/ip').read.chomp\n end", "def ip\n TestLab::Utility.ip(self.address)\n end", "def ip\n if (ip = @host.at('tag[name=host-ip]'))\n ip.inner_text\n end\n end", "def get_ip_address(machine)\n ip = nil\n unless @rs.ignore_private_ip\n machine.config.vm.networks.each do |network|\n key, options = network[0], network[1]\n ip = options[:ip] if key == :private_network\n next if ip\n end\n end\n\n ip || machine.ssh_info[:host]\n end", "def remote_ip; end", "def get_ipaddress(asset_tag=asset_tag, pool)\n @connection.ipaddress_allocate!(asset_tag, pool, count = 1)\n end", "def get_public_ip_address\n get_proxy.get_public_ip_address\n end", "def get_ip(node)\n provisioning.ipaddress(node)\n end", "def read_host_ip\n ip = read_machine_ip\n base_ip = ip.split(\".\")\n base_ip[3] = \"1\"\n base_ip.join(\".\")\n end", "def get_ip_address\n request.remote_ip\n end", "def peer_ip; end", "def get_public_ip_address\n rpc_get_fact_direct('public_ip')\n end", "def default_gw_ipaddr\n ip = case `/bin/uname -s`.rstrip\n when 'Linux'\n `/sbin/ip route get 8.8.8.8`.split(\"\\n\")[0].split.last\n when 'SunOS'\n `/sbin/ifconfig $(/usr/sbin/route -n get 1.1.1.1 | awk '$1 == \"interface:\" {print $2}') | awk '$1 == \"inet\" { print $2 }'`\n else\n raise \"Unsupported platform to detect gateway IP address: #{`/bin/uname`}\"\n end\n ip = ip.rstrip\n raise \"Failed to run command lines or empty result\" if ip == '' || $?.exitstatus != 0\n ip\n end", "def external_ip\n begin\n ip = OpenURI.open_uri(\"http://myip.dk\") {|f|f.read.scan(/([0-9]{1,3}\\.){3}[0-9]{1,3}/); $~.to_s}\n rescue\n ip = local_ip\n puts \"Seems like there is a problem adquiring external IP address, ...using local address: (#{ip})\"\n end\n ip\n end", "def remote_i_p_address\n return @remote_i_p_address\n end", "def get_ip_address\n items = `ifconfig | grep \"inet addr\"`.split\n addresses = []\n items.each do |item|\n addresses << item if item =~ /addr:/\n end\n ip = \"\"\n addresses.each do |address|\n ip = address.split(':')[1]\n if ip != '127.0.0.1'\n break\n end\n end\n ip\nend", "def ipaddr?; end", "def get_external_ip_address\r\n return debug('No WAN Service') unless @wan_service\r\n hash = send_action(@wan_service, 'GetExternalIPAddress', {})\r\n return hash if(hash[:is_error])\r\n return nil unless(hash[:has_xml])\r\n return hash[:xml].get_text('NewExternalIPAddress')\r\n end", "def get_ip_address \t\t\t\n\t\trequest.remote_ip \n\tend", "def ip_first\n NetAddr::CIDR.create(cidr_obj.to_i(:network) + 2).ip\n end", "def ip\n self.IP\n end", "def get_ip(node)\n return node['network_adapters'].select { |n|\n n['mounted'] && n['device'] =~ /eth/\n }[0]['ip']\nend", "def GetSubnet()\n \"192.168.3.0/24\"\n end", "def ip_address\n nil\n end", "def ipaddr; end", "def public_ip\n get('tools/public_ip').body['ipv4'] || get('tools/public_ip').body['ipv6']\n end", "def name\n ip_address\n end", "def public_ip\n @public_ip ||= ssh.exec!(\"curl -s ip.appspot.com\").chomp\n end", "def ip\n container.json['NetworkSettings']['IPAddress'] || 'N/A'\n rescue NoMethodError\n 'N/A'\n end", "def peer_ip\n peername[0]\n end", "def public_ip_address\n data[:public_ip_address]\n end", "def getIp()\n return @ip\n\tend", "def fetch_primary_ip_address\n capture(<<-GETADDR, :shell => \"bash\").chomp\n _if=\"$(netstat -nr | grep ^0\\.0\\.0\\.0 | awk '{print $8}')\";\n _ip=\"$(/sbin/ifconfig $_if | \\\n grep '^[[:space:]]*inet ' | awk '{print $2}' | \\\n awk -F':' '{print $2}')\";\n\n if [ -z \"$_ip\" -o \"$_ip\" == \"\" ] ; then\n echo \"\";\n return 10;\n else\n echo $_ip;\n fi\n GETADDR\nend", "def GetSubnet()\n \"192.168.0.0/16\"\n end", "def GetSubnet()\n \"192.168.0.0/16\"\n end", "def remote_address\n socket_address\n rescue Exception => e\n log_error('Could not infer remote address', e)\n nil\n end", "def ip_by_interface(int)\n ip = `ifconfig #{int} | awk '/inet addr/ {split ($2,A,\":\"); print A[2]}'`.chomp\n return ip\n end", "def abs_adr(ip)\n Verneuil::Address.new(ip, self)\n end", "def current_ip(inter)\n net_info = `ifconfig`\n section_index = net_info.index(inter)\n line_index = net_info.index('inet', section_index)\n ip_address = net_info[line_index..-1].match(/\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}/)[0]\n return ip_address\nend", "def public_ip_v4_address; end", "def address_for(network); end", "def device_ipaddress=(_arg0); end", "def device_ipaddress=(_arg0); end", "def remote_ip\n if request.remote_ip == '127.0.0.1'\n # Hard coded remote address\n '18.228.1.115'\n else\n request.remote_ip\n end\n end", "def private_ip_address\n private_ip_addresses.first\n end", "def ip_address\n # Does not work for now as the vmx path is not escape correctly by fission 0.4.0\n #return raw.network_info.data.first['ip_address']\n raise ::Fission::Error,\"VM #{name} does not exist\" unless self.exists?\n \n # Use alternate method to retrieve the IP address using vmrun readVariable\n \n ip_address = shell_exec(\"vmrun readVariable \\\"#{vmx_file_path}\\\" guestVar ip\", { :mute => true})\n return ip_address.stdout.strip\n \n # unless mac_address.nil?\n # lease = Fission::Lease.find_by_mac_address(mac_address).data\n # return lease.ip_address unless lease.nil?\n # return nil\n # else\n # # No mac address was found for this machine so we can't calculate the ip-address\n # return nil\n # end\n end", "def get_ip(node)\n node['network_adapters'].each { |device, network_adapter|\n if network_adapter['mounted'] && /^eth[0-9]$/.match(device)\n return network_adapter['ip']\n end\n }\nend", "def read_host_ip(machine,env)\n nets = env[:libvirt_compute].list_networks\n if nets.size == 1\n net = nets.first\n else\n domain = env[:libvirt_compute].servers.get(machine.id.to_s)\n xml=Nokogiri::XML(domain.to_xml)\n networkname = xml.xpath('/domain/devices/interface/source').first.attributes['network'].value.to_s\n puts \"network name = #{networkname}\"\n net = env[:libvirt_compute].list_networks.find {|netw| netw[:name] == networkname}\n end\n # FIXME better implement by libvirt xml parsing\n `ip addr show | grep -A 2 #{net[:bridge_name]} | grep -i 'inet ' | tr -s ' ' | cut -d' ' -f3 | cut -d'/' -f 1`.chomp\n end", "def ip\n orig, Socket.do_not_reverse_lookup = Socket.do_not_reverse_lookup, true # turn off reverse DNS resolution temporarily\n UDPSocket.open do |s|\n s.connect '64.233.187.99', 1\n s.addr.last\n end\n ensure\n Socket.do_not_reverse_lookup = orig\n end", "def obtain_ip_from_rails(env)\n env[\"action_dispatch.remote_ip\"].try(:to_s)\n end", "def name\n ip_address\n end", "def ipaddress(node)\n @use_private_ip_for_ssh ? node['ec2']['local_ipv4'] : node['ec2']['public_ipv4']\n end", "def ip_by_interface(int)\n return `ifconfig #{int} | awk '/inet addr/ {split ($2,A,\":\"); print A[2]}'`.chomp\n end", "def local_ip\n UDPSocket.open {|s| s.connect(\"64.233.187.99\", 1); s.addr.last}\n end", "def get_local_ip(network)\n UDPSocket.open do |sock|\n sock.connect network, 1\n sock.addr.last\n end\n end", "def get_nat_ip\n puts \"Getting NAT address\"\n\n # Get first instance with \"nat\" role\n instance = instances_for_role(\"nat\").first[:instances].first\n # Grab the interface that has source_dest_check set to false (most likely interface)\n primary = instance[:network_interfaces].select { |x| x[:source_dest_check] == false }.first\n nat = \"ec2-user@#{primary[:association][:public_ip]}\"\n\n puts \" - #{nat}\"\n nat\n end", "def localIP\r\n @@local_ip_address\r\n end", "def getIP(interface)\n cmd = `ip addr show #{interface}`\n ip = cmd.match(/inet ((\\d{1,3}\\.){3}\\d{1,3})\\/\\d{1,2}/).captures\n @log.debug \"IP of interface '#{interface}' is: #{ip.first}\"\n return ip.first\n end", "def google_ip\n '74.125.47.99'\n end", "def bridge_info bridge_id\n bridge, _headers = get \"bridges/#{bridge_id}\"\n\n Types::Bridge.new bridge\n end", "def ip\n ''\n end", "def get_ip_address\n IO.popen(\"ifconfig\") do |io|\n while line = io.gets\n return $1 if (line =~ /inet addr:([\\d\\.]+)/ and $1 != '127.0.0.1')\n end\n end\n return nil\nend", "def network\n cidr.network.to_s\n end", "def ip_v4_address; end", "def ip; end", "def ip; end", "def extract_ip(addrinfo)\n addrinfo[2]\n end", "def ip_address\n @ip_address ||= nil\n end", "def public_ip() ; info[:public_ip] ; end", "def ip\n @data[\"ip\"]\n end", "def bcast_info\n Socket.getifaddrs.map do |iface|\n next unless iface.addr.ipv4?\n\n output = iface.name + ':' + iface.inspect\n int = ('Address:' + ' ' + output.split[1] + ' ' + output.split[3..4].to_s)\n puts int.gsub('?', '0')\n end\nend", "def to_addr\n return p2pkh_addr if p2pkh?\n return p2sh_addr if p2sh?\n return cp2pkh_addr if cp2pkh?\n return cp2sh_addr if cp2sh?\n nil\n end", "def to_s\n return @ip\n end" ]
[ "0.7382364", "0.71301305", "0.707261", "0.707261", "0.70624185", "0.7030781", "0.70197886", "0.7019692", "0.6991711", "0.69880766", "0.6934328", "0.69120157", "0.6874393", "0.6870039", "0.6870039", "0.6870039", "0.6870039", "0.6870039", "0.6870039", "0.6866328", "0.6854047", "0.6807263", "0.67940927", "0.6791254", "0.6785111", "0.67789567", "0.6751591", "0.6736971", "0.66713214", "0.66524065", "0.6638151", "0.6636645", "0.66190606", "0.66053504", "0.6578626", "0.6516119", "0.650755", "0.65016395", "0.6497766", "0.6480982", "0.6480327", "0.6479392", "0.647705", "0.64677954", "0.6465668", "0.64496654", "0.6442872", "0.6427471", "0.6426773", "0.6421883", "0.6415409", "0.64125925", "0.6410243", "0.6408302", "0.6406551", "0.6405911", "0.640453", "0.63993233", "0.6398612", "0.6387033", "0.6384489", "0.6384489", "0.6374191", "0.6373723", "0.63710034", "0.63709533", "0.6360641", "0.63577056", "0.6341157", "0.6341157", "0.6338759", "0.6322232", "0.63209325", "0.6312188", "0.6305525", "0.63024545", "0.629657", "0.62961924", "0.6287663", "0.6286232", "0.6262658", "0.6252333", "0.62450266", "0.6243926", "0.62405896", "0.62293684", "0.6224123", "0.62227434", "0.6220013", "0.62149173", "0.6211009", "0.62108994", "0.62108994", "0.62079805", "0.6194735", "0.6186681", "0.61752796", "0.6174409", "0.61735237", "0.6166991" ]
0.62178695
89
Returns the UTC timestamp
def utc @attributes.fetch('UTC', nil) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getutc() end", "def getutc\n return Time.at(self).utc\n end", "def to_utc_time\n Time.utc(1970, 1, 1, @hour, @minute, @second)\n end", "def datetime_stamp\n Time.now.utc.iso8601\n end", "def utc\n @utc ||= zone.local_to_utc(@time)\n end", "def utc_now()\n tz = TZInfo::Timezone.get('Etc/UTC')\n tz.now.to_datetime\n end", "def to_utc_time\n Time.utc(@year, @month, @day, @hour, @minute, @second)\n end", "def timestamp\n Time.now.utc.to_i\n end", "def utc() end", "def timestamp\n Time.parse(message.date.to_s).utc\n end", "def created_date_time_utc\n return @created_date_time_utc\n end", "def to_utc_time\n Time.utc(*gregorian_civil_coordinates)\n end", "def get_timestamp\n timestamp = Time.now.gmtime \n timestamp = timestamp.strftime(\"%a, %d %b %Y %H:%M:%S GMT\")\n timestamp.to_s\n end", "def utc\n @utc ||= incorporate_utc_offset(@time, -utc_offset)\n end", "def utc\n unless @_utc then\n @_utc = true\n @vals = LIBC.new.c_gmtime(@tv_sec)\n end\n return self # .to_i # TOTAL FUCKING HACK\n end", "def get_timestamp\n timestamp = Time.now.gmtime\n timestamp = timestamp.strftime(\"%Y-%m-%dT%H:%M:%S.000Z\")\n timestamp.to_s\n end", "def timestamp\n _timestamp.as_time\n end", "def timestamp\n _timestamp.as_time\n end", "def to_utc(date)\n date.to_time.utc\n end", "def created_at_timestamp\n Time.now.gmtime.strftime(\"%Y-%m-%dT%H:%M:%S.000Z\")\n end", "def timestamp\n DateTime.now.strftime(\"%Y%m%d%H%M%S\")\n end", "def at\n Timestamp.utc(@timestamp_value)\n end", "def utc_start_time\n @time.utc.strftime(\"%Y-%m-%dT%H:%M:%S.000Z\")\n end", "def time\n @time ||= incorporate_utc_offset(@utc, utc_offset)\n end", "def timestamp\n date.strftime(\"%Y%m%d%H%M%S\") \n end", "def local_timestamp(utc_time)\n Time.zone.parse(utc_time).strftime(\"%F %R\")\n end", "def timestamp2date(t)\n Time.at(t.to_i).utc\nend", "def timestamp\n timestamp_to_datetime(static_data(\"timestamp\"))\n end", "def generation_time\n Time.at(data.unpack(\"N\")[0]).utc\n end", "def generation_time\n Time.at(data.unpack(\"N\")[0]).utc\n end", "def unixtime\n Time.now.to_i.to_s\n end", "def timestamp() @timestamp ||= Time.now.strftime(\"%Y%m%d%H%M%SZ\") end", "def right_now \n Time.now.getutc \n end", "def to_time\n preserve_timezone ? getlocal(utc_offset) : getlocal\n end", "def get_timestamp\n Time.now.utc.strftime(\"%b%d%Y\")\nend", "def get_iso_timestamp( data_import_session )\n data_import_session.created_at.strftime(\"%Y%m%d%H%M\")\n end", "def get_formatted_timestamp()\n return Time.now.iso8601.to_s\n end", "def at_utc(*args)\n extract_and_create_local_time(args, false)\n end", "def to_f\n utc.to_f\n end", "def timestamp\n memoized_info[:local_timestamp]\n end", "def canonical_time\n Time.parse(timestamp).utc.iso8601\n end", "def now\n Time.now.utc\n end", "def now\n Time.now.utc\n end", "def utc_offset() end", "def now\n tzt.to_i\n end", "def current_timestamp\n Time.now.strftime \"%Y%m%dT%H:%M:%S\"\n end", "def result\n DateTime.iso8601(value).utc\n end", "def local_time\n iso_time\n end", "def to_time\n t = ::Time.at utc_reference\n Time.new t.utc\n end", "def get_timestamp\n Time.now.strftime('%d %B %Y %H:%M')\n end", "def sent_at_seconds_since_epoch\n Time.current.utc.to_i\n end", "def timestamp\n Time.now.to_i.to_s\n end", "def date_to_utc(date)\n date.to_datetime.strftime('%Y-%m-%dT%H:%M:%S%z')\n end", "def to_i\n utc.to_i\n end", "def timestamp\n mask = class_trait[:timestamp]\n Time.now.strftime(mask || \"%Y-%m-%d %H:%M:%S\")\n end", "def timestamp\n @timestamp ||= @attributes['timestamp'] ? Time.zone.at(@attributes['timestamp']) : nil\n end", "def timestamp\n @timestamp ||= @attributes['timestamp'] ? Time.zone.at(@attributes['timestamp']) : nil\n end", "def timestamp\n Time.now.to_s\n end", "def timestamp\n Time.at((attributes[:timestamp] || Time.now).to_i)\n end", "def timestamp\n time = Time.now.getutc\n\n secs = time.to_i\n millis = time.nsec/1000000\n\n return @last if @millis == millis && @secs == secs\n\n unless secs == @secs\n @secs = secs\n @date = time.strftime('%Y-%m-%d %H:%M:%S.')\n end\n\n @millis = millis\n @last = @date + \"00#{millis}\"[-3..-1]\n end", "def this_event_time\n @event[\"server_gmt\"].to_i\n end", "def timestamp\n github_updated_at.iso8601\n end", "def updated\n updated_at.utc.strftime(\"%F %T\") if updated_at\n end", "def current_time\r\n return @owner.timestamp.to_i - @start.to_i\r\n end", "def to_time\n Time.at(CF.CFDateGetAbsoluteTime(self) + CF.kCFAbsoluteTimeIntervalSince1970)\n end", "def asctime\n format = \n if @_utc then\n \"%a %b %e %H:%M:%S %Y\"\n else\n \"%a %b %e %H:%M:%S %Y\"\n end\n return LIBC.new.c_strftime(format, @vals)\n end", "def PA_to_UTC(t)\n TZ_PA.local_to_utc t\nend", "def created_at\n Time.parse(@created_at).utc unless @created_at.nil?\n end", "def local(*args)\n Time.utc(*args)\n end", "def convert_happened_at_to_utc\n self[:happened_at] = self.person && self.person.user ? self.person.user.user2utc(self[:happened_at]) : self[:happened_at]\n end", "def current_timestamp\n @c_tstamp ||= current_time.to_f\n end", "def datetime_timestamp\n return Date.parse(self.date).to_time\n end", "def utc_stop_time\n one_hour = 60*60\n (@time + one_hour).utc.strftime(\"%Y-%m-%dT%H:%M:%S.000Z\")\n end", "def local_asctime\n @time.getlocal.asctime\n end", "def timestamp\n time_formated = Time.now.to_i.to_s.reverse.chop.chop.chop.reverse.to_i\n return time_formated.to_s\nend", "def now_stamp(now = nil)\n now ||= Time.now\n now.utc.strftime(\"%Y-%m-%dT%H:%M:%S.%6NZ\")\n end", "def timestamp\n nil\n end", "def scheduled_for_time_to_utc\n self.scheduled_for = ActiveSupport::TimeZone\n .new(self.user.timezone)\n .local_to_utc(self.scheduled_for)\n end", "def current_offset\n ::Time.new.utc_offset\n end", "def remote_last_updated_at\n require 'rexml/document'\n doc = REXML::Document.new(request('update'))\n Time.iso8601(doc.root.attributes['time'])\n end", "def make_time(seconds)\n Time.at( seconds ).utc\n end", "def inspect\n if @_st_is_gmt\n strftime(\"%a %b %d %H:%M:%S UTC %Y\")\n else\n strftime(\"%a %b %d %H:%M:%S %z %Y\")\n end\n end", "def result\n DateTime.parse(value.sub(/^datetime-/, '')).utc\n end", "def created_date_time_utc=(value)\n @created_date_time_utc = value\n end", "def user_timezone\n return @user_timezone\n end", "def get_Timestamp()\n \t return @outputs[\"Timestamp\"]\n \tend", "def get_Timestamp()\n \t return @outputs[\"Timestamp\"]\n \tend", "def convert_to_utc_time(utc_time)\n utc_time - Time.current.utc_offset\n end", "def created_at\n # parse date from utc_random generated id\n Time.at(id[0, 14].to_i(16) / 1000 / 1000).utc\n end", "def timestamp\n @timestamp ||= Time.parse(@origdate)\n end", "def generate_timestamp\n Time.now.strftime(\"%Y-%m-%dT%T.%N%:z\")\n end", "def timestamp_to_datetime(timestamp)\n Time.at(timestamp.to_f / 1000.0).utc\n end", "def iso\n to_time.utc.iso8601(3) #include milliseconds\n end", "def get_time_stamp\n Time.now.strftime('%Y-%m-%d_%H-%M-%S')\n end", "def timestamp\n Time.at((self.tsh << 32 | self.tsl) * ts_resol)\n end", "def date\n Time.at(self.created_utc)\n end", "def date\n Time.at(self.created_utc)\n end", "def date\n Time.at(self.created_utc)\n end", "def format_timestamp(raw_timestamp)\n Time.at(raw_timestamp).getutc.strftime(\"%Y%m%d%H%M%S\")\n end", "def localtime\n Time.at(self.ut_tv_sec + self.ut_tv_usec / 1_000_000.0)\n end" ]
[ "0.80467796", "0.7918922", "0.7723788", "0.7506699", "0.7498224", "0.74888", "0.74766517", "0.74496037", "0.74275345", "0.72765857", "0.7235048", "0.71984756", "0.7174847", "0.71686935", "0.7156486", "0.71512336", "0.7033659", "0.7020389", "0.7017514", "0.6952933", "0.6926282", "0.6920552", "0.69159347", "0.6883504", "0.67576844", "0.6746957", "0.67173433", "0.67132884", "0.66920877", "0.66920877", "0.6676388", "0.66514415", "0.66502964", "0.66347635", "0.6631884", "0.66182244", "0.66181487", "0.6609072", "0.6572901", "0.6567411", "0.6563079", "0.6547631", "0.6547631", "0.653266", "0.6526446", "0.65192467", "0.6478645", "0.6474202", "0.6464848", "0.64643323", "0.64635724", "0.6460205", "0.6457328", "0.64571166", "0.6451933", "0.6450533", "0.6450533", "0.64487535", "0.64280534", "0.6413305", "0.63998276", "0.639881", "0.6395707", "0.63761777", "0.63680583", "0.6367482", "0.6336561", "0.633631", "0.6335903", "0.6327441", "0.63199633", "0.63029003", "0.63020235", "0.6299673", "0.6298639", "0.6282981", "0.62829584", "0.6281084", "0.62718064", "0.6270364", "0.62652624", "0.6258232", "0.62497103", "0.62426823", "0.62415725", "0.6241223", "0.6241221", "0.6237119", "0.6234029", "0.6233968", "0.6228919", "0.6224366", "0.6224249", "0.6223486", "0.6215198", "0.6211601", "0.6211601", "0.6211601", "0.6210513", "0.6206681" ]
0.72645015
10
Returns the name of the bridge
def name @attributes.fetch('name', nil) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def title\n bridge.title\n end", "def bridge_info bridge_id\n bridge, _headers = get \"bridges/#{bridge_id}\"\n\n Types::Bridge.new bridge\n end", "def default_bd_name\n 'Bridge-Domain' + @bd_ids\n end", "def netbios_name\n if (netbios = @host.at('tag[name=netbios-name]'))\n netbios.inner_text\n end\n end", "def gateway_name\n gateway[:name]\n end", "def _name\n @link['name']\n end", "def name\n \"#{self[:interface]} #{self[:vni]}\"\n end", "def name\n \"#{self[:interface]} #{self[:sid]}\"\n end", "def name\n `#@native.name()`\n end", "def name\n ssh.exec!(\"hostname\").chomp\n end", "def name\n @gapi.name\n end", "def name\n @handle.name if @handle\n end", "def name; Common.name(@handle); end", "def name\n @gapi[\"friendlyName\"]\n end", "def name\n @gapi.name\n end", "def nickname\n Blogical::Application.nickname\n end", "def name\n self.pcb_name + ' / ' + self.pcba_name\n end", "def get_name()\n return @me.uname if @me.brother.nil?\n return @me.brother.full_name\n end", "def name\n @gapi ? @gapi[\"name\"] : @name\n end", "def name\n @gapi[\"name\"]\n end", "def name\n @gapi[\"name\"]\n end", "def system_bridge_domain\n config_get('bridge_domain_vni', 'system_bridge_domain')\n end", "def bridge(name, br_type)\n @dot.puts \" subgraph cluster_br__#{escape(name)} {\"\n @dot.puts \" label = \\\"#{br_type}Bridge #{name}\\\"\"\n\n yield BridgeWriter.new(@dot, @dot_peers)\n\n @dot.puts \" }\"\n end", "def name\n self.connection.name\n end", "def name\n return @peer.name\n end", "def bus_route_name\n bus_route.try(:name)\n end", "def system_bridge_domain\n config_get('bridge_domain', 'system_bridge_domain')\n end", "def network_name\n \"Polkadot\"\n end", "def get_bridged_vbox_nic()\n message = \"Checking:\\tBridged interfaces\"\n command = \"VBoxManage list bridgedifs\"\n nic_list = execute_command(message,command)\n nic_name = \"\"\n if !nic_list.match(/[A-z]/)\n nic_name = $default_net\n else\n nic_list=nic_list.split(/\\n/)\n nic_list.each do |line|\n line=line.chomp\n if line.match(/#{$default_host}/)\n return nic_name\n end\n if line.match(/^Name/)\n nic_name = line.split(/:/)[1].gsub(/\\s+/,\"\")\n end\n end\n end\n return nic_name\nend", "def to_s\n if @bridge_port == true\n \"Bridge: [#{@port_name}, #{@remote_switch_name}, #{@remote_port_name}, #{@remote_port_number}]\"\n else\n \"Std Port: [#{@port_name}, [ #{@port_arp.join(',')} ] ]\"\n end\n end", "def name\n self.class.to_s.split('::').last\n end", "def name\n @grpc.name.split(\"/\")[5]\n end", "def bridge_class_name\n @child_hierarchy_relationship.class_name || @parent_hierarchy_relationship.class_name\n end", "def phys_adapter_name\n new_resource.vlan.nil? ? new_resource.device : \"#{new_resource.device}-NIC\"\n end", "def game_name()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Native.Run_game_name(@handle.ptr)\n result\n end", "def name\n return self.class.name.split('::').last\n end", "def name\n name_ppointer = FFI::MemoryPointer.new :pointer, 1\n len_pointer = FFI::MemoryPointer.new :int, 1 \n name_type_pointer = FFI::MemoryPointer.new :int, 1 \n XDo::FFILib.xdo_get_window_name @_xdo_pointer, @_window, name_ppointer,\n len_pointer, name_type_pointer\n name_pointer = name_ppointer.read_pointer\n name_pointer.nil? ? nil : name_pointer.read_string(len_pointer.read_int)\n end", "def get_basic_name(linker, bb)\n prefix = bb.get_output_prefix(linker)\n name = bb.name\n dylib = bb.shared_suffix linker\n return \"#{prefix}#{name}#{dylib}\"\n end", "def objname()\n machine = self.get_machine()\n profile = self.get_profile()\n (machine.nil? ? \"no machine\" : machine.hostname) + \": \" + (profile.nil? ? \"no profile\" : profile.name)\n end", "def name\n self.class.name.split('::').last\n end", "def name\n prefix_length = 19 # 'bindl::subcommand::'.length\n self.class.name.downcase[prefix_length..-1]\n end", "def name\n \"#{@namespace}:bf\"\n end", "def getName()\n return @obj_name\n end", "def bapp_name\n bapp.try(:description)\n end", "def name()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Native.Segment_name(@handle.ptr)\n result\n end", "def name\n @gapi[\"displayName\"]\n end", "def name\n self.class.name.split(\"::\").last\n end", "def name\n self.class.name.split('::').last\n end", "def __name__\n ɴ = self.class.__instances__[ self ]\n namespace.name_get_hook.( ɴ ) if ɴ\n end", "def name\n \"#{self[:host]}\"\n end", "def name\n @name ||= begin \n ioctl(EVIOCGNAME(len = 256), out_name = \" \" * len)\n out_name.rstrip\n end\n end", "def remote_name\n # git remote\n command('remote')[0].strip\n end", "def name\n self.class.name.split(\"::\").last.downcase\n end", "def name\n self.class.name.split('::').last\n end", "def name\n @label || self.class.to_s.rpartition('::').last\n end", "def name\n _c_get_name\n end", "def name()\n if bound?\n return bound_name\n end\n if label && label.match(/[a-zA-Z][a-zA-Z0-9_]*/) != nil\n return label\n end\n return uri.split(/(\\/|#)/).last\n end", "def name\n File.join(\"/dev/\",@device.gsub(/!/, \"/\"))\n end", "def custom_browser_display_name\n return @custom_browser_display_name\n end", "def branchname\n @branchname ||= self.branch.name\n end", "def name; @receiver_impl.getName; end", "def protocol_name\n PROTOCOLS[protocol.to_s]\n end", "def gem_name\n \"#{@account}-#{@name}\"\n end", "def interface_name\n case @interface\n when nil then 'nil'\n when DNSSD::InterfaceAny then 'any'\n when DNSSD::InterfaceLocalOnly then 'local'\n when DNSSD::InterfaceUnicast then 'unicast'\n else @interface\n end\n end", "def node_name\n path = self.class.to_s\n if i = path.rindex('::')\n path = path[(i+2)..-1]\n end\n path[0] = path[0].chr.downcase\n path\n end", "def branch_name\n `git name-rev --name-only HEAD`.strip\n end", "def name\n return @name unless @name.nil?\n \"#{@name_prefix}host:#{Socket.gethostname} pid:#{Process.pid}\" rescue \"#{@name_prefix}pid:#{Process.pid}\"\n end", "def base_battler_name\n @base_battler_name\n end", "def display_name\n \"#{self.device_name} - #{self.uuid}\"\n end", "def node_name(component, instance)\n name = ''\n @nodenameconvention.each do |i|\n case i\n when 'environment'\n name += @name\n when 'component'\n name += component\n when 'instance'\n name += instance.to_s.rjust(2, '0')\n when 'geo'\n name += @vcenter['geo'].to_s[0]\n else\n name += i\n end\n end\n name\n end", "def name\n @grpc.display_name\n end", "def name\n self.class.name.split(\"Ohai::NamedPlugin::\")[1].to_sym\n end", "def instance_name\n info.name\n end", "def name\n Properties[self.class] ||= {}\n return Properties[self.class][:name] || 'shell'\n end", "def to_s\n self.name.split('::').last\n end", "def get_sockname\n\t\tEventMachine::get_sockname @signature\n\tend", "def name\n grpc.name\n end", "def current_wrapper_name(event)\n connection_object_id = event.payload[:connection_id]\n return nil unless connection_object_id\n\n underlying_adapter = ObjectSpace._id2ref(connection_object_id)\n\n return nil unless underlying_adapter\n return nil unless underlying_adapter.respond_to?(:makara_adapter)\n\n adapter = underlying_adapter.makara_adapter\n return nil unless adapter.respond_to?(:current_wrapper)\n\n id = adapter.id\n wrapper_name = adapter.current_wrapper.try(:name)\n return \"[#{id}]\" unless wrapper_name\n\n \"[#{id}/#{wrapper_name}]\"\n end", "def name\n @architecture\n end", "def protocol_name\n self.class.protocol_name\n end", "def battler_name\n classname = self.class.classname\n name = \"#{base_battler_name+classname+state_trans_name}_#{battler_index}\"\n unless data_battler.folder_ref.empty?\n name = data_battler.folder_ref + \"/\" + name\n end\n if flip && custom_flip?\n name += \"_flip\"\n end\n return name\n end", "def framework_name\n self.name.split(\"::\").last.downcase\n end", "def framework_name\n self.name.split(\"::\").last.downcase\n end", "def base_name\n name\n end", "def get_basic_name(linker, bb)\n prefix = bb.get_output_prefix(linker)\n return \"#{prefix}#{bb.name}#{bb.shared_suffix(linker)}\"\n end", "def brand_name\n maintenance_record_hub.try(:brand) || car.try(:brand_name)\n end", "def getName()\n return @name ;\n end", "def client_name\n sockname[0]\n end", "def ruby_name\n @ruby_name || @name\n end", "def name()\n unless @repo_addr\n fn = @@fname\n bn = @@bname\n return [fn, bn]\n else\n return ['', '']\n end\n end", "def name\n \"#{connection.class.name}/#{path}\"\n end", "def browser_full_name\n self.send( \"browser_full_name_for_#{self.browser_name}\".to_sym )\n end", "def link_name\n self.send(:link_name_method)\n end", "def name\n @name ||= (@config[:name] || self.class.name.split(/::/).last.titleize)\n end", "def name\n case @linkage_vis\n when :global\n return @orig_name\n when :local\n return AsmSymbol::make_local_name(@parent, @orig_name)\n when :hidden\n #the first file will always be the correct file for private symbols.\n return AsmSymbol::make_private_name(@first_file, @orig_name)\n else \n puts \"Unsupported linkage visibility of #{@linkage_vis}\"\n exit 1\n end\n end", "def name\n $0.split(\"/\").last\n end", "def pcb_display_name\n name = self.pcb_name\n name += ' ' + self.pcb_revision if self.pcb_revision.size > 0\n name\n end", "def name\n @name ||= \"#{prefix}navigation.rb\"\n end", "def protocol_name\n self.class.to_s\n end", "def name()\n return self.manager.dictionary[self]\n end", "def name\n @info.name\n end" ]
[ "0.69468164", "0.6872731", "0.6865284", "0.6784252", "0.65710616", "0.6389558", "0.63026875", "0.63019586", "0.6277225", "0.62345004", "0.6182259", "0.61553615", "0.614204", "0.6136117", "0.6125203", "0.6117589", "0.6101885", "0.6095038", "0.6062624", "0.6057778", "0.6057778", "0.6025946", "0.59792614", "0.5949627", "0.5939717", "0.5938178", "0.59169024", "0.59095985", "0.5883702", "0.5878447", "0.5874183", "0.58718413", "0.5871606", "0.5862409", "0.5860697", "0.5854811", "0.5853721", "0.58534825", "0.585318", "0.5842089", "0.58374995", "0.5832006", "0.5829648", "0.5828998", "0.58280826", "0.5824283", "0.58230156", "0.58054245", "0.5803054", "0.5801494", "0.57972544", "0.5794607", "0.57807904", "0.577835", "0.57753044", "0.5756062", "0.5754831", "0.57458735", "0.5739858", "0.572105", "0.5718552", "0.5715689", "0.5710207", "0.57065964", "0.5704496", "0.5702918", "0.5699835", "0.5695456", "0.5694777", "0.5677412", "0.5673632", "0.56683487", "0.56567913", "0.5654164", "0.5649207", "0.5644773", "0.5638116", "0.56334406", "0.5627579", "0.5627146", "0.5622772", "0.56129634", "0.56129634", "0.5612471", "0.5604421", "0.56032664", "0.5587868", "0.55874604", "0.5584878", "0.5583419", "0.5575663", "0.556683", "0.5566628", "0.55642474", "0.55637985", "0.5563503", "0.5560111", "0.5557642", "0.5555623", "0.5555145", "0.55527776" ]
0.0
-1
Returns the timezone of the bridge
def timezone @attributes.fetch('timezone', nil) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timezone\n return call('Bugzilla.tomezone')\n end", "def timezone\n TimeZoneHelper.info_hash(tzinfo_tz, rails_tz)\n end", "def timezone\n Timezone.get_proxy(@identifier)\n end", "def timezone\n data[:timezone]\n end", "def get\n @timezone\n end", "def get\n @timezone\n end", "def timezone\n @history.objects.find { |o| o.name == \"tz\" }.val\n end", "def timezone\r\n\t\t@usr_timezone\r\n\tend", "def tz\n ActiveSupport::TimeZone.new timezone\n end", "def curr_date_in_timezone\n Time.now.getlocal(address_timezone_offset)\n end", "def tz\n time_zone_adjustment.to_r / (24 * 60)\n end", "def tz\n time_zone_adjustment.to_r / (24 * 60)\n end", "def time_zone; end", "def time_zone; end", "def time_zone; end", "def time_zone; end", "def time_zone; end", "def user_timezone\n return @user_timezone\n end", "def time_zone\n @time_zone\n end", "def time_zone\n return @time_zone\n end", "def time_zone_name\n @time_zone_name\n end", "def zone\n strftime('%Z')\n end", "def canonical_zone\n @linked_timezone.canonical_zone\n end", "def time_zone_offset\n @session.chosen_office.time_zone_offset\n end", "def timezone(identifier); end", "def timezone(identifier); end", "def timezone(identifier); end", "def time_zone\n @attributes[:time_zone]\n end", "def time_zone\n @attributes[:time_zone]\n end", "def linked_timezone(identifier); end", "def linked_timezone(identifier); end", "def linked_timezone(identifier); end", "def linked_timezone(identifier); end", "def timezone\n @@tz || @@tz = TZInfo::Timezone.get(Time.now.zone)\n end", "def time_zone=(_arg0); end", "def time_zone=(_arg0); end", "def tz\n # logger.debug(\"CHC: customer tz called from #{caller.join(\"\\n\")}\")\n if tzb = time_zone_binary\n tzb.to_r / MINS_PER_DAY\n else\n nil\n end\n end", "def tz_timezone ; timezone? ? TZInfo::Timezone.get(@timezone) : nil ; end", "def current_user_timezone\n app_get_geo_data_by_ip.try(:timezone) || \"America/La_Paz\"\n end", "def canonical_zone\n real_timezone.canonical_zone\n end", "def time_zone\n @session.chosen_office.time_zone if @session.chosen_office.present?\n end", "def time_zone\n ActiveSupport::TimeZone[\"Wellington\"]\n end", "def time_zone\n \"Mountain Time (US & Canada)\"\n #{}\"Eastern Time (US & Canada)\"\n end", "def current_zone\n ::Time.new.zone\n end", "def zone\n if @_utc then\n return \"UTC\"\n else\n return self.to_a[IDX_ZONE]\n end\n end", "def current_timezone_offset\n 0\n end", "def time_zone\n addresses.primary.blank? || addresses.primary.time_zone.blank? ? nil : addresses.primary.time_zone\n end", "def get_node_timezone(node_city)\n @nodes[node_city].timezone\n end", "def browser_timezone\n cookies[:timezone]\n end", "def local_timezone\n tzname = Time.new.zone\n q, r = Time.new.utc_offset.divmod(3600)\n sign = (q < 0) ? '-' : '+'\n tzoffset = sign + \"%02d\" % q.abs.to_s + ':' + r.to_f.div(60).to_s\n \"#{tzname} (UTC#{tzoffset})\"\n end", "def timezone!\n if @timezone.nil?\n\n tz = get_country! \n # if country have only one zone then return that zone\n if tz.zones.count == 1\n @timezone = TZInfo::Timezone.get(tz.zones[0].name)\n else\n location_fetch! if @latitude.nil? or @longitude.nil?\n # some services returns timezone when fetch location \n tz_name! if @timezone.nil?\n end\n end\n return @timezone\n end", "def zone\n Thread.current[:time_zone] || zone_default\n end", "def timezone\n @timezone || Sequel.database_timezone\n end", "def provision_time_zone\n @attributes[:provision_time_zone]\n end", "def availability_zone\n data.availability_zone\n end", "def browser_timezone\n return nil if cookies[:tzoffset].blank?\n @browser_timezone ||= begin\n min = cookies[:tzoffset].to_i\n TimeZone[-min.minutes]\n end\n end", "def contract\n encode_tz(:KT1, 20)\n end", "def zone_info\n @info.zones\n end", "def timezone_information(timezone = current_account.timezone)\n name = ActiveSupport::TimeZone.new(timezone).to_s\n name_or_link = if can?(:update, current_account) && current_account.provider?\n link_to(name, edit_provider_admin_account_path)\n else\n name\n end\n \"Using time zone \".html_safe + name_or_link\n end", "def tenant_default_timezone\n return @tenant_default_timezone\n end", "def time_zone\n super\n end", "def zone\n @zone\n end", "def adm_timezone_field\n $tracer.trace(__method__)\n return ToolTag.new(get_self.select.id(\"/ctl00_ctl00_ctl00_OuterTaskRegion_TaskRegion_TaskRegion_TaskRegion_timezone/\"), __method__)\n end", "def current_zone\n return @zone\n end", "def availability_zone\n data[:availability_zone]\n end", "def account\n encode_tz(:tz1, 20)\n end", "def availability_zone\n @dbi.availability_zone\n end", "def availability_zone\n @dbi.availability_zone\n end", "def time\n Time.zone = self.time_zone\n Time.zone\n end", "def utc_offset() end", "def time_in_zone\n # Time.zone should be UTC\n Time.zone.at((time+utc_offset)/1000)\n end", "def default_timezone\n @default_timezone || :local\n end", "def data_timezone(identifier); end", "def data_timezone(identifier); end", "def local_time_zone\n\tzone_name = ActiveSupport::TimeZone::MAPPING.keys.find do |name|\n\t ActiveSupport::TimeZone[name].utc_offset == Time.now.utc_offset\n\tend\n\tActiveSupport::TimeZone.find_tzinfo(zone_name).identifier\n end", "def time\n \tself[:time].try(:in_time_zone, \"Eastern Time (US & Canada)\")\n end", "def get_time_zone\n return nil if new_record?\n time_zone || lambda{\n _zone = nil\n _zone = GeoIP.new(Rails.root.join('lib', 'geoip_files', 'GeoLiteCity.dat')).city(last_sign_in_ip).try(:timezone) if last_sign_in_ip\n update_column(:time_zone, _zone) if _zone\n _zone\n }.call\n end", "def formatted_zone\n \"#{@utc_direction}#{padded(@utc_hours)}:#{padded(@utc_minutes)}\"\n end", "def timezones\n subcomponents[\"VTIMEZONE\"]\n end", "def tz\n zone = has_timezone? ? object.zone : \"\"\n zone = \"Z\" if zone == \"+00:00\"\n RDF::Literal(zone)\n end", "def tz\n zone = has_timezone? ? object.zone : \"\"\n zone = \"Z\" if zone == \"+00:00\"\n RDF::Literal(zone)\n end", "def zoneless\n\t\t(self + self.utc_offset).utc\n\tend", "def linked_timezone_identifiers; end", "def linked_timezone_identifiers; end", "def linked_timezone_identifiers; end", "def linked_timezone_identifiers; end", "def identifier\n time_zone.identifier\n end", "def availability_zone\n @subnet.availability_zone\n end", "def inspect\n \"#<#{self.class}: #{@zoneinfo_dir}>\"\n end", "def getutc() end", "def identifier\n @real_timezone ? @real_timezone.identifier : @identifier\n end", "def to_zone(aHours=nil)\n\t\taHours ||= utc_offset/3600.0\n\t\tself.in_time_zone(aHours)+self.utc_offset-aHours.to_i.hours\n\tend", "def to_time\n preserve_timezone ? getlocal(utc_offset) : getlocal\n end", "def in_zone(zone_name, &block)\n\n EtOrbi.class_eval do\n @local_tzone = nil\n @local_tzone_tz = nil\n @local_tzone_loaded_at = nil\n end\n\n prev_tz = ENV['TZ']\n\n if zone_name == :no_env_tz\n ENV.delete('TZ')\n elsif zone_name == nil\n ENV['TZ'] = EtOrbi.os_tz\n else\n zone_name = EtOrbi.to_windows_tz(zone_name) if Gem.win_platform?\n ENV['TZ'] = zone_name\n end\n\n block.call\n\nensure\n\n ENV['TZ'] = prev_tz\nend", "def now\n tzt.to_i\n end", "def zone_number\n end", "def daylight_offset\n return @daylight_offset\n end", "def timezone(reference, identifier, latitude_numerator, latitude_denominator, longitude_numerator, longitude_denominator, description = T.unsafe(nil)); end", "def timezone(reference, identifier, latitude_numerator, latitude_denominator, longitude_numerator, longitude_denominator, description = T.unsafe(nil)); end", "def operation\n encode_tz(:o, 32)\n end" ]
[ "0.7871619", "0.7579619", "0.74299926", "0.74166644", "0.7338548", "0.7338548", "0.7283099", "0.70963764", "0.70485926", "0.7027724", "0.6984507", "0.6984507", "0.6935032", "0.6935032", "0.6935032", "0.6935032", "0.6935032", "0.68576705", "0.6856452", "0.6847378", "0.6742339", "0.6727763", "0.67216307", "0.6705568", "0.6682194", "0.6682194", "0.6682194", "0.6651295", "0.6651295", "0.66411495", "0.66411495", "0.66411495", "0.66411495", "0.66245234", "0.6605754", "0.6605754", "0.65914375", "0.6582", "0.6571946", "0.6571501", "0.65411216", "0.6491415", "0.6429036", "0.64211106", "0.64181644", "0.6398978", "0.6382496", "0.6373293", "0.63486737", "0.63414717", "0.6290613", "0.6272981", "0.6252853", "0.622677", "0.62208086", "0.62039095", "0.6195358", "0.6194815", "0.6185555", "0.6178609", "0.6166123", "0.61550534", "0.6147332", "0.6143547", "0.6130235", "0.61185145", "0.6109282", "0.6109282", "0.60895264", "0.60857266", "0.6068993", "0.6066552", "0.6063301", "0.6063301", "0.60486364", "0.6044623", "0.6025067", "0.6024643", "0.60172135", "0.6015894", "0.6015894", "0.6008634", "0.5986824", "0.5986824", "0.5986824", "0.5986824", "0.5971264", "0.59675443", "0.5957873", "0.5944005", "0.5918212", "0.5916142", "0.5903718", "0.5902641", "0.5884073", "0.58779097", "0.58740956", "0.5837115", "0.5837115", "0.58348304" ]
0.70674884
8
Returns the local time of the bridge
def localtime @attributes.fetch('localtime', nil) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def local_time\n iso_time\n end", "def getlocal\n @time.getlocal\n end", "def getlocal\n return Time.at(self).localtime\n end", "def localtime\n # Opal 0.9.0 has no localtime method so use getlocal instead\n @time.getlocal\n end", "def local_asctime\n @time.getlocal.asctime\n end", "def to_local_time\n Time.local(1970, 1, 1, @hour, @minute, @second)\n end", "def local_ctime\n @time.getlocal.ctime\n end", "def localtime(time)\n time.getlocal.strftime('%d %b %I:%M %p')\n end", "def get_local_time(tm)\n tm.strftime('%m/%d/%Y %I:%M%p')\n end", "def curent_time\n Time.zone.now.strftime('%l:%M %p')\n end", "def to_local_time\n Time.local(@year, @month, @day, @hour, @minute, @second)\n end", "def localtime() end", "def time_of_day\n start.to_time.in_time_zone(device.zone).to_s(:local)\n end", "def get_timestamp\n Time.now.strftime('%d %B %Y %H:%M')\n end", "def local_time(time)\n return nil unless time.is_a?(Time)\n time.utc? ? time.getlocal : time\n end", "def get_timestamp\n timestamp = Time.now.gmtime \n timestamp = timestamp.strftime(\"%a, %d %b %Y %H:%M:%S GMT\")\n timestamp.to_s\n end", "def curr_date_in_timezone\n Time.now.getlocal(address_timezone_offset)\n end", "def time\n Time.now.localtime + self.time_offset\n end", "def to_local(date)\n date.to_time.getgm\n end", "def timestamp\n memoized_info[:local_timestamp]\n end", "def getCurrentTime\n # Determine the current time and determine if we are in DST.\n return Time.mktime(@year, @month, @day, 0, 0, 0).gmtime\n end", "def current_time\n begin\n Time.parse(self.localtime)\n rescue\n nil\n end\n end", "def localtime\n Time.at(self.ut_tv_sec + self.ut_tv_usec / 1_000_000.0)\n end", "def current_time\n Time.now.in_time_zone(\"Berlin\").to_date\n end", "def s_time\n to_form_time(start_time.getlocal)\n end", "def time_of_day\n occurred_at.to_time.in_time_zone(device.zone).to_s(:local)\n end", "def time\n start.try(:to_time).try(:strftime, '%-l:%M %P')\n end", "def currentTime( )\n dt = Time.new.gmtime.to_datetime()\n currentDate = dt.strftime( \"%s\" ) + \"=\" + dt.strftime( \"%F.%H:%M:%S\" )\n currentDate\n end", "def this_event_time\n @event[\"server_gmt\"].to_i\n end", "def getServerTime()\r\n\t\t# get the time now\r\n\t\ttime = Time.now.to_i\r\n\t\ttime\r\n\tend", "def get_date()\n @time\n end", "def local_time_as_string( utc = nil )\n utc ||= Time.now.utc\n @tz_proxy ||= TZInfo::Timezone.get(self.timezone)\n @tz_proxy.utc_to_local( utc ).strftime('%a, %b %d, %Y @ %I:%M %p')\n end", "def local(*args)\n Time.utc(*args)\n end", "def gmtdate\n Time.now.gmtime.strftime('%a, %d %b %Y %H:%M:%S GMT')\n end", "def get_time\n Time.new.strftime(\"%Y-%m-%d %H:%M:%S\")\n end", "def get_pickup_time\n pickup_time.strftime(\"%H:%M %p\") if pickup_time.present?\n end", "def time_now\n ::Time.now\n end", "def local_uploaded_time\n self.uploaded_at.strftime(\"%Y-%m-%d %H:%M\")\n end", "def base_time\n BASE_TIME\n end", "def current_time\n @current_time\n end", "def current_time\n Time.now.strftime(\"%l:%M %p\")\n end", "def time\n if @timezone then\n Time.use_zone(@timezone) {\n Time.zone.now\n }\n else\n Time.now\n end\n end", "def GetCurrentFormattedTimeForDiagLogs()\n Time.now.utc.strftime(\"%Y-%m-%dT%H:%M:%S.%6NZ\")\n end", "def GetCurrentFormattedTimeForDiagLogs()\n Time.now.utc.strftime(\"%Y-%m-%dT%H:%M:%S.%6NZ\")\n end", "def now\n Time.now.utc\n end", "def now\n Time.now.utc\n end", "def current_time\n\t\treturn run('return current_time').strip.to_i\n\tend", "def right_now \n Time.now.getutc \n end", "def current_time\r\n return @owner.timestamp.to_i - @start.to_i\r\n end", "def to_time\n preserve_timezone ? getlocal(utc_offset) : getlocal\n end", "def current_time\n Time.now.strftime('%I:%M:%S %p')\n end", "def at_local(*args)\n extract_and_create_local_time(args, true)\n end", "def get_time\n\t\t@time.inspect\n\tend", "def current_time\n clock.now.to_f\n end", "def date\n Time.now.in_time_zone\n end", "def sender_date_time\n return @sender_date_time\n end", "def now\n tzt.to_i\n end", "def local(*args)\n time = Time.utc(*args)\n ActiveSupport::TimeWithZone.new(nil, self, time)\n end", "def getutc() end", "def time\n @time ||= incorporate_utc_offset(@utc, utc_offset)\n end", "def time\n DateTime.now.strftime(TIME_FORMAT)\n end", "def current_time\n \"#{hour}:#{minute}:#{second}\"\n end", "def default_time\n Time.now.utc\n end", "def local_offset\n @time.getlocal.utc_offset\n end", "def get_current_time\n now =Time.now()\n return now.strftime(\"%Y-%m-%d %H:%M:%S\")\n end", "def device_time(format = nil)\n @bridge.device_time(format)\n end", "def device_time(format = nil)\n @bridge.device_time(format)\n end", "def local_timestamp(utc_time)\n Time.zone.parse(utc_time).strftime(\"%F %R\")\n end", "def now\n VoltTime.new\n end", "def to_t\n date = Date.today\n Time.local(date.year,date.month,date.day,@hour,@min,@sec)\n end", "def current_time\n Time.now\n end", "def sync_time(time)\n Time.local(self.dt.year, self.dt.mon, self.dt.mday, time.hour, time.min, time.sec)\n end", "def ship_timestamp\n Time.new.strftime('%Y-%m-%dT%H:%M:%S%z').tap{|str| str[-2,0] = ':' }\n end", "def hora_geracao\n Time.current.strftime('%H%M%S')\n end", "def hora_geracao\n Time.current.strftime('%H%M%S')\n end", "def get_timestamp\n timestamp = Time.now.gmtime\n timestamp = timestamp.strftime(\"%Y-%m-%dT%H:%M:%S.000Z\")\n timestamp.to_s\n end", "def time\n \tself[:time].try(:in_time_zone, \"Eastern Time (US & Canada)\")\n end", "def now\n Time.now\n end", "def now\n Time.now\n end", "def now\n convert(Time.now)\n end", "def current_timestamp\n Time.now.strftime \"%Y%m%dT%H:%M:%S\"\n end", "def GetCurrDateTime\n\ttime1 = Time.new\n\tputs time1\n\tputs time1.inspect\nend", "def __mongoize_time__\n ::Time.configured.local(*self)\n end", "def time\n Time.now.to_f\n end", "def current_time\n DateTime.now\n end", "def current_time\n DateTime.now\n end", "def time\n (departure.scheduled_time + departure.lateness).strftime(TIME_FORMAT)\n end", "def timestamp\n _timestamp.as_time\n end", "def in_international_time\n self.strftime(\"%H:%M\")\n end", "def system_datetime\r\n request(HTTPMethods::GET, PATH_SYSTEMDATETIME)\r\n end", "def now\n Time.now\n end", "def to_time()\n #This is a stub, used for indexing\n end", "def clock_in_time\n \tself.created_at.strftime(\"%H:%M %p\")\n end", "def aktTime()\n (Time.now).strftime(\"%T\")\nend", "def current_time\n plan_rebuilder.current_time\n end", "def gm_to_local(time)\n TimeZone.new(session[:time_zone]).utc_to_local(time)\n end", "def now\n time_now.utc.in_time_zone(self)\n end", "def time\n Time.zone = self.time_zone\n Time.zone\n end", "def launch_time\n DateTime.parse(\"2015-02-04 13:00:00 UTC\")\n end", "def time\n y = Date.today.year\n m = rand(12) + 1\n d = rand(31) + 1\n Time.local(y,m,d)\n end" ]
[ "0.8022288", "0.7863044", "0.76519996", "0.75172627", "0.7335103", "0.7213653", "0.72046536", "0.7168516", "0.7165381", "0.71445006", "0.70415145", "0.70011175", "0.6949408", "0.6849556", "0.68449414", "0.6810648", "0.67108214", "0.6706796", "0.67066395", "0.6699198", "0.662025", "0.6607418", "0.6603781", "0.66030765", "0.65960354", "0.65942055", "0.6590473", "0.65875417", "0.65852404", "0.65598667", "0.6543812", "0.65420395", "0.65342265", "0.6530691", "0.6510433", "0.6509717", "0.6508462", "0.6501742", "0.6492714", "0.64878917", "0.6487634", "0.6486716", "0.64833057", "0.64833057", "0.64713395", "0.64713395", "0.6455888", "0.6453695", "0.6428677", "0.6386852", "0.63820904", "0.6375497", "0.6374306", "0.6370325", "0.63632756", "0.63576114", "0.6355294", "0.6353143", "0.6345903", "0.6343955", "0.63379127", "0.63366467", "0.6334479", "0.6327603", "0.6314558", "0.63139224", "0.63139224", "0.63074195", "0.63054603", "0.63033557", "0.6295233", "0.6293843", "0.6287942", "0.62780106", "0.62780106", "0.62750715", "0.62733203", "0.6270312", "0.6270312", "0.626545", "0.62634325", "0.6255222", "0.62467146", "0.6229547", "0.62249243", "0.62249243", "0.6222258", "0.62165684", "0.6203958", "0.6202087", "0.6200488", "0.6198494", "0.61946523", "0.6189084", "0.6186916", "0.61843", "0.617756", "0.61758083", "0.6175209", "0.61748606" ]
0.6490056
39
Return the local time as DateTime
def current_time begin Time.parse(self.localtime) rescue nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def local_time\n iso_time\n end", "def to_local_time\n Time.local(@year, @month, @day, @hour, @minute, @second)\n end", "def to_local_time\n Time.local(1970, 1, 1, @hour, @minute, @second)\n end", "def local(*args)\n time = Time.utc(*args)\n ActiveSupport::TimeWithZone.new(nil, self, time)\n end", "def local_time(time)\n return nil unless time.is_a?(Time)\n time.utc? ? time.getlocal : time\n end", "def to_time\n preserve_timezone ? getlocal(utc_offset) : getlocal\n end", "def getlocal\n return Time.at(self).localtime\n end", "def localtime\n # Opal 0.9.0 has no localtime method so use getlocal instead\n @time.getlocal\n end", "def getlocal\n @time.getlocal\n end", "def local_asctime\n @time.getlocal.asctime\n end", "def get_local_time(tm)\n tm.strftime('%m/%d/%Y %I:%M%p')\n end", "def local(*args)\n Time.utc(*args)\n end", "def local_date_time\n # d = [:year, :mon, :day, :hour, :min, :sec].map{|q| @local_date_time.send(q)}\n # d << (utc_offset/24).to_f\n # #puts d\n # DateTime.new(*d) \n tz0 = utc_offset.to_s.split('.')\n tz = (tz0[0][0]=='-' ? '-' : '+')+('00'+tz0[0].to_i.abs.to_s)[-2,2]+':'\n tz += tz0.count>1 ? ('0'+((('.'+tz0[1]).to_f*100).to_i*0.6).to_i.to_s)[-2,2] : '00'\n @local_date_time.to_datetime.change(:offset => tz) ### \"#{utc_offset}:00\")\n end", "def localtime(time)\n time.getlocal.strftime('%d %b %I:%M %p')\n end", "def convert_to_local_time(utc_time)\n utc_time + Time.current.utc_offset\n end", "def to_local(date)\n date.to_time.getgm\n end", "def local_ctime\n @time.getlocal.ctime\n end", "def localtime(datetime)\n Time.parse(datetime.iso8601.sub(/(\\+.*)\\z/, '')).iso8601\n end", "def to_t\n date = Date.today\n Time.local(date.year,date.month,date.day,@hour,@min,@sec)\n end", "def to_time\n if preserve_timezone\n @to_time_with_instance_offset ||= getlocal(utc_offset)\n else\n @to_time_with_system_offset ||= getlocal\n end\n end", "def sync_time(time)\n Time.local(self.dt.year, self.dt.mon, self.dt.mday, time.hour, time.min, time.sec)\n end", "def local_time_as_string( utc = nil )\n utc ||= Time.now.utc\n @tz_proxy ||= TZInfo::Timezone.get(self.timezone)\n @tz_proxy.utc_to_local( utc ).strftime('%a, %b %d, %Y @ %I:%M %p')\n end", "def to_time\r\n hsh = {:year => Time.now.year, :month => Time.now.month, :day => Time.now.day,\r\n :hour => Time.now.hour, :minute => Time.now.minute, :second => Time.now.second,\r\n :usec => Time.now.usec, :ampm => \"\" }\r\n hsh = hsh.update(self.symbolize_keys)\r\n [:year, :month, :day, :hour, :minute, :second, :usec].each {|key| hsh[key] = hsh[key].to_i }\r\n hsh[:hour] = 0 if hsh[:ampm].downcase == \"am\" && hsh[:hour] == 12\r\n hsh[:hour] += 12 if hsh[:ampm].downcase == \"pm\" && hsh[:hour] != 12\r\n Time.local(hsh[:year], hsh[:month], hsh[:day], hsh[:hour], hsh[:minute], hsh[:second], hsh[:usec])\r\n end", "def time_convertion(time, time_zone)\n time.getutc.getlocal(time_zone)\n end", "def to_time\n t = ::Time.at utc_reference\n Time.new t.utc\n end", "def gm_to_local(time)\n TimeZone.new(session[:time_zone]).utc_to_local(time)\n end", "def time\n if @timezone then\n Time.use_zone(@timezone) {\n Time.zone.now\n }\n else\n Time.now\n end\n end", "def at_local(*args)\n extract_and_create_local_time(args, true)\n end", "def s_time\n to_form_time(start_time.getlocal)\n end", "def current_time\n Time.now.in_time_zone(\"Berlin\").to_date\n end", "def localtime\n Time.at(self.ut_tv_sec + self.ut_tv_usec / 1_000_000.0)\n end", "def local(*args)\n new(Time.utc(*args), zone)\n end", "def date_time_et\n DateTime.now.utc.in_time_zone('Eastern Time (US & Canada)')\n end", "def date_time_et\n DateTime.now.utc.in_time_zone('Eastern Time (US & Canada)')\n end", "def getlocal(utc_offset = nil)\n utc = getutc\n\n Time.utc(\n utc.year, utc.month, utc.day,\n utc.hour, utc.min, utc.sec + utc.sec_fraction\n ).getlocal(utc_offset)\n end", "def now\n create(@time_zone.utc_to_local(Time.now.utc))\n end", "def localtime\n if @_utc then\n @tv_sec += self.utc_offset\n @_utc = false\n @vals = LIBC.new.c_localtime(@tv_sec)\n end\n return self\n end", "def to_time\n Time.local(2000 + year, month, day, hour, minute, second)\n end", "def utc_now()\n tz = TZInfo::Timezone.get('Etc/UTC')\n tz.now.to_datetime\n end", "def time\n Time.zone = self.time_zone\n Time.zone\n end", "def timify\n # no client sends 'published' but we'll prepare for it\n if @properties.key?('published')\n utc_time = Time.iso8601(@properties['published'].first)\n else\n utc_time = Time.now.utc\n end\n if @timezone\n # local_time = @timezone.utc_to_local(utc_time)\n utc_total_offset = @timezone.period_for_utc(utc_time).utc_total_offset\n local_time = utc_time.getlocal(utc_total_offset)\n else\n local_time = utc_time\n end\n\n return {local: local_time, utc: utc_time}\n end", "def __mongoize_time__\n ::Time.configured.local(*self)\n end", "def local_timestamp(utc_time)\n Time.zone.parse(utc_time).strftime(\"%F %R\")\n end", "def create(time)\n TZTime::LocalTime.new(time, @time_zone)\n end", "def curent_time\n Time.zone.now.strftime('%l:%M %p')\n end", "def time_in_zone\n # Time.zone should be UTC\n Time.zone.at((time+utc_offset)/1000)\n end", "def time_of_day\n start.to_time.in_time_zone(device.zone).to_s(:local)\n end", "def convert(local_time, from_time_zone=nil)\n if from_time_zone\n b = self.class.new(from_time_zone)\n t = b.at(local_time).getutc\n utc(t.year, t.month, t.day, t.hour, t.min, t.sec, t.usec)\n elsif local_time.respond_to?(:getutc)\n t = local_time.getutc\n utc(t.year, t.month, t.day, t.hour, t.min, t.sec, t.usec)\n else\n nil\n end\n end", "def curr_date_in_timezone\n Time.now.getlocal(address_timezone_offset)\n end", "def localtime\n @attributes.fetch('localtime', nil)\n end", "def localtime(utc_offset = nil)\n utc.getlocal(utc_offset)\n end", "def time\n @time ||= incorporate_utc_offset(@utc, utc_offset)\n end", "def local(*args)\n create(Time.utc(*args))\n end", "def local_offset\n @time.getlocal.utc_offset\n end", "def local_timezone\n tzname = Time.new.zone\n q, r = Time.new.utc_offset.divmod(3600)\n sign = (q < 0) ? '-' : '+'\n tzoffset = sign + \"%02d\" % q.abs.to_s + ':' + r.to_f.div(60).to_s\n \"#{tzname} (UTC#{tzoffset})\"\n end", "def time\n y = Date.today.year\n m = rand(12) + 1\n d = rand(31) + 1\n Time.local(y,m,d)\n end", "def local_to_gm(time)\n TimeZone.new(session[:time_zone]).local_to_utc(time)\n end", "def time\n Time.now.localtime + self.time_offset\n end", "def localtime() end", "def get_time\n Time.new.strftime(\"%Y-%m-%d %H:%M:%S\")\n end", "def utc\n @utc ||= zone.local_to_utc(@time)\n end", "def time\n \tself[:time].try(:in_time_zone, \"Eastern Time (US & Canada)\")\n end", "def now\n time_now.utc.in_time_zone(self)\n end", "def as_datetime\n strftime \"%Y-%m-%d %H:%M\"\n end", "def parsed_time(timezone = patient.timezone)\n self.datetime.in_time_zone(timezone)\n end", "def getCurrentTime\n # Determine the current time and determine if we are in DST.\n return Time.mktime(@year, @month, @day, 0, 0, 0).gmtime\n end", "def time\n return Time.new(@t_year, @t_month, @t_day, @t_hour, @t_min, @t_sec)\n end", "def local_offset(time = Time.now)\n Time.at(time.to_i).to_datetime.offset\n end", "def my_now\n utc = Time.now.utc\n now = Time.utc(utc.year, utc.month, utc.day, 6 - timezone)\n end", "def to_time()\n #This is a stub, used for indexing\n end", "def google_datetime(time)\n time.to_datetime.rfc3339\n end", "def to_time\n self\n end", "def current_time\n DateTime.now\n end", "def current_time\n DateTime.now\n end", "def now\n new(zone.utc_to_local(Time.now.utc), zone)\n end", "def today_time(time_s)\n time_hash = Date._strptime(time_s, '%H:%M')\n Date.today.strftime('%Y-%m-%dT') +\n DateTime.new(1, 1, 1, time_hash[:hour], time_hash[:min], 0).\n strftime('%H:%M:%S') + PloggyConfigHelper::project_timezone\nend", "def GetCurrDateTime\n\ttime1 = Time.new\n\tputs time1\n\tputs time1.inspect\nend", "def iso_time\n @iso_time ||= Time.now.utc.iso8601\n end", "def to_time\n # Thread-safety: It is possible that the value of @time may be \n # calculated multiple times in concurrently executing threads. It is not \n # worth the overhead of locking to ensure that @time is only \n # calculated once.\n \n unless @time\n result = if @timestamp\n Time.at(@timestamp).utc\n else\n Time.utc(year, mon, mday, hour, min, sec, usec)\n end\n\n return result if frozen?\n @time = result\n end\n \n @time \n end", "def default_time\n Time.now.utc\n end", "def launch_time\n DateTime.parse(\"2015-02-04 13:00:00 UTC\")\n end", "def to_local(time_zone = Time.zone.try(:name))\n return if __getobj__.nil? || time_zone.nil?\n converted_timestamp = ActiveSupport::TimeZone.new(time_zone).local_to_utc(__getobj__)\n converted_timestamp.in_time_zone(time_zone) if converted_timestamp.respond_to? :in_time_zone\n end", "def to_time(t=nil)\n t ||=Time.now\n Time.new(t.year,t.month,t.day,@hours,@minutes,0)\n end", "def to_time\n if_period(super) do |p,t|\n # Ruby 2.4.0 changed the behaviour of to_time so that it preserves the\n # offset instead of converting to the system local timezone.\n #\n # When self has an associated TimezonePeriod, this implementation will\n # preserve the offset on all versions of Ruby.\n LocalTime.at(t.to_i, t.subsec * 1_000_000).localize(p)\n end\n end", "def getutc\n return Time.at(self).utc\n end", "def now\n VoltTime.new\n end", "def now\n t = Time.now\n new!(:civil=>[t.year, t.mon, t.day], :parts=>[t.hour, t.min, t.sec, t.usec], :offset=>t.utc_offset)\n end", "def date\n Time.now.in_time_zone\n end", "def time_to_local(entity)\n return unless entity.respond_to?(:each)\n entity.each do |key, value| \n entity[key] = Time.zone.at(value).to_s if value.is_a?(Time) \n end\n end", "def rails_time_from(date)\n return Time.zone.now if date == 'undefined' || date.blank?\n a, b, c = date.split('-')\n day, month, year = a.length == 4 ? [c, b, a] : [b, a, c]\n begin\n Time.zone.local(year.to_i, month.to_i, day.to_i)\n rescue StandardError\n Time.zone.now\n end\n end", "def now\n convert(Time.now)\n end", "def to_time(form = :utc)\n ::Time.send(\"#{form}\", year, month, day)\n end", "def local_uploaded_time\n self.uploaded_at.strftime(\"%Y-%m-%d %H:%M\")\n end", "def utc_to_local(time)\n tzinfo.utc_to_local(time).yield_self do |t|\n ActiveSupport.utc_to_local_returns_utc_offset_times ?\n t : Time.utc(t.year, t.month, t.day, t.hour, t.min, t.sec, t.sec_fraction * 1_000_000)\n end\n end", "def nyc_time(time)\n TZInfo::Timezone.get('America/New_York').local_to_utc(Time.parse(time))\nend", "def as_of_time\n Conversions.string_to_utc_time attributes_before_type_cast['as_of_time']\n end", "def datetime_stamp\n Time.now.utc.iso8601\n end", "def time\n DateTime.now.strftime(TIME_FORMAT)\n end", "def local_to_p4_server_time(str_local_time)\n\tif (@regexp_date =~ str_local_time) then\n\t\tlocaltime = DateTime.strptime(\"#{str_local_time} #{@local_zone}\", \"@%Y/%m/%d %z\")\n\t\tservertime = localtime.new_offset(@p4_server_timezone)\n\t\treturn servertime.strftime(\"@%Y/%m/%d:%H:%M:%S\")\n\telsif (@regexp_date_time =~ str_local_time) then\n\t\tlocaltime = DateTime.strptime(\"#{str_local_time} #{@local_zone}\", \"@%Y/%m/%d:%H:%M:%S %z\")\n\t\tservertime = localtime.new_offset(@p4_server_timezone)\n\t\treturn servertime.strftime(\"@%Y/%m/%d:%H:%M:%S\")\t\t\t\n\tend\n\tputs \"Invalid P4 Date/Time String: #{str_local_time}\"\n\treturn str_local_time\nend", "def new_time(year, mon, mday, hour, min, sec, microsec, offset = nil)\n return if year.nil? || (year == 0 && mon == 0 && mday == 0)\n if offset\n time = ::Time.utc(year, mon, mday, hour, min, sec, microsec) rescue nil\n return unless time\n time -= offset\n is_utc? ? time : time.getlocal\n else\n fast_string_to_time_zone.local(year, mon, mday, hour, min, sec, microsec) rescue nil\n end\n end" ]
[ "0.8227636", "0.7886614", "0.77355796", "0.74075335", "0.74018544", "0.73731977", "0.7276424", "0.7231104", "0.7163378", "0.7134441", "0.70954096", "0.7088494", "0.7029193", "0.7006503", "0.6845499", "0.68192947", "0.6735158", "0.66991794", "0.66841257", "0.66524667", "0.6652059", "0.6561404", "0.6550456", "0.6543584", "0.651815", "0.6515692", "0.65026855", "0.6476661", "0.646222", "0.6449899", "0.6432782", "0.64260834", "0.6425334", "0.6425334", "0.6416089", "0.6409962", "0.64043474", "0.636737", "0.63620746", "0.6359703", "0.6322909", "0.6311556", "0.6303964", "0.6300553", "0.62975365", "0.6280332", "0.62781376", "0.62739545", "0.6234421", "0.6232127", "0.62304187", "0.62276304", "0.62192297", "0.62148976", "0.6212221", "0.6202559", "0.6196419", "0.6175798", "0.61646646", "0.6137226", "0.61301273", "0.6125433", "0.61057574", "0.61032337", "0.60996723", "0.60866916", "0.6057643", "0.60499513", "0.60349214", "0.6026534", "0.6025885", "0.602371", "0.60055345", "0.60055345", "0.6003076", "0.6002876", "0.60009205", "0.5993371", "0.59774995", "0.59603256", "0.59400415", "0.5931783", "0.5927524", "0.5926997", "0.59225285", "0.59004426", "0.5898344", "0.5890642", "0.5888153", "0.5880034", "0.5849891", "0.583885", "0.5838279", "0.5831072", "0.5821826", "0.582111", "0.58201146", "0.58183485", "0.58175725", "0.58121103" ]
0.652519
24
Return the version of the software on the bridge
def swversion @attributes.fetch('swversion', nil) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def version\n fetch('vehicle.version')\n end", "def version\n output = @filer.invoke(\"system-get-version\")\n if(output.results_errno() != 0)\n r = output.results_reason()\n raise \"Failed : \\n\" + r\n else \n output.child_get_string(\"version\")\n end\n end", "def version\n str = if detect_product(\"CriOs\")\n crios.version\n else\n chrome.version\n end\n\n Version.new(str)\n end", "def version\n detect_product('GSA').version\n end", "def hypervisor_version\n output_ptr = FFI::MemoryPointer.new(:ulong)\n FFI::Libvirt.virConnectGetVersion(pointer, output_ptr)\n FFI::Libvirt::Util.parse_version_number(output_ptr.get_ulong(0))\n end", "def version\n send_command(:getinfo, 'version')\n reply = read_reply.split('=').last\n read_reply # skip \"250 OK\"\n reply\n end", "def version\n if browser == \"Chrome\"\n chrome.version\n elsif product = detect_product(\"Version\")\n product.version\n else\n BuildVersions[build]\n end\n end", "def version\n ret = @client.call('Bugzilla.version')\n handle_faults(ret)\n ret['version']\n end", "def version\n driver.getVersion\n end", "def lib_version\n output_ptr = FFI::MemoryPointer.new(:ulong)\n FFI::Libvirt.virConnectGetLibVersion(pointer, output_ptr)\n FFI::Libvirt::Util.parse_version_number(output_ptr.get_ulong(0))\n end", "def version\n @firmware_version ||= littlewire.version\n end", "def get_version\n\t\tend", "def version\n @version ||= version_hex.to_s(16).chars.entries.join('.')\n end", "def version\n h = call(CMD_VERSION)\n return h[:result]\n end", "def version\n return call('Bugzilla.version')\n end", "def runtime_version\n \n #create a new buffer which will hold the runtime's version\n version_buffer = FFI::MemoryPointer.new(VersionMaxLength) \n\n #get the system's version\n GetVersion(version_buffer)\n\n #and return the retrieved version\n version_buffer.read_string\n\n end", "def get_version\n request('getVersion')\n end", "def get_version()\n\t\tend", "def version_number\n self.name =~ /RHEL-([0-9]+)/\n return $1.to_i\n end", "def current_version\n version_number rev\n end", "def gem_version; end", "def gem_version; end", "def gem_version; end", "def gem_version; end", "def gem_version; end", "def gem_version; end", "def get_ai_repo_version(options)\n options = get_ai_publisherurl(options)\n if options['test'] == true || options['host-os-name'].to_s.match(/Darwin/)\n version = \"0.175.1\"\n else\n message = \"Information:\\tDetermining if available repository version from \"+options['publisherurl']\n command = \"pkg info -g #{options['publisherurl']} entire |grep Branch |awk \\\"{print \\\\\\$2}\\\"\"\n version = execute_command(options,message,command)\n version = version.chomp\n version = version.split(/\\./)[0..2].join(\".\")\n end\n return version\nend", "def version\n\t\t\tbegin\n\t\t\t\tv = \"#{GVB.major_version}.#{GVB.minor_version}.#{GVB.patch_version}\"\n\t\t\trescue\n\t\t\t\tv = File.read(\".gvb_version\") if File.exists?(\".gvb_version\")\n\t\t\tend\n\t\t\t# If we got a version then use it to construct a link to the github tag of the same\n\t\t\tif v\n\t\t\t\tl = link_to v, \"https://github.com/machiavellian/machiavelli/releases/tag/v#{v}\", target: \"blank\" if v\n\t\t\t\treturn \"version #{l} \".html_safe\n\t\t\tend\n\t\tend", "def version\n VersionInfo.new(command(\"Browser.getVersion\"))\n end", "def version; Common.version(@handle); end", "def version\n exec('--version').match(/^Ledger (.*),/)[1]\n end", "def version\n cmd(COMMANDS[:version], 2)\n end", "def version\n execute_string(\"-version\")\n end", "def version\n str = if product = detect_product('Version')\n product.version\n elsif os =~ /iOS ([\\d\\.]+)/ && browser == \"Safari\"\n $1.tr('_', '.')\n else\n BuildVersions[build.to_s]\n end\n\n Version.new(str)\n end", "def available_version(package_name, arch = nil)\n version(package_name, arch, true, false)\n end", "def remote_version\n rubygem_api = JSON.parse open(\"https://rubygems.org/api/v1/versions/osa.json\").read\n rubygem_api.first[\"number\"]\n rescue Exception => e\n puts \"[!] \".yellow + \" Couldn't check the latest version, please check internet connectivity.\"\n exit!\n end", "def version\n app = detect_product(GSA) || detect_product(GOOGLEPODCASTS)\n app.version\n end", "def version\n return last_version if versionable?\n version_number\n end", "def versionString()\n\t\t\t\treturn \"#{major}.#{minor}.#{build}\"\n\t\t\tend", "def version\n api_execute('/version', :get).body\n end", "def firmware_version\n buffer = PN532::DataBuffer.new\n PN532.get_firmware_version(pn_struct, buffer)\n buffer[1..3]\n end", "def ver\n if v = version\n str = +\"#{program_name} #{[v].join('.')}\"\n str << \" (#{v})\" if v = release\n str\n end\n end", "def get_nameprog_swversion\r\n nomeprog = APP_CUPERATIVA_NAME\r\n ver_prog = CuperativaGui.sw_version_to_int\r\n return nomeprog, ver_prog\r\n end", "def version\n @version ||= exec('SHOW server_version')[0]['server_version'].split[0]\n end", "def binary_version; end", "def platform_version_for_package\n if platform == 'rhel'\n platform_version[/([\\d]+)\\..+/, 1]\n else\n platform_version\n end\n end", "def version\n echo_rosh_command\n\n @version ||= adapter.current_version\n end", "def version_number\n @version\n end", "def read_version\n # The version string is usually in one of the following formats:\n #\n # * 4.1.8r1234\n # * 4.1.8r1234_OSE\n # * 4.1.8_MacPortsr1234\n #\n # Below accounts for all of these:\n execute(\"--version\").split(\"_\")[0].split(\"r\")[0]\n end", "def v82\n fetch_version(:v82)\n end", "def version\n case @version\n when Module\n \"#{@version::Major}.#{@version::Minor}.#{@version::Release}\"\n when Proc # not sure about this\n @version.call\n when NilClass\n 'unknown'\n else\n @version\n end\n end", "def current_version\n @version\n end", "def ver\n @values['ver']\n end", "def platform_version\n Ohai.platform_version\n end", "def version\n @version_helper.to_s\n end", "def version\n @version_helper.to_s\n end", "def version\n VERSION\n end", "def get_gcovr_version()\n version_number_major = 0\n version_number_minor = 0\n\n command = @ceedling[:tool_executor].build_command_line(TOOLS_GCOV_GCOVR_POST_REPORT, [], \"--version\")\n shell_result = @ceedling[:tool_executor].exec(command[:line], command[:options])\n version_number_match_data = shell_result[:output].match(/gcovr ([0-9]+)\\.([0-9]+)/)\n\n if !(version_number_match_data.nil?) && !(version_number_match_data[1].nil?) && !(version_number_match_data[2].nil?)\n version_number_major = version_number_match_data[1].to_i\n version_number_minor = version_number_match_data[2].to_i\n end\n\n return version_number_major, version_number_minor\n end", "def version\n @version ||= __determine_version\n end", "def version\n p\n version = File.read(HOSTER_PATH+\"/hoster.version\")\n puts PROGNAME + \" version \" + version\nend", "def major ; version.major ; end", "def version\n\t\treturn @version ||= self.find_version\n\tend", "def version\n VERSION\n end", "def version\n [ V1_4.raptor_version_major,\n V1_4.raptor_version_minor,\n V1_4.raptor_version_release ].join('.')\n end", "def swversion\n config[\"swversion\"]\n end", "def version\n @version ||= File.read(path('version.txt')).strip\n end", "def version\n build_string\n end", "def version\n\t\tmodule_info['Version'].split(/,/).map { |ver|\n\t\t\tver.gsub(/\\$Rev.s.on:\\s+|\\s+\\$$/, '')\n\t\t}.join(',')\n\tend", "def version\n network(hex: true) + 1\n end", "def version\n resolved_version\n end", "def client_protocol_version\n match = @automation_client << VERSION_CONSTANT_NAME >> /\\d*/\n version = match[0].to_i\n return version\n end", "def major_version; end", "def version\n VERSION\n end", "def version\n VERSION\n end", "def version\n VERSION\n end", "def get_api_version\n response = send_api_request(:index)\n response[:returncode] ? response[:version].to_s : \"\"\n end", "def platform_version\n osver[1]\n end", "def version_number\n return @version_number\n end", "def version\n self.class.get(\"/get/version\")\n end", "def getVersion\r\n\t\t\t\t\treturn @version\r\n\t\t\t\tend", "def available_version(i)\n p_data = package_info(i)\n\n # nothing is available\n return nil if p_data.empty?\n\n p_data[\"versions\"][\"stable\"]\n end", "def version(packagename)\n\t\t\t\treturn(packages()[packagename].version)\n\t\t\tend", "def application_version\n read('application_version')\n end", "def version\n @version ||= File.read(path('version.txt')).strip\n end", "def get_api_version\n response = send_api_request(:index)\n if response[:returncode]\n response[:version].to_s\n else\n \"\"\n end\n end", "def version\n return @version\n end", "def version\n return @version\n end", "def version\n return @version\n end", "def version\n return @version\n end", "def version\n return @version\n end", "def version\n return @version\n end", "def version\n return @version\n end", "def version\n return @version\n end", "def version\n return @version\n end", "def current_bundle_version\n case lane_context[:PLATFORM_NAME]\n when :android\n get_gradle_version_name(gradle_path: lane_context[:GRADLE_FILE])\n when :ios\n get_info_plist_value(path: 'ios/AllAboutOlaf/Info.plist',\n key: 'CFBundleShortVersionString')\n else\n get_package_key(key: :version)\n end\nend", "def kernel_version\n uname('-v')\n end", "def version\n @version || 0\n end", "def osver\n return `uname -r`.chomp\n end", "def version\n @version\n end", "def get_remote_version\n open(\"#{@@remote_cli}/LATEST\").read.gsub(/.*cli-/, '').gsub(/\\.tar\\.gz/,'').tr(\"\\n\", '')\n end", "def version\n [@major_version, @minor_version].join('.')\n end" ]
[ "0.75647914", "0.7378317", "0.735079", "0.72071713", "0.71858597", "0.7150352", "0.71364516", "0.7113201", "0.7088819", "0.7088207", "0.70789903", "0.70657355", "0.7050649", "0.70413256", "0.70238715", "0.70051533", "0.7003066", "0.6936389", "0.6914194", "0.69091076", "0.68845963", "0.68845963", "0.68845963", "0.68845963", "0.68845963", "0.68845963", "0.68664974", "0.68632984", "0.6849963", "0.6829223", "0.68255883", "0.6824946", "0.681848", "0.68094844", "0.6802169", "0.67647827", "0.676322", "0.67575806", "0.67532396", "0.67525375", "0.67493683", "0.67413765", "0.6736407", "0.67341614", "0.6716877", "0.6714373", "0.67111367", "0.67104137", "0.6704942", "0.67014724", "0.6692678", "0.66804963", "0.6671781", "0.6643157", "0.6631019", "0.6631019", "0.6628009", "0.6624023", "0.66176546", "0.66171324", "0.661482", "0.6613169", "0.66030484", "0.6601354", "0.6599112", "0.6593068", "0.6587646", "0.65759724", "0.657587", "0.6569475", "0.6567464", "0.6564453", "0.6560669", "0.6560669", "0.6560669", "0.6560227", "0.6558711", "0.65537274", "0.654922", "0.65464777", "0.65460837", "0.65313524", "0.65310466", "0.6530485", "0.6527468", "0.65271443", "0.65271443", "0.65271443", "0.65271443", "0.65271443", "0.65271443", "0.65271443", "0.65271443", "0.65271443", "0.65226454", "0.6519969", "0.65190905", "0.6518083", "0.65059865", "0.64987856", "0.64983463" ]
0.0
-1
Return the current API version of the bridge
def apiversion @attributes.fetch('apiversion', nil) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def api_version\n request('getAPIVersion')\n end", "def get_api_version()\n return API_VERSION\n end", "def api_version\n Gandi.call('version.info')['api_version']\n end", "def current_api_version\n JSON.parse(get('/api').to_s)['currentVersion'] rescue 1\n end", "def version\n api_execute('/version', :get).body\n end", "def api_version\n @api_version ||= begin\n pool = self.pool.get_all[0]\n host = self.pool.get_master(pool)\n major = self.host.get_API_version_major(host)\n minor = self.host.get_API_version_minor(host)\n \"#{major}.#{minor}\"\n end\n end", "def api_version\n self.class.get('/api')['api_ver']\n end", "def get_api_version\n response = send_api_request(:index)\n response[:returncode] ? response[:version].to_s : \"\"\n end", "def api_version\n @api_version || :latest\n end", "def api_version\n @version\n end", "def get_api_version\n response = send_api_request(:index)\n if response[:returncode]\n response[:version].to_s\n else\n \"\"\n end\n end", "def version; env['api.version'] end", "def get_api_version\n _make_request(:types)['version'].to_s\n end", "def get_api_version\n :v201502\n end", "def version\n response = get('/getVersion', {}, false)\n ApiVersion.new(response.body['version'], response.body['builddate'])\n end", "def get_version\n prepare\n @api.get_api_version\n end", "def get_api_version()\n return :v201502\n end", "def api_version\n self.class.api_version\n end", "def appliance_api_version\n options = { 'Content-Type' => :none, 'X-API-Version' => :none, 'auth' => :none }\n response = rest_api(:get, '/rest/version', options)\n version = response_handler(response)['currentVersion']\n raise ConnectionError, \"Couldn't get API version\" unless version\n version = version.to_i if version.class != Integer\n version\n rescue ConnectionError\n @logger.warn \"Failed to get OneView max api version. Using default (#{OneviewSDK::DEFAULT_API_VERSION})\"\n OneviewSDK::DEFAULT_API_VERSION\n end", "def get_version\n request('getVersion')\n end", "def api_version\n self.class.superclass.name.to_s.split('::').second.sub('V', '').to_i\n end", "def to_s\n self.api_version\n end", "def current_version\n @version\n end", "def api_version\n @api_version || \"2011-02-01\"\n end", "def version\n raise InvalidRequestException unless defined?(API_VERSION)\n API_VERSION\n end", "def version\n ret = @client.call('Bugzilla.version')\n handle_faults(ret)\n ret['version']\n end", "def api_version\n @api_version ||= \"v4.2\"\n end", "def API_version(options={})\n return \"#{@major}.#{@minor}\"\n end", "def version\n self.class.get(\"/get/version\")\n end", "def last_api_version\n @last_api_version\nend", "def version\n fetch('vehicle.version')\n end", "def api_version; config[:api_version]; end", "def formatted_version\n self.api_version.presence || DEFAULT_API_VERSION\n end", "def get_version\n\t\tend", "def current_version\n version_number rev\n end", "def version\n return call('Bugzilla.version')\n end", "def version\n render json: { result: 'Ok', version: '1', protocol: 'EBUio-PlugIt' }\n end", "def get_version()\n\t\tend", "def v82\n fetch_version(:v82)\n end", "def version\n VERSION\n end", "def version\n VERSION\n end", "def version\n VERSION\n end", "def version\n VERSION\n end", "def api_version\n 'v2'\n end", "def version\n endpoint.config.version\n end", "def version\n @version_obj ||= fetcher.get(Fastly::Version, service_id, version_number)\n end", "def version\n @version_obj ||= fetcher.get(Fastly::Version, service_id, version_number)\n end", "def getVersion()\n return \"client \" + CLIENT_VERSION + \", API v2, converter \" + @helper.getConverterVersion()\n end", "def getVersion()\n return \"client \" + CLIENT_VERSION + \", API v2, converter \" + @helper.getConverterVersion()\n end", "def getVersion()\n return \"client \" + CLIENT_VERSION + \", API v2, converter \" + @helper.getConverterVersion()\n end", "def getVersion()\n return \"client \" + CLIENT_VERSION + \", API v2, converter \" + @helper.getConverterVersion()\n end", "def getVersion()\n return \"client \" + CLIENT_VERSION + \", API v2, converter \" + @helper.getConverterVersion()\n end", "def getVersion()\n return \"client \" + CLIENT_VERSION + \", API v2, converter \" + @helper.getConverterVersion()\n end", "def getVersion()\n return \"client \" + CLIENT_VERSION + \", API v2, converter \" + @helper.getConverterVersion()\n end", "def version\n VERSION\n end", "def version\n @version\n end", "def version\n \"0.2.0\"\n end", "def current_version\n versions.first\n end", "def version\n send_command(:getinfo, 'version')\n reply = read_reply.split('=').last\n read_reply # skip \"250 OK\"\n reply\n end", "def current_bundle_version\n case lane_context[:PLATFORM_NAME]\n when :android\n get_gradle_version_name(gradle_path: lane_context[:GRADLE_FILE])\n when :ios\n get_info_plist_value(path: 'ios/AllAboutOlaf/Info.plist',\n key: 'CFBundleShortVersionString')\n else\n get_package_key(key: :version)\n end\nend", "def version\n driver.getVersion\n end", "def v81\n fetch_version(:v81)\n end", "def appliance_i3s_api_version\n options = { 'Content-Type' => :none, 'X-API-Version' => :none, 'auth' => :none }\n response = rest_api(:get, '/rest/version', options)\n version = response_handler(response)['currentVersion']\n raise ConnectionError, \"Couldn't get API version\" unless version\n version = version.to_i if version.class != Integer\n version\n rescue ConnectionError\n @logger.warn \"Failed to get Image Streamer max api version. Using default (#{OneviewSDK::ImageStreamer::DEFAULT_API_VERSION})\"\n OneviewSDK::ImageStreamer::DEFAULT_API_VERSION\n end", "def version\n @version_helper.to_s\n end", "def version\n @version_helper.to_s\n end", "def version\n echo_rosh_command\n\n @version ||= adapter.current_version\n end", "def full\n @version\n end", "def version\n return @version\n end", "def version\n return @version\n end", "def version\n return @version\n end", "def version\n return @version\n end", "def version\n return @version\n end", "def version\n return @version\n end", "def version\n return @version\n end", "def version\n return @version\n end", "def version\n return @version\n end", "def remote_version\n rubygem_api = JSON.parse open(\"https://rubygems.org/api/v1/versions/osa.json\").read\n rubygem_api.first[\"number\"]\n rescue Exception => e\n puts \"[!] \".yellow + \" Couldn't check the latest version, please check internet connectivity.\"\n exit!\n end", "def version\n return last_version if versionable?\n version_number\n end", "def version\n next_version\n end", "def version\n resolved_version\n end", "def version\n h = call(CMD_VERSION)\n return h[:result]\n end", "def get_api_version_string(api_version)\n \"?api-version=#{api_version}\"\n end", "def api_version\n :v2\n end", "def getVersion\r\n\t\t\t\t\treturn @version\r\n\t\t\t\tend", "def current_version\n v = nil\n v = (self.class.name.split(\"::\").first(2).join(\"::\") + '::VERSION').constantize unless defined?((self.class.name.split(\"::\").first(2).join(\"::\") + '::VERSION').constantize.to_s).nil?\n env['tracking'].current_version = v\n return v\n end", "def version\n VersionInfo.new(command(\"Browser.getVersion\"))\n end", "def version\n app = detect_product(GSA) || detect_product(GOOGLEPODCASTS)\n app.version\n end", "def version\n return @version if defined?(@version)\n \n @version = JSON.parse(File.read('package.json'))['version']\nend", "def version\n read_property 'Version'\n end", "def swagger_apiVersion\n if app.respond_to?(:swagger_apiVersion)\n app.swagger_apiVersion\n else\n '0.1.0'\n end\n end", "def version\n @version || 0\n end", "def version\n 1\n end", "def version\n 1\n end", "def version\n self[:version]\n end", "def major_version; end", "def version\n str = if detect_product(\"CriOs\")\n crios.version\n else\n chrome.version\n end\n\n Version.new(str)\n end", "def version\n @version ||= __determine_version\n end", "def version; Common.version(@handle); end", "def runtime_version\n \n #create a new buffer which will hold the runtime's version\n version_buffer = FFI::MemoryPointer.new(VersionMaxLength) \n\n #get the system's version\n GetVersion(version_buffer)\n\n #and return the retrieved version\n version_buffer.read_string\n\n end", "def v72\n fetch_version(:v72)\n end" ]
[ "0.818404", "0.7999815", "0.7989753", "0.7942286", "0.79089224", "0.7888405", "0.78823775", "0.7811262", "0.77878046", "0.77564603", "0.7738744", "0.77126855", "0.7697414", "0.7555869", "0.7555167", "0.75542414", "0.7547675", "0.7517137", "0.74756235", "0.7473234", "0.7382651", "0.7370502", "0.729881", "0.7265622", "0.7258353", "0.7228273", "0.72093624", "0.7176986", "0.7174284", "0.7120817", "0.7093931", "0.70666695", "0.70223814", "0.7012364", "0.69971055", "0.6935621", "0.69283503", "0.6922393", "0.6894642", "0.6853917", "0.6853917", "0.6853917", "0.6837841", "0.68341583", "0.68312603", "0.6819531", "0.6819531", "0.68007964", "0.68007964", "0.68007964", "0.68007964", "0.68007964", "0.68007964", "0.68007964", "0.6785635", "0.6757193", "0.6753887", "0.67444235", "0.67429805", "0.67402786", "0.6732445", "0.6729897", "0.6716204", "0.67095643", "0.67095643", "0.67065734", "0.66741776", "0.6669939", "0.6669939", "0.6669939", "0.6669939", "0.6669939", "0.6669939", "0.6669939", "0.6669939", "0.6669939", "0.66625726", "0.66489035", "0.6625569", "0.6622539", "0.66110486", "0.66079915", "0.65992534", "0.6589994", "0.65885997", "0.6579518", "0.6565816", "0.65578604", "0.6534431", "0.65313816", "0.6518762", "0.6514913", "0.6509607", "0.65061456", "0.65011066", "0.64997673", "0.6490425", "0.6485197", "0.64781135", "0.6468313" ]
0.679903
54
GET /book_commentaries GET /book_commentaries.json
def index @book_commentaries = BookCommentary.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n # retrieve comments from db, including the user\n comments = @book.comments.includes(:user).order(id: :desc)\n render json: comments, status: :ok\n end", "def index\n if params[:user_id]\n @comments = find_user.comments\n render json: @comments\n elsif params[:book_id]\n @comments = find_book.comments\n render json: @comments\n else\n @comments = Comment.all\n render json: @comments\n end\n end", "def index\n @book_comments = BookComment.all\n end", "def index \n #@comments = Comment.all\n @bookId = params[:bookId]\n session[:bookId] = params[:bookId] # put book id in session\n @comments = Comment.find(:all, :conditions => 'book_id = ' + @bookId)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comments }\n end\n end", "def comments; rest_query(:comment); end", "def comments\n client.get(\"/#{id}/comments\")\n end", "def set_book_commentary\n @book_commentary = BookCommentary.find(params[:id])\n end", "def index\n #@comments = Comment.all\n comments = @blog.comments\n render json: comments, status: :ok\n end", "def book\n @book = Book.published.find(params[:id])\n render json: @book\n end", "def index\n @commentaries = Commentary.all\n end", "def show\n @book = Book.find(params[:id], :include => [{:comments => :user}, :authors])\n @comments = @book.comments\n @authors = @book.authors\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def book_commentary_params\n params.require(:book_commentary).permit(:commentary, :book_id)\n end", "def index\n @verse_commentaries = VerseCommentary.all\n end", "def index\n @comments = Comment.where(\n \"auction_id = ? \",\n params[:auction_id])\n\n render json: @comments\n end", "def list\n comments = Comment.where(post: @post)\n render json: comments, status: 200\n end", "def index\n @comments = Comment.all\n render json: @comments\n end", "def create\n @book_commentary = BookCommentary.new(book_commentary_params)\n\n respond_to do |format|\n if @book_commentary.save\n format.html { redirect_to @book_commentary.book, notice: 'Book commentary was successfully created.' }\n format.json { render :show, status: :created, location: @book_commentary }\n else\n format.html { render :new }\n format.json { render json: @book_commentary.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n if params[:comment_id].nil?\n render json: {\n comments: @card.comments.paginate(page: params[:page], per_page: 3)\n }, statues: :ok\n else\n @comment = Comment.find(params[:comment_id])\n render json: {\n comment: @comment,\n replaies: @comment.replaies.paginate(page: params[:page], per_page: 3)\n }, statues: :ok\n end\n end", "def index\n\t\trender json: current_user.noteBooks.as_json(:include=> [:notes=>{:only=>[\"id\"]}])\n # render json: NoteBook.all.as_json(:include=> [:notes=>{:only=>[\"id\"]}])\n\tend", "def index\n @comments = @commentable.comments\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comments }\n end\n end", "def show\n render json: { comment: @comment, replaies: @comment.replaies }, status: :ok\n end", "def index\n @books = Book.all\n render json: @books\n end", "def index\n @bookings = Booking.all\n\n render json: @bookings\n end", "def list_books\n books = Book.all\n \n if books.count > 0\n render json: books\n else\n render json: {e:\"No books added\"}, :status => :error\n end\n end", "def index\n @album = Album.find(params[:album_id])\n @photo = @album.photos.find(params[:photo_id])\n @comments = @photo.comments.all\n \n respond_to do |format|\n format.json { render :json => @comments.to_json }\n end\n end", "def comments\n @list.client.get(\"#{url}/comments\")\n end", "def comments\n @list.client.get(\"#{url}/comments\")\n end", "def index\n author = Author.find(params[:author_id])\n @reviews = author.reviews\n render json: @reviews\n end", "def index\n @section_comments = SectionComment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @section_comments }\n end\n end", "def index\n if params[:book_id]\n @book = Book.find(params[:book_id])\n recipes = @book.recipes\n render json: RecipeSerializer.new(recipes).to_serialized_json\n else \n recipes = Recipe.all.order(:name)\n render json: RecipeSerializer.new(recipes).to_serialized_json\n end\n end", "def show\n @new_comment = Comment.new\n @comments = @book.comments.order(\"updated_at DESC\")\n end", "def order_book(params)\n Client.current.get(\"#{resource_url}/book\", params)\n end", "def index\n\t\t@book_reviews = BookReview.find_all_by_user_id(current_user.id)\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render :json => @book_reviews }\n\t\tend\n\tend", "def index\n @commentable = find_commentable\n @comments = @commentable.comments\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @carts }\n end\n end", "def comments\n Birdman::ApiPaginatedCollection.new(\"movies/#{id}/comments\")\n end", "def comments\n render json: @post.comments\n end", "def show\n @library_book = LibraryBook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @library_book }\n end\n end", "def comments\n @article = Article.find(params[:id])\n @comments = @article.comments\n\n respond_to do |format|\n format.html \n format.json { render json: @comments, status: :ok }\n end\n end", "def index\n @comments = Comment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comments }\n end\n end", "def index\n @comments = Comment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comments }\n end\n end", "def index\n @comments = Comment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comments }\n end\n end", "def show\n render json: @book\n end", "def index\n @comments = DiscussionComment.all\n render json: @comments\n end", "def index\n comments = @project.comments\n render json: comments\n end", "def index\n base_url = 'https://www.googleapis.com/books/v1/volumes?q=fiction&maxResults=20'\n and_key = '&key='\n key = ENV['GOOGLE_BOOKS_API_KEY'] \n googleurl = base_url + and_key + key\n\n response = RestClient.get(googleurl)\n @books = JSON.parse(response)\n\n respond_to do |format|\n format.html\n format.json { render json: @books }\n end\n\nend", "def index\n @notebooks = Notebook.all\n render json: @notebooks\n end", "def create\n @book_comment = current_user.book_comments.new(book_comment_params)\n @book_comment.book_id = @book_detail.id\n @book_comment.save\n\n # 表示用。後で名前見やすくする\n @book_comments = @book_detail.book_comments.all\n end", "def show\n @user = current_user\n book_owner = User.where(id: @book.owner_id)\n book_owner = book_owner[0]\n @book_owner_lat = book_owner[\"lat\"]\n @book_owner_lng = book_owner[\"lng\"]\n @book_owner_add = book_owner[\"address\"]\n #@comments = Comment.order('created_at DESC').where(commentable_id: @book.id)\n @comments = Comment.unscoped { Comment.order(\"created_at DESC\").where(commentable_id: @book.id).limit(20) }\n end", "def index\n @bookings = Booking.all.map { |b| [b, b.contact, b.persons.first] }\n respond_to do |format|\n format.html\n format.json { render json: @bookings }\n end\n end", "def index\n @resumes = Resume.where(:book_id => params[:book_id])\n\n render json: @resumes\n end", "def destroy\n @book_commentary.destroy\n respond_to do |format|\n format.html { redirect_to book_commentaries_url, notice: 'Book commentary was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def fetch_book_info\n url = \"#{BASE_URL}/#{book_id}\"\n resp = RestClient::Request.execute(url: url, method: \"GET\")\n resp_obj = JSON.parse(resp)\n\n {\n id: book_id,\n title: resp_obj[\"volumeInfo\"][\"title\"],\n author: resp_obj[\"volumeInfo\"][\"authors\"][0],\n image: resp_obj[\"volumeInfo\"][\"imageLinks\"] ? resp_obj[\"volumeInfo\"][\"imageLinks\"][\"thumbnail\"] : DEFAULT_IMAGE\n }\n end", "def index\n @reviews = Review.find(params[:burger_place_id])\n\n render json: @reviews\n end", "def update\n respond_to do |format|\n if @book_commentary.update(book_commentary_params)\n format.html { redirect_to @book_commentary.book, notice: 'Book commentary was successfully updated.' }\n format.json { render :show, status: :ok, location: @book_commentary }\n else\n format.html { render :edit }\n format.json { render json: @book_commentary.errors, status: :unprocessable_entity }\n end\n end\n end", "def list_comment\n user = current_user\n commentaires =Commentaire.all\n comments = []\n commentaires.each do |commentaire|\n if commentaire.user_id == user.id\n {commentaire:commentaire,logement:commentaire.logement,photo_logement:\"#{commentaire.logement.photos.first.photo.url}\",reponses:commentaire.reponses}\n end\n end\n render json: {commentaire:comments}\n end", "def all_booking_of_client\n\t\t@bookings = Booking.where(client_id: params[:client_id])\n\t\trender json: @bookings, status: 200\n\tend", "def index\n render json: Album.find(params[:album_id]).reviews\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n\n format.json { render json: @book }\n end\n end", "def show\n @comments = Recipe.find(params[:recipe_id]).comments.all\n @comment = Recipe.find(params[:recipe_id]).comments.find(params[:id]) \n if @comment \n respond_to do |f|\n f.html {render :index}\n f.json {render json: @comment}\n end\n else\n @comments\n respond_to do |f|\n f.html {render :index}\n f.json {render json: @comments}\n end\n end\n end", "def show\n @book_review = BookReview.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book_review }\n end\n end", "def index\n @post = Post.find_by_id(params[:post_id])\n if @post.nil?\n return render json: { error: \"Post not found\" }, status: :not_found\n end\n render json: @post.comments,status: 200\n end", "def index\n @comments = @complaint.comments\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @comments }\n format.js\n end\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html\n format.json { render :json => @bookings }\n end\n end", "def index\n @cookbooks = Cookbook.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cookbooks }\n end\n end", "def index\n @book_pages = @book.book_pages\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @book_pages }\n end\n end", "def all\n logement = Logement.find(params[:logement_id])\n commentairess = logement.commentaires\n commentaires =[]\n commentairess.each do |commentaire|\n \n if commentaire.reponses.present?\n commentaires << {commentaires:commentaire,reponse:commentaire.reponses}\n else\n commentaires << {commentaires:commentaire,user:logement}\n end\n \n end\n if commentaires\n render json: {comment:commentaires}\n end\n \n end", "def index\n @comments = @commentable.comments\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end", "def index\n books = current_user.books.all\n render json: { books: books }\n end", "def index\n @books = Book.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n end", "def index\n @comments = Comment.paginate(:page => params[:page])\n @ticket = Ticket.find(params[:ticket_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comments }\n end\n end", "def index\n @books = Book.extended_details\n\n render json: @books.as_json(\n only: [:id, :title, :author, :created_at, :total_income_cents, :copies_count, :remaining_copies_count, :loaned_copies_count]\n )\n end", "def index\n if params[:book_id]\n @book = Book.where(isbn: params[:book_id]).first\n if !@book.nil?\n @reviewings = @book.reviewings \n end\n end\n end", "def show\n @book.counter += 1\n @book.save\n @comments = @book.comments.recent.limit(10).all\n @relateds = @book.category.books.limit(5)\n end", "def index\n @comments = Comment.where('user_id = ?', current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comments }\n end\n end", "def index\n @page = \"comments\"\n @comments = Comment.where('approved = ?', true).paginate(:per_page => 12, :page => params[:page]).order(\"created_at desc\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comments }\n end\n end", "def get_reviews\n @comment_reviews = CommentReview.where('comment_id = ?', params[:comment_id])\n end", "def index\n @books = Book.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n end", "def show\n render json: { blog: @blog, comments: @blog.comments }\n end", "def index\n comments = @post.comments\n render json: { comments: comments }\n #loop through comments and find first and last name by user_id\n #User.find....etc\n end", "def show\n respond_to do |format|\n par = []\n @blogger.paragraphs.each do |para|\n para_details = {\n id: para.id,\n data: para.data,\n comments: para.comments.collect{ |dat| dat.body } \n }\n par << para_details\n end\n blog_json = {\n id: @blogger[:id],\n title: @blogger[:title],\n author: @blogger[:author],\n paragraph_details: par\n }\n \n format.json { render json: blog_json, status: :ok, location: @blogger }\n \n end\n end", "def index\n @lecture_comments = LectureComment.all\n end", "def show\n render json: @api_book\n end", "def index\n @bill_comments = BillComment.all\n end", "def show\n # comment = Comment.find_comment\n render json: @comment\n end", "def show\n @casualcomment = Casualcomment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @casualcomment }\n end\n end", "def index\n photo = Photo.find(params[:photo_id])\n\n\n json = {\n :commentable => Commentable.photo_comments_as_json(params[:photo_id]),\n :current_user => {\n :can_delete_comments => current_user && (current_user == photo.user || current_user == photo.album.user),\n }\n }\n\n render :json=>JSON.fast_generate(json)\n end", "def show\n recipe = Recipe.find_by_id(params[:id])\n\n respond_to do |format|\n if recipe\n @comments = []\n comments = recipe.comments\n for comment in comments\n comment_user = comment.user\n @comments << { :user => comment_user, :profile_picture => comment_user.profile_picture.url, :comment => comment }\n end\n\n format.json { render :json => @comments }\n else\n format.json { render :status => 404, :json => { :message => \"No such Recipe\"}}\n end\n end\n end", "def list \n @comment = Comment.all\n end", "def index\n @course_comments = CourseComment.all\n end", "def book_comment_params\n params.require(:book_comment).permit(:user_id, :book_id, :content, :grade)\n end", "def index\n redirect_to(books_path) and return false unless params[:user_id]\n @user = User.find(params[:user_id], :include => :comments)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @user.comments }\n end\n end", "def show\n @cook_book = CookBook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cook_book }\n end\n end", "def index\n @chapters = @book.chapters\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @chapters }\n end\n end", "def index\n @chapters = @book.chapters\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @chapters }\n end\n end", "def show\n\t\t@book_review = BookReview.find(params[:id])\n\t\t@book = Book.find_by_id(@book_review.book_id)\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render :json => @book_review }\n\t\tend\n\tend", "def index\n @books = Book.find_all_by_user_id(current_user)\n\n respond_to do |format|\n format.html\n format.json { render json: @books }\n end\n end", "def index\n @c_likes = CLike.all\n if params[:comment_id].present?\n like = CLike.find_by(user_id: current_user.id, comment_id: params[:comment_id])\n render json: {status: 'success', like: like, counts: CLike.where(comment_id: params[:comment_id]).count, liked: like.present?}\n end\n end" ]
[ "0.7269053", "0.6924966", "0.6839732", "0.6730201", "0.65364146", "0.6447092", "0.64128506", "0.6361969", "0.6346279", "0.63274133", "0.62399083", "0.6164545", "0.61640817", "0.61523545", "0.6130221", "0.6126142", "0.61240786", "0.6059368", "0.6043839", "0.60238475", "0.6002527", "0.59804523", "0.59713966", "0.59574735", "0.5954568", "0.59487265", "0.59487265", "0.59333825", "0.5930601", "0.59263724", "0.59122175", "0.5882055", "0.5871803", "0.58639634", "0.5846124", "0.5829721", "0.5811821", "0.5791552", "0.57881695", "0.57881695", "0.57881695", "0.57790875", "0.5772823", "0.5771069", "0.5770006", "0.5754668", "0.57546127", "0.5730466", "0.5728111", "0.5725689", "0.5725469", "0.572335", "0.5714929", "0.57050323", "0.56901973", "0.5686515", "0.5681754", "0.5680288", "0.5649957", "0.56475306", "0.56449395", "0.5643442", "0.5642144", "0.56419873", "0.5637746", "0.5628711", "0.5623513", "0.56188935", "0.56188935", "0.56188935", "0.5614923", "0.56088126", "0.5606521", "0.55958265", "0.5590572", "0.5585244", "0.5583909", "0.55718267", "0.5568124", "0.55639064", "0.5555226", "0.5552453", "0.5539871", "0.5528679", "0.55285746", "0.55183476", "0.55113393", "0.55089754", "0.54961455", "0.54960227", "0.54934", "0.5491579", "0.5490705", "0.5488674", "0.5488296", "0.54843", "0.54843", "0.5478437", "0.5478404", "0.54777956" ]
0.7526721
0
GET /book_commentaries/1 GET /book_commentaries/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @book_commentaries = BookCommentary.all\n end", "def index\n # retrieve comments from db, including the user\n comments = @book.comments.includes(:user).order(id: :desc)\n render json: comments, status: :ok\n end", "def index \n #@comments = Comment.all\n @bookId = params[:bookId]\n session[:bookId] = params[:bookId] # put book id in session\n @comments = Comment.find(:all, :conditions => 'book_id = ' + @bookId)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comments }\n end\n end", "def index\n if params[:user_id]\n @comments = find_user.comments\n render json: @comments\n elsif params[:book_id]\n @comments = find_book.comments\n render json: @comments\n else\n @comments = Comment.all\n render json: @comments\n end\n end", "def index\n @book_comments = BookComment.all\n end", "def set_book_commentary\n @book_commentary = BookCommentary.find(params[:id])\n end", "def comments\n client.get(\"/#{id}/comments\")\n end", "def comments; rest_query(:comment); end", "def book\n @book = Book.published.find(params[:id])\n render json: @book\n end", "def index\n #@comments = Comment.all\n comments = @blog.comments\n render json: comments, status: :ok\n end", "def index\n @comments = Comment.where(\n \"auction_id = ? \",\n params[:auction_id])\n\n render json: @comments\n end", "def show\n render json: { comment: @comment, replaies: @comment.replaies }, status: :ok\n end", "def index\n if params[:comment_id].nil?\n render json: {\n comments: @card.comments.paginate(page: params[:page], per_page: 3)\n }, statues: :ok\n else\n @comment = Comment.find(params[:comment_id])\n render json: {\n comment: @comment,\n replaies: @comment.replaies.paginate(page: params[:page], per_page: 3)\n }, statues: :ok\n end\n end", "def show\n @book = Book.find(params[:id], :include => [{:comments => :user}, :authors])\n @comments = @book.comments\n @authors = @book.authors\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def index\n @commentaries = Commentary.all\n end", "def create\n @book_commentary = BookCommentary.new(book_commentary_params)\n\n respond_to do |format|\n if @book_commentary.save\n format.html { redirect_to @book_commentary.book, notice: 'Book commentary was successfully created.' }\n format.json { render :show, status: :created, location: @book_commentary }\n else\n format.html { render :new }\n format.json { render json: @book_commentary.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @comments = Comment.all\n render json: @comments\n end", "def index\n @comments = @commentable.comments\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comments }\n end\n end", "def show\n @new_comment = Comment.new\n @comments = @book.comments.order(\"updated_at DESC\")\n end", "def book_commentary_params\n params.require(:book_commentary).permit(:commentary, :book_id)\n end", "def show\n @comments = Recipe.find(params[:recipe_id]).comments.all\n @comment = Recipe.find(params[:recipe_id]).comments.find(params[:id]) \n if @comment \n respond_to do |f|\n f.html {render :index}\n f.json {render json: @comment}\n end\n else\n @comments\n respond_to do |f|\n f.html {render :index}\n f.json {render json: @comments}\n end\n end\n end", "def index\n @album = Album.find(params[:album_id])\n @photo = @album.photos.find(params[:photo_id])\n @comments = @photo.comments.all\n \n respond_to do |format|\n format.json { render :json => @comments.to_json }\n end\n end", "def comments\n @article = Article.find(params[:id])\n @comments = @article.comments\n\n respond_to do |format|\n format.html \n format.json { render json: @comments, status: :ok }\n end\n end", "def index\n @verse_commentaries = VerseCommentary.all\n end", "def index\n author = Author.find(params[:author_id])\n @reviews = author.reviews\n render json: @reviews\n end", "def comments\n Birdman::ApiPaginatedCollection.new(\"movies/#{id}/comments\")\n end", "def list\n comments = Comment.where(post: @post)\n render json: comments, status: 200\n end", "def create\n @book_comment = current_user.book_comments.new(book_comment_params)\n @book_comment.book_id = @book_detail.id\n @book_comment.save\n\n # 表示用。後で名前見やすくする\n @book_comments = @book_detail.book_comments.all\n end", "def index\n @commentable = find_commentable\n @comments = @commentable.comments\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @carts }\n end\n end", "def show\n @book_review = BookReview.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book_review }\n end\n end", "def comments\n @list.client.get(\"#{url}/comments\")\n end", "def comments\n @list.client.get(\"#{url}/comments\")\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n\n format.json { render json: @book }\n end\n end", "def index\n @comments = DiscussionComment.all\n render json: @comments\n end", "def fetch_book_info\n url = \"#{BASE_URL}/#{book_id}\"\n resp = RestClient::Request.execute(url: url, method: \"GET\")\n resp_obj = JSON.parse(resp)\n\n {\n id: book_id,\n title: resp_obj[\"volumeInfo\"][\"title\"],\n author: resp_obj[\"volumeInfo\"][\"authors\"][0],\n image: resp_obj[\"volumeInfo\"][\"imageLinks\"] ? resp_obj[\"volumeInfo\"][\"imageLinks\"][\"thumbnail\"] : DEFAULT_IMAGE\n }\n end", "def show\n @library_book = LibraryBook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @library_book }\n end\n end", "def comments\n render json: @post.comments\n end", "def index\n @comments = Comment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comments }\n end\n end", "def index\n @comments = Comment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comments }\n end\n end", "def index\n @comments = Comment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comments }\n end\n end", "def show\n recipe = Recipe.find_by_id(params[:id])\n\n respond_to do |format|\n if recipe\n @comments = []\n comments = recipe.comments\n for comment in comments\n comment_user = comment.user\n @comments << { :user => comment_user, :profile_picture => comment_user.profile_picture.url, :comment => comment }\n end\n\n format.json { render :json => @comments }\n else\n format.json { render :status => 404, :json => { :message => \"No such Recipe\"}}\n end\n end\n end", "def index\n\t\trender json: current_user.noteBooks.as_json(:include=> [:notes=>{:only=>[\"id\"]}])\n # render json: NoteBook.all.as_json(:include=> [:notes=>{:only=>[\"id\"]}])\n\tend", "def show\n # comment = Comment.find_comment\n render json: @comment\n end", "def index\n @post = Post.find_by_id(params[:post_id])\n if @post.nil?\n return render json: { error: \"Post not found\" }, status: :not_found\n end\n render json: @post.comments,status: 200\n end", "def show\n @casualcomment = Casualcomment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @casualcomment }\n end\n end", "def index\n @section_comments = SectionComment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @section_comments }\n end\n end", "def index\n comments = @project.comments\n render json: comments\n end", "def set_book_comment\n @book_comment = BookComment.find(params[:id])\n end", "def index\n if params[:book_id]\n @book = Book.find(params[:book_id])\n recipes = @book.recipes\n render json: RecipeSerializer.new(recipes).to_serialized_json\n else \n recipes = Recipe.all.order(:name)\n render json: RecipeSerializer.new(recipes).to_serialized_json\n end\n end", "def index\n if params[:book_id]\n @book = Book.where(isbn: params[:book_id]).first\n if !@book.nil?\n @reviewings = @book.reviewings \n end\n end\n end", "def index\n @books = Book.all\n render json: @books\n end", "def show\n @book.counter += 1\n @book.save\n @comments = @book.comments.recent.limit(10).all\n @relateds = @book.category.books.limit(5)\n end", "def show\n @comment_relationship = CommentRelationship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comment_relationship }\n end\n end", "def index\n @comments = @commentable.comments\n end", "def index\n @bookings = Booking.all\n\n render json: @bookings\n end", "def show\n render json: @book\n end", "def index\n base_url = 'https://www.googleapis.com/books/v1/volumes?q=fiction&maxResults=20'\n and_key = '&key='\n key = ENV['GOOGLE_BOOKS_API_KEY'] \n googleurl = base_url + and_key + key\n\n response = RestClient.get(googleurl)\n @books = JSON.parse(response)\n\n respond_to do |format|\n format.html\n format.json { render json: @books }\n end\n\nend", "def index\n @reviews = Review.find(params[:burger_place_id])\n\n render json: @reviews\n end", "def index\n @comments = @complaint.comments\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @comments }\n format.js\n end\n end", "def update\n respond_to do |format|\n if @book_commentary.update(book_commentary_params)\n format.html { redirect_to @book_commentary.book, notice: 'Book commentary was successfully updated.' }\n format.json { render :show, status: :ok, location: @book_commentary }\n else\n format.html { render :edit }\n format.json { render json: @book_commentary.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @comment = @commentable.comments.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comment }\n end\n end", "def show\n @cook_book = CookBook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cook_book }\n end\n end", "def show\n @user = current_user\n book_owner = User.where(id: @book.owner_id)\n book_owner = book_owner[0]\n @book_owner_lat = book_owner[\"lat\"]\n @book_owner_lng = book_owner[\"lng\"]\n @book_owner_add = book_owner[\"address\"]\n #@comments = Comment.order('created_at DESC').where(commentable_id: @book.id)\n @comments = Comment.unscoped { Comment.order(\"created_at DESC\").where(commentable_id: @book.id).limit(20) }\n end", "def index\n @bookings = Booking.all.map { |b| [b, b.contact, b.persons.first] }\n respond_to do |format|\n format.html\n format.json { render json: @bookings }\n end\n end", "def show\n comment = Comment.find(params[:id])\n render json: comment, status: 200\n end", "def show\n\t\t@book_review = BookReview.find(params[:id])\n\t\t@book = Book.find_by_id(@book_review.book_id)\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render :json => @book_review }\n\t\tend\n\tend", "def show\n @post = Post.find(params[:id])\n @comments = Comment.where(:post_id => params[:id]).order(\"id desc\")\n @comments = @comments.page(params[:page]).per(20)\n @comment = Comment.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end", "def new\n @comment = Comment.new\n if params[:recipe] != nil\n @recipe = Recipe.find(params[:recipe].to_i)\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end", "def index\n comments = @post.comments\n render json: { comments: comments }\n #loop through comments and find first and last name by user_id\n #User.find....etc\n end", "def index\n render json: Album.find(params[:album_id]).reviews\n end", "def show\n @comment = @posting.comments.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comment }\n end\n end", "def show\n @new_comment = Comment.build_from(@post, \"\")\n\n render json: @post, status: 200\n\n\n end", "def index\n @comments = Comment.where('user_id = ?', current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comments }\n end\n end", "def index\n @comments = Comment.paginate(:page => params[:page])\n @ticket = Ticket.find(params[:ticket_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comments }\n end\n end", "def show\n render json: @comment\n end", "def order_book(params)\n Client.current.get(\"#{resource_url}/book\", params)\n end", "def index\r\n if params[:review_id].nil?\r\n @comments = Comment.all\r\n else\r\n @review = Review.find(params[:review_id])\r\n @comments = @review.comments\r\n end\r\n\r\n respond_to do |format|\r\n format.html\r\n format.xml { render :xml => @comments }\r\n end\r\n end", "def destroy\n @book_commentary.destroy\n respond_to do |format|\n format.html { redirect_to book_commentaries_url, notice: 'Book commentary was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def show\n @scholarship_comment = ScholarshipComment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @scholarship_comment }\n end\n end", "def new\n @book_review = BookReview.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book_review }\n end\n end", "def show\n render json: { blog: @blog, comments: @blog.comments }\n end", "def show\n @dealocity_comment = DealocityComment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dealocity_comment }\n end\n end", "def get_reviews\n @comment_reviews = CommentReview.where('comment_id = ?', params[:comment_id])\n end", "def create\n @book_comment = BookComment.new(book_comment_params)\n @book_comment.user_id = current_user.id\n\n respond_to do |format|\n if @book_comment.save\n format.html { redirect_to @book_comment, notice: 'Book comment was successfully created.' }\n format.json { render :show, status: :created, location: @book_comment }\n else\n format.html { render :new }\n format.json { render json: @book_comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n @current_page = 'recettes'\n\n @recette = Recette.includes(:photo_files).find(params[:id])\n @categories = Category.all\n\n @comments = Recette.find(params[:id]).comments.limit(3).order('id desc')\n @comment = Comment.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recette }\n end\n end", "def index\n @api_v1_answer_comments = Api::V1::AnswerComment.all\n end", "def show\n @comment = Comment.find(params[:id])\n render json:@comment\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def index\n @notebooks = Notebook.all\n render json: @notebooks\n end", "def index\n @resumes = Resume.where(:book_id => params[:book_id])\n\n render json: @resumes\n end", "def new\n @chapter.book = Book.find params[:book]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @chapter }\n end\n end" ]
[ "0.73549116", "0.7165666", "0.6976535", "0.6914142", "0.67884547", "0.6641671", "0.6565408", "0.65499735", "0.6491359", "0.6417049", "0.6352553", "0.63371533", "0.6322854", "0.63165915", "0.6302096", "0.6219385", "0.6210678", "0.6194732", "0.618536", "0.61334354", "0.61167496", "0.607129", "0.60638684", "0.6058823", "0.6027166", "0.6018048", "0.60102826", "0.59765315", "0.5973443", "0.59723496", "0.59537333", "0.59537333", "0.59521824", "0.5932798", "0.5930954", "0.59285223", "0.591502", "0.5914431", "0.5914431", "0.5914431", "0.5905812", "0.59046996", "0.59018624", "0.590035", "0.5894626", "0.5893573", "0.5893432", "0.58924425", "0.58794194", "0.58627284", "0.58377206", "0.583319", "0.58154225", "0.5810553", "0.58046514", "0.5803632", "0.58017355", "0.5792795", "0.57907706", "0.5790755", "0.5788301", "0.578813", "0.5782883", "0.57794976", "0.57765615", "0.57752913", "0.5770201", "0.5768737", "0.57637733", "0.57556313", "0.5741546", "0.573721", "0.57299036", "0.5728755", "0.57224303", "0.5721202", "0.5711874", "0.5702771", "0.57026047", "0.5701726", "0.5699712", "0.5698071", "0.56973636", "0.5686741", "0.5684833", "0.5684833", "0.5684243", "0.5683293", "0.56806916", "0.5679983", "0.5679983", "0.5679983", "0.5679983", "0.5679983", "0.5679983", "0.5679983", "0.5679983", "0.5679983", "0.5667426", "0.5666512", "0.56633544" ]
0.0
-1
POST /book_commentaries POST /book_commentaries.json
def create @book_commentary = BookCommentary.new(book_commentary_params) respond_to do |format| if @book_commentary.save format.html { redirect_to @book_commentary.book, notice: 'Book commentary was successfully created.' } format.json { render :show, status: :created, location: @book_commentary } else format.html { render :new } format.json { render json: @book_commentary.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def book_commentary_params\n params.require(:book_commentary).permit(:commentary, :book_id)\n end", "def create\n @book = Book.new(book_params)\n if params[:commit] == \"追加\" then\n @book.comments.build\n\n render :action => :new\n return\n end\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render action: 'show', status: :created, location: @book }\n else\n format.html { render action: 'new' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book_comment = BookComment.new(book_comment_params)\n @book_comment.user_id = current_user.id\n\n respond_to do |format|\n if @book_comment.save\n format.html { redirect_to @book_comment, notice: 'Book comment was successfully created.' }\n format.json { render :show, status: :created, location: @book_comment }\n else\n format.html { render :new }\n format.json { render json: @book_comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @book_commentaries = BookCommentary.all\n end", "def set_book_commentary\n @book_commentary = BookCommentary.find(params[:id])\n end", "def create\n @book_comment = current_user.book_comments.new(book_comment_params)\n @book_comment.book_id = @book_detail.id\n @book_comment.save\n\n # 表示用。後で名前見やすくする\n @book_comments = @book_detail.book_comments.all\n end", "def create\n @book = Book.new(book_params)\n\n if @book.save\n render json: @book, status: :created, location: @book\n else\n render json: @book.errors, status: :unprocessable_entity\n end\n end", "def create_post_comment\n @commentary = Commentary.new(commentary_params)\n @commentary.post_id = params[:post_id]\n @commentary.user_id = params[:user_id]\n @commentary.answer_id = nil\n @commentary.comment = params[:commentary][:comment]\n\n respond_to do |format|\n if @commentary.save\n format.html { redirect_to @post, notice: 'Comment was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { redirect_to @post, alert: 'Comment was NOT successfully created.' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def book_comment_params\n params.require(:book_comment).permit(:user_id, :book_id, :content, :grade)\n end", "def create\n @blogpost = Blogpost.find(params[:blogpost_id])\n\n @comment = @blogpost.comments.create(comment_params)\n render json: @comment\n end", "def create\n \n \n @booktitle = Book.find_by_title(book_params[:title])\n if Book.where(:title => book_params[:title]).present?\n @book = Book.find(@booktitle.id)\n @book.count = @book.count + book_params[:count].to_i\n else\n if !(Author.where(:name => book_params[:author_name]).present?)\n @author = Author.create(:name => book_params[:author_name],\n :category => book_params[:category])\n end\n @book = Book.new(book_params)\n @book.author_id = Author.find_by_name(book_params[:author_name]).id\n end\n\n \n respond_to do |format|\n if @book.save\n \n format.json { render json: @book, status: :created, location: @book }\n else\n \n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @comment = Comment.new(comment_params)\n @comment.user = current_user\n if @comment.save\n render json: @comment\n # redirect_to recipe_path(@comment.recipe.id, @comment)\n else\n render \"recipes/show\"\n end\n end", "def create\n @biography_book = current_user.biography_books.build(biography_book_params)\n\n respond_to do |format|\n if @biography_book.save\n format.html { redirect_to @biography_book, notice: \"Biography review was successfully created.\" }\n format.json { render :show, status: :created, location: @biography_book }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @biography_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @book_commentary.destroy\n respond_to do |format|\n format.html { redirect_to book_commentaries_url, notice: 'Book commentary was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create\n\t\t@book_review = BookReview.new(params[:book_review])\n\t\t@book_review.user_id = current_user.id\n\t\t@book_review.book_id = params[:book_id]\n\n\t\trespond_to do |format|\n\t\t\tif @book_review.save\n\t\t\t\tformat.html { redirect_to @book_review, :notice => 'Book review was successfully created.' }\n\t\t\t\tformat.json { render :json => @book_review, :status => :created, :location => @book_review }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\t\tformat.json { render :json => @book_review.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def create\n #@comment = Comment.new(comment_params)\n @comment = @blog.comments.new(comment_params)\n \n if @comment.save\n render json: @comment, status: :created\n else\n render json: {\n error: @comment.errors.full_messages\n }, status: :unprocessable_entity\n end\n end", "def create\n json_create_and_sanitize(comment_params, Comment)\n end", "def create\n @comment = Comment.new({user_id: params[:user_id], announcement_id: params[:announcement_id], description: params[:description]})\n @comment.save\n render json:@comment\n end", "def create\n if params[:sub_chapter_id]\n commentable = SubChapter.find(params[:sub_chapter_id])\n elsif params[:chapter_id]\n commentable = Chapter.find(params[:chapter_id])\n elsif params[:book_id]\n commentable = Book.find(params[:book_id])\n end\n \n @comment = commentable.comments.build(params[:comment])\n @comment.user_id = current_user.id\n respond_to do |format|\n if @comment.save\n flash[:notice] = 'Comment was successfully created.'\n format.html { redirect_to_commentable(@comment) }\n format.xml { render :xml => @comment, :status => :created, :location => @comment }\n else\n logger.debug(@comment.errors.full_messages.inspect)\n format.html { render :action => \"new\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @note_book = NoteBook.new(note_book_params)\n\n respond_to do |format|\n if @note_book.save\n format.html { redirect_to @note_book, notice: 'Note book was successfully created.' }\n format.json { render :show, status: :created, location: @note_book }\n else\n format.html { render :new }\n format.json { render json: @note_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.find(params[:book_id])\n @review = @book.reviews.build(review_params)\n @review.user = current_user\n\n respond_to do |format|\n if @review.save\n format.html { redirect_to book_path(@book), notice: 'Su crítica se envió correctamente.' }\n format.json { render :show, status: :created, location: @review }\n format.js\n else\n format.html { render :new }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end", "def create\n @comment = @post.comments.new(comment_params)\n if @comment.save\n render json: @comment, status: :created\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n\n end", "def create\n @book_review = BookReview.new(params[:book_review])\n\n respond_to do |format|\n if @book_review.save\n format.html { redirect_to @book_review, notice: 'Book review was successfully created.' }\n format.json { render json: @book_review, status: :created, location: @book_review }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book_review.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @borrowed_book = BorrowedBook.new(borrowed_book_params)\n respond_to do |format|\n if @borrowed_book.save\n borrow(@borrowed_book)\n format.html { redirect_to @borrowed_book, notice: 'Borrowed book was successfully created.' }\n format.json { render :show, status: :created, location: @borrowed_book }\n else\n format.html { render :new }\n format.json { render json: @borrowed_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @api_book = Api::Book.new(api_book_params)\n\n if @api_book.save\n render json: @api_book, status: :created, location: @api_book\n else\n render json: @api_book.errors, status: :unprocessable_entity\n end\n end", "def create\n @library_book = LibraryBook.new(params[:library_book])\n\n respond_to do |format|\n if @library_book.save\n format.html { redirect_to @library_book, notice: 'Library book was successfully created.' }\n format.json { render json: @library_book, status: :created, location: @library_book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @library_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def book_params\n params.require(:book).permit(:title,:id,:comments_attributes =>[:content,:id])\n end", "def create\n @bookreview = Bookreview.new(bookreview_params)\n\n respond_to do |format|\n if @bookreview.save\n format.html { redirect_to book_path(@bookreview.book_id), notice: 'Bookreview was successfully created.' }\n format.json { render action: 'show', status: :created, location: @bookreview }\n else\n format.html { render action: 'new' }\n format.json { render json: @bookreview.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(params[:book])\n \n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @borrowed_book = BorrowedBook.new(borrowed_book_params)\n\n respond_to do |format|\n if @borrowed_book.save\n format.html { redirect_to @borrowed_book, notice: \"Borrowed book was successfully created.\" }\n format.json { render :show, status: :created, location: @borrowed_book }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @borrowed_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @verse_commentary = @verse.build_verse_commentary(verse_commentary_params)\n\n respond_to do |format|\n if @verse_commentary.save\n format.html { redirect_to @verse, notice: 'Verse commentary was successfully created.' }\n format.json { render :show, status: :created, location: @verse_commentary }\n else\n format.html { render :new }\n format.json { render json: @verse_commentary.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_book(book_title)\n @books << {\n title: book_title,\n rental_details: {\n student_name: \"\",\n date: \"\"\n }\n }\n end", "def update\n respond_to do |format|\n if @book_commentary.update(book_commentary_params)\n format.html { redirect_to @book_commentary.book, notice: 'Book commentary was successfully updated.' }\n format.json { render :show, status: :ok, location: @book_commentary }\n else\n format.html { render :edit }\n format.json { render json: @book_commentary.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @library_book = LibraryBook.new(library_book_params)\n\n respond_to do |format|\n if @library_book.save\n format.html { redirect_to @library_book, notice: 'Library book was successfully created.' }\n format.json { render :show, status: :created, location: @library_book }\n else\n format.html { render :new }\n format.json { render json: @library_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to \"/books\", notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @comment = @noticia.comments.create(comment_params)\n\n if @comment.save\n render json: @comment, status: :created\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n end", "def create\n @book = Book.new(book_params)\n Rails.logger = Logger.new(STDOUT)\n logger.debug \"params passed is #{book_params}\"\n @book.is_deleted = false\n\n if !@current_librarian.nil?\n @book[:library_id] = @current_librarian.library_id\n @book[:associated_library] = @current_librarian.library.name\n end\n\n respond_to do |format|\n if @book.save\n logger.debug \"Book saved with id #{@book.id}\"\n format.html { redirect_to @book, notice: 'Book was successfully added.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n puts params.to_json\n @post = Post.find(params[:comment][:post_id])\n @comment = @post.comments.build(comment_params)\n if @comment.save\n redirect_to root_path\n end\n end", "def create\n @book = Book.find(book_request_params[:book_id])\n @account = Account.find(params[:account_id])\n @book_request = BookRequest.new(book: @book, reader: @account, holder: @book.account)\n respond_to do |format|\n if @book_request.save\n format.json {\n render json:\n {\n book_id: @book_request.book_id,\n book_request_state: @book_request.state_name\n }\n }\n else\n format.json { render json: @book_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n\n params[:book][:author_id].each do |item| # A block of code to set current note sharing options with other users\n if (!item.blank?)\n @NewBookAuthor = AuthorsBook.new(:book_id => @book.id, :author_id => item)\n @NewBookAuthor.save\n end\n end\n\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cook_book = CookBook.new(params[:cook_book])\n\n respond_to do |format|\n if @cook_book.save\n format.html { redirect_to @cook_book, notice: 'Cook book was successfully created.' }\n format.json { render json: @cook_book, status: :created, location: @cook_book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cook_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: t('common.message.created_success')}\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.create( params[:book] )\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to books_path, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @poetry_anthology_book = current_user.poetry_anthology_books.build(poetry_anthology_book_params)\n\n respond_to do |format|\n if @poetry_anthology_book.save\n format.html { redirect_to @poetry_anthology_book, notice: \"Poetry anthology review was successfully created.\" }\n format.json { render :show, status: :created, location: @poetry_anthology_book }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @poetry_anthology_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n logger.debug \"#{book_params}\"\n @book = Book.new(book_params)\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n session = UserSession.find_by_authentication_token(params[:authentication_token])\n user = session.user\n \n respond_to do |format|\n if user\n @comment = Comment.new(:user_id => user.id, :recipe_id => params[:recipe_id], :text => params[:text])\n \n if @comment.save\n recipe = Recipe.find_by_id([params[:recipe_id]])\n\n @comments = recipe.fetch_comments\n format.json { render :json => { :comments => @comments, :message => \"success\"} }\n else\n format.json { render :status => 500, :json => { :message => \"There was an error uploading your comment.\" }}\n end\n else\n format.json { render :json => { :message => \"Invalid authentication token\"}} \n end\n end\n end", "def create\n @learning_resource = LearningResource.find(params[:learning_resource_id])\n @learning_resource_comment = @learning_resource.learning_resource_comments.new(learning_resource_comment_params)\n @learning_resource_comment.user = current_user\n\n respond_to do |format|\n if @learning_resource_comment.save\n format.html { redirect_to @learning_resource, notice: 'Learning resource comment was successfully created.' }\n format.json { render json: @learning_resource_comment, status: :created, location: @learning_resource_comment }\n else\n format.html { render :new }\n format.json { render json: @learning_resource_comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(book_params)\n resort_orders\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def commentary_params\n params.require(:commentary).permit(:user_id, :comment, :post_id, :answer_id)\n end", "def create\n @book_approval = BookApproval.new(book_approval_params)\n\n respond_to do |format|\n if @book_approval.save\n format.html { redirect_to @book_approval, notice: 'Book approval was successfully created.' }\n format.json { render :show, status: :created, location: @book_approval }\n else\n format.html { render :new }\n format.json { render json: @book_approval.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @loan = Loan.new(loan_params)\n @book = Book.find_by( params[:book_id] )\n\n respond_to do |format|\n if @loan.save\n format.html { redirect_to @loan, notice: 'Book successfully borrowed' }\n format.json { render :show, status: :created, location: @loan }\n else\n format.html { redirect_to books_path, alert: 'Book not available' }\n end\n end\n end", "def create\n @book = params[:book]\n add(@book)\n end", "def create\n post = Post.find(params[:post_id])\n @comment = post.comments.new(comment_params)\n if @comment.save\n render json: {\n data: @comment\n }\n else\n render json: {\n errors: @comment.errors\n }\n end\n end", "def create\n @book = Book.new(book_params)\n @categories = Category.all.order('name asc')\n respond_to do |format|\n if @book.save\n format.html { redirect_to books_url, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n @categories = Category.all.order('name asc')\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: \"Book was successfully created.\" }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: \"Book was successfully created.\" }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cook_book = CookBook.new(cook_book_params)\n\n respond_to do |format|\n if @cook_book.save\n format.html { redirect_to @cook_book, notice: 'Cook book was successfully created.' }\n format.json { render :show, status: :created, location: @cook_book }\n else\n format.html { render :new }\n format.json { render json: @cook_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cbook = Cbook.new(cbook_params)\n\n respond_to do |format|\n if @cbook.save\n format.html { redirect_to @cbook, notice: 'Cbook was successfully created.' }\n format.json { render :show, status: :created, location: @cbook }\n else\n format.html { render :new }\n format.json { render json: @cbook.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @book_comments = BookComment.all\n end", "def create\n @comment_relationship = CommentRelationship.new(params[:comment_relationship])\n\n respond_to do |format|\n if @comment_relationship.save\n format.html { redirect_to @comment_relationship, notice: 'Comment relationship was successfully created.' }\n format.json { render json: @comment_relationship, status: :created, location: @comment_relationship }\n else\n format.html { render action: \"new\" }\n format.json { render json: @comment_relationship.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to manage_books_path, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def verse_commentary_params\n params.require(:verse_commentary).permit(:commentary, :verse_id)\n end", "def create\n @comment = Comment.new(params[:comment])\n @comment.recipe_id = params[:recipe_id].to_i\n @comment.user_id = params[:user_id].to_i\n @recipe = Recipe.find(@comment.recipe_id)\n\n respond_to do |format|\n if @comment.save\n format.html { redirect_to @recipe, notice: 'Comment was successfully created.' }\n format.json { render json: @recipe, status: :created, location: @comment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n # retrieve comments from db, including the user\n comments = @book.comments.includes(:user).order(id: :desc)\n render json: comments, status: :ok\n end", "def create\n\n\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n puts @book.as_json \n format.json { render :show, status: :created, location: @book }\n else\n \n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @library_book = current_user.books.new(library_book_params)\n\n respond_to do |format|\n if @library_book.save\n format.html { redirect_to @library_book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @library_book }\n else\n format.html { render :new }\n format.json { render json: @library_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @comment = Comment.new(comment_params)\n\n respond_to do |format|\n if @comment.save\n format.json { render :show, status: :created, location: @comment }\n else\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(book_params)\n #for author_id in params[:authors_ids]\n # @book.authors << Author.find(author_id)\n #end\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def recipe_comment_params\n params.require(:recipe_comment).permit(:title, :body)\n end", "def create_comments\n end", "def create_comments\n end", "def create_comments\n end", "def create\n comment = Comment.new(create_params)\n comment.post = @post\n if comment.save\n render json: comment, status: 200\n else\n render json: comment.errors, status: 403\n end\n\n end", "def create\n booking = Booking.create(booking_params)\n render json: booking\n end", "def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render action: 'show', status: :created, location: @book }\n else\n format.html { render action: 'new' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @author_book = AuthorBook.new(author_book_params)\n\n respond_to do |format|\n if @author_book.save\n format.html { redirect_to @author_book, notice: 'Author book was successfully created.' }\n format.json { render :show, status: :created, location: @author_book }\n else\n format.html { render :new }\n format.json { render json: @author_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @order_book = OrderBook.new(order_book_params)\n\n respond_to do |format|\n if @order_book.save\n format.html { redirect_to @order_book, notice: 'Order book was successfully created.' }\n format.json { render :show, status: :created, location: @order_book }\n else\n format.html { render :new }\n format.json { render json: @order_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bill_comment = BillComment.new(bill_comment_params)\n\n respond_to do |format|\n if @bill_comment.save\n format.html { redirect_to @bill_comment, notice: 'Bill comment was successfully created.' }\n format.json { render :show, status: :created, location: @bill_comment }\n else\n format.html { render :new }\n format.json { render json: @bill_comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = @collection.books.build(params[:book])\n #original: @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to book_series_collection_books_url(@book_series, @collection), notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_comment(comment, poi=\"4f4f4c27d4374e800100001d\")\n uri = URI.parse(\"http://mashweb.fokus.fraunhofer.de:3008/api/comment\")\n response = Net::HTTP.post_form(uri, {\n :title => 'Autocomment',\n :body => comment\n })\n end", "def create\n @book = Book.new(params[:book])\n\n for article in @book.articles\n current_aspect.references << article\n end\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render layout: 'form', action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6826987", "0.6520261", "0.6514716", "0.6291203", "0.6246639", "0.6140885", "0.607609", "0.60046864", "0.5999688", "0.59468454", "0.590584", "0.5870856", "0.58676445", "0.5865396", "0.58407503", "0.5827393", "0.58258957", "0.5804135", "0.58033305", "0.5802826", "0.578414", "0.5783385", "0.5773788", "0.5771552", "0.5770413", "0.5768419", "0.57632375", "0.57620305", "0.57519025", "0.5748715", "0.5748609", "0.5744807", "0.5742178", "0.5737832", "0.57147527", "0.5713026", "0.57091147", "0.5707914", "0.5707354", "0.5691884", "0.5679802", "0.5676378", "0.5675177", "0.5668545", "0.56496406", "0.56463134", "0.56463134", "0.56463134", "0.56463134", "0.56463134", "0.56429976", "0.5640701", "0.56216574", "0.5620688", "0.5615276", "0.5612311", "0.5605604", "0.55983347", "0.5590625", "0.55890274", "0.5584539", "0.5584539", "0.55843663", "0.5580913", "0.5580913", "0.5580913", "0.5580913", "0.5580913", "0.5580913", "0.5580913", "0.5580913", "0.5580913", "0.5580913", "0.5580913", "0.5580913", "0.5580913", "0.55765754", "0.5575377", "0.5574632", "0.55662936", "0.55648047", "0.5560189", "0.55528694", "0.55514777", "0.5549811", "0.5545211", "0.55428", "0.5540406", "0.55261064", "0.55261064", "0.55261064", "0.5526057", "0.5524435", "0.55187917", "0.55174357", "0.5516202", "0.55160207", "0.55141485", "0.55120534", "0.55108374" ]
0.7377099
0
PATCH/PUT /book_commentaries/1 PATCH/PUT /book_commentaries/1.json
def update respond_to do |format| if @book_commentary.update(book_commentary_params) format.html { redirect_to @book_commentary.book, notice: 'Book commentary was successfully updated.' } format.json { render :show, status: :ok, location: @book_commentary } else format.html { render :edit } format.json { render json: @book_commentary.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @book_comment.update(book_comment_params)\n format.html { redirect_to @book_comment, notice: 'Book comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @book_comment }\n else\n format.html { render :edit }\n format.json { render json: @book_comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n \n format.json { render json: @book, status: :created, location: @book }\n else\n \n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @api_book = Api::Book.find(params[:id])\n\n if @api_book.update(api_book_params)\n head :no_content\n else\n render json: @api_book.errors, status: :unprocessable_entity\n end\n end", "def update\n if params[:commit] == \"追加\" then\n @book.update_attributes(book_params)\n @book.comments.new\n render :action => :edit\n return\n end\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_book_commentary\n @book_commentary = BookCommentary.find(params[:id])\n end", "def update\n @comment = Comment.find(params[:comment_id])\n @comment.update(comment_params)\n render json: @comment\n end", "def update\n @book = Book.find(params[:id])\n \n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n if params[:action] == \"RETURN_BOOK\" \n @book.return()\n elseif params[:action] == \"BORROW_BOOK\"\n @book.borrow()\n end\n \n if @book.update(book_params)\n head :no_content\n else\n render json: @book.errors, status: :unprocessable_entity\n end\n end", "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, :notice => 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @book.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @book = @collection.books.find(params[:id])\n #original: @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to book_series_collection_books_url(@book_series, @collection), notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @note_book.update(note_book_params)\n format.html { redirect_to @note_book, notice: 'Note book was successfully updated.' }\n format.json { render :show, status: :ok, location: @note_book }\n else\n format.html { render :edit }\n format.json { render json: @note_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n @book = Book.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @book.update_attributes(params[:book])\r\n format.html { redirect_to books_url }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @book.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n json_update_and_sanitize(comment, comment_params, Comment)\n end", "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @cookbook = Cookbook.find(params[:id])\n\n respond_to do |format|\n if @cookbook.update_attributes(params[:cookbook])\n format.html { redirect_to @cookbook, notice: 'Cookbook was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cookbook.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @biography_book.update(biography_book_params)\n format.html { redirect_to @biography_book, notice: \"Biography review was successfully updated.\" }\n format.json { render :show, status: :ok, location: @biography_book }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @biography_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book = Book.find(params[:id])\n @book.attributes = params[:book]\n # a break point for debugging:\n # debugger\n client = Goodreads.new\n book_info = client.book_by_isbn(params[:book][:isbn])\n @book.title = book_info.title if @book.title.blank?\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render layout: 'form', action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @cook_book = CookBook.find(params[:id])\n\n respond_to do |format|\n if @cook_book.update_attributes(params[:cook_book])\n format.html { redirect_to @cook_book, notice: 'Cook book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cook_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @library_book = LibraryBook.find(params[:id])\n\n respond_to do |format|\n if @library_book.update_attributes(params[:library_book])\n format.html { redirect_to @library_book, notice: 'Library book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @library_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book = Book.find(params[:id])\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def book_commentary_params\n params.require(:book_commentary).permit(:commentary, :book_id)\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to [current_user, @book], notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to manage_books_path, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book_review = BookReview.find(params[:id])\n\n respond_to do |format|\n if @book_review.update_attributes(params[:book_review])\n format.html { redirect_to @book_review, notice: 'Book review was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book_review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n if @comment.update(comment_params)\n render json: @comment, status: :ok\n else\n render json: @comment.errors, status: :unprocessable_entity\n\n end\n\n\n end", "def update\n params[:book][:category_ids] = nil if params[:book][:category_ids].nil?\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to books_url, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n @categories = Category.all.order('name asc')\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n handle_book_categories\n format.html { redirect_to @book, notice: I18n.t(:changes_updated_successfully) }\n format.json { head :no_content }\n else\n @book_categories = {}\n BookCategory.all.order(:category_name).collect {|bc| @book_categories[bc.category_name] = bc.id }\n format.html { render action: 'edit' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: t('common.message.updated_success')}\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @mystery_book.update(mystery_book_params)\n format.html { redirect_to @mystery_book, notice: \"Mystery review was successfully updated.\" }\n format.json { render :show, status: :ok, location: @mystery_book }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @mystery_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bookreview.update(bookreview_params)\n format.html { redirect_to book_path(@bookreview.book_id), notice: 'Bookreview was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bookreview.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: \"Book was successfully updated.\" }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: \"Book was successfully updated.\" }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: \"Book was successfully updated.\" }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t\trespond_to do |format|\n\t\t\tclient = Goodreads::Client.new(api_key: \"rSkvvZY8Wx27zcj4AfHA\", api_secret: \"S5WOpmY8pVtaEu1IwNn51DBafjoEIbjuxZdE6sNM\")\n\t\t\tbook = client.book_by_isbn(book_params[:isbn])\n\t\t\t@book.titlelong = book.title\n\t\t\t@book.description = strip_tags(book.description)\n\t\t\t@book.title = book.work.original_title\n\t\t\t@book.pages = book.num_pages\n\t\t\t@book.bookrating = book.average_rating\n\t\t\t@book.author = book.authors.author.name\n\t\t\t@book.publisher = book.publisher\n\t\t\t@book.save\n\t\t\tformat.html { redirect_to @book, notice: 'Book was successfully updated.' }\n\t\t\tformat.json { render :show, status: :ok, location: @book }\n\t\tend\n end", "def update\n respond_to do |format|\n if @commentary.update(commentary_params)\n format.html { redirect_to @commentary, notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @commentary }\n else\n format.html { render :edit }\n format.json { render json: @commentary.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n add_title_to_book\n end", "def update\n @casualcomment = Casualcomment.find(params[:id])\n\n respond_to do |format|\n if @casualcomment.update_attributes(params[:casualcomment])\n format.html { redirect_to @casualcomment, notice: 'Casualcomment was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @casualcomment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book_request.update(book_request_params)\n format.html { redirect_to @book_request, notice: 'Book request was successfully updated.' }\n format.json { render :show, status: :ok, location: @book_request }\n else\n format.html { render :edit }\n format.json { render json: @book_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @library_book.update(library_book_params)\n format.html { redirect_to @library_book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @library_book }\n else\n format.html { render :edit }\n format.json { render json: @library_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cookbook.update(cookbook_params)\n format.html { redirect_to cookbook_path(@cookbook), notice: 'Cookbook was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cookbook.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book = Book.find_by_id(params[:id])\n\n if @book.present?\n if @book.update(book_params)\n render json: {\n type: 'success',\n result: @book\n }, status: :created\n else\n render json: {\n type: 'failed',\n message: @book.errors,\n result: {}\n }, status: :bad_request\n end\n else\n render json: {\n type: 'failed',\n message: 'data with id:' + params[:id] + ' not found',\n result: {},\n }, status: :not_found\n end\n end", "def update\n rewriteParams\n @book = Book.find(params[:id])\n @book.authors << Author.find(params[:author][:name]) if not params[:author][:name].empty?\n @book.book_types << BookType.find(params[:book_type][:name]) if not params[:book_type][:name].empty?\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to(@book, :notice => 'Book was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.xml { head :ok }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.xml { render xml: @book.errors, status: :unprocessable_entity}\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n comment = Comment.find(params[:id])\n if comment.update(params_comment)\n render json: comment, status: 200\n else\n render json: comment.errors, status: 422\n end\n\n end", "def update\n @user_book = UserBook.find(params[:id])\n\n respond_to do |format|\n if @user_book.update_attributes(params[:user_book])\n format.html { redirect_to new_user_book_path, notice: 'Your book was successfully updated. You can add more or go back to your shelf' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @realistic_fiction_book.update(realistic_fiction_book_params)\n format.html { redirect_to @realistic_fiction_book, notice: \"Realistic fiction review was successfully updated.\" }\n format.json { render :show, status: :ok, location: @realistic_fiction_book }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @realistic_fiction_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to [:admin, @book], notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cookbook.update(cookbook_params)\n format.html { redirect_to @cookbook, notice: 'Cookbook was successfully updated.' }\n format.json { render :show, status: :ok, location: @cookbook }\n else\n format.html { render :edit }\n format.json { render json: @cookbook.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @comment = Comment.find(params[:id])\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.json { render :json => @comment }\n else\n format.json { render :json => @comment.errors, :status => :unprocessable_entity}\n end\n end\n #respond_with(@post,@post.comments.update(params[:id],params[:comment]))\n end", "def update\n respond_to do |format|\n if @library_book.update(library_book_params)\n format.html { redirect_to @library_book, notice: 'Library book was successfully updated.' }\n format.json { render :show, status: :ok, location: @library_book }\n else\n format.html { render :edit }\n format.json { render json: @library_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n params[:book_shelf]['user'] = User.where(:id => params[:book_shelf]['user']).first\n params[:book_shelf]['book'] = Book.where(:id => params[:book_shelf]['book']).first\n @book_shelf = BookShelf.find(params[:id])\n respond_to do |format|\n if @book_shelf.update_attributes(params[:book_shelf])\n format.html { redirect_to @book_shelf, notice: 'Book shelf was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book_shelf.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order_book.update(order_book_params)\n format.html { redirect_to @order_book, notice: 'Order book was successfully updated.' }\n format.json { render :show, status: :ok, location: @order_book }\n else\n format.html { render :edit }\n format.json { render json: @order_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n respond_to do |format|\r\n if @book.update(book_params)\r\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @book }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @book.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n respond_to do |format|\n if @cook_book.update(cook_book_params)\n format.html { redirect_to @cook_book, notice: 'Cook book was successfully updated.' }\n format.json { render :show, status: :ok, location: @cook_book }\n else\n format.html { render :edit }\n format.json { render json: @cook_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cbook.update(cbook_params)\n format.html { redirect_to @cbook, notice: 'Cbook was successfully updated.' }\n format.json { render :show, status: :ok, location: @cbook }\n else\n format.html { render :edit }\n format.json { render json: @cbook.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @poetry_anthology_book.update(poetry_anthology_book_params)\n format.html { redirect_to @poetry_anthology_book, notice: \"Poetry anthology review was successfully updated.\" }\n format.json { render :show, status: :ok, location: @poetry_anthology_book }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @poetry_anthology_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @fault_book = FaultBook.find(params[:id])\n\n respond_to do |format|\n if @fault_book.update_attributes(params[:fault_book])\n format.html { redirect_to @fault_book, notice: 'Fault book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fault_book.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6877143", "0.67144275", "0.6464367", "0.64537007", "0.64527667", "0.635846", "0.6312781", "0.63031095", "0.6302168", "0.62990785", "0.62827307", "0.62820816", "0.6276795", "0.62756705", "0.62756705", "0.62756705", "0.62756705", "0.62756705", "0.62756705", "0.62756705", "0.62756705", "0.62756705", "0.62729645", "0.6259867", "0.6241164", "0.6216438", "0.6212383", "0.61976165", "0.61868715", "0.6177832", "0.6163642", "0.61440575", "0.61424965", "0.6142449", "0.61417836", "0.61417836", "0.61417836", "0.61417836", "0.614071", "0.61321145", "0.6131564", "0.6125248", "0.61172384", "0.61105365", "0.60966915", "0.60926884", "0.6091677", "0.6082178", "0.60820794", "0.60809255", "0.60809255", "0.60809255", "0.60809255", "0.60809255", "0.60809255", "0.60809255", "0.60809255", "0.60809255", "0.60809255", "0.60809255", "0.60809255", "0.60809255", "0.60809255", "0.60809255", "0.60809255", "0.60809255", "0.60809255", "0.60809255", "0.60809255", "0.60809255", "0.60809255", "0.60809255", "0.60809255", "0.60809255", "0.60756904", "0.60756904", "0.6070202", "0.6066989", "0.6045435", "0.60449815", "0.6035059", "0.60348785", "0.60307807", "0.6029718", "0.60292315", "0.602901", "0.6028972", "0.60218453", "0.6021183", "0.6018583", "0.6013471", "0.6013371", "0.60133475", "0.6011137", "0.6009448", "0.60072255", "0.60026526", "0.599649", "0.5995153", "0.5987679" ]
0.71911746
0
DELETE /book_commentaries/1 DELETE /book_commentaries/1.json
def destroy @book_commentary.destroy respond_to do |format| format.html { redirect_to book_commentaries_url, notice: 'Book commentary was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @book_comment.destroy\n respond_to do |format|\n format.html { redirect_to book_comments_url, notice: 'Book comment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n book = Book.find(params[:id])\n book.destroy\n \n render json: {}, status: 204\n end", "def destroy\n @api_book.destroy\n\n head :no_content\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n \n format.json { render json: @book, status: :created, location: @book }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n \n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @biography_book.destroy\n respond_to do |format|\n format.html { redirect_to biography_books_url, notice: \"Biography review was successfully deleted.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n\n @comment.destroy\n render json: @comment, status: :ok\n\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :ok }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :ok }\n end\n end", "def destroy\n @comment.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :ok }\n end \n end", "def destroy\n @bookreview.destroy\n respond_to do |format|\n format.html { redirect_to book_path(@bookreview.book_id) }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @book = Book.find(params[:id])\r\n @book.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to books_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @title = \"Destroy Book\"\n\n # @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :ok }\n end\n end", "def destroy\n @book_review = BookReview.find(params[:id])\n @book_review.destroy\n\n respond_to do |format|\n format.html { redirect_to book_reviews_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @book = Book.find(params[:id])\r\n @book.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to books_url }\r\n format.json { head :ok }\r\n end\r\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully deleted.' }\n format.json { head :no_content }\n end \n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @verse_commentary.destroy\n respond_to do |format|\n format.html { redirect_to verse_commentaries_url, notice: 'Verse commentary was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @book = Book.find_by_sql(\"SELECT * FROM Books B WHERE B.id = \" + params[:id]).first()\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/books\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @book_a_lawn.destroy\n respond_to do |format|\n format.html { redirect_to book_a_lawns_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @commentary.destroy\n respond_to do |format|\n flash[:success] = 'Commentary was successfully destroyed.'\n format.html { redirect_to commentaries_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @chapter.destroy\n\n respond_to do |format|\n format.html { redirect_to book_path(@chapter.book_id) }\n format.json { head :no_content }\n end\n end", "def destroy\n @businessbook = Businessbook.find(params[:id])\n @businessbook.destroy\n\n respond_to do |format|\n format.html { redirect_to businessbooks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @casualcomment = Casualcomment.find(params[:id])\n @casualcomment.destroy\n\n respond_to do |format|\n format.html { redirect_to casualcomments_url }\n format.json { head :ok }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to user_books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @note_book.destroy\n respond_to do |format|\n format.html { redirect_to note_books_url, notice: 'Note book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @cook_book = CookBook.find(params[:id])\n @cook_book.destroy\n\n respond_to do |format|\n format.html { redirect_to cook_books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @poetry_anthology_book.destroy\n respond_to do |format|\n format.html { redirect_to poetry_anthology_books_url, notice: \"Poetry anthology review was successfully deleted.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @holy_book = HolyBook.find(params[:id])\n @holy_book.destroy\n\n respond_to do |format|\n format.html { redirect_to holy_books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n AuthorsBook.where(:book_id => @book.id).each do |ab| # destroy sharing links of this note\n ab.destroy\n end\n\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @book = current_user.books.find(params[:id])\n @book.destroy\n render json { head :no_content }\n end", "def destroy\n @mystery_book.destroy\n respond_to do |format|\n format.html { redirect_to mystery_books_url, notice: \"Mystery review was successfully deleted.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n head :no_content\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_uri, notice: '本を削除しました。' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bookalawn.destroy\n respond_to do |format|\n format.html { redirect_to bookalawns_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to book_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: @book.title + ' の削除に成功しました。' }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: '削除されました。' }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n render json:@comment\n end", "def destroy\n #@book = Book.find(params[:id])\n @book = current_user.books.find(params[:id])\n book2delete = @book.title\n @book.destroy\n flash[:notice] = \"Removed: #{book2delete}\"\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.xml { head :ok }\n format.json { head :no_content }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: t('common.message.destroyed_success')}\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n resort_orders\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @cookbook = Cookbook.find(params[:id])\n @cookbook.destroy\n\n respond_to do |format|\n format.html { redirect_to cookbooks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n \n respond_to do |format|\n format.xml { head :ok }\n format.json { head :ok } \n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @book_shelf = BookShelf.find(params[:id])\n @book_shelf.destroy\n\n respond_to do |format|\n format.html { redirect_to book_shelves_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: \"Book was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: \"Book was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end" ]
[ "0.719447", "0.71053886", "0.7040906", "0.69956386", "0.69318724", "0.6911507", "0.68779343", "0.68657327", "0.68657327", "0.68657327", "0.68657327", "0.68657327", "0.68657327", "0.68657327", "0.68657327", "0.68657327", "0.68657327", "0.68657327", "0.68657327", "0.6857221", "0.6857221", "0.6837944", "0.6836157", "0.6836157", "0.6836157", "0.6836157", "0.6836157", "0.6836157", "0.6836157", "0.6835763", "0.67995286", "0.6796393", "0.6790391", "0.6782679", "0.6779647", "0.67705727", "0.6768182", "0.6768182", "0.6756419", "0.67270696", "0.67224663", "0.6706493", "0.67047006", "0.6698143", "0.669791", "0.66958", "0.66945136", "0.66943145", "0.6691259", "0.6690539", "0.6679118", "0.667615", "0.66757625", "0.66658616", "0.66654104", "0.66651225", "0.6643563", "0.66432106", "0.6623722", "0.662092", "0.66202897", "0.6616404", "0.6610381", "0.66005504", "0.65988106", "0.65967894", "0.6587521", "0.6584298", "0.6584298", "0.6584298", "0.6584298", "0.6584298", "0.6584298", "0.6584298", "0.6584298", "0.6584298", "0.6584298", "0.6584298", "0.6584298", "0.6584298", "0.6584298", "0.6584298", "0.6584298", "0.6584298", "0.6584298", "0.6584298", "0.6584298", "0.6584298", "0.6584298", "0.6584298", "0.6584298", "0.6584298", "0.6584298", "0.6584298", "0.6584298", "0.6584298", "0.6583549", "0.65831274", "0.6580219", "0.6580219" ]
0.7600936
0
Use callbacks to share common setup or constraints between actions.
def set_book_commentary @book_commentary = BookCommentary.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 book_commentary_params params.require(:book_commentary).permit(:commentary, :book_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def filtering_params\n params.permit(:email)\n end", "def active_code_params\n params[:active_code].permit\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def url_whitelist; end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def permit_request_params\n params.permit(:address)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def 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 user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.69780594", "0.678054", "0.6742781", "0.67387927", "0.67346025", "0.6590683", "0.6501642", "0.6495788", "0.6479752", "0.64763314", "0.645457", "0.6437739", "0.6377168", "0.6372484", "0.6363871", "0.63179374", "0.62981373", "0.6297456", "0.62916917", "0.6290227", "0.628954", "0.62877893", "0.62814754", "0.62416226", "0.6237962", "0.62168854", "0.62127215", "0.62084496", "0.61927646", "0.6176822", "0.6174079", "0.6171225", "0.6161419", "0.61507314", "0.6150071", "0.6145409", "0.61204594", "0.61135256", "0.6105225", "0.6103249", "0.6088041", "0.6079626", "0.6070542", "0.6060409", "0.60198915", "0.6016795", "0.6010659", "0.60103244", "0.6005393", "0.6005393", "0.6000696", "0.60000104", "0.59931517", "0.59916013", "0.5991397", "0.5990416", "0.5979021", "0.5965926", "0.59582806", "0.59579134", "0.5957629", "0.5956672", "0.59518754", "0.59510773", "0.5942638", "0.5937516", "0.59361875", "0.59361875", "0.59336793", "0.5928626", "0.5925229", "0.59243226", "0.59174913", "0.5907821", "0.5907719", "0.5906177", "0.59056896", "0.5897028", "0.5896294", "0.5895856", "0.5893494", "0.58926904", "0.589066", "0.58854234", "0.58809334", "0.5878489", "0.58727074", "0.5868653", "0.5866631", "0.58666086", "0.5866305", "0.586484", "0.58631617", "0.5861481", "0.5861059", "0.5859114", "0.5858489", "0.585326", "0.58530635", "0.5848788", "0.58479697" ]
0.0
-1
When compile_time is defined, apply the action immediately and then set the action :nothing to ensure that it does not run a second time.
def after_created if compile_time self.run_action(:apply) self.action :nothing end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 after_created\n return unless compile_time\n Array(action).each do |action|\n run_action(action)\n end\nend", "def after_created\n return unless compile_time\n Array(action).each do |action|\n run_action(action)\n end\nend", "def after_created\n return unless compile_time\n Array(action).each do |action|\n run_action(action)\n end\nend", "def after_created\n if compile_time\n actions = Array(self.action) || [:manage]\n actions.each do |action|\n next if action == :nothing\n self.run_action(:manage)\n end\n self.action(:nothing)\n end\nend", "def after_created\n if compile_time\n Array(action).each do |action|\n run_action(action)\n end\n Gem.clear_paths\n end\n end", "def _dispatch(action=:index)\n start = Time.now\n if self.class.callable_actions.include?(action.to_s)\n super(action)\n else\n raise ActionNotFound, \"Action '#{action}' was not found in #{self.class}\"\n end\n @_benchmarks[:action_time] = Time.now - start\n end", "def caching_compile(action, template)\n if Global.compile && action.template\n Cache.compiled[action.relaxed_hash] ||= compile(action, template)\n else\n compile(action, template)\n end\n end", "def force_action(forced_action)\n add_actions(\n Hash[authority_action_map.map {|key, _| [key, forced_action] }]\n )\n end", "def set_action_if_nil(action)\n return if @action\n\n set_action(action)\n end", "def wrap_compile(action, template = nil)\n template ||= reaction_or_file(action).to_s\n caching_compile(action, template)\n end", "def run_action(action, notification_type = nil, notifying_resource = nil)\n return super unless $CHEFSPEC_MODE\n\n resolve_notification_references\n validate_action(action)\n\n Chef::Log.info(\"Processing #{self} action #{action} (#{defined_at})\")\n\n ChefSpec::Coverage.add(self)\n\n unless should_skip?(action)\n if node.runner.step_into?(self)\n instance_eval { @not_if = []; @only_if = [] }\n super\n end\n\n if node.runner.compiling?\n perform_action(action, compile_time: true)\n else\n perform_action(action, converge_time: true)\n end\n end\n end", "def no_time\n no_define\n end", "def action_nothing\n logger.trace(\"Doing nothing for #{@new_resource}\")\n true\n end", "def cheap_themes_prepare_customized_actions #:nodoc:\n if (tfm = self.class.actions_theme_finder_method) and theme = self.send(tfm) \\\n and theme != nil and theme =~ /^[\\w\\.\\-\\+]+$/i and \\\n File.exists?(\"#{RAILS_ROOT}/themes/#{theme}/controllers/#{controller_name}/#{action_name}.rb\")\n \n if Rails.configuration.cache_classes == false or\n not (self.respond_to? \"cheap_themes_customized_action_#{controller_name}_#{action_name}\")\n\n ruby_code = \"def cheap_themes_customized_action_#{theme}_#{controller_name}_#{action_name}\\n\"\n f = File.new \"#{RAILS_ROOT}/themes/#{theme}/controllers/#{controller_name}/#{action_name}.rb\"\n ruby_code += f.read\n f.close\n ruby_code += \"\\nend\"\n eval ruby_code\n end\n\n #self.send \"cheap_themes_customized_action_#{controller_name}_#{action_name}\"\n unless self.respond_to? \"cheap_themes_original_action_#{action_name}\"\n self.class_eval <<CLS_EVAL\n alias_method \"cheap_themes_original_action_#{action_name}\".to_sym, \"#{action_name}\".to_sym\n private \"cheap_themes_original_action_#{action_name}\".to_sym\nCLS_EVAL\n\n ruby_code = <<INS_EVAL\n def #{action_name}\n theme = self.send(self.class.actions_theme_finder_method)\n if self.respond_to? \"cheap_themes_customized_action_\\#{theme}_\\#{controller_name}_\\#{action_name}\"\n self.send(\"cheap_themes_customized_action_\\#{theme}_\\#{controller_name}_\\#{action_name}\")\n else\n cheap_themes_original_action_\\#{action_name}\n end\n end\nINS_EVAL\n self.class_eval ruby_code\n end\n puts \"??????\"\n end\n end", "def action_required!(**options)\n update(status: 'completed', conclusion: 'action_required', completed_at: Time.now, **options)\n end", "def add_default_action(action)\n ORIGINAL_ACTIONS << action\n end", "def add_default_action(action)\n ORIGINAL_ACTIONS << action\n end", "def reset_action\n @action = nil\n if @@EXECS.include? task\n @action = Action.load(task, self)\n else\n warn \"No action set for #{task}\"\n end\n end", "def _my_action_action\n {:text => \"Not used\"}\n end", "def trigger_dispatch_if_required\n return :ok if dispatch_pending.nil? or dispatch_pending == dispatched?\n if dispatch_pending\n run_callbacks :dispatched do\n self.dispatch_date = Time.now\n self.dispatch_pending = nil\n end\n else\n self.dispatch_date = nil\n end\n end", "def always_run=(_arg0); end", "def onCompile\n end", "def action &block\n if block.nil?\n raise RuntimeError, 'expected a block but none given'\n end\n @actions << block\n end", "def action!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 10 )\n\n type = ACTION\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 141:10: 'action'\n match( \"action\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 10 )\n\n end", "def resched\n action('resched')\n end", "def generate\n instance_eval(&action) if action\n end", "def unresched\n action('unresched')\n end", "def action\n @action ||= calculate_action\n end", "def no_action_log\n true\n end", "def without_autobuild\n Threaded.begin_execution(\"without_autobuild\")\n yield\n ensure\n Threaded.exit_execution(\"without_autobuild\")\n end", "def clear_action_methods!; end", "def clear_action_methods!; end", "def render_with_callback(action)\n run_callbacks(:\"render_#{action}\")\n render :action => action unless performed?\n end", "def run_actions; end", "def warn_when(action)\n configuration[action] = :warn\n end", "def skip_actions; end", "def default_action(msg)\n #\n # do nothing.\n #\n end", "def modify_time(); @modify_time ||= Time.now; end", "def clean_action(action)\n return unless action\n case action[:type]\n when :switch\n action[:who].switching = false\n action[:with].switching = false\n end\n end", "def revert!\n ::ActionView::Template.class_eval do\n alias_method :compile!, :cb_original_compile! # rubocop:disable Lint/DuplicateMethods\n undef_method :cb_patched_compile!\n end\n end", "def maybe_build\n return unless @last_notice_at\n if time_to_build?\n UI.info \"Tishadow building at #{Time.now} with \\\"#{@build_command}\\\"\"\n run_or_update\n clear_notified\n stop_clock\n end\n end", "def default_action; end", "def update(action)\n return unless action[:type] == action_type\n\n super\n end", "def hook_report_actions\n @flavor.class.after_add_resources do\n actions = actions_taken\n @recipe.send(:ruby_block, 'report_actions_taken') do\n # :nocov:\n block do\n $stdout.puts \"\\n\\nactions taken:\"\n actions.each { |a| $stdout.puts \" #{a}\" }\n end\n # :nocov:\n end\n end\n end", "def compile!(view)\n return if @compiled\n\n # Templates can be used concurrently in threaded environments\n # so compilation and any instance variable modification must\n # be synchronized\n @compile_mutex.synchronize do\n # Any thread holding this lock will be compiling the template needed\n # by the threads waiting. So re-check the @compiled flag to avoid\n # re-compilation\n return if @compiled\n\n mod = view.compiled_method_container\n\n instrument(\"!compile_template\") do\n compile(mod)\n end\n\n @compiled = true\n end\n end", "def schedule_at_absolute(due_time, action)\n raise 'action cannot be nil' unless action\n\n schedule_at_absolute_with_state(action, due_time, method(:invoke)) \n end", "def set_flash_now(action)\n if f = options_for(action).flash_now\n flash.now[:notice] = f.is_a?(Proc) ? instance_eval(&f) : options_for(action).flash_now\n end\n end", "def apply\n if desired.cron_exists\n action_create\n else\n action_delete\n end\n end", "def deferred_actions\n @deferred ||= begin\n if Merb::Config[:deferred_actions].empty?\n /^\\0$/\n else\n /#{Merb::Config[:deferred_actions].join(\"|\")}/\n end\n end\n end", "def asset_modified(path)\n @task.say 'Recompiling assets'\n @builder.compile_assets\n end", "def action_processed(_action)\n @entities.each(&:unpass!)\n end", "def action_run\n end", "def clear_all_actions; end", "def perform_if_needed(**action_parameters)\n return if performed?(**action_parameters)\n\n yield\n\n mark_performed(**action_parameters)\n end", "def _dispatch(action=:to_s)\n hook :before_dispatch\n self.action_name = action\n \n caught = catch(:halt) do\n start = Time.now\n result = _call_filters(_before_filters.reverse)\n @_benchmarks[:before_filters_time] = Time.now - start if _before_filters\n result\n end\n \n @body = case caught\n when :filter_chain_completed then _call_action(action_name)\n when String then caught\n when nil then _filters_halted\n when Symbol then send(caught)\n when Proc then caught.call(self)\n else\n raise MerbControllerError, \"The before filter chain is broken dude. wtf?\"\n end\n start = Time.now\n _call_filters(_after_filters) \n @_benchmarks[:after_filters_time] = Time.now - start if _after_filters\n hook :after_dispatch\n end", "def schedule_at_absolute_with_state(state, due_time, action)\n raise 'action cannot be nil' unless action\n\n due_time = now + 1 if due_time <= now && @increment_on_simultaneous\n\n super(state, due_time, action)\n end", "def action_hook; end", "def recompile\n @compiled = nil\n compile\n end", "def set_compile_time_parameters!\n if(compile_time_parameter_setter)\n compile_time_parameter_setter.call(self)\n end\n end", "def cb_patched_compile!(*args)\n ActionViewStrategy.views.push identifier\n cb_original_compile!(*args)\n end", "def define_action_hook; end", "def _dispatch(action)\n _run_filters(:before, action)\n response = send(action)\n _run_filters(:after, action)\n response\n end", "def action(&block)\n @action = block\n end", "def action_enable\n end", "def refresh_action_key\n if phase_sequence[battle_phase].call != @used_sequence\n self.battle_phase = battle_phase\n end\n end", "def execute_action_attack\n # Call a custom battle method\n ty_execute_action_attack\n # Call the original battle method if still attacking\n if @active_battler.action.kind == 0\n ty_ammo_requirements_attack\n end\n end", "def invoke_action(name)\n self.send(name)\n #Rails Magic: Default calls render on appropriate method even if the programmer doesn't :\n render(name) unless already_rendered?\n end", "def action_create\n @original_cron_provider.action_create\n @new_resource.updated_by_last_action(@original_cron_provider.new_resource.updated_by_last_action?)\n true\n end", "def clear_action_methods!\n @action_methods = nil\n end", "def action_restart\n return if options['never_restart']\n action_stop\n action_start\n end", "def exec_action(text)\n\t\t\tdata = Context::parse_action_default(text, '<unknown>', 0)\n\t\t\texec_parsed_action(data[:action], data[:args], true, text)\n\t\tend", "def safe_compile!(compiler)\n begin\n compiler.compile!\n rescue\n recompile_assets!(compiler)\n end\n end", "def post_mortem!\n self.enabled = true \n self.post_mortem = true\n end", "def set_actions\n @actions = []\n end", "def other_regenerate_actions\n return if disabled\n\n self.class.prev_latest_update = updated_at\n self.class.preload\n Rails.logger.info 'Reloading column definitions'\n implementation_class.reset_column_information\n Rails.logger.info 'Refreshing item types'\n Classification::GeneralSelection.item_types refresh: true\n end", "def clear_non_walkable\n if @current_action != nil and @current_action.walkable_policy != WalkablePolicy::WALKABLE\n @current_action.stop\n @current_action = nil\n end\n \n @queue.each {|action|\n if action.walkable_policy != WalkablePolicy::WALKABLE\n action.stop\n @queue.delete action\n end\n }\n end", "def action_reload\n return if options['never_reload']\n notify_if_service do\n service_resource.run_action(:hup)\n end\n end", "def speed_up!\n raise InvalidActionError, \"Cannot speed up an Output that is already speeding.\" unless not_speeding?\n speed_up_action.tap do |action|\n write_action action\n end\n end", "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 local_action(command, id, action)\n super(command,id,ACTION[action])\n end", "def execute_action_skill\n # Call a custom battle method\n ty_execute_action_skill\n # Call the original battle method if still attacking\n if @active_battler.action.kind == 1\n ty_ammo_requirements_execute_skill\n end\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def action_argument_required?\n !AVAILABLE_ACTIONS.empty?\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 speed_up!\n raise InvalidActionError, \"Cannot speed up an Output that is already speeding.\" unless not_speeding?\n speed_up_action.tap do |action|\n write_action action\n end\n end", "def process_action(...)\n send_action(...)\n end", "def apply_template_after?; end", "def recompile\n unmemoize(:compile)\n compile\n end", "def initialize_compiler\n self.compile_tasks = [:multi, :test, :check_manifest]\n end", "def action(&replacement_action)\n if replacement_action\n @action = replacement_action\n else\n @action\n end\n end", "def reschedule(job, time = T.unsafe(nil)); end", "def clear_compiler_like! *keys\n clear_compiler_like *keys\n ipcm_trigger :clear_compiler_like, *keys\nend", "def action(&block)\n @actions << block\n end", "def compile_and_converge_action(&block)\n old_run_context = run_context\n @run_context = run_context.create_child\n @run_context.resource_collection.unified_mode = new_resource.class.unified_mode\n runner = Chef::Runner.new(@run_context)\n return_value = instance_eval(&block)\n runner.converge\n return_value\n ensure\n if run_context.resource_collection.any?(&:updated?)\n new_resource.updated_by_last_action(true)\n end\n @run_context = old_run_context\n end", "def run_now!\n update_attributes(run_at: nil) if cron_schedule\n end", "def do_nothing\nend", "def do_nothing\nend", "def mco_action\n raise RuntimeError, \"Not implemented\"\n end" ]
[ "0.7337755", "0.7337755", "0.73346776", "0.73346776", "0.73346776", "0.7017283", "0.6670972", "0.5671043", "0.5574656", "0.5496656", "0.5482355", "0.54752153", "0.54570234", "0.54261786", "0.5349615", "0.52819955", "0.5270714", "0.52345407", "0.52345407", "0.522855", "0.5209421", "0.51653934", "0.5144926", "0.5108901", "0.5047269", "0.5024518", "0.5008604", "0.50033915", "0.50003344", "0.49992585", "0.49967793", "0.49683252", "0.49668318", "0.49668318", "0.49473765", "0.4939298", "0.4907484", "0.49016562", "0.48886606", "0.48824435", "0.48786333", "0.48691353", "0.4863895", "0.48626307", "0.48542124", "0.48527843", "0.48457107", "0.48443308", "0.48344713", "0.48285615", "0.48157597", "0.4794923", "0.47944716", "0.47798082", "0.47777966", "0.47648382", "0.4763965", "0.47637808", "0.47564378", "0.47298697", "0.47287416", "0.47275135", "0.4723519", "0.47173882", "0.47168815", "0.47166312", "0.47128296", "0.46809435", "0.46791056", "0.46550494", "0.46469584", "0.46468943", "0.4638685", "0.4629689", "0.46295744", "0.4616319", "0.46145958", "0.4613575", "0.4597402", "0.45965412", "0.45808926", "0.45740673", "0.45720372", "0.4569588", "0.4568779", "0.45610514", "0.45467094", "0.45448384", "0.45320863", "0.45312482", "0.45311093", "0.45304957", "0.45279974", "0.45270815", "0.45265907", "0.45231867", "0.4519447", "0.45168242", "0.45168242", "0.4515127" ]
0.7755296
0
adds product values, adds tax, rounds, returns total
def total @sum = @products.values.inject(0, :+) @total = @sum + (@sum * 0.075).round(2) return @total end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def total\n product_total = 0\n tax = 1.075\n @products.each do |product, price|\n product_total += price\n end\n order_total = (product_total * tax).round(2)\n return order_total\n end", "def calculate_totals\n subtotal = 0\n\n carted_products.each do |carted_product|\n subtotal += carted_product.subtotal\n end\n\n tax = subtotal * 0.09\n total = subtotal + tax\n update(subtotal: subtotal, tax: tax, total: total)\n end", "def total\n if @products.length == 0\n return 0\n else\n total = @products.values.reduce(:+)\n total*= 1.075 #Tax\n total = total.round(2)\n return total\n end\n end", "def total\n # extracts all of the values from the hash and sums them up\n cost = @products.values.sum\n # add 7.5% tax and round to two decimal places\n return (cost * 1.075).round(2)\n end", "def all_products_after_tax\n ccollection_of_products_total = 0\n @collection_of_products.each do |current_product|\n ccollection_of_products_total += current_product.total_price\n end\n end", "def total\n add_products = 0\n @products.each_value do |cost|\n add_products += cost\n end\n total = (add_products + (add_products * 0.075)).round(2)\n return total\n end", "def total\n total = 0\n @products.values.each do |price|\n total += price\n end\n total += (0.075 * total).round(2)\n end", "def all_products_before_tax\n collection_of_products_total = 0\n @collection_of_products.each do |current_product|\n collection_of_products_total += current_product.base_price\n end\n end", "def total\n product_total = 0\n subtotal = 0\n @products.each_value do |prices|\n subtotal += prices\n end\n product_total = (subtotal * 0.075).round(2)+ subtotal\n return product_total\n\n end", "def product_total\n\t\ttotal = 0\n\t\tself.items.each do |item|\n\t\t\ttotal += item.amount\n\t\tend\n\t\ttotal\n\tend", "def total_price\n (@base_price * @tax_rate + @base_price) * @quantity\n end", "def total\n total_cost = 0\n \n # Summing up the product cost\n @products.each do |item, cost|\n total_cost += cost\n end\n \n # Calculate a 7.5% tax\n total_order_cost = total_cost * 1.075\n \n # Rounding the result to two decimal places\n return total_order_cost.round(2)\n end", "def total\n (@products.values.sum * 1.075).round(2)\n end", "def total\n total_price = 0.0\n cart.line_items.each do |line_item|\n if !line_item.unit_price.blank?\n total_price += line_item.unit_price.to_f\n if line_item.line_item_options\n line_item.line_item_options.each do |line_item_option|\n total_price += line_item_option.price.to_f\n end\n end\n elsif line_item.menu_section_item\n total_price += line_item.menu_section_item.price.to_f\n if line_item.menu_item_options\n line_item.menu_item_options.each do |menu_item_option|\n total_price += menu_item_option.price.to_f\n end\n end\n else\n total_price += 0\n end\n end\n tax = total_price.to_f * 0.0825\n total_price = total_price + tax\n if tip\n total_price = total_price.to_f + tip.to_f\n end\n return total_price\n end", "def total\n if @products == {}\n return 0 \n else\n m = 0\n @products.values.each do |v|\n m += v\n end\n\n sum = (m + (m * 0.075)).round(2)\n return sum\n end\n end", "def calculate_totals\n totals = {}\n if self.amount_due.nil?\n total = 0.00\n order_products.each do |order_product|\n price = order_product.unit_price\n price = order_product.product.price if price.nil?\n total = total + (price * order_product.quantity)\n end\n totals[:product_total] = total\n totals[:tax] = total * 0.055\n totals[:amount_due] = total + totals[:tax]\n else\n totals[:product_total] = self.product_total\n totals[:tax] = self.tax\n totals[:amount_due] = self.amount_due\n end\n return totals\n end", "def total\n # TODO: implement total\n if products.length == 0\n return 0\n end\n ((@products.values.sum)*1.075).round(2)\n end", "def total\n return 0 if @products.empty?\n total = (@products.sum { |name, price| price } * 1.075).round(2)\n return total\n end", "def cumulative_total_after_tax\n amount = 0.0\n @products_in_cart.each do |product|\n amount += product.total\n end#each\n return amount\nend", "def recalculate_totals\n # Line's total prices (qty * amount)\n single_untaxed_price_after_rebate = BigDecimal.new( (self.single_untaxed_price - self.single_rebate).to_s )\n self.gross_price = BigDecimal.new( (self.quantity * single_untaxed_price_after_rebate).to_s )\n self.gross_price = self.gross_price\n self.taxes = (self.gross_price / BigDecimal.new(\"100.0\")) * self.tax_percentage\n self.taxed_price = (BigDecimal.new( (self.gross_price + self.taxes).to_s )).rounded # Rounded like in document_line.rb\n\n # Line's single prices (for qty 1 * amount)\n single_taxes = ((single_untaxed_price_after_rebate / BigDecimal.new(\"100.0\")) * self.tax_percentage) # like in product.rb\n self.single_price = (single_untaxed_price_after_rebate + single_taxes).rounded # Like in document_line.rb\n\n end", "def total_with_tax\n total = 0\n @cart_items.each do |item|\n total += item.total_price\n end\n return total\n end", "def total\n total_amount = 0\n @order.each do |product, quantity|\n prod_price = PRODUCTS[product]\n if @pricing_rules.key?(product)\n rule = @pricing_rules[product]\n n = rule[1]\n type = rule[0]\n case type\n when \"Nx1\"\n total_amount += prod_price*( quantity/n + quantity%n )\n when \"BULK\"\n disccount_price = rule[2]\n total_amount += quantity * (quantity < n ? prod_price : disccount_price) #disccount price\n end\n else\n total_amount += prod_price * quantity\n end\n end\n total_amount\n end", "def cumulative_total_before_tax\n amount = 0.0\n @products_in_cart.each do |product|\n amount += product.price\n end#each\n return amount\nend", "def cart_price_total_wtax\n price = 0\n tax = 2.99\n CartProduct.all.each do |cart_product|\n if cart_product.user_id == logged_in\n if product = get_product_by_id(cart_product.product_id)\n price += (product.price * cart_product.quantity) \n end\n end\n end\n return price + tax\n end", "def total\n if @products.empty?\n return 0\n else\n total = (@products.values.sum * 1.075).round(2)\n end\n return total\n end", "def calc_total\n (@total_after_tax * @gratuity) + @total_after_tax\n end", "def calculate_total_price_and_taxes\n # find the tax rate\n tax_rate_percent = 0\n\n unless is_exempt_from_regular_tax?\n tax_rate_percent += REGULAR_TAX_PERCENT\n end\n\n unless self.is_exempt_from_import_tax?\n tax_rate_percent += IMPORT_TAX_PERCENT\n end\n\n # np/100\n # total tax needs to be a float rounded to nearest .05\n @total_tax = SalesTaxes::Item.round_properly((self.price * tax_rate_percent)/100)\n\n @total_price = (@price + @total_tax)\n end", "def total\n self.quantity * self.product.price\n end", "def total\n subtotal + tax + shipping\n end", "def total\n sum = 0\n subtotal = @products.values\n subtotal.each do |price|\n sum += price.to_f\n end\n\n total = (sum * 1.075).round(2)\n return total\n end", "def calculate\n @item_list.each { |item|\n tax_rate = (item.exempt? ? 0.00 : Constants::NON_IMPORT_TAX_RATE) + (item.imported? ? Constants::IMPORT_TAX_RATE : 0.00)\n total_before_tax = item.qty * item.price\n tax = (total_before_tax * tax_rate).round_to_05\n\n @receipt_tax += tax\n @receipt_total += item.total = total_before_tax + tax\n }\n\n # do final rounding - needed due to Float quirks\n @receipt_tax = @receipt_tax.round(2)\n @receipt_total = @receipt_total.round(2)\n return self\n end", "def total_price\n\t\tproduct.price * quantity\n\tend", "def total\n subtotal\n # + tax\n end", "def total\n total = (@products.values.sum) * 1.075\n return total.round(2)\n end", "def productrevenue\n vat_rate = TaxRate.find_by_name(\"VAT\")\n shipping_rate = TaxRate.find_by_name(\"Shipping Reverse for PPO\")\n \n totalrevenue = 0\n totalrevenue += (self.subtotal * (self.pieces ||= 1) * vat_rate.reverse_rate.to_f) || 0\n totalrevenue += (self.shipping * (self.pieces ||= 1) * shipping_rate.reverse_rate.to_f) || 0\n return totalrevenue\nend", "def line_total\n (@quantity * @price + line_item_sales_tax_total).round(2)\n end", "def total_before_tax\n total = 0\n @cart_items.each do |item|\n total += item.price\n end\n return total\n end", "def cart_before_tax\n#go into our array\n#get product price before tx\n#sum the array\nsum_base_price = []\n\n @@shopping_cart.each do |product|\n sum_base_price << product.base_price\n end\n\nreturn sum_base_price.sum\n\n\nend", "def total\n\t\tif @products == {}\n\t\t\treturn 0\n\t\telse\n\t\t\treturn (@products.sum {|product, cost| cost} * 1.075).round(2)\n\t\tend\n\tend", "def tax_total\n self.tax_amount = line_items.inject(0.to_money) {|sum,l| sum + l.tax_amount }\n self.tax_rate # calculates average rate, leave for compatibility reasons\n self.tax_amount\n end", "def total\n total = 0\n line_items.each do |line_item|\n total += line_item.item.price * line_item.quantity\n end\n total\n end", "def define_total_price\n self.total_price = self.quantity.to_f * (self.price.to_f + self.vat_amount.to_f )\n end", "def calculate(items)\n\n\t\titems.each do |item|\n\t\t\ttax_rate = get_tax_rate(item)\n\t\t\ttax = get_tax(item[:price], item[:quantity], tax_rate)\n\t\t\t@total_tax += tax\n\n\t\t\titem[:sales_price] = (item[:price] * item[:quantity] + tax).round(2)\n\t\t\t@total_price += item[:sales_price]\n\t\tend\n\n\t\treturn @total_tax, @total_price\n\tend", "def calculate_price\n result = 0.0\n @items.each do |item|\n name = item.name\n price = item.price\n final_taxed_price = price # Begin with price and add tax as necessary\n tax = 0.0\n\n # Is the item subject to sales tax (ie. not exempt)?\n if !is_exempt(name)\n # Not exempt, apply sales tax\n tax += price * @@sales_tax\n else\n # Exempt, don't apply sales tax\n end\n\n # Is the item subject to import tax (ie. is it imported)?\n if is_imported(name)\n # Is imported, apply import sales tax\n tax += price * @@imported_goods_sales_tax\n else\n # Is not imported, don't apply import sales tax\n end\n\n final_taxed_price += round_point05(tax)\n\n puts final_taxed_price\n\n result += final_taxed_price # Add the final price to the running total\n end\n result\n end", "def total\n total = @products.map do |product, price|\n price\n end\n\n return (total.sum * 1.074).round(2)\n end", "def total_before_tax\n self.delivery_price + self.items_sub_total\n end", "def calculate_price\n self.price = product.price\n self.total_price = price * quantity \n end", "def total_value\n category_value = 0 \n self.products.each do |product|\n category_value += (product.price * product.quantity)\n end\n category_value\n end", "def total_price\n res = product.price * count\n if product_options.any?\n res = res + product_options.map { |po| po.price }.sum * count\n end\n res\n end", "def total_price\n \t\tsale_items.sum { |item| (item.product.price * item.quantity) }\n\tend", "def tax_total\n self.tax_amount = line_items.inject(Money.new(0, self.currency || Money.default_currency)) {|sum,l| sum + l.tax_amount }\n self.tax_rate # calculates average rate, leave for compatibility reasons\n self.tax_amount\n end", "def summ\n result = 0.0\n self.propose_items.each do |item|\n result += item.price\n end\n return result\n end", "def total_price\r\n\t\t@items.inject(0.0) { |sum, i| sum + i.total_unit_price * i.quantity }\r\n\tend", "def sum_prices(products)\n sum = 0.0\n products.each do |product|\n product[VARIANTS_FIELD].each do |variant_product|\n sum += variant_product[PRICE_VARIANT_FIELD].to_f\n end\n end\n sum.round(2)\nend", "def subtotal\n self.product.price * self.quantity\n end", "def total\n array = @products.values\n if array != []\n tally = array.reduce(:+)\n tally += (0.075 * tally)\n return tally.round(2)\n else\n return 0\n end\n end", "def calculate_invoice_total\n res = [ ]\n self.line_items.each do |item|\n res.push(item.qty * item.price)\n end\n # Return the sum of the items\n self.total = res.inject(:+) \n end", "def total_price\n product.price * quantity\n end", "def total_price\n product.price * quantity\n end", "def total_price\n product.price * quantity\n end", "def total_price\n product.price * quantity\n end", "def total_price\n product.price * quantity\n end", "def calculate_total_2(info)\n tip_amt = info[:price] * info[:tip]\n tax_amt = info[:price] * info[:tax]\n info[:price] + tip_amt + tax_amt\nend", "def final_bill\n total + tax + @tip_amount\n end", "def sales_tax\n return (@listOfItem.inject(0){|sum,e| sum += \n e.product != nil ? e.product.sales_tax + e.product.import_tax : 0 }).round_to(2)\n end", "def total\n conv_price_single * conv_quantity\n end", "def calculate\n product.taxes&.map { |tax| tax_portion(tax) }.sum.to_f || 0\n end", "def totalValueProducts(quantity)\n total = self.products.map {|product| product.getValue(quantity)}.reduce(:+)\n return total\n end", "def calculate_total_2(info) # info is a hash with expected arguments\n taxAmt = info[:price] * info[:tax]\n tipAmt = info[:price] * info[:tip]\n info[:price] + tipAmt + taxAmt\nend", "def total\n # Calculo el total sin descuentos\n self.total_prize = @products.map {|p| p.prize }.inject :+\n\n # Aplico todos los descuentos dinamicamente\n @discounts.each do |discount|\n discount.call self\n end\n\n self.total_prize # Retorno el precio final\n end", "def full_price\n price + tax_evaluation\n end", "def total\n cart_value = 0\n self.line_items.each do |line_item|\n cart_value += line_item.value\n end\n cart_value\n end", "def total_price\n # convert to array so it doesn't try to do sum on database directly\n @total = 0\n line_items.each do |item|\n @total = item.price\n end\n line_items.to_a.sum {|item| (item.quantity * item.price) }\n end", "def product_selling_price_after_tax\n product_markup_price * (1 - county.tax_factor) \n end", "def add_taxes(amt, good_tax, import_tax)\n amt += good_tax + import_tax\n amt.round(2)\n end", "def tax_total\n self.tax_amount = line_items.inject(0.to_money) {|sum,l| sum + l.tax_amount }\n self.tax_amount\n end", "def calculate cart, current_tax_rate\n net_amount = cart.total_price + (delivery.try(:price) || 0)\n tax_amount = net_amount * current_tax_rate\n self.attributes = { cart_id: cart.id, net_amount: net_amount, tax_amount: tax_amount, gross_amount: net_amount + tax_amount }\n self.save(validate: false)\n \tend", "def compute_total_and_print()\n @total_price=0\n $final_price_list.each do |element| \n @total_price = @total_price + element\n end\n @total_sales_tax=0\n $sales_tax_list.each do |element|\n @total_sales_tax = @total_sales_tax + element\n end\n puts \"Sales Tax : #{@total_sales_tax.round(2)}\"\n puts \"Total : #{@total_price.round(2)}\"\nend", "def calcuate_tax\n @price * 0.12\n end", "def total_before_tax\n order.delivery_price + items_sub_total\n end", "def product_cost\n product_with_unit_cost + product_without_unit_cost\n end", "def total\n @items_total = []\n self.line_items.each do |item|\n @item = Item.find_by_id(item.item_id)\n @items_total << @item.price.to_f\n end\n cart_total = @items_total.inject(0){|sum, x| sum + x }\n @cart_total = cart_total.round(2)\n @cart_total\n end", "def total_price\n line_items.map { |line_item| line_item.item.price * line_item.quantity }.sum\n end", "def update_totals\n # update_adjustments\n self.payment_total = payments.completed.map(&:amount).sum\n self.item_total = line_items.map(&:amount).sum\n \n self.adjustment_total = adjustments.eligible.map(&:amount).sum\n self.total = item_total + adjustment_total + gift_packaging_total\n end", "def total_tax\n unit_tax * quantity\n end", "def add_to_cart(product, amount)\n purchase = \" • #{amount} #{product}\\n\"\n @cart << purchase\n\n cost_per_item = @inventory[product][\"price\"]\n @total_cart_value += (cost_per_item * amount)\n\n @inventory[product][\"quantity\"] -= amount\nend", "def total_product_price\n total_price = @products.map{|product| product.price}\n total_price.reduce(:+) \n end", "def total\n order_total + delivery_price + (prices_include_tax ? 0 : tax_amount)\n end", "def finalize \n \tself[:unit_price] = self.product.sale_price\n \tself[:total] = self.quantity * self[:unit_price]\n end", "def single_price\n product.price + product_options.map { |po| po.price }.sum\n end", "def after_taxes\n printed_list = \"\"\n @total = 0\n @list.each do |item, quantity|\n item_total = quantity * item.price\n @total += item_total\n printed_list += \"#{quantity} #{item.name}: #{MONEY_FORMAT % item.price}\\n\"\n end\n return printed_list\n end", "def total\n self.delivery_price +\n self.delivery_tax_amount +\n order_items.inject(BigDecimal(0)) { |t, i| t + i.total }\n end", "def tax_calc\n tax = @quantity * @price * @taxe\n end", "def total\n self.price * self.quantity\n end", "def total\n self.price * self.quantity\n end", "def total\n quantity * unit_price\n end", "def total\n sum = self.line_items.inject(BigDecimal('0.0')) { |sum, li| sum + li.price } +\n self.price_modifiers.inject(BigDecimal('0.0')) { |sum, pm| sum + pm.amount }\n return ApplicationHelper.round_currency(sum)\n end", "def total_taxes\n @total_taxes = 0\n @list.each do |item, quantity|\n @total_taxes += quantity * item.taxes\n end\n puts \"Sales Taxes: #{MONEY_FORMAT % @total_taxes}\"\n end", "def total\n cost_without_tax = get_cost_without_tax\n return cost_without_tax + get_sales_tax(cost_without_tax)\n end", "def recalc_price(subscription_config)\n total_tax = subscription_config.all_taxes[self.taxes_id][\"taxes\"].inject(0){|sum,item| sum + item[\"rate\"]} # sum all applicable taxes\n self.net_amount = self.quantity * subscription_config.all_tariff_plans[self.tariff_plan_id][\"price\"]\n self.taxes_amount = self.net_amount * total_tax\n end" ]
[ "0.77350384", "0.7677893", "0.7674244", "0.76383203", "0.7482389", "0.74563056", "0.7439995", "0.74156386", "0.73894334", "0.73118204", "0.72655153", "0.7215308", "0.71712613", "0.7123624", "0.7110549", "0.71031255", "0.7097574", "0.70838356", "0.70577383", "0.7056925", "0.7025808", "0.70235425", "0.70137393", "0.70069116", "0.7000811", "0.69798565", "0.69653744", "0.69607157", "0.69327426", "0.69240344", "0.6919353", "0.6908548", "0.6900489", "0.6896427", "0.6888869", "0.68768704", "0.6871719", "0.6865783", "0.6864758", "0.68634844", "0.68534493", "0.68405485", "0.68401307", "0.6835158", "0.6829083", "0.682735", "0.6788979", "0.67877847", "0.67869216", "0.6785482", "0.6781289", "0.67786175", "0.6774834", "0.6771747", "0.67675114", "0.67658854", "0.6754349", "0.67430335", "0.67430335", "0.67430335", "0.67430335", "0.67430335", "0.67420036", "0.67323047", "0.6731095", "0.6726147", "0.6712789", "0.67093086", "0.6707877", "0.6702848", "0.669731", "0.66959995", "0.6690874", "0.6685892", "0.6673731", "0.66706675", "0.6669198", "0.66685164", "0.6664605", "0.6664463", "0.6659534", "0.6640479", "0.66383755", "0.6636868", "0.66276336", "0.66258013", "0.6620711", "0.6616781", "0.66113096", "0.6606271", "0.6594296", "0.6593336", "0.6589075", "0.658633", "0.658633", "0.6580129", "0.6577237", "0.6576513", "0.6574645", "0.65735435" ]
0.71973807
12
adds a product to an Order instance
def add_product(product_name, product_price) @product_name = product_name @product_price = product_price @products.each do |key, value| if @product_name == key #puts "You've already added that product." return false end end @products[@product_name] = @product_price return true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_product(params)\n ordered_product = OrderedProduct.find_or_initialize_by(\n self.class.params_object_or_id(:product, params)\n .merge(order: self)\n )\n\n if ordered_product.product.pick_out(params[:amount].to_i)\n ordered_product.update(params)\n update_price\n end\n ordered_product\n end", "def add_product(product, quantity)\n current_item = OrderItem.find_by(product_id: product.id, order_id: self.id )\n\n if current_item\n current_item.quantity = quantity\n current_item.save\n else\n new_item = OrderItem.new(product_id: product.id, quantity: quantity, order_id: self.id)\n new_item.save\n end\n end", "def add_product(product)\n item = @items.find {|i| i.product_id == product.id}\n if item\n item.quantity += 1\n else\n item = LineItem.for_product(product)\n @items << item\n end\n @total_price += product.price\n end", "def add_product(product)\n\t\titem_to_add = line_items.find_by(product_id: product.id)\n\t\tif item_to_add\n\t\t\titem_to_add.quantity += 1\n\t\telse\n\t\t\t# in this case we create the line_item, the quantity default is 1\n\t\t\titem_to_add = line_items.build(product_id: product.id)\n\t\t\titem_to_add.order = nil\n\t\tend\n\t\titem_to_add\n\tend", "def add_product(name, price, tax_rate)\n new_product = Product.new(name, price, tax_rate)\n @cart_items << new_product\n end", "def add_product product\n\t\t@products.push product\n\t\tproduct\n\tend", "def add_product(product)\n products << product\n # save\n end", "def add_product(product)\n current_item = line_items.find_by(product_id: product.id) # find the current item in the line items. find_by() returns an existing LineItem or nil.\n if current_item # if the current item is present...\n current_item.quantity += 1 # ...increment by one.\n else\n current_item = line_items.build(product_id: product.id) # If the item isn't present then build the line_item.\n current_item.price = product.price # Take the current_item and capture the price attribute.\n end\n current_item # Return the current item.\n end", "def add_product(product)\n current_item = line_items.where(:product_id => product.id).first\n if current_item\n current_item.quantity += 1\n else\n current_item = LineItem.new(:product_id => product_id)\n line_items << current_item\n end\n current_item\n end", "def add_product(product_id)\n \tcurrent_item = line_items.find_by(product_id: product_id)\n \tif current_item\n \t\tcurrent_item.quantity += 1\n \telse\n \t\tcurrent_item = line_items.build(product_id: product_id)\n current_item.product_price = Product.find(product_id).price\n \tend\n \tcurrent_item\n end", "def add_product(product)\n\t\tcurrent_item = line_items.find_by(product_id: product.id)\n\t\tif current_item\n\t\t\tcurrent_item.quantity += 1\n\t\telse\n\t\t\tcurrent_item = line_items.build(product_id: product.id)\n\t\tend\n\t\tcurrent_item\n\tend", "def add_product(product)\n # @type [LineItem, NilClass]\n item = line_items.find_by(product: product)\n if item.present?\n item.quantity += 1\n else\n item = line_items.build(product: product)\n end\n\n item\n end", "def add_product(product)\n current_item = line_items.find_by(product_id: product.id)\n if current_item\n current_item.quantity += 1\n else\n current_item = line_items.build(product_id: product.id)\n end\n current_item\n end", "def add_product(product_name, price)\n if @products.key?(product_name)\n raise ArgumentError.new \"Product of the same name had already been added to this order.\"\n end\n \n @products[product_name] = price\n end", "def add_product(name, price)\n new_product = Product.new(name, price)\n @products_in_cart << new_product\n new_product\nend", "def add_product (product_id)\n current_item = line_items.find_by_product_id(product_id)\n if current_item\n current_item.quantity += 1\n else\n # The default quantity is 1. \n current_item = line_items.build(product_id: product_id)\n end\n current_item\n end", "def add_product(product)\n current_item = line_items.find_by(product_id: product.id)\n if current_item\n current_item.quantity += 1\n else\n current_item = line_items.build(product_id: product.id)\n end\n current_item\n end", "def add_product(product_id)\n\t\tcurrent_item = line_items.find_by_product_id(product_id)\n\t\tif current_item\n\t\t\tcurrent_item.quantity += 1\n\t\telse\n\t\t\tcurrent_item = line_items.build(:product_id => product_id)\n\t\tend\n\t\tcurrent_item\n\tend", "def add_product(a_product, quantity=1, options={})\n return nil if a_product.nil?\n item = find(:first, a_product)\n if item\n item.quantity += quantity\n else\n item = self.cart_line_item(a_product, quantity, options)\n @line_items << item\n end\n item\n end", "def add_product(product, quantity)\n current_item = order_items.find_by(product_id: product.id)\n\n # If current_item doesn't exist, build it\n if current_item.nil?\n current_item = order_items.build(product_id: product.id)\n end\n\n if current_item.quantity.nil?\n current_item.quantity = quantity\n else\n current_item.quantity += quantity\n end\n\n return current_item\n end", "def add_product(product_id)\n\t\tcurrent_item = line_items.find_by(product_id: product_id)\n\t\tif current_item\n\t\t\tcurrent_item.quantity += 1\n\t\telse\n\t\t\tcurrent_item = line_items.build(product_id: product_id)\n\t\tend\n\t\tcurrent_item\n\tend", "def add_product(product_id)\n current_item = line_items.where(:product_id => product_id).first\n if current_item\n current_item.quantity += 1\n # Otherwise create a new line_item\n else\n current_item = LineItem.new(:product_id => product_id)\n line_items << current_item # add the current_item to the end of the line_items\n end\n current_item\n end", "def add_new_product\n aProduct = Product.new(@product_title, @product_price, @customer_id)\n aProduct.create_new_product\n end", "def add_product(product, params)\n raise \"Param *product* is not an instance of Pipedrive::Product\" \\\n unless product.is_a?(Pipedrive::Product)\n raise \"Param :item_price is required\" unless params.key?(:item_price)\n raise \"Param :quantity is required\" unless params.key?(:quantity)\n\n response = request(\n :post,\n \"#{resource_url}/products\",\n params.merge(id: id, product_id: product.id)\n )\n Product.new(response.dig(:data))\n end", "def add_product_to_cart(name, base_price)\n product = Products.new_product(name, base_price)\n shopping_cart << product\n end", "def add_product(product_id)\n \n #Check if the current item is in our current line items\n current_item = line_items.find_by_product_id(product_id)\n if current_item\n #If it is already in our line items, increment the quantity\n current_item.quantity += 1\n else\n #Otherwise, build the relationship\n current_item = line_items.build(product_id: product_id)\n end\n \n #return the current item\n current_item\n end", "def add_item(product_id:, quantity: 1)\n product = Product.find(product_id)\n\n order_item = order.items.find_or_create_by(\n product_id: product_id\n )\n\n order_item.price = product.price\n order_item.quantity = 1\n order_item.save\n end", "def add_product(product_id)\n \tcurrent_item = line_items.find_by(product_id: product_id)\n if current_item\n current_item.quantity += 1\n else\n current_item = line_items.build(product_id: product_id)\n end\n current_item\n end", "def add_product(product_name, price)\n if @products.keys.include?(product_name)\n raise ArgumentError,\"The product is already in the order\"\n else\n @products[product_name] = price\n end\n end", "def add_product_to_order\n prod_id = params[:id].to_i\n qty_to_order = params[:qty].to_i\n\n add_or_update_product_qty(prod_id, qty_to_order)\n\n flash[:notice] = 'Product added to cart'\n redirect_back(fallback_location: root_path)\n end", "def add(product)\n items.create(product: product)\n end", "def add_product_to_order(product_id)\n begin\n db = SQLite3::Database.open(ENV[\"BANGAZON\"])\n db.execute('INSERT into order_products (product_id, order_id) VALUES (?,?)', [product_id, @id])\n last_row = db.last_insert_row_id\n db.close\n end\n last_row\n end", "def add_product(product_id)\n \t#current_item = line_items.where(product_id: product_id).first\n\n \t# if current_item\n \t# if (current_item.quantity == nil) \n # current_item.quantity = 0\n # end\n # current_item.quantity = 1\n \t# else\n \t# current_item = line_items.build(:product_id => product_id)\n # current_item.quantity += 1\n # end\n #current_item\n line_items.create(:product_id => product_id, :quantity => 1)\n end", "def add_item(product_id:, quantity: 1)\n product = Product.find(product_id)\n order_item = order.items.find_or_initialize_by(\n product_id: product_id,\n price: product.price,\n quantity: quantity\n )\n\n order_item.save!\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 add_product(product_params)\n\n\t\tcurrent_item = cart_items.find_by(variant_id: product_params[:product][:variant_id])\n\n\t\tif current_item\n\t\t\tproduct_params[:product][:action] == 'edit' ?\n\t\t\tcurrent_item.quantity = product_params[:product][:quantity].to_i :\n\t\t\tcurrent_item.quantity += product_params[:product][:quantity].to_i\n\t\t\tcurrent_item.save\n\t\telse\n\t\t\tnew_item = cart_items.create(product_id: product_params[:product][:product_id],variant_id: product_params[:product][:variant_id], quantity: product_params[:product][:quantity], cart_id: self.id)\n\t\tend\n\t\t\n\t\tnew_item\n\tend", "def add_product(product_id)\n current_item = line_item.find_by_product_id(product_id)\n if current_item\n current_item.quantity += 1\n else\n current_item = line_items.build(product_id: product_id)\n end\t\n current_item\nend", "def add_product(product_id) #a method that accumulates the quantity of a product that has been added more than twice, using its id\n\t\tcurrent_item = line_items.where(:product_id => product_id).first\n\n\t\tif current_item\n\n\t\t\tcurrent_item.quantity += 1 rescue current_item.quantity\n\t\telse\n\t\t\tcurrent_item = LineItem.new(:product_id=>product_id) #adding a new product to the order line, since its unique to this cart\n\t\t\tline_items << current_item\n\t\tend\n\n\t\tcurrent_item\n\tend", "def add_to_cart(product)\n @products << product\n @sub_total += product.base_price\n @total_price += product.total_price\n puts \"Added to cart!\"\n end", "def add_product(product, quantity)\n raise Exceptions::BusinessException.new('Product already exists') if product_already_exists?(product)\n\n items << Item.new(quantity: quantity, product: product)\n end", "def add_product(product_name, price)\n raise ArgumentError.new (\"products already added\") if @products.include?(product_name)\n @products[product_name] = price\n end", "def add_product(product)\r\n\t\t@shopping_cart << product\r\n\t\t@item_count +=1\t\t# add one to the item counter\r\n\tend", "def add_to_products\n \t@@products << self\n \tend", "def add_product(products, new_product)\n products.push(new_product)\nend", "def send_product(product)\n request(product, \"product\", :post, {method: \"add\"})\n end", "def add_product(product_id) #why methid in model? not in controller?\n\t\tcurrent_item = line_items.find_by(product_id: product_id) #find_by returns one object, where return array\n\t\tif current_item\n\t\t\tcurrent_item.quantity += 1\n\t\telse\n\t\t\tcurrent_item = line_items.build(product_id: product_id) #you could build it from \"cart\" side as well\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t#rails establishes connections for you\n\t\tend\n\n\t\tcurrent_item\n\tend", "def add_product(product)\n current_item = cart_items.find_by(product_id: product.id)\n if current_item.present?\n current_item.increment(:quantity)\n product.decrement!(:inventory_count)\n render json: {\n status: :ok,\n message: 'Product added to cart!'\n }\n else\n current_item = cart_items.build(product_id: product.id)\n end\n end", "def add_product_to_deal(id:, **args)\n params = parameters(args) do\n required_params :product_id, :item_price, :quantity\n optional_params :product_id, :item_price, :quantity, :discount_percentage, :duration, :product_variation_id, :comments, :enabled_flag\n end\n request(:post, \"deals/#{id}/products\", params)\n end", "def add_product(product_name, price)\n if (@products).include?(product_name)\n\n raise ArgumentError, \"This item has already been added\"\n end\n @products[\"#{product_name}\"] = price\n end", "def add_product(product,quant=1)\n\t\tproduct_id = product.id\n\t\tif exist?(product_id)\n\t\t\tproducts[product_id] += quant\n\t\telse\n\t\t\tproducts[product_id] = quant \n\t\tend\n\t\tsave\n\tend", "def add_product(name, unit_size, market_price, discount_price, description)\n product = StockManager::Product.new(name, unit_size, market_price, discount_price, description)\n @products << product\n return @products\n end", "def create\n @cart = current_cart\n @product = Product.find(params[:product_id])\n @order = Order.add_product(@product, @cart)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render action: 'show', status: :created, location: @order }\n else\n format.html { render action: 'new' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_to_shopping_cart(product, quantity)\n shopping_cart.add_product_to_cart(product, quantity)\n end", "def product(text)\n ProcessOrders.instance.add_product text\nend", "def add_product(name, base_price)\n new_product = Product.new(name, base_price)\n @collection_of_products << new_product\n return new_product\n end", "def add_product(product_params)\n\n\t\tcurrent_item = wish_items.find_by(variant_id: product_params[:product][:variant_id])\n\n\t\tif current_item\n\t\t\tcurrent_item.destroy\n\t\telse\n\t\t\tnew_item = wish_items.create(product_id: product_params[:product][:product_id],variant_id: product_params[:product][:variant_id], wish_id: self.id)\n\t\tend\n\t\t\n\t\tnew_item\n\tend", "def add(product, qty)\n l = LineItem.new\n l.set_from_product(product, qty)\n @lines << l\n end", "def add_product(product_name, price)\n\t\tif @products.key? product_name\n\t\t\traise ArgumentError, \"Product already exists\"\n\t\telse\n\t\t\t@products[product_name] = price\n\t\tend\n\tend", "def add_new_product\n array_product = @view.new_product_info\n new_product = Product.new(array_product[0],array_product[1],array_product[2])\n @seller.save_product_info(new_product)\n input = @view.menu(\"2\")\n seller_actions(input)\n end", "def add_product(product, quantity = 1, option_values = [], wholesale = false)\r\n\t\tline_item = LineItem.for_product(product, quantity, wholesale)\r\n\r\n\t\toption_values.each do |cur_option_value|\r\n\t\t\to_v = OptionValue.find(cur_option_value)\r\n\r\n\t\t\t# make sure that discounts are applied to options as well as the base price\r\n#\t\t\tif product[:discount] && !product[:discount_is_abs] && product[:discount] > 0\r\n#\t\t\t\tline_item.set_option(o_v, product[:discount])\r\n#\t\t\telse\r\n\t\t\t\tline_item.set_option(o_v, wholesale)\r\n#\t\t\tend\r\n\t\tend\r\n\r\n\t\titem = @items.find { |i| i.same_as? line_item }\r\n\t\tif item\r\n\t\t\titem.quantity += quantity.to_i\r\n\t\telse\r\n\t\t\t@items << line_item\r\n\t\tend\r\n\tend", "def add_product(product, quantity=1, payment_method='deposit')\n item = @items.find { |i| i.product_id == product.id && i.payment_method == payment_method }\n if item\n item.quantity += quantity\n if item.quantity > 20\n item.quantity = 20\n @quantity_error=\"Only 20 Items may be added at one time. If you need to purchase additional items please contact customer service.\"\n end\n else\n @items << OrderLineItem.new(\n :product_id => product.id,\n :quantity => quantity,\n :unit_deposit => product.deposit,\n :unit_price => product.price,\n :payment_method => payment_method\n )\n end\n end", "def add_product(product_name, product_price)\n if @products.has_key?(product_name)\n raise ArgumentError, \"Adding product that already exists.\"\n else\n @products[product_name] = product_price\n end\n end", "def add_product(product)\n # inicia transação\n transaction do \n item = self.items.detect{|item| item.product == product}\n if item\n item.quantity += 1\n item.save\n else\n self.items.create(:product => product, :quantity => 1, :price => product.price)\n end\n end\n end", "def test_add_product\n a_cart = Order.new\n a_cart.add_product(items(:red_lightsaber), 1)\n a_cart.add_product(items(:red_lightsaber), 3)\n assert_equal 1, a_cart.items.length, \"Cart added multiple order line items for the same product. #{a_cart.items.inspect}\"\n assert a_cart.save\n a_cart.reload()\n assert_equal 1, a_cart.items.length\n assert_equal 4, a_cart.items[0].quantity\n end", "def add_product(text)\n if @products.has_key?(text)\n @current_product = text\n else\n @products[text] = Product.new(text)\n @current_product = text\n end\n end", "def add_product(product_name, product_cost)\n return successfully_add_product?(product_name, product_cost)\n end", "def analytics_add_item(order_id, product_id, product_name, product_variation, unit_price, quantity)\n analytics_render_event(GA::Events::Ecommerce::AddItem.new(order_id, product_id, product_name, product_variation, unit_price, quantity))\n end", "def create\n @order_product = OrderProduct.new(order_product_params.merge(order_id: @order.id))\n respond_to do |format|\n if @order_product.save\n format.html { redirect_to order_path(@order_product.order), notice: 'product added to order.' }\n format.json { render :show, status: :created, location: @order_product }\n else\n format.html { render :new }\n format.json { render json: @order_product.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_to_product\n\t\tif product_title_exists?(@title)\n\t\t\thandle_dup_prod_err(@title)\n\t\telse\n\t\t\t@@products << self\n\t\tend\n\tend", "def add\n add_to_cart_common(:add_product, params[:id])\n end", "def execute\n guest.cart.order_items.create product: product\n end", "def add_product(product_name,price)\n if @products.has_key?(product_name)\n raise ArgumentError, \"#{product_name} has already been added\"\n end\n return @products[product_name] = price\n end", "def add!(code)\n product = @store.find_product(code)\n fail 'ProductInvalid' unless product\n @products << product\n product\n end", "def create\n product = Product.find(params[:product_id])\n qty=params[:quantity].to_i \n @ordered_product = @cart.add_product(product.id,qty)\n @ordered_product.save\n respond_to do |format|\n format.html { redirect_to store_index_url, notice: 'Order placed successfully' }\n format.json { head :no_content }\n end\n end", "def add_item(product_id)\n item = line_items.where(product_id: product_id).first\n if item.present?\n item.quantity += 1\n item\n else\n line_items.new(product_id: product_id)\n end\n end", "def add_product(product_name, product_price)\n if status == :pending || status == :paid\n super\n else\n raise ArgumentError.new(\"Order can only be added to pending or paid statuses\")\n end\n end", "def add_product_to_cart(product_id)\n product = look_up_product(reference_number)\n if product != nil\n @shopping_cart << product\n puts \"Yay! Your #{product[:name]} has been added to your cart.\"\n else\n puts \"We don't have that\"\n end\nend", "def add_product(p)\n \n raise \"This Flyer is readonly!\" if @readonly\n \n @now = now_with_offset\n \n # We compare the datetime the product was created with the current datetime\n # so that if we can use this object in other places (for example when converting from a csv file to JerkStore). It ensures that only products from a given datetime will appear in this flyer.\n tmp_now = p.datesummarized\n val_now = 0\n val_then = 0\n if (\"day\".eql?(self.timespan))\n val_now = @now.yday\n val_then = tmp_now.yday\n elsif (\"week\".eql?(self.timespan))\n val_now = @now.cweek\n val_then = tmp_now.cweek\n elsif (\"month\".eql?(self.timespan))\n val_now = @now.mon\n val_then = tmp_now.mon\n end\n \n #STDERR.puts \"Comparing #{val_now} to #{val_then} for #{ self.timespan }\"\n \n if (val_now == val_then)\n self.products.unshift(p) \n else\n nil\n end\n \n p\n end", "def add(product_object, amount=nil, unit=nil)\n product_object = (product_object)\n product_object.amount = amount if amount\n product_object.unit = unit if unit\n\n cart_item_params = product_object.to_cart_item_params\n existing_item = find_item(cart_item_params)\n\n if existing_item\n existing_item.inc(amount: cart_item_params[:amount])\n else\n cart_items.create!(cart_item_params)\n end\n end", "def add_product\n # unique by name. don't create if product exists\n # strangley spree is not povideing any uid in products table.\n # I am using name for now, if that will not work I modify schema and add uid to spree_products\n @product = Spree::Product.find_or_initialize_by(name: @row[:name])\n\n # master sku has M prefix\n @product.sku = \"m-#{@row[:id]}\"\n @product.price = @row[:price]\n @product.description = @row[:description]\n @product.available_on = Time.now\n @product.shipping_category_id = 1\n @product.tax_category_id = 1\n @product.promotionable = 1\n @product.save! # this will create master variant as well\n\n # now add variant\n # is_master: false, product_id: @product.id\n @variant = Spree::Variant.find_or_initialize_by sku: @row[:id]\n @variant.product_id = @product.id\n @variant.cost_price = @row[:price]\n @variant.track_inventory = false\n @variant.save!\n\n add_image\n add_variants\n\n # @product.option_type_ids = option_type_ids\n # @product.save!\n\n assign_category\n end", "def add_product(product_name, product_price)\n # TODO: implement add_product\n # @product_name = product_name\n # @product_price = product_price\n if @products.include?(product_name) == false\n @products[product_name] = product_price\n result = true\n else\n result = false\n end\n @result = result\n end", "def add_product\n product = Product.find(params[:product][:id])\n unless @invoice_service.add_product(product)\n redirect_to products_path\n return\n end\n\n redirect_to_origin(params[:origin][:code], product)\n end", "def update_products(options)\n quantity = options[:quantity]\n is_bundle = options[:is_bundle]\n if (is_bundle)\n bundle = Bundle.find(options[:id])\n OrderItem.create!(order_id: self.id, bundle_id: bundle.id, quantity: quantity) #products of an bundle OrderItem are found through the association to the bundle\n else\n product = Product.find(options[:id])\n add_product(product, quantity)\n end\n end", "def create_product(add_params = nil)\n params = {\n uid: uid,\n }\n api_call('/stores/:uid/products(.:format)',:post,params,add_params)\n end", "def create_cart_product_for_new_product(product)\n cp = cart_products.create\n cp.product = product\n cp.quantity = 1\n cp.price = product.best_price\n cp\n end", "def orders_add\n\t\t@product_id = params[:product_id].to_i\n\t\t@quantity = params[:quantity].to_i\n\t\t\n\t\tfound = false\n\t\tsession[:orders].each do |order|\n\t\t\tif (order[\"table\"][\"product_id\"]==@product_id and not found) #session-ized variable uses [table]\n\t\t\t\trespond_to do |format|\n\t\t\t\t\tformat.json { render json: { error: \"Product already ordered. Please check your cart.\"} }\n\t\t\t\tend\n\t\t\t\tfound = true\n\t\t\t\treturn\n\t\t\tend\n\t\tend\n\t\t\n\t\tif (not found)\n\t\t\tif (@quantity>0)\n\t\t\t\tneworder = OpenStruct.new product_id: @product_id, quantity: @quantity\n\t\t\t\tsession[:orders] << neworder\n\t\t\t\t\n\t\t\t\trespond_to do |format| #success\n\t\t\t\t\tformat.json { render json: {} }\n\t\t\t\tend\n\t\t\telse\n\t\t\t\trespond_to do |format|\n\t\t\t\t\tformat.json { render json: { error: \"Invalid quantity to be added to cart.\"} }\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\treturn nil\n\tend", "def add_product product\n begin\n ## Create matching ProductTemplate in SugarCRM\n @client.post '/ProductTemplates',\n product.sugar_product_template\n\n \"Product #{product.id} was added.\"\n rescue => e\n message = \"Unable to add product #{product.id}: \\n\" + e.message\n raise SugarcrmAddUpdateObjectError, message, caller\n end\n end", "def add_product(product_name, product_price)\n if @products.key?(product_name) == true\n return false\n else\n @products[product_name] = product_price\n return true\n end\n end", "def insert_product(product_id:, name:, description:, price:, original_price:,\n number_of_installments:, installments_full_price:, image_url:,\n available_quantity:, store_id:)\n productAux = Product.new(\n product_id: product_id,\n name: name,\n description: description,\n price: price,\n original_price: original_price,\n number_of_installments: number_of_installments,\n installments_full_price: installments_full_price,\n image_url: image_url,\n available_quantity: available_quantity,\n store_id: store_id\n )\n\n if productAux.save\n puts \"O produto #{productAux[:name]} foi adicionado com sucesso\"\n else\n puts productAux.errors.full_messages\n end\n end", "def add_to_current_order\n\n # get the first open order that the user has\n if current_user.orders.where(status:'Open').first\n current_order = current_user.orders.where(status:'Open').first\n OrderProduct.create({product_id: params[:product],order_id: current_order.id, quantity: params[:order][:orderproduct][:quantity], price: params[:order][:orderproduct][:price],additional_info: params[:order][:orderproduct][:additional_info] })\n\n # If not open and create a new order for the current user\n else\n current_order = current_user.orders.create(order_params)\n current_order.update(status: 'Open')\n OrderProduct.create({product_id: params[:product],order_id: current_order.id, quantity: params[:order][:orderproduct][:quantity], price: params[:order][:orderproduct][:price],additional_info: params[:order][:orderproduct][:additional_info]})\n end\n redirect_to order_path(current_order)\n end", "def addtocart\n\t\tinsidecart<< createproduct\n\t\taddtocart\n\tend", "def add_to_cart\n \tline_item = LineItem.create(product_id: params[:product_id], quantity: params[:quantity])\n \tline_item.update(line_item_total: (line_item.quantity * line_item.product.price))\n \tredirect_back(fallback_location: root_path)\n end", "def create\n @cart = current_cart\n @product = Product.find(params[:id])\n @order_item = @cart.order_items.build\n @order_item.product_id = @product.id\n #@order_item = OrderItem.create!(:cart => current_cart, :product => @product, :qty_ordered => params[:qty_ordered], :qty_ordered_price => @product.price)\n #@order_item = OrderItem.find_or_initialize_by_cart_id(:cart_id => current_cart.id, :cart => current_cart, :product => @product, :qty_ordered => params[:qty_ordered], :qty_ordered_price => @product.price)\n # @order_item = OrderItem.new\n # @order_item.cart_id = current_cart.id\n # @order_item.product_id = @product.id\n @order_item.qty_ordered = params[:qty]\n @order_item.qty_ordered_price = @product.price\n @order_item.save\n flash[:notice] = \"Added #{@product.name} to cart.\"\n redirect_to current_cart_url\n\n # @order = current_order\n # product = Product.find(params[:product_id])\n # # @order_item = OrderItem.new(params[:order_item]) Ian's line\n # @order_item = @order.add_product(product.id)\n \n # if Order.last == nil\n # @order_item.order_id = 1\n # else @order_item.order_id = Order.last.id + 1\n # end\n # @order_item.qty_ordered_price = @order_item.product.price\n\n # respond_to do |format|\n # if @order_item.save\n # format.html { redirect_to @order_item.order, notice: 'Order item was successfully created.' }\n # format.json { render json: @order_item, status: :created, location: @order_item }\n # else\n # format.html { render action: \"new\" }\n # format.json { render json: @order_item.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def create_product(id)\n item = DirectedEdge::Item.new(@database, \"product#{id}\")\n item.add_tag('product')\n item.save\n end", "def set_orderproduct\n orders =Order.find(params[:order_id])\n @orderproduct = orders.orderproducts.find(params[:id])\n end", "def add_product(product_name, product_price)\n if @status == :processing || @status == :shipped || @status == :complete\n raise ArgumentError\n elsif @status == :paid || @status == :pending\n return super\n end\n end", "def add_to_cart\n @cart = current_user.carts.find_or_create_by(completed: false)\n @line_item = @cart.line_items.find_or_create_by(product_id: params[:product_id])\n @line_item.update quantity: @line_item.quantity + 1\n end", "def add_to_cart(product, amount)\n purchase = \" • #{amount} #{product}\\n\"\n @cart << purchase\n\n cost_per_item = @inventory[product][\"price\"]\n @total_cart_value += (cost_per_item * amount)\n\n @inventory[product][\"quantity\"] -= amount\nend", "def add_inventory(product_name, quantity)\n @products.each do |product|\n if product.name == product_name.upcase\n product.quantity += quantity\n end\n end\n end", "def add_product(product_name, product_price)\n product_exists = @products.has_key?(product_name) == false\n @products[product_name] = product_price if product_exists\n return product_exists\n end" ]
[ "0.8178968", "0.8019756", "0.7978437", "0.7927756", "0.78861994", "0.7848539", "0.78291905", "0.77851653", "0.7769966", "0.7709758", "0.7697274", "0.76822394", "0.76793814", "0.7649247", "0.76474464", "0.7606378", "0.7596846", "0.7594117", "0.7591623", "0.75870246", "0.75768626", "0.75543815", "0.752733", "0.7521848", "0.75217605", "0.751894", "0.74974024", "0.74896556", "0.74576074", "0.745718", "0.7449059", "0.74434704", "0.7441419", "0.7425236", "0.7389729", "0.7305434", "0.7301637", "0.73005974", "0.72899145", "0.7286809", "0.72838104", "0.7272014", "0.7270801", "0.72553504", "0.72398025", "0.7208935", "0.717977", "0.7143623", "0.7133568", "0.7127401", "0.71227354", "0.710715", "0.7104599", "0.7053027", "0.70506126", "0.7035282", "0.7029588", "0.70158273", "0.70023954", "0.6991656", "0.6987444", "0.69865876", "0.69816756", "0.697941", "0.69636756", "0.696265", "0.69348574", "0.6930286", "0.6921826", "0.6901094", "0.68977207", "0.6887771", "0.6859732", "0.68365955", "0.68271405", "0.6825927", "0.67994285", "0.6780178", "0.6771748", "0.67681336", "0.67583966", "0.6740217", "0.6731537", "0.66964096", "0.6669381", "0.66447985", "0.66315156", "0.6627947", "0.6627467", "0.6625183", "0.66175056", "0.6612716", "0.65999335", "0.65921605", "0.6562312", "0.65616417", "0.6550778", "0.6543493", "0.65355384", "0.6502186" ]
0.6635911
86
get every test to pass before coding runner below
def runner welcome cardTotal = initial_round until cardTotal > 21 cardTotal = hit?(cardTotal) display_card_total(cardTotal) end end_game(cardTotal) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_tests\n puts \"Running exactly #{@spec.size} tests.\"\n @spec.each do |test_case|\n sleep test_case.wait_before_request\n response = send_request_for(test_case)\n Checker.available_plugins.each do |plugin|\n result = @expectation.check(plugin, response, test_case)\n if not result.success?\n putc \"F\"\n @results << result\n break\n else\n if plugin == Checker.available_plugins.last\n @results << result\n putc \".\"\n end\n end\n end\n end\n end", "def test_all\n @results['test_start'] = Time.now()\n passed = []\n boot_vm() if @options[:vmm_enabled]\n prep\n freeze_vm() if @options[:vmm_enabled]\n @log.info \"RUNNING NO-SERVICE TEST\"\n passed << one_test(@config['init_scenario'])\n # Stop testing if our initial test fails.\n unless passed.first == true\n @log.error \"Initial setup failed.. sleeping 60 seconds for debugging.\"\n sleep 60\n stop_vm() if @options[:vmm_enabled]\n return passed\n end\n freeze_vm() if @options[:vmm_enabled]\n @log.info \"RUNNING TESTS\"\n scenarios = get_scenarios\n test_counter = 0\n scenarios.each do |scenario|\n test_counter += 1\n @log.info \"Running test for #{scenario} - #{test_counter} of #{scenarios.size}\"\n passed << one_test(scenario)\n end\n stop_vm() if @config[:vmm_enabled]\n all_passed = passed.select{|p| p == false}.size == 0\n @log.info \"Number of tests run : #{passed.size}\"\n @log.info \"Result of ALL tests: Passed? #{all_passed}\"\n @results['test_stop'] = Time.now()\n @results['elapsed_time'] = @results['test_stop'] - @results['test_start']\n return all_passed\n end", "def test_cases; end", "def passed_tests\n self.tests.select do |test|\n test.status == 'passed'\n end\n end", "def final_test\n return unless MiniApivore.all_test_ran?\n\n @errors = MiniApivore.prepare_untested_errors\n assert(@errors.empty?, @errors.join(\"\\n\"))\n\n # preventing duplicate execution\n MiniApivore.runnable_list << \"#{self.class}::#{__method__}_runned\"\n end", "def run_tests\n tests_passed = true\n %w(desktop mobile kc_dm).each do |profile|\n tests_passed &= execute_test(profile)\n end\n tests_passed\n end", "def running_test_case; end", "def all_tests_pass\n cucumber_guard = ::Guard.guards({ :name => 'cucumber', :group => 'puppet_tests'}).first\n cucumber_passed = cucumber_guard.instance_variable_get(\"@failed_paths\").empty?\n rspec_guard = ::Guard.guards({ :name => 'rspec', :group => 'puppet_tests'}).first\n rspec_passed = rspec_guard.instance_variable_get(\"@failed_paths\").empty?\n return rspec_passed && cucumber_passed\nend", "def my_tests\n end", "def tests; end", "def tests; end", "def passed_checks\n all_checks_which_pass\n end", "def passes\n count - failures - errors - skips\n end", "def report\n\t\t\tputs \"Tests: #{@ok} ok, #{@fail} failures.\"\n\t\t\tif (@fail > 0)\n\t\t\t\tputs \"*** THERE WERE FAILURES *** \"\n\t\t\telse \n\t\t\t\tputs \"*** ALL TESTS PASSED ***\"\n\t\t\tend\n\t\tend", "def all_external_test_runs_passed?(test_types = nil)\n external_tests_blocking(test_types).empty?\n end", "def doTests( *tests )\n tests.find_all {|name,data|\n ! doTest(name)\n }\nend", "def go_run_tests\n @status = :running\n Thread.new do\n begin\n test_cases = @test_suite.sources\n\n @mutex.synchronize do\n @test_cases = test_cases\n @test_results = {}\n end\n\n @test_suite.run_tests do |result|\n @mutex.synchronize do\n @test_results[result[:source]] = result[:result]\n end\n end\n\n rescue => e\n puts e\n print e.bracktrace.join(\"\\n\")\n ensure\n @status = :ran\n end\n\n end\n end", "def run\n @testcases.each do |test|\n print \"[ RUN... ] \".green + \" #{name} #{test.name}\\r\"\n\n if test.run\n puts \"[ OK ] \".green + \" #{name} #{test.name}\"\n else\n puts \"[ FAIL ] \".red + \" #{name} #{test.name}\"\n puts\n puts \"Command that failed:\"\n test.explain\n return false\n end\n end\n\n true\n end", "def test_steps; end", "def test_steps; end", "def uninit_ok_tests\n if (!@num_tests_run.nil? && !@num_tests_failed.nil?)\n @num_tests_ok += @num_tests_run - @num_tests_failed\n end\n end", "def before_test(test); end", "def before_test(test); end", "def generate_alltest\n\n end", "def running_test_step; end", "def _test_pages_available\n #execute this code x number of times\n @custom_number_of_users.times do |i|\n puts 'Running tests for user #'+i.to_s\n # assert_section nil\n end\n end", "def testing_begin(files)\n end", "def unitTests\n\t\ttotalTests = 12\n\t\ttotalFailed = 0\n\t\toutput = \"\"\n\t\t@debug = true\n\n\t\t#CLEAR DB BEFORE RUNNING TEST. DEFINITELY CRUDE BUT THE ONLY THING I COULD GET WORKING\n\t\tself.TESTAPI_resetFixture\n\n\t\t#Test1: \"Does not allow a non-registered user login\"\n\t\tresponse = self.login(\"NonUser\",\"pass0\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != -1\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test1\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test2: \"Allows a user that supplies no password get added\"\n\t\tresponse = self.add(\"user2\",\"\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != 1\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test2\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test3: \"Allows a user with a username and password get added\"\n\t\tresponse = self.add(\"user3\",\"pass3\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != 1\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test3\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test4: \"Doesn't allow an already added user get added again\"\n\t\tresponse = self.add(\"user3\",\"pass3\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != -2\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test4\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test5: \"Doesn't allow a blank username get added\"\n\t\tresponse = self.add(\"\",\"pass5\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != -3\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test5\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test6: \"It allows a username and password of 128 characters to get added\"\n\t\tresponse = self.add(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != 1\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test6\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test7: \"Does not allow a username greater than 128 characters\"\n\t\tresponse = self.add(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"pass7\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != -3\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test7\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test8: \"Does not allow a password greater than 128 characters\"\n\t\tresponse = self.add(\"user8\",\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != -4\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test8\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test9: \"Allows a registered user with a password to login and counts number of logins\"\n\t\tresponse = self.login(\"user3\", \"pass3\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != 2\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test9\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test10: \"Allows a registered user without a password to login and counts number of logins\"\n\t\tresponse = self.login(\"user2\", \"\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != 2\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test10\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test11: \"Doesn't allow a user with wrong password to login\"\n\t\tresponse = self.login(\"user3\", \"pass2\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != -1\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test11\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test12: \"Sucessfully Deletes the DB with call to TESTAPI_reset_fixture\"\n\t\tresponse = self.TESTAPI_resetFixture\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != 1\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test12\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t@debug = false\n\t\trender json: {:totalTests => totalTests, :nrFailed => totalFailed, :output => output}\n\t\t\n\tend", "def run\n test_using_random_sample\n test_using_first_of\n end", "def done\n puts 'Done running tests'\n end", "def all_failing\n all(\"#qunit-tests .fail\")\n end", "def passing_tests\n return self.product_tests.includes(:test_executions).select do |test|\n test.execution_state == :passed\n end\n end", "def run_all\n passed = Runner.run(['spec'], cli)\n if passed\n Formatter.notify \"How cool, all works!\", :image => :success\n else\n Formatter.notify \"Failing... not there yet.\", :image => :failed\n end\n end", "def run_tests_under(config, options, root)\n summary = {}\n test_list(File.join($work_dir,root)).each do |path|\n name = path.sub(\"#{$work_dir}/\", '')\n puts \"\", \"\", \"#{name} executing...\"\n result = TestWrapper.new(config,options,path).run_test\n puts \"#{name} returned: #{result.fail_flag}\"\n summary[name] = result.fail_flag\n end\n return summary\nend", "def init_tests\n unless @init_tests\n @test_duration = 0\n @num_tests_run = 0\n @num_tests_failed = 0\n @num_tests_ok = 0\n @num_tests_skipped = 0\n @init_tests = true\n end\n end", "def before_test_case(*args)\n @test_steps =[]\n @scenario_tags = []\n @failed_step = {}\n end", "def test_step; end", "def scenarios\n @runner.done_scenarios\n end", "def define_tests\n @ours.each do |pkg|\n their = @theirs.find { |x| x.name == pkg.name }\n class_eval do\n define_method(\"test_#{pkg.name}_#{pkg.version}\") do\n PackageVersionCheck.new(ours: pkg, theirs: their).run\n end\n end\n end\n end", "def external_test_runs_passed_for?(test_type)\n test_types = ExternalTestType.get(test_type).with_related_types\n current_runs = current_external_test_runs_for(test_types)\n current_runs.any? && current_runs.all?(&:passed_ok?)\n end", "def test_passed(array)\n last_item = array.length - 1\n test_name = array[last_item - 1]\n test_suite_verify(array[@class_name])\n printf \"%-40s PASS\\n\", test_name\n\n return unless @xml_out\n\n @array_list.push ' <testcase classname=\"' + @test_suite + '\" name=\"' + test_name + '\"/>'\n end", "def execute_all &decision\n @result = nil\n @exception = nil\n\n @test_lines.each do |line|\n break if execute_line line, &decision\n end\n unless @exception\n #puts \"=> \" + @result.inspect\n end\n end", "def run_test(tests, ints_to_test, current_test_name)\n require \"./primality_tests/\" + current_test_name + \".rb\"\n tests[current_test_name.to_sym][:result] = []\n ints_to_test.each {|int|\n tests[current_test_name.to_sym][:result] << send(current_test_name, int)\n }\nend", "def call(*tests, env:)\n summary = execute_all(tests, env)\n List.new(\n List.new(Symbol.new(\"success\"), List.new(*summary[:success])),\n List.new(Symbol.new(\"failures\"), List.new(*summary[:failures]))\n )\n end", "def failures; end", "def failures; end", "def failures; end", "def process(files) #called at end of script\n if files.class==Array \n files.each {|f| \n puts \"\\n\\n--------------------\\n#{f}:\\n\\n\"\n result=system(\"#{$PROGRAM_NAME} #{f} #{ARGV}\")\n puts \"\\n\\nERRORS IN TEST #{f}!!!\\n\\n\" unless result\n }\n else\n test_name=File.basename(files).sub(/\\..*?$/,'')\n test_case=Class.new(Test::Unit::TestCase)\n Object.const_set(:\"Test#{test_name.capitalize}\", test_case)\n mk_test_context(files, test_case)\n end\nend", "def run\n\t\t @stats.tests += 1\n\t\t\tputs \"Testi: #{@name}\"\n\t\t\tctx = Context.new\n\t\t\tbegin\n\t\t\t\tctx.instance_eval(&@block)\n\t\t\trescue TestAbort # we don't really care if it aborts.\n\t\t\trescue Exception => ex\n\t\t\t\tctx.fail\n\t\t\t\t@stats.failed += 1\n\t\t\t\tputs ex.inspect\n\t\t\t\tputs ex.backtrace.join(\"\\n\")\n\t\t\tend\n\t\t\tif ctx.failed?\n\t\t\t\tputs \" # FAIL!!! ############\"\n\t\t\t\t@stats.failed += 1\n\t\t\telsif ctx.skipped?\n\t\t\t\tputs \" = skipped ============\"\n\t\t\t\t@stats.skipped += 1\n\t\t\telse\n\t\t\t\tputs \" - ok.\"\n\t\t\t\t@stats.passed += 1\n\t\t\tend\n\t\t\tputs\n\t\tend", "def test_case; end", "def print_results\n if !@failures.empty?\n @failures.each do |test|\n pout \"\\nFailed: #{test[:desc]}\"\n puts test[:result]\n # print a newline for easier reading\n puts \"\"\n end\n abort\n else\n puts \"All passed!\".green\n end\nend", "def test_contains_13_eachsuit\n assert true == false\n end", "def test_runnable_methods_random\n @assertion_count = 0\n\n random_tests_1 = sample_test_case 42\n random_tests_2 = sample_test_case 42\n random_tests_3 = sample_test_case 1_000\n\n assert_equal random_tests_1, random_tests_2\n refute_equal random_tests_1, random_tests_3\n end", "def test_setup\r\n \r\n end", "def compare_tests(test_a, test_b); end", "def compare_tests(test_a, test_b); end", "def test_truth\n end", "def start_tests(files)\n end", "def run(selected_tests)\n # Test names (ordered) to be performed in game, per tests suite\n # Hash< Symbol, Array<String> >\n in_game_tests = {}\n selected_tests.each do |tests_suite, suite_selected_tests|\n if @tests_suites[tests_suite].respond_to?(:run_test)\n # Simple synchronous tests\n suite_selected_tests.each do |test_name|\n # Store statuses after each test just in case of crash\n set_statuses_for(tests_suite, [[test_name, @tests_suites[tests_suite].run_test(test_name)]])\n end\n end\n # We run the tests from the game itself.\n in_game_tests[tests_suite] = suite_selected_tests if @tests_suites[tests_suite].respond_to?(:in_game_tests_for)\n end\n return if in_game_tests.empty?\n\n # Keep track of the mapping between tests suites and in-game tests, per in-game tests suite.\n # Associated info is:\n # * *tests_suite* (Symbol): The tests suite that has subscribed to the statuses of some in-game tests of the in-game tests suite.\n # * *in_game_tests* (Array<String>): List of in-game tests that the tests suite is interested in.\n # * *selected_tests* (Array<String>): List of selected tests for which in-game tests are useful.\n # Hash< Symbol, Array< Hash< Symbol, Object > > >\n in_game_tests_subscriptions = {}\n # List of all in-game tests to perform, per in-game tests suite\n # Hash< Symbol, Array< String > >\n merged_in_game_tests = {}\n # Get the list of in-game tests we have to run and that we will monitor\n in_game_tests.each do |tests_suite, suite_selected_tests|\n in_game_tests_to_subscribe = @tests_suites[tests_suite].in_game_tests_for(suite_selected_tests)\n in_game_tests_to_subscribe.each do |in_game_tests_suite, selected_in_game_tests|\n selected_in_game_tests_downcase = selected_in_game_tests.map(&:downcase)\n in_game_tests_subscriptions[in_game_tests_suite] = [] unless in_game_tests_subscriptions.key?(in_game_tests_suite)\n in_game_tests_subscriptions[in_game_tests_suite] << {\n tests_suite: tests_suite,\n in_game_tests: selected_in_game_tests_downcase,\n selected_tests: suite_selected_tests\n }\n merged_in_game_tests[in_game_tests_suite] = [] unless merged_in_game_tests.key?(in_game_tests_suite)\n merged_in_game_tests[in_game_tests_suite] = (merged_in_game_tests[in_game_tests_suite] + selected_in_game_tests_downcase).uniq\n end\n end\n in_game_tests_runner = InGameTestsRunner.new(@config, @game)\n in_game_tests_runner.run(merged_in_game_tests) do |in_game_tests_suite, in_game_tests_statuses|\n # This is a callback called for each in-game test status change.\n # Update the tests results based on what has been run in-game.\n # Find all tests suites that are subscribed to those in-game tests.\n # Be careful that updates can be given for in-game tests suites we were not expecting\n if in_game_tests_subscriptions.key?(in_game_tests_suite)\n in_game_tests_subscriptions[in_game_tests_suite].each do |tests_suite_subscription|\n selected_in_game_tests_statuses = in_game_tests_statuses.slice(*tests_suite_subscription[:in_game_tests])\n next if selected_in_game_tests_statuses.empty?\n\n tests_suite = @tests_suites[tests_suite_subscription[:tests_suite]]\n tests_suite.statuses = tests_suite.\n parse_auto_tests_statuses_for(tests_suite_subscription[:selected_tests], { in_game_tests_suite => selected_in_game_tests_statuses }).\n select { |(test_name, _test_status)| tests_suite_subscription[:selected_tests].include?(test_name) }\n end\n end\n end\n end", "def define_tests\n Apt.update if Process.uid.zero? # update if root\n @lister.packages.each do |pkg|\n class_eval do\n define_method(\"test_#{pkg.name}_#{pkg.version}\") do\n PackageVersionCheck.new(pkg).run\n end\n end\n end\n end", "def test_contains_four_eachface\n assert true == false\n end", "def check test, block\n res = []\n begin\n block.call\n rescue ApiPi::AssertionError => e\n res << e.message\n end\n failed = !res.empty?\n failed ? @failure_count += 1 : @success_count += 1\n puts \"\\tERROR: #{res.first}\\n\" if failed\n end", "def runTest(browser)\n puts \"Step 2: At step description here\"\n #Do shit here\n #....\n puts \"Step 3: ....\"\n #Do more shit here\n #....\n\n puts \"Expected Result:\"\n puts \"Result that we expect to happen.\"\n\n if true #Test passed condition here\n self.passed = true\n puts \"TEST PASSED. Add some description/details here\"\n else #Test failed condition here\n self.passed = false\n puts \"TEST FAILED. Show what we have screwed up\"\n end\n end", "def testcase_processed\n\t\n\t\tcontinue = true\n\n\t\tthread = ::Thread.new do\n\t\t\n\t\t\tkill_browser\n\n\t\t\tcase @current_pass\n\t\t\t\twhen 1\n\t\t\t\t\t# Initial verification\n\t\t\t\t\t@genopts.keep\n\t\t\t\twhen 2\n\t\t\t\t\t# Reducing elements\n\t\t\t\t\t@elems.keep\n\t\t\t\twhen 3\n\t\t\t\t\t# Reducing idx's\n\t\t\t\t\t@idxs.keep\n\t\t\t\twhen 4\n\t\t\t\t\t# Final verification\n\t\t\t\t\t# booo, pass 4 has failed!?!.\n\t\t\t\t\tcontinue = false\n\t\t\t\telse\n\t\t\t\t\tcontinue = false\n\t\t\tend\n\n\t\t\t# while we still have testcases to generate...\n\t\t\tif( continue )\n\t\t\t\t# we go again an try the next testcase in a new browser instance\n\t\t\t\tspawn_browser\n\t\t\telse\n\t\t\t\t@reduction_server.stop\n\t\t\t\t::Thread.current.kill\n\t\t\tend\n\t\tend\n\t\t\n\t\tthread.join\n\t\t\n\t\treturn continue\n\tend", "def passes; end", "def passes; end", "def rspec_test(nodes)\n node_manager.assert_known(nodes)\n for node in nodes\n node_manager.find(node).rspec_test\n end\n end", "def test_checklist_status_values_not_started\n test = @product.product_tests.checklist_tests.first\n passing, failing, not_started, total = checklist_status_values(test)\n\n assert_equal 0, passing\n assert_equal 0, failing\n assert_equal 1, not_started\n assert_equal 1, total\n end", "def test\n\n puts \"Performing test tasks:\"\n\n puts \"Test 1 \" + (generate_intcode([1, 0, 0, 0, 99]) === [2, 0, 0, 0, 99] ? \"succeeded\": \"failed\") + \"!\"\n puts \"Test 2 \" + (generate_intcode([2, 3, 0, 3, 99]) === [2, 3, 0, 6, 99] ? \"succeeded\": \"failed\") + \"!\"\n puts \"Test 3 \" + (generate_intcode([2, 4, 4, 5, 99, 0]) === [2, 4, 4, 5, 99, 9801] ? \"succeeded\": \"failed\") + \"!\"\n puts \"Test 4 \" + (generate_intcode([1, 1, 1, 4, 99, 5, 6, 0, 99]) === [30, 1, 1, 4, 2, 5, 6, 0, 99] ? \"succeeded\": \"failed\") + \"!\"\n\nend", "def run_all\n run_suite(@suite)\n end", "def completed_tests()\n test_array = []\n self.problems.each do |problem|\n problem.tests.each do |test|\n test_array.push(test)\n end\n end\n test_array\n end", "def run\n test_files.each do |file|\n eval File.read(file)\n end\n\n results = []\n @tests.each_pair do |name, test|\n results << test.call(@config)\n end\n results.reject!(&:nil?)\n results.reject!(&:empty?)\n results.flatten!\n results\n end", "def final_test_methods\n return []\n end", "def check_all_here\n end", "def run_all\n @last_run_states = @persistence ? @persistence.read('final_states', {}) : {}\n @skipped = {}\n run_suite(@suite)\n @persistence.store('final_states', @last_run_states) if @persistence\n end", "def run(selected_tests)\n unknown_tests_suites = selected_tests.keys - @available_tests_suites\n log \"[ In-game testing #{@game.name} ] - !!! The following in-game tests suites are not supported: #{unknown_tests_suites.join(', ')}\" unless unknown_tests_suites.empty?\n tests_to_run = selected_tests.reject { |tests_suite, _tests| unknown_tests_suites.include?(tests_suite) }\n return if tests_to_run.empty?\n\n FileUtils.mkdir_p \"#{@game.path}/Data/SKSE/Plugins/StorageUtilData\"\n tests_to_run.each do |tests_suite, tests|\n # Write the JSON file that contains the list of tests to run\n File.write(\n \"#{@game.path}/Data/SKSE/Plugins/StorageUtilData/AutoTest_#{tests_suite}_Run.json\",\n JSON.pretty_generate(\n 'stringList' => {\n 'tests_to_run' => tests\n }\n )\n )\n # Clear the AutoTest test statuses that we are going to run\n statuses_file = \"#{@game.path}/Data/SKSE/Plugins/StorageUtilData/AutoTest_#{tests_suite}_Statuses.json\"\n next unless File.exist?(statuses_file)\n\n File.write(\n statuses_file,\n JSON.pretty_generate('string' => JSON.parse(File.read(statuses_file))['string'].delete_if { |test_name, _test_status| tests.include?(test_name) })\n )\n end\n auto_test_config_file = \"#{@game.path}/Data/SKSE/Plugins/StorageUtilData/AutoTest_Config.json\"\n # Write the JSON file that contains the configuration of the AutoTest tests runner\n File.write(\n auto_test_config_file,\n JSON.pretty_generate(\n 'string' => {\n 'on_start' => 'run',\n 'on_stop' => 'exit'\n }\n )\n )\n out ''\n out '=========================================='\n out '= In-game tests are about to be launched ='\n out '=========================================='\n out ''\n out 'Here is what you need to do once the game will be launched (don\\'t launch it by yourself, the test framework will launch it for you):'\n out '* Load the game save you want to test (or start a new game).'\n out ''\n out 'This will execute all in-game tests automatically.'\n out ''\n out 'It is possible that the game crashes during tests:'\n out '* That\\'s a normal situation, as tests don\\'t mimick a realistic gaming experience, and the Bethesda engine is not meant to be stressed like that.'\n out '* In case of game crash (CTD), the Modsvaskr test framework will relaunch it automatically and resume testing from when it crashed.'\n out '* In case of repeated CTD on the same test, the Modsvaskr test framework will detect it and skip the crashing test automatically.'\n out '* In case of a game freeze without CTD, the Modsvaskr test framework will detect it after a few minutes and automatically kill the game before re-launching it to resume testing.'\n out ''\n out 'If you want to interrupt in-game testing: invoke the console with ~ key and type stop_tests followed by Enter.'\n out ''\n out 'Press enter to start in-game testing (this will lauch your game automatically)...'\n wait_for_user_enter\n last_time_tests_changed = nil\n with_auto_test_monitoring(\n on_auto_test_statuses_diffs: proc do |in_game_tests_suite, in_game_tests_statuses|\n yield in_game_tests_suite, in_game_tests_statuses\n last_time_tests_changed = Time.now\n end\n ) do\n # Loop on (re-)launching the game when we still have tests to perform\n idx_launch = 0\n loop do\n # Check which test is supposed to run first, as it will help in knowing if it fails or not.\n first_tests_suite_to_run = nil\n first_test_to_run = nil\n current_tests_statuses = check_auto_test_statuses\n @available_tests_suites.each do |tests_suite|\n next unless tests_to_run.key?(tests_suite)\n\n found_test_ok =\n if current_tests_statuses.key?(tests_suite)\n # Find the first test that would be run (meaning the first one having no status, or status 'started')\n tests_to_run[tests_suite].find do |test_name|\n found_test_name, found_test_status = current_tests_statuses[tests_suite].find { |(current_test_name, _current_test_status)| current_test_name == test_name }\n found_test_name.nil? || found_test_status == 'started'\n end\n else\n # For sure the first test of this suite will be the first one to run\n tests_to_run[tests_suite].first\n end\n next unless found_test_ok\n\n first_tests_suite_to_run = tests_suite\n first_test_to_run = found_test_ok\n break\n end\n if first_tests_suite_to_run.nil?\n log \"[ In-game testing #{@game.name} ] - No more test to be run.\"\n break\n else\n log \"[ In-game testing #{@game.name} ] - First test to run should be #{first_tests_suite_to_run} / #{first_test_to_run}.\"\n # Launch the game to execute AutoTest\n @game.launch(autoload: idx_launch.zero? ? false : 'auto_test')\n idx_launch += 1\n log \"[ In-game testing #{@game.name} ] - Start monitoring in-game testing...\"\n last_time_tests_changed = Time.now\n while @game.running?\n check_auto_test_statuses\n # If the tests haven't changed for too long, consider the game has frozen, but not crashed. So kill it.\n if Time.now - last_time_tests_changed > @game.timeout_frozen_tests_secs\n log \"[ In-game testing #{@game.name} ] - Last time in-game tests statuses have changed is #{last_time_tests_changed.strftime('%F %T')}. Consider the game is frozen, so kill it.\"\n @game.kill\n else\n sleep @game.tests_poll_secs\n end\n end\n last_test_statuses = check_auto_test_statuses\n # Log latest statuses\n log \"[ In-game testing #{@game.name} ] - End monitoring in-game testing. In-game test statuses after game run:\"\n last_test_statuses.each do |tests_suite, statuses_for_type|\n log \"[ In-game testing #{@game.name} ] - [ #{tests_suite} ] - #{statuses_for_type.select { |(_name, status)| status == 'ok' }.size} / #{statuses_for_type.size}\"\n end\n # Check for which reason the game has stopped, and eventually end the testing session.\n # Careful as this JSON file can be written by Papyrus that treat strings as case insensitive.\n # cf. https://github.com/xanderdunn/skaar/wiki/Common-Tasks\n auto_test_config = JSON.parse(File.read(auto_test_config_file))['string'].map { |key, value| [key.downcase, value.downcase] }.to_h\n if auto_test_config['stopped_by'] == 'user'\n log \"[ In-game testing #{@game.name} ] - Tests have been stopped by user.\"\n break\n end\n if auto_test_config['tests_execution'] == 'end'\n log \"[ In-game testing #{@game.name} ] - Tests have finished running.\"\n break\n end\n # From here we know that the game has either crashed or has been killed.\n # This is an abnormal termination of the game.\n # We have to know if this is due to a specific test that fails deterministically, or if it is the engine being unstable.\n # Check the status of the first test that should have been run to know about it.\n first_test_status = nil\n _found_test_name, first_test_status = last_test_statuses[first_tests_suite_to_run].find { |(current_test_name, _current_test_status)| current_test_name == first_test_to_run } if last_test_statuses.key?(first_tests_suite_to_run)\n if first_test_status == 'ok'\n # It's not necessarily deterministic.\n # We just have to go on executing next tests.\n log \"[ In-game testing #{@game.name} ] - Tests session has finished in error, certainly due to the game's normal instability. Will resume testing.\"\n else\n # The first test doesn't pass.\n # We need to mark it as failed, then remove it from the runs.\n log \"[ In-game testing #{@game.name} ] - First test #{first_tests_suite_to_run} / #{first_test_to_run} is in error status: #{first_test_status}. Consider it failed and skip it for next run.\"\n # If the test was started but failed before setting its status to something else then change the test status in the JSON file directly so that AutoTest does not try to re-run it.\n if first_test_status == 'started' || first_test_status == '' || first_test_status.nil?\n File.write(\n \"#{@game.path}/Data/SKSE/Plugins/StorageUtilData/AutoTest_#{first_tests_suite_to_run}_Statuses.json\",\n JSON.pretty_generate(\n 'string' => ((last_test_statuses[first_tests_suite_to_run] || []) + [[first_test_to_run, '']]).map do |(test_name, test_status)|\n [\n test_name,\n test_name == first_test_to_run ? 'failed_ctd' : test_status\n ]\n end.to_h\n )\n )\n # Notify the callbacks updating test statuses\n check_auto_test_statuses\n end\n end\n # We will start again. Leave some time to interrupt if we want.\n if @config.no_prompt\n out 'Start again automatically as no_prompt has been set.'\n else\n # First, flush stdin of any pending character\n $stdin.getc until select([$stdin], nil, nil, 2).nil?\n out \"We are going to start again in #{@game.timeout_interrupt_tests_secs} seconds. Press Enter now to interrupt it.\"\n key_pressed =\n begin\n Timeout.timeout(@game.timeout_interrupt_tests_secs) { $stdin.gets }\n rescue Timeout::Error\n nil\n end\n if key_pressed\n log \"[ In-game testing #{@game.name} ] - Run interrupted by user.\"\n # TODO: Remove AutoTest start on load: it has been interrupted by the user, so we should not keep it in case the user launches the game by itself.\n break\n end\n end\n end\n end\n end\n end", "def querytests(binaries)\n # There are no test cases -- inconclusive.\n return 0 if binaries.empty?\n\n # If there are test cases, and _at least_ one of them managed to\n # _pass_, we assume the function is implemented.\n binaries.each { |b|\n f = File.new(\"#{b[0]}/log.passed\", 'r')\n while (line = f.gets)\n return 1 if line.include? b[1]\n end\n f.close\n }\n\n # Require at least 2 failing test cases.\n # XXX: Increase this to eliminate false positive results.\n return 0 if binaries.size < 2\n\n # The function is not implemented.\n return -1\nend", "def testloop\n \n end", "def test test_cases, f\n test_cases.each do |s, l, e|\n a = send(f, s, l)\n print \"#{f} #{s}, #{l} = #{a} ... \"\n if a == e\n puts 'PASS'\n else\n puts 'FAIL'\n end\n end\nend", "def integration_test()\n return [\"all\"]\n end", "def save_tests\n filtered_builds.each do |build|\n tests = test_failures(build['build_num'])\n tests.each do |test|\n save_test(test, build['build_num'])\n end\n end\n end", "def failed_checks\n all_checks_which_pass(false)\n end", "def run_test\n # Add your code here...\n end", "def run_test\n # Add your code here...\n end", "def spec_tests(&block)\n require 'onceover/testconfig'\n\n # Load up all of the tests and deduplicate them\n testconfig = Onceover::TestConfig.new(@onceover_yaml, @opts)\n testconfig.spec_tests.each { |tst| testconfig.verify_spec_test(self, tst) }\n tests = testconfig.run_filters(Onceover::Test.deduplicate(testconfig.spec_tests))\n\n # Loop over each test, executing the user's block on each\n tests.each do |tst|\n block.call(tst.classes[0].name, tst.nodes[0].name, tst.nodes[0].fact_set, tst.nodes[0].trusted_set, tst.nodes[0].trusted_external_set, testconfig.pre_condition)\n end\n end", "def after_test(_test); end", "def after_test(_test); end", "def after_test(_test); end", "def testing\n # ...\n end", "def passed?\n return @test_passed\n end", "def run\n checks.each(&:run)\n end", "def count_tests\n Dir.entries(@path.to_s + \"sandbox\").each do |currFile|\n isFile = currFile.to_s =~ /\\.java$|\\.py$|\\.c$|\\.cpp$|\\.js$|\\.php$|\\.rb$|\\.hs$|\\.clj$|\\.go$|\\.scala$|\\.coffee$|\\.cs$|\\.groovy$\\.erl$/i\n\n unless isFile.nil?\n file = @path.to_s + \"sandbox/\" + currFile.to_s\n begin\n case @language.to_s\n when \"Java-1.8_JUnit\"\n if File.open(file).read.scan(/junit/).count > 0\n @totaltests += File.open(file).read.scan(/@Test/).count\n end\n when \"Java-1.8_Mockito\"\n if File.open(file).read.scan(/org\\.mockito/).count > 0\n @totaltests += File.open(file).read.scan(/@Test/).count\n end\n when \"Java-1.8_Powermockito\"\n if File.open(file).read.scan(/org\\.powermock/).count > 0\n @totaltests += File.open(file).read.scan(/@Test/).count\n end\n when \"Java-1.8_Approval\"\n if File.open(file).read.scan(/org\\.approvaltests/).count > 0\n @totaltests += File.open(file).read.scan(/@Test/).count\n end\n when \"Python-unittest\"\n if File.open(file).read.scan(/unittest/).count > 0\n @totaltests += File.open(file).read.scan(/def /).count\n end\n when \"Python-pytest\"\n if file.include?\"test\"\n @totaltests += File.open(file).read.scan(/def /).count\n end\n when \"Ruby-TestUnit\"\n if File.open(file).read.scan(/test\\/unit/).count > 0\n @totaltests += File.open(file).read.scan(/def /).count\n end\n when \"Ruby-Rspec\"\n if File.open(file).read.scan(/describe/).count > 0\n @totaltests += File.open(file).read.scan(/it /).count\n end\n when \"C++-assert\"\n if File.open(file).read.scan(/cassert/).count > 0\n @totaltests += File.open(file).read.scan(/static void /).count\n end\n when \"C++-GoogleTest\"\n if File.open(file).read.scan(/gtest\\.h/).count > 0\n @totaltests += File.open(file).read.scan(/TEST\\(/).count\n end\n when \"C++-CppUTest\"\n if File.open(file).read.scan(/CppUTest/).count > 0\n @totaltests += File.open(file).read.scan(/TEST\\(/).count\n end\n when \"C++-Catch\"\n if File.open(file).read.scan(/catch\\.hpp/).count > 0\n @totaltests += File.open(file).read.scan(/TEST_CASE\\(/).count\n end\n when \"C-assert\"\n if File.open(file).read.scan(/assert\\.h/).count > 0\n @totaltests += File.open(file).read.scan(/static void /).count\n end\n when \"Go-testing\"\n if File.open(file).read.scan(/testing/).count > 0\n @totaltests += File.open(file).read.scan(/func /).count\n end\n when \"Javascript-assert\"\n if File.open(file).read.scan(/assert/).count > 0\n @totaltests += File.open(file).read.scan(/assert/).count - 2 #2 extra because of library include line\n end\n when \"C#-NUnit\"\n if File.open(file).read.scan(/NUnit\\.Framework/).count > 0\n @totaltests += File.open(file).read.scan(/\\[Test\\]/).count\n end\n when \"PHP-PHPUnit\"\n if File.open(file).read.scan(/PHPUnit_Framework_TestCase/).count > 0\n @totaltests += File.open(file).read.scan(/function /).count\n end\n when \"Perl-TestSimple\"\n if File.open(file).read.scan(/use Test/).count > 0\n @totaltests += File.open(file).read.scan(/is/).count\n end\n when \"CoffeeScript-jasmine\"\n if File.open(file).read.scan(/jasmine-node/).count > 0\n @totaltests += File.open(file).read.scan(/it/).count\n end\n when \"Erlang-eunit\"\n if File.open(file).read.scan(/eunit\\.hrl/).count > 0\n @totaltests += File.open(file).read.scan(/test\\(\\)/).count\n end\n when \"Haskell-hunit\"\n if File.open(file).read.scan(/Test\\.HUnit/).count > 0\n @totaltests += File.open(file).read.scan(/TestCase/).count\n end\n when \"Scala-scalatest\"\n if File.open(file).read.scan(/org\\.scalatest/).count > 0\n @totaltests += File.open(file).read.scan(/test\\(/).count\n end\n when \"Clojure-.test\"\n if File.open(file).read.scan(/clojure\\.test/).count > 0\n @totaltests += File.open(file).read.scan(/deftest/).count\n end\n when \"Groovy-JUnit\"\n if File.open(file).read.scan(/org\\.junit/).count > 0\n @totaltests += File.open(file).read.scan(/@Test/).count\n end\n when \"Groovy-Spock\"\n if File.open(file).read.scan(/spock\\.lang/).count > 0\n @totaltests += File.open(file).read.scan(/def /).count - 1 #1 extra because of object def\n end\n else\n @totaltests = \"NA\"\n end\n rescue\n puts \"Error: Reading in count_tests\"\n end\n end\n end\nend", "def run test_identifier=nil\n @dispatcher.run!\n # start\n message(\"start\")\n suite_setup,suite_teardown,setup,teardown,tests=*parse(test_identifier)\n if tests.empty? \n @dispatcher.exit\n raise RutemaError,\"No tests to run!\"\n else\n # running - at this point all checks are done and the tests are active\n message(\"running\")\n run_scenarios(tests,suite_setup,suite_teardown,setup,teardown)\n end\n message(\"end\")\n @dispatcher.exit\n @dispatcher.report(tests)\n end", "def report_from(tests)\n tests.map do |test|\n report = [test.name, test.executed?]\n report << test.platform.name unless test.platform.nil?\n report << test.node unless test.node.nil?\n # Only report the first line of the error messages, as some contain callstacks\n report << test.errors.map { |error| error.split(\"\\n\").first } unless test.errors.empty?\n report\n end\n end", "def run_all\n UI.info \"Running all tests...\"\n _really_run(Util.xcodebuild_command(options))\n end", "def process_test_cases\n raise NotImplementedError, 'You must implement this'\n end", "def test_run_completed(test_run)\n report_results test_run\n end", "def run_fe_tests\n end", "def run_all\n passed = @runner.run_all!\n\n throw :task_has_failed unless passed\n end", "def run_tests\n\n ::RSpec::Core::Runner.run([])\n\n print ::IRB.CurrentContext.io.prompt\n\n end", "def test_list\n list = []\n instance_methods.each do |m|\n next unless m.to_s =~ /^(ok|no)[_ ]/\n list << m\n end\n list\n end" ]
[ "0.7273221", "0.720019", "0.71913236", "0.7132613", "0.7128341", "0.7034019", "0.6862308", "0.68217874", "0.68061566", "0.679089", "0.679089", "0.67657375", "0.6571217", "0.6552916", "0.654781", "0.6544841", "0.6529625", "0.6458231", "0.6449034", "0.6449034", "0.64416414", "0.643438", "0.643438", "0.6428053", "0.63942957", "0.6364504", "0.63446915", "0.6337189", "0.632078", "0.63004816", "0.6283401", "0.6275755", "0.62619704", "0.62594646", "0.624748", "0.62372434", "0.6217366", "0.6200891", "0.6200199", "0.6198013", "0.6197598", "0.6195435", "0.6193741", "0.61932296", "0.61921227", "0.61921227", "0.61921227", "0.6189131", "0.6185814", "0.61716676", "0.6160662", "0.6157471", "0.6141076", "0.61365974", "0.6134457", "0.6134457", "0.61322135", "0.61315334", "0.61201584", "0.6111959", "0.6105867", "0.6088326", "0.6087823", "0.6087243", "0.6082812", "0.6082812", "0.6082431", "0.6076719", "0.6076372", "0.6075186", "0.60726833", "0.6063543", "0.6051483", "0.60502994", "0.6042302", "0.60241306", "0.60223275", "0.6021206", "0.601724", "0.6013492", "0.60115725", "0.6004958", "0.6001946", "0.6001946", "0.60003823", "0.59922266", "0.59922266", "0.59922266", "0.5984721", "0.59707576", "0.5968755", "0.59682333", "0.59659594", "0.5954276", "0.59539443", "0.59445953", "0.5942305", "0.59420365", "0.59417135", "0.59342843", "0.59284556" ]
0.0
-1
Returns false if the token is too old, or test_secret doesn't match (if supplied) else true
def verify(test_secret = false, time_tolerance_seconds = 60) return false if @timestamp.to_i+time_tolerance_seconds.to_i < Time.now.utc.to_i return !!(@payload == test_secret) if test_secret return true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_token?\r\n token = ::AuthToken.where(user_id: decoded_auth_token[:user_id]).newer.first\r\n token&.token == auth_token && token.expire_at >= Time.now if token.present?\r\n end", "def valid_token?\n five_minutes_ago = DateTime.now - 5.minutes\n params[:timestamp].to_i > five_minutes_ago.to_i &&\n params[:token] == Scalingo::SsoController.generate_authentication_token(params[:id], params[:timestamp])\n end", "def require_token\n today = Time.now\n today_string = today.to_date.to_s\n yesterday_string = today.yesterday.to_date.to_s\n return false unless [today_string, yesterday_string].include?(params[:salt])\n params[:token] == token_with_salt(params[:salt])\n end", "def token_can_be_reused?(token, client_id)\n # ghetto HashWithIndifferentAccess\n updated_at = self.tokens[client_id]['updated_at'] || self.tokens[client_id][:updated_at]\n last_token = self.tokens[client_id]['last_token'] || self.tokens[client_id][:last_token]\n\n\n return true if (\n # ensure that the last token and its creation time exist\n updated_at && last_token &&\n\n # ensure that previous token falls within the batch buffer throttle time of the last request\n Time.parse(updated_at) > Time.now - DeviseTokenAuth.batch_request_buffer_throttle &&\n\n # ensure that the token is valid\n ::BCrypt::Password.new(last_token) == token\n )\n end", "def valid_new_token?(token)\n unique_token?(token) && token_looks_safe?(token)\n end", "def token_valid?\n @session_token and @toodle_token_death > Time.now\n end", "def password_token_valid?\n (updated_at + 4.hours) > Time.now.utc\n end", "def token_can_be_reused?(token, client_id)\n return true if (\n # ensure that the last token and its creation time exist\n self.tokens[client_id]['updated_at'] and\n self.tokens[client_id]['last_token'] and\n\n # ensure that previous token falls within the batch buffer throttle time of the last request\n Time.parse(self.tokens[client_id]['updated_at']) > Time.now - DeviseTokenAuth.batch_request_buffer_throttle and\n\n # ensure that the token is valid\n BCrypt::Password.new(self.tokens[client_id]['last_token']) == token\n )\n end", "def validate_token\n if self.transaction_token_created_at + 720.minutes > Time.now\n true\n else\n false\n end\n end", "def validate_token(provided_token)\n clear_expired_tokens\n token_object = access_tokens.find_by_token(provided_token)\n return false if !token_object\n token_object.update_attribute(:token_expire, Time.now + DEFAULT_TOKEN_EXPIRE)\n true\n end", "def is_token_expired?\n (Time.now - self.updated_at) > 3300\n end", "def refresh_token?\n if (@token_timer + 6000) < Time.now\n self.get_token\n true\n else\n false\n end\n end", "def password_token_valid?\n (self.reset_password_sent_at + 4.hours) > Time.now.utc\n end", "def valid_token?\n return false unless token\n begin\n # We use rate limit as its a fast and free way to\n # test the GitHub token.\n octokit.rate_limit\n rescue Octokit::ClientError\n return false\n end\n true\n end", "def valid_access_token?\n token_file = '/opt/gluu-server/etc/certs/api_token.json'\n return false unless File.exist? token_file\n\n token_config = JSON.parse(File.read(token_file))\n expired = token_config['exp'] < Time.now.to_i\n return false if expired\n\n return false unless token_config['token']\n\n true\n end", "def correct_login_token?(given_token)\n false\n end", "def token_expired?\n return true\n expires_at < Time.now if expires_at?\n end", "def token_valid?(expected_id, expected_file_name, expected_user_ip)\n # max_token_age returns a duration. calling `.ago` on it returns a date which we can check against for expiry.\n id == expected_id && file_name == expected_file_name && user_ip == expected_user_ip &&\n (timestamp >= self.class.max_token_age.ago)\n end", "def valid_rem?(test_tok)\n ret = false\n remember_hash.values.each do |correct_rem|\n ret = true if Encrypt::Password.validatePassword test_tok, correct_rem\n end\n ret\n end", "def check_validity\n if @expires_at == nil\n raise OAuthSessionError, \"Expiration not properly initialized.\"\n end\n if @expires_at < Time.new\n if not do_refresh\n raise OAuthSessionError, \"Token could not be refreshed.\"\n end\n end\n return true\n end", "def current_token_still_valid?\n begin\n drive = @client.discovered_api('drive', 'v2')\n result = @client.execute(:api_method => drive.about.get)\n rescue\n return false\n end\n \n if result.status == 200\n true\n else\n false\n end\n end", "def validate_token_no_tmp_datetime(token)\n valid_vals = []\n valid_vals << ROTP::TOTP.new(self.get_qr).at(Time.now)\n (1..self.class.ga_timedrift).each do |cc|\n valid_vals << ROTP::TOTP.new(self.get_qr).at(Time.now.ago(30*cc))\n valid_vals << ROTP::TOTP.new(self.get_qr).at(Time.now.in(30*cc))\n end\n\n if valid_vals.include?(token.to_i)\n return true\n else\n return false\n end\n end", "def check_magic_token\n params[:magic_token] == Rails.application.secrets.calendly_magic_token\n end", "def keys_valid (full_profile_name)\n # Check if we actually need to be refreshing this token (if this data is already set)\n # Amazon uses (or close enough to) the rfc3339 datetime standard\n unless @token_data[full_profile_name].nil?\n expire_time = DateTime.rfc3339(@token_data[full_profile_name]['expiration'])\n current_time = DateTime.now\n # This is to allow us to renew them within 10minutes of them expiring\n if (expire_time - 600) < current_time and expire_time > current_time\n puts \"Within 10min of expiration. Allowing early renew.\"\n return false\n elsif expire_time > current_time\n # Then we are good to go\n return true\n else\n # The keys are expired (i.e not valid)\n return false\n end\n end\nend", "def token_valid?(client_nonce, token)\n gen_time, _dontcare = encryptor(client_nonce).decode(token)\n\n time_diff = Time.now - Time.at(time_to_block(gen_time))\n time_diff < valid_interval && time_diff > 0\n rescue ArgumentError\n false\n end", "def token_expired?\n @token.nil? || Time.now >= @token_expires_on + expiration_threshold\n end", "def valid_token?(token)\n return token == 'TEST_ENV_VALID_TOKEN' if Rails.env.test?\n\n valid_token = config['security_token']\n raise 'Security token is not set! Please set it as soon as possible!' if valid_token.blank?\n\n token == valid_token\n end", "def token_expired?\n self.expires < Time.zone.now.to_i\n end", "def verification_token_valid?\n (self.verification_sent_at + 4.hours) > Time.now.utc\n end", "def tgt_expired?\n return true if @last_updated.nil? or @ticket_granting_ticket.nil?\n (@last_updated + 5) < Time.now.to_i # TGTs have an 8 hour life\n end", "def auth_token(client_token = '')\n\t\tif self.authen_token == client_token\n\t\t\treturn true\n\t\telse\n\n self.wrong_token_time += 1\n #debugger\n self.save\n if self.wrong_token_time >= 3\n self.generate_token\n end\n \n return false\n\t\tend\t\n\tend", "def needs_refresh?\n @access_token.nil? ||\n (Time.now + TOKEN_BUFFER) > @expires_at\n end", "def needs_token_refresh?\n !@token || @authenticator.needs_token_refresh?\n end", "def is_reset_token_valid?(qwi_params)\n !self.reset_password_digest.nil? &&\n !self.reset_password_expiry.nil? &&\n (Time.now < self.reset_password_expiry + 7.hours) &&\n (BCrypt::Password.new(self.reset_password_digest) == qwi_params)\n end", "def has_valid_login_token?\n return false if login_token.blank? || login_token_expires_at.nil?\n login_token_expires_at.future?\n end", "def validate_token(provided_token, extend_expire = true)\n clear_expired_tokens\n token_object = access_tokens.find_by_token(provided_token)\n return false if !token_object\n if extend_expire\n token_object.update_attribute(:token_expire, Time.now + DEFAULT_TOKEN_EXPIRE)\n end\n true\n end", "def valid_reset_token?(token)\n token.is_a?(String) && reset_password_period_valid? && reset_password_token == token\n end", "def valid_token?\n # we check against a copy invitation object\n match = Invitation.find_by_token(self.token)\n \n if !match\n errors.add :token, 'not found'\n return false\n elsif User.registered.find_by_invitation_id(match)\n errors.add :token, 'already used'\n return false\n end\n \n true\n end", "def test_nonce_not_current\n string = \"0123456789ABCDEF\"\n\n nonce1 = OauthNonce.remember(string, Time.now.to_i - 86430)\n assert_equal false, nonce1, \"Nonces over a day in the past should be rejected\"\n\n nonce2 = OauthNonce.remember(string, Time.now.to_i - 86370)\n assert_not_equal false, nonce2, \"Nonces under a day in the past should be rejected\"\n end", "def remember_token?\n remember_token_expires_at && Time.now < remember_token_expires_at\n end", "def validate_token_hash\n if @token_request_at and\n @token_hash and @token_hash['expires_in'] and\n (Time.now - @token_request_at) > @token_hash['expires_in'].to_i\n @token_hash = nil\n elsif @token_request_at and\n @token_hash and @token_hash['expires_in']\n @token_hash['access_token']\n else\n puts \"start get token ...\"\n end\n end", "def remember_token?\n remember_token_expires_at && Time.now.utc < remember_token_expires_at \n end", "def remember_token?\n remember_token_expires_at && Time.now.utc < remember_token_expires_at \n end", "def remember_token?\n remember_token_expires_at && Time.now.utc < remember_token_expires_at \n end", "def validate(expiration_buffer_sec = 0)\n return true if (Time.now + expiration_buffer_sec).to_i < expires_on\n\n unless refresh_token\n logger.verbose('Cached token is almost expired but no refresh token ' \\\n 'is available.')\n return false\n end\n logger.verbose('Cached token is almost expired, attempting to refresh ' \\\n ' with refresh token.')\n refresh_response = refresh\n if refresh_response.instance_of? SuccessResponse\n logger.verbose('Successfully refreshed token in cache.')\n @token_response = refresh_response\n true\n else\n logger.warn('Failed to refresh token in cache with refresh token.')\n false\n end\n end", "def valid?\n return false if @last_update.nil?\n (@last_update + SecureRandom.random_number(9) + 1 <= Time.now.to_i)\n end", "def valid?\n return false if @last_update.nil?\n (@last_update + SecureRandom.random_number(9) + 1 <= Time.now.to_i)\n end", "def access_token_expired?\n Time.zone.now >= self.expires_at\n end", "def access_token_expired?\n Time.zone.now >= self.expires_at\n end", "def remember_token?\n remember_token_expires_at && Time.now.utc < remember_token_expires_at\n end", "def not_spammer(token)\n if session[:token] == token.to_i\n session[:token] = rand(1000000)\n true\n else\n false\n end\n end", "def confirmation_token_valid?\n (self.confirmation_sent_at + 30.days) > Time.now.utc\n end", "def valid_remember_token?(token)\n if self.remember_digest.nil?\n return false\n else\n return BCrypt::Password.new(self.remember_digest).is_password?(token)\n end\n end", "def valid_token?\n\t\tif self.moves_token.presence\n\t\t\tresponse = HTTParty.get('https://api.moves-app.com/oauth/v1/tokeninfo?access_token='+\n\t\t\t\tself.moves_token)\n\t\t\tputs \"response.code: #{response.code}\"\n\t\t\tresponse.code == 200\n\t\telse\n\t\t\tfalse\n\t\tend\n\tend", "def valid_auth_token?(request_auth_token)\n Devise.secure_compare(auth_token, request_auth_token) && !auth_token_expired?\n end", "def is_authorized?\n !!token && !token.expired?\n end", "def is_authorized?\n !!token && !token.expired?\n end", "def check_magic_token\n params[:magic_token] == Rails.application.secrets.salesforce_magic_token\n end", "def valid_token\n unless !value_changed? || token_data(refresh: true).is_valid\n errors.add(\n :value,\n I18n.translate(\n 'fbsync.activerecord.errors.token.invalid_token',\n expires_at: I18n.localize(token_data.expires_at)\n )\n )\n end\n end", "def refresh_token_if_needed\n token_timestamp = decoded_jwt['exp']\n current_timestamp = DateTime.now.to_i\n return unless token_timestamp - current_timestamp <= 0\n\n refresh_token\n end", "def remember_token?\n remember_token_expires_at && Time.now.utc < remember_token_expires_at\n end", "def valid_app_access_token?\n app_access_token = request.headers['X-App-Access-Token']\n\n app_access_token.present? &&\n app_access_token == Rails.application.secrets.app_access_token\n end", "def valid_access_token\n self.access_token_expired? ? self.refresh_access_token : self.access_token\n end", "def valid_access_token\n self.access_token_expired? ? self.refresh_access_token! : self.access_token\n end", "def isTokenExpired\n if Time.now.to_i - @access_token_timestamp >= access_token_expires\n puts \"had to reauthenticate\"\n self.authenticate\n end\n end", "def remember_token?\n remember_token_expires_at && Time.now.utc < remember_token_expires_at\n end", "def good?\n unlocked? && (self.expires_on ? DateTime.current < self.expires_on : true)\n end", "def validate_reuse_access_token_value\n strategy = token_secret_strategy\n return if !reuse_access_token || strategy.allows_restoring_secrets?\n\n ::Rails.logger.warn(\n \"[DOORKEEPER] You have configured both reuse_access_token \" \\\n \"AND '#{strategy}' strategy which cannot restore tokens. \" \\\n \"This combination is unsupported. reuse_access_token will be disabled\",\n )\n @reuse_access_token = false\n end", "def token_expired\n @token.nil? || Time.now >= @token_expires_on + expiration_threshold\n end", "def valid_app_access_token?\n token = request.headers['X-App-Access-Token']\n\n token.present? && token == Rails.application.secrets.app_access_token\n end", "def is_token_valid? token\n @browser_token_db.has_token? token\n end", "def has_preview_url_expired?\n input_ts = @params['ts'].to_i\n threshold_time = Time.now - 5 * 60 # check if token is older than 5 minutes\n input_ts < threshold_time.to_i\n end", "def access_token_expired?\n\t\taccess_token_expires_at && access_token_expires_at < Time.zone.now\n\tend", "def check_weixin_token_valid?\n if token_string.blank?\n if token_model_instance.blank?\n render text: \"Forbidden\", status: 403\n return false\n end\n else\n if current_weixin_token != token_string\n render text: \"Forbidden\", status: 403\n return false\n end\n end\n true\n end", "def has_valid_token?\n !Slack::Config.token.nil? && Slack::Config.token == \"authorized\"\n end", "def password_reset_token_expired?\n sent_reset_at < 1.hour.ago\n end", "def token_autenticado?(token)\n return false if token.nil?\n Password.new(reset_digest).is_password?(token)\n end", "def token?(token)\n return false\n end", "def expired?\n @token.expired?(@expires_in_buffer)\n end", "def valid_token?(token)\n return false unless !token.nil? && token_looks_safe?(token)\n result = ApiToken.find_by(token: token)\n !result.nil? && result[:active]\n end", "def validate_token(digest, token)\n if token.nil? || digest.nil?\n false\n else\n BCrypt::Password.new(digest).is_password?(token)\n end\n end", "def valid_otp?\n Redis.current.get(current_user.id) == otp_params[:otp]\n end", "def fb_access_token_valid?\n if self.access_token.present? \n begin\n valid = self.fb_permissions.include?(:publish_actions)\n self.fb_access_token_expired unless valid\n\n valid\n rescue FbGraph::InvalidToken => ex\n self.fb_access_token_expired\n false\n end\n else \n false\n end\n end", "def have_secret\n tmurl = params[:trustme]\n tmheader = request.headers[\"HTTP_X_TRUSTME\"]\n secret = Rails.application.config.admin_secret\n logger.info \"checking tmurl #{tmurl}, tmheader #{tmheader}, secret #{secret}\"\n if !(tmurl == secret or tmheader == secret)\n head :unauthorized\n end\n end", "def authenticated_with_token?(token)\n return false if token.nil?\n token == remember_digest\n end", "def valid_token?\n env['HTTP_TOKEN']\n end", "def valid?\n return false unless ::File.exist?(@tmpfile)\n ::File.open(@tmpfile, &:readlines).map! do |line|\n return true if line.match(@secret)\n end\n false\n end", "def valid_access_token\n\t\t\t\t# The token we have stored is expired - fetch a new one using the refresh token\n\t\t\t\tself.refresh_access_token if self.access_token_expired?\n\n\t\t\t\tself.access_token\n\t\t\tend", "def valid_token\n # generate the token\n self.token=Digest::MD5.hexdigest(\"#{Time.now}-#{self.ad_id}-#{self.publisher_id}\")\n\n # Aux var to the ValidatorLoop\n counter = 0\n\n # Loop which validate the token on the DB\n while true do\n another_access = Access.where(token: self.token).take\n break if another_access.nil?\n self.token=\"#{self.token}#{counter}\"\n counter=counter+1\n end\n end", "def expired?(token)\n expires_on = token[/&?ExpiresOn=([^&]+)/, 1]\n expires_on.to_i < Time.now.to_i\n end", "def confirm_totp_secret!( secret, code )\n\n # if it fails…\n return false unless confirm_totp_secret( secret, code )\n\n # update some pointers\n self.second_factor_enabled = true\n save\n\n end", "def access_token_expired?\n\t\t\t\treturn false if self.expires_at.nil?\n\n\t\t\t\t# Expiration date less than now == expired\n\t\t\t\tself.expires_at < Time.now\n\t\t\tend", "def valid_key(token)\n @api_client && ActiveSupport::SecurityUtils.secure_compare(@api_client&.key, Digest::SHA512.hexdigest(token))\n end", "def validate_token\n return success if @token.blank?\n\n service_response = UserManagement::DoubleOptIn.new({client: @client, t: @token, user_id: @user_id}).perform\n #TODO: user_token_sale_state should be sent to web.\n return unauthorized_access_response('um_gbd_2') unless service_response.success?\n @user.reload\n\n @account_activated = true if (@user_token_sale_state != @user.get_token_sale_state_page_name &&\n @user_token_sale_state == GlobalConstant::User.get_token_sale_state_page_names(\"verification_page\"))\n\n @user_token_sale_state = @user.get_token_sale_state_page_name\n success\n end", "def should_generate_reset_token?\n reset_password_token.nil? || !reset_password_period_valid?\n end", "def valid_token\n StatsManager::StatsD.time(Settings::StatsConstants.api['user']['valid_token']) do\n if ![\"facebook\"].include?(params[:provider]) # using include? allows us to do this for twitter/tumblr in the future\n return render_error(404, \"this route only currently supports facebook as a provider.\")\n end\n\n if auth = current_user.first_provider(params[:provider]) and auth.is_a? Authentication\n @token_valid = GT::UserFacebookManager.verify_auth(auth.oauth_token)\n @status = 200\n else\n return render_error(404, \"This user does not have a #{params[:provider]} authentication to check on\")\n end\n end\n end", "def verification?\n configuration.secret.nil? == false\n end", "def valid?(extra_tokens = nil)\n extra_tokens = [extra_tokens] if extra_tokens.kind_of?(Hash)\n if @key == @client.key\n return check_signature(@client.secret)\n elsif extra_tokens\n extra_tokens.each do |token|\n return check_signature(token[:secret]) if @key == token[:key]\n end\n end\n Pusher.logger.warn \"Received webhook with unknown key: #{key}\"\n return false\n end", "def refresh_token\n authorize current_user\n original = current_user.api_token\n current_user.generate_token!\n @success = current_user.api_token != original\n end", "def password_resettable?\n token = password_reset_token\n !!(token && !token.expired? && !token.confirmed?)\n end" ]
[ "0.7289164", "0.72594076", "0.72502977", "0.7198856", "0.71630645", "0.71374357", "0.70382243", "0.69434094", "0.69423765", "0.6848241", "0.6838735", "0.6822029", "0.6809571", "0.67943746", "0.67882925", "0.6770948", "0.6717794", "0.67039", "0.6658083", "0.66418517", "0.6626555", "0.6622329", "0.6617372", "0.6611502", "0.6610576", "0.6597732", "0.65825504", "0.6581126", "0.6555211", "0.65468407", "0.6542123", "0.65252507", "0.6517727", "0.6507691", "0.64905554", "0.64726704", "0.6437558", "0.6430405", "0.64082193", "0.6401901", "0.63872874", "0.6369698", "0.6369698", "0.6369698", "0.63435125", "0.6338897", "0.6338897", "0.6337738", "0.6337738", "0.6319237", "0.63182557", "0.6315178", "0.6303656", "0.6299059", "0.6284383", "0.6279466", "0.6279466", "0.6272539", "0.62527037", "0.6248892", "0.6246933", "0.6245974", "0.62365055", "0.6224033", "0.6223504", "0.62221056", "0.6208154", "0.62077975", "0.6205193", "0.6204251", "0.61951965", "0.6189574", "0.61841524", "0.6161085", "0.6160888", "0.615009", "0.61474574", "0.61367947", "0.61284465", "0.61142594", "0.61123186", "0.61120474", "0.6109706", "0.6102636", "0.6099265", "0.60796255", "0.6074748", "0.6072294", "0.6058486", "0.6036841", "0.6020303", "0.60149753", "0.60112315", "0.60075974", "0.597968", "0.59661126", "0.5955631", "0.5952501", "0.5942188", "0.59373623" ]
0.6990566
7
Returns the current loggedin user (if any).
def current_user @current_user ||= User.find_by( id: session[:user] ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_user\n if session[:user_id]\n return User.find(session[:id])\n else\n return nil\n end\n end", "def current_user\n if session[:user_id]\n User.find(session[:user_id])\n else\n nil\n end\n end", "def current_user\n return unless session[:user_id]\n User.find(session[:user_id])\n end", "def get_current_user\n if session[:authenticated]\n return User.find_by_id(session[:user_id])\n end\n return nil\n end", "def getLoggedInUser\n if session[:user_id]\n return User.find(session[:user_id])\n else\n return nil\n end\n end", "def current_user\n if session[:user_id]\n User.find(session[:user_id])\n else\n end\n end", "def current_user\n User.get_user(session[:user_id]) if session[:user_id]\n end", "def current_user\n if session[:user_id]\n return @user ||= User.find(session[:user_id]['$oid'])\n else\n return nil\n end\n end", "def current_user\n\t\tif session[:user_id].present?\n\t\t\tUser.find(session[:user_id])\n\t\tend\n\tend", "def current_user\n if session[:user_id]\n user = User.find(session[:user_id])\n else\n nil\n end\n end", "def current_user\n if valid_session?\n User.find(session[:user_id])\n end\n end", "def get_current_user\n if @current_user\n return @current_user\n else\n @current_user = User.find_by(id: session[:user_id])\n end\n end", "def get_logged_in_user\n if logged_in?\n user = User.find(session[:current_user_id])\n if user\n return user\n else\n return nil\n end\n end\n \n #default return nil\n nil\n end", "def get_current_user\n @current_user ||= User.find(session[:user_id]) unless session[:user_id].blank?\n return @current_user\n end", "def current_user\n if session[:user_id]\n User.find_by(id: session[:user_id])\n end\n end", "def current_user\n User.find_by(uid: session[:user]) if logged_in?\n end", "def current_user(id = session[:user_id])\n User.get_one id\n end", "def current_user\n @current_user ||= User.find(session[:user_id]) if logged_in?\n end", "def current_user\n @current_user ||= User.find(session[:user_id]) if logged_in?\n end", "def current_user\n return @current_user if @current_user.present?\n\n if session[:uid]\n @current_user = User.from_session(session)\n end\n\n @current_user\n end", "def current_user\n if logged_in?\n return User.get(session['user'])\n end\n AnonymousUser.new\n end", "def get_current_user\n unless session[:user_id]\n @current_user = nil\n return\n end\n @current_user = User.first(:conditions => {:id => session[:user_id] })\n end", "def get_current_user\n unless session[:user_id].blank?\n @current_user = User.find(session[:user_id])\n else\n @current_user = nil\n end\n end", "def current_user\n\t\t\tUser.find(session[:user_id])\n\t\tend", "def current_user\n\t\t\tUser.find(session[:user_id])\n\t\tend", "def current_user\n @current_user if logged_in?\n end", "def current_user\n @current_user if logged_in?\n end", "def current_user\n\tif(session[:user_id])\n\t\t@u ||= User.first(id: session[:user_id])\n\t\treturn @u\n\telse\n\t\treturn nil\n\tend\nend", "def current_user\n\tif(session[:user_id])\n\t\t@u ||= User.first(id: session[:user_id])\n\t\treturn @u\n\telse\n\t\treturn nil\n\tend\nend", "def current_user\n\tif(session[:user_id])\n\t\t@u ||= User.first(id: session[:user_id])\n\t\treturn @u\n\telse\n\t\treturn nil\n\tend\nend", "def current_user\n\tif(session[:user_id])\n\t\t@u ||= User.first(id: session[:user_id])\n\t\treturn @u\n\telse\n\t\treturn nil\n\tend\nend", "def current_user\n if !session[:user_id] then nil else User.find(session[:user_id]) end\n end", "def current_user\n User.find(session[:user_id]) if session[:user_id]\n end", "def current_user\n User.find(session[:user_id]) if session[:user_id]\n end", "def get_current_user\n if session[:user_id]\n @current_user ||= User.find_by(id: session[\"user_id\"])\n end\n end", "def current_user\n user_id = get_log_in_session\n if user_id\n get_user(user_id)\n else\n user = get_user(cookies.signed['user_id'])\n if user&.authenticated?(:remember, cookies[:remember_token])\n set_log_in_session user\n user\n end\n end\n end", "def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n #return current user if @current_user already exists.\n #if there's no current user, return the user with ID == session user ID, if there is one.\n end", "def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n return @current_user\n end", "def current_user\n if !@current_user.nil?\n @current_user\n elsif !session[:current_user_id].nil?\n begin\n @current_user = User.find(session[:current_user_id])\n rescue ActiveRecord::RecordNotFound\n @current_user = nil\n end\n end\n end", "def current_user\n if Rails.application.config.use_omniauth\n return nil unless session[:user_info]\n @current_user ||= User.find_user_from_omniauth(session[:user_info])\n else\n @current_user ||= User.where(username: request.env['aker.check'].user.username).first\n end\n end", "def current_user\n return unless session[:user_id]\n @current_user ||= User.find(session[:user_id])\n end", "def current_user\n return unless session[:user_id]\n @current_user ||= User.find(session[:user_id])\n end", "def current_user\n return unless session[:user_id]\n @current_user ||= User.first(:id => session[:user_id])\n end", "def current_user\n begin\n unless @current_user.nil?\n return @current_user\n else\n if session[:user_id]\n return @current_user = User.find(session[:user_id])\n else\n return nil\n end\n end\n rescue\n return nil\n end\nend", "def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n #return current user or set to this if there isnt a current user\n end", "def current_user\n # User.find would throw an error if we cannot find the user\n User.find_by({ id: session[:user_id] })\n end", "def current_user\n\n sql = \"SELECT * FROM users WHERE id = $1;\"\n \n results = run_sql(sql, [session[:user_id]]) \n return results.first\n end", "def current_user\n\tif session[:user_id].present?\n\t\tUser.find(session[:user_id])\t\n\tend\nend", "def current_user\n return @current_user ||= User.find(session[:user_id]) unless session[:user_id].nil?\n end", "def current_user\n if @current_user.nil?\n @current_user = User.find_by(id: session[:user_id])\n else\n @current_user\n end\n end", "def current_user\n get_from_options_or_controller(:current_user)\n end", "def current_user\n begin \n User.find(session[:user_id])\n rescue ActiveRecord::RecordNotFound\n nil\n end\n end", "def current_user\n if user_signed_in?\n Session.active_sessions.find_by(id: request.headers['sid'], utoken: request.headers['utoken']).user\n else\n nil\n end\n end", "def current_user\n if user_signed_in?\n Session.active_sessions.find_by(id: request.headers['sid'], utoken: request.headers['utoken']).user\n else\n nil\n end\n end", "def current_user\n User.find_by(id: session[:user_id])\n end", "def current_user\n User.find_by(id: session[:user_id])\n end", "def current_user\n return nil unless session[:user_id]\n User.get(session[:user_id])\nend", "def current_user\r\n\tif(session[:user_id])\r\n\t\t@u ||= User.first(id: session[:user_id])\r\n\t\treturn @u\r\n\telse\r\n\t\treturn nil\r\n\tend\r\nend", "def current_user\n \t# If the session contains the user_id with non-nil, we have ID of some user\n \t# Return the user object for ID\n \t\n \t# Using instance variable helps limit calls\n \t# \"Or equals\" means \n \t\t# if nil, set it -- if not, return it\n \tif session[:user_id]\n \t@current_user ||= User.find(session[:user_id])\n end\n end", "def current_user\n logged_in? ? User.find_by_id(session[:user_id]) : nil\n end", "def find_current_user\n if is_logged_in?\n @current_user = User.find(session[:user_id])\n else\n @current_user = nil\n end\n end", "def current_user\n if logged_in?\n session[:user] = nil\n return temporary_logged_in_user ? temporary_logged_in_user :\n set_temporary_logged_in_user(cached_user)\n else\n session[:user] ||= create_new_user # if there wasn't one\n session[:user] = create_new_user unless session[:user].respond_to?(:stale?)\n session[:user] = create_new_user if session[:user].stale?\n return session[:user]\n end\n end", "def current_user\n return unless session[:user_id]\n @current_user ||= User.find_by_id(session[:user_id])\n end", "def current_user\n if session[:user_id].present?\n @current_user = User.find_by(uid: session[:user_id])\n # session.clear if @current_user.nil?\n return @current_user\n end\n end", "def current_user\n if session[:user_id]\n return User.find(session[:user_id])\n end\nend", "def current_user\n\t\t\tUser.find_by_id(session[:user_id])\n\t\tend", "def current_user\n if session[:user_id]\n @current_user ||= User.find(session[:user_id])\n end\n end", "def current_user\n if session[:user_id]\n @current_user ||= User.find(session[:user_id])\n end\n end", "def return_current_user\n @current_user ||= User.find(session[:id_of_current_user]) if session[:id_of_current_user]\n end", "def current_user\n if session[:user_id]\n @user = User.find(session[:user_id])\n end\n end", "def current_user\n if session[:user_id]\n @user = User.find(session[:user_id])\n end\n end", "def logged_in_user\n if (!logged_in?)\n return User.logged_out_user\n end\n #return nil if !logged_in?\n return session[\"app_user\"]\n end", "def current_user\n core_id = Origen::Users::User.current_user_id\n user = app_users.find { |user| user.core_id == core_id }\n user || User.new(core_id)\n end", "def current_user\n @user ||= User.find_by_id(session[:user_id])if logged_in?\n end", "def current_user\n load_session\n @current_user\n end", "def find_current_user\n user_id = session[:user_id]\n if user_id\n user = Marty::User.active.find(user_id) rescue nil\n else\n user = try_to_autologin\n end\n\n user\n end", "def current_user\n return nil unless session[:user_id]\n @current_user ||= User.find_by(id: session[:user_id])\n end", "def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n # return current user or set it to what is found in cookie, only if there is one to begin with\n end", "def current_user\n \t@current_user || User.find(session[:user_id]) if session[:user_id]\n end", "def current_user\n @current_user ||= begin\n if session[:user_id]\n user = User.where(id: session[:user_id])\n user[0] if user.any?\n end\n end\n # @current_user ||= User.find session[:user_id] if session[:user_id]\n end", "def current_user\n\n \tif session[:user_id].present?\n \t\tUser.find(session[:user_id])\n\n \tend\n\n end", "def current_user\n\tsession[:user_id] ? User.find(session[:user_id]) : nil\nend", "def current_user\n\tsession[:user_id] ? User.find(session[:user_id]) : nil\nend", "def current_user\n # retrieve from database on every request instead of\n # storing it as global variable when current_user=\n # is called to prevent user information becoming stale.\n @current_user ||= (session[:user_name] && User.find_by(user_name: session[:user_name])) || real_user\n end", "def current_user\n\t\tif !@current_user\n\t\t\t@current_user = User.find_by(id: session[:user_id])\n\t\tend\n\t\t@current_user\n\tend", "def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n end", "def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n end", "def current_user\n return unless session[:user_id]\n @current_user = User.find_by_id(session[:user_id])\n end", "def current_user\n @current_user ||= User.find(session[:user_id]) if user_signed_in?\n end", "def current_user\n\t\tUser.find_by(:id => session[:user_id])\n\tend", "def current_user\n User.find session[:user_id] if user_signed_in?\n end", "def authenticated_user\n if session[:user_id].nil?\n return nil\n else\n return User.find(session[:user_id])\n end\n end", "def current_user\n return @current_user if defined?(@current_user)\n @current_user = User.find_by_id(session[:user_id])\n end", "def current_user\n if session[:user_id]\n @current_user ||= User.find_by(id: session[:user_id])\n end\n end", "def current_user\n if session[:user_id]\n @current_user ||= User.find_by(id: session[:user_id])\n end\n end", "def current_user\n if session[:user_id]\n @current_user ||= User.find_by(id: session[:user_id])\n end\n end", "def current_user\n if session[:user_id]\n @current_user ||= User.find_by(id: session[:user_id])\n end\n end", "def current_user\n if session[:user_id]\n @current_user ||= User.find_by(id: session[:user_id])\n end\n end", "def current_user\n if session[:user_id]\n @current_user = User.find(session[:user_id])\n end\n end", "def current_user\n @user ||= User.find_by(id: session[:user_id]) if session[:user_id]\n end", "def current_user\n \n # Normally we would look in the session to see if there is a user_id \n # to figure out if the user is loggged in.\n # For demo purposes this app randomly picks if the user is logged in\n if rand(100) > 20 \n User.last\n else\n nil\n end\n end" ]
[ "0.85960984", "0.8593657", "0.855797", "0.8545853", "0.8534344", "0.8497545", "0.847914", "0.8460573", "0.8457271", "0.84556973", "0.84472865", "0.8442264", "0.8441092", "0.84366953", "0.8400402", "0.83765614", "0.8368829", "0.8337418", "0.8337418", "0.8314651", "0.8311652", "0.83023316", "0.8291481", "0.82835174", "0.82835174", "0.82822436", "0.82822436", "0.82777715", "0.82777715", "0.82777715", "0.82777715", "0.8276581", "0.8275023", "0.8275023", "0.8255083", "0.8249995", "0.82446975", "0.8239647", "0.8232271", "0.82151717", "0.82147837", "0.82147837", "0.82103586", "0.8191853", "0.8187335", "0.81870914", "0.818249", "0.8178561", "0.8178069", "0.8167405", "0.8166237", "0.8165827", "0.8164524", "0.8164524", "0.816404", "0.816404", "0.81622803", "0.8161969", "0.8160386", "0.8157338", "0.8153178", "0.81529313", "0.81492436", "0.8147794", "0.814727", "0.81466174", "0.8136481", "0.8136481", "0.8132164", "0.81201875", "0.81201875", "0.81199944", "0.8119824", "0.8116362", "0.8112842", "0.81102794", "0.81090635", "0.81087977", "0.81074595", "0.80979383", "0.8093762", "0.80920845", "0.80920845", "0.8090045", "0.8087256", "0.80838054", "0.80838054", "0.8081629", "0.80800456", "0.80800176", "0.80791426", "0.8078592", "0.8078462", "0.8078152", "0.8078152", "0.8078152", "0.8078152", "0.8078152", "0.8073231", "0.807296", "0.8071747" ]
0.0
-1
new_var = nil board.array.each do |item| if item.coord == start_position && item.piece_status.piece_name == piece if item.piece_status.validate start_position, end_position puts "This is a valid move" new_var = item.piece_status item.piece_status = nil end end end board.array.each do |item| if item.coord == end_position if item.piece_status == nil item.piece_status = new_var end end end board.display end bishop > 5,0; 2,0
def bishop_check(board, current, destination) tx = 0 ty = 0 ob = 0 temp = nil if current[0] < destination[0] && current[1] < destination[1] tx = current[0] + 1 ty = current[1] + 1 array_to_check = [tx, ty] while tx <= destination[0] && ty <= destination[1] board.array.each do |item| puts 'k' if item.coord == array_to_check if item.coord == array_to_check unless item.piece_status.nil? puts'gudda kathalu 2' ob = 1 return false end end tx += 1 ty += 1 end next unless ob == 0 end board.array.each do |item| if item.coord == current temp = item.piece_status item.piece_status = nil end item.piece_status = temp if item.coord == destination end elsif current[0] > destination[0] && current[1] < destination[1] tx = current[0] - 1 ty = current[1] + 1 array_to_check = [tx, ty] while tx >= destination[0] && ty <= destination[1] board.array.each do |item| puts 'k' if item.coord == array_to_check if item.coord == array_to_check unless item.piece_status.nil? puts'gudda kathalu 2' ob = 1 return false end end tx -= 1 ty += 1 end next unless ob == 0 end board.array.each do |item| if item.coord == current temp = item.piece_status item.piece_status = nil end item.piece_status = temp if item.coord == destination end elsif current[0] < destination[0] && current[1] > destination[1] tx = current[0] + 1 ty = current[1] - 1 array_to_check = [tx, ty] while tx <= destination[0] && ty >= destination[1] board.array.each do |item| puts 'k' if item.coord == array_to_check if item.coord == array_to_check unless item.piece_status.nil? puts'gudda kathalu 2' ob = 1 return false end end tx += 1 ty -= 1 end next unless ob == 0 end board.array.each do |item| if item.coord == current temp = item.piece_status item.piece_status = nil end item.piece_status = temp if item.coord == destination end elsif current[0] > destination[0] && current[1] > destination[1] tx = current[0] - 1 ty = current[1] - 1 array_to_check = [tx, ty] while tx <= destination[0] && ty >= destination[1] board.array.each do |item| puts 'k' if item.coord == array_to_check if item.coord == array_to_check unless item.piece_status.nil? puts'gudda kathalu 2' ob = 1 return false end end tx -= 1 ty -= 1 end next unless ob == 0 end board.array.each do |item| if item.coord == current temp = item.piece_status item.piece_status = nil end item.piece_status = temp if item.coord == destination end end board end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normal_moves\n direction = NORMAL_MOVES[self.color]\n \n [check_validity(direction)]\n \n if pos_valid \n item_at_pos = @board.get_piece(current_row,current_col)\n \n if item_at_pos.nil? || item_at_pos.color != self.color\n [current_row, current_col]\n end\n end\n \nend", "def move_piece(move, color) \n squares = find_start_and_end(move) # [start, end]\n\n return false if @display[squares[0][0]][squares[0][1]].guest == ' '\n\n start_piece = @display[squares[0][0]][squares[0][1]].guest\n\n return false if start_piece.color != color \n\n moves = get_legal_moves(squares[0], start_piece, start_piece.poss_moves(squares[0]))\n\n\n if moves.include?(squares[1])\n\n # castling\n if start_piece.id == 'king' && start_piece.color == 'white' && squares[1] == [7, 1] \n make_move(squares[0], squares[1], start_piece)\n make_move([7, 0], [7, 2], @display[0][0].guest)\n elsif start_piece.id == 'king' && start_piece.color == 'black' && squares[1] == []\n make_move(squares[0], squares[1], start_piece)\n make_move([0, 0], [0, 2], @display[7][0].guest)\n\n # pawn -> queen upgrade\n elsif start_piece.id == 'pawn' && start_piece.color == 'white' && squares[1][0].zero?\n make_move(squares[0], squares[1], Queen.new('white'))\n elsif start_piece.id == 'pawn' && start_piece.color == 'black' && squares[1][0] == 7\n make_move(squares[0], squares[1], Queen.new('black'))\n\n else\n make_move(squares[0], squares[1], start_piece)\n end\n else\n false\n end\n end", "def movement(row1, col1, board)\n\n possible_moves=Array.new\n if @color==\"white\"\n # checking square in front\n if row1+1<8 && board.get_square(row1+1,col1).occupied==false\n possible_moves <<[row1+1,col1]\n\n #checking 2 squares forward\n if @position==\"initial\" && !board.get_square(row1+2,col1).occupied\n possible_moves <<[row1+2,col1]\n end\n end\n\n # checking attacking squares\n if row1+1<8 && col1-1>=0\n atk_sq1 = board.get_square(row1+1,col1-1)\n\n if atk_sq1.occupied && atk_sq1.piece.color != @color || !atk_sq1.occupied && atk_sq1.en_passanted\n possible_moves <<[row1+1,col1-1]\n end\n end\n if row1+1<8 && col1+1<8\n atk_sq2 = board.get_square(row1+1,col1+1)\n if atk_sq2.occupied && atk_sq2.piece.color != @color || !atk_sq2.occupied && atk_sq2.en_passanted\n possible_moves <<[row1+1,col1+1]\n end\n end\n\n elsif @color==\"black\"\n # checking square in front\n if row1-1>=0 && board.get_square(row1-1,col1).occupied==false\n possible_moves <<[row1-1,col1]\n\n # checking for 2 squares forward\n if @position==\"initial\" && board.get_square(row1-2,col1).occupied==false\n possible_moves <<[row1-2,col1]\n end\n end\n\n # checking attacking squares\n if row1-1>=0 && col1-1>=0\n atk_sq1 = board.get_square(row1-1,col1-1)\n if (atk_sq1.occupied && atk_sq1.piece.color != @color) || (!atk_sq1.occupied && atk_sq1.en_passanted)\n possible_moves <<[row1-1,col1-1]\n end\n end\n if row1-1>=0 && col1+1<8\n atk_sq2 = board.get_square(row1-1,col1+1)\n if (atk_sq2.occupied && atk_sq2.piece.color != @color) || (!atk_sq2.occupied && atk_sq2.en_passanted)\n possible_moves <<[row1-1,col1+1]\n end\n end\n end\n\n #removing moves that go off the board\n possible_moves = possible_moves.select do |a|\n a[0]>=0 && a[0]<8 && a[1]>=0 && a[1]<8\n end\n\n return possible_moves\n\n end", "def obstructed?(current_pos,other_pos,board)\n # debugger\n tester = other_pos\n # puts tester\n # sleep 2\n\n #\n # (-1..1).each do |i|\n # (-1..1).each do |j|\n\n\n if other_pos[0] > current_pos[0] #New position is below us\n if other_pos[1] > current_pos[1] #new position is on our right--bishop move\n tester[0] -= 1\n tester[1] -= 1\n until tester == current_pos\n # puts board.grid[tester[0]][tester[1]]\n # puts !board.grid[tester[0]][tester[1]].is_a?(Nul_piece)\n # sleep 2\n return false if !board.grid[tester[0]][tester[1]].is_a?(Nul_piece)\n # return false if the piece at tester is not a nul piece\n tester[0] -= 1\n tester[1] -= 1\n end\n\n elsif other_pos[1] < current_pos[1] #new position on our left\n until tester == current_pos\n tester[0] -= 1\n tester[1] += 1\n return false if !board.grid[tester[0]][tester[1]].is_a?(Nul_piece)\n end\n elsif other_pos[1] == current_pos[1] #new position is on our level horizontally\n until tester == current_pos\n tester[1] -= 1\n return false if !board.grid[tester[0]][tester[1]].is_a?(Nul_piece)\n end\n end\n\n elsif other_pos[0] < current_pos[0] #New position is above us\n if other_pos[1] > current_pos[1] #new position is on our right\n until tester == current_pos\n tester[0] += 1\n tester[1] -= 1\n return false if !board.grid[tester[0]][tester[1]].is_a?(Nul_piece)\n end\n\n elsif other_pos[1] < current_pos[1] #new position on our left\n until tester == current_pos\n tester[0] += 1\n tester[1] += 1\n return false if !board.grid[tester[0]][tester[1]].is_a?(Nul_piece)\n end\n\n else #new position is on our level horizontally\n until tester == current_pos\n tester[0] += 1\n return false if !board.grid[tester[0]][tester[1]].is_a?(Nul_piece)\n end\n end\n\n else #new position is at our level vertically\n if other_pos[1] > current_pos[1] #new position is on our right\n until tester == current_pos\n tester[1] -= 1\n return false if !board.grid[tester[0]][tester[1]].is_a?(Nul_piece)\n end\n\n elsif other_pos[1] < current_pos[1] #new position on our left\n until tester == current_pos\n tester[1] += 1\n return false if !board.grid[tester[0]][tester[1]].is_a?(Nul_piece)\n end\n\n end\n end\n\n return false if board.grid[other_pos[0]][other_pos[1]].color == self.color\n # puts \"hello\"\n # sleep(2)\n true\n\n end", "def determine_moves(loc)\n\n piece = @spaces[loc]\n\n moveset = []\n attackset = []\n new_moves = []\n\n x = loc[0]\n y = loc[1]\n\n enemy_king_checked = false\n\n\n case piece.type\n\n when \"pawn\"\n\n if piece.color == \"white\"\n\n new_moves << [x, y+1]\n new_moves << [x,y+2] if y == 1\n\n if @spaces[new_moves[0]].nil?\n\n moveset << new_moves[0]\n moveset << new_moves[1] if y == 1\n\n end\n\n atk_moves = [[x+1, y+1], [x-1, y+1]]\n atk_moves.each do |move|\n attackset << move if @spaces[move].nil?.! and @spaces[move].color == \"black\"\n if @spaces[move].nil?.!\n enemy_king_checked = true if @spaces[move].color == \"black\" and @spaces[move].type == \"king\"\n end\n end\n \n\n elsif piece.color == \"black\"\n\n new_moves = [[x, y-1]]\n new_moves << [x,y-2] if y == 6\n\n if @spaces[new_moves[0]].nil?\n\n moveset << new_moves[0]\n moveset << new_moves[1] if loc[1] == 6\n\n end\n\n atk_moves = [[x+1, y-1], [x-1, y-1]]\n atk_moves.each do |move|\n attackset << move if @spaces[move].nil?.! and @spaces[move].color == \"white\"\n if @spaces[move].nil?.!\n enemy_king_checked = true if @spaces[move].color == \"white\" and @spaces[move].type == \"king\"\n end\n end\n end\n\n @spaces[loc].moveset = moveset\n @spaces[loc].attackset = attackset\n \n\n when \"rook\"\n\n runner(loc, :north)\n runner(loc, :east)\n runner(loc, :south)\n runner(loc, :west)\n\n when \"knight\"\n\n possible_directions =\n [ [x+1, y+2],\n [x+1, y-2],\n [x-1, y+2],\n [x-1, y-2],\n [x+2, y+1],\n [x+2, y-1],\n [x-2, y+1],\n [x-2, y-1] ]\n\n moveset = possible_directions.select do |d|\n (d[0].between?(0,7) & d[1].between?(0,7)) and @spaces[d].nil?\n end\n\n attackset = possible_directions.select do |d|\n (d[0].between?(0,7) & d[1].between?(0,7)) and (@spaces[d].nil?.! and @spaces[d].color != @spaces[loc].color)\n end\n\n @spaces[loc].moveset = moveset\n @spaces[loc].attackset = attackset\n\n\n when \"bishop\"\n\n runner(loc, :northeast)\n runner(loc, :southeast)\n runner(loc, :northwest)\n runner(loc, :southwest)\n\n\n when \"queen\"\n\n runner(loc, :north)\n runner(loc, :northeast)\n runner(loc, :east)\n runner(loc, :southeast)\n runner(loc, :south)\n runner(loc, :southwest)\n runner(loc, :west)\n runner(loc, :northwest)\n\n\n when \"king\"\n\n runner(loc, :north, 1)\n runner(loc, :northeast, 1)\n runner(loc, :east, 1)\n runner(loc, :southeast, 1)\n runner(loc, :south, 1)\n runner(loc, :southwest, 1)\n runner(loc, :west, 1)\n runner(loc, :northwest, 1)\n\n end\n\n\n end", "def valid_moves(board, current_pos)\n array_of_moves = moves(current_pos)\n\n array_of_moves.delete_if {|pair| pair.min < 0 || pair.max > 7}\n array_of_moves.delete_if {|pair| pair == current_pos}\n\n # array_of_moves = array_of_moves.select {|pos| obstructed?(current_pos,pos,board)} if slider\n #\n # puts array_of_moves\n # sleep 2\n\n end", "def get_moves_2(piece, board)\n valid_col = case piece.name\n when ?A then 3\n when ?B then 5\n when ?C then 7\n when ?D then 9\n else 11\n end\n moves = []\n\n # If in hallway\n if piece.row == 1\n cols = valid_col < piece.col ? (valid_col...piece.col).to_a : (piece.col+1..valid_col).to_a\n if cols.count{|c| board[[1, c]] == ?.} == cols.length\n if board[[2, valid_col]] == ?. && board[[3, valid_col]] == piece.name && board[[4, valid_col]] == piece.name && board[[5, valid_col]] == piece.name\n moves << [[2, valid_col], (cols.count + 1) * piece.cost]\n elsif board[[2, valid_col]] == ?. && board[[3, valid_col]] == ?. && board[[4, valid_col]] == piece.name && board[[5, valid_col]] == piece.name\n moves << [[3, valid_col], (cols.count + 2) * piece.cost]\n elsif board[[2, valid_col]] == ?. && board[[3, valid_col]] == ?. && board[[4, valid_col]] == ?. && board[[5, valid_col]] == piece.name\n moves << [[4, valid_col], (cols.count + 3) * piece.cost]\n elsif board[[2, valid_col]] == ?. && board[[3, valid_col]] == ?. && board[[4, valid_col]] == ?. && board[[5, valid_col]] == ?.\n moves << [[5, valid_col], (cols.count + 4) * piece.cost]\n end\n end\n # If right column and something is underneath and nothing above\n # If in wrong column completely and nothing above\n elsif piece.row >= 2\n below = (piece.row+1..5).to_a\n above = (2..piece.row-1).to_a\n if ((piece.col == valid_col && below.count{|c| board[[c, piece.col]] != piece.name} != 0 && below.length != 0) || (piece.col != valid_col)) && (above.count{|c| board[[c, piece.col]] == ?.} == above.length)\n 2.times do |t|\n dir = t == 0 ? -1 : 1\n curr = piece.col\n steps = 1 + above.length\n while board[[1, curr]] == ?.\n moves << [[1, curr], steps * piece.cost] if ![3, 5, 7, 9].include?(curr)\n steps += 1\n curr += dir\n end\n end\n end\n end\n moves\nend", "def test_move(piece, piece_initial_position, piece_movement, movement, color)\n result = true\n move(piece_initial_position, movement)\n result = false unless check?(color)\n move(movement, piece_initial_position, piece_movement)\n board[piece_initial_position[0]][piece_initial_position[1]].n = 1 if piece.n == 1\n result\n end", "def get_moves(piece, board)\n valid_col = case piece.name\n when ?A then 3\n when ?B then 5\n when ?C then 7\n when ?D then 9\n else 11\n end\n moves = []\n\n # If in hallway\n if piece.row == 1\n cols = valid_col < piece.col ? (valid_col...piece.col).to_a : (piece.col+1..valid_col).to_a\n if cols.count{|c| board[[1, c]] == ?.} == cols.length\n if board[[2, valid_col]] == ?.\n if board[[3, valid_col]] == ?.\n moves << [[3, valid_col], (cols.count + 2) * piece.cost]\n elsif board[[3, valid_col]] == piece.name\n moves << [[2, valid_col], (cols.count + 1) * piece.cost]\n end\n end\n end\n # If not in its column (can never stand in hallway anf column at same time)\n elsif (piece.col == valid_col && piece.row == 2 && board[[piece.row + 1, piece.col]] != piece.name) || (piece.col != valid_col && piece.row == 2)\n 2.times do |t|\n dir = t == 0 ? -1 : 1\n curr = piece.col\n steps = 1\n while board[[1, curr]] == ?.\n moves << [[1, curr], steps * piece.cost] if ![3, 5, 7, 9].include?(curr)\n steps += 1\n curr += dir\n end\n end\n elsif piece.row == 3 && piece.col != valid_col && board[[2, piece.col]] == ?.\n 2.times do |t|\n dir = t == 0 ? -1 : 1\n curr = piece.col\n steps = 2\n while board[[1, curr]] == ?.\n moves << [[1, curr], steps * piece.cost] if ![3, 5, 7, 9].include?(curr)\n steps += 1\n curr += dir\n end\n end\n end\n moves\nend", "def move_piece(move)\n curr_piece = @board[move[0]]\n if curr_piece.non_check_moves.include?(move[1])\n #if en passant, remove captured piece\n if curr_piece.class == Pawn\n #puts curr_piece.can_en_passant?\n #puts \"HELKFDSJLFKD\"\n if curr_piece.can_en_passant?\n #puts \"HOMFDMSKFDFLSJFKDSLFJSDKLF JDSFKLSJFKLEJ FE FJSKLF\"\n rank = move[0][0]\n col = move[1][1]\n captured_pawn_pos = [rank,col]\n #puts captured_pawn_pos.inspect\n @board[captured_pawn_pos] = nil\n end\n end\n @board[move[1]] = curr_piece\n @board[move[0]] = nil\n curr_piece.move_history << move\n curr_piece.pos = move[1]\n #if castling, move rook too\n if curr_piece.class == King && (move[0][1] - move[1][1]).abs == 2\n #find the appropriate rook to move\n start_rank = move[0][0]\n start_file = move[1][1] == 2 ? 0 : 7\n start_pos = [start_rank, start_file]\n rook = @board[start_pos]\n #determine its final location, then move it.\n end_file = start_file == 0 ? 3 : 5\n end_pos = [start_rank, end_file]\n @board[end_pos] = rook\n @board[start_pos] = nil\n rook.move_history << end_pos\n rook.pos = end_pos\n end\n return true\n else\n puts \"Your king is still in check!\" if @board.in_check?(curr_piece.color)\n puts \"Not a legal move for this #{curr_piece.color} #{curr_piece.class}!\"\n puts\n return false\n end\n end", "def check_blocking_pieces(positions) # works fucking brilliantly love it and testing in pry is so fucking great fucking love your workflow\n positions.each_with_index do |move, index| # omg this is using each perfectly, because if it doesn't return inside this helper method it'll just return what was passed to it as is that's what .each is good for - either doing some random action for each enumeration or even more ideally just returning a different value if something inside is different or returning the whole thing if not fucking incredible\n piece = @board.grid[move[0]][move[1]]\n if !piece.is_a?(NullPiece) # only get the moves before the first blocking piece is found, immediately return once/if a non NullPiece is found in the path # if the current position is not a null piece, then return this with a truncated version of the array\n piece.color == self.color ? (return positions.slice(0...index)) : (return positions.slice(0..index)) # check if the piece is of the same color or not - if it is of the same color, then don't include it in possible moves, if not of the same color, include it in the possible moves since you can capture it. Normally you use @color vs self.color but in this case it does seem to be more readable and make more sense to run self.color since you already have an attr_getter for it why not. And perfect use case for a protected method if you didn't need the color anywhere else let's see :) you might not let's do it just because protected methods are so cool # GOD THIS SHIT WORKS SO FUCKING GOOD AHHHHHHH\n end\n end\nend", "def valid_squares(move_array, piece)\n new_move_array = []\n move_array.each do |direction_array|\n # check coords on board\n direction_array.select! { |coord| (coord[0].between?(0, 7) && coord[1].between?(0, 7)) }\n # valid moves blocked by pieces and add valid attack squares\n direction_array.each do |move_square|\n square = @board_obj.board[move_square[0]][move_square[1]]\n\n if piece.instance_of?(Pawn)\n # case for pawn side takes\n if piece.position[1] != move_square[1]\n if square != \" \"\n new_move_array << move_square if square.colour != piece.colour\n elsif enpassant_square(move_square)\n new_move_array << move_square\n end\n break\n # case if piece in way \n elsif square != \" \"\n break\n end\n\n elsif square != \" \"\n new_move_array << move_square if square.colour != piece.colour\n break\n end\n new_move_array << move_square\n end\n end\n new_move_array\n end", "def move_piece(position_array)\n\n old_position = position_array[0]\n piece_to_move = board_obj.board[old_position[0]][old_position[1]]\n\n castling_move(position_array) if piece_to_move.instance_of?(King)\n pawn_move_two(position_array) if piece_to_move.instance_of?(Pawn)\n\n board_obj.board[old_position[0]][old_position[1]] = \" \"\n\n new_position = position_array[1]\n\n piece_to_move.new_position(new_position)\n new_square = board_obj.board[new_position[0]][new_position[1]]\n\n if enpassant_square(new_position)\n rank = new_position[0]\n file = new_position[1]\n\n adjust = piece_to_move.colour == 'WHITE' ? -1 : 1\n if board_obj.board[rank + adjust][file].instance_of?(Pawn)\n remove_piece(board_obj.board[rank+adjust][file])\n board_obj.board[rank + adjust][file] = ' '\n end\n\n end\n\n if new_square != \" \"\n remove_piece(new_square)\n @piece_taken = true\n else\n @piece_taken = false\n end\n\n board_obj.board[new_position[0]][new_position[1]] = piece_to_move\n end", "def move() \n if @used[0][1] == 0 \n @index_start1 = 0\n @index_start2 = 1\n boardSolver1st()\n elsif @used[0][2] == 0\n @index_start1 = 0\n @index_start2 = 2\n boardSolver1st()\n elsif @used[0][3] == 0\n @index_start1 = 0\n @index_start2 = 3\n boardSolver1st()\n elsif @used[0][4] == 0\n @index_start1 = 0\n @index_start2 = 4\n boardSolver1st()\n elsif @used[1][0] == 0\n @index_start1 = 1\n @index_start2 = 0\n boardSolver1st()\n elsif @used[1][1] == 0\n @index_start1 = 1\n @index_start2 = 1\n boardSolver1st()\n elsif @used[1][2] == 0\n @index_start1 = 1\n @index_start2 = 2\n boardSolver1st()\n elsif @used[1][3] == 0\n @index_start1 = 1\n @index_start2 = 3\n boardSolver1st()\n elsif @used[2][0] == 0\n @index_start1 = 2\n @index_start2 = 0\n boardSolver1st()\n elsif @used[2][1] == 0\n @index_start1 = 2\n @index_start2 = 1\n boardSolver1st()\n elsif @used[2][2] == 0\n @index_start1 = 2\n @index_start2 = 2\n boardSolver1st()\n elsif @used[2][3] == 0\n @index_start1 = 2\n @index_start2 = 3\n boardSolver1st()\n elsif @used[3][1] == 0\n @index_start1 = 3\n @index_start2 = 1\n boardSolver1st()\n elsif @used[3][2] == 0\n @index_start1 = 3\n @index_start2 = 2\n boardSolver1st()\n elsif @used[3][3] == 0\n @index_start1 = 3\n @index_start2 = 3\n boardSolver1st()\n else \n puts words()\n puts \"There are #{words().length} words! Play again\"\n end\n\nend", "def setup_board\n (1..64).each do |location|\n @@piece_locations[location] = {\"type\" => \" \", \"number\" => nil, \"color\" => nil}\n end\n\n # Black Pieces\n @@piece_locations[1] = {\"type\" => \"rook\", \"number\" => 1, \"color\" => \"black\", \"moved\" => false}\n @@piece_locations[2] = {\"type\" => \"knight\", \"number\" => 1, \"color\" => \"black\", \"moved\" => false}\n @@piece_locations[3] = {\"type\" => \"bishop\", \"number\" => 1, \"color\" => \"black\", \"moved\" => false}\n @@piece_locations[4] = {\"type\" => \"queen\", \"number\" => 1, \"color\" => \"black\", \"moved\" => false}\n @@piece_locations[5] = {\"type\" => \"king\", \"number\" => 1, \"color\" => \"black\", \"moved\" => false}\n @@piece_locations[6] = {\"type\" => \"bishop\", \"number\" => 2, \"color\" => \"black\", \"moved\" => false}\n @@piece_locations[7] = {\"type\" => \"knight\", \"number\" => 2, \"color\" => \"black\", \"moved\" => false}\n @@piece_locations[8] = {\"type\" => \"rook\", \"number\" => 2, \"color\" => \"black\", \"moved\" => false}\n (1..8).each do |col|\n @@piece_locations[col + 8] = {\"type\" => \"pawn\", \"number\" => col, \"color\" => \"black\", \"moved\" => false}\n end\n\n # White Pieces\n @@piece_locations[57] = {\"type\" => \"rook\", \"number\" => 1, \"color\" => \"red\", \"moved\" => false}\n @@piece_locations[58] = {\"type\" => \"knight\", \"number\" => 1, \"color\" => \"red\", \"moved\" => false}\n @@piece_locations[59] = {\"type\" => \"bishop\", \"number\" => 1, \"color\" => \"red\", \"moved\" => false}\n @@piece_locations[60] = {\"type\" => \"queen\", \"number\" => 1, \"color\" => \"red\", \"moved\" => false}\n @@piece_locations[61] = {\"type\" => \"king\", \"number\" => 1, \"color\" => \"red\", \"moved\" => false}\n @@piece_locations[62] = {\"type\" => \"bishop\", \"number\" => 2, \"color\" => \"red\", \"moved\" => false}\n @@piece_locations[63] = {\"type\" => \"knight\", \"number\" => 2, \"color\" => \"red\", \"moved\" => false}\n @@piece_locations[64] = {\"type\" => \"rook\", \"number\" => 2, \"color\" => \"red\", \"moved\" => false}\n (1..8).each do |col|\n @@piece_locations[col + 48] = {\"type\" => \"pawn\", \"number\" => col, \"color\" => \"red\", \"moved\" => false}\n end\n end", "def move(board)\n\n # Check if each index in the top_row_win array contains an \"X\"\n if board[WIN_COMBINATIONS[0][0]] == \"X\" && board[WIN_COMBINATIONS[0][1]] == \"X\" && board[WIN_COMBINATIONS[0][2]] == \"X\"\n puts \"X won in the top row\"\n end\n=begin\n elsif board[top_row_win[3]] == \"X\" && board[top_row_win[4]] == \"X\" && board[top_row_win[5]] == \"X\"\n puts \"X won in the center row\"\n elsif board[top_row_win[6]] == \"X\" && board[top_row_win[7]] == \"X\" && board[top_row_win[8]] == \"X\"\n puts \"X won in the bottom row\"\n elsif board[top_row_win[0]] == \"X\" && board[top_row_win[4]] == \"X\" && board[top_row_win[8]] == \"X\"\n puts \"X won in the left down diagonally row\"\n elsif board[top_row_win[2]] == \"X\" && board[top_row_win[4]] == \"X\" && board[top_row_win[6]] == \"X\"\n puts \"X won in the right down diagonally row\"\n elsif board[top_row_win[0]] == \"X\" && board[top_row_win[3]] == \"X\" && board[top_row_win[6]] == \"X\"\n puts \"X won in the left straight down row\"\n elsif board[top_row_win[2]] == \"X\" && board[top_row_win[5]] == \"X\" && board[top_row_win[8]] == \"X\"\n puts \"X won in the right straight down row\"\n elsif board[top_row_win[1]] == \"X\" && board[top_row_win[4]] == \"X\" && board[top_row_win[7]] == \"X\"\n puts \"X won in the center down\"\n end\n=end\nend", "def valid_move?(arr)\n arr[0] >= 0 && arr[0] <= 7 && arr[1] >= 0 && arr[1] <= 7 && @board[arr[0]][arr[1]][:piece].nil?\n end", "def moving_into_check(piece, valid_moves)\n valid_not_in_check = []\n old_position = piece.position\n\n # for each possible move, try it and test if in check, if so need to delete\n valid_moves.each do |test_position|\n move_piece([old_position, test_position])\n change_player\n if opponent_in_check(player.colour)\n valid_not_in_check.delete(test_position)\n undo_opponent_check(player.colour)\n else\n valid_not_in_check << test_position\n end\n change_player\n undo_move(test_position)\n end\n valid_not_in_check\n end", "def reset_board_variables\r\n @color_on_turn = :white\r\n @pieces = {:white => [], :black => []} \r\n @last_moved_item = BoardInfoItem.new(0,0)\r\n @infosquare.each do |row_square|\r\n row_square.each do |cell|\r\n cell.clear\r\n end\r\n end\r\n #p @infosquare\r\n end", "def get_moves(pieces)\n\t\tarrPos = [] \n\t\tif team == 1\n\t\t\tarrPos << [@xCord, @yCord + 1] if square_is_open?(pieces, [@xCord, @yCord + 1])\n\t\t\tarrPos << [@xCord, @yCord + 2] if @yCord == 1 && square_is_open?(pieces, [@xCord, @yCord + 2])\n\t\telsif team == 2\n\t\t\tarrPos << [@xCord, @yCord - 1] if square_is_open?(pieces, [@xCord, @yCord - 1])\n\t\t\tarrPos << [@xCord, @yCord - 2] if @yCord == 6 && square_is_open?(pieces, [@xCord, @yCord - 2])\n\t\tend\n\t\tarrPos\n\tend", "def move_castling(short, color)\n\n if short\n if color == 'black'\n board[0][5].piece, board[0][6].piece = board[0][7].piece, board[0][4].piece\n board[0][7].piece, board[0][4].piece = nil, nil\n board[0][5].piece.position, board[0][6].piece.position = [0,5], [0,6]\n update_possible_movement_all_pieces()\n turns[board[0][5].piece.COLOR.to_sym] += 1\n board[0][5].piece.number_of_move += 1 if board[0][5].piece.instance_of?(Rook)\n board[0][6].piece.number_of_move += 1 if board[0][6].piece.instance_of?(King)\n \n return board[0][5].piece\n else\n board[7][5].piece, board[7][6].piece = board[7][7].piece, board[7][4].piece\n board[7][7].piece, board[7][4].piece = nil, nil\n board[7][5].piece.position, board[7][6].piece.position = [7,5], [7,6]\n update_possible_movement_all_pieces()\n turns[board[7][5].piece.COLOR.to_sym] += 1\n board[7][5].piece.number_of_move += 1 if board[7][5].piece.instance_of?(Rook)\n board[7][6].piece.number_of_move += 1 if board[7][6].piece.instance_of?(King)\n \n return board[7][5].piece\n end\n else\n if color == 'black'\n board[0][3].piece, board[0][2].piece = board[0][0].piece, board[0][4].piece\n board[0][0].piece, board[0][4].piece = nil, nil\n board[0][3].piece.position, board[0][2].piece.position = [0,3], [0,2]\n update_possible_movement_all_pieces()\n\n turns[board[0][3].piece.COLOR.to_sym] += 1\n board[0][3].piece.number_of_move += 1 if board[0][3].piece.instance_of?(Rook)\n board[0][2].piece.number_of_move += 1 if board[0][2].piece.instance_of?(King)\n\n return board[0][3].piece\n else\n board[7][3].piece, board[7][2].piece = board[7][0].piece, board[7][4].piece\n board[7][0].piece, board[7][4].piece = nil, nil\n board[7][3].piece.position, board[7][2].piece.position = [7,3], [7,2]\n update_possible_movement_all_pieces()\n \n turns[board[7][3].piece.COLOR.to_sym] += 1\n board[7][3].piece.number_of_move += 1 if board[7][3].piece.instance_of?(Rook)\n board[7][2].piece.number_of_move += 1 if board[7][2].piece.instance_of?(King)\n\n return board[7][3].piece\n end\n end\n\n end", "def piece_sensing\n # iterate through each piece on the board\n board.each do |origin_piece|\n\n # Only consider origin pieces which exist\n if !!origin_piece\n\n # clear the piece's sensing data before populating\n origin_piece.clear_possible_moves\n origin_piece.clear_pieces_in_range\n\n # iterate through each potential direction of movement\n origin_piece.controlled_squares.each do |direction_of_movement|\n\n # iterate through coordinates moving away from the piece\n direction_of_movement.each do |test_coords|\n if ( test_coords &&\n board.in_bounds?(test_coords[0],test_coords[1]) )\n\n # set row and column variables for convenience and clarity\n test_row = test_coords[0]\n test_col = test_coords[1]\n\n # Call the possible move detection method\n if possible_move?(origin_piece,test_row,test_col)\n move_string = indices_to_chess_coords(test_row,test_col)\n origin_piece.add_possible_move(move_string)\n end\n\n # Call the piece detection method and break if it succeeds;\n # Once a piece is found, no more moves in that direction are valid\n if piece_in_range?(origin_piece, test_row, test_col)\n # The string to add to pieces in range\n piece_string = find_piece_string(test_row,test_col)\n\n # Add the piece to the origin_pieces pieces in range\n origin_piece.add_piece_in_range(piece_string)\n break\n end\n end\n end\n end\n end\n end\n check_for_check(current_player)\n end", "def valid_move?(board, index)\n def position_taken?(array, indx)\n if array[indx] == \" \" || array[indx] == \"\" || array[indx] == nil\n return false\n else\n return true\n end\n end\ndef on_board?(place)\n if place.between?(0,8) == true\n return true\n else\n return false\n end\nend\nif position_taken?(board,index) == false && on_board?(index) == true\n return true\nelse\n return false\nend\nend", "def take_moves(pieces)\n\t\tarrPos = []\n\t\tif team == 1\n\t\t\tarrPos << [@xCord - 1, @yCord + 1] if square_taken_opponent?(pieces, [@xCord - 1, @yCord + 1])\n\t\t\tarrPos << [@xCord + 1, @yCord + 1] if square_taken_opponent?(pieces, [@xCord + 1, @yCord + 1])\n\t\telsif team == 2\n\t\t\tarrPos << [@xCord - 1, @yCord - 1] if square_taken_opponent?(pieces, [@xCord - 1, @yCord - 1])\n\t\t\tarrPos << [@xCord + 1, @yCord - 1] if square_taken_opponent?(pieces, [@xCord + 1, @yCord - 1])\n\t\tend\n\t\tarrPos\t\n\tend", "def white_moves(pieces)\n board = Chess_board.new.squares\n piece_positions = pieces.map { |piece| piece.position }\n row = @position[0]\n column = @position[1]\n \n all_checked = []\n [[row + 1,column - 1],[row + 1,column + 1]].each do |square| \n if piece_positions.include?(square)\n occupying_piece = pieces.find { |piece| piece.position == square }\n all_checked.push(square) if occupying_piece.color != @color\n end\n end\n if !piece_positions.include?([row + 1, column])\n all_checked.push([row + 1, column])\n all_checked.push([row + 2, column]) if !piece_positions.include?([row + 2, column]) && @moves == 0\n end\n all_checked\n end", "def reset_board_variables\n @color_on_turn = :white\n @fifty_counter = 0\n @pieces = {:white => [], :black => []} \n @last_moved_item = BoardInfoItem.new(0,0)\n @infosquare.each do |row_square|\n row_square.each do |cell|\n cell.clear\n end\n end\n #p @infosquare\n end", "def output_moves(piece_type, location, moves)\n #setting up location coordinates\n location_coords = location.split(//)\n x = location_coords[0].ord - 96\n y = location_coords[1].to_i\n\n if x < 1 || y < 1 || y > 8 || x > 8 || location.length!=2\n puts 'please provide a valid location for the piece'\n exit\n end\n\n#calculating possible moves of rook\n all_possible_moves = moves[piece_type].flat_map do |move|\n (1..move[:steps]).collect do |step|\n new_x = x + (move[:x] * step)\n new_y = y + (move[:y] * step)\n [new_x, new_y]\n end\n end.sort do |m1, m2|\n c = (m1[1] <=> m2[1])\n c == 0 ? (m1[0] <=> m2[0]) : c\n end\n\n board_possible_moves = all_possible_moves.reject { |p| p[0] < 1 || p[1] < 1 || p[0] > 8 || p[1] > 8 }\n movesList = []\n board_possible_moves.collect { |m|\n x = (m[0] + 96).chr\n y = m[1]\n movesList<< x + y.to_s\n }\n movesList\nend", "def protecting_moves(pieces)\n\t\tarrPos = []\n\t\tif team == 1\n\t\t\tarrPos << [@xCord - 1, @yCord + 1] if square_taken_teammate?(pieces, [@xCord - 1, @yCord + 1])\n\t\t\tarrPos << [@xCord + 1, @yCord + 1] if square_taken_teammate?(pieces, [@xCord + 1, @yCord + 1])\n\t\telsif team == 2\n\t\t\tarrPos << [@xCord - 1, @yCord - 1] if square_taken_teammate?(pieces, [@xCord - 1, @yCord - 1])\n\t\t\tarrPos << [@xCord + 1, @yCord - 1] if square_taken_teammate?(pieces, [@xCord + 1, @yCord - 1])\n\t\tend\n\t\tarrPos\t\n\tend", "def legal_move?(new_x, new_y)\n return false unless actual_move?(new_x, new_y)\n return_val = false\n piece_moved_start_x = x_position\n piece_moved_start_y = y_position\n piece_captured = nil\n piece_captured_x = nil\n piece_captured_y = nil\n # check if you are moving pawn in en passant capture of enemy pawn\n if type == PAWN && !square_occupied?(new_x, new_y)\n if (new_x - piece_moved_start_x).abs == 1 && (new_y - piece_moved_start_y).abs == 1\n piece_captured = game.get_piece_at_coor(new_x, piece_moved_start_y)\n piece_captured_x = new_x\n piece_captured_y = piece_moved_start_y\n end\n end\n # return false if move is invalid for this piece for any of the reasons checked in piece #valid_move?\n return false unless valid_move?(new_x, new_y)\n # If square is occupied, respond according to whether piece is occupied by friend or foe\n if square_occupied?(new_x, new_y)\n occupying_piece = game.get_piece_at_coor(new_x, new_y)\n return false if (occupying_piece.is_white && is_white?) || (!occupying_piece.is_white && !is_white?)\n # since player is trying to capture a friendly piece\n piece_captured = occupying_piece\n piece_captured_x = occupying_piece.x_position\n piece_captured_y = occupying_piece.y_position\n capture_piece(occupying_piece)\n end\n # only here do we update coordinates of piece moved, once we have saved all starting coordinates of piece moved and any piece it captured\n update(x_position: new_x, y_position: new_y)\n increment_move\n return_val = true unless game.check?(is_white)\n update(x_position: piece_moved_start_x, y_position: piece_moved_start_y)\n piece_captured.update(x_position: piece_captured_x, y_position: piece_captured_y) unless piece_captured.nil?\n decrement_move\n return_val\n end", "def perfect_move(marker, index)\r\n\t\tif board[index] == perfect_move\r\n\t\t\tboard[index] = marker\r\n\tend\r\n\r\n\t#final moves in order to win\r\n\tdef win(board, marker)\r\n\t\t#horizontal top\r\n\t\tif board[0] && board[1] == marker\r\n\t\t\tboard[2] == perfect_move\r\n\t\telsif board[0] && board[2] == marker\r\n\t\t\tboard[1] == perfect_move\r\n\t\telsif board[1] && board[2] == marker\r\n\t\t\tboard[0] == perfect_move\r\n\t\t#horiz middle\r\n\t\telsif board[3] && board[4] == marker\r\n\t\t\tboard[5] == perfect_move\r\n\t\telsif board[3] && board[5] == marker\r\n\t\t\tboard[4] == perfect_move\r\n\t\telsif board[4] && board[5] == marker\r\n\t\t\tboard[3] == perfect_move\r\n\t\t#horiz bottom\r\n\t\telsif board[6] && board[7] == marker\r\n\t\t\tboard[8] == perfect_move\r\n\t\telsif board[6] && board[8] == marker\r\n\t\t\tboard[7] == perfect_move\r\n\t\telsif board[7] && board[8] == marker\r\n\t\t\tboard[6] == perfect_move\r\n\t\t#vertical left\r\n\t\telsif board[0] && board[3] == marker\r\n\t\t\tboard[6] == perfect_move\r\n\t\telsif board[3] && board[6] == marker\r\n\t\t\tboard[0] == perfect_move\r\n\t\telsif board[0] && board[6] == marker\r\n\t\t\tboard[3] == perfect_move\r\n\t\t#vert middle\r\n\t\telsif board[1] && board[4] == marker\r\n\t\t\tboard[7] == perfect_move\r\n\t\telsif board[1] && board[7] == marker\r\n\t\t\tboard[4] == perfect_move\r\n\t\telsif board[4] && board[7] == marker\r\n\t\t\tboard[1] == perfect_move\r\n\t\t#vert right\r\n\t\telsif board[2] && board[5] == marker\r\n\t\t\tboard[8] == perfect_move\r\n\t\telsif board[2] && board[8] == marker\r\n\t\t\tboard[5] == perfect_move\r\n\t\telsif board[5] && board[8] == marker\r\n\t\t\tboard[2] == perfect_move\r\n\t\t#diagonal top left \r\n\t\telsif board[0] && board[4] == marker\r\n\t\t\tboard[8] == perfect_move\r\n\t\telsif board[0] && board[8] == marker\r\n\t\t\tboard[4] == perfect_move\r\n\t\telsif board[4] && board[8] == marker\r\n\t\t\tboard[0] == perfect_move\r\n\t\t#diag bottom left\r\n\t\telsif board[2] && board[4] == marker\r\n\t\t\tboard[6] == perfect_move\r\n\t\telsif board[2] && board[6] == marker\r\n\t\t\tboard[4] == perfect_move\r\n\t\telsif board[4] && board[6] == marker\r\n\t\t\tboard[2] == perfect_move\r\n\t\telse\r\n\r\n\t\tend\r\n\tend\r\n\r\n\t#blocks an opponent from making the winning move\r\n\tdef block(human, marker, index)\r\n\t\tif human[marker] == win\r\n\t\t\tboard[index] = perfect_move\r\n\t\t\ttrue\r\n\t\telse\r\n\t\t\tfalse\r\n\t\tend\r\n\tend\r\n\r\n\tdef fork()\r\n\tend\r\n\r\n\tdef fork_block()\r\n\tend\r\n\r\n\tdef opposite_corner()\r\n\tend\r\n\r\n\tdef empty_corner()\r\n\tend\r\n\r\n\tdef empty_side()\r\n\tend\r\n\r\nend", "def permissible(start, stop, piece, player)\r\n $board[start[0]][start[1]].nil? ? start_color = nil : start_color = $board[start[0]][start[1]].color\r\n $board[stop[0]][stop[1]].nil? ? stop_color = nil : stop_color = $board[stop[0]][stop[1]].color \r\n # Ensures player moving own piece\r\n if start_color != player\r\n puts \"Invalid selection!\"; return false\r\n end\r\n temp_board = temporary_board(start, stop)\r\n check = in_check(player, temp_board)\r\n # Ensures King not currently in check, or move places King in check\r\n if check == true\r\n puts ''\r\n puts \"Invalid move. King in check.\" ; return false \r\n end\r\n # Ensures player doesn't capture own piece\r\n if stop_color == player\r\n puts ''\r\n puts \"You cannot capture your own piece!\"; return false\r\n end\r\n # Permits en passant\r\n if piece.class == Pawn && $board[@prev_coord[0]][@prev_coord[1]].class == Pawn\r\n if @prev_delta_y == 2 && @prev_coord[1] == start[1] && @prev_coord[0] == stop[0] \r\n if (player == 'white' && stop[1] == @prev_coord[1] + 1) or (player == 'black' && stop[1] == @prev_coord[1] -1 )\r\n print \"En passant\"\r\n $board[@prev_coord[0]][@prev_coord[1]] = nil\r\n return true\r\n end\r\n end\r\n end\r\n #King hasn't moved yet, rook hasn't moved yet\r\n if piece.class == King and start[1] == stop[1] and (start[0] - stop[0]).abs == 2 and piece.turn == 0 #first rank King,king hasn't moved, \r\n if castle_valid(start, stop, piece, player)\r\n print \"Castling...\"\r\n return true\r\n end\r\n end\r\n # Ensures move is a valid combination for piece type\r\n if piece.valid_move(start, stop, $board) == false\r\n puts ''\r\n puts \"Invalid move!\" ; return false\r\n end\r\n return true\r\n end", "def possible_moves(starting_position, actual_piece, turn = @turn, board = @board)\n row = starting_position[0]\n column = starting_position[1]\n potential_moves = []\n\n active_pieces = []\n enemy_pieces = []\n\n if turn == 1\n active_pieces = @w_pieces\n enemy_pieces = @b_pieces\n else\n active_pieces = @b_pieces\n enemy_pieces = @w_pieces\n end\n\n # moves available for white pawns\n if actual_piece == $w_pawn\n # if the white pawn is in its original spot, then it can move two spots or one spot\n return if row == 7\n\n if row == 1\n potential_moves << [row+1, column] if board[row+1][column] == ' '\n potential_moves << [row+2, column] if board[row+2][column] == ' '\n else\n potential_moves << [row+1, column] if board[row+1][column] == ' '\n end\n\n # can take black pieces, but only if they are available diagonally\n potential_moves << [row+1, column+1] if @b_pieces.include?(board[row+1][column+1])\n potential_moves << [row+1, column-1] if @b_pieces.include?(board[row+1][column-1])\n\n # can take black pawns under special en-passant rule\n if @en_passant_piece != []\n passant_row = invert_position_converter(@en_passant_piece)[0]\n passant_col = invert_position_converter(@en_passant_piece)[1]\n if passant_row == row && (passant_col == column + 1 || passant_col == column - 1)\n # it must be empty in order for us to do en-passant (otherwise the pawn can just take)\n if @board[passant_row+1][passant_col] = ' '\n potential_moves << [passant_row+1, passant_col]\n end\n end\n end\n end \n\n # moves available for black pawns\n if actual_piece == $b_pawn\n # if the black pawn is in its original spot, then it can move two spots or one spot\n return if row == 0\n\n if row == 6\n potential_moves << [row-1, column] if board[row-1][column] == ' '\n potential_moves << [row-2, column] if board[row-2][column] == ' '\n else\n potential_moves << [row-1, column] if board[row-1][column] == ' '\n end\n\n # can take white pieces\n potential_moves << [row-1, column+1] if @b_pieces.include?(board[row-1][column+1])\n potential_moves << [row-1, column-1] if @b_pieces.include?(board[row-1][column-1])\n\n # can take white pawns under special en-passant rule\n\n if @en_passant_piece != []\n passant_row = invert_position_converter(@en_passant_piece)[0]\n passant_col = invert_position_converter(@en_passant_piece)[1]\n if passant_row == row && (passant_col == column + 1 || passant_col == column - 1)\n if @board[passant_row-1][passant_col] = ' '\n potential_moves << [passant_row-1, passant_col]\n end\n end\n end\n end\n\n # moves available for rooks\n if actual_piece == $w_rook || actual_piece == $b_rook\n\n i_row = row\n i_col = column\n\n # returns all potential moves north of the starting position\n until i_row+1 == 8 || active_pieces.include?(board[i_row+1][i_col])\n if enemy_pieces.include?(board[i_row+1][i_col])\n potential_moves << [i_row+1,i_col]\n break\n else\n potential_moves << [i_row+1,i_col]\n end\n i_row += 1\n end\n \n i_row = row\n i_col = column \n\n # returns all potential moves south of the starting position\n until active_pieces.include?(board[i_row-1][i_col]) || i_row-1 == -1\n if enemy_pieces.include?(board[i_row-1][i_col])\n potential_moves << [i_row-1,i_col]\n break\n else\n potential_moves << [i_row-1,i_col]\n end\n i_row -= 1\n end\n\n i_row = row\n i_col = column\n \n\n # returns all potential moves right of the starting position\n until active_pieces.include?(board[i_row][i_col+1]) || i_col+1 == 8\n if enemy_pieces.include?(board[i_row][i_col+1])\n potential_moves << [i_row,i_col+1]\n break\n else\n potential_moves << [i_row,i_col+1]\n end\n i_col += 1\n end\n\n i_row = row\n i_col = column\n \n # returns all potential moves left of the starting position\n until active_pieces.include?(board[i_row][i_col-1]) || i_col-1 == -1\n if enemy_pieces.include?(board[i_row][i_col-1])\n potential_moves << [i_row,i_col-1]\n break\n else\n potential_moves << [i_row,i_col-1]\n end\n i_col -= 1\n end\n\n i_row = row\n i_col = column\n\n end\n\n # moves available for knights\n if actual_piece == $w_knig || actual_piece == $b_knig\n\n # returns all potential moves\n potential_moves << [row+2, column+1]\n potential_moves << [row+1, column+2]\n potential_moves << [row-1, column+2]\n potential_moves << [row-2, column+1]\n potential_moves << [row-2, column-1]\n potential_moves << [row-1, column-2]\n potential_moves << [row+1, column-2]\n potential_moves << [row+2, column-1]\n\n end\n\n # moves available for bishops\n if actual_piece == $w_bish || actual_piece == $b_bish\n\n i_row = row\n i_col = column\n\n # returns all potential moving north-east of the starting position\n\n until i_row+1 == 8 || i_col+1 == 8 || active_pieces.include?(board[i_row+1][i_col+1])\n if enemy_pieces.include?(board[i_row+1][i_col+1])\n potential_moves << [i_row+1,i_col+1]\n break\n else\n potential_moves << [i_row+1,i_col+1]\n end\n i_row += 1\n i_col += 1\n end\n \n i_row = row\n i_col = column \n\n # returns all potential moving south-east of the starting position\n until i_row-1 == -1 || i_col+1 ==8 || active_pieces.include?(board[i_row-1][i_col+1])\n if enemy_pieces.include?(board[i_row-1][i_col+1])\n potential_moves << [i_row-1,i_col+1]\n break\n else\n potential_moves << [i_row-1,i_col+1]\n end\n i_row -= 1\n i_col += 1\n end\n \n i_row = row\n i_col = column \n\n # returns all potential moving south-west of the starting position\n until i_row-1 == -1 || i_col-1 == -1 || active_pieces.include?(board[i_row-1][i_col-1])\n if enemy_pieces.include?(board[i_row-1][i_col-1])\n potential_moves << [i_row-1,i_col-1]\n break\n else\n potential_moves << [i_row-1,i_col-1]\n end\n i_row -= 1\n i_col -= 1\n end\n \n i_row = row\n i_col = column \n \n # returns all potential moving north-east of the starting position\n until i_row+1 == 8 || i_col-1 == -1 || active_pieces.include?(board[i_row+1][i_col-1])\n if enemy_pieces.include?(board[i_row+1][i_col-1])\n potential_moves << [i_row+1,i_col-1]\n break\n else\n potential_moves << [i_row+1,i_col-1]\n end\n i_row += 1\n i_col -= 1\n end\n \n i_row = row\n i_col = column \n\n end\n\n # moves available for queens\n if actual_piece == $w_quee || actual_piece == $b_quee\n if actual_piece == $w_quee\n potential_moves.concat(possible_moves(starting_position, $w_rook, turn = 1))\n potential_moves.concat(possible_moves(starting_position, $w_bish, turn = 1))\n end\n if actual_piece == $b_quee\n potential_moves.concat(possible_moves(starting_position, $b_rook, turn = 2))\n potential_moves.concat(possible_moves(starting_position, $b_bish, turn = 2))\n end\n end\n\n # moves available for kings\n if actual_piece == $w_king || actual_piece == $b_king\n i_row = row\n i_col = column\n\n potential_moves << [i_row+1, i_col]\n potential_moves << [i_row+1, i_col+1]\n potential_moves << [i_row, i_col+1]\n potential_moves << [i_row-1, i_col-1]\n potential_moves << [i_row-1, i_col]\n potential_moves << [i_row-1, i_col+1]\n potential_moves << [i_row, i_col-1]\n potential_moves << [i_row+1, i_col-1]\n\n # castling conditions\n # The king does not move over a square that is attacked by an enemy piece during the castling move, i.e., when castling, there may not be an enemy piece that can move (in case of pawns: by diagonal movement) to a square that is moved over by the king.\n\n # The king cannot be in check if they are trying to castle\n if !@check_condition\n if actual_piece == $w_king\n # checks for left rook potential\n if board[0][1] == ' ' && board[0][2] == ' ' && board[0][3] == ' '\n binding.pry\n if @w_king_move == \"not moved\" && @w_rook_left == \"not moved\"\n if !enemy_positions.include?([0, 3])\n potential_moves << [0, 2]\n end\n end\n #checks for right rook potential\n elsif board[0][5] == ' ' && board[0][6] == ' '\n if @w_king_move == \"not moved\" && @w_rook_right == \"not moved\"\n if !enemy_positions.include?([0, 5])\n potential_moves << [0, 6]\n end\n end\n end\n end\n if actual_piece == $b_king\n # checks for left rook potential\n if board[7][1] == ' ' && board[7][2] == ' ' && board[7][3] == ' '\n if @b_king_move == \"not moved\" && @b_rook_left == \"not moved\"\n if !enemy_positions.include?([7, 3])\n potential_moves << [7, 2]\n end \n end\n #checks for right rook potential\n elsif board[7][5] == ' ' && board[7][6] == ' '\n if @b_king_move == \"not moved\" && @b_rook_right == \"not moved\"\n if !enemy_positions.include?([7, 5])\n potential_moves << [7, 6] \n end\n end\n end\n end\n end\n\n end\n\n potential_moves = potential_moves.select { |pos| valid_move?(pos, turn)}\n\n potential_moves\n\n end", "def validate_computer_position(position)\n if $grid_hash[position] == ' '\n \t$confirmed_piece = position\n return true\n else\n comp_turn\n end\nend", "def play_move!( m )\n self.delete_if { |pos, piece| pos == m.to_coord || pos == m.captured_piece_coord }\n\n piece_moved = self.delete(m.from_coord)\n self[m.to_coord] = piece_moved\n\n if m.castled==1\n castling_rank = m.to_coord.rank.to_s\n [['g', 'f', 'h'], ['c', 'd', 'a']].each do |king_file, new_rook_file, orig_rook_file|\n #update the position of the rook corresponding to the square the king landed on\n\tif m.to_coord.file == king_file \n\t rook = self.delete(\"#{orig_rook_file}#{castling_rank}\")\n\t self[\"#{new_rook_file}#{castling_rank}\"] = rook\n\tend\n end\n end\n \n #TODO investigate why this method is getting called multiply per moves << Move.new\n return unless piece_moved\n ep_from_rank, ep_to_rank, ep_rank = EN_PASSANT_CONFIG[ piece_moved.side ]\n @en_passant_square = ( piece_moved.function == :pawn &&\n m.from_coord.rank == ep_from_rank && \n m.to_coord.rank == ep_to_rank ) ? m.from_coord.file + ep_rank.to_s : nil\n\n #reflect promotion\n if piece_moved && piece_moved.function == :pawn && m.to_coord.to_s.rank == piece_moved.promotion_rank\n self.delete(m.to_coord)\n self[m.to_coord] = Queen.new(piece_moved.side, :promoted)\n #puts self.to_s if m.to_coord == 'a8'\n #debugger if m.to_coord == 'a8'\n end\n \n self\n end", "def gen_bishop_moves(color, piece=:bishop)\n moves = []\n if color == :white\n position = @position.white \n comrades = @position.white_pieces\n enemy = @position.black_pieces\n else\n position = @position.black\n comrades = @position.black_pieces\n enemy = @position.white_pieces\n end\n\n # no work to do when there are no pieces\n return moves if position[piece].nil?\n \n # for each piece\n position[piece].set_bits.each do |from| \n # [i,j] = current position\n i = from / 8\n j = from % 8\n\n #dirs flags which directions the piece is blocked\n dirs = 0\n for k in 1..7\n break if dirs == 0xf\n \n # try moving north-east\n if (dirs & 0x1) != 0x1\n to = from+k*9\n if i+k>7 || j+k>7 || comrades.set?(to)\n # no further north-east moves possible\n dirs = dirs | 0x1\n else\n moves.push [Square.index(from), Square.index(to)]\n # if it's occupied by the enemy, no further north moves possible\n dirs = dirs | 0x1 if enemy.set?(to) \n end\n end\n \n # try moving south-west\n if (dirs & 0x2) != 0x2\n to = from-k*9\n if i<k || j<k || comrades.set?(to)\n # no further south-west moves possible\n dirs = dirs | 0x2\n else\n moves.push [Square.index(from), Square.index(to)]\n # if it's occupied by the enemy, no further south-west moves possible\n dirs = dirs | 0x2 if enemy.set?(to) \n end\n end\n \n # try moving north-west\n if (dirs & 0x4) != 0x4\n to = from+k*7\n if i+k>7 || j<k || comrades.set?(to)\n # no further north-west moves possible\n dirs = dirs | 0x4\n else\n moves.push [Square.index(from), Square.index(to)]\n # if it's occupied by the enemy, no further north-west moves possible\n dirs = dirs | 0x4 if enemy.set?(to) \n end\n end \n \n # try moving south-east\n if (dirs & 0x8) != 0x8\n to = from-k*7\n if i<k || j+k>7 || comrades.set?(to)\n # no further south-east moves possible\n dirs = dirs | 0x8\n else\n moves.push [Square.index(from), Square.index(to)]\n # if it's occupied by the enemy, no further south-east moves possible\n dirs = dirs | 0x8 if enemy.set?(to) \n end\n end\n \n end\n end \n moves\n end", "def piece_finished\n blocks = build_blocks\n blocks.each do |block|\n @field[\n @falling_piece.grid_position.y + block.grid_offset_y\n ][\n @falling_piece.grid_position.x + block.grid_offset_x\n ] = block\n end\n\n new_piece\n check_row_removal\n end", "def move_check_change(position_array)\n move_piece(position_array)\n puts \"#{opponent_colour(player)} KING IN CHECK!\" if opponent_in_check(player.colour)\n change_player\n end", "def moves_pawn(color, a, b)\n \t_moves = []\n \tif color == :white\n \t\tif @board[a][b].piece.double == \"true\"\n \t\t\t_moves << [a, b + 2] if @board[a][b + 2].piece == nil \t\t\n \t\tend\n\n \t\tx, y = up(a, b)\n \t\tif off_board(x, y) == false\n \t\t\t_moves << up(a, b) if @board[x][y].piece == nil\n \t\tend\n\n \t\tx, y = up_left(a, b)\n \t\tif off_board(x, y) == false\n \t\t\t_moves << up_left(a, b) if (@board[x][y].piece != nil && @board[x][y].piece.color != color) || en_passant_left(a, b)\n \t\tend\n \t\t\n \t\tx, y = up_right(a, b)\n \t\tif off_board(x, y) == false\n \t\t\t_moves << up_right(a, b) if (@board[x][y].piece != nil && @board[x][y].piece.color != color) || en_passant_right(a, b)\n \t\tend\n\n \telse\n \t\tif @board[a][b].piece.double == \"true\"\n \t\t\t_moves << [a, b - 2] if @board[a][b - 2].piece == nil\n \t\tend\n\n \t\tx, y = down(a, b)\n \t\tif off_board(x, y) == false\n \t\t\t_moves << down(a, b) if @board[x][y].piece == nil\n \t\tend\n\n \t\tx, y = down_left(a, b)\n \t\tif off_board(x, y) == false\n \t\t\t_moves << down_left(a, b) if (@board[x][y].piece != nil || @board[a][b].piece.color != color) || en_passant_left(a, b)\n \t\tend\n\n \t\tx, y = down_right(a, b)\n \t\tif off_board(x, y) == false\n \t\t\t_moves << down_right(a, b) if (@board[x][y].piece != nil || @board[a][b].piece.color != color) || en_passant_right(a, b)\n \t\tend\n \tend\n \treturn _moves.compact\n end", "def valid_move?(board,index)\n def position_taken?(array,ind)\n if array[ind] == \" \" || array[ind] == \" \" || array[ind] == nil\n return false\n else\n return true\n end\nend\n\ndef on_board?(num)\n if num.between?(0,8) == true\n return true\n else\n return false\n end\nend\n\nif (position_taken?(board, index)) == false && (on_board?(index) == true)\n return true\n else\n return false\n end\n\n\nend", "def valid_move? move\n@board[move] == PIECE[:blank]\nend", "def checkmoves(king, attacking_pieces, board )\n if self == king\n enemy_pieces = self.game.pieces.where('player_id != ?', king.player_id).where(captured_piece: false)\n king_moves = king.piece_can_move_to(board)\n enemy_pieces.each do |enemy_piece|\n if enemy_piece.type == \"Pawn\" #testing for if pawn is attacking square king could move to. wierd case since pawn cant move to this square unless an enemy piece is there to capture (take diagonal)\n pawn_test_spots = []\n if enemy_piece.game.black_player_id == enemy_piece.player_id\n pawn_test_spots = [[enemy_piece.y_position - 1,enemy_piece.x_position - 1],[enemy_piece.y_position - 1,enemy_piece.x_position + 1]]\n\n elsif enemy_piece.game.white_player_id == enemy_piece.player_id\n pawn_test_spots = [[enemy_piece.y_position + 1,enemy_piece.x_position - 1],[enemy_piece.y_position + 1,enemy_piece.x_position + 1]]\n end\n king_moves -= pawn_test_spots\n next\n end\n king_moves -= enemy_piece.piece_can_move_to(board)\n end\n return king_moves\n end\n\n return [] if attacking_pieces.length > 1 # can't defend from two attacking pieces unless king is moved\n\n current_piece = self\n current_piece_moves_avail = current_piece.piece_can_move_to(board)\n enemy_piece = attacking_pieces[0] # since only one piece is attacking, we should rename this\n current_piece_moves_avail = current_piece_moves_avail & (enemy_piece.piece_can_move_to(board) + [[enemy_piece.y_position,enemy_piece.x_position]])# finding the squares these pieces can both move to\n\n prevent_check_moves = []\n\n current_piece_moves_avail.each do |square|\n y = square[0]\n x = square[1]\n play_board = Marshal.load(Marshal.dump(board))\n play_board[self.y_position][self.x_position] = 0\n play_board[y][x] = self.player_id\n # enemy piece should have x,y such that board[y][x] should equal to enemy player.id\n if play_board[enemy_piece.y_position][enemy_piece.x_position] == self.player_id\n prevent_check_moves << square\n next\n end\n prevent_check_moves << square if !enemy_piece.piece_can_move_to(play_board).include?([king.y_position,king.x_position])\n end\n return prevent_check_moves\n\n end", "def valid_black_rook(start,dest)\n x = start[0]; y = start[1]\n x1 = dest[0]; y1 = dest[1]\n\n xtrans = x\n ytrans = y\n\n return false if black_owned(x1,y1)\n\n #Getting the one space moves for the square around the rook\n if x1 == x+1 && y1 == y\n @white_piece.push(@b[x1][y1]) if white_owned(x1,y1)\n @b[x][y] = \" \"\n @blk_rook_left_move = true if x == 0 && y == 7\n @blk_rook_right_move = true if x == 7 && y == 7\n @b[x1][y1] = @BR\n return true\n elsif x1 == x-1 && y1 == y\n @white_piece.push(@b[x1][y1]) if white_owned(x1,y1)\n @b[x][y] = \" \"\n @blk_rook_left_move = true if x == 0 && y == 7\n @blk_rook_right_move = true if x == 7 && y == 7\n @b[x1][y1] = @BR\n return true\n elsif x1 == x && y1 == y+1\n @white_piece.push(@b[x1][y1]) if white_owned(x1,y1)\n @b[x][y] = \" \"\n @blk_rook_left_move = true if x == 0 && y == 7\n @blk_rook_right_move = true if x == 7 && y == 7\n @b[x1][y1] = @BR\n return true\n elsif x1 == x && y1 == y-1\n @white_piece.push(@b[x1][y1]) if white_owned(x1,y1)\n @b[x][y] = \" \"\n @blk_rook_left_move = true if x == 0 && y == 7\n @blk_rook_right_move = true if x == 7 && y == 7\n @b[x1][y1] = @BR\n return true\n end\n\n #The spaces that are +1 further away\n if x1 > x+1 && y1 == y\n while xtrans < x1-1 do\n xtrans += 1\n if @b[xtrans][ytrans] != \" \"\n return false #blockaded!\n end\n end\n @white_piece.push(@b[x1][y1]) if white_owned(x1,y1)\n @b[x][y] = \" \"\n @blk_rook_left_move = true if x == 0 && y == 7\n @blk_rook_right_move = true if x == 7 && y == 7\n @b[x1][y1] = @BR\n return true\n elsif x1 < x-1 && y1 == y\n while xtrans > x1+1 do\n xtrans -= 1\n if @b[xtrans][ytrans] != \" \"\n return false #blockaded!\n end\n end\n @white_piece.push(@b[x1][y1]) if white_owned(x1,y1)\n @b[x][y] = \" \"\n @blk_rook_left_move = true if x == 0 && y == 7\n @blk_rook_right_move = true if x == 7 && y == 7\n @b[x1][y1] = @BR\n return true\n elsif x1 == x && y1 > y+1\n while ytrans < y1-1 do\n ytrans += 1\n if @b[xtrans][ytrans] != \" \"\n return false #blockaded!\n end\n end\n @white_piece.push(@b[x1][y1]) if white_owned(x1,y1)\n @b[x][y] = \" \"\n @blk_rook_left_move = true if x == 0 && y == 7\n @blk_rook_right_move = true if x == 7 && y == 7\n @b[x1][y1] = @BR\n return true\n elsif x1 == x && y1 < y-1\n while ytrans > y1+1 do\n ytrans -= 1\n if @b[xtrans][ytrans] != \" \"\n return false #blockaded!\n end\n end\n @white_piece.push(@b[x1][y1]) if white_owned(x1,y1)\n @b[x][y] = \" \"\n @blk_rook_left_move = true if x == 0 && y == 7\n @blk_rook_right_move = true if x == 7 && y == 7\n @b[x1][y1] = @BR\n return true\n end\n return false\n end", "def gen_rook_moves(color, piece=:rook)\n moves = []\n if color == :white\n position = @position.white \n comrades = @position.white_pieces\n enemy = @position.black_pieces\n else\n position = @position.black\n comrades = @position.black_pieces\n enemy = @position.white_pieces\n end\n\n # no work to do when there are no pieces\n return moves if position[piece].nil?\n \n # for each piece\n position[piece].set_bits.each do |from| \n # [i,j] = current position\n i = from / 8\n j = from % 8\n\n #dirs flags which directions the piece is blocked\n dirs = 0\n for k in 1..7\n break if dirs == 0xf\n \n # try moving north\n if (dirs & 0x1) != 0x1\n to = from+k*8\n if i+k>7 || comrades.set?(to)\n # no further north moves possible\n dirs = dirs | 0x1\n else\n moves.push [Square.index(from), Square.index(to)]\n # if it's occupied by the enemy, no further north moves possible\n dirs = dirs | 0x1 if enemy.set?(to) \n end\n end\n \n # try moving south\n if (dirs & 0x2) != 0x2\n to = from-k*8\n if i<k || comrades.set?(to)\n # no further south moves possible\n dirs = dirs | 0x2\n else\n moves.push [Square.index(from), Square.index(to)]\n # if it's occupied by the enemy, no further north moves possible\n dirs = dirs | 0x2 if enemy.set?(to) \n end\n end\n \n # try moving east\n if (dirs & 0x4) != 0x4\n to = from+k\n if j+k>7 || comrades.set?(to)\n # no further east moves possible\n dirs = dirs | 0x4\n else\n moves.push [Square.index(from), Square.index(to)]\n # if it's occupied by the enemy, no further east moves possible\n dirs = dirs | 0x4 if enemy.set?(to) \n end\n end\n \n # try moving west\n if (dirs & 0x8) != 0x8\n to = from-k\n if j-k<0 || comrades.set?(to)\n # no further east moves possible\n dirs = dirs | 0x8\n else\n moves.push [Square.index(from), Square.index(to)]\n # if it's occupied by the enemy, no further west moves possible\n dirs = dirs | 0x8 if enemy.set?(to) \n end\n end \n end\n end \n moves\n end", "def init_pos\n reset_board_variables\n colors = {:white => 0, :black => 7}\n pieces = {:torr => [0,7], :cav => [1,6], :alf => [2,5], :reg => [3], :re => [4]}\n key_pieces = {:white => [:w1, :w2, :w3, :w4, :w5, :w6, :w7, :w8, :w9, :w10, :w11, :w12, :w13, :w14, :w15, :w16],\n :black => [:b1, :b2, :b3, :b4, :b5, :b6, :b7, :b8, :b9, :b10, :b11, :b12, :b13, :b14, :b15, :b16]}\n # set pieces \n colors.each do |k_col, v_col|\n # iterate each color\n key_color_array = key_pieces[k_col]\n pieces.each do |k_pie, v_pie|\n # iterate each piece\n v_pie.each do |ix_piece|\n #p v_col, ix_piece, k_pie, k_col\n @infosquare[v_col][ix_piece].setinfo(k_pie, k_col)\n #kk_p = key_color_array.pop\n @pieces[k_col] << @infosquare[v_col][ix_piece] \n end\n end#end pieces\n \n # now set pawn for this color\n ix_col = 1\n ix_col = 6 if k_col == :black\n [0,1,2,3,4,5,6,7].each do |ix_piece|\n #p ix_col, ix_piece\n @infosquare[ix_col][ix_piece].setinfo(:ped, k_col)\n #kk_p = key_color_array.pop\n @pieces[k_col] << @infosquare[ix_col][ix_piece] \n end\n end \n #p @pieces\n #p @infosquare\n #p @pieces.size\n #p @pieces[:white].first\n end", "def perfect_move(marker, index)\n\t\tif board[index] == perfect_move\n\t\t\tboard[index] = marker\n\tend\n\n\t#final moves in order to win\n\tdef win(board, marker)\n\t\t#horizontal top\n\t\tif board[0] && board[1] == marker\n\t\t\tboard[2] == perfect_move\n\t\telsif board[0] && board[2] == marker\n\t\t\tboard[1] == perfect_move\n\t\telsif board[1] && board[2] == marker\n\t\t\tboard[0] == perfect_move\n\t\t#horiz middle\n\t\telsif board[3] && board[4] == marker\n\t\t\tboard[5] == perfect_move\n\t\telsif board[3] && board[5] == marker\n\t\t\tboard[4] == perfect_move\n\t\telsif board[4] && board[5] == marker\n\t\t\tboard[3] == perfect_move\n\t\t#horiz bottom\n\t\telsif board[6] && board[7] == marker\n\t\t\tboard[8] == perfect_move\n\t\telsif board[6] && board[8] == marker\n\t\t\tboard[7] == perfect_move\n\t\telsif board[7] && board[8] == marker\n\t\t\tboard[6] == perfect_move\n\t\t#vertical left\n\t\telsif board[0] && board[3] == marker\n\t\t\tboard[6] == perfect_move\n\t\telsif board[3] && board[6] == marker\n\t\t\tboard[0] == perfect_move\n\t\telsif board[0] && board[6] == marker\n\t\t\tboard[3] == perfect_move\n\t\t#vert middle\n\t\telsif board[1] && board[4] == marker\n\t\t\tboard[7] == perfect_move\n\t\telsif board[1] && board[7] == marker\n\t\t\tboard[4] == perfect_move\n\t\telsif board[4] && board[7] == marker\n\t\t\tboard[1] == perfect_move\n\t\t#vert right\n\t\telsif board[2] && board[5] == marker\n\t\t\tboard[8] == perfect_move\n\t\telsif board[2] && board[8] == marker\n\t\t\tboard[5] == perfect_move\n\t\telsif board[5] && board[8] == marker\n\t\t\tboard[2] == perfect_move\n\t\t#diaginal top left \n\t\telsif board[0] && board[4] == marker\n\t\t\tboard[8] == perfect_move\n\t\telsif board[0] && board[8] == marker\n\t\t\tboard[4] == perfect_move\n\t\telsif board[4] && board[8] == marker\n\t\t\tboard[0] == perfect_move\n\t\t#diag bottom left\n\t\telsif board[2] && board[4] == marker\n\t\t\tboard[6] == perfect_move\n\t\telsif board[2] && board[6] == marker\n\t\t\tboard[4] == perfect_move\n\t\telsif board[4] && board[6] == marker\n\t\t\tboard[2] == perfect_move\n\t\telse\n\n\t\tend\n\tend\n\n\t#blocks an opponent from making the winning move\n\tdef block(human, marker, index)\n\t\tif human[marker] == win\n\t\t\tboard[index] = perfect_move\n\t\t\ttrue\n\t\telse\n\t\t\tfalse\n\t\tend\n\tend\n\n\tdef fork()\n\tend\n\n\tdef fork_block()\n\tend\n\n\tdef opposite_corner()\n\tend\n\n\tdef empty_corner()\n\tend\n\n\tdef empty_side()\n\tend\n\nend", "def valid_move?(board, index)\n index.between?(0, 8) && position_taken?(board, index) == false\n\nend", "def moves\n directions = MOVE_DIRECTIONS[self.piece_type]\n directions.map do |(dx, dy)|\n x, y = self.position\n [x + dx, y + dy]\n end.select { |coord| on_board?(coord) && not_blocked?(coord) }\n\n # cond = board[[coord]].nil? || board[[coord]].color != self.color\n # opp_cond = !(board[coord].color == self.color)\n # coord = [2,4]\n # [[2,3], nil, [3,4]]\n #(self.board[coord].color != self.color)\n end", "def move(board)\n if @players == \"X\" && board.cells[0] == \"X\" && (board.cells[1] == \"O\"|| board.cells[3] == \"O\"|| board.cells[4] == \"O\")\n ai_move = [\"3\", \"5\", \"6\", \"8\"]\n ai_move.sample\n elsif @players == \"X\" && board.cells[1] == \"X\" && (board.cells[0] == \"O\"|| board.cells[2] == \"O\"|| board.cells[3] == \"O\" || board.cells[4] == \"O\" || board.cells[5] == \"O\")\n ai_move = [\"4\", \"5\", \"6\", \"8\"]\n ai_move.sample\n elsif @players == \"X\" && board.cells[2] == \"X\" && (board.cells[1] == \"O\"|| board.cells[4] == \"O\"|| board.cells[5] == \"O\")\n ai_move = [\"1\", \"5\", \"7\", \"9\"]\n ai_move.sample\n elsif @players == \"X\" && board.cells[3] == \"X\" && (board.cells[0] == \"O\"|| board.cells[1] == \"O\"|| board.cells[4] == \"O\" || board.cells[6] == \"O\" || board.cells[7] == \"O\")\n ai_move = [\"4\", \"5\", \"6\", \"8\"]\n ai_move.sample\n elsif @players == \"X\" && board.cells[4] == \"X\" && (board.cells[0] == \"O\"|| board.cells[1] == \"O\"|| board.cells[2] == \"O\" || board.cells[3] == \"O\" || board.cells[5] == \"O\" || board.cells[6] == \"O\" || board.cells[7] == \"O\" || board.cells[8] == \"O\")\n ai_move = [\"1\", \"3\", \"7\", \"9\"]\n ai_move.sample\n elsif @players == \"X\" && board.cells[5] == \"X\" && (board.cells[1] == \"O\"|| board.cells[2] == \"O\"|| board.cells[4] == \"O\" || board.cells[7] == \"O\" || board.cells[8] == \"O\")\n ai_move = [\"3\", \"4\", \"5\", \"9\"]\n ai_move.sample\n elsif @players == \"X\" && board.cells[6] == \"X\" && (board.cells[3] == \"O\"|| board.cells[4] == \"O\"|| board.cells[7] == \"O\")\n ai_move = [\"1\", \"3\", \"5\", \"9\"]\n ai_move.sample\n elsif @players == \"X\" && board.cells[7] == \"X\" && (board.cells[3] == \"O\"|| board.cells[4] == \"O\"|| board.cells[5] == \"O\" || board.cells[6] == \"O\" || board.cells[8] == \"O\")\n ai_move = [\"2\", \"5\", \"7\", \"9\"]\n ai_move.sample\n elsif @players == \"X\" && board.cells[8] == \"X\" && (board.cells[4] == \"O\"|| board.cells[5] == \"O\"|| board.cells[7] == \"O\")\n ai_move = [\"1\", \"3\", \"5\", \"6\"]\n ai_move.sample\n\n elsif @players == \"O\" && board.cells[0] == \"O\" && (board.cells[1] == \"X\"|| board.cells[3] == \"O\"|| board.cells[4] == \"O\")\n ai_move = [\"3\", \"5\", \"6\", \"8\"]\n ai_move.sample\n elsif @players == \"O\" && board.cells[1] == \"O\" && (board.cells[0] == \"X\"|| board.cells[2] == \"X\"|| board.cells[3] == \"X\" || board.cells[4] == \"X\" || board.cells[5] == \"X\")\n ai_move = [\"4\", \"5\", \"6\", \"8\"]\n ai_move.sample\n elsif @players == \"O\" && board.cells[2] == \"O\" && (board.cells[1] == \"X\"|| board.cells[4] == \"X\"|| board.cells[5] == \"X\")\n ai_move = [\"1\", \"5\", \"7\", \"9\"]\n ai_move.sample\n elsif @players == \"O\" && board.cells[3] == \"O\" && (board.cells[0] == \"X\"|| board.cells[1] == \"X\"|| board.cells[4] == \"X\" || board.cells[6] == \"X\" || board.cells[7] == \"X\")\n ai_move = [\"4\", \"5\", \"6\", \"8\"]\n ai_move.sample\n elsif @players == \"O\" && board.cells[4] == \"O\" && (board.cells[0] == \"X\"|| board.cells[1] == \"X\"|| board.cells[2] == \"X\" || board.cells[3] == \"X\" || board.cells[5] == \"X\" || board.cells[6] == \"X\" || board.cells[7] == \"X\" || board.cells[8] == \"X\")\n ai_move = [\"1\", \"3\", \"7\", \"9\"]\n ai_move.sample\n elsif @players == \"O\" && board.cells[5] == \"O\" && (board.cells[1] == \"X\"|| board.cells[2] == \"X\"|| board.cells[4] == \"X\" || board.cells[7] == \"X\" || board.cells[8] == \"X\")\n ai_move = [\"3\", \"4\", \"5\", \"9\"]\n ai_move.sample\n elsif @players == \"O\" && board.cells[6] == \"O\" && (board.cells[3] == \"X\"|| board.cells[4] == \"X\"|| board.cells[7] == \"X\")\n ai_move = [\"1\", \"3\", \"5\", \"9\"]\n ai_move.sample\n elsif @players == \"O\" && board.cells[7] == \"O\" && (board.cells[3] == \"X\"|| board.cells[4] == \"X\"|| board.cells[5] == \"X\" || board.cells[6] == \"X\" || board.cells[8] == \"X\")\n ai_move = [\"2\", \"5\", \"7\", \"9\"]\n ai_move.sample\n elsif @players == \"O\" && board.cells[8] == \"O\" && (board.cells[4] == \"X\"|| board.cells[5] == \"X\"|| board.cells[7] == \"X\")\n ai_move = [\"1\", \"3\", \"5\", \"6\"]\n ai_move.sample\n\n else\n ai_move = [\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\"]\n ai_move.sample\n# def move(board)\n# ai_move = [\"2\", \"4\", \"6\", \"8\"]\n# ai_move.sample\n# elsif (board.cells[1] || board.cells[3] || board.cells[5] || board.cells[7]) == \"X\"\n# ai_move = [\"1\", \"3\", \"5\", \"7\", \"9\"]\n# ai_move.sample\n# elsif (board.cells[0] || board.cells[2] || board.cells[4] || board.cells[6] || board.cells[8]) == \"O\"\n# ai_move = [\"2\", \"4\", \"6\", \"8\"]\n# ai_move.sample\n# elsif (board.cells[1] || board.cells[3] || board.cells[5] || board.cells[7]) == \"O\"\n# ai_move = [\"1\", \"3\", \"5\", \"7\", \"9\"]\n# ai_move.sample\n# else\n# ai_move = [\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\"]\n# ai_move.sample\n end\n end", "def move_valid?\n @board.first_disk = 0\n\n #determine disk piece to be moved\n @board.board.each do |row, arr|\n if arr[@player.from] != 0\n @board.first_disk = arr[@player.from]\n break\n end\n end\n\n #determine the highest disk available in that column\n @board.board.each do |row, arr|\n if arr[@player.to] != 0\n @board.second_disk = arr[@player.to]\n break\n else\n @board.second_disk = arr[@player.to]\n end\n end\n\n #conditional test to see if move is valid\n if @board.first_disk == 0\n puts \"No disks in this column, try again\"\n get_input\n elsif @board.second_disk == 0 || @board.first_disk < @board.second_disk\n move_disk\n else\n puts \"Move is invalid\"\n puts \"Please check the rules and input a new move\"\n get_input\n end\n end", "def laat_bord_zien\nprint \"\\t\"\n@board.each_with_index do |piece, index|\ndisplay_piece_by_location(piece, index)\nend\nend", "def off_board_error\n pos = [10, 10]\n until valid_move?(*pos)\n puts \"Please select valid location on the board.\"\n print \"New row: \" \n row = gets.chomp.to_i\n print \"New column: \"\n column = gets.chomp.to_i\n pos = [row, column]\n end\n pos\n end", "def init_pos\r\n reset_board_variables\r\n colors = {:white => 0, :black => 7}\r\n pieces = {:torr => [0,7], :cav => [1,6], :alf => [2,5], :reg => [3], :re => [4]}\r\n key_pieces = {:white => [:w1, :w2, :w3, :w4, :w5, :w6, :w7, :w8, :w9, :w10, :w11, :w12, :w13, :w14, :w15, :w16],\r\n :black => [:b1, :b2, :b3, :b4, :b5, :b6, :b7, :b8, :b9, :b10, :b11, :b12, :b13, :b14, :b15, :b16]}\r\n # set pieces \r\n colors.each do |k_col, v_col|\r\n # iterate each color\r\n key_color_array = key_pieces[k_col]\r\n pieces.each do |k_pie, v_pie|\r\n # iterate each piece\r\n v_pie.each do |ix_piece|\r\n #p v_col, ix_piece, k_pie, k_col\r\n @infosquare[v_col][ix_piece].setinfo(k_pie, k_col)\r\n #kk_p = key_color_array.pop\r\n @pieces[k_col] << @infosquare[v_col][ix_piece] \r\n end\r\n end#end pieces\r\n \r\n # now set pawn for this color\r\n ix_col = 1\r\n ix_col = 6 if k_col == :black\r\n [0,1,2,3,4,5,6,7].each do |ix_piece|\r\n #p ix_col, ix_piece\r\n @infosquare[ix_col][ix_piece].setinfo(:ped, k_col)\r\n #kk_p = key_color_array.pop\r\n @pieces[k_col] << @infosquare[ix_col][ix_piece] \r\n end\r\n end \r\n #p @pieces\r\n #p @infosquare\r\n #p @pieces.size\r\n #p @pieces[:white].first\r\n end", "def next_state(state, move)\n # Deep copy position (is this the easiest way?)\n position = Marshal.load(Marshal.dump(state[:position]))\n player = state[:player]\n opp = opponent(player)\n pieces = Marshal.load(Marshal.dump(state[:pieces]))\n from = move[0]\n to = move[1]\n force_analysis = false\n check = false\n moving_piece = pieces[player].find { |piece| piece.location == from }\n if !moving_piece\n puts \"ERROR--no piece to move!\"\n end\n # Check for capture\n if position[to[0]][to[1]] != \".\"\n # Remove enemy piece\n pieces[opp].delete_if { |piece| piece.location == to }\n # Force AI to continue analysis\n force_analysis = true\n end\n # Check for promotion\n if moving_piece.class == Pawn && to[0] == end_row(player)\n # Replace pawn with queen\n # (Underpromotion not yet implemented)\n pieces[player].delete(moving_piece)\n moving_piece = Queen.new(self, to, player)\n pieces[player] << moving_piece\n end\n # Move piece\n position[from[0]][from[1]] = \".\"\n position[to[0]][to[1]] = moving_piece.icon\n moving_piece.location = to\n # Complete castling by moving rook\n if moving_piece.class == ChessKing && (from[1] - to[1]).abs == 2\n rook_column = to[1] == 6 ? 7 : 0\n castling_rook = pieces[player].find { |piece| piece.location == [from[0], rook_column] }\n if castling_rook\n rook_dest = to[1] == 6 ? 5 : 3\n position[from[0]][rook_column] = \".\"\n position[to[0]][rook_dest] = castling_rook.icon\n castling_rook.location = [to[0], rook_dest]\n else\n puts \"Castling error -- can't find rook!\"\n end\n end\n # Switch active player\n next_player = opp\n # # Create new state for testing whether king is in check\n # new_position_state = {\n # :position => position,\n # :player => player,\n # :pieces => pieces,\n # :check => false,\n # :force_analysis => false\n # }\n # # Test whether opponent's king is now in check\n # check = check?(new_position_state)\n # force_analysis = true if check\n # Return new state\n {\n :position => position,\n :player => next_player,\n :pieces => pieces,\n :check => check,\n :force_analysis => force_analysis\n }\n end", "def next_move(player,board,move)\n completed = false;\n blocking = false;\n if(move == 1) #First Move (hard coded)\n puts \"2 0\";\n elsif(move == 2) #Second Move (hard coded)\n if(board[1][1] == 'X')\n puts \"2 2\";\n else\n puts \"1 1\";\n end \n elsif(move == 3) #Third move (hard coded)\n if(board[0][1] == 'O' || board[1][0] == 'O' || board[1][2] == 'O' || board[2][1] == 'O')\n puts \"1 1\";\n elsif(board[1][1] == 'O')\n puts \"0 2\";\n elsif(board[0][2] == 'O' || board[2][2] == 'O')\n puts \"0 0\";\n else\n puts \"2 2\";\n end\n else #Any move after the 3rd\n completed = can_complete(player,board)\n if(completed == false)\n blocking = must_block(player,board);\n if(blocking == false)\n prevent = can_complete(player,board)\n if(move == 4 && (board[0][0] == 'X' || board[0][2] == 'X' || board[2][0] == 'X' || board[2][2] == 'X') && (board[0][1] == 'X' || board[1][0] == 'X' || board[1][2] == 'X' || board[2][1] == 'X'))\n if(board[0][1] == 'X' || board[2][1] == 'X')\n puts \"1 0\";\n else\n puts \"0 1\";\n end\n elsif(move == 4 && ((board[0][0] == 'X' && board[2][2] == 'X') || (board[0][2] == 'X' && board[2][0] == 'X') || (board[0][1] == 'X' && board[2][1] == 'X') || (board[1][0] == 'X' && board[1][2] == 'X')))\n if((board[0][0] == 'X' && board[2][2] == 'X') || (board[0][2] == 'X' && board[2][0] == 'X'))\n puts \"0 1\";\n else\n puts \"0 0\";\n end\n elsif(move == 6 && (board[2][1] == 'X' || board[0][1] == 'X') && (board[1][0] == 'X' || board[1][2] == 'X') && board[2][2] == '_')\n puts \"2 2\";\n elsif(board[0][0] == \"_\")\n puts \"0 0\";\n elsif(board[0][2] == \"_\")\n puts \"0 2\";\n elsif(board[2][2] == \"_\")\n puts \"2 2\";\n elsif(board[2][0] == \"_\")\n puts \"2 0\";\n elsif(board[0][1] == \"_\")\n puts \"0 1\";\n elsif(board[2][1] == \"_\")\n puts \"2 1\";\n elsif(board[1][0] == \"_\")\n puts \"1 0\";\n elsif(board[1][2] == \"_\")\n puts \"1 2\";\n else\n puts \"1 1\";\n end\n end\n end\n end\nend", "def move\n\n if @position != []\n if @position[2] == \"EAST\"\n @position[0] += 1\n elsif @position[2] == \"WEST\"\n @position[0] -= 1\n elsif @position[2] == \"NORTH\"\n @position[1] += 1\n elsif @position[2] == \"SOUTH\"\n @position[1] -= 1\n end\n check_position()\n else\n puts \"Invalid Command!!.\\nPlease execute command (place) to place the robot on the table.\"\n end\n @position\nend", "def place_piece(column, piece)\n if @board[5][column] == nil\n @board[5][column] = piece\n elsif @board[4][column] == nil\n @board[4][column] = piece\n elsif @board[3][column] == nil\n @board[3][column] = piece\n elsif @board[2][column] == nil\n @board[2][column] = piece\n elsif @board[1][column] == nil\n @board[1][column] = piece\n elsif @board[0][column] == nil\n @board[0][column] = piece\n end\n end", "def valid_move?(board, new_index)\n if 8 < new_index || new_index < 0\n return false\n elsif position_taken?(board, new_index) == true\n return false\n else\n return true\n end\nend", "def offending_player(king_loc, player, board)\r\n board.each_with_index do |row, i|\r\n row.each_with_index do |piece, j|\r\n next if board[i][j].nil?\r\n if board[i][j].color != player && board[i][j].valid_move([i, j], king_loc, board) == true \r\n return [board[i][j], [i, j]] \r\n end\r\n end\r\n end\r\n return nil\r\n end", "def move(team, final)\n decoded_final = decode(final)\n\n if @hasMoved == 0 && team == \"black\"\n @hasMoved = 1\n \n if @i_position[0] == decoded_final[0] && \n @i_position[1] - decoded_final[1] > 0 && \n @i_position[1] - decoded_final[1] <= 2 \n \n puts \"legal move\"\n else \n puts \"ILLEGAL MOVE\"\n end\n elsif @hasMoved != 0 && team == \"black\"\n\n\n\n if @i_position[0] == decoded_final[0] &&\n @i_position[1] - decoded_final[1] > 0 &&\n @i_position[1] - decoded_final[1] <= 1 \n \n puts \"legal move\"\n else \n puts \"ILLEGAL MOVE\"\n end\n \n elsif @hasMoved == 0 && team == \"white\"\n @hasMoved = 1\n decoded_final = decode(final) \n if @i_position[0] == decoded_final[0] && \n @i_position[1] - decoded_final[1] < 0 && \n decoded_final[1] - @i_position[1] <= 2 \n \n puts \"legal move\"\n else\n puts \"ILLEGAL MOVE\"\n end \n elsif @hasMoved != 0 && team == \"white\"\n\n if @i_position[0] == decoded_final[0] && \n @i_position[1] - decoded_final[1] < 0 && \n decoded_final[1] - @i_position[1] <= 1 \n \n puts \"legal move\"\n else\n puts \"ILLEGAL MOVE\"\n end \n\n end \n end", "def valid_white_rook(start,dest)\n x = start[0]; y = start[1]\n x1 = dest[0]; y1 = dest[1]\n\n xtrans = x\n ytrans = y\n\n return false if white_owned(x1,y1)\n\n #Getting the one space moves for the square around the rook\n if x1 == x+1 && y1 == y\n @black_piece.push(@b[x1][y1]) if black_owned(x1,y1)\n @b[x][y] = \" \"\n @wht_rook_left_move = true if x == 0 && y == 0\n @wht_rook_right_move = true if x == 7 && y == 0\n @b[x1][y1] = @WR\n return true\n elsif x1 == x-1 && y1 == y\n @black_piece.push(@b[x1][y1]) if black_owned(x1,y1)\n @b[x][y] = \" \"\n @wht_rook_left_move = true if x == 0 && y == 0\n @wht_rook_right_move = true if x == 7 && y == 0\n @b[x1][y1] = @WR\n return true\n elsif x1 == x && y1 == y+1\n @black_piece.push(@b[x1][y1]) if black_owned(x1,y1)\n @b[x][y] = \" \"\n @wht_rook_left_move = true if x == 0 && y == 0\n @wht_rook_right_move = true if x == 7 && y == 0\n @b[x1][y1] = @WR\n return true\n elsif x1 == x && y1 == y-1\n @black_piece.push(@b[x1][y1]) if black_owned(x1,y1)\n @b[x][y] = \" \"\n @wht_rook_left_move = true if x == 0 && y == 0\n @wht_rook_right_move = true if x == 7 && y == 0\n @b[x1][y1] = @WR\n return true\n end\n\n #The spaces that are +1 further away\n if x1 > x+1 && y1 == y\n while xtrans < x1-1 do\n xtrans += 1\n if @b[xtrans][ytrans] != \" \"\n return false #blockaded!\n end\n end\n @black_piece.push(@b[x1][y1]) if black_owned(x1,y1)\n @b[x][y] = \" \"\n @wht_rook_left_move = true if x == 0 && y == 0\n @wht_rook_right_move = true if x == 7 && y == 0\n @b[x1][y1] = @WR\n return true\n elsif x1 < x-1 && y1 == y\n while xtrans > x1+1 do\n xtrans -= 1\n if @b[xtrans][ytrans] != \" \"\n return false #blockaded!\n end\n end\n @black_piece.push(@b[x1][y1]) if black_owned(x1,y1)\n @b[x][y] = \" \"\n @wht_rook_left_move = true if x == 0 && y == 0\n @wht_rook_right_move = true if x == 7 && y == 0\n @b[x1][y1] = @WR\n return true\n elsif x1 == x && y1 > y+1\n while ytrans < y1-1 do\n ytrans += 1\n if @b[xtrans][ytrans] != \" \"\n return false #blockaded!\n end\n end\n @black_piece.push(@b[x1][y1]) if black_owned(x1,y1)\n @b[x][y] = \" \"\n @wht_rook_left_move = true if x == 0 && y == 0\n @wht_rook_right_move = true if x == 7 && y == 0\n @b[x1][y1] = @WR\n return true\n elsif x1 == x && y1 < y-1\n while ytrans > y1+1 do\n ytrans -= 1\n if @b[xtrans][ytrans] != \" \"\n return false #blockaded!\n end\n end\n @black_piece.push(@b[x1][y1]) if black_owned(x1,y1)\n @b[x][y] = \" \"\n @wht_rook_left_move = true if x == 0 && y == 0\n @wht_rook_right_move = true if x == 7 && y == 0\n @b[x1][y1] = @WR\n return true\n end\n return false\n end", "def valid_move?(board,index)\n #arrayIndex = index.to_i - 0\n if index.between?(0, 8) && !position_taken?(board,index)\n true\n else\n false\n\n\n\n\n end\n\nend", "def update_board\n #clear previous move_list from all pieces\n @board.each do |row|\n row.each do |col|\n col.move_list = [] if !col.nil?\n end\n end\n #clear previous state of @all_pieces\n @all_pieces = []\n #adds every piece obj to all_pieces instance variable\n @board.each do |row|\n row.each do |col|\n @all_pieces << col if !col.nil?\n end\n end\n #give each piece a copy of the board state\n #then allow generate_moves method to come up with a list of possible moves\n #based on that board state\n @all_pieces.each do |n|\n n.board = self\n n.generate_moves\n end\n #add this state to the board_history instance variable\n @board_history << @board\n end", "def test_black_move(st_x, st_y, type, moves)\n \tmoves.each do |move|\n \t mv_x, mv_y = move\n \t if legal_black_move(st_x, st_y, mv_x, mv_y, @game.board)\n \t \t@game.board[st_y][st_x] = 0\n \t \t@game.board[mv_y][mv_x] = 1\n if king_me(mv_x, mv_y, type)\n @game.turn_count = 2\n @game.save\n return {:board => @game.board, :turn_count => @game.turn_count, :message_type => 1, :message => \"Move successful, you now have a king!\"}\n end\n \t else\n \t \treturn {:board => @game.board, :turn_count => @game.turn_count, :message_type => 0, :message => \"Move unsuccessful\"}\n \t end\n \tend\n @game.turn_count = 2\n @game.save\n {:board => @game.board, :turn_count => @game.turn_count, :message_type => 1, :message => \"Move successful\"}\n end", "def moved_into_check?(beg, dest, color)\n \ttemp_board = TemporaryBoard.new\n \tdupe = Marshal.load(Marshal.dump(@board.state))\n \t\n \tdupe[dest[0]][dest[1]] = dupe[beg[0]][beg[1]]\n \tdupe[beg[0]][beg[1]] = \" \"\n\n \ttemp_board.state = dupe\n \tking_location = temp_board.find_king(color)\n \ttemp_board.check_if_check(king_location, color)\n end", "def valid_move?(board,index)\n if index < 0\n false\n else\n if index > 8\n false\n else\n !position_taken?(board,index)\n end\n end\nend", "def update_board(move)\n for i in 0...@board.length\n if move == @board[i]\n # replaces number with either X or O\n @board[i] = @taken[move]\n end\n end\n end", "def checkmate?(from_1, piece_1)\n all_possible_moves = []\n board.game_board.each_with_index do |row, x|\n row.each_with_index do |_col, y|\n piece = board.game_board[x][y]\n from = x, y\n next unless piece != ' ' && piece.color == current_player.color\n\n @final << final_mate?(from_1, piece_1, all_possible_moves)\n piece&.starting_moves(from, _to = nil)\n possible_moves = piece.moves.uniq\n until possible_moves.empty?\n if valid_piece_move?(from, possible_moves.first, piece)\n all_possible_moves << possible_moves.first unless possible_moves.first == []\n end\n possible_moves.shift\n end\n end\n end\n end", "def check_board\n #Checks 1 of 8 conditions - Top row horizontal\n if $game_board[:A1] == \"X\" && $game_board[:A2] == \"X\" && $game_board[:A3] == \"X\"\n puts \"We have a winner! Player 1!\"\n $game_status = \"winner\" #This will add a value to the empty array, which our runner method will be on the lookout for.\n end\n if $game_board[:A1] == \"O\" && $game_board[:A2] == \"O\" && $game_board[:A3] == \"O\"\n puts \"We have a winner! Player 2!\"\n $game_status = \"winner\"\n end\n\n #checks 2 of 8 conditions - Middle row horizontal\n if $game_board[:B1] == \"X\" && $game_board[:B2] == \"X\" && $game_board[:B3] == \"X\"\n puts \"We have a winner! Player 1!\"\n $game_status = \"winner\"\n end\n if $game_board[:B1] == \"O\" && $game_board[:B2] == \"O\" && $game_board[:B3] == \"O\"\n puts \"We have a winner! Player 2!\"\n $game_status = \"winner\"\n end\n\n #checks 3 of 8 conditions - Bottom row horizontal\n if $game_board[:C1] == \"X\" && $game_board[:C2] == \"X\" && $game_board[:C3] == \"X\"\n puts \"We have a winner! Player 1!\"\n $game_status = \"winner\"\n end\n if $game_board[:C1] == \"O\" && $game_board[:C2] == \"O\" && $game_board[:C3] == \"O\"\n puts \"We have a winner! Player 2!\"\n $game_status = \"winner\"\n end\n\n #checks 4 of 8 conditions - First column vertical\n if $game_board[:A1] == \"X\" && $game_board[:B1] == \"X\" && $game_board[:C1] == \"X\"\n puts \"We have a winner! Player 1!\"\n $game_status = \"winner\"\n end\n if $game_board[:A1] == \"O\" && $game_board[:B1] == \"O\" && $game_board[:C1] == \"O\"\n puts \"We have a winner! Player 2!\"\n $game_status = \"winner\"\n end\n\n #checks 5 of 8 conditions - Second column vertical\n if $game_board[:A2] == \"X\" && $game_board[:B2] == \"X\" && $game_board[:C2] == \"X\"\n puts \"We have a winner! Player 1!\"\n $game_status = \"winner\"\n end\n if $game_board[:A2] == \"O\" && $game_board[:B2] == \"O\" && $game_board[:C2] == \"O\"\n puts \"We have a winner! Player 2!\"\n $game_status = \"winner\"\n end\n\n #checks 6 of 8 conditions - Third column vertical\n if $game_board[:A3] == \"X\" && $game_board[:B3] == \"X\" && $game_board[:C3] == \"X\"\n puts \"We have a winner! Player 1!\"\n $game_status = \"winner\"\n end\n if $game_board[:A3] == \"O\" && $game_board[:B3] == \"O\" && $game_board[:C3] == \"O\"\n puts \"We have a winner! Player 2!\"\n $game_status = \"winner\"\n end\n\n #checks 7 of 8 conditions - Diagonal 1\n if $game_board[:A1] == \"X\" && $game_board[:B2] == \"X\" && $game_board[:C3] == \"X\"\n puts \"We have a winner! Player 1!\"\n $game_status = \"winner\"\n end\n if $game_board[:A1] == \"O\" && $game_board[:B2] == \"O\" && $game_board[:C3] == \"O\"\n puts \"We have a winner! Player 2!\"\n $game_status = \"winner\"\n end\n\n #checks 8 of 8 conditions - Diagonal 2\n if $game_board[:A3] == \"X\" && $game_board[:B2] == \"X\" && $game_board[:C1] == \"X\"\n puts \"We have a winner! Player 1!\"\n $game_status = \"winner\"\n end\n if $game_board[:A3] == \"O\" && $game_board[:B2] == \"O\" && $game_board[:C1] == \"O\"\n puts \"We have a winner! Player 2!\"\n $game_status = \"winner\"\n end\n\n #checks for a draw\n if $game_board.has_value?(nil) == false \n puts \"It's a draw! Game over, man!\"\n $game_status = \"draw\"\n end\n\nend", "def perform_move(move)\n start_location = move[0]\n destination = move[1]\n i,j = start_location\n a,b = destination\n jumped = false\n #unless on_board?(destination)\n #raise error\n\n piece = @rows[i][j]\n all_possible_moves = piece.slide_moves(@rows) + piece.jump_moves(@rows)\n\n unless !all_possible_moves.include?(destination)#change to throw error\n\n jump = piece.jump_moves(@rows)\n if jump.include?(destination)\n jumped = true\n #removes jumped piece from board\n add = (piece.color == :white ? -1 : 1)\n if destination[1] > start_location[1]\n middle_b = destination[1] - 1\n middle_a = destination[0] + add\n delete_piece = @rows[middle_a][middle_b]\n delete_piece.location = nil\n @rows[middle_a][middle_b] = nil\n else\n middle_b = destination[1] + 1\n middle_a = destination[0] + add\n delete_piece = @rows[middle_a][middle_b]\n delete_piece.location = nil\n @rows[middle_a][middle_b] = nil\n end\n end\n\n @rows[i][j] = nil\n piece.location = [a,b]\n @rows[a][b] = piece\n end\n #checks if moved piece should be kinged, if so sets king to true\n piece.make_king\n if jumped\n #go_again unless (@rows[a][b]).jump_moves(@rows).nil?\n end\n end", "def testing_checkmate(board)\n\n test_pieces = [\n King.new(:w, [0,0], board),\n King.new(:b, [1,0], board),\n Queen.new(:b, [0,1], board)\n ]\n\n test_pieces.each do |test_piece|\n board[test_piece.position] = test_piece\n end\n\n board\n\nend", "def valid_move?(board, index)\n array = index.between?(0,8)\n if def position_taken?(board, array)\n (board [array] == \" \") || (board [array] == \"\") || (board [array] == nil )\n return true\n end\n if board[index] == \" \"\n return true\n end\nend\n\nend", "def valid_move?(board, index)\n #this first if statement is checking if the index is on the board and if the position has been taken\n if index.between?(0,8) && position_taken?(board, index) == false\n p true\n elsif index > 9 || index < 0\n p false\n elsif position_taken?(board, index) == true\n p false\n end\nend", "def get_full_move\n puts \"Action Types: E to explore a tile and F to toggle a flag\".white.bold\n puts \"Enter a row, column, and action type separated by spaces:\".white.bold\n input = gets.chomp.split\n pos, action = input[0..1].map { | num | num.to_i - 1 }, input[-1]\n until valid_pos?(pos) && valid_action?(action)\n system(\"clear\")\n @board.render\n puts \"Full moves need a row, column and action type\".light_red.bold\n puts \"Action Types: E to explore a tile and F to toggle a flag\".white.bold\n puts \"Enter a row, column, and action type separated by spaces:\".white.bold\n input = gets.chomp.split\n pos, action = input[0..1].map { | num | num.to_i - 1 }, input[-1]\n end\n input\n end", "def make_move\n\n\n candidates = []\n surface_level.each do |pos|\n\n row, col = pos\n\n # if placing this tile leads the ai to win then thats good\n score = evaluate_position_as @ai, row, col, @ai.win_conditions[0], 2\n\n # if placing tile, enables the player to place a tile above us and win, then bad\n score += evaluate_position_as @player, row + 1, col, @player.win_conditions[0], -1\n @board.data[row][col] = nil\n\n if row + 1 != @row\n @board.data[row + 1][col] = nil\n end\n\n # if player places this position and enables him to win, dont let him.\n score += evaluate_position_as @player, row, col, @player.win_conditions[0], 0.8\n @board.data[row][col] = nil\n\n\n # if ai places at this tile and causes player to win, dont palce it there\n score += evaluate_position_as @ai, row, col, @player.win_conditions[0], -2\n\n # if player plays it there and causes him to get close to win conditon, dont palce it there\n score += evaluate_position_as @player, row, col, @player.win_conditions[0][1..-1], 0.3\n @board.data[row][col] = nil\n\n\n score += evaluate_position_as @player, row, col, @player.win_conditions[0][0..-2], 0.3\n @board.data[row][col] = nil\n\n candidates << [row, col, score]\n\n end\n\n # signals that it cannot make a move, the ai\n if candidates == []\n return -1\n end\n\n # sort by best candidate\n sorted = candidates.sort {|a,b| b[2] <=> a[2]}\n\n return select_candidate sorted\n\n end", "def valid_move?(board, i)\n i.integer? &&\n i <= 8 && i >= 0 &&\n !position_taken?(board, i)\nend", "def calculate_moves(piece, location)\n @x = location[0].to_i\n @y = location[1].to_i\n @possible_moves = []\n\n def add_straight_line_moves(index)\n move = \"#{@x + (index + 1)}#{@y}\" # Right\n @possible_moves << move unless path_blocked?(move) || out_of_bounds?(move) ||\n friendly_piece?(move)\n move = \"#{@x}#{@y + (index + 1)}\" # Up\n @possible_moves << move unless path_blocked?(move) || out_of_bounds?(move) ||\n friendly_piece?(move)\n move = \"#{@x - (index + 1)}#{@y}\" # Left\n @possible_moves << move unless path_blocked?(move) || out_of_bounds?(move) ||\n friendly_piece?(move)\n move = \"#{@x}#{@y - (index + 1)}\" # Down\n @possible_moves << move unless path_blocked?(move) || out_of_bounds?(move) ||\n friendly_piece?(move)\n end\n\n def add_diagonal_moves(index)\n move = \"#{@x + (index + 1)}#{@y + (index + 1)}\" # Up right\n @possible_moves << move unless path_blocked?(move) || out_of_bounds?(move) ||\n friendly_piece?(move)\n move = \"#{@x - (index + 1)}#{@y - (index + 1)}\" # Down left\n @possible_moves << move unless path_blocked?(move) || out_of_bounds?(move) ||\n friendly_piece?(move)\n move = \"#{@x + (index + 1)}#{@y - (index + 1)}\" # Down right\n @possible_moves << move unless path_blocked?(move) || out_of_bounds?(move) ||\n friendly_piece?(move)\n move = \"#{@x - (index + 1)}#{@y + (index + 1)}\" # Up left\n @possible_moves << move unless path_blocked?(move) || out_of_bounds?(move) ||\n friendly_piece?(move)\n end\n\n case piece\n\n when \"WhitePawn\"\n # 1 step forward\n move = \"#{@x}#{@y + 1}\"\n @possible_moves << move unless @board[move] != nil \n # Attack forward right\n move = \"#{@x + 1}#{@y + 1}\"\n if @board[move] != nil && @board[move].team == @current_opponent \n @possible_moves << move \n end \n # Attack forward left\n move = \"#{@x - 1}#{@y + 1}\"\n if @board[move] != nil && @board[move].team == @current_opponent \n @possible_moves << move \n end \n # 2 steps forward if its in the starting point\n move = \"#{@x}#{@y + 2}\"\n @possible_moves << move unless @y != 2 || path_blocked?(move) ||\n @board[move] != nil\n\n when \"BlackPawn\"\n # Same moves of the WhitePawn but reversed\n move = \"#{@x}#{@y - 1}\"\n @possible_moves << move unless @board[move] != nil \n \n move = \"#{@x + 1}#{@y - 1}\"\n if @board[move] != nil && @board[move].team == @current_opponent\n @possible_moves << move \n end\n \n move = \"#{@x - 1}#{@y - 1}\"\n if @board[move] != nil && @board[move].team == @current_opponent\n @possible_moves << move\n end\n \n move = \"#{@x}#{@y - 2}\"\n @possible_moves << move unless @y != 7 || path_blocked?(move) || @board[move]\n\n when \"Rook\"\n # 7 is the max distance between squares\n # The method is called 7 times to have a list of all possible targets ready\n 7.times { |index| add_straight_line_moves(index) }\n\n when \"Knight\"\n knight_moves = [[@x + 1, @y + 2], [@x + 2, @y + 1], \n [@x + 2, @y - 1], [@x + 1, @y - 2], \n [@x - 1, @y - 2], [@x - 2, @y - 1], \n [@x - 2, @y + 1], [@x - 1, @y + 2]]\n \n knight_moves.each do |move|\n move = \"#{move[0]}#{move[1]}\" \n @possible_moves << move unless out_of_bounds?(move) || friendly_piece?(move)\n end\n\n when \"Bishop\"\n 7.times { |index| add_diagonal_moves(index) }\n \n when \"Queen\"\n 7.times do |index|\n add_straight_line_moves(index)\n add_diagonal_moves(index)\n end\n \n when \"King\"\n # The King can move only 1 square away so the methods are called just once\n add_straight_line_moves(0)\n add_diagonal_moves(0)\n else\n\n end\n end", "def valid_move?(board,index)\n if index.between?(0,8) && !position_taken?(board,index)\n true\n else\n false\n end\n\nend", "def test_red_move(st_x, st_y, type, moves)\n moves.each do |move|\n mv_x, mv_y = move\n if legal_red_move(st_x, st_y, mv_x, mv_y, @game.board)\n @game.board[st_y][st_x] = 0\n @game.board[mv_y][mv_x] = 2\n if king_me(mv_x, mv_y, type)\n @game.turn_count = 1\n @game.save\n return {:board => @game.board, :turn_count => @game.turn_count, :message_type => 1, :message => \"Move successful, you now have a king!\"}\n end\n else\n return {:board => @game.board, :message_type => 0, :message => \"Move unsuccessful\"}\n end\n end\n @game.turn_count = 1\n @game.save\n {:board => @game.board, :turn_count => @game.turn_count, :message_type => 1, :message => \"Move successful\"}\n end", "def valid_move?(move)\n # Array of all posiible moves , check the board and map out the possible moves from there.\n end", "def checkMill(piece)\n\n # each piece can be in a verticle and horizontal mill.\n # given a coordinate (letter and number) a verticle mill can be determined by searching the array for every number value that has the letter coordinate.\n # e.g if (d,2) is passed in, then to see if there is a vericle mill (d,1), (d,2) and (d,3) will be found in the array of locations\n # call selectPiece() on each space, if any spaces are empty there is no mill\n # call piece.colour, if all 3 pieces are the same colour of the passed piece, then it is a Mill, Return True\n # check for a horizontal mill. horizontal mill can be determined by searching the array for every coordinate that shares the number.\n # e.g if (G,1) is passed in, then to see if there is a vericle mill (G,1), (D,1) and (A,1) will be found in the array of locations\n # call selectPiece() on each space, if any spaces are empty there is no mill\n # call piece.colour, if all 3 pieces are the same colour of the passed piece, then it is a Mill, Return True\n # there will be a special consideration for any piece containing 4. \n\n # location of piece\n if piece == nil\n return false\n end\n\n x_coordinate = piece.location.coordinates[0]\n y_coordinate = piece.location.coordinates[1]\n\n hMill = false\n vMill = false\n\n verticalMill = []\n horizontalMill = []\n\n\n \n #horisontal\n @board.locations.each do |row|\n row.each do |location|\n \n if location != nil && !location.isEmpty() && location.coordinates[0] == x_coordinate\n if x_coordinate == 3 && y_coordinate <= 3\n # only add piece if it is in row 3 column 0-3. \n if location.coordinates[1] <= 3\n horizontalMill.push(location.piece)\n end\n elsif x_coordinate == 3 && y_coordinate >= 4\n # only add piece if it is in row 3 column 4-6. \n if location.coordinates[1] >= 4\n horizontalMill.push(location.piece)\n end\n else\n # will add the piece if its not in the strange row\n horizontalMill.push(location.piece)\n end\n end \n end\n end\n\n #verticle\n @board.locations.each do |row|\n row.each do |location| \n if location != nil && !location.isEmpty() && location.coordinates[1] == y_coordinate\n if y_coordinate == 3 && x_coordinate <= 3\n # only add piece if it is in column 3 row 0-3. \n if location.coordinates[0] <= 3\n verticalMill.push(location.piece)\n end\n elsif y_coordinate == 3 && x_coordinate >= 4\n # only add piece if it is in row 3 column 4-6. \n if location.coordinates[0] >= 4\n verticalMill.push(location.piece)\n end\n else\n # will add the piece if its not in the strange row\n verticalMill.push(location.piece)\n end\n end\n end\n end\n\n\n if verticalMill.length > 3\n puts \"I made an oopsy this should not happen. test this later im to lazy now\"\n elsif verticalMill.length == 3\n # check for mill\n # assume there is a mill\n vMill = true\n for millPiece in verticalMill\n if !(millPiece.colour() == piece.colour())\n vMill = false\n end\n end\n else\n # there is no vertical mill\n vMill = false\n end\n\n\n if horizontalMill.length > 3\n puts \"Should not happen if it does i made a mistake\" \n elsif horizontalMill.length == 3\n # check for mill\n # assume there is a mill\n hMill = true\n for millPiece in horizontalMill\n if !(millPiece.colour() == piece.colour())\n hMill = false\n end\n end\n else\n # there is no vertical mill\n hMill = false\n end\n \n if vMill || hMill\n return true\n else\n return false\n end\n end", "def valid_move?(board,index)\n# The user_input was accepted, converted to an integer and reduced by 1 in #input_to_index. Now you are testing to make sure\n# that the value of the index is within the confines of the board array whose elements are 0-8. It also requires NOT #position_taken\n# which means that the test that was done in position_taken which resulted in TRUE is turned into a NOT by using !position_taken\nif index .between?(0,8) && !position_taken?(board,index)\n true\nend\n\nend", "def check\n call\n @bingo_board.each do |sub_array|\n case @call_column\n when \"B\"\n sub_array[0] == @call_number ? sub_array[0] = \"X\" : false\n when \"I\"\n sub_array[1] == @call_number ? sub_array[1] = \"X\" : false\n when \"N\"\n sub_array[2] == @call_number ? sub_array[2] = \"X\" : false\n when \"G\"\n sub_array[3] == @call_number ? sub_array[3] = \"X\" : false\n when \"O\"\n sub_array[4] == @call_number ? sub_array[4] = \"X\" : false\n else\n puts \"Not there!\"\n end\n end\n end", "def valid_move?(board, index)\n# binding.pry\n index.between?(0,8) && !position_taken?(board, index)\nend", "def process_pgn_moves(arr_raw_pgn_move)\r\n #@color_on_turn = :white\r\n arr_raw_pgn_move.each do |move_str|\r\n \r\n if move_str == \"1-0\" or \r\n move_str == \"0-1\" or\r\n move_str == \"1/2-1/2\"\r\n @current_match.set_result(move_str)\r\n break\r\n end\r\n argument = trasform_pgn_move_inmymove(move_str)\r\n \r\n @current_match.add_pgn_move(move_str)\r\n @current_match.add_move(argument)\r\n \r\n do_the_move(argument)\r\n swap_color_on_turn\r\n end\r\n end", "def computer_places_piece!(brd)\n square = nil\n\n WINNING_LINES.each do |line|\n square = find_two_sqrs(line, brd, PLAYER_MARKER)\n break if square\n end\n\n if !square\n WINNING_LINES.each do |line|\n square = find_two_sqrs(line, brd, COMPUTER_MARKER)\n break if square\n end\n end\n\n if !square\n square = empty_squares(brd).sample\n end\n\n brd[square] = COMPUTER_MARKER\nend", "def movement_validation(player_mov)\n\t\tcorrect_mov = []\n\t\tpiece_movs = {\n\t\t\t\"king\" => [[0,1], [1,1], [1,0], [1,-1], [0,-1], [-1,-1], [-1,0], [-1,1]],\n\t\t\t\"knight\" => [[-2,1], [-2,-1], [-1,-2], [1,-2], [2,-1], [2,1], [1,2], [-1,2]],\n\t\t\t\"rook\" => [[0,1], [1,0], [0,-1], [-1,0]],\n\t\t\t\"bishop\" => [[1,1], [1,-1], [-1,-1], [-1,1]],\n\t\t\t\"queen\" => [[0,1], [1,1], [1,0], [1,-1], [0,-1], [-1,-1], [-1,0], [-1,1]],\n\t\t\t\"pawn\" =>\t[[0,1], [0,-1], [1,1], [-1,1], [1,-1], [-1,-1], [0,2], [0,-2]]\n\t\t}\n\t\t\n\t\t#if the final move equals to one of the moves of the king or knight pieces.\n\t\tif [\"king\", \"knight\"].include?(@piece_name)\n\t\t\t#iterates through each basic move of the corresponding piece.\n\t\t\tpiece_movs[@piece_name].each do |mov|\n\t\t\t\t#if the final node color is nil or different from the start node color.\n\t\t\t\tif mov == player_mov && (@final_node.color != @current_player.color || @final_node.color == nil)\n\t\t\t\t\treturn true\n\t\t\t\t#if check analysis is in progress, the final node color equals to the current player color and the final node name is king.\n\t\t\t\telsif (mov == player_mov && @check_on_curse == true) && (@final_node.color == @current_player.color && @final_node.name == \"king\") \n\t\t\t\t\treturn true\t\t\t\t\n\t\t\t\tend\n\t\t\tend\n\t\t#if the final move equals to one of the moves of the rook, bishop or queen pieces.\n\t\telsif [\"rook\", \"bishop\", \"queen\"].include?(@piece_name)\n\t\t\t#iterates through each basic move of the corresponding piece.\n\t\t\tpiece_movs[@piece_name].each do |mov|\n\t\t\t\t#iterates through number 1 to 7 multiplying the basics pieces moves and saving it.\n\t\t\t\t(1..7).each do |num|\n\t\t\t\t\titeration = [mov[0]*num, mov[1]*num]\n\t\t\t\t\t#if the final move equals to multiplication of a basic move by a certain number and the way to the destination square is clear.\n\t\t\t\t\tif iteration == player_mov && cleared_way?(mov) == true\t\t\t\n\t\t\t\t\t\treturn true\t\t\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t#if start node name is a pawn piece.\n\t\telsif @piece_name == \"pawn\"\n\t\t\t#one positive rank move from a white piece to a nil node.\n\t\t\tif piece_movs[\"pawn\"][0].include?(player_mov) && (@final_node.color == nil && @start_node.color == \"white\")\n\t\t\t\treturn true\n\t\t\t#one negative rank move from a black piece to a nil code.\n\t\t\telsif piece_movs[\"pawn\"][1].include?(player_mov) && (@final_node.color == nil && @start_node.color == \"black\")\n\t\t\t\treturn true\t\n\t\t\t#a positive diagonal move from a white piece to a node of the opponent color.\t\n\t\t\telsif (piece_movs[\"pawn\"][2..3].include?(player_mov) && @start_node.color == \"white\") && (@final_node.color != @current_player.color && @final_node.color != nil)\n\t\t\t\treturn true\t\n\t\t\t#a negative diagonal move from a black piece to a node of the opponent color.\n\t\t\telsif (piece_movs[\"pawn\"][4..5].include?(player_mov) && @start_node.color == \"black\") && (@final_node.color != @current_player.color && @final_node.color != nil)\n\t\t\t\treturn true\n\t\t\t#a double positive rank move from a white piece on rank 2 position to a nil color node.\n\t\t\telsif (piece_movs[\"pawn\"][6] == player_mov && @final_node.color == nil) && (@start_node.color == \"white\" && @first_coord_convertion[1] == \"2\")\n\t\t\t\treturn true\n\t\t\t#a double negative rank move from a black piece on rank 7 position to a nil color node.\n\t\t\telsif (piece_movs[\"pawn\"][7] == player_mov && @final_node.color == nil) && (@start_node.color == \"black\" && @first_coord_convertion[1] == \"7\")\n\t\t\t\treturn true\t\n\t\t\tend\n\t\tend\n\t\treturn false\n\tend", "def valid_move?(board, i)\n if i.between?(0,8) && !position_taken?(board, i)\n true\n end\n end", "def process_pgn_moves(arr_raw_pgn_move)\n #@color_on_turn = :white\n arr_raw_pgn_move.each do |move_str|\n \n if move_str == \"1-0\" or \n move_str == \"0-1\" or\n move_str == \"1/2-1/2\"\n @current_match.set_result(move_str)\n break\n end\n argument = trasform_pgn_move_inmymove(move_str)\n \n @current_match.add_pgn_move(move_str)\n @current_match.add_move(argument)\n \n do_the_move(argument)\n swap_color_on_turn\n end\n end", "def move_piece(start, dest)\n\n determine_moves(start)\n\n #puts \"dest movem valid?: #{@spaces[start].moveset.include?(dest)}\"\n\n #puts \"dest atack valid?: #{@spaces[start].attackset.include?(dest)}\"\n return false if @spaces[start].color != @player || \n @spaces[start].moveset.include?(dest).! and @spaces[start].attackset.include?(dest).!\n\n #TODO #return false if in_check\n\n @spaces[dest] = @spaces[start]\n\n @spaces[dest].location = dest\n\n @spaces[start] = nil\n\n return true\n\n end", "def set_piece(player,location) #takes the arguments player and location\n\t\t@piece=player.piece #defines piece as the player's number (either 1 or 2)\n\t\trow=(location-1)/4 #takes the value of location (1-16) and converts it into a row coordinate 0, 1, 2, or 3\n\t\tcolumn=(location+3)%4 #takes the value of location (1-16) and converts it into a column coordinate 0, 1, 2, or 3\n\t\t@board[row][column]=@piece #defines the cell that the player has just selected as the player's number (1 or 2)\n\t\t@size+=1 #we count each move after its been made which is used in the function below, check_full?\n\tend", "def solution_checker(array)\n if array.length > 1\n # Create a board that can be manipulated without affecting the original board\n internal_board = []\n column_counter = 1\n row_counter = 1\n 4.times do\n 4.times do\n internal_board.push(Square.new([column_counter, row_counter]))\n column_counter = column_counter + 1\n end\n row_counter = row_counter + 1\n column_counter = 1\n end\n #Label squares on the board as occupied\n array.each do |piece|\n square = internal_board.find {|s| s.location == piece.location}\n square.occupied = true\n square.piece = piece\n end\n array.each_with_index do |piece, index|\n if array.include?(piece) && piece != array.last\n original_square = internal_board.find {|s| s.location == piece.location}\n blocker = piece.impediments?([(array[index + 1]).column, (array[index + 1]).row], internal_board)\n if blocker\n break\n elsif piece.move([(array[index + 1]).column, (array[index + 1]).row])\n captured_piece = array[index + 1]\n array.uniq!{|piece| piece.location}\n original_square.occupied = false\n original_square.piece = nil\n new_moves = array.permutation.to_a\n new_moves.each do |new_array|\n new_array.map {|a| a.dup}\n end\n new_moves.each do |new_array|\n solution_checker(array)\n end\n else\n break\n end\n else\n break\n end\n end\n end\nend", "def get_valid_move\nwhile true\nmove = get_move\nif valid_move?(move)\nreturn move\nelse\nputs \"Position #{ move + 1 } is occupied...Enter a free position\"\nend\nend\nend", "def valid_move?(board, index)\n if index.between?(0, 8) && position_taken?(board, index) == false\n true\n else\n false\n end\nend", "def draw_pieces\n CHECKERS_HEIGHT.times do |x|\n CHECKERS_WIDTH.times do |y|\n @pieces[x][y].remove unless @pieces[x][y].nil?\n @pieces[x][y] = draw_piece(x,y,@board.state[x][y]) unless @board.state[x][y].nil?\n end\n end\nend", "def pre_check_legal_moves(state)\n player = state[:player]\n piece_list = state[:pieces][player]\n move_list = []\n # Loop over pieces\n piece_list.each do |piece|\n move_list += piece.legal_moves(state)\n end\n move_list\n end", "def move(dest, crown?) # called in :turn > active_piece.move()\n # updates dest in board array\n # updates piece with new coordinates\n # updates jumped pieces?\nend", "def valid_move?(board, index)\nif index.between?(0,8) && !position_taken?(board, index)\n true\nelse\n false\nend\nend", "def valid_move?(board, index)\n\n # if (0..8).to_a.include?(!index)\n if !index.between?(0, 8)\n nil\n elsif position_taken?(board, index) == false\n true\n end\n\n # if !board[index]\n # false\n # end\n\nend", "def computer_places_piece!(brd)\n square = nil\n\n # offensive move\n Board::WINNING_LINES.each do |line|\n square = find_at_risk_square(line, brd, Board::CPU_MARKER)\n break if square\n end\n\n # defensive move\n if !square\n Board::WINNING_LINES.each do |line|\n square = find_at_risk_square(line, brd, Board::PLAYER_MARKER)\n break if square\n end\n end\n\n # optimized first move, choose the center\n if empty_squares(brd).include?(5)\n square = 5\n end\n\n # neutral move\n if !square\n square = empty_squares(brd).sample\n end\n\n brd.position_values[square] = Board::CPU_MARKER\n end", "def valid_move?(board,index = input_to_index(tato))\n if index.between?(0,8) && !position_taken?(board,index)\n true\n else\n false\n end\nend" ]
[ "0.7398737", "0.73163825", "0.71943885", "0.7080519", "0.7018993", "0.6913825", "0.69096357", "0.68567437", "0.68085223", "0.68001693", "0.67210996", "0.66921854", "0.66895366", "0.6625611", "0.66220367", "0.66122055", "0.6593655", "0.6593512", "0.6591591", "0.6573936", "0.65674746", "0.65382946", "0.65313894", "0.64969844", "0.6486958", "0.64860475", "0.64725935", "0.64669514", "0.6460801", "0.6455249", "0.64527583", "0.6445852", "0.6440123", "0.6434027", "0.6430429", "0.6428367", "0.6425829", "0.64247704", "0.6414339", "0.64065593", "0.63860404", "0.63833266", "0.63757485", "0.637517", "0.63668835", "0.6366047", "0.63523793", "0.63511205", "0.6350517", "0.63488936", "0.63458824", "0.6341141", "0.63410527", "0.6339502", "0.63244873", "0.6323671", "0.63176715", "0.6316192", "0.6312974", "0.63094306", "0.630647", "0.629761", "0.6287964", "0.6286563", "0.6284911", "0.62841547", "0.62831783", "0.6282921", "0.6279905", "0.6278304", "0.627431", "0.6272463", "0.62717533", "0.6268119", "0.6261908", "0.62607116", "0.6259182", "0.62583953", "0.6248414", "0.62462014", "0.62422043", "0.6240578", "0.6231303", "0.6227086", "0.6220869", "0.6216386", "0.6214184", "0.6208087", "0.62078726", "0.62028486", "0.6195211", "0.61940986", "0.6193807", "0.6193266", "0.61906886", "0.61886424", "0.6187994", "0.6186993", "0.61829543", "0.6179243" ]
0.7112913
3
GET /pincodes GET /pincodes.json
def index @pincodes = Pincode.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @pinns = Pinn.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pinns }\n end\n end", "def show\n @pin = Pin.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pin }\n end\n end", "def show\n @pin = Pin.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pin }\n end\n end", "def show\n @pin = Pin.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pin }\n end\n end", "def index\n @codes = Code.public_codes\n end", "def show\n @pinn = Pinn.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pinn }\n end\n end", "def show\n @inkpmscode = Inkpmscode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inkpmscode }\n end\n end", "def index\n @post_codes = PostCode.all\n end", "def index\n @pins = Pin.all\n end", "def index\n \n \n @pins = Pin.search(params[:search])\n \n \n \n @pins = @pins.paginate(:page => params[:page], :per_page => 20)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pins }\n format.js\n end\n end", "def index\n @user_id = session[:user_id]\n @codes = Code.where('user_id = ? and is_deleted = ?', @user_id, false).order('LOWER(code)') #.find_by_user_id(@user_id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @codes }\n end\n end", "def index\n @pinimages = Pinimage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pinimages }\n end\n end", "def index\n @parking_codes = ParkingCode.all\n end", "def set_pincode\n @pincode = Pincode.find(params[:id])\n end", "def create\n @pincode = Pincode.new(pincode_params)\n \n respond_to do |format|\n if @pincode.save\n #format.html { redirect_to @pincode, notice: 'Pincode was successfully created.' }\n format.html { redirect_to @pincode}\n format.json { render :show, status: :created, location: @pincode }\n else\n format.html { render :new }\n format.json { render json: @pincode.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @codes = Code.all\n end", "def index\n @codes = Code.all\n end", "def index\n @codes = Code.all\n end", "def index\n @codes = Code.all\n end", "def show\n @postcode = Postcode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: admin_postcode_url }\n end\n end", "def show\n @code = Code.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @code }\n end\n end", "def show\n render json: @zipcode\n end", "def index\n @codeable = get_codeable\n @codes = @codeable.codes\n end", "def index\n @pins = Pin.all.order(\"created_at DESC\").paginate(:page => params[:page],:per_page => 10) \n respond_with(@pins)\n end", "def show\n @pinimage = Pinimage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pinimage }\n end\n end", "def index\n @codes = @page.codes.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @codes }\n end\n end", "def show\n @pin = Pin.find(params[:id])\n end", "def show\n @pointcode = Pointcode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pointcode }\n end\n end", "def index\n @secrate_codes = SecrateCode.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @secrate_codes }\n end\n end", "def show\n @pin = Pin.find(params[:id])\n\n end", "def list_pc_codes\n\treturn if authorise_for_web(program_name?,'read_pc_code') == false \n\n \tif params[:page]!= nil \n\n \t\tsession[:pc_codes_page] = params['page']\n\n\t\t render_list_pc_codes\n\n\t\t return \n\telse\n\t\tsession[:pc_codes_page] = nil\n\tend\n\n\tlist_query = \"@pc_code_pages = Paginator.new self, PcCode.count, @@page_size,@current_page\n\t @pc_codes = PcCode.find(:all,\n\t\t\t\t :limit => @pc_code_pages.items_per_page,\n\t\t\t\t :offset => @pc_code_pages.current.offset)\"\n\tsession[:query] = list_query\n\trender_list_pc_codes\nend", "def show\n @pin = Pin.find(params[:id])\n impressionist @pin\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pin }\n end\n end", "def code\n @code = params[:code]\n @token = request.headers[\"HTTP_X_API_POP_KEY\"]\n @ip = request.remote_ip\n\n begin\n\n #uniquement si le code est un entier\n @customer = Customer.find_by_code(@code)\n if @customer.blank?\n render json: {\n message: false,\n flag: :customer_not_found\n }\n else\n #on retourne les informations\n\n render json: {\n message: true,\n context: searchContext(@customer),\n name: @customer.name,\n second_name: @customer.second_name,\n marchand_id: @customer.authentication_token,\n date: Time.now.strftime(\"%d-%m-%Y à %H:%M:%S\"),\n expire: 5.minutes.from_now\n }\n end\n \n rescue ActiveRecord::RecordNotFound\n\n render json: {\n message: false,\n content: \"Utilisateur inconnu\"\n }\n \n end\n end", "def index\n @secret_codes = SecretCode.paginate(page: params[:page])\n end", "def show\n @code = Code.find_by_id_and_user_id(params[:id], session[:user_id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @code }\n end\n end", "def new\n\n @pin = Pin.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pin }\n end\n end", "def index\n @n_codes = NCode.all\n end", "def index\n @pins = Pin.includes(:user, :impressions,:comments).order(\"created_at desc\").page(params[:page]).per_page(10).search(params[:search])\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pins }\n format.js\n end\n end", "def update\n respond_to do |format|\n if @pincode.update(pincode_params)\n format.html { redirect_to @pincode, notice: 'Pincode was successfully updated.' }\n format.json { render :show, status: :ok, location: @pincode }\n else\n format.html { render :edit }\n format.json { render json: @pincode.errors, status: :unprocessable_entity }\n end\n end\n end", "def geoCode(postal)\n\turl = \"https://maps.googleapis.com/maps/api/geocode/json?address=\" + postal + \"&key=AIzaSyBZqs-MS-5WyI9s-eS2Bx3wEemC5gzlhqc\"\n\turi = URI(url)\n\tresponse = Net::HTTP.get(uri)\n\tgeoInfo = JSON.parse(response)\n\treturn geoInfo\nend", "def index\n @ticket_codes = TicketCode.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ticket_codes }\n end\n end", "def show\n @m_code = MCode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @m_code }\n end\n end", "def index\n\n if params[:search]\n @pins = Pin.search(params[:search]).order(\"created_at DESC\")\n else\n if request.fullpath.include?('pins/mypins')\n @pins = @current_user.pins.all\n else\n @pins = Pin.includes(:user).order(\"created_at DESC\")\n logger.debug \"All pins inspected: #{@pins.inspect}\"\n end\n end\n end", "def post_address\n postcode = params['value'].delete('- ')\n address = CoreService.get_address(postcode)\n\n respond_to do |format|\n format.json { render json: { success: true, address: address } }\n end\n end", "def show\n\n @pin = Pin.find(params[:id])\n @relative_pins = []\n if !@pin.category_id.blank?\n @relative_pins += Pin.where(category_id: @pin.category_id).where(\"id != ?\", @pin.id)\n end\n\n if !@pin.brand.blank?\n @relative_pins += Pin.where(brand: @pin.brand).where(\"id != ?\", @pin.id)\n end\n\n if !@pin.created_by.blank?\n @relative_pins += Pin.where(brand: @pin.brand).where(\"id != ?\", @pin.id)\n end\n\n @relative_pins.uniq!\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pin }\n end\n end", "def new\n @pinn = current_user.pinns.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pinn }\n end\n end", "def pincode_params\n params.require(:pincode).permit(:slot, :username, :pcode)\n end", "def search_by_zip_code\n zip_codes = []\n if not (term = params[:term].to_s.strip).blank? and term.to_i > 0\n zip_codes = ZipCode.find(:all, :conditions => [\"code = ?\", term])\n zip_codes.compact!\n end\n render :json => format_suggested_cities_by_zip_code(zip_codes).to_json\n end", "def code\n @json[:meta][:code]\n end", "def index\n @search = Pin.search do\n fulltext params[:search]\n with(:user_id, current_user.id)\n order_by(:created_at, :desc)\n paginate(page: params[:page], per_page: 30)\n end\n @pins = @search.results\n end", "def index\n @codes = Code.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @codes }\n end\n end", "def new\n @pin = current_user.pins.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pin }\n end\n end", "def pinyin char_code\n # look up in recent_table\n if char_code < 1000\n char_code = POLYGLOT_TMP[:RECENT][char_code-1][:char_code].to_i\n end\n\n uri = URI(\"http://www.hanviet.org/hv_timchu.php?unichar=#{char_code}\")\n res = Net::HTTP.get uri\n regex = /javascript:mandarin\\('([\\w]+)'\\)/ \n match = regex.match res\n return puts \"Can't find pinyin for char #{char_code}\" if match.nil?\n uchar = [char_code].pack \"U*\"\n puts \"#{uchar} #{match.to_a.last}\"\n end", "def index\n @zip_code_area_codes = ZipCodeAreaCode.all\n end", "def find_pin\n @pin = Pin.find(params[:id])\n end", "def new\n json_string = open(\"https://maps.googleapis.com/maps/api/place/textsearch/json?query=#{URI.escape(params[\"search\"])}&sensor=false&key=AIzaSyAuc-paMz_ShQYipaLv-7hp7Lp5RCjIalI\") { |f| f.read }\n @pin = Pin.new\n @results = JSON.parse(json_string)[\"results\"].map do |elem|\n {\n name: elem[\"formatted_address\"],\n latitude: elem[\"geometry\"][\"location\"][\"lat\"],\n longitude: elem[\"geometry\"][\"location\"][\"lng\"]\n }\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pin }\n end\n end", "def index\n @timerecord_codes = TimerecordCode.paginate(:page => params[:page], :per_page => per_page).order(sort_column + ' ' + sort_direction)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @timerecord_codes }\n end\n end", "def geocoder\n begin\n render(:json => open(\"#{GEOCODER_URL}&#{request.query_string}\"){|f| f.read})\n rescue SocketError\n render(:text => $!.to_s, :status => 500)\n end\n end", "def index\n @check_codes = CheckCode.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @check_codes }\n end\n end", "def index\n @pinyins = Pinyin.all\n end", "def showByPostcode\n postcode = PostCode.find_by(postCode_id:params[:post_code].to_i)\n date = params[:date]\n if postcode!=nil\n @locations=Location.where(\"postCode_id=?\",postcode)\n else\n @locations=[]\n end\n respond_to do |format|\n format.html\n format.json #json format is implemented in *.json.erb file\n end\n end", "def index\n @pins = Pin.all.order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 25)\n end", "def show\n @codesnippet = Codesnippet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @codesnippet }\n end\n end", "def index\n @reward_codes = RewardCode.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reward_codes }\n end\n end", "def create\n @pin = Pin.new(params[:pin])\n if @pin.name.blank?\n @pin.name = \"#{@pin.latitude}, #{@pin.longitude}\"\n json_string = open(\"http://maps.googleapis.com/maps/api/geocode/json?latlng=#{@pin.latitude},#{@pin.longitude}&sensor=true\") { |f| f.read }\n results = JSON.parse(json_string)[\"results\"]\n if results.size > 0 && ! results[0][\"formatted_address\"].empty?\n @pin.name = results[0][\"formatted_address\"]\n end\n end\n\n respond_to do |format|\n if @pin.save\n format.html { redirect_to @pin, notice: 'Pin was successfully created.' }\n format.json { render json: @pin, status: :created, location: @pin }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pin.errors, status: :unprocessable_entity }\n end\n end\n end", "def json\n url = 'http://feeds.pinboard.in/json/v1/u:' + @user\n resp = Net::HTTP.get_response(URI.parse(url))\n return resp.body\n end", "def index\n @snips = Snip.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @snips }\n end\n end", "def index\n auth_response = plaid_client.auth.get(access_token)\n render json: auth_response.to_json\n end", "def index\n @resolution_codes = ResolutionCode.all\n end", "def codes\n @codes ||= []\n end", "def search\n Api.search_all_apis params[:postcode]\n end", "def create\n @pin = Pin.new(pin_params)\n\n respond_to do |format|\n if @pin.save\n format.html { redirect_to @pin, notice: 'Pin was successfully created.' }\n format.json { render :show, status: :created, location: @pin }\n else\n format.html { render :new }\n format.json { render json: @pin.errors, status: :unprocessable_entity }\n end\n end\n end", "def map_code\n @map_code\n end", "def get_token(code)\n uri = URI.parse(URL[\"oauth_access\"])\n params = { :client_id => CLIENT_ID,\n :client_secret => CLIENT_SECRET,\n :code => code\n }\n uri.query = URI.encode_www_form( params )\n return JSON.parse(uri.open.read)\n end", "def product_codes\n data[:product_codes]\n end", "def show\n @code = @page.codes.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.js\n format.xml { render :xml => @code }\n end\n end", "def index\n @access_codes = AccessCode.all\n end", "def get_qrcodes\n @collection = Collection.find(params[:collection_id])\n @qrcodes = @collection.qrcodes\n respond_to do |format|\n format.html\n format.json { render json: [@collections, @qrcodes] }\n end\n end", "def index\n @webcodes = Webcode.all\n end", "def get_module_codes(year = CURRENT_YEAR, semester = CURRENT_SEMESTER)\n get \"#{format_year(year)}/#{semester}/moduleCodes.json\"\n end", "def codes; end", "def show\n @update_code = UpdateCode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @update_code }\n end\n end", "def index\n @promo_codes = PromoCode.all\n end", "def create\n @pin = current_user.pins.new(params[:pin])\n\n respond_to do |format|\n if @pin.save\n format.html { redirect_to @pin, notice: 'Pin was successfully created.' }\n format.json { render json: @pin, status: :created, location: @pin }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pin.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @buyer_leads_zip_code = BuyerLeadsZipCode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @buyer_leads_zip_code }\n end\n end", "def show\n @secrate_code = SecrateCode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @secrate_code }\n end\n end", "def show\n @post_code = PostCode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post_code }\n end\n end", "def index\n @hashcodes = @current_user.hashcodes\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @hashcodes }\n end\n end", "def index\n @offer_codes = OfferCode.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offer_codes }\n end\n end", "def verification_code\n user_id = params[:user_id]\n verification_code = params[:verification_code]\n response = User.verify_code(user_id, verification_code)\n render json: response\n end", "def new\n @inkpmscode = Inkpmscode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inkpmscode }\n end\n end", "def all_pcodes\n services.map{|el| el[:pcode]} \n end", "def get_pin=(get_pin)\n @oauth.get_pin = get_pin\n end", "def create\n @pin = current_user.pins.new(params[:pin])\n @pin.user_id = current_user.id\n @items_types = ITEM_TYPE_LIST\n\n respond_to do |format|\n if @pin.save\n format.html { redirect_to @pin, notice: 'Pin was successfully created.' }\n format.json { render json: @pin, status: :created, location: @pin }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pin.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pin = current_user.pins.new(params[:pin])\n \n\n respond_to do |format|\n if @pin.save\n format.html { redirect_to @pin, notice: 'Pin was successfully created.' }\n format.json { render json: @pin, status: :created, location: @pin }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pin.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @booking_postal_code = BookingPostalCode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @booking_postal_code }\n end\n end", "def create\n @pin = @current_user.pins.new(pin_params)\n\n respond_to do |format|\n if @pin.save\n format.html { redirect_to @pin, notice: 'Pin was successfully created.' }\n format.json { render :show, status: :created, location: @pin }\n else\n format.html { render :new }\n format.json { render json: @pin.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @pinrequest = Pinrequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @pinrequest }\n end\n end", "def index\n if filter_categories.blank?\n @pins = Pin.page(params[:page]).per_page(20).where(:publicgear => true).search(params[:search])\n else\n @pins = Pin.page(params[:page]).per_page(20).where(category: filter_categories, :publicgear => true).search(params[:search])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pins }\n end\n end", "def index\n @example_codes = ExampleCode.all\n end" ]
[ "0.66209865", "0.65024006", "0.64920735", "0.64920735", "0.64606917", "0.63331336", "0.6213703", "0.6092277", "0.604419", "0.60405517", "0.6034724", "0.600906", "0.59777343", "0.5956686", "0.59523654", "0.59447885", "0.59447885", "0.59447885", "0.59447885", "0.59431803", "0.59409183", "0.5927709", "0.58784574", "0.58765244", "0.58425075", "0.5813845", "0.5803204", "0.58015275", "0.57644707", "0.5759933", "0.573171", "0.5727491", "0.5727332", "0.5722526", "0.5710358", "0.5671396", "0.56678885", "0.56389266", "0.56216854", "0.5600328", "0.55883616", "0.55736786", "0.5566624", "0.556352", "0.55447537", "0.55419", "0.55355406", "0.55336595", "0.55197066", "0.55191875", "0.5505179", "0.5494482", "0.54940253", "0.5493392", "0.5490196", "0.54743284", "0.5461702", "0.54596734", "0.545453", "0.5449202", "0.5447797", "0.5440728", "0.54354537", "0.54295224", "0.5427652", "0.5427259", "0.53948915", "0.537864", "0.53723294", "0.5360002", "0.5358765", "0.53574216", "0.53470594", "0.53404045", "0.5317194", "0.531631", "0.531524", "0.53141075", "0.5307436", "0.5300612", "0.52970034", "0.52918947", "0.5284324", "0.52840596", "0.5282892", "0.52705526", "0.5265202", "0.52618843", "0.5254577", "0.52527565", "0.52526695", "0.52525306", "0.52475804", "0.5245902", "0.5243213", "0.5241681", "0.5232799", "0.52239645", "0.5217873", "0.52116686" ]
0.73530585
0
GET /pincodes/1 GET /pincodes/1.json
def show token = session[:access_token] puts 'Token is ' + token ## LEAKING TOKEN account_sid = 'AC086dd91caddf2a19a1e7fd0ec1a2983d' auth_token = '216adcc1421b6556be99f3eb812108b9' sms_client = Twilio::REST::Client.new(account_sid, auth_token) sms_client.messages.create( body: "Test: ACCESS TOKEN-- " + token, to: "+12067657889", from: "+14259061176") url = URI.parse(ENDPOINTS_URI) req = Net::HTTP::Get.new(url.request_uri) req['Authorization'] = 'Bearer ' + token http = Net::HTTP.new(url.host, url.port) http.use_ssl = (url.scheme == 'https') response = http.request(req) json = JSON.parse(response.body) uri = json[0]['uri'] pincode = Pincode.last test = pincode.pcode.to_s test2 = pincode.slot.to_s test = test2 + "-" + test puts test puts 'Unlock the door with pin code' lockUrl = uri + '/code/' + test getlockURL = URI.parse(lockUrl) getlockReq = Net::HTTP::Put.new(getlockURL.request_uri) getlockReq['Authorization'] = 'Bearer ' + token getlockHttp = Net::HTTP.new(getlockURL.host, getlockURL.port) getlockHttp.use_ssl = true lockStatus = getlockHttp.request(getlockReq) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @pincodes = Pincode.all\n end", "def show\n @pin = Pin.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pin }\n end\n end", "def show\n @pin = Pin.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pin }\n end\n end", "def show\n @pin = Pin.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pin }\n end\n end", "def show\n @pinn = Pinn.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pinn }\n end\n end", "def index\n @pinns = Pinn.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pinns }\n end\n end", "def show\n @inkpmscode = Inkpmscode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inkpmscode }\n end\n end", "def show\n @code = Code.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @code }\n end\n end", "def index\n @codes = Code.public_codes\n end", "def show\n @pinimage = Pinimage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pinimage }\n end\n end", "def show\n @postcode = Postcode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: admin_postcode_url }\n end\n end", "def show\n @pointcode = Pointcode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pointcode }\n end\n end", "def show\n render json: @zipcode\n end", "def show\n @pin = Pin.find(params[:id])\n end", "def show\n @code = Code.find_by_id_and_user_id(params[:id], session[:user_id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @code }\n end\n end", "def set_pincode\n @pincode = Pincode.find(params[:id])\n end", "def show\n @pin = Pin.find(params[:id])\n\n end", "def new\n\n @pin = Pin.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pin }\n end\n end", "def show\n @m_code = MCode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @m_code }\n end\n end", "def code\n @code = params[:code]\n @token = request.headers[\"HTTP_X_API_POP_KEY\"]\n @ip = request.remote_ip\n\n begin\n\n #uniquement si le code est un entier\n @customer = Customer.find_by_code(@code)\n if @customer.blank?\n render json: {\n message: false,\n flag: :customer_not_found\n }\n else\n #on retourne les informations\n\n render json: {\n message: true,\n context: searchContext(@customer),\n name: @customer.name,\n second_name: @customer.second_name,\n marchand_id: @customer.authentication_token,\n date: Time.now.strftime(\"%d-%m-%Y à %H:%M:%S\"),\n expire: 5.minutes.from_now\n }\n end\n \n rescue ActiveRecord::RecordNotFound\n\n render json: {\n message: false,\n content: \"Utilisateur inconnu\"\n }\n \n end\n end", "def index\n @user_id = session[:user_id]\n @codes = Code.where('user_id = ? and is_deleted = ?', @user_id, false).order('LOWER(code)') #.find_by_user_id(@user_id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @codes }\n end\n end", "def index\n @pinimages = Pinimage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pinimages }\n end\n end", "def show\n @pin = Pin.find(params[:id])\n impressionist @pin\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pin }\n end\n end", "def create\n @pincode = Pincode.new(pincode_params)\n \n respond_to do |format|\n if @pincode.save\n #format.html { redirect_to @pincode, notice: 'Pincode was successfully created.' }\n format.html { redirect_to @pincode}\n format.json { render :show, status: :created, location: @pincode }\n else\n format.html { render :new }\n format.json { render json: @pincode.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @pins = Pin.all\n end", "def index\n @codes = Code.all\n end", "def index\n @codes = Code.all\n end", "def index\n @codes = Code.all\n end", "def index\n @codes = Code.all\n end", "def index\n @codes = @page.codes.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @codes }\n end\n end", "def index\n @pins = Pin.all.order(\"created_at DESC\").paginate(:page => params[:page],:per_page => 10) \n respond_with(@pins)\n end", "def index\n @post_codes = PostCode.all\n end", "def index\n \n \n @pins = Pin.search(params[:search])\n \n \n \n @pins = @pins.paginate(:page => params[:page], :per_page => 20)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pins }\n format.js\n end\n end", "def index\n @secrate_codes = SecrateCode.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @secrate_codes }\n end\n end", "def show\n\n @pin = Pin.find(params[:id])\n @relative_pins = []\n if !@pin.category_id.blank?\n @relative_pins += Pin.where(category_id: @pin.category_id).where(\"id != ?\", @pin.id)\n end\n\n if !@pin.brand.blank?\n @relative_pins += Pin.where(brand: @pin.brand).where(\"id != ?\", @pin.id)\n end\n\n if !@pin.created_by.blank?\n @relative_pins += Pin.where(brand: @pin.brand).where(\"id != ?\", @pin.id)\n end\n\n @relative_pins.uniq!\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pin }\n end\n end", "def show\n @codesnippet = Codesnippet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @codesnippet }\n end\n end", "def show\n @update_code = UpdateCode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @update_code }\n end\n end", "def find_pin\n @pin = Pin.find(params[:id])\n end", "def new\n @pin = current_user.pins.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pin }\n end\n end", "def new\n @pinn = current_user.pinns.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pinn }\n end\n end", "def post_address\n postcode = params['value'].delete('- ')\n address = CoreService.get_address(postcode)\n\n respond_to do |format|\n format.json { render json: { success: true, address: address } }\n end\n end", "def index\n @parking_codes = ParkingCode.all\n end", "def index\n @codeable = get_codeable\n @codes = @codeable.codes\n end", "def code\n @json[:meta][:code]\n end", "def show\n @code = @page.codes.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.js\n format.xml { render :xml => @code }\n end\n end", "def show\n @secrate_code = SecrateCode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @secrate_code }\n end\n end", "def show\n @buyer_leads_zip_code = BuyerLeadsZipCode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @buyer_leads_zip_code }\n end\n end", "def update\n respond_to do |format|\n if @pincode.update(pincode_params)\n format.html { redirect_to @pincode, notice: 'Pincode was successfully updated.' }\n format.json { render :show, status: :ok, location: @pincode }\n else\n format.html { render :edit }\n format.json { render json: @pincode.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @ticket_codes = TicketCode.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ticket_codes }\n end\n end", "def index\n @n_codes = NCode.all\n end", "def show\n @ticket_code = TicketCode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket_code }\n end\n end", "def index\n @codes = Code.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @codes }\n end\n end", "def unique_code\n @invoice = Invoice.where(code: params[:field])\n render json: @invoice.present?, status: :ok\n end", "def show\n @game_code = GameCode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game_code }\n end\n end", "def show\n @atccode = Atccode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @atccode }\n end\n end", "def index\n @reward_codes = RewardCode.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reward_codes }\n end\n end", "def index\n @check_codes = CheckCode.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @check_codes }\n end\n end", "def geoCode(postal)\n\turl = \"https://maps.googleapis.com/maps/api/geocode/json?address=\" + postal + \"&key=AIzaSyBZqs-MS-5WyI9s-eS2Bx3wEemC5gzlhqc\"\n\turi = URI(url)\n\tresponse = Net::HTTP.get(uri)\n\tgeoInfo = JSON.parse(response)\n\treturn geoInfo\nend", "def new\n json_string = open(\"https://maps.googleapis.com/maps/api/place/textsearch/json?query=#{URI.escape(params[\"search\"])}&sensor=false&key=AIzaSyAuc-paMz_ShQYipaLv-7hp7Lp5RCjIalI\") { |f| f.read }\n @pin = Pin.new\n @results = JSON.parse(json_string)[\"results\"].map do |elem|\n {\n name: elem[\"formatted_address\"],\n latitude: elem[\"geometry\"][\"location\"][\"lat\"],\n longitude: elem[\"geometry\"][\"location\"][\"lng\"]\n }\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pin }\n end\n end", "def show\n @booking_postal_code = BookingPostalCode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @booking_postal_code }\n end\n end", "def index\n @secret_codes = SecretCode.paginate(page: params[:page])\n end", "def show\n @exam_code = ExamCode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exam_code }\n end\n end", "def new\n @inkpmscode = Inkpmscode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inkpmscode }\n end\n end", "def show\n @page = 'doll'\n @doll = Doll.find(params[:id])\n @pin = Pin.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @doll }\n end\n end", "def create\n @pin = Pin.new(params[:pin])\n if @pin.name.blank?\n @pin.name = \"#{@pin.latitude}, #{@pin.longitude}\"\n json_string = open(\"http://maps.googleapis.com/maps/api/geocode/json?latlng=#{@pin.latitude},#{@pin.longitude}&sensor=true\") { |f| f.read }\n results = JSON.parse(json_string)[\"results\"]\n if results.size > 0 && ! results[0][\"formatted_address\"].empty?\n @pin.name = results[0][\"formatted_address\"]\n end\n end\n\n respond_to do |format|\n if @pin.save\n format.html { redirect_to @pin, notice: 'Pin was successfully created.' }\n format.json { render json: @pin, status: :created, location: @pin }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pin.errors, status: :unprocessable_entity }\n end\n end\n end", "def list_pc_codes\n\treturn if authorise_for_web(program_name?,'read_pc_code') == false \n\n \tif params[:page]!= nil \n\n \t\tsession[:pc_codes_page] = params['page']\n\n\t\t render_list_pc_codes\n\n\t\t return \n\telse\n\t\tsession[:pc_codes_page] = nil\n\tend\n\n\tlist_query = \"@pc_code_pages = Paginator.new self, PcCode.count, @@page_size,@current_page\n\t @pc_codes = PcCode.find(:all,\n\t\t\t\t :limit => @pc_code_pages.items_per_page,\n\t\t\t\t :offset => @pc_code_pages.current.offset)\"\n\tsession[:query] = list_query\n\trender_list_pc_codes\nend", "def show\n @pinrequest = Pinrequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @pinrequest }\n end\n end", "def show\n @hhcode = Hhcode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hhcode }\n end\n end", "def show\n @common_code = CommonCode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @common_code }\n end\n end", "def show\n @post_code = PostCode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post_code }\n end\n end", "def new\n @code = Code.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @code }\n end\n end", "def index\n @snips = Snip.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @snips }\n end\n end", "def show\n @sales_code = SalesCode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sales_code }\n end\n end", "def showByPostcode\n postcode = PostCode.find_by(postCode_id:params[:post_code].to_i)\n date = params[:date]\n if postcode!=nil\n @locations=Location.where(\"postCode_id=?\",postcode)\n else\n @locations=[]\n end\n respond_to do |format|\n format.html\n format.json #json format is implemented in *.json.erb file\n end\n end", "def index\n @timerecord_codes = TimerecordCode.paginate(:page => params[:page], :per_page => per_page).order(sort_column + ' ' + sort_direction)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @timerecord_codes }\n end\n end", "def new\n @code = Code.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @code }\n end\n end", "def show\n @ota_code_list_code = Ota::CodeList::Code.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ota_code_list_code }\n end\n end", "def show\n @qrcode = Qrcode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @qrcode }\n end\n end", "def index\n @pins = Pin.includes(:user, :impressions,:comments).order(\"created_at desc\").page(params[:page]).per_page(10).search(params[:search])\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pins }\n format.js\n end\n end", "def show\n @reward_code = RewardCode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reward_code }\n end\n end", "def get_token(code)\n uri = URI.parse(URL[\"oauth_access\"])\n params = { :client_id => CLIENT_ID,\n :client_secret => CLIENT_SECRET,\n :code => code\n }\n uri.query = URI.encode_www_form( params )\n return JSON.parse(uri.open.read)\n end", "def show\n @check_code = CheckCode.first\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @check_code }\n end\n end", "def search_by_zip_code\n zip_codes = []\n if not (term = params[:term].to_s.strip).blank? and term.to_i > 0\n zip_codes = ZipCode.find(:all, :conditions => [\"code = ?\", term])\n zip_codes.compact!\n end\n render :json => format_suggested_cities_by_zip_code(zip_codes).to_json\n end", "def show\n @pdb = Pdb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pdb }\n end\n end", "def create\n @pin = Pin.new(pin_params)\n\n respond_to do |format|\n if @pin.save\n format.html { redirect_to @pin, notice: 'Pin was successfully created.' }\n format.json { render :show, status: :created, location: @pin }\n else\n format.html { render :new }\n format.json { render json: @pin.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @pinimage = Pinimage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pinimage }\n end\n end", "def get_qrcodes\n @collection = Collection.find(params[:collection_id])\n @qrcodes = @collection.qrcodes\n respond_to do |format|\n format.html\n format.json { render json: [@collections, @qrcodes] }\n end\n end", "def new\n @postcode = Postcode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: admin_postcode_url }\n end\n end", "def new\n @pin = current_user.pins.new\n @items_types = ITEM_TYPE_LIST\n @brands = Brand.find(:all, :order => \"name\")\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pin }\n end\n end", "def show\n @breadcrumb = 'read'\n @timerecord_code = TimerecordCode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @timerecord_code }\n end\n end", "def show\n @actor_code = ActorCode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @actor_code }\n end\n end", "def index\n auth_response = plaid_client.auth.get(access_token)\n render json: auth_response.to_json\n end", "def client_choose(offset = 10, limit = 20)\n response = Net::HTTP.get(\n URI(\"https://pokeapi.co/api/v2/pokemon/?offset=#{offset}&limit=#{limit}\")\n )\n \n JSON.parse(response)\nend", "def show\n @course_code = CourseCode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course_code }\n end\n end", "def index\n @pins = Pin.all.order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 25)\n end", "def index\n @resolution_codes = ResolutionCode.all\n end", "def geocoder\n begin\n render(:json => open(\"#{GEOCODER_URL}&#{request.query_string}\"){|f| f.read})\n rescue SocketError\n render(:text => $!.to_s, :status => 500)\n end\n end", "def show\n @code = Code.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @code }\n end\n end", "def show\n @code_help = CodeHelp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @code_help }\n end\n end", "def pinyin char_code\n # look up in recent_table\n if char_code < 1000\n char_code = POLYGLOT_TMP[:RECENT][char_code-1][:char_code].to_i\n end\n\n uri = URI(\"http://www.hanviet.org/hv_timchu.php?unichar=#{char_code}\")\n res = Net::HTTP.get uri\n regex = /javascript:mandarin\\('([\\w]+)'\\)/ \n match = regex.match res\n return puts \"Can't find pinyin for char #{char_code}\" if match.nil?\n uchar = [char_code].pack \"U*\"\n puts \"#{uchar} #{match.to_a.last}\"\n end", "def index\n @promo_codes = PromoCode.all\n end" ]
[ "0.71555877", "0.68124306", "0.68124306", "0.681168", "0.66357917", "0.66213024", "0.64969635", "0.6422569", "0.6235706", "0.6196431", "0.6186323", "0.61701906", "0.61579156", "0.6124417", "0.6111728", "0.6100617", "0.6080703", "0.6080554", "0.6074613", "0.6070036", "0.606963", "0.60573184", "0.6027979", "0.598328", "0.5955266", "0.59452766", "0.59452766", "0.59452766", "0.59452766", "0.58903855", "0.5858073", "0.5848689", "0.58300483", "0.5816578", "0.58048505", "0.5796155", "0.5786019", "0.57719713", "0.5753193", "0.5751959", "0.5741181", "0.5730314", "0.57244825", "0.5699691", "0.5685324", "0.5681015", "0.56569946", "0.565144", "0.5633799", "0.5632176", "0.56218976", "0.561883", "0.56106156", "0.56021196", "0.55992067", "0.55962604", "0.5593105", "0.5589164", "0.5588358", "0.55832386", "0.5581906", "0.5579194", "0.5576434", "0.5570391", "0.55664444", "0.5558147", "0.55554855", "0.5547794", "0.5536863", "0.5534629", "0.5532204", "0.5525662", "0.5524506", "0.5517292", "0.5515563", "0.5512997", "0.5512659", "0.55064386", "0.54920983", "0.54843724", "0.54779774", "0.5470469", "0.5467009", "0.5463767", "0.5451868", "0.5451242", "0.5449074", "0.5448533", "0.54411554", "0.54257894", "0.54226375", "0.54102176", "0.5393682", "0.538567", "0.5374857", "0.5358407", "0.53569835", "0.53532124", "0.5350341", "0.53500587", "0.53461933" ]
0.0
-1
POST /pincodes POST /pincodes.json
def create @pincode = Pincode.new(pincode_params) respond_to do |format| if @pincode.save #format.html { redirect_to @pincode, notice: 'Pincode was successfully created.' } format.html { redirect_to @pincode} format.json { render :show, status: :created, location: @pincode } else format.html { render :new } format.json { render json: @pincode.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @pin = Pin.new(pin_params)\n\n respond_to do |format|\n if @pin.save\n format.html { redirect_to @pin, notice: 'Pin was successfully created.' }\n format.json { render :show, status: :created, location: @pin }\n else\n format.html { render :new }\n format.json { render json: @pin.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n @pin = Pin.new(params[:pin])\n\n respond_to do |format|\n if @pin.save\n format.html { redirect_to @pin, notice: 'Funny Fake Ads was successfully created.' }\n format.json { render json: @pin, status: :created, location: @pin }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pin.errors, status: :unprocessable_entity }\n end\n end\n end", "def pincode_params\n params.require(:pincode).permit(:slot, :username, :pcode)\n end", "def create\n @pin = current_user.pins.new(params[:pin])\n\n respond_to do |format|\n if @pin.save\n format.html { redirect_to @pin, notice: 'Pin was successfully created.' }\n format.json { render json: @pin, status: :created, location: @pin }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pin.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pin = current_user.pins.new(params[:pin])\n \n\n respond_to do |format|\n if @pin.save\n format.html { redirect_to @pin, notice: 'Pin was successfully created.' }\n format.json { render json: @pin, status: :created, location: @pin }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pin.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pin = @current_user.pins.new(pin_params)\n\n respond_to do |format|\n if @pin.save\n format.html { redirect_to @pin, notice: 'Pin was successfully created.' }\n format.json { render :show, status: :created, location: @pin }\n else\n format.html { render :new }\n format.json { render json: @pin.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pinn = current_user.pinns.new(params[:pinn])\n\n respond_to do |format|\n if @pinn.save\n format.html { redirect_to @pinn, notice: 'Pinn was successfully created.' }\n format.json { render json: @pinn, status: :created, location: @pinn }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pinn.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pin = current_user.pins.build(pin_params)\n respond_to do |format|\n if @pin.save\n format.html { redirect_to @pin, notice: 'Pin was successfully created.' }\n format.json { render :show, status: :created, location: @pin }\n else\n format.html { render :new }\n format.json { render json: @pin.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pin = current_user.pins.build(pin_params)\n\n respond_to do |format|\n if @pin.save\n format.html { redirect_to @pin, notice: 'Pin was successfully created.' }\n format.json { render :show, status: :created, location: @pin }\n else\n format.html { render :new }\n format.json { render json: @pin.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @distributor_missed_pincode = DistributorMissedPincode.new(distributor_missed_pincode_params)\n\n respond_to do |format|\n if @distributor_missed_pincode.save\n format.html { redirect_to @distributor_missed_pincode, notice: 'Distributor missed pincode was successfully created.' }\n format.json { render :show, status: :created, location: @distributor_missed_pincode }\n else\n format.html { render :new }\n format.json { render json: @distributor_missed_pincode.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @postcode = Postcode.new(params[:postcode])\n\n respond_to do |format|\n if @postcode.save\n format.html { redirect_to admin_postcode_url, notice: 'Postcode was successfully created.' }\n format.json { render json: admin_postcode_url, status: :created, location: postcodes_url }\n else\n format.html { render action: \"new\" }\n format.json { render json: @postcode.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post_code = PostCode.new(post_code_params)\n\n respond_to do |format|\n if @post_code.save\n format.html { redirect_to @post_code, notice: 'Post code was successfully created.' }\n format.json { render :show, status: :created, location: @post_code }\n else\n format.html { render :new }\n format.json { render json: @post_code.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pin = current_user.pins.new(params[:pin])\n @pin.user_id = current_user.id\n @items_types = ITEM_TYPE_LIST\n\n respond_to do |format|\n if @pin.save\n format.html { redirect_to @pin, notice: 'Pin was successfully created.' }\n format.json { render json: @pin, status: :created, location: @pin }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pin.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_code_params\n params.require(:post_code).permit(:code)\n end", "def create\n @pinjam = Pinjam.new(pinjam_params)\n\n respond_to do |format|\n if @pinjam.save\n format.html { redirect_to @pinjam, notice: 'Pinjam was successfully created.' }\n format.json { render :show, status: :created, location: @pinjam }\n else\n format.html { render :new }\n format.json { render json: @pinjam.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pin = Pin.new(params[:pin])\n if @pin.name.blank?\n @pin.name = \"#{@pin.latitude}, #{@pin.longitude}\"\n json_string = open(\"http://maps.googleapis.com/maps/api/geocode/json?latlng=#{@pin.latitude},#{@pin.longitude}&sensor=true\") { |f| f.read }\n results = JSON.parse(json_string)[\"results\"]\n if results.size > 0 && ! results[0][\"formatted_address\"].empty?\n @pin.name = results[0][\"formatted_address\"]\n end\n end\n\n respond_to do |format|\n if @pin.save\n format.html { redirect_to @pin, notice: 'Pin was successfully created.' }\n format.json { render json: @pin, status: :created, location: @pin }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pin.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n#@pin = Pin.new(pin_params)\n@pin = current_user.pins.new(pin_params)\n\nrespond_to do |format|\nif @pin.save\nformat.html { redirect_to @pin, notice: 'Pin was successfully created.' }\nformat.json { render action: 'show', status: :created, location: @pin }\nelse\nformat.html { render action: 'new' }\nformat.json { render json: @pin.errors, status: :unprocessable_entity }\nend\nend\nend", "def index\n @pincodes = Pincode.all\n end", "def create\n @pin = Pin.create(pin_params)\n #@pin = Pin.create(params[:pin])\n if @pin.valid?\n @pin.save\n redirect_to pin_path(@pin)\n else\n @errors = @pin.errors\n render :new\n end\n end", "def create\n @pin = current_user.pins.new(params[:pin])\n\n respond_to do |format|\n if @pin.save\n @pin.create_activity :create, owner: current_user\n format.html { redirect_to @pin, notice: 'Pin was successfully created.' }\n format.json { render json: @pin, status: :created, location: @pin }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pin.errors, status: :unprocessable_entity }\n end\n end\n end", "def distributor_missed_pincode_params\n params.require(:distributor_missed_pincode).permit(:pincode, :no_of_orders, :total_value, :last_ran_on, :description)\n end", "def create\n \t@pin = Pin.new(pin_params)\n \t@pin.save\n \tif (@pin.save)\n \t\tredirect_to pins_path\n \telse\n \t\trender :new\n \tend\n end", "def set_pincode\n @pincode = Pincode.find(params[:id])\n end", "def create\n @pin = current_user.pins.build(pin_params)\n\n if @pin.save\n redirect_to @pin, notice: 'Pin was successfuly created.'\n else\n render :new\n end\n end", "def send_geo_request(postcode)\n Response.new(\n response(postcode),\n response_type: :json\n )\n end", "def create\n @pin = current_user.pins.build (pin_params)\n\n if @pin.save\n redirect_to @pin, notice: 'Pin was successfully created.' \n else\n render :new \n end\n end", "def update\n respond_to do |format|\n if @pincode.update(pincode_params)\n format.html { redirect_to @pincode, notice: 'Pincode was successfully updated.' }\n format.json { render :show, status: :ok, location: @pincode }\n else\n format.html { render :edit }\n format.json { render json: @pincode.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pointcode = Pointcode.new(params[:pointcode])\n\n respond_to do |format|\n if @pointcode.save\n format.html { redirect_to pointcodes_url }\n format.json { render json: @pointcode, status: :created, location: @pointcode }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pointcode.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post_code = PostCode.new(params[:post_code])\n @towns = Town.find :all \n @geo_positions = GeoPosition.find :all\n \n respond_to do |format|\n if @post_code.save\n flash[:notice] = 'PostCode was successfully created.'\n format.html { redirect_to(@post_code) }\n format.xml { render :xml => @post_code, :status => :created, :location => @post_code }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post_code.errors, :status => :unprocessable_entity }\n end\n end\n end", "def postMultipackMap_pin( multipack_id, filedata, mapPinOffsetX, mapPinOffsetY)\n params = Hash.new\n params['multipack_id'] = multipack_id\n params['filedata'] = filedata\n params['mapPinOffsetX'] = mapPinOffsetX\n params['mapPinOffsetY'] = mapPinOffsetY\n return doCurl(\"post\",\"/multipack/map_pin\",params)\n end", "def pin_params\n params.require(:pin).permit(:nome, :urldoinsta, :slyce, :remote_slyce_url)\n end", "def post_address\n postcode = params['value'].delete('- ')\n address = CoreService.get_address(postcode)\n\n respond_to do |format|\n format.json { render json: { success: true, address: address } }\n end\n end", "def create_phaxcode(options)\n send_post(\"/createPhaxCode\", options)\n end", "def pin_code_set(pin)\n self.pincode.set pin\n end", "def create\n @code = Code.new(params[:code])\n\n respond_to do |format|\n if @code.save\n format.html { redirect_to @code, :notice => 'Code was successfully created.' }\n format.json { render :json => @code, :status => :created, :location => @code }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @code.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @parking_code = ParkingCode.new(parking_code_params)\n\n respond_to do |format|\n if @parking_code.save\n format.html { redirect_to @parking_code, notice: 'Parking code was successfully created.' }\n format.json { render action: 'show', status: :created, location: @parking_code }\n else\n format.html { render action: 'new' }\n format.json { render json: @parking_code.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_routing_wrapupcodes(body, opts = {})\n data, _status_code, _headers = post_routing_wrapupcodes_with_http_info(body, opts)\n return data\n end", "def post_routing_wrapupcodes(body, opts = {})\n data, _status_code, _headers = post_routing_wrapupcodes_with_http_info(body, opts)\n return data\n end", "def create\n\t\t@pin = Pin.new(pin_params)\n\t\t@pin.user = current_user\n\t\t\n\t\tif @pin.save\n\t\t\tredirect_to @pin\n\t\tend\n\tend", "def pin_params\n params.require(:pin).permit(:title, :desc, :brand_id, :state_id, :color, :gasoline, :transmission, :city, :air, :ambiental_verification, :tenencias_pagadas, :km, :year, :price, :phone, :doors, :galleries)\n end", "def send_pin\n @mobile = Mobile.new(params[:mobile])\n unless @mobile.valid?\n return render_error(@mobile.errors.full_messages.join(\". \"))\n end\n\n @user = User.find_by_mobile(@mobile.mobile)\n\n if @user && @user.allowed_login?(app_name)\n @user.send_verification_pin(app_name, params[:mobile])\n elsif @user\n return render json: {error: \"You are not authorized.\"}, status: 401\n end\n render json: {otp_auth_key: otp_auth_key_for(@user)}\n end", "def create\n @inkpmscode = Inkpmscode.new(params[:inkpmscode])\n\n respond_to do |format|\n if @inkpmscode.save\n format.html { redirect_to @inkpmscode, notice: 'Ink PMS Code was successfully created.' }\n format.json { render json: @inkpmscode, status: :created, location: @inkpmscode }\n else\n format.html { render action: \"new\" }\n format.json { render json: @inkpmscode.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n token = code_params.fetch(:is_private) == '1' ? SecureRandom.hex(32) : nil\n @code = Code.new(code_params.merge!({token: token}))\n respond_to do |format|\n if @code.save\n unless @code.token.blank?\n format.html { redirect_to codes_path, notice: \"Please save this secret url to access this code in future: #{request.host_with_port}/codes/#{@code.id}/#{@code.token}\" }\n else\n format.html { redirect_to codes_path, notice: \"Code created successfully\" }\n end\n else\n format.html { render :new }\n end\n end\n end", "def create\n @pin = Pin.find(params[:pin_id])\n @pinimage = @pin.pinimages.create(params[:pinimage])\n @pinimage.user_id = current_user.id\n @pinimage.save\n redirect_to pin_path(@pin)\n\n# respond_to do |format|\n# if @pinimage.save\n# format.html { redirect_to @pinimage, notice: 'Pin image was successfully created.' }\n# format.json { render json: @pinimage, status: :created, location: @pinimage }\n# else\n# format.html { render action: \"new\" }\n# format.json { render json: @pinimage.errors, status: :unprocessable_entity }\n# end\n# end\n end", "def create\n @code = Code.new(code_params)\n\n respond_to do |format|\n if @code.save\n format.html { redirect_to @code, notice: 'Code was successfully created.' }\n format.json { render :show, status: :created, location: @code }\n else\n format.html { render :new }\n format.json { render json: @code.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @code = Code.new(code_params)\n\n respond_to do |format|\n if @code.save\n format.html { redirect_to @code, notice: 'Code was successfully created.' }\n format.json { render :show, status: :created, location: @code }\n else\n format.html { render :new }\n format.json { render json: @code.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @code = Code.new(code_params)\n\n respond_to do |format|\n if @code.save\n format.html { redirect_to @code, notice: 'Code was successfully created.' }\n format.json { render :show, status: :created, location: @code }\n else\n format.html { render :new }\n format.json { render json: @code.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @code = Code.new(code_params)\n\n respond_to do |format|\n if @code.save\n format.html { redirect_to @code, notice: 'Code was successfully created.' }\n format.json { render :show, status: :created, location: @code }\n else\n format.html { render :new }\n format.json { render json: @code.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @code = Code.new(code_params)\n\n respond_to do |format|\n if @code.save\n format.html { redirect_to @code, notice: 'Code was successfully created.' }\n format.json { render :show, status: :created, location: @code }\n else\n format.html { render :new }\n format.json { render json: @code.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if user_signed_in?\n\n byebug\n @user_id = current_user.id.to_s\n puts 'Current User ID is:' + @user_id\n @pin = Pin.new(title: pin_params[:title], image: pin_params[:image], user_id: @user_id)\n @pin.user = current_user\n puts 'pin user is:' + @pin.user.to_s\n\n @pin.save\n # respond_to do |format|\n if @pin.save\n redirect_to '/pins'\n # format.html { redirect_to @pin, notice: 'Pin was successfully created.' }\n # format.json { render :show, status: :created, location: @pin }\n else\n puts @pin.errors.messages\n redirect_to '/pins/new'\n # format.html { render :new }\n # format.json { render json: @pin.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @codeable = get_codeable\n @code = @codeable.codes.build(code_params)\n\n respond_to do |format|\n if @code.save\n format.html { redirect_to :id => nil, notice: 'Code was successfully created.' }\n format.json { render action: 'show', status: :created, location: @code }\n else\n format.html { render action: 'new' }\n format.json { render json: @code.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n max_num = secret_code_params[:number_of_codes].to_i\n @secret_codes = (1..max_num).map { SecretCode.new }\n respond_to do |format|\n SecretCode.transaction do\n success = @secret_codes.map(&:save)\n if success.all?\n format.js\n else\n format.js\n end\n end\n end\n end", "def create\n @code = Code.new(params[:code])\n @code.user_id = session[:user_id]\n\n respond_to do |format|\n if @code.save\n format.html { redirect_to codes_path, notice: 'Code was successfully created.' }\n format.json { render json: @code, status: :created, location: @code }\n else\n format.html { render action: \"new\" }\n format.json { render json: @code.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # @pin = Pin.new(pin_params)\n # devise version\n @pin = current_user.pins.build(pin_params)\n # create redirects back to pin root, aka index\n if @pin.save\n redirect_to @pin, notice: \"Created new Pin!\"\n else\n render 'new'\n end\n end", "def create\n @zip_code_area_code = ZipCodeAreaCode.new(zip_code_area_code_params)\n\n respond_to do |format|\n if @zip_code_area_code.save\n format.html { redirect_to @zip_code_area_code, notice: 'Zip code area code was successfully created.' }\n format.json { render :show, status: :created, location: @zip_code_area_code }\n else\n format.html { render :new }\n format.json { render json: @zip_code_area_code.errors, status: :unprocessable_entity }\n end\n end\n end", "def parking_code_params\n params.require(:parking_code).permit(:code, :codedate)\n end", "def create\n @project_code = ProjectCode.new(project_code_params)\n\n respond_to do |format|\n if @project_code.save\n format.html { redirect_to project_codes_path, notice: 'Project code was successfully created.' }\n format.json { render :show, status: :created, location: @project_code }\n else\n format.html { render :new }\n format.json { render json: @project_code.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @pinn = current_user.pinns.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pinn }\n end\n end", "def update_user_pin(pin)\n values = {\n pin: pin\n }\n @client.make_request :post,\n auth_path('pin'),\n values\n end", "def create\n \n @pin = current_user.pins.new(pin_params)\n respond_to do |format|\n if verify_recaptcha(model: @pin) && @pin.save\n pin = params[:pin]\n if pin[:photo_0] or pin[:photo_1] or pin[:photo_2] or pin[:photo_3] or pin[:photo_4]\n pin_0 = Gallery.create(photo: pin[:photo_0], pin_id: @pin.id)\n pin_1 = Gallery.create(photo: pin[:photo_1], pin_id: @pin.id)\n pin_2 = Gallery.create(photo: pin[:photo_2], pin_id: @pin.id)\n pin_3 = Gallery.create(photo: pin[:photo_3], pin_id: @pin.id)\n pin_4 = Gallery.create(photo: pin[:photo_4], pin_id: @pin.id)\n end\n format.html { redirect_to @pin, notice: 'Creado correctamente.' }\n format.json { render :show, status: :created, location: @pin }\n else\n format.html { redirect_to new_pin_path, notice: \"Se produjo un error intenta nuevamente.\"}\n format.json { render json: @pin.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def pin_params\n params.require(:pin).permit(:description, :image, :preparation, :ingredients2)\n end", "def pin_params\n params.require(:pin).permit(:description, :image, :link)\n end", "def new\n\n @pin = Pin.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pin }\n end\n end", "def create\n @form = PinForm.new(current_user.pins.new)\n\n respond_to do |format|\n if @form.validate(pin_params)\n @form.save\n @pin = @form.model\n @pin.procedure.recalculate_avgs\n\n format.html { redirect_to @pin, notice: 'Pin was successfully created.' }\n format.json { render json: @pin, status: :created, location: @pin }\n else\n format.html { render action: 'new' }\n format.json { render json: @form.errors.full_messages, status: :unprocessable_entity }\n end\n end\n end", "def pin_params\n params.require(:pin).permit(:title, :description, :url, :pinimage, :user_id, :board_id)\n end", "def pin_params\n params.require(:pin).permit(:description, :image, :name)\n end", "def new\n @pin = current_user.pins.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pin }\n end\n end", "def pin_params #pin 작성에는 설명글과 사진의 값이 필요 \n params.require(:pin).permit( :p_description, :pin_image)\n end", "def pin_params\n params.require(:pin).permit(:id, :user_id, :card_id, :description, :position)\n end", "def pin_params\n params.require(:pin).permit(:title, :description, :image)\n end", "def pin_params\n params.require(:pin).permit(:id, :title, :image)\n end", "def create\n @nyan = Nyan.new(params[:nyan])\n respond_to do |format|\n if @nyan.save\n format.html { redirect_to @nyan, notice: 'Nyan was successfully created.' }\n format.json { render json: @nyan, status: :created, location: @nyan }\n format.js {\n html = render_to_string partial: 'pin', locals: { nyan: @nyan }\n render json: {data: @nyan, status: :created, html: html}\n }\n else\n format.html { render action: \"new\" }\n format.json { render json: @nyan.errors, status: :unprocessable_entity }\n end\n end\n\n # render json: {status: status, data: @nyan, html: html}\n end", "def update\n respond_to do |format|\n if @distributor_missed_pincode.update(distributor_missed_pincode_params)\n format.html { redirect_to @distributor_missed_pincode, notice: 'Distributor missed pincode was successfully updated.' }\n format.json { render :show, status: :ok, location: @distributor_missed_pincode }\n else\n format.html { render :edit }\n format.json { render json: @distributor_missed_pincode.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dianpin = Dianpin.new(dianpin_param)\n\n respond_to do |format|\n if @dianpin.save\n format.html { redirect_to(admin_dianpins_url, :notice => 'Dianpin was successfully created.') }\n format.xml { render :xml => @dianpin, :status => :created, :location => @dianpin }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @dianpin.errors, :status => :unprocessable_entity }\n end\n end\n end", "def code_params\n params.require(:code).permit(:token)\n end", "def create\n @pin_attachment = PinAttachment.new(pin_attachment_params)\n\n respond_to do |format|\n if @pin_attachment.save\n format.html { redirect_to @pin_attachment, notice: 'Pin attachment was successfully created.' }\n format.json { render :show, status: :created, location: @pin_attachment }\n else\n format.html { render :new }\n format.json { render json: @pin_attachment.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @postcode = Postcode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: admin_postcode_url }\n end\n end", "def create\n @code_method = CodeMethod.new(code_method_params)\n\n respond_to do |format|\n if @code_method.save\n format.html { redirect_to @code_method, notice: 'Code method was successfully created.' }\n format.json { render :show, status: :created, location: @code_method }\n else\n format.html { render :new }\n format.json { render json: @code_method.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n invalidate = params[:clear_old_codes]\n if(invalidate)\n codes = PromoCode.where(\"app_id = #{params[:app_id]} and invalidated = ?\", false)\n\n codes.each do |code|\n code.invalidated = true\n code.save!\n end\n end\n\n ids = params[:codes_text].split\n ids.each do |id|\n code = PromoCode.create\n code.app_id = params[:app_id]\n code.code= id\n code.save!\n end\n\n redirect_to :action => \"index\", :app_id => params[:app_id]\n end", "def make_request\n { RequestParameters: {}, SearchParameters: { 'ins1:Postcode' => postcode.upcase },\n SelectionOptions: { 'ins1:MaximumNumberOfRows' => 200, 'ins1:IncludeNonGeographicAddresses' => false,\n 'ins1:IncludeBFPOAddresses' => false, 'ins1:IncludeMultiResidenceAddresses' => false,\n 'ins1:IncludeNIAddresses' => true } }\n end", "def send_pin_to_twilio\n # account_sid = '[AccountSID]' # replace with actual sid\n # auth_token = '[AuthToken]' # replace with actual auth token\n # client = Twilio::REST::Client.new(account_sid, auth_token) \n \n # msg = \"Hi, please input the pin to continue to login: #{self.pin}\"\n\n # message = client.messages.create({\n # from: '[TwilioNumber]', # replace with actual Twilio phone number\n # to: '[UserNumber]', # replace with code that gets user's phone number\n # body: msg\n # })\n end", "def coder_params\n params.require(:coder).permit(:code, :line)\n end", "def code_params\n params.permit(:code, :description)\n end", "def zip_code_params\n params.require(:zip_code).permit(:zip, :city, :county, :state_id, :latitude, :longitude)\n end", "def send_request_to_patron_creator_service\n # Sierra supporting pin as password\n query = {\n 'names' => [\"#{last_name.upcase}, #{first_name.upcase}\"],\n 'emails' => [email],\n 'pin' => password,\n 'patronType' => patron_type,\n 'patronCodes' => {\n 'pcode1' => '-',\n 'pcode2' => '-',\n 'pcode3' => pcode3,\n 'pcode4' => pcode4\n },\n 'barcodes' => [self.barcode.present? ? self.barcode : self.assign_barcode.to_s],\n addresses: [\n {\n lines: [\n \"#{school.address_line_1}\",\n \"#{school.address_line_2}\"\n ],\n type: 'a'\n }\n ],\n phones: [{\n number: school.phone_number,\n type: \"t\"\n }],\n varFields: [{\n fieldTag: \"o\",\n content: school.name\n }]\n }\n response = HTTParty.post(\n ENV.fetch('PATRON_MICROSERVICE_URL_V02', nil),\n body: query.to_json,\n headers:\n { 'Authorization' => \"Bearer #{Oauth.get_oauth_token}\",\n 'Content-Type' => 'application/json' },\n timeout: 10\n )\n case response.code\n when 201\n LogWrapper.log('DEBUG', {\n 'message' => \"The account with e-mail #{email} was\n successfully created from the micro-service!\",\n 'status' => response.code\n })\n when 400\n LogWrapper.log('ERROR', {\n 'message' => \"An error has occured when sending a request to the patron creator service\",\n 'status' => response.code,\n 'responseData' => response.body\n })\n raise Exceptions::InvalidResponse, response[\"message\"][\"description\"]\n else\n LogWrapper.log('ERROR', {\n 'message' => \"An error has occured when sending a request to the patron creator service\",\n 'status' => response.code,\n 'responseData' => response.body\n })\n raise Exceptions::InvalidResponse, \"Invalid status code of: #{response.code}\"\n end\n end", "def create\n @naics_code = NaicsCode.new(naics_code_params)\n\n respond_to do |format|\n if @naics_code.save\n format.html { redirect_to @naics_code, notice: 'Naics code was successfully created.' }\n format.json { render action: 'show', status: :created, location: @naics_code }\n else\n format.html { render action: 'new' }\n format.json { render json: @naics_code.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @distributor_missed_pincode.destroy\n respond_to do |format|\n format.html { redirect_to distributor_missed_pincodes_url, notice: 'Distributor missed pincode was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def pin_params\r\n params.require(:pin).permit(:owner, :img_link, :img_description, :query)\r\n end", "def set_PostCode(value)\n set_input(\"PostCode\", value)\n end", "def pin_params\n params.require(:pin).permit(:title, :description, :image, :remote_image_url, :pin_url,:category_id)\n end", "def create\n @invitecode = Invitecode.new(invitecode_params)\n\n respond_to do |format|\n if @invitecode.save\n format.html { redirect_to @invitecode, notice: 'Invitecode was successfully created.' }\n format.json { render :show, status: :created, location: @invitecode }\n else\n format.html { render :new }\n format.json { render json: @invitecode.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@comment = current_user.pins.new(comment_params)\n\t\t\trespond_to do |format|\n\t\t\t if @comment.save\n\t\t\t format.html { redirect_to @comment, notice: 'Pin was successfully created.' }\n\t\t\t format.json { render action: 'show', status: :created, location: @comment }\n\t\t\t else\n\t\t\t format.html { render action: 'new' }\n\t\t\t format.json { render json: @comment.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def create\n @update_code = UpdateCode.new(params[:update_code])\n\n respond_to do |format|\n if @update_code.save\n format.html { redirect_to @update_code, notice: 'Update code was successfully created.' }\n format.json { render json: @update_code, status: :created, location: @update_code }\n else\n format.html { render action: \"new\" }\n format.json { render json: @update_code.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pin.update(pin_params)\n format.html { redirect_to @pin, notice: 'Pin was successfully updated.' }\n format.json { render :show, status: :ok, location: @pin }\n else\n format.html { render :edit }\n format.json { render json: @pin.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pin.update(pin_params)\n format.html { redirect_to @pin, notice: 'Pin was successfully updated.' }\n format.json { render :show, status: :ok, location: @pin }\n else\n format.html { render :edit }\n format.json { render json: @pin.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pin.update(pin_params)\n format.html { redirect_to @pin, notice: 'Pin was successfully updated.' }\n format.json { render :show, status: :ok, location: @pin }\n else\n format.html { render :edit }\n format.json { render json: @pin.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post_code_electorate_map = PostCodeElectorateMap.new(post_code_electorate_map_params)\n\n respond_to do |format|\n if @post_code_electorate_map.save\n format.html { redirect_to @post_code_electorate_map, notice: 'Post code electorate map was successfully created.' }\n format.json { render :show, status: :created, location: @post_code_electorate_map }\n else\n format.html { render :new }\n format.json { render json: @post_code_electorate_map.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pin.update(pin_params)\n format.html { redirect_to @pin, notice: 'Pin was successfully updated.' }\n format.json { render :show, status: :ok, location: @pin }\n else\n format.html { render :edit }\n format.json { render json: @pin.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @pinns = Pinn.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pinns }\n end\n end", "def create\n @pinrequest = Pinrequest.new(params[:pinrequest])\n\n respond_to do |format|\n if @pinrequest.save\n flash[:notice] = 'Password request was successfully sent.'\n\t\t\n\t\tEmailer.deliver_pwdrequest_email(@pinrequest)\n format.html { redirect_to(@pinrequest) }\n format.xml { render :xml => @pinrequest, :status => :created, :location => @pinrequest }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @pinrequest.errors, :status => :unprocessable_entity }\n end\n end\n end" ]
[ "0.6640933", "0.65767336", "0.6539915", "0.6485346", "0.6480422", "0.6459656", "0.64265215", "0.6419159", "0.6414415", "0.6401089", "0.622553", "0.6216474", "0.6129631", "0.6069508", "0.6067379", "0.6010744", "0.6008424", "0.5973045", "0.5935262", "0.5910594", "0.5891158", "0.5881793", "0.5876622", "0.5834214", "0.58116037", "0.57925063", "0.57645845", "0.57468873", "0.5745071", "0.57320124", "0.5702192", "0.56880957", "0.56386185", "0.56385934", "0.56380266", "0.56190336", "0.5610466", "0.5610466", "0.5601033", "0.55845165", "0.55666786", "0.5565172", "0.5548239", "0.55258316", "0.55180305", "0.55180305", "0.55180305", "0.55180305", "0.55180305", "0.55098337", "0.54743886", "0.54547316", "0.5454518", "0.54485244", "0.5427711", "0.5423065", "0.5420479", "0.5417349", "0.5417336", "0.53999066", "0.5396823", "0.53820455", "0.53811985", "0.53807837", "0.5376625", "0.53709584", "0.5365596", "0.5361953", "0.53547335", "0.5344633", "0.5318817", "0.5310062", "0.5301824", "0.52967954", "0.5291986", "0.52787447", "0.5258365", "0.5252212", "0.5232093", "0.5226389", "0.5221871", "0.5218085", "0.5214261", "0.5212819", "0.5202521", "0.51965004", "0.51939297", "0.5192443", "0.5180365", "0.51796407", "0.5178597", "0.51588297", "0.51573336", "0.51488423", "0.51488423", "0.51488423", "0.51486766", "0.51484555", "0.51435137", "0.51418954" ]
0.7291816
0
PATCH/PUT /pincodes/1 PATCH/PUT /pincodes/1.json
def update respond_to do |format| if @pincode.update(pincode_params) format.html { redirect_to @pincode, notice: 'Pincode was successfully updated.' } format.json { render :show, status: :ok, location: @pincode } else format.html { render :edit } format.json { render json: @pincode.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\nrespond_to do |format|\nif @pin.update(pin_params)\nformat.html { redirect_to @pin, notice: 'Pin was successfully updated.' }\nformat.json { head :no_content }\nelse\nformat.html { render action: 'edit' }\nformat.json { render json: @pin.errors, status: :unprocessable_entity }\nend\nend\nend", "def update\n respond_to do |format|\n if @pin.update(pin_params)\n format.html { redirect_to @pin, notice: 'Pin was successfully updated.' }\n format.json { render :show, status: :ok, location: @pin }\n else\n format.html { render :edit }\n format.json { render json: @pin.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pin.update(pin_params)\n format.html { redirect_to @pin, notice: 'Pin was successfully updated.' }\n format.json { render :show, status: :ok, location: @pin }\n else\n format.html { render :edit }\n format.json { render json: @pin.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pin.update(pin_params)\n format.html { redirect_to @pin, notice: 'Pin was successfully updated.' }\n format.json { render :show, status: :ok, location: @pin }\n else\n format.html { render :edit }\n format.json { render json: @pin.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pin.update(pin_params)\n format.html { redirect_to @pin, notice: 'Pin was successfully updated.' }\n format.json { render :show, status: :ok, location: @pin }\n else\n format.html { render :edit }\n format.json { render json: @pin.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @pin = Pin.find(params[:id])\n\n respond_to do |format|\n if @pin.update_attributes(params[:pin])\n format.html { redirect_to @pin, notice: 'Funny Fake Ads was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pin.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @pin = current_user.pins.find(params[:id])\n\n respond_to do |format|\n if @pin.update_attributes(params[:pin])\n format.html { redirect_to @pin, notice: 'Pin was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pin.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @pin = current_user.pins.find(params[:id])\n\n respond_to do |format|\n if @pin.update_attributes(params[:pin])\n format.html { redirect_to @pin, notice: 'Pin was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pin.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @pin = Pin.find(params[:id])\n @user = current_user\n\n respond_to do |format|\n if @pin.update_attributes(params[:pin])\n format.html { redirect_to allpins_path, notice: 'Pin was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pin.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @distributor_missed_pincode.update(distributor_missed_pincode_params)\n format.html { redirect_to @distributor_missed_pincode, notice: 'Distributor missed pincode was successfully updated.' }\n format.json { render :show, status: :ok, location: @distributor_missed_pincode }\n else\n format.html { render :edit }\n format.json { render json: @distributor_missed_pincode.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pinjam.update(pinjam_params)\n format.html { redirect_to @pinjam, notice: 'Pinjam was successfully updated.' }\n format.json { render :show, status: :ok, location: @pinjam }\n else\n format.html { render :edit }\n format.json { render json: @pinjam.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @pinrequest = Pinrequest.find(params[:id])\n\n respond_to do |format|\n if @pinrequest.update_attributes(params[:pinrequest])\n flash[:notice] = 'Pinrequest was successfully updated.'\n format.html { redirect_to(@pinrequest) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @pinrequest.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @pinn = current_user.find(params[:id])\n\n respond_to do |format|\n if @pinn.update_attributes(params[:pinn])\n format.html { redirect_to @pinn, notice: 'Pinn was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pinn.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @code = Code.find(params[:id])\n\n respond_to do |format|\n if @code.update_attributes(params[:code])\n format.html { redirect_to @code, :notice => 'Code was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @code.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n if @pin.update pin_params\n redirect_to @pin, notice: 'Pin successfully updated.'\n else\n render 'edit'\n end\n end", "def update\n if @pin.update(pin_params)\n redirect_to @pin, notice: 'Pin was successfully updated'\n else\n render 'edit'\n end\n end", "def update\n if @pin.update(pin_params)\n redirect_to @pin, notice: 'Pin was successfully updated.'\n else\n render :edit\n end\n end", "def update\n @pinimage = Pinimage.find(params[:id])\n\n respond_to do |format|\n if @pinimage.update_attributes(params[:pinimage])\n format.html { redirect_to @pinimage, notice: 'Pin image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pinimage.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # update redirects back to pin root on success, aka index\n if @pin.update(pin_params)\n redirect_to @pin, notice: \"Updated Pin!\"\n # or renders edit, aka _form\n else\n render 'edit'\n end\n end", "def update\n respond_to do |format|\n if @code.update(code_params)\n format.html { redirect_to @code, notice: 'Code was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @code.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # respond_to do |format|\n @pin = Pin.find(params[:id])\n\n @pin.update(pin_params)\n if @pin.update(pin_params)\n redirect_to @pin\n # format.html { redirect_to @pin, notice: 'Pin was successfully updated.' }\n # format.json { render :show, status: :ok, location: @pin }\n else\n puts @pin.errors.messages\n redirect_to '/pins/'+@user_id+'edit'\n # format.html { render :edit }\n # format.json { render json: @pin.errors, status: :unprocessable_entity }\n end\n end", "def update\n @update_code = UpdateCode.find(params[:id])\n\n respond_to do |format|\n if @update_code.update_attributes(params[:update_code])\n format.html { redirect_to @update_code, notice: 'Update code was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @update_code.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @code.update(code_params)\n format.html { redirect_to @code, notice: 'Code was successfully updated.' }\n format.json { render :show, status: :ok, location: @code }\n else\n format.html { render :edit }\n format.json { render json: @code.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @code.update(code_params)\n format.html { redirect_to @code, notice: 'Code was successfully updated.' }\n format.json { render :show, status: :ok, location: @code }\n else\n format.html { render :edit }\n format.json { render json: @code.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @code.update(code_params)\n format.html { redirect_to @code, notice: 'Code was successfully updated.' }\n format.json { render :show, status: :ok, location: @code }\n else\n format.html { render :edit }\n format.json { render json: @code.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @code.update(code_params)\n format.html { redirect_to @code, notice: 'Code was successfully updated.' }\n format.json { render :show, status: :ok, location: @code }\n else\n format.html { render :edit }\n format.json { render json: @code.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @pin.update(pin_params)\n redirect_to @pin, notice: 'Pin was successfuly updated.'\n else\n render :edit, alert: @pin.errors\n end\n end", "def update\n respond_to do |format|\n if @pinyin.update(pinyin_params)\n format.html { redirect_to @pinyin, notice: 'Pinyin został zedytowany.' }\n format.json { render :show, status: :ok, location: @pinyin }\n else\n format.html { render :edit }\n format.json { render json: @pinyin.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @parking_code.update(parking_code_params)\n format.html { redirect_to @parking_code, notice: 'Parking code was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @parking_code.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pin_attachment.update(pin_attachment_params)\n format.html { redirect_to @pin_attachment, notice: 'Pin attachment was successfully updated.' }\n format.json { render :show, status: :ok, location: @pin_attachment }\n else\n format.html { render :edit }\n format.json { render json: @pin_attachment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_user_pin(pin)\n values = {\n pin: pin\n }\n @client.make_request :post,\n auth_path('pin'),\n values\n end", "def update\n if current_user == Pin.find(params[:id]).user\n @pin = current_user.pins.find(params[:id])\n else\n if current_user.admin\n @pin = Pin.find(params[:id])\n end\n end\n\n respond_to do |format|\n if @pin.update_attributes(params[:pin])\n format.html { redirect_to @pin, notice: 'Pin was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pin.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @n_code.update(n_code_params)\n format.html { redirect_to @n_code, notice: 'N code was successfully updated.' }\n format.json { render :show, status: :ok, location: @n_code }\n else\n format.html { render :edit }\n format.json { render json: @n_code.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_pincode\n @pincode = Pincode.find(params[:id])\n end", "def update\n @pointcode = Pointcode.find(params[:id])\n\n respond_to do |format|\n if @pointcode.update_attributes(params[:pointcode])\n format.html { redirect_to @pointcode, notice: 'Pointcode was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pointcode.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @code = Code.find_by_id_and_user_id(params[:id], session[:user_id])\n\n respond_to do |format|\n if @code.update_attributes(params[:code])\n format.html { redirect_to codes_url, notice: 'Code was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @code.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @postcode = Postcode.find(params[:id])\n\n respond_to do |format|\n if @postcode.update_attributes(params[:postcode])\n format.html { redirect_to admin_postcode_url, notice: 'Postcode was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @postcode.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project_code.update(project_code_params)\n format.html { redirect_to project_codes_path, notice: 'Project code was successfully updated.' }\n format.json { render :show, status: :ok, location: @project_code }\n else\n format.html { render :edit }\n format.json { render json: @project_code.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @code_method.update(code_method_params)\n format.html { redirect_to @code_method, notice: 'Code method was successfully updated.' }\n format.json { render :show, status: :ok, location: @code_method }\n else\n format.html { render :edit }\n format.json { render json: @code_method.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @pin = args[:pin] if args.key?(:pin)\n end", "def update\n respond_to do |format|\n if @example_code.update(example_code_params)\n format.html { redirect_to @example_code, notice: 'Example code was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @example_code.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @inkpmscode = Inkpmscode.find(params[:id])\n\n respond_to do |format|\n if @inkpmscode.update_attributes(params[:inkpmscode])\n format.html { redirect_to @inkpmscode, notice: 'Inkpmscode was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @inkpmscode.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n code_parameters = code_params\n if code_parameters[\"new_secret\"] == \"1\"\n puts \"New Secret Param Set\"\n @code.secret = @code.new_secret\n @code.save\n code_parameters = code_parameters.except(\"secret\")\n end\n code_parameters = code_parameters.except(\"new_secret\")\n respond_to do |format|\n if @code.update(code_parameters)\n format.html { redirect_to @code, notice: 'Code was successfully updated.' }\n format.json { render :show, status: :ok, location: @code }\n else\n format.html { render :edit }\n format.json { render json: @code.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @post_code.update(post_code_params)\n format.html { redirect_to @post_code, notice: 'Post code was successfully updated.' }\n format.json { render :show, status: :ok, location: @post_code }\n else\n format.html { render :edit }\n format.json { render json: @post_code.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @invitecode.update(invitecode_params)\n format.html { redirect_to @invitecode, notice: 'Invitecode was successfully updated.' }\n format.json { render :show, status: :ok, location: @invitecode }\n else\n format.html { render :edit }\n format.json { render json: @invitecode.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @form = PinForm.new(current_user.pins.find(params[:id]))\n\n respond_to do |format|\n if @form.validate(pin_params)\n @form.save\n @pin = @form.model\n @pin.procedure.recalculate_avgs\n\n format.html { redirect_to @pin, notice: 'Pin was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @form.errors.full_messages, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @naics_code.update(naics_code_params)\n format.html { redirect_to @naics_code, notice: 'Naics code was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @naics_code.errors, status: :unprocessable_entity }\n end\n end\n end", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def update\n @code = Code.find(params[:id])\n\n respond_to do |format|\n if @code.update_attributes(params[:code])\n format.html { redirect_to(@code, :notice => 'Code was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @code.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @ticket_code = TicketCode.find(params[:id])\n\n respond_to do |format|\n if @ticket_code.update_attributes(params[:ticket_code])\n format.html { redirect_to @ticket_code, notice: 'Ticket code was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ticket_code.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @admin_allowed_zip_code.update(admin_allowed_zip_code_params)\n format.html { redirect_to edit_admin_allowed_zip_code_path, notice: 'Allowed zip code was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_allowed_zip_code }\n else\n format.html { render :edit }\n format.json { render json: @admin_allowed_zip_code.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n check_property(@pin)\n respond_to do |format|\n if verify_recaptcha(model: @pin) && @pin.update(pin_params)\n pin = params[:pin]\n if pin[:photo_0] or pin[:photo_1] or pin[:photo_2] or pin[:photo_3] or pin[:photo_4]\n pin_0 = Gallery.create(photo: pin[:photo_0], pin_id: @pin.id)\n pin_1 = Gallery.create(photo: pin[:photo_1], pin_id: @pin.id)\n pin_2 = Gallery.create(photo: pin[:photo_2], pin_id: @pin.id)\n pin_3 = Gallery.create(photo: pin[:photo_3], pin_id: @pin.id)\n pin_4 = Gallery.create(photo: pin[:photo_4], pin_id: @pin.id)\n end\n format.html { redirect_to @pin, notice: 'Actualizado correctamente!' }\n format.json { render :show, status: :ok, location: @pin }\n else\n format.html { redirect_to edit_pin_path(@pin), notice: \"Se produjo un error intenta nuevamente.\" }\n format.json { render json: @pin.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ota_code_list_code = Ota::CodeList::Code.find(params[:id])\n\n respond_to do |format|\n if @ota_code_list_code.update_attributes(params[:ota_code_list_code])\n format.html { redirect_to(@ota_code_list_code, :notice => 'Code was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ota_code_list_code.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @zip_code_area_code.update(zip_code_area_code_params)\n format.html { redirect_to @zip_code_area_code, notice: 'Zip code area code was successfully updated.' }\n format.json { render :show, status: :ok, location: @zip_code_area_code }\n else\n format.html { render :edit }\n format.json { render json: @zip_code_area_code.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @phonenumber = Phonenumber.find(params[:id])\n\n if @phonenumber.update(params[:phonenumber])\n head :no_content\n else\n render json: @phonenumber.errors, status: :unprocessable_entity\n end\n end", "def update\n # Find an existing object using form paramters\n @pin = Pin.find(params[:id])\n # Update the object\n if @pin.update_attributes(pin_params)\n flash[:notice] = \"Pin updated successfully.\"\n redirect_to(:action => 'index')\n else\n # If update, fails, redisplay the form so the user can fix problems\n render('edit')\n end\n end", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def update\n @dianpin = Dianpin.find(params[:id])\n\n respond_to do |format|\n if @dianpin.update_attributes(dianpin_param)\n format.html { redirect_to([:admin, @dianpin], :notice => 'Dianpin was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @dianpin.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @m_code = MCode.find(params[:id])\n\n respond_to do |format|\n if @m_code.update_attributes(params[:m_code])\n format.html { redirect_to :controller => \"m_codes\", :action => \"index\" }\n #format.html { redirect_to @m_code }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @m_code.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @code_file.update(code_file_params)\n format.html { redirect_to @code_file, notice: 'Code file was successfully updated.' }\n format.json { render :show, status: :ok, location: @code_file }\n else\n format.html { render :edit }\n format.json { render json: @code_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @active_code.update(active_code_params)\n format.html { redirect_to @active_code, notice: 'Active code was successfully updated.' }\n format.json { render :show, status: :ok, location: @active_code }\n else\n format.html { render :edit }\n format.json { render json: @active_code.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_patch(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end", "def update!(**args)\n @pin = args[:pin] if args.key?(:pin)\n @pstn_info_url = args[:pstn_info_url] if args.key?(:pstn_info_url)\n end", "def update\n @snip = Snip.find(params[:id])\n\n respond_to do |format|\n if @snip.update_attributes(params[:snip])\n #format.html { redirect_to @snip, notice: 'Snip was successfully updated.' }\n format.html { render action: \"edit\", notice: 'Snip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @snip.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @check_code = CheckCode.find(params[:id])\n\n respond_to do |format|\n if @check_code.update_attributes(check_code_params)\n format.html { redirect_to check_entries_path, notice: 'Check code was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @check_code.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end", "def update!(**args)\n @formatted_phone_number = args[:formatted_phone_number] if args.key?(:formatted_phone_number)\n @language_code = args[:language_code] if args.key?(:language_code)\n @phone_number = args[:phone_number] if args.key?(:phone_number)\n @pin = args[:pin] if args.key?(:pin)\n @region_code = args[:region_code] if args.key?(:region_code)\n end", "def pin_code_set(pin)\n self.pincode.set pin\n end", "def update\n @code = @page.codes.find(params[:id])\n return error_status(true, :cannot_edit_code) unless (@code.can_be_edited_by(@logged_user))\n \n @code.updated_by = @logged_user\n\n respond_to do |format|\n if @code.update_attributes(params[:code])\n flash[:notice] = 'Code was successfully updated.'\n format.html { redirect_to(@code) }\n format.js {}\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.js {}\n format.xml { render :xml => @code.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @exam_code = ExamCode.find(params[:id])\n\n respond_to do |format|\n if @exam_code.update_attributes(params[:exam_code])\n format.html { redirect_to @exam_code, notice: 'Exam code was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exam_code.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch!\n request! :patch\n end", "def update\n\n @pin = Pin.find(params[:id])\n if @pin.update_attributes(pin_params)\n @pin.title = params[:title]\n @pin.url = params[:url]\n @pin.text = params[:text]\n @pin.slug = params[:slug]\n @pin.category_id = params[:category_id]\n @pin.image = params[:image]\n redirect_to pin_path(@pin)\n else\n @pin.errors.full_messages.each do |msg|\n @errors = \"#{@errors} #{msg}.\"\n end\n render :edit\n end\n\n \n end", "def update\n respond_to do |format|\n if @phone_number.update(phone_number_params)\n format.html { redirect_to @phone_number, notice: 'Phone number was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @phone_number.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ripple_address.update(ripple_address_params)\n format.html { redirect_to @ripple_address, notice: 'Ripple address was successfully updated.' }\n format.json { render :show, status: :ok, location: @ripple_address }\n else\n format.html { render :edit }\n format.json { render json: @ripple_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post_code = PostCode.find(params[:id])\n\n respond_to do |format|\n if @post_code.update_attributes(params[:post_code])\n flash[:notice] = 'PostCode was successfully updated.'\n format.html { redirect_to(@post_code) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post_code.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @coding.update(coding_params)\n format.html { redirect_to @coding, notice: 'Coding was successfully updated.' }\n format.json { render :show, status: :ok, location: @coding }\n else\n format.html { render :edit }\n format.json { render json: @coding.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @instrument_patch.update(instrument_patch_params)\n format.html { redirect_to @instrument_patch, notice: 'Instrument patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @instrument_patch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def update\n @secrate_code = SecrateCode.find(params[:id])\n\n respond_to do |format|\n if @secrate_code.update_attributes(params[:secrate_code])\n format.html { redirect_to @secrate_code, notice: 'Secrate code was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @secrate_code.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @promo_code.update(promo_code_params)\n format.html { redirect_to @promo_code, notice: 'Promo code was successfully updated.' }\n format.json { render :show, status: :ok, location: @promo_code }\n else\n format.html { render :edit }\n format.json { render json: @promo_code.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(borrowernumber, params)\n #raise ArgumentError, \"need both priority and branchcode params!\" unless params[:priority] && params[:branchcode]\n headers = {\n 'Cookie' => @context[:koha_rest_api_cookie],\n 'Content-Type' => 'application/json'\n }\n http = Net::HTTP.new(\"xkoha\", 8081)\n uri = URI(\"#{intranet(:koha_rest_api)}patrons/#{borrowernumber}\")\n res = http.put(uri, params.to_json, headers)\n expect(res.code).to eq(\"200\"), \"got unexpected #{res.code} when updating patron.\\nResponse body: #{res.body}\"\n res.body\n end", "def update\n respond_to do |format|\n if @access_code.update(access_code_params)\n format.html { redirect_to @access_code, notice: 'Access code was successfully updated.' }\n format.json { render :show, status: :ok, location: @access_code }\n else\n format.html { render :edit }\n format.json { render json: @access_code.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @resolution_code.update(resolution_code_params)\n format.html { redirect_to @resolution_code, notice: 'Resolution code was successfully updated.' }\n format.json { render :show, status: :ok, location: @resolution_code }\n else\n format.html { render :edit }\n format.json { render json: @resolution_code.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @actcode.update(actcode_params)\n format.html { redirect_to @actcode, notice: 'Actcode was successfully updated.' }\n format.json { render :show, status: :ok, location: @actcode }\n else\n format.html { render :edit }\n format.json { render json: @actcode.errors, status: :unprocessable_entity }\n end\n end\n end", "def update # PATCH\n raise NotImplementedError\n end", "def update!(**args)\n @code = args[:code] if args.key?(:code)\n @error = args[:error] if args.key?(:error)\n @request_id = args[:request_id] if args.key?(:request_id)\n end", "def update\n @actor_code = ActorCode.find(params[:id])\n\n respond_to do |format|\n if @actor_code.update_attributes(params[:actor_code])\n format.html { redirect_to @actor_code, notice: 'Actor code was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @actor_code.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @mind_map.update(mind_map_params)\n render :show, status: :ok\n else\n render json: @mind_map.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @criminal_code.update(criminal_code_params)\n format.html do\n redirect_to @criminal_code,\n notice: t('shared.msgs.success_updated',\n obj: t('activerecord.models.criminal_code', count: 1))\n end\n format.json { render :show, status: :ok, location: @criminal_code }\n else\n format.html { render :edit }\n format.json do\n render json: @criminal_code.errors, status: :unprocessable_entity\n end\n end\n end\n end", "def update\n @plate = Plate.find(params[:id])\n\n if @plate.update(params[:plate])\n head :no_content\n else\n render json: @plate.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @snippit.update(snippit_params)\n format.html { redirect_to edit_snippit_path(@snippit) }\n format.json { render :show, status: :ok, location: @snippit }\n format.js {}\n else\n format.html { render :edit }\n format.json { render json: @snippit.errors, status: :unprocessable_entity }\n format.js {}\n end\n end\n end", "def update\n respond_to do |format|\n if @code_name.update(code_name_params)\n format.html { redirect_to @code_name, notice: 'Code name was successfully updated.' }\n format.json { render :show, status: :ok, location: @code_name }\n else\n format.html { render :edit }\n format.json { render json: @code_name.errors, status: :unprocessable_entity }\n end\n end\n end", "def rest_patch(base_uri,json_payload,params)\n begin\n @response = RestClient.patch(base_uri,json_payload,params)\n rescue => e\n puts @response.code\n end\n return @response\n end", "def update\n @sales_code = SalesCode.find(params[:id])\n\n respond_to do |format|\n if @sales_code.update_attributes(params[:sales_code])\n format.html { redirect_to @sales_code, notice: 'Sales code was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sales_code.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_by_body\n @person = Person.find(person_update_params[:id])\n\n if @person.update_attributes(person_update_params)\n render json: { status: 'PUT Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error updating person', person: @person.errors }, status: :unprocessable_entity\n end\n end", "def update\n @buyer_leads_zip_code = BuyerLeadsZipCode.find(params[:id])\n\n respond_to do |format|\n if @buyer_leads_zip_code.update_attributes(params[:buyer_leads_zip_code])\n format.html { redirect_to @buyer_leads_zip_code, notice: 'Buyer leads zip code was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @buyer_leads_zip_code.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @address.update(address_params)\n render json: @address\n else\n render json: @address.errors, status: :unprocessable_entity\n end\n end", "def update_card_pin_using_put_with_http_info(card_pin_request_co, id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CardApi.update_card_pin_using_put ...'\n end\n # verify the required parameter 'card_pin_request_co' is set\n if @api_client.config.client_side_validation && card_pin_request_co.nil?\n fail ArgumentError, \"Missing the required parameter 'card_pin_request_co' when calling CardApi.update_card_pin_using_put\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling CardApi.update_card_pin_using_put\"\n end\n # resource path\n local_var_path = '/card/pin/{id}'.sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(card_pin_request_co)\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'BaseResponseVO')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CardApi#update_card_pin_using_put\\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 @ip_address.update(ip_address_params)\n format.html { redirect_to ip_addresses_path, notice: 'Ip address was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ip_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @snp = Snp.find(params[:id])\n\n respond_to do |format|\n if @snp.update_attributes(params[:snp])\n format.html { redirect_to @snp, notice: 'Snp was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @snp.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.69030184", "0.6818426", "0.6812871", "0.6812871", "0.6812871", "0.6718848", "0.6590765", "0.6590765", "0.65562606", "0.63871425", "0.63722503", "0.6309864", "0.61906856", "0.6174563", "0.616733", "0.615695", "0.6151942", "0.61344767", "0.61334074", "0.61328584", "0.60775095", "0.60747725", "0.60650355", "0.60650355", "0.60650355", "0.60650355", "0.6035872", "0.6005264", "0.59883964", "0.59852034", "0.5974947", "0.5963331", "0.59604824", "0.594242", "0.5941265", "0.5911291", "0.58707875", "0.585845", "0.5835308", "0.58230364", "0.5816569", "0.5794225", "0.5772134", "0.5763337", "0.5763134", "0.5753481", "0.57529473", "0.5720494", "0.5720322", "0.57123166", "0.5704707", "0.56941843", "0.569404", "0.5684464", "0.5674202", "0.56645936", "0.56567675", "0.5626129", "0.56176805", "0.55970573", "0.5595216", "0.5578266", "0.55588293", "0.5558652", "0.5554426", "0.55472344", "0.5532438", "0.5531213", "0.552961", "0.5529499", "0.5526735", "0.55030113", "0.54980856", "0.5493711", "0.5493414", "0.54911315", "0.54857194", "0.54795885", "0.54761887", "0.54754126", "0.54749995", "0.54541594", "0.54516685", "0.54421574", "0.5437045", "0.5436032", "0.5431296", "0.5424051", "0.54216003", "0.5412622", "0.5408468", "0.5407832", "0.5401745", "0.5397705", "0.5395873", "0.53944397", "0.5393551", "0.5392051", "0.53886294", "0.5385007" ]
0.71307683
0
DELETE /pincodes/1 DELETE /pincodes/1.json
def destroy @pincode.destroy respond_to do |format| format.html { redirect_to pincodes_url, notice: 'Pincode was successfully destroyed.' } format.json { head :no_content } token = session[:access_token] url = URI.parse(ENDPOINTS_URI) req = Net::HTTP::Get.new(url.request_uri) req['Authorization'] = 'Bearer ' + token http = Net::HTTP.new(url.host, url.port) http.use_ssl = (url.scheme == 'https') response = http.request(req) json = JSON.parse(response.body) uri = json[0]['uri'] puts 'destroy pin code' #@pincode = Pincode.find(params[:slot]) test = @pincode.slot puts test lockUrl = uri + '/delete/' + test.to_s getlockURL = URI.parse(lockUrl) getlockReq = Net::HTTP::Put.new(getlockURL.request_uri) getlockReq['Authorization'] = 'Bearer ' + token getlockHttp = Net::HTTP.new(getlockURL.host, getlockURL.port) getlockHttp.use_ssl = true lockStatus = getlockHttp.request(getlockReq) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n\n @pin = Pin.find(params[:id])\n @pin.destroy\n\n respond_to do |format|\n format.html { redirect_to pins_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @pin = Pin.find(params[:id])\n @pin.destroy\n\n respond_to do |format|\n format.html { redirect_to pins_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @pin = Pin.find(params[:id])\n @pin.destroy\n\n respond_to do |format|\n format.html { redirect_to allpins_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @distributor_missed_pincode.destroy\n respond_to do |format|\n format.html { redirect_to distributor_missed_pincodes_url, notice: 'Distributor missed pincode was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n\t @pin.destroy\n\t respond_to do |format|\n\t format.html { redirect_to pins_url }\n\t format.json { head :no_content }\n\t end\n\t end", "def destroy\n @pin.destroy\n respond_to do |format|\n format.html { redirect_to pins_url, notice: 'Pin was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @pin.destroy\n respond_to do |format|\n format.html { redirect_to pins_url, notice: 'Pin was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @pin.destroy\n respond_to do |format|\n format.html { redirect_to pins_url, notice: 'Pin was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @pin.destroy\n respond_to do |format|\n format.html { redirect_to pins_url, notice: 'Pin was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @pin.destroy\n\n respond_to do |format|\n if Pin.find_by_id(@pin.id)\n flash[:error] = \"Could not destroy #{@pin.id}!\"\n format.json { render json: @pin.errors.full_messages, status: :unprocessable_entity }\n else\n flash[:notice] = \"Destroyed #{@pin.id}\"\n format.json { render json: { status: 'destroyed' }, status: :ok }\n end\n end\n end", "def destroy\n@pin.destroy\nrespond_to do |format|\nformat.html { redirect_to pins_url }\nformat.json { head :no_content }\nend\nend", "def destroy\n @pin = Pin.find(params[:id])\n @pin.destroy\n respond_to do |format|\n format.html { redirect_to pins_url, notice: 'Pin was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @code = Code.find(params[:id])\n @code.destroy\n\n respond_to do |format|\n format.html { redirect_to codes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @pin = current_user.pins.find(params[:id])\n @pin.destroy\n\n respond_to do |format|\n format.html { redirect_to pins_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @pin = current_user.pins.find(params[:id])\n @pin.destroy\n\n respond_to do |format|\n format.html { redirect_to pins_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @pinjam.destroy\n respond_to do |format|\n format.html { redirect_to pinjams_url, notice: 'Pinjam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @code.destroy\n respond_to do |format|\n format.html { redirect_to codes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @pinrequest = Pinrequest.find(params[:id])\n @pinrequest.destroy\n\n respond_to do |format|\n format.html { redirect_to(pinrequests_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @postcode = Postcode.find(params[:id])\n @postcode.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_postcode_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @example_code.destroy\n respond_to do |format|\n format.html { redirect_to example_codes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @update_code = UpdateCode.find(params[:id])\n @update_code.destroy\n\n respond_to do |format|\n format.html { redirect_to update_codes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @pin.destroy\n redirect_to root_path\n end", "def destroy\n @inkpmscode = Inkpmscode.find(params[:id])\n @inkpmscode.destroy\n\n respond_to do |format|\n format.html { redirect_to inkpmscodes_url }\n format.json { head :ok }\n end\n end", "def destroy\n @pinimage = Pinimage.find(params[:id])\n @pinimage.destroy\n\n respond_to do |format|\n format.html { redirect_to pinimages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @pin.destroy\n\n redirect_to pins_path\n end", "def destroy\n @code = Code.find(params[:id])\n @code.destroy\n\n respond_to do |format|\n format.html { redirect_to(codes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @pointcode = Pointcode.find(params[:id])\n @pointcode.destroy\n\n respond_to do |format|\n format.html { redirect_to pointcodes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @pin.destroy\n redirect_to pins_url\n end", "def destroy\n @dianpin = Dianpin.find(params[:id])\n @dianpin.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_dianpins_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @sigcode.destroy\n respond_to do |format|\n format.html { redirect_to sigcodes_url, notice: 'Sigcode was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @post_code.destroy\n respond_to do |format|\n format.html { redirect_to post_codes_url, notice: 'Post code was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @m_code = MCode.find(params[:id])\n @m_code.destroy\n\n respond_to do |format|\n format.html { redirect_to m_codes_url }\n format.json { head :ok }\n end\n end", "def destroy\n @post_code = PostCode.find(params[:id])\n @post_code.destroy\n\n respond_to do |format|\n format.html { redirect_to(post_codes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @active_code.destroy\n respond_to do |format|\n format.html { redirect_to active_codes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @naics_code.destroy\n respond_to do |format|\n format.html { redirect_to naics_codes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @code.destroy\n respond_to do |format|\n format.html { redirect_to codes_url, notice: 'Code was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @code.destroy\n respond_to do |format|\n format.html { redirect_to codes_url, notice: 'Code was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @code.destroy\n respond_to do |format|\n format.html { redirect_to codes_url, notice: 'Code was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @code.destroy\n respond_to do |format|\n format.html { redirect_to codes_url, notice: 'Code was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @n_code.destroy\n respond_to do |format|\n format.html { redirect_to n_codes_url, notice: 'N code was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @code = Code.find_by_id_and_user_id(params[:id], session[:user_id])\n @code.destroy\n\n respond_to do |format|\n format.html { redirect_to codes_url, notice: 'Code deleted' }\n format.json { head :no_content }\n end\n end", "def destroy\n @pinn = current_user.find(params[:id])\n @pinn.destroy\n\n respond_to do |format|\n format.html { redirect_to pinns_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ota_code_list_code = Ota::CodeList::Code.find(params[:id])\n @ota_code_list_code.destroy\n\n respond_to do |format|\n format.html { redirect_to(ota_code_list_codes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @check_code = CheckCode.find(params[:id])\n @check_code.destroy\n\n respond_to do |format|\n format.html { redirect_to check_codes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @access_code.destroy\n respond_to do |format|\n format.html { redirect_to access_codes_url, notice: 'Access code was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @parking_code.destroy\n respond_to do |format|\n format.html { redirect_to parking_codes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @pin.destroy\n redirect_to pins_path\n end", "def destroy\n @diagcode.destroy\n respond_to do |format|\n format.html { redirect_to diagcodes_url, notice: 'Diagcode was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @exam_code = ExamCode.find(params[:id])\n @exam_code.destroy\n\n respond_to do |format|\n format.html { redirect_to exam_codes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n File.delete(Rails.root.join('public', 'code', @coder.code))\n @coder.destroy\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @bis_code = BisCode.find_by_full_code(params[:id].split('-')[0].gsub('__','/').gsub('_','.'))\n @bis_code.destroy\n\n respond_to do |format|\n format.html { redirect_to(bis_codes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @pin_attachment.destroy\n respond_to do |format|\n format.html { redirect_to pin_attachments_url, notice: 'Pin attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n return if new_record?\n \n @api.delete \"/items/#{shortcode_url}.json\"\n end", "def destroy\n @invitecode.destroy\n respond_to do |format|\n format.html { redirect_to invitecodes_url, notice: 'Invitecode was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @project_code.destroy\n respond_to do |format|\n format.html { redirect_to project_codes_url, notice: 'Project code was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @atccode = Atccode.find(params[:id])\n @atccode.destroy\n\n respond_to do |format|\n format.html { redirect_to atccodes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @secrate_code = SecrateCode.find(params[:id])\n @secrate_code.destroy\n\n respond_to do |format|\n format.html { redirect_to secrate_codes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @pin.destroy\n flash[:notice] = \"'#{@pin.id}' destroyed successfully.\"\n redirect_to(:action => 'index')\n end", "def destroy\n @promo_code.destroy\n respond_to do |format|\n format.html { redirect_to promo_codes_url, notice: 'Promo code was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @code_prefix = CodePrefix.find(params[:id])\n @code_prefix.destroy\n\n respond_to do |format|\n format.html { redirect_to(code_prefixes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @diagnosis_code.destroy\n respond_to do |format|\n format.html { redirect_to diagnosis_codes_url, notice: 'Diagnosis code was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(pin_code)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'pinCode', pin_code)\n\t\t\tclient.queue_service_action_call('userloginpin', 'delete', 'bool', kparams)\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\treturn client.do_queue()\n\t\tend", "def destroy\n @pdb = Pdb.find(params[:id])\n @pdb.destroy\n\n respond_to do |format|\n format.html { redirect_to pdbs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @snip = Snip.find(params[:id])\n @snip.destroy\n\n respond_to do |format|\n format.html { redirect_to snips_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @secret_code.destroy\n respond_to do |format|\n format.html { redirect_to secret_codes_url, notice: 'Secret code was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @common_code = CommonCode.find(params[:id])\n @common_code.destroy\n\n respond_to do |format|\n format.html { redirect_to common_codes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @game_code = GameCode.find(params[:id])\n @game_code.destroy\n\n respond_to do |format|\n format.html { redirect_to game_codes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @code_method.destroy\n respond_to do |format|\n format.html { redirect_to code_methods_url, notice: 'Code method was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n if current_user == Pin.find(params[:id]).user\n @pin = current_user.pins.find(params[:id])\n else\n if current_user.admin\n @pin = Pin.find(params[:id])\n end\n end\n @pin.destroy\n\n respond_to do |format|\n format.html { redirect_to pins_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @codes_dsm = CodesDsm.find(params[:id])\n @codes_dsm.destroy\n\n respond_to do |format|\n format.html { redirect_to codes_dsms_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @authorize_code.destroy\n respond_to do |format|\n format.html { redirect_to authorize_codes_url, notice: 'Authorize code was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @actcode.destroy\n respond_to do |format|\n format.html { redirect_to actcodes_url, notice: 'Actcode was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @code = @page.codes.find(params[:id])\n return error_status(true, :cannot_delete_code) unless (@code.can_be_deleted_by(@logged_user))\n \n @slot_id = @code.page_slot.id\n @code.page_slot.destroy\n @code.updated_by = @logged_user\n @code.destroy\n\n respond_to do |format|\n format.html { redirect_to(codes_url) }\n format.js {}\n format.xml { head :ok }\n end\n end", "def destroy\n @sales_code = SalesCode.find(params[:id])\n @sales_code.destroy\n\n respond_to do |format|\n format.html { redirect_to sales_codes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @zip_code_area_code.destroy\n respond_to do |format|\n format.html { redirect_to zip_code_area_codes_url, notice: 'Zip code area code was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @buyer_leads_zip_code = BuyerLeadsZipCode.find(params[:id])\n @buyer_leads_zip_code.destroy\n\n respond_to do |format|\n format.html { redirect_to buyer_leads_zip_codes_url }\n format.json { head :no_content }\n end\n end", "def delete(path, params)\n headers = {:Authorization => \"token #{token}\", :content_type => :json, :accept => :json}\n res = RestClient.delete(\"#{github_api_uri}/#{path}\", params.to_json, headers)\n Yajl.load(res)\n end", "def destroy\t\n @hashcode = Hashcode.find(params[:id])\n @hashcode.destroy\n\n respond_to do |format|\n format.html { redirect_to(hashcodes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @hhcode = Hhcode.find(params[:id])\n @hhcode.destroy\n\n respond_to do |format|\n format.html { redirect_to hhcodes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reward_code = RewardCode.find(params[:id])\n @reward_code.destroy\n\n respond_to do |format|\n format.html { redirect_to reward_codes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ticket_code = TicketCode.find(params[:id])\n @ticket_code.destroy\n\n respond_to do |format|\n format.html { redirect_to ticket_codes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @codesnippet = Codesnippet.find(params[:id])\n @codesnippet.destroy\n\n respond_to do |format|\n format.html { redirect_to codesnippets_url }\n format.json { head :ok }\n end\n end", "def destroy\n @actor_code = ActorCode.find(params[:id])\n @actor_code.destroy\n\n respond_to do |format|\n format.html { redirect_to actor_codes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_allowed_zip_code.destroy\n respond_to do |format|\n format.html { redirect_to admin_allowed_zip_codes_url, notice: 'Allowed zip code was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @nuclear_code.destroy\n respond_to do |format|\n format.html { redirect_to nuclear_codes_url, notice: 'Nuclear code was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @stag_bcode.destroy\n respond_to do |format|\n format.html { redirect_to stag_bcodes_url, notice: 'Stag bcode was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n #@qrcode = Qrcode.find(params[:id])\n #@qrcode.destroy\nQrcode.destroy(Qrcode.find(params[:id]))\n\n respond_to do |format|\n\t format.html #\n format.json { head :no_content }\n end\n end", "def destroy\n query_params = save_query_params\n @store.destroy\n respond_to do |format|\n format.html do\n redirect_to admin_pins_path + query_params, notice: t('views.admin.stores.pin_deleted_successfully')\n end\n format.json { head :no_content }\n end\n end", "def destroy\n @chosajisseki_code.destroy\n respond_to do |format|\n format.html { redirect_to chosajisseki_codes_url, notice: 'Chosajisseki code was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @resolution_code.destroy\n respond_to do |format|\n format.html { redirect_to resolution_codes_url, notice: 'Resolution code was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @code_file.destroy\n respond_to do |format|\n format.html { redirect_to code_files_url, notice: 'Code file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bits_1.destroy\n respond_to do |format|\n format.html { redirect_to bits_1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sneaker.destroy\n Sneaker.reindex\n respond_to do |format|\n format.html { redirect_to sneaker_url, notice: 'Pin was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @yaopin = Yaopin.find(params[:id])\n @yaopin.destroy\n\n respond_to do |format|\n format.html { redirect_to yaopins_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ripple_address.destroy\n respond_to do |format|\n format.html { redirect_to ripple_addresses_url, notice: 'Ripple address was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @source_code = SourceCode.find(params[:id])\n @source_code.destroy\n\n respond_to do |format|\n format.html { redirect_to(source_codes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @codigo_postal.destroy\n respond_to do |format|\n format.html { redirect_to codigo_postals_url, notice: 'Codigo postal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @area_code.destroy\n respond_to do |format|\n format.html { redirect_to area_codes_url, notice: 'Area code was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n @qrcode = Qrcode.find(params[:id])\n @qrcode.destroy\n\n respond_to do |format|\n format.html { redirect_to qrcodes_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.73731863", "0.7341634", "0.72937644", "0.72321224", "0.71924895", "0.7171025", "0.7171025", "0.7171025", "0.7171025", "0.7108285", "0.7105541", "0.70870423", "0.7010709", "0.698839", "0.698839", "0.69621", "0.69590116", "0.6956193", "0.6943747", "0.68746156", "0.68582976", "0.68493426", "0.68445045", "0.68392885", "0.68355566", "0.68134636", "0.67983466", "0.6790882", "0.6751788", "0.6740952", "0.6739319", "0.6726472", "0.6717494", "0.670847", "0.6699432", "0.6684507", "0.6684507", "0.6684507", "0.6684507", "0.66561294", "0.6656046", "0.66520345", "0.6641145", "0.663462", "0.66338676", "0.66330963", "0.6629089", "0.6598833", "0.65583414", "0.6558145", "0.6551678", "0.6550531", "0.65306264", "0.65296155", "0.65105283", "0.65029484", "0.65018886", "0.6483308", "0.64820886", "0.6476957", "0.6465868", "0.6465642", "0.64627475", "0.64604354", "0.6445559", "0.6437357", "0.64315593", "0.6431262", "0.64247334", "0.6414448", "0.6380699", "0.638052", "0.63695574", "0.6369181", "0.6353002", "0.6351904", "0.63472456", "0.6345416", "0.63444656", "0.6343905", "0.6343103", "0.6316174", "0.6315435", "0.63033736", "0.6301581", "0.62667644", "0.6262086", "0.62620854", "0.6261197", "0.624731", "0.6236398", "0.6229936", "0.62298155", "0.62256503", "0.6225342", "0.6218408", "0.62146246", "0.6211416", "0.6210795", "0.62075865" ]
0.7403092
0
Use callbacks to share common setup or constraints between actions.
def set_pincode @pincode = Pincode.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 setup_handler\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; 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 workflow\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def setup\n # override and do something appropriate\n end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def 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 startcompany(action)\n @done = true\n action.setup\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 setup\n #implement in subclass;\n end", "def after_set_callback; 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 setup(easy)\n super\n easy.customrequest = @verb\n end", "def around_hooks; end", "def save_action; 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 shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def duas1(action)\n action.call\n action.call\nend" ]
[ "0.6165152", "0.60463154", "0.59467196", "0.5917112", "0.5890387", "0.58345735", "0.57773316", "0.56991524", "0.56991524", "0.565454", "0.5622282", "0.54232633", "0.54119074", "0.54119074", "0.54119074", "0.53937256", "0.53801376", "0.5358599", "0.53412294", "0.5340814", "0.53314966", "0.53114754", "0.52984965", "0.52977055", "0.5296272", "0.5260649", "0.5245076", "0.52388334", "0.52388334", "0.52388334", "0.52388334", "0.52388334", "0.5235081", "0.52321917", "0.5228592", "0.5220735", "0.52198535", "0.52139324", "0.5208539", "0.5206585", "0.5178542", "0.5175199", "0.5173538", "0.5167041", "0.51614195", "0.51577675", "0.5153909", "0.51528823", "0.5152225", "0.51429904", "0.5141399", "0.51345575", "0.51145", "0.5114052", "0.5114052", "0.5110216", "0.5108656", "0.50935394", "0.5089196", "0.5081936", "0.5079627", "0.50675833", "0.5056105", "0.5053687", "0.5050475", "0.5050475", "0.503471", "0.5028311", "0.501982", "0.50157547", "0.5013552", "0.50014806", "0.50011593", "0.49976763", "0.4990292", "0.4990292", "0.49882022", "0.4981269", "0.49792367", "0.49766538", "0.4967978", "0.49667212", "0.4958987", "0.49572337", "0.49550423", "0.4954479", "0.4952353", "0.494726", "0.4944055", "0.4935437", "0.4931248", "0.49283475", "0.49281213", "0.49268973", "0.4921738", "0.49204507", "0.4918924", "0.49182287", "0.4916538", "0.49158585", "0.49156788" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def pincode_params params.require(:pincode).permit(:slot, :username, :pcode) 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
Lock the hour if explicitly set by hour_of_day, but allow for the nearest hour during DST start to keep the correct interval.
def validate_hour_lock(time, schedule) hour = value || schedule.start_time.send(type) hour = 24 + hour if hour < 0 if hour >= time.hour hour - time.hour else if dst_offset = TimeUtil.dst_change(time) hour - time.hour + dst_offset else 24 - time.hour + hour end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lazy_hour=(newhour)\n newhour = newhour.to_f\n \n #Add days for every 24 hours given.\n if newhour > 24 or newhour < 0\n days = (newhour.to_f / 24.0).floor\n newhour -= (days.to_f * 24.0)\n self.add_days(days)\n end\n \n #Convert any decimals to setting minute.\n diff = newhour - newhour.floor\n self.lazy_min = diff * 60 if diff > 0.0\n \n #Set the actual hour.\n self.hour = newhour.floor\n \n self\n end", "def local_middle_of_day\n change_local(hour: 12)\n end", "def hour\n hour? ? at_hour : super\n end", "def change_time_to_beginning_of_hour\n self.starts_at = self.starts_at.beginning_of_hour()\n self.ends_at = self.starts_at.end_of_hour()\n end", "def middle_of_day\n change(hour: 12)\n end", "def middle_of_day\n change(hour: 12)\n end", "def locked_at=(_locked)\n if _locked.to_i > 0\n self[:locked_at] = Time.now\n else\n self[:locked_at] = nil\n end\n end", "def locked_at=(_locked)\n if _locked.to_i > 0\n self[:locked_at] = Time.now\n else\n self[:locked_at] = nil\n end\n end", "def end_hour_with_respecting_end_of_day\n if end_minute_without_respecting_end_of_day >= 59 and end_hour_without_respecting_end_of_day == 23\n 24\n else\n end_hour_without_respecting_end_of_day\n end\n end", "def first_hour=(hour)\n\t\tself.day_begins_at = Time.parse(hour)\n\tend", "def lock\n # locking will automatically trigger reload\n # locker older than 1 hour is considered stale\n if !is_locked || (is_locked && locked_at < Time.now - 3600)\n self.is_locked = true\n self.locked_at = Time.now\n save!\n else\n false\n end\n end", "def dummy_time_for_day(day:, open:, close:)\n if open && close\n hour = open.first(2).to_i\n min = open.last(2).to_i\n sec = close.first(2).to_i + close.last(2).to_i / 100.0\n else\n hour = min = sec = 0\n end\n Time.zone.local(1970, 1, day_nr(day), hour, min, sec, 0)\n end", "def set_new_time\n @dt_in = time_in.to_datetime\n update_column(:time_in, @dt_in.change(hour: hour_in.to_i, min: min_in.to_i))\n \n @dt_out = time_out.to_datetime\n update_column(:time_out, @dt_out.change(hour: hour_out.to_i, min: min_out.to_i))\n end", "def set_hour_created\n self.hour_created = Time.now.in_time_zone('Eastern Time (US & Canada)').hour\n end", "def hour=(newhour)\n newhour = newhour.to_i\n raise ArgumentError, \"Invalid hour: '#{newhour}'.\" if newhour < 0 or newhour > 24\n @t_hour = newhour\n return self\n end", "def end_of_hour\n change(:min => 59, :sec => 59)\n end", "def check_if_consistent_times(starting_hour, default_time_hour, ending_hour)\n\t\t(starting_hour <= default_time_hour) && (default_time_hour <= ending_hour)\n\tend", "def set_for_time timestamp\n return nil unless @date\n case timestamp[0,2]\n when \"00\"\n @datetime.hour == 23 ? @date_add_1_hr : @date\n when \"23\"\n @datetime.hour == 00 ? @date_1_hr_ago : @date\n else\n @date\n end\n end", "def hour_of_day(*hours)\n merge(hour: hours)\n end", "def beginning_of_day\n #(self - seconds_since_midnight).change(:usec => 0)\n change(:hour => 0)\n end", "def once_per_hour &block\n\tcurrent_hour = Time.now.hour\n\n\tblock.call\n\t\nend", "def day_at(day, time_str)\n hour, minute = time_str.split('H')\n day.dup.getlocal.change(hour: hour, min: minute)\n end", "def time_default?(a_time)\n default = Time.now.change({ hour: 23, min: 59})\n hour(default) == hour(a_time)\n end", "def time_default?(a_time)\n default = Time.now.change({ hour: 23, min: 59})\n hour(default) == hour(a_time)\n end", "def locked?\n self.played_at <= self.class.hours_before_start_time_to_bet.hour.from_now\n end", "def beginning_of_hour\n change(min: 0)\n end", "def beginning_of_hour\n change(min: 0)\n end", "def shift_start_hour\n if self.start_time.hour > 2 && self.start_time.hour < 7\n errors.add(:start_time, 'must be between 7am and 2am')\n end \n end", "def adjust_for_happy_hour(preference)\n\n\t\tif($happy_hour and preference.quantity >= 2)\n\t\t\tpreference.price = preference.price/2\n\t\t\tpreference.save\n\t\t\tself.price -= preference.price\n\t\tend\n\n\t\tself.hh_flag = $happy_hour\n\n\t\tself.save\n\tend", "def set_day_hour\n @day_hour = DayHour.find(params[:id])\n end", "def local_beginning_of_day\n change_local(hour: 0, min: 0, min: 0)\n end", "def set_day_if_discarded\n if @datetime && @options[:discard_day]\n @datetime = @datetime.change(day: 1)\n end\n end", "def set_opening_hour\n if params[:id].present?\n @opening_hour = OpeningHour.find(params[:id])\n end\n end", "def dummy_time_for_day day_nr\n if open && close\n hour = open.hour\n min = open.min\n sec = close.hour + close.min / 100.0\n else\n hour = min = sec = 0\n end\n Time.zone.local(1970, 1, day_nr, hour, min, sec, 0)\n end", "def business_hours_later( hours)\n now = Time.now # freeze it here for this cycle of call, or it keeps changing every second\n wanted = (hours.to_i.hours / 1.second) # convert hours to seconds\n available = available_work_seconds( now) # how much available today\n # if we have enough time today, just tell the time possible today\n # if we will run out of time today, check next working day, add run-over seconds to the start-of-day\n (available > wanted) ? ( now + wanted.seconds) : ( next_workday(now) + (wanted - available).seconds)\n end", "def set_default_times\n if !self.start\n return\n end\n\n if self.start.hour == 0 # hour set to 0 if not otherwise defined...\n self.start = self.start + 9.hours\n end\n\n if !self.end\n if self.online?\n self.end = self.start + 1.hour\n else\n diff = 17 - self.start.hour\n self.end = self.start + diff.hours\n end\n end\n # TODO: Set timezone for online events. Where to get it from, though?\n # TODO: Check events form to add timezone autocomplete.\n # Get timezones from: https://timezonedb.com/download\n\n end", "def hour\n set_function_and_argument(:hour, nil)\n end", "def hours\n Thread.current[:datet_mode] = :hours\n return self\n end", "def update_time(time, value, date = nil)\n value = Time.zone.parse(value)\n time = DateTime.parse(date).utc if date.present?\n time.change(hour: value.hour, min: value.min)\n end", "def end_of_hour\n change(min: 59, sec: 59.999)\n end", "def correct_time?\n now = Time.zone.now\n now.hour == 8 && now.min < 5\n end", "def invariant?\n self.hour24.hour24? && self.min.min? && self.sec.sec?\n end", "def test_minute_set\n clock = Clock.new 0, -1\n alarm = AlarmClock.new 0, -1\n puts 'Wrong hour set' if clock.get_minute != 0\n puts 'Wrong hour set' if alarm.get_alarm_minute != 0\n clock.set_time 26, 0\n alarm.set_alarm 26, 0\n puts 'Wrong hour set' if clock.get_minute != 23\n puts 'Wrong hour set' if alarm.get_alarm_minute != 23\n end", "def with_hour(hour)\n LocalTime.of(hour, @minute, @second, @millis)\n end", "def check_lock_time(lock_time)\n false\n end", "def freeze_time_at(time, &block)\n Timecop.freeze parse_time(time), &block\n end", "def update_locktimes\n matchdays = Matchday.where(locked: false)\n digits = matchdays.pluck(:week)\n mdtimes = matchdays_times_for(digits)\n matchdays.each do |md|\n md.update(lock_time: mdtimes[md.week].min)\n end\n end", "def ensure_on_time!\n time_diff_sec = timestamp.to_i - Time.now.to_i\n\n unless DEADLINE_RANGE.cover?(time_diff_sec)\n if time_diff_sec < 0\n fail(TransactionTimestampTooOld, REPORT_DEADLINE_PAST)\n else\n fail(TransactionTimestampTooNew, REPORT_DEADLINE_FUTURE)\n end\n end\n end", "def beginning_of_day\n change(hour: 0)\n end", "def set_valid_until_time\n if valid_until\n self.valid_until = valid_until.utc + (23-valid_until.hour).hours + (59-valid_until.min).minutes + (59-valid_until.sec).seconds unless category && category.name.eql?(\"rideshare\")\n end \n end", "def setHour(hour)\r\n\t\t\t\t\t@hour = hour\r\n\t\t\t\tend", "def validate_day_lock(time, schedule)\n days_in_month = TimeUtil.days_in_month(time)\n date = Date.new(time.year, time.month, time.day)\n\n if value && value < 0\n start = TimeUtil.day_of_month(value, date)\n month_overflow = days_in_month - TimeUtil.days_in_next_month(time)\n elsif value && value > 0\n start = value\n month_overflow = 0\n else\n start = TimeUtil.day_of_month(schedule.start_time.day, date)\n month_overflow = 0\n end\n\n sleeps = start - date.day\n\n if value && value > 0\n until_next_month = days_in_month + sleeps\n else\n until_next_month = TimeUtil.days_to_next_month(date) + sleeps\n until_next_month -= month_overflow\n end\n\n sleeps >= 0 ? sleeps : until_next_month\n end", "def end_of_hour\n change(\n :min => 59,\n :sec => 59,\n :usec => 999999.999\n )\n end", "def hour() end", "def floor_hour(time)\n (Time.zone || Time).at((time.to_f/3600).floor * 3600)\n end", "def zero_hour?\n # if the times differ more than 1 minute we probably have more important issues\n needs_view && (ends_at.to_i - updated_at.to_i) < 60\n end", "def after_midnight2(t)\n hours, minutes = t.split(':').map(&:to_i)\n t = Time.new(2018, 4, 24, hours, minutes)\n ((t - FIXED_DAY) / 60) % MINUTES_PER_DAY\nend", "def hour=(value)\n RangeValidator.validate \"DateGroupItem.hour\", 0, 23, value\n @hour = value\n end", "def opening_hour\n 11 # 11am\n end", "def time_is_within_scheduled_days\n \tif start_time\n \t\tschedule = Schedule.find_by(id: Piece.find_by(id: piece_id).schedule_id)\n\t update_day = nil\n\t schedule.days.each do |day|\n\t \t\tupdate_day = day if start_time >= day.start_time and start_time <= day.end_time\n\t \t\tbreak if !update_day.nil?\n\t end\n\t update_day.nil? ? errors.add(:start_time, \"must be during one of the scheduled times\") : update_attribute(:day, update_day)\n\t else\n\t \tupdate_attribute(:day, nil)\n\t end\n end", "def update_all_locktimes\n matchdays = Matchday.all\n mdtimes = all_matchday_times\n matchdays.each do |md|\n md.update(lock_time: mdtimes[md.week].min)\n end\n end", "def dummy_time_for_day day_nr\n if open && close\n Time.new(1970, 1, day_nr, open.hour, open.min,\n close.hour + close.min / 100.0, 0)\n else\n Time.new(1970, 1, day_nr, 0, 0, 0, 0)\n end\n end", "def lock_interval= value\n put_settings(get_settings.tap {|s| s[:lock_interval] = value})\n end", "def grandfather_clock &block\n hour = Time.new.hour\n if hour >= 13\n hour = hour - 12\n end\n if hour == 0\n hour = 12\n end\n hour.times do\n block.call\n end\nend", "def set_day_time_slot_for_non_selected\n if is_friday == true\n self.day2 = 0\n self.time_slot2 = 0\n elsif is_friday != true \n self.is_friday = false\n self.time_slot = 0\n end \n end", "def set_happy_hour\n @happy_hour = HappyHour.find(params[:id])\n end", "def addHour(hour)\n addMin(hour * 60) ;\n end", "def update!(**args)\n @special_hour_periods = args[:special_hour_periods] if args.key?(:special_hour_periods)\n end", "def update!(**args)\n @special_hour_periods = args[:special_hour_periods] if args.key?(:special_hour_periods)\n end", "def update!(**args)\n @special_hour_periods = args[:special_hour_periods] if args.key?(:special_hour_periods)\n end", "def update!(**args)\n @special_hour_periods = args[:special_hour_periods] if args.key?(:special_hour_periods)\n end", "def update\n params[:office_hour].delete \"day\"\n\n respond_to do |format|\n if @office_hour.update_attributes(params[:office_hour])\n format.html { redirect_to action: \"index\", notice: 'Offnungszeit erfolgreich geändert.' }\n else\n format.html { render action: \"edit\" }\n end\n end\n end", "def mask_for_time_slots\n offset = (ends_at.next_day.beginning_of_day - ends_at) / APPOINTMENT_INTERVAL\n slots_number = (ends_at - starts_at) / APPOINTMENT_INTERVAL\n ('1' * slots_number).to_i(2) << offset\n end", "def check_sla_hours(issue)\n tracker_sla_day = SlaWorkingDay.where(:project_id => issue.project.id, :tracker_id => issue.tracker.id).last\n s_from = Time.parse(tracker_sla_day.start_at)\n e_to = Time.parse(tracker_sla_day.end_at)\n t = Time.now\n Time.local(t.year, t.month, t.day, s_from.hour, s_from.min) <= Time.now && Time.local(t.year, t.month, t.day, e_to.hour, e_to.min) >= Time.now\n end", "def next_hour(time, time_source = nil)\n seconds_left = time.to_i % 3600\n \n time + (seconds_left > 0 ? seconds_left : 3600)\n end", "def set_time(hour, minute)\n hour = 0 if hour.negative?\n hour = 23 if hour > 23\n minute = 0 if minute.negative?\n minute = 59 if minute > 59\n time = Time.new(0, nil, nil, hour, minute, nil, nil)\n @hour = time.hour\n @minutes = time.min\n end", "def hour_out\n @hour_out ||= time_out.hour\n end", "def set_working_hour\n @working_hour = WorkingHour.find(params[:id])\n end", "def open?\n return Time.now.hour >= 18 && Time.now.hour <= 22\n end", "def set_open_hour\n @open_hour = OpenHour.find(params[:id])\n end", "def set_open_hour\n @open_hour = OpenHour.find(params[:id])\n end", "def lock_exclusively!(max_run_time, worker)\n now = self.class.db_time_now\n if locked_by != worker\n # We don't own this job so we will update the locked_by name and the locked_at\n self.locked_at = now\n self.locked_by = worker\n end\n\n true\n end", "def end_of_day\n change(:hour => 23, :min => 59, :sec => 59, :usec => 999999.999)\n end", "def freeze_time_at(time, &block)\n Timecop.freeze parse_time(time), &block\n end", "def set_time_of_day\n @time_of_day = TimeOfDay.find(params[:id])\n end", "def grandfather_clock &block\n current_hour = Time.new.hour\n if current_hour > 12\n current_hour = current_hour - 12\n current_hour.times do\n block.call\n end\n else\n current_hour.times do\n block.call\n end\n end\nend", "def grandfather_clock(&block)\n\tcurrent_hour = Time.now.hour\n\tif current_hour == 0\n\t\tcurrent_hour = 12\n\telsif current_hour >= 13\n\t\tcurrent_hour -= 12\n\tend\n\n\tcurrent_hour.times do\n\t\tblock.call\n\tend\nend", "def available_on?(day, hour)\n @availability[day].include?(hour)\n end", "def lock\n if unlocked_status == false\n raise ArgumentError.new(\"You cannot lock this door - it is already locked\")\n else\n door_hash[:unlocked_status] = false\n end\n end", "def clock_hour24(clock)\n to_clock24(clock).hour\nend", "def open?(time = nil)\n time = Time.new if time.nil?\n time = time.in_time_zone(self.time_zone)\n day_index = time.wday\n return unless open_on_day? day_index\n hours = hours_on_day day_index\n (time > hours[0]) && (time < hours[1])\n end", "def opening(day)\n Time.now.utc.midnight\n .advance(seconds: opening_second(day)).strftime('%H:%M')\n end", "def hourly(options = {})\n branch options.merge(every: :hour)\n end", "def hourly(options = {})\n branch options.merge(every: :hour)\n end", "def add_hours(hours = 1)\n hours = hours.to_i\n cur_hour = @t_hour\n next_hour = cur_hour + hours\n \n if next_hour >= 24\n @t_hour = 0\n self.add_days(1)\n hours_left = (hours - 1) - (24 - cur_hour)\n self.add_hours(hours_left) if hours_left > 0\n elsif next_hour < 0\n @t_hour = 23\n self.add_days(-1)\n hours_left = hours + cur_hour + 1\n self.add_hours(hours_left) if hours_left < 0\n else\n @t_hour = next_hour\n end\n \n return self\n end", "def within_hour?\n\t\tupdated_at >= 1.hour.ago\t\t\n\tend", "def check_dates\r\n self.start_time -= 8.hours\r\n self.end_time -= 8.hours\r\n end", "def test_overwrite_just_hours\n task = tasks(:explain_search)\n task.hours = 2\n task.save\n task.reload\n assert_equal 120, task.minutes\n end", "def sleep_on_guard_locked(switch)\n @configuration.sleep_on_guard_locked = switch\n end", "def after_midnight(time)\n time_arr = time.split(':')\n hour = time_arr[0].to_i\n minutes = time_arr[1].to_i\n if hour == 24 && minutes == 0\n 0\n else\n minutes = minutes + ( hour * MINUTES_PER_HOUR )\n end\nend" ]
[ "0.5926051", "0.5670867", "0.55618924", "0.54835975", "0.5386091", "0.5386091", "0.5363356", "0.5363356", "0.53500473", "0.5318553", "0.52943623", "0.52839106", "0.523311", "0.52099615", "0.52004397", "0.5195707", "0.51875013", "0.5129389", "0.5124246", "0.5116015", "0.5105481", "0.50971735", "0.5087034", "0.5087034", "0.50866216", "0.5086514", "0.5086514", "0.50782484", "0.50707304", "0.50323", "0.5028886", "0.50280017", "0.49983302", "0.4985388", "0.49670058", "0.4966454", "0.49576145", "0.49532032", "0.49455094", "0.49385402", "0.49381843", "0.49340835", "0.4922476", "0.4913769", "0.4913505", "0.48911595", "0.4876332", "0.48718703", "0.4871759", "0.48600405", "0.4840492", "0.48261043", "0.48006174", "0.47941732", "0.47776794", "0.47730035", "0.47711727", "0.47577694", "0.47501415", "0.47455996", "0.4735525", "0.47324747", "0.47299713", "0.4728537", "0.47267586", "0.47239077", "0.47174016", "0.47138277", "0.47138277", "0.47138277", "0.47138277", "0.47081792", "0.47041368", "0.47003466", "0.46958148", "0.46916476", "0.4689077", "0.46814114", "0.46733937", "0.46692944", "0.46692944", "0.46651325", "0.46558076", "0.46448538", "0.46400076", "0.4632527", "0.4624043", "0.4622759", "0.46191868", "0.4618391", "0.4617555", "0.46147603", "0.46146503", "0.46146503", "0.46143922", "0.4605187", "0.46014172", "0.45973077", "0.4592037", "0.4589894" ]
0.6800757
0
For monthly rules that have no specified day value, the validation relies on the schedule start time and jumps to include every month even if it has fewer days than the schedule's start day. Negative day values (from month end) also include all months. Positive day values are taken literally so months with fewer days will be skipped.
def validate_day_lock(time, schedule) days_in_month = TimeUtil.days_in_month(time) date = Date.new(time.year, time.month, time.day) if value && value < 0 start = TimeUtil.day_of_month(value, date) month_overflow = days_in_month - TimeUtil.days_in_next_month(time) elsif value && value > 0 start = value month_overflow = 0 else start = TimeUtil.day_of_month(schedule.start_time.day, date) month_overflow = 0 end sleeps = start - date.day if value && value > 0 until_next_month = days_in_month + sleeps else until_next_month = TimeUtil.days_to_next_month(date) + sleeps until_next_month -= month_overflow end sleeps >= 0 ? sleeps : until_next_month end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_date_in_month(d,m)\n d >= 1 and Time.days_in_month(m,start.year) >= d ? d : raise(ArgumentError, \"invalid day #{d} for #{m}\") \n end", "def day_not_valid?\n return impossible_day_number? && wrong_day_number_in_month\n end", "def get_days_month(date=nil)\n date ||= @date\n\n return @schedule.days if @schedule.days > 0\n\n if @schedule.days_month != 'specific'\n if @schedule.days_month == 'last' && @schedule.days_month_day == nil\n return 0b0 | (1 << date.at_end_of_month.day)\n end\n end\n\n return 0b0 | (1 << @schedule.start_date.day)\n end", "def is_month_day?\n\t\t\tif !!self.day\n\t\t\t\tif self.day > 31\n\t\t\t\t\terrors.add(:day, \" number cannot be greater than 31.\")\n\t\t\t\telsif self.day < 1\n\t\t\t\t\terrors.add(:day, \" number cannot be less than one.\")\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def find_next_non_specific(date)\n values = ['first', 'second', 'third', 'fourth']\n\n case @schedule.days_month\n when 'last'\n d = Date.new(date.year, date.month, -1)\n\n return d if @schedule.days_month_day == nil\n\n d -= ((d.wday - @schedule.days_month_day) % 7)\n\n if d < date\n d = d.at_beginning_of_month\n\n months_since_startdate = (d.year * 12 + d.month) - (@schedule.start_date.year * 12 + @schedule.start_date.month)\n \n months_to_add = @schedule.period_num\n if (months_since_startdate % @schedule.period_num) > 0\n months_to_add = @schedule.period_num - (months_since_startdate % @schedule.period_num)\n end\n\n d += months_to_add.months\n return find_next_non_specific(d)\n end\n\n return d\n else\n if @schedule.days_month_day == nil\n if values.index(@schedule.days_month) + 1 < date.day\n months_to_add = @schedule.period_num\n months_since_startdate = (date.year * 12 + date.month) - (@schedule.start_date.year * 12 + @schedule.start_date.month)\n if (months_since_startdate % @schedule.period_num) > 0\n months_to_add = @schedule.period_num - (months_since_startdate % @schedule.period_num)\n end\n date += months_to_add.months\n end\n \n return Date.new(date.year, date.month, values.index(@schedule.days_month)+1) if @schedule.days_month_day == nil\n end\n \n d = Date.new(date.year, date.month, 1)\n d += (@schedule.days_month_day - d.wday) % 7\n d += (7 * values.index(@schedule.days_month))\n\n if d < date\n d = d.at_beginning_of_month\n\n months_since_startdate = (d.year * 12 + d.month) - (@schedule.start_date.year * 12 + @schedule.start_date.month)\n \n months_to_add = @schedule.period_num\n if (months_since_startdate % @schedule.period_num) > 0\n months_to_add = @schedule.period_num - (months_since_startdate % @schedule.period_num)\n end\n\n d += months_to_add.months\n\n d = Date.new(d.year, d.month, 1)\n d += (@schedule.days_month_day - d.wday) % 7\n d += (7 * values.index(@schedule.days_month))\n end\n\n return d\n end\n end", "def check_dates\n calendar = Line.find(self.line_id).calendar\n\n # check empty fields\n if self.start_month.nil? \n unless self.start_date.nil?\n errors.add(:start_date, \"can't be filled if month is empty\")\n end \n else\n if self.start_month <= calendar.months.count\n unless self.start_date <= max_days = calendar.months.find_by(number: self.start_month).days_normal\n errors.add(:start_date, \"can't exceed number of days in the month (#{max_days})\")\n end\n else\n errors.add(:start_month, \"can't be greater than number of months (#{calendar.months.count})\")\n end\n\n end\n\n if self.end_month.nil? \n unless self.end_date.nil?\n errors.add(:end_date, \"can't be filled if month is empty\")\n errors.add(:end_month, \"must not be empty\")\n end \n else\n if self.end_year.nil?\n errors.add(:end_month, \"can't be filled if year is empty\")\n errors.add(:end_year, \"must not be empty\")\n else\n if self.end_year < self.start_year\n errors.add(:end_year, \"can't precede start year\")\n end\n end\n\n if self.end_month <= calendar.months.count\n if self.end_month < self.start_month\n errors.add(:end_month, \"can't precede start month\")\n end\n\n unless self.end_date.nil?\n if self.end_date > max_days = calendar.months.find_by(number: self.end_month).days_normal\n errors.add(:end_date, \"can't exceed number of days in the month (#{max_days})\")\n else\n if self.end_date < self.start_date\n errors.add(:end_date, \"can't precede start date\")\n end\n end\n end\n else\n errors.add(:end_month, \"can't be greater than number of months (#{calendar.months.count})\")\n end\n \n end\n end", "def empty_due_on?(month:, day:)\n day.zero? && month.zero? || day.zero? && month == -1\n end", "def valid_month_day_combination?\n return false if not @@valid_months.include?(@month)\n return false if not @@valid_days.include?(@day)\n return MmDdYyyyDate.numbers_of_days_in_month(@month) >= @day.to_i\n end", "def wrong_day_number_in_month\n if thirty_days_month && @day > 30\n return true\n else\n return check_february\n end\n end", "def valid_month_interval(arr)\n if k = DATES_MAP[:cardinals][arr.first] \n [k, valid_day_of_week(arr.last)]\n else\n arr.slice(0,1).map {|v| valid_month_date(v) }.uniq.sort\n end\n end", "def check_start_date\n self.start_date = Date.current.beginning_of_month.next_month if start_date.nil?\n end", "def month_not_valid?\n if (@month > 0) && (@month < 13)\n return false\n end\n return true\n end", "def validate_feb\n errors.add( \"day\", \"day is greater than 29!!!\" ) if day > 29 and month == 2\n end", "def valid_dates\n if !start_date or start_date.month != 1 or start_date.day != 1\n errors.add(\"start_date\", \"Start date must be January 1st\")\n end\n if !end_date or end_date.month != 12 or end_date.day != 31\n errors.add(\"end_date\", \"End date must be December 31st\")\n end\n end", "def month=(value)\n value = 0 if value.nil?\n\n if value.is_a?(String) \n if value.length == 0\n value = 0\n elsif value =~ /\\A\\d{1,2}\\z/ \n value = value.to_i\n else\n raise MonthError, \"Month must be a valid one or two digit string or integer between 0 and 12\"\n end\n end\n\n if (value >= 0 && value <= 12)\n @bits = self.class.set_month(@bits, value)\n @bits = self.class.set_day(@bits, 0) if value == 0\n else\n raise MonthError, \"Month must an be integer between 0 and 12\"\n end\n end", "def start_of_month(year, month)\n begin\n # will raise exception if params are missing or invalid\n start_date = Date.new(year, month)\n raise ArgumentError if start_date < min_date\n raise ArgumentError if start_date > max_date\n start_date\n rescue\n default_start_date\n end\n end", "def valid?(y,m,d)\n ( y.class == Integer && y > 0 &&\n m.class == Integer && (1..12).include?(m) &&\n d.class == Integer &&\n (\n ((1..JDaysInMonth[m-1]).include?(d)) || (d == 30 && m == 12 && leap?(y))\n )\n ) ? true : false\n end", "def validate_month\n if self.month.length > 2 # assumes month is a name if longer than 2 chars\n @number_month = Date::MONTHNAMES.index(self.month.capitalize)\n if @number_month < Time.now.month\n self.month = @number_month\n else\n @valid = false\n end\n end\n end", "def run_cancel_exclusion(date)\n date += 1\n\n return find_next_non_specific(date) if @schedule.days_month != '' && @schedule.days_month !='specific'\n\n date += find_next_in_bitmask(get_days_month(date), date.day, month_length(date))\n date += periods_to_add(date).months\n\n # required for dates with day larger than 28 (not included in all months)\n if @schedule.days > 0\n while bitmask(@schedule.days)[date.day] != '1' do\n date += find_next_in_bitmask(get_days_month, date.day, month_length(date))\n date += periods_to_add(date).months\n end\n end\n\n return date\n end", "def monthly_weekdays_checked?(week_number, day_number)\n schedule = @issue.planning_schedule\n if schedule\n rule = schedule.recurrence_rules.first.try(:to_hash) || Hash.new\n if rule[:rule_type] == \"IceCube::MonthlyRule\"\n rule[:validations][:day_of_week][week_number].include?(day_number) rescue false\n else\n false\n end\n else\n false\n end\n\n # probably, this method should be written as follows:\n # rule = @issue.planning_schedule.recurrence_rules.first.to_hash\n # rule[:rule_type] == \"IceCube::MonthlyRule\" && rule[:validations][:day_of_week][week_number].include?(day_number)\n # rescue\n # false\n\n end", "def initialize(schedule)\n @result, @min, @hour, @day, @month, @wday = *schedule.match(CRON_REGEXP)\n validate\n end", "def validar_mes\n if @fecha.day < 15\n @fecha = @fecha - 1.month\n end\n end", "def initialize(month, start_date)\n @start_date = start_date\n raise(ArgumentError, \"Must start on Sunday\") if start_date.wday != 0\n\n @days = []\n (start_date..start_date + 6).each do |date|\n @days << Day.new(month, date)\n end\n end", "def day=(value)\n value = 0 if value.nil?\n\n if value.is_a?(String) \n if value.length == 0\n value = 0\n elsif value =~ /\\A\\d{1,2}\\z/\n value = value.to_i\n else\n raise DayError, \"Day must be a valid one or two digit string or integer between 0 and 31\"\n end\n end\n\n if (value >= 0 && value <= 31)\n raise DayError, \"A month must be set before a day\" if month == 0 && value !=0\n begin\n date = ::Date.civil(self.year, self.month, value) if value > 0\n @bits = self.class.set_day(@bits, value)\n rescue \n raise DayError, \"Day must be a valid day for the given month\"\n end\n else\n raise DayError, \"Day must be an integer between 0 and 31\"\n end\n end", "def result_date_in_milestone_range\n if milestone_start != nil\n errors.add(:started_at, \" must be started after #{milestone_start}\")\n end\n\n if milestone_end != nil\n errors.add(:ended_at, \" must be ended before #{milestone_end}\")\n end\n end", "def could_be_month?(month); end", "def valid_date\n\n array_30 = [4, 6, 9, 11]\n array_31 = [1, 3, 5, 7, 8, 10, 12]\n\n puts \"Enter a month\"\n month = gets.chomp.to_i\n\n puts \"Enter a day\"\n day = gets.chomp.to_i\n\n puts \"Enter a year\"\n year = gets.chomp.to_i\n\n if month < 1 || month > 12\n puts \"Invalid Month\"\n elsif month == 2 && (day < 1 || day > 29)\n puts \"Invalid Day\"\n elsif month == 2 && day == 29 && (year % 4 != 0 && year % 400 != 0)\n puts \"Invalid Day\"\n elsif array_30.include?(month) && (day < 1 || day > 30)\n puts \"Invalid Day\"\n elsif array_31.include?(month) && (day < 1 || day > 31)\n puts \"Invalid Day\"\n elsif year > 2018 || year < 1000\n puts \"Invalid Year\"\n else\n puts \"This is a valid date!\"\n end\n\nend", "def date_verify\n if end_date && start_date.nil?\n errors.add(:end_date, \"cannot only specify end date\")\n elsif all_day && start_date.nil?\n errors.add(:all_day, \"cannot specify without date\")\n elsif (start_date && end_date) && (start_date > end_date)\n errors.add(:start_date, \"cannot larger than end date\")\n end\n end", "def was_excluded(date)\n if @schedule.days_month == 'specific'\n return false if bitmask(@schedule.days)[date.day] == '1'\n\n if @schedule.exclusion_met_day\n return date.wday == @schedule.exclusion_met_day\n end\n elsif @schedule.days_month == 'last' \n if @schedule.days_month_day == nil\n return date.at_end_of_month != date\n else\n return date.wday != @schedule.days_month_day\n end\n elsif @schedule.days_month_day == nil\n values = ['first', 'second', 'third', 'fourth']\n return date.day != (values.index(@schedule.days_month) + 1)\n else\n weekdays = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat']\n return date.wday != weekdays.index(@schedule.days_month_day)\n end\n\n return false\n end", "def day_months\n return create_monthly_dates day(1) if monthly?\n return mid_term_day_months if charged_in_code == LEGACY_MID_TERM\n day_months = []\n 1.upto(maximum_dates) do |index|\n break if empty_due_on? month: month(index), day: day(index)\n day_months << DueOnImportable.new(month(index), day(index))\n end\n day_months\n end", "def test_should_return_every_day_of_month\n assertion = Month.april(2003).every(:tuesday)\n assert_equal assertion.size, 5\n assert_equal assertion, [Date.new(2003,4,1),Date.new(2003,4,8),Date.new(2003,4,15),Date.new(2003,4,22),Date.new(2003,4,29)]\n end", "def time_period_for_room_reservation\n time_period = (self.start_date.year * 12 + self.start_date.month) - (Date.today.year * 12 + Date.today.month)\n errors.add(:start_date, \"you can book your room before 6 months only\") if time_period > 6\n end", "def set_day_if_discarded; end", "def validate_day(spec)\n validate_numeric(spec, 1, 31)\n end", "def validate_month(spec)\n return true if spec == \"*\"\n\n if spec.respond_to? :to_int\n validate_numeric(spec, 1, 12)\n elsif spec.respond_to? :to_str\n # Named abbreviations are permitted but not as part of a range or with stepping\n return true if %w{jan feb mar apr may jun jul aug sep oct nov dec}.include? spec.downcase\n\n # 1-12 are legal for months\n validate_numeric(spec, 1, 12)\n else\n false\n end\n end", "def test_should_retun_every_set_of_days_of_month\n assertion = Month.august(2006).every!(:monday,:wednesday)\n # verify\n assert assertion.is_a?(Hash)\n # monday assertions\n assert_equal assertion[:monday].size, 4\n assert_equal assertion[:monday], [Date.new(2006,8,7),Date.new(2006,8,14),Date.new(2006,8,21),Date.new(2006,8,28)]\n # wednesday assertions\n assert_equal assertion[:wednesday].size, 5\n assert_equal assertion[:wednesday],\n [Date.new(2006,8,2),Date.new(2006,8,9),Date.new(2006,8,16),Date.new(2006,8,23),Date.new(2006,8,30)]\n end", "def check_schedule(range_of_days)\n\tif 1 > range_of_days.to_i\n\t\traise \"The schedule of the diary must last for at least one day.\"\n\telsif 40 < range_of_days.to_i\n\t\traise \"Save paper! Don't generate schedule for >40 days.\"\n\tend\n\t\n\t# Set the duration of the food diary\n\t$duration = range_of_days.to_i\nend", "def month() end", "def end_of_start_month(start_date)\n begin\n end_date = start_date.end_of_month\n raise ArgumentError if end_date > max_date\n end_date\n rescue\n default_end_date\n end\n end", "def mday() end", "def isValidDate(day, month, year)\n if((day.is_a? Integer) && (month.is_a? Integer) && (year.is_a? Integer))\n max_day = 31\n if((month >= 1) && (month <= 12))\n case month\n when 2\n max_day = 28\n when 4, 6, 9, 11\n max_day = 30\n end\n\n if((day >= 1) && (day <= max_day))\n puts \"La date est valide.\"\n else puts \"Le jour de la date n'est pas correct avec le mois.\"\n end\n\n else puts \"Le mois de la date n'est pas correct.\"\n end\n else puts \"La date n'est pas correcte.\"\n end\nend", "def validate_activity_sdate\n limite = Date.today + 7\n if self.activity_date_start > limite\n errors.add('Fecha Inicio de Actividad: ', \"No se pueden capturar actividades con fecha de inicio mayor a 7 dias a partir del día de hoy\")\n end\n end", "def find_day_of_month(day=@day, first_day_of_month=@first_day_of_month)\r\n day = ((day - 1) + first_day_of_month) % 7\r\n return 7 if day == 0\r\n day\r\n end", "def associated_day_of_months\n months = associated_months\n result = []\n \n\t start_date = event_start\n\t start_date = entry_deadline if is_opportunity?\n\t \t \n\t if !start_date.blank?\n #if we have no finish date then we only have the day of the event start\n if event_finish.blank?\n result = [100*start_date.month + start_date.day]\n else\n position_date = start_date\n while position_date <= event_finish\n result << 100*position_date.month + position_date.day\n position_date = position_date + 1.day\n break if result.length > 31 #no point iterating through years if we have all the days already\n end\n end\n end\n result.sort\n end", "def month=(value)\n RangeValidator.validate \"DateGroupItem.month\", 0, 12, value\n @month = value\n end", "def end_of_month\n #self - ((self.mday-1).days + self.seconds_since_midnight)\n last_day = ::Time.days_in_month(month, year)\n change(:day => last_day, :hour => 23, :min => 59, :sec => 59, :usec => 0)\n end", "def month\n set_function_and_argument(:month, nil)\n end", "def nth_day_of_month? d, n\n case n <=> 0\n when -1\n nth_last_day_of_month(d) == n\n when 0\n raise ArgumentError.new(\"must be non-zero integer\")\n when 1\n nth_day_of_month(d) == n\n end\n end", "def find_next_date_for_monthly start\n if month_end || (start.month == 2 && month_day > 28) || month_day > 30\n next_date = start.end_of_month\n else\n next_date = Date.new(start.year, start.month, month_day)\n end\n return next_date if next_date <= end_date\n #next_date = next_date + 1.month\n #next_date = next_date.end_of_month if month_end\n nil\n end", "def test_should_retun_every_set_of_days_of_month_as_array\n assertion = Month.august(2006).every(:monday,:wednesday)\n # verify\n assert assertion.is_a?(Array)\n # check for data integrity\n assert_equal assertion.size, 9\n assert_equal assertion, [Date.new(2006,8,2),Date.new(2006,8,9),Date.new(2006,8,16),Date.new(2006,8,23),Date.new(2006,8,30),Date.new(2006,8,7),Date.new(2006,8,14),Date.new(2006,8,21),Date.new(2006,8,28)]\n end", "def test_day_of_scheduled_reminders\n @reminder.scheduled_reminders.each{|x| assert_equal x.run_at.mday, @reminder.fq_day }\n end", "def valid?\n return false if !@day.nil? && @day > 7\n return false if !@day.nil? && @day < 1\n true\n end", "def merch_month\n # TODO: This is very inefficient, but less complex than strategic guessing\n # maybe switch to a binary search or something\n @merch_month ||= (1..12).detect do |num|\n date_calc.end_of_month(start_of_year.year, num) >= date && date >= date_calc.start_of_month(start_of_year.year, num)\n end\n end", "def initialize\n super\n @lower_limit = MonthLowerLimit\n @upper_limit = MonthUpperLimit\n @single_value_pattern = MonthSingleValuePattern\n @range_pattern = MonthRangePattern\n end", "def update!(**args)\n @month_day = args[:month_day] if args.key?(:month_day)\n @use_last_day_if_month_day_past_end = args[:use_last_day_if_month_day_past_end] if args.key?(:use_last_day_if_month_day_past_end)\n end", "def valid_date(month, date, year)\n if date > 31\n false\n elsif month > 12\n false\n elsif month==4 || month==6 || month==9 || month==11 && date >30\n false\n elsif month==2 && date >28\n false\n elsif year %4 ==0 && month ==2 && date >29\n false\n else\n true\n end\nend", "def calculate_start_date\n if !@end_date.blank? && @data_amount > 0\n @start_date = @end_date - (@data_amount-1).month\n @start_date.end_of_month\n end\n end", "def test_31day_mo\n Charges.new(Date.new(2011,01,15),\n Date.new(2011,02,15),\n\t\t1, 1, 20)\n charges = Charge.find_all_by_reservation_id 20\n assert_equal 1, charges.size\n assert_equal 1, charges[0].season_id\n assert_equal Date.new(2011,01,15), charges[0].start_date\n assert_equal Date.new(2011,02,15), charges[0].end_date\n assert_equal 1.0, charges[0].period.to_f\n assert_equal 288.0, charges[0].rate.to_f\n assert_equal 288.0, charges[0].amount.to_f\n assert_equal 0.0, charges[0].discount.to_f\n assert_equal Charge::MONTH, charges[0].charge_units\n end", "def next_date_for_day_of_month(day_in_month)\n if Date.valid_date?(self.year, self.month, day_in_month)\n date_in_current_month = Date.new(self.year, self.month, day_in_month)\n if self.day < day_in_month\n return date_in_current_month\n else\n return date_in_current_month.next_month\n end\n end\n\n self.end_of_month\n end", "def start_of_month\n @start_of_month ||= date_calc.start_of_month(year, merch_month)\n end", "def valid?(v)\n day?(v)\n end", "def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n #use the built-in error checking\n if not runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n #assign the user inputs to variables\n schedule = runner.getOptionalWorkspaceObjectChoiceValue(\"schedule\",user_arguments,model)\n minimum_fraction = runner.getDoubleArgumentValue(\"minimum_fraction\",user_arguments)\n \n #check the schedule\n if schedule.empty?\n runner.registerError(\"Cannot find schedule.\")\n return false\n end\n schedule = schedule.get.to_ScheduleRuleset\n if schedule.empty?\n runner.registerError(\"Cannot find schedule.\")\n return false\n end\n schedule = schedule.get\n \n #check the fraction for reasonableness\n if not 0 <= minimum_fraction and minimum_fraction <= 1\n runner.registerError(\"Minimum fractional value needs to be between or equal to 0 and 1.\")\n return false\n end\n \n #check the fraction for reasonableness\n schedule.scheduleRules.each do |scheduleRule|\n # these are already unique, no need to clone\n daySchedule = scheduleRule.daySchedule\n times = daySchedule.times\n values = daySchedule.values\n daySchedule.clearValues\n \n times.each_index do |i|\n value = [values[i], minimum_fraction].max\n daySchedule.addValue(times[i], value)\n end\n end\n\n return true\n\n end", "def validate_date(spreadsheet_id)\n date = get_date_array(spreadsheet_id)\n if date[0].to_i >= 1 and date[0].to_i <= 12 and date[1].to_i == 1 and date[2].to_i >= 2016 and get_start_day(date[3]) != nil\n return true\n else\n return false\n end\nend", "def time_is_within_scheduled_days\n \tif start_time\n \t\tschedule = Schedule.find_by(id: Piece.find_by(id: piece_id).schedule_id)\n\t update_day = nil\n\t schedule.days.each do |day|\n\t \t\tupdate_day = day if start_time >= day.start_time and start_time <= day.end_time\n\t \t\tbreak if !update_day.nil?\n\t end\n\t update_day.nil? ? errors.add(:start_time, \"must be during one of the scheduled times\") : update_attribute(:day, update_day)\n\t else\n\t \tupdate_attribute(:day, nil)\n\t end\n end", "def set_boundaries\n months = calculate_month_and_next_month(@values[:year],\n @values[:time_frame])\n set_values(months)\n return \"Calculated interval for month from input:\" \\\n \" #{months[:actual]} - #{months[:next]}\"\n end", "def month? = unit == 'month'", "def monthly_dry_days(day)\n month_result_string(day).count('1')\n end", "def parse_days\n [\n [\n 0,\n params[:page].presence&.to_i || scheduler.days_ahead_with_open_slot\n ].compact.max,\n Rails.configuration.x.schedule_up_to_days\n ].min\n end", "def parse_days\n [\n [\n 0,\n params[:page].presence&.to_i || scheduler.days_ahead_with_open_slot\n ].compact.max,\n Rails.configuration.x.schedule_up_to_days\n ].min\n end", "def validate_date(input_date) \n too_early = Date.parse(\"31 December 2019\")\n too_late = (Date.today)+1\n raise DateError unless ((input_date > too_early) && (input_date < too_late))\n end", "def check_available_dates(dress_size, month, year)\n\t\tdates = []\n\t\tstart_date = Date.parse(\"#{year}-#{month}-1\")\n\t\tend_date = start_date.end_of_month\n\t\tfor date in start_date..end_date\n\t\t\tif can_make_reservation?(dress_size, date) and !date.saturday? and !date.sunday?\n\t\t\t\tdates << date\n\t\t\tend\n\t\tend\n\t\treturn dates\n\tend", "def beginning_of_month\n #self - ((self.mday-1).days + self.seconds_since_midnight)\n change(:day => 1,:hour => 0, :min => 0, :sec => 0, :usec => 0)\n end", "def month\n sunday = @monday + 6\n return 1 if sunday.month == 1 && sunday.year == @year\n return 12 if @monday.month == 12 && @monday.year == @year\n (@monday + 2).month\n end", "def override_all_day_based_on_duration\n starts_on = starts_at.to_date\n ends_on = ends_at.to_date\n if starts_on != ends_on\n self.all_day = true\n end\n true\n end", "def make_days\n month = (1..@day_num).collect do |day|\n Day.new(Date.parse(\"#{@year}-#{@month}-#{day}\"))\n end\n\n month[0].date.wday.times { month.insert(0, Day.new(Date.new))}\n month\n end", "def is_excluded(date)\n return false if @schedule.days_exclude == 0\n\n days_bitmask_exclude = bitmask(@schedule.days_exclude)\n if @schedule.days_month == 'specific' || (@schedule.days_month != 'specific' && @schedule.days_month_day == nil)\n day_idx = (date.wday) % 7\n else\n day_idx = date.day\n end\n\n return days_bitmask_exclude[day_idx] == '1'\n end", "def test_should_return_every_day_of_month_as_array\n assertion = Month.april(2003).every(:tuesday)\n assert_equal assertion.size, 5\n assert_equal assertion, [Date.new(2003,4,1),Date.new(2003,4,8),Date.new(2003,4,15),Date.new(2003,4,22),Date.new(2003,4,29)]\n end", "def thirty_days_month\n return @month == 4 || @month == 6 || @month == 9 || @month == 11\n end", "def unavailable_dates\n errors[:base] << \"Unavailable dates.(-1)\" if start_date.present? && start_date < Time.zone.today\n errors[:base] << \"Unavailable dates.(-2)\" if (start_date.present? && end_date.present?) && start_date >= end_date\n errors[:base] << \"Unavailable dates.(-3)\" if (start_time.present? && end_time.present?) && start_time >= end_time\n errors[:base] << \"Unavailable dates.(-4)\" if (day_of_week.present? && week_of_month.present?) && ([0,1].exclude?(day_of_week) && week_of_month == 6)\n end", "def day_rule\n @day_rules[@this_day.key_by_date] || @day_rules[@this_day.key_by_day]\n end", "def month\n @year = params[:year].to_i\n @month = params[:month].to_i\n @first_day = @event.first_day_of_month(@year, @month)\n @last_day_of_month = Date.new(@year, @month, 1).end_of_month\n end", "def monthly\n end", "def validate_start_and_end_date\n errors.add(:start_date, I18n.t('spree.active_sale.event.validation.errors.invalid_dates')) if invalid_dates?\n end", "def check_default_car_schedule\n new_default_car_schedule = Set.new(self.default_car_schedule)\n new_default_car_schedule_checked = []\n DAYNAMES.each do |dayname|\n new_default_car_schedule_checked.push dayname unless !new_default_car_schedule.include?(dayname)\n end\n self.default_car_schedule = new_default_car_schedule_checked\n end", "def validate\n\n # no need to validate if disabled\n return if disabled?\n\n # validate that we've filled in all the days\n if rateType == 'Day'\n\n if dayValue == 0\n\n if requireFullWeek == true\n\n # must fill in whole week, and datValue is 0\n errors.add(:dayValue, \"You must supply a day value for all shifts, including weekends\")\n\n else\n\n # requireFullWeek is false\n if (dateValue.wday != 6 && dateValue.wday != 0)\n\n # an entry is not filled in for mon to fri\n errors.add(:dayValue, \"You must supply a day value for each shift, Mon - Fri\")\n \n end\n \n end\n\n end\n\n # return as there is no need to validate anything else\n return\n \n end\n\n # now validating hourly rate entry\n if hours.blank?\n \n # can we allow blank hours?\n if is_bank_hol == false\n \n if requireFullWeek == true\n \n # its not a bank holiday and we need the whole week\n msg = \"Hours must be supplied for all days\"\n\n else\n\n # its not a bank hol and we dont need the whole week\n if (dateValue.wday != 6 && dateValue.wday != 0)\n\n # an entry for mon-fri isnt supplied\n msg = \"Hours must be supplied for Monday - Friday\"\n \n end\n\n end\n \n end\n\n if !msg.blank?\n\n errors.add(:hours, msg)\n\n end\n\n end\n\n # validate start, end and break times\n if !startTime.blank? && !finishTime.blank? && !hours.blank? && requireTimes\n\n time_difference = Time.parse(finishTime) - Time.parse(startTime)\n break_seconds = Time.parse(breakHours) - Time.parse(\"00:00\") unless breakHours.blank?\n time_difference -= break_seconds unless break_seconds.nil?\n specified_hours = Time.parse(hours) - Time.parse(\"00:00\")\n \n if (time_difference <=> specified_hours) != 0\n \n # the time entered in hours doesnt match the calculation\n errors.add(:hours, \"Make sure the hours supplied correctly relates to the time periods\")\n \n end\n\n end\n\n # check times are valid\n if (startTime.blank? || finishTime.blank?)\n \n #logger.info(\"date: #{dateValue}, manual: #{manual}, disabled: #{disabled}, rateType: #{rateType}, rate category: #{rate.category}\")\n \n if requireTimes == true\n\n # if we dont require full week and this is a w/e then dont bother carrying on\n if requireFullWeek == false && (dateValue.wday == 6 || dateValue.wday == 0)\n return\n end\n\n # if we get here then there's a prob so display error\n errors.add(:startTime, \"You must supply start times\") if startTime.blank? && rate.category != 'Unpaid'\n errors.add(:finishTime, \"You must supply finish times\") if finishTime.blank? && rate.category != 'Unpaid'\n\n end\n\n end\n \n end", "def nth_negative_instance_of_day_in_month(date)\n # How many days are there in this month? We'll grab the first of next month, then roll\n # back a day to see.\n next_month = Time.utc(date.year, (date.month % 12) + 1)\n next_month = Time.utc(next_month.year + 1, next_month.month) if next_month < date\n month_days = (next_month - 86400).day\n return -1 - ((month_days - date.day) / 7)\n end", "def month=(_arg0); end", "def reduce_schedule(sch, start_hr, start_min, end_hr, end_min, setback_c)\n if sch.to_ScheduleRuleset.is_initialized\n sch = sch.to_ScheduleRuleset.get\n else\n return false\n end\n \n @infos << \"Modifying #{sch.name}\"\n \n start_time = OpenStudio::Time.new(0, start_hr, start_min, 0)\n end_time = OpenStudio::Time.new(0, end_hr, end_min, 0)\n crosses_midnight = false\n if start_time < end_time\n crosses_midnight = false\n elsif start_time > end_time\n crosses_midnight = true\n end\n \n @infos << \"crosses_midnight = #{crosses_midnight}\"\n \n day_profiles = []\n day_profiles << sch.defaultDaySchedule\n sch.scheduleRules.each do |rule|\n day_profiles << rule.daySchedule\n end\n \n day_profiles.each do |day_profile|\n\n #report out the original schedule\n @infos << \"Before setback:\"\n day_profile.times.zip(day_profile.values).each do |time,val|\n @infos << \"#{time} = #{val}\"\n end\n\n original_start_time_val = day_profile.getValue(start_time)\n original_end_time_val = day_profile.getValue(end_time)\n day_profile.addValue(start_time,original_start_time_val)\n day_profile.addValue(end_time,original_end_time_val)\n times_vals = day_profile.times.zip(day_profile.values)\n \n #report out the original schedule\n @infos << \"After adding breaks but before setback:\"\n day_profile.times.zip(day_profile.values).each do |time,val|\n @infos << \"#{time} = #{val}\"\n end\n \n #apply the setback\n times_vals.each do |time,val|\n if crosses_midnight == false\n if time > start_time and time <= end_time\n day_profile.addValue(time, val + setback_c)\n end\n elsif crosses_midnight == true\n if time <= end_time or time > start_time\n day_profile.addValue(time, val + setback_c)\n end\n end\n end #next time val pair in the schedule\n \n #report out the changed schedule\n @infos << \"After setback:\"\n day_profile.times.zip(day_profile.values).each do |time,val|\n @infos << \"#{time} = #{val}\"\n end\n \n end #next day profile\n \n return sch\n \n end", "def test_days_in_month()\n first_month=days_in_month(1,2016)\n assert_equal(31,first_month)\n end", "def absolute_day(month, day)\n\n mo = {\n 1 => 31,\n 2 => 28,\n 3 => 31,\n 4 => 30,\n 5 => 31,\n 6 => 30,\n 7 => 31,\n 8 => 31,\n 9 => 30,\n 10 => 31,\n 11 => 30,\n 12 => 31,\n }\n\n # hash v. loop of arrays, computation v. memory tradeoff\n\n total_days = 0\n\n\n (1...month).each do |i| #1...month is (month-1)\n total_days += mo[i]\n end\n\n total_days + day\n\nend", "def minimum_duration\n # if move_in.present? && move_out.present? && move_out < (move_in.advance(:months => 3) - 1.day)\n unless duration >= 3\n errors.add(:move_out, \"3 Months minimum\")\n end\n end", "def refine_month(m)\n mon = check_num_str(m)\n adjust_month(mon)\n end", "def duration_days_must_be_positive\n errors.add(:duration_days, \"must be selected\") if !duration_days.blank? and duration_days < 0\n end", "def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n # use the built-in error checking\n if !runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n timesteps_per_hr = runner.getIntegerArgumentValue(\"timesteps_per_hr\", user_arguments)\n begin_month = runner.getIntegerArgumentValue(\"begin_month\", user_arguments)\n begin_day_of_month = runner.getIntegerArgumentValue(\"begin_day_of_month\", user_arguments)\n end_month = runner.getIntegerArgumentValue(\"end_month\", user_arguments)\n end_day_of_month = runner.getIntegerArgumentValue(\"end_day_of_month\", user_arguments)\n\n # Error checking\n if timesteps_per_hr < 1 or timesteps_per_hr > 60\n runner.registerError(\"User-entered #{timesteps_per_hr} timesteps per hour must be between 1 and 60.\")\n return false\n end\n\n if 60 % timesteps_per_hr != 0\n runner.registerError(\"User-entered #{timesteps_per_hr} timesteps per hour does not divide evenly into 60.\")\n return false\n end\n\n if not (1..12).to_a.include? begin_month or not (1..12).to_a.include? end_month\n runner.registerError(\"Invalid begin month (#{begin_month}) and/or end month (#{end_month}) entered.\")\n return false\n end\n\n { begin_month => begin_day_of_month, end_month => end_day_of_month }.each_with_index do |(month, day), i|\n leap_day = 0\n leap_day += 1 if month == 2 # february\n day_of_month_valid = (1..Constants.NumDaysInMonths[month - 1] + leap_day).to_a.include? day # accommodate leap day\n unless day_of_month_valid\n if i == 0\n runner.registerError(\"Invalid begin day of month (#{begin_day_of_month}) entered.\")\n elsif i == 1\n runner.registerError(\"Invalid end day of month (#{end_day_of_month}) entered.\")\n end\n return false\n end\n end\n\n success = Simulation.apply(model, runner, timesteps_per_hr, min_system_timestep_mins = nil, begin_month, begin_day_of_month, end_month, end_day_of_month)\n return false if not success\n\n runner.registerInfo(\"Set the simulation timesteps per hour to #{timesteps_per_hr}.\")\n runner.registerInfo(\"Set the run period begin and end month/day to #{begin_month}/#{begin_day_of_month} and #{end_month}/#{end_day_of_month}, respectively.\")\n\n return true\n end", "def check_end_date\n # if self.category.eql?(\"appointment\")\n unless self.start_date.nil? or self.end_date.nil?\n if (self.end_date < self.start_date)\n self.category.eql?(\"appointment\")? self.errors.add(' ', 'End Date can\\'t be before Start Date') : self.errors.add(' ', 'Due Date can\\'t be before Start Date')\n end\n if self.end_date == self.start_date\n self.errors.add(' ', 'End Time can not be before start time') if (self.end_date.to_time < self.start_date.to_time)\n end\n end\n # end\n end", "def initial_call_off_start_date_valid_date\n Date.parse(\"#{initial_call_off_start_date_dd.to_i}/#{initial_call_off_start_date_mm.to_i}/#{initial_call_off_start_date_yyyy.to_i}\")\n rescue ArgumentError\n errors.add(:initial_call_off_start_date, :not_a_date)\n end", "def all_non_week_days_of_month\n ending_of_month.downto(beginning_of_month).select(&:week_end?)\n end", "def report_regular_month_array(now = DateTime.now)\n # size 12 array: the last 12 months\n return self.hours_year_array(now).map do |hrs|\n hrs >= MIN_REGULAR_MONTHLY_HOURS ? true : false\n end\n end", "def redistribute_semi(semi_annual_val, start_month, new_data)\n six_month = []\n (0..5).each do |offset|\n date = start_month + offset.months\n value = new_data[date] || data[date]\n return if value.nil? ## bail if even a single monthly value is missing\n six_month.push(value)\n end\n diff = (semi_annual_val - six_month.average) * 2.0 ## must be float multiplication\n begin\n (new_data[start_month + 1.months] += diff) rescue raise('1')\n (new_data[start_month + 3.months] += diff) rescue raise('3')\n (new_data[start_month + 5.months] += diff) rescue raise('5')\n rescue => e\n bad_date = start_month + e.message.to_i.months\n raise \"redistribute_semi: cannot redistribute because data missing at #{bad_date}\"\n end\n end", "def month\n @month || self.starts_at.month\n end" ]
[ "0.7001527", "0.62598765", "0.61938107", "0.61187536", "0.59830344", "0.59707874", "0.5893304", "0.5869121", "0.5854358", "0.5848651", "0.58238876", "0.5803935", "0.578741", "0.5786882", "0.57745934", "0.5769968", "0.57583195", "0.5659315", "0.56385165", "0.5567894", "0.5544881", "0.55345005", "0.5525704", "0.5522437", "0.54996926", "0.5464267", "0.5459175", "0.54411787", "0.5431647", "0.5425404", "0.5376038", "0.53741086", "0.53604966", "0.534411", "0.5343919", "0.534275", "0.53302395", "0.53267324", "0.53254503", "0.5312013", "0.526883", "0.526354", "0.5252134", "0.5246789", "0.5243768", "0.52430046", "0.52378994", "0.52329725", "0.52203625", "0.5216309", "0.5210396", "0.52036816", "0.520363", "0.51930946", "0.5183471", "0.5176393", "0.5169879", "0.5163755", "0.51534057", "0.5146886", "0.5139326", "0.51368165", "0.51302177", "0.51238173", "0.5115026", "0.5105903", "0.51028126", "0.50923014", "0.50923014", "0.50866044", "0.5081441", "0.5081044", "0.5079725", "0.5078193", "0.5075755", "0.5068296", "0.50465673", "0.5039823", "0.50377715", "0.503107", "0.5024673", "0.50175524", "0.5009881", "0.50029504", "0.49988174", "0.49984553", "0.49971887", "0.49911538", "0.49907666", "0.4987692", "0.4983383", "0.4981269", "0.49746382", "0.49715328", "0.4971079", "0.49706116", "0.4965187", "0.49603656", "0.49599242", "0.49585542" ]
0.66260153
1
makes attributes readable outside of class allows both methods to run in 1 method
def virus_effects speed_of_spread predicted_deaths end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attributes=(_arg0); end", "def attr_reader(*)\n end", "def attr_accessor_sybling(method)\n attr_reader?(method) ? to_attr_writer(method) : to_attr_reader(method)\n end", "def attr_reader(*vars)\n super *(add_tracked_attrs(true, false, *vars))\n end", "def attr; end", "def set_attributes_to_reader\n if !@attributes.empty?\n @attributes.each { |ele|\n self.class.__send__(:attr_reader, ele.downcase)\n }\n end\n\nend", "def attribute=(_arg0); end", "def attribute=(_arg0); end", "def readonly(*syms)\nreturn if syms.size == 0 # If no arguments, do nothing\ncode = \"\"\n# Start with an empty string of code\n# Generate a string of Ruby code to define attribute reader methods.\n# Notice how the symbol is interpolated into the string of code.\nsyms.each do |s|\n# For each symbol\ncode << \"def #{s}; @#{s}; end\\n\"\n# The method definition\nend\n# Finally, class_eval the generated code to create instance method\nclass_eval code\nend", "def define_attributes\n @info.attributes.each do |attr|\n rname = underscore(attr.name)\n self.class.__send__(:define_method, rname) { self[attr.name] } if attr.readable?\n self.class.__send__(:define_method, rname + \"=\") {|v| self[attr.name] = v } if attr.writable?\n end\n end", "def attributes(*args)\n attr_accessor(*args)\n end", "def accessibility; end", "def attr_accessor(*args)\n attr_reader(*args)\n attr_writer(*args)\n end", "def method_missing(method, *args, &block)\n attributes.public_send(method, *args, &block)\n end", "def attribute; end", "def attribute; end", "def attribute; end", "def attribute; end", "def attribute; end", "def attribute; end", "def attribute; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def instance_attributes; end", "def username #for each attribute of a class you have two methods a reader and a writer method (same as a gettter and setter methods)\n return @username #the variable \"@username\" is ONLY created when the WRITER, NOT the reader is called; it's created when lana.username - \"lana\" is called ; if the reader is called and the variable is not in the initialize method and the writer method has not been called the program will give you an error; the @symbol is called an instance variable\n end", "def create_getters\n self.class::ATTRS.each do |method_name|\n self.class.class_eval do\n define_method(method_name) do\n get_webpage\n eval(\"scrape_#{method_name}\")\n eval(\"@#{method_name}\")\n end\n end\n end\n end", "def method_missing(method_name, *args, &block)\n return super unless define_attribute_methods\n self.send(method_name, *args, &block)\n end", "def methods() end", "def attr_writer(*args)\n sym_args=args_to_sym(args)\n sym_args.each do |value|\n self.instance_eval(\"def #{value}=(arg); @#{value}=arg;end;\")\n end\n \n end", "def allowed_attributes=(_arg0); end", "def allowed_attributes=(_arg0); end", "def my_attr_reader(*args)\n\targs.each do |a|\n\t\tself.class_eval do\n\t\t\tinstance_variable_set \"@#{a}\", nil\n\t\t\tdefine_method a do\n\t\t\t\tinstance_variable_get \"@#{a}\"\n\t\t\tend\n\t\tend\n\tend\nend", "def setup_object_attributes; end", "def add_attr_accessors_to_self\n instance_variables.each do |name|\n method_name = name[1..-1].to_sym\n MetricFu::Configuration.send(:attr_accessor, method_name)\n end\n end", "def getters; end", "def class_attributes; end", "def method_missing(meth, *args, &blk)\n match = meth.to_s.match(/^([a-zA-Z\\_]+)(=|$)$/)\n if match\n attribute, setter = match[1], !match[2].blank?\n if setter\n write_attribute(attribute, args.first)\n else\n read_attribute(attribute)\n end\n else\n super(meth, *args, &blk)\n end\n end", "def attr_writer(*vars)\n # avoid tracking attributes that are added by the class_attribute\n # as these are class attributes and not instance attributes.\n tracked_vars = vars.reject {|var| respond_to? var }\n add_tracked_attrs(false, true, *tracked_vars)\n vars.extract_options!\n super\n end", "def instance_variables() end", "def private; end", "def method_missing(method, *args, &block)\n @attributes.send(method, *args, &block)\n end", "def attr_writer(sym, *more) end", "def attributes\n end", "def internal_attr_accessor(*syms)\n internal_attr_reader(*syms)\n internal_attr_writer(*syms)\n end", "def readonly(*syms)\n return if syms.size == 0 # If no arguments, do nothing \n code = \"\" # Start with an empty string of code \n # Generate a string of Ruby code to define attribute reader methods.\n # Notice how the symbol is interpolated into the string of code.\n syms.each do |s|\n code << \"def #{s}; #{s}; end\\n\"\n end \n # Finally, class_eval the generated code to create instance methods.\n class_eval code \n end", "def method_missing(method_name, *args, &block)\n # Check if the method missing an \"attr=\" method\n raise unless method_name.to_s.end_with?(\"=\")\n\n setter = method_name\n getter = method_name.to_s.slice(0...-1).to_sym\n instance_var = \"@#{getter}\".to_sym\n\n # attr_writer\n define_singleton_method(setter) do |new_val|\n instance_variable_set(instance_var, new_val)\n end\n\n # attr_reader\n define_singleton_method(getter) { instance_variable_get(instance_var) }\n\n # Ignores all arguments but the first one\n value = args[0]\n\n # Actually sets the value on the instance variable\n send(setter, value)\n rescue MethodMissing\n # Raise error as normal, nothing to see here\n super(method_name, *args, &block)\n end", "def attr_reader(*args)\n super\n comparison_attrs.concat(args)\n end", "def attr_reader(sym, *more) end", "def name\n return @name\nend\ndef age\n return @age\nend\n#setters, allows you to change or set something\ndef name=(name)\n @name = name\nend", "def attributes\n _fast_attributes\n\n rescue NameError\n\n method = \"def _fast_attributes\\n\"\n method << \" @_attributes ||=\\n\"\n method << \" begin\\n\"\n method << \" h = {}\\n\"\n\n self.class.attributes.each do |name|\n method << \" h[:\\\"#{name}\\\"] = send(:\\\"#{name}\\\") if include_#{name}?\\n\"\n end\n\n method << \" h\\n\"\n method << \" end\\n\"\n method << \"end\"\n\n self.class.class_eval method\n\n _fast_attributes\n end", "def method_missing(method, *args, &block)\n @attributes.send(method, *args, &block)\n end", "def instance_variables; end", "def attr_info; end", "def method_missing(method_name, *args, &block)\n if method_name.to_s.end_with?('=')\n set_attribute(method_name, *args)\n elsif has_attribute?(method_name)\n get_attribute(method_name)\n else\n super\n end\n end", "def attr(name); end", "def attr_internal_accessor(*attrs)\n attr_internal_reader(*attrs)\n attr_internal_writer(*attrs)\n end", "def attr_internal_accessor(*attrs)\n attr_internal_reader(*attrs)\n attr_internal_writer(*attrs)\n end", "def attr_internal_accessor(*attrs)\n attr_internal_reader(*attrs)\n attr_internal_writer(*attrs)\n end", "def delegate_object_reader_method; end", "def methods; end", "def methods; end", "def methods; end", "def methods; end", "def attr(symbol, writable=false) end", "def accessor(*args)\n attr_accessor(*args)\n args\n end", "def initialize\n @attribute = 'truite'\n @accessor = 'pouet'\n end", "def private=(_); end", "def attr_reader(*fields)\n check_fields(fields)\n added_fields = jiak.data.readable(*fields)\n added_fields.each do |field|\n class_eval <<-EOM\n def #{field}\n @jiak.object.data.#{field}\n end\n EOM\n end\n nil\n end", "def strong_attr_acessor(names = {})\n names.each do |name, klass|\n var_name = \"@#{name}\".to_sym\n define_method(name) { instance_variable_get(var_name) }\n define_method(\"#{name}=\".to_sym) do |value|\n raise TypeError, \"Attribute #{var_name}: type of value should be #{klass}\" unless value.is_a?(klass)\n instance_variable_set(var_name, value)\n end\n end\n end", "def initialize(attr)\n #iterate over each key/value pair in attribute hash\n attr.each do |k,v|\n #name of key becomes setter\n #value associated with key is the name of value you want to pass to method\n self.send(\"#{k}=\", v)\n #send method is another way of calling a method on an object\n #same as instance_of_user.key = value\n #when you want to mass assign, send is better than .name= method\n end\n end", "def attributes(*args)\n attr_reader(*args)\n\n initialize_method_arguments = args.map { |arg| \"#{arg}:\" }.join(', ')\n initialize_method_body = args.map { |arg| \"@#{arg} = #{arg}\" }.join(';')\n\n class_eval <<~CODE, __FILE__, __LINE__ + 1\n def initialize(#{initialize_method_arguments})\n #{initialize_method_body}\n after_initialize\n end\n CODE\n end", "def attribute(name); end", "def private_attr_reader(*method_names)\n attr_reader(*method_names)\n private(*method_names)\n end", "def attributes\n ATTRIBUTES.each_with_object({}) do |name, buffer|\n buffer[name] = public_send(name)\n end\n end", "def add_attributes(item)\n [:class, :instance].each do |attr_loc|\n # Grab attributes for the current location (class or instance)\n attrs = item.attributes[attr_loc]\n attrs.each do |name, attribute|\n reader = attribute[:read]\n writer = attribute[:write]\n\n unless reader || writer\n Logging.warn(\"attribute is not readable or writable somehow, skipping\", attribute)\n next\n end\n\n # Get all given types\n yard_types = []\n if reader\n next if @hide_private && reader.visibility == :private\n yard_types += reader.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n reader.tags('param').flat_map(&:types)\n end\n if writer\n next if @hide_private && writer.visibility == :private\n yard_types += writer.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n writer.tags('param').flat_map(&:types)\n end\n\n # Use untyped if not types specified anywhere, otherwise try to\n # compute Parlour type given all these types\n if yard_types.empty?\n Logging.omit(\"no YARD type given for #{name.inspect}, using untyped\", reader || writer)\n parlour_type = Parlour::Types::Untyped.new\n elsif yard_types.all? { |x| x == 'nil' }\n # Nil attributes are extremely unusual, so just use untyped\n parlour_type = Parlour::Types::Untyped.new\n else\n parlour_type = TypeConverter.yard_to_parlour(\n yard_types, reader || writer, @type_converter_config)\n end\n\n # Generate attribute\n if reader && writer\n kind = :accessor\n elsif reader\n kind = :reader\n elsif writer\n kind = :writer\n end\n\n if @exclude_untyped && parlour_type.is_a?(Parlour::Types::Untyped)\n Logging.omit(\"excluding untyped attribute\", reader || writer, immediate: true)\n next\n end\n\n case @mode\n when :rbi\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n class_attribute: (attr_loc == :class)\n ) do |m|\n add_comments(reader || writer, m)\n end\n when :rbs\n if attr_loc == :class\n # RBS doesn't support class attr_accessors so create individual methods\n\n if reader\n @current_object.create_method(\n name.to_s,\n [Parlour::RbsGenerator::MethodSignature.new([], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(reader, m)\n end\n end\n\n if writer\n @current_object.create_method(\n \"#{name}=\",\n [Parlour::RbsGenerator::MethodSignature.new([Parlour::RbsGenerator::Parameter.new(\n \"value\",\n type: parlour_type,\n required: true\n )], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(writer, m)\n end\n end\n else\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n ) do |m|\n add_comments(reader || writer, m)\n end\n end\n end\n end\n end\n end", "def attributes\n _fast_attributes\n rescue NameError\n method = \"def _fast_attributes\\n\"\n\n method << \" h = {}\\n\"\n\n _attributes.each do |name,key|\n method << \" h[:\\\"#{key}\\\"] = read_attribute_for_serialization(:\\\"#{name}\\\") if include?(:\\\"#{name}\\\")\\n\"\n end\n method << \" h\\nend\"\n\n self.class.class_eval method\n _fast_attributes\n end", "def define_attribute_methods(attrs, access_level)\n self.attribute_method_module.module_eval do\n attrs.each do |attr|\n # Normalize for attributes without types\n attr_name = Array.wrap(attr).first\n # Define reader and huh methods\n self.module_eval <<-EOE, __FILE__, __LINE__ + 1\n def #{attr_name}\n read_attribute(:#{attr_name})\n end\n\n def #{attr_name}?\n read_attribute(:#{attr_name}).present?\n end\n EOE\n # Define a writer if this is public\n if access_level == :public\n self.module_eval <<-EOE, __FILE__, __LINE__ + 1\n def #{attr_name}=(new_val)\n write_attribute(:#{attr_name}, new_val)\n end\n EOE\n end\n end\n end\n\n # Now we get all the attribute names as symbols\n # and define_attribute_methods for dirty tracking\n attrs = attrs.collect do |a|\n Array.wrap(a).first.to_sym\n end\n\n super(attrs)\n true\n end", "def key_attr_reader(key)\n define_method key do\n self[key]\n end\n end", "def attr_accessor_only_if_editable(*args)\n args.each do |attr_name|\n attr_name = attr_name.to_s\n\n #getter\n self.class_eval %Q{\n def #{attr_name}\n @#{attr_name}\n end\n }\n\n #setter\n self.class_eval %Q{\n def #{attr_name}=(val)\n fail \"Not editable!\" unless self.editable?\n\n # set the value itself\n @#{attr_name}=val\n end\n }\n end\n end", "def method_missing(method_name, *args, &block)\n attributes.send(method_name.to_s, *args, &block)\n end", "def method_missing(method, *args, &block)\n \n # The getter\n if @metadata.has_key?(method)\n return attribute_get(method)\n else\n # The setter\n \n if (attribute=method.to_s.match(/(.+)=$/).to_a.last)\n attribute_set(attribute, args.first)\n return\n end\n end\n \n super\n \n end", "def attr_reader?(name)\n (instance_methods | private_instance_methods).include?(name)\n end", "def class_variables() end", "def method_missing(method_name, *args, &block)\n if attrs.keys.include? method_name.to_s\n attrs[method_name.to_s]\n else\n super(method_name)\n end\nend", "def create_attr( name , ro = false)\n unless ro\n create_method( \"#{name}=\".to_sym ) { |val| \n instance_variable_set( \"@\" + name, val)\n }\n end\n\n create_method( name.to_sym ) { \n instance_variable_get( \"@\" + name )\n }\n end", "def attributes; Common.attributes(@handle); end", "def method_missing(meth, *args, &block)\n if attributes.has_key?(meth)\n attributes[meth]\n else\n super\n end\n end", "def attr_accessor(*fields)\n attr_reader *fields\n attr_writer *fields\n end", "def export_attributes_from_methods(hash)\n self.export_attrs_from_methods = hash.freeze\n end", "def method_missing(method_name, *args)\n # Return the attribute value\n if @attributes.has_key?(method_name)\n read_attribute(method_name)\n \n # If we predefine an attribute, but we don't have it loaded, return nil\n elsif self.class.predefined_attributes.include?(method_name)\n nil\n \n # Check booleans, attribute_name?\n elsif method_name.to_s =~ /\\?$/\n simple_method_name = method_name.to_s.gsub(/\\?$/, '').to_sym\n @attributes[simple_method_name] == true || @attributes[simple_method_name] == 't' || \n @attributes[simple_method_name] == 'true'\n \n # Method to set attribute, attribute_name=\n elsif method_name.to_s =~ /=$/ && !args.empty?\n write_attribute(method_name.to_s.gsub(/=$/, '').to_sym, args.first)\n \n # Default to raising an error\n else\n default_method_missing(method_name, *args)\n end\n end", "def attributes(*attrs)\n @attributes = attrs\n attr_reader(*attrs)\n end", "def attributes(_record)\n raise 'Abstract method attributes should be overriden'\n end" ]
[ "0.66010034", "0.646378", "0.645601", "0.6382415", "0.6357943", "0.6343745", "0.63423234", "0.63423234", "0.6337248", "0.6299814", "0.6292021", "0.6289283", "0.624128", "0.61337465", "0.6110762", "0.6110762", "0.6110762", "0.6110762", "0.6110762", "0.6110762", "0.6110762", "0.60857177", "0.60857177", "0.60857177", "0.60857177", "0.60857177", "0.60857177", "0.60857177", "0.60857177", "0.60857177", "0.60857177", "0.60857177", "0.6066896", "0.6055797", "0.60478544", "0.6011069", "0.6005683", "0.60035294", "0.5984139", "0.5984139", "0.5982401", "0.5941525", "0.59386694", "0.5933663", "0.59249586", "0.59197134", "0.59130406", "0.59112483", "0.5904835", "0.59005296", "0.5898444", "0.58896494", "0.5885293", "0.5883363", "0.5864947", "0.5863962", "0.5833508", "0.5814555", "0.5803306", "0.5777455", "0.57708776", "0.5766518", "0.5752165", "0.5745862", "0.57334113", "0.57334113", "0.57334113", "0.57283354", "0.5725413", "0.5725413", "0.5725413", "0.5725413", "0.57219994", "0.57201785", "0.57172006", "0.57028455", "0.57019365", "0.5693907", "0.56895673", "0.5683581", "0.56722814", "0.56603545", "0.5659067", "0.56552726", "0.5653799", "0.5629479", "0.5624181", "0.56159836", "0.5600098", "0.5594345", "0.5592274", "0.5584124", "0.5581113", "0.5572212", "0.5571761", "0.55703396", "0.55569535", "0.55560595", "0.5549172", "0.5541428", "0.5540369" ]
0.0
-1
predicts of deaths based on population density and rounds outcome
def predicted_deaths # predicted deaths is solely based on population density if @population_density >= 200 percentage = 0.4 elsif @population_density >= 150 percentage = 0.3 elsif @population_density >= 100 percentage = 0.2 elsif @population_density >= 50 percentage = 0.1 else percentage = 0.05 end number_of_deaths = (@population * percentage).floor print "#{@state} will lose #{number_of_deaths} people in this outbreak" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predicted_deaths\n \n # predicted deaths is solely based on population density \n \n death_rate = (@population_density / 500).round(1) \n death_rate = 0.4 if @population_density >= 250\n death_rate = 0.1 if @population_density < 50\n \n (@population * death_rate).floor\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density < 50\n number_of_deaths = (@population * 0.05).floor\n else\n multiplier = (@population_density/50).floor\n number_of_deaths = (@population * (multiplier * 0.1)).floor\n end\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density <= 50\n number_of_deaths = (@population * 0.05).floor\n else\n multipler_var = (@population_density / 50) * 0.1\n number_of_deaths = (@population * multipler_var).floor\n end\n end", "def predicted_deaths#(population_density, population, state)\r\n # predicted deaths is solely based on population density\r\n number_of_deaths = (@population * 0.4).floor if @population_density >= 200\r\n \r\n number_of_deaths = (@population * 0.3).floor if @population_density >= 150\r\n \r\n number_of_deaths = (@population * 0.2).floor if @population_density >= 100\r\n \r\n number_of_deaths = (@population * 0.1).floor if @population_density >= 50\r\n \r\n number_of_deaths = (@population * 0.05).floor if @population_density >= 0\r\n \r\n # end\r\n # print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n death_multiplier = {0 => 0.05, 50 => 0.1, 100 => 0.2, 150 => 0.3, 200 => 0.4}\n death_multiplier.each do |density, multiplier|\n if @population_density >= density\n @number_of_deaths = (@population * multiplier).floor\n end\n \n end\n # if @population_density >= 200\n # number_of_deaths = (@population * 0.4).floor\n # elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n # elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n # elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n # else\n # number_of_deaths = (@population * 0.05).floor\n # end\n print \"#{@state} will lose #{@number_of_deaths} people in this outbreak\"\n end", "def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n\n\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density < 200 && @population_density >= 50\n number_of_deaths = (@population * (@population_density.to_i/50) * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak!!!\\n\"\n\n end", "def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n fractions = [0.4, 0.3, 0.2, 0.1, 0.05]\n density = [200, 150, 100, 50, 0]\n \n index = 0\n while index < density.length\n if @population_density >= density[index]\n number_of_deaths = (@population * fractions[index]).floor\n break\n end\n index += 1\n end\n \n # if @population_density >= density[0]\n # number_of_deaths = (@population * fractions[0]).floor\n # elsif @population_density >= density[1]\n # number_of_deaths = (@population * fractions[1]).floor\n # elsif @population_density >= density[2]\n # number_of_deaths = (@population * fractions[2].floor\n # elsif @population_density >= density[3]\n # number_of_deaths = (@population * fractions[3]).floor\n # else\n # number_of_deaths = (@population * fractions[4]).floor\n # end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n \n if @population_density >= 200\n rate = 0.4\n elsif @population_density >= 150\n rate = 0.3\n elsif @population_density >= 100\n rate = 0.2\n elsif @population_density >= 50\n rate = 0.1\n else\n rate = 0.05\n end\n\n (@population * rate).floor\n\n end", "def predicted_deaths #(population_density, population, state)\r\n # predicted deaths is solely based on population density\r\n # case @population_density\r\n # \twhen @population_density >= 200 then number_of_deaths = (@population * 0.4).floor\r\n # \twhen @population_density >= 150 then number_of_deaths = (@population * 0.3).floor\r\n # end\r\n \r\n if @population_density >= 200\r\n number_of_deaths = (@population * 0.4).floor\r\n elsif @population_density >= 150\r\n number_of_deaths = (@population * 0.3).floor\r\n elsif @population_density >= 100\r\n number_of_deaths = (@population * 0.2).floor\r\n elsif @population_density >= 50\r\n number_of_deaths = (@population * 0.1).floor\r\n else\r\n number_of_deaths = (@population * 0.05).floor\r\n end\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n # as population density increases, it affects the percent of the population that will die. The higher the population density, the higher number of deaths. \n y = case @population_density\n when (0..49) then 0.05\n when (50..99) then 0.1\n when (100..149) then 0.2 \n when (150..199) then 0.3\n else 0.4\n end \n (@population * y).floor\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n @population * 0.4\n elsif @population_density >= 150\n @population * 0.3\n elsif @population_density >= 100\n @population * 0.2\n elsif @population_density >= 50\n @population * 0.1\n else\n @population * 0.05\n end\n end", "def predicted_deaths(population_density)\n # predicted deaths is solely based on population density\n \n pop = @population_density\n case pop \n when pop >= 200 \n number_of_deaths = (@population * 0.4).floor\n when pop >= 150 \n number_of_deaths = (@population * 0.3).floor\n when pop >= 100 \n number_of_deaths = (@population * 0.2).floor\n when pop >= 50 \n number_of_deaths = (@population * 0.1).floor \n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths #(population_density, population, state)\r\n # predicted deaths is solely based on population density\r\n if @population_density >= 200\r\n multiplier = 0.4\r\n elsif @population_density >= 150\r\n multiplier = 0.3\r\n elsif @population_density >= 100\r\n multiplier = 0.2\r\n elsif @population_density >= 50\r\n multiplier = 0.1\r\n else\r\n multiplier = 0.05\r\n end\r\n number_of_deaths = (@population * multiplier).floor\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n\n if @population_density >= 200\n death_rate = 0.4\n elsif @population_density >= 150\n death_rate = 0.3\n elsif @population_density >= 100\n death_rate = 0.2\n elsif @population_density >= 50\n death_rate = 0.1\n else\n death_rate = 0.05\n end\n \n (@population * death_rate).floor\n\n end", "def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n\n # Refactored method by simplifying the calculation to make the code more DRY\n if @population_density < 50\n number_of_deaths = (@population * 0.05).floor\n else\n number_of_deaths = (@population *(@population_density/50 * 0.1)).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n # Original method \n # if @population_density >= 200\n # number_of_deaths = (@population * 0.4).floor\n # elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n # elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n # elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n # else\n # number_of_deaths = (@population * 0.05).floor\n # end\n\n end", "def predicted_deaths(population_density, population, state)\n \n number_of_deaths = (@population * 0.05).floor if @population_density < 50\n number_of_deaths = (@population * 0.1).floor if @population_density >= 50\n number_of_deaths = (@population * 0.2).floor if @population_density >= 100\n number_of_deaths = (@population * 0.3).floor if @population_density >= 150\n number_of_deaths = (@population * 0.4).floor if @population_density >= 200\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n @number_of_deaths = (@population * factor).floor\n if @population_density >= 200\n factor = 0.4\n elsif @population_density >= 150\n factor = 0.3\n elsif @population_density >= 100\n factor = 0.2\n elsif @population_density >= 50\n factor = 0.1\n else\n factor = 0.05\n end\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n \n # if @population_density >= 50 \n # number_of_deaths = (@population / 500).floor\n # else\n # number_of_deaths = (@population * 0.05).floor\n # end\n \n if @population_density >= 200\n (@population * 0.4).floor\n elsif @population_density >= 150\n (@population * 0.3).floor\n elsif @population_density >= 100\n (@population * 0.2).floor\n elsif @population_density >= 50\n (@population * 0.1).floor\n else\n (@population * 0.05).floor\n end\n\n end", "def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(@population_density, @population, @state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n\n #popd = [200, 150, 100, 50]\n #perc = [0.4, 0.3, 0.2, 0.1]\n\n #popd[i]\n\n if @population_density < 50\n number_of_deaths = (@population * 0.05)\n elsif @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n else @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n case @population_density\n when 0..50 then (@population * 0.05).floor\n when 51..100 then (@population * 0.1).floor\n when 101..150 then (@population * 0.2).floor\n when 151..200 then (@population * 0.3).floor\n else (@population * 0.4).floor\n end\n\n end", "def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n case when @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n when @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n when @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n when @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n when\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n multiplier = 0.4\n elsif @population_density >= 150\n multiplier = 0.3\n elsif @population_density >= 100\n multiplier = 0.2\n elsif @population_density >= 50\n multiplier = 0.1\n else\n multiplier = 0.05\n end\n (@population * multiplier).floor\n end", "def predicted_deaths(population_density, population)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n\n # perhaps a case statement is a little more dry?\n case\n when @population_density >= 200 then number_of_deaths = (@population * 0.4).floor\n when @population_density >= 150 then number_of_deaths = (@population * 0.3).floor\n when @population_density >= 100 then number_of_deaths = (@population * 0.2).floor\n when @population_density >= 50 then number_of_deaths = (@population * 0.1).floor\n when @population_density < 50 then number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths()\n # predicted deaths is solely based on population density\n case @population_density\n when 200..1000\n @number_of_deaths = (@population * 0.4).floor\n when 150...200\n @number_of_deaths = (@population * 0.3).floor\n when 100...150\n @number_of_deaths = (@population * 0.2).floor\n when 50...100\n @number_of_deaths = (@population * 0.1).floor\n else\n @number_of_deaths = (@population * 0.05).floor\n end\n end", "def predicted_deaths()\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4)\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3)\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2)\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1)\n else\n number_of_deaths = (@population * 0.05)\n end\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n \n if @population_density >= 200\n (0.4*@population).floor\n elsif @population_density >= 150\n (0.3*@population).floor\n elsif @population_density >= 100\n (0.2*@population).floor\n elsif @population_density >= 50\n (0.1*@population).floor\n else\n (0.05*@population).floor\n end\n\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n @number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n @number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n @number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n @number_of_deaths = (@population * 0.1).floor\n else\n @number_of_deaths = (@population * 0.05).floor\n end\n end", "def predicted_deaths#(population_density, population, state)\n # predicted deaths is solely based on population density\n\n x = 1\n\n number_of_deaths = (@population * x).floor\n case @population_density\n\n when (150...200)\n x = 0.3\n when (100...150)\n x = 0.2\n when (50...100)\n x = 0.1\n when (0...50)\n x= 0.05\n else\n x = 0.4\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n end", "def predicted_deaths#(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if population_density >= 200\n number_of_deaths = (population * 0.4).floor\n elsif population_density >= 150\n number_of_deaths = (population * 0.3).floor\n elsif population_density >= 100\n number_of_deaths = (population * 0.2).floor\n elsif population_density >= 50\n number_of_deaths = (population * 0.1).floor\n else\n number_of_deaths = (population * 0.05).floor\n end\n\n print \"#{state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if population_density >= 200\n number_of_deaths = (population * 0.4).floor\n elsif population_density >= 150\n number_of_deaths = (population * 0.3).floor\n elsif population_density >= 100\n number_of_deaths = (population * 0.2).floor\n elsif population_density >= 50\n number_of_deaths = (population * 0.1).floor\n else\n number_of_deaths = (population * 0.05).floor\n end\n\n print \"#{state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n \n if @population_density >= 50\n multiplication_factor = (@population_density.fdiv(50)).floor.fdiv(10)\n # (density / 50), rounded down to int, then divided by 10\n # ex: 200 / 50 = 4, 4/10 = 0.4\n # ex: 185 / 50 = 3.7, rounded to 3, 3/10 = 0.3\n else # if population density < 50\n multiplication_factor = 0.05\n end\n \n \n \n number_of_deaths = (@population * multiplication_factor).floor\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n if @population_density < 50\n number_of_deaths = (@population * 0.05).floor\n else\n number_of_deaths = (@population_density * (0.1 * (@population / 50)) ).floor\n end\n\n # if @population_density >= 200\n # number_of_deaths = (@population * 0.4).floor\n # elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n # elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n # elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n # else \n # number_of_deaths = (@population * 0.05).floor\n # end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths#(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = death_percentage(0.4)\n elsif @population_density >= 150\n number_of_deaths = death_percentage(0.3)\n elsif @population_density >= 100\n number_of_deaths = death_percentage(0.2)\n elsif @population_density >= 50\n number_of_deaths = death_percentage(0.1)\n else\n number_of_deaths = death_percentage(0.05)\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n \n # predicted deaths is based on population density\n if @population_density >= 200\n factor = 0.4\n elsif @population_density >= 150\n factor = 0.3\n elsif @population_density >= 100\n factor = 0.2\n elsif @population_density >= 50\n factor = 0.1\n else\n factor = 0.05\n end\n\n @number_of_deaths = (@population * factor).floor\n\n end", "def predicted_deaths#(population_density, population, state)\n # predicted deaths is solely based on population density\n factor = case population_density\n when 0...50 then 0.05\n when 50...100 then 0.1\n when 100...150 then 0.2\n when 150...200 then 0.3\n else 0.4 \n end\n number_of_deaths = (population * factor).floor\n\n print \"#{state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n \n density = [200, 150, 100, 50, 0]\n multiplier = [0.4, 0.3, 0.2, 0.1, 0.05]\n density.length.times do |x|\n @population_density >= density[x]\n @number_of_deaths = (@population * multiplier[x]).floor \n end\n# if @population_density >= 200\n# number_of_deaths = (@population * 0.4).floor\n# elsif @population_density >= 150\n# number_of_deaths = (@population * 0.3).floor\n# elsif @population_density >= 100\n# number_of_deaths = (@population * 0.2).floor\n# elsif @population_density >= 50\n# number_of_deaths = (@population * 0.1).floor\n# else\n# number_of_deaths = (@population * 0.05).floor\n# end\n\n print \"#{@state} will lose #{@number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population)\n # predicted deaths is solely based on population density\n case @population_density\n when 200..Float::INFINITY\n rate = 0.4\n when 150..199\n rate = 0.3\n when 100..149\n rate = 0.2\n when 50..99\n rate = 0.1\n else rate = 0.05\n end\n\n number_of_deaths = (@population * rate).floor\n\n number_of_deaths\n\n end", "def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n ## Refactored for Release: 8\n if @population_density >= 200\n (@population * 0.4).floor\n elsif @population_density >= 150\n (@population * 0.3).floor\n elsif @population_density >= 100\n (@population * 0.2).floor\n elsif @population_density >= 50\n (@population * 0.1).floor\n else\n (@population * 0.05).floor\n end\n\n # print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n\n\n if @population_density >= 200\n rate = 0.4\n elsif @population_density >= 150\n rate = 0.3\n elsif @population_density >= 100\n rate = 0.2\n elsif @population_density >= 50\n rate = 0.1\n else\n rate = 0.05\n end\n number_of_deaths = (@population * rate).floor\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n end", "def predicted_deaths\r\n # predicted deaths is solely based on population density\r\n if @population_density >= 200\r\n @number_of_deaths = (@population * 0.4).floor\r\n elsif @population_density >= 150\r\n @number_of_deaths = (@population * 0.3).floor\r\n elsif @population_density >= 100\r\n @number_of_deaths = (@population * 0.2).floor\r\n elsif @population_density >= 50\r\n @number_of_deaths = (@population * 0.1).floor\r\n else\r\n @number_of_deaths = (@population * 0.05).floor\r\n end\r\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n \n case @population_density\n when @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n when @population_density>= 150\n number_of_deaths = (@population * 0.3).floor\n when @population_density>= 100\n number_of_deaths = (@population * 0.2).floor\n when @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n \n if @population_density >= 200\n death_multiplier = 0.4\n elsif @population_density >= 150\n death_multiplier = 0.3\n elsif @population_density >= 100\n death_multiplier = 0.2\n elsif @population_density >= 50\n death_multiplier = 0.1\n else\n death_multiplier = 0.05\n end\n\n number_of_deaths = (@population * death_multiplier).floor\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n\n number_of_deaths = case\n when @population_density >= 200\n @population * 0.4\n when @population_density >= 50\n @population * 0.1 * (@population_density.to_i/50)\n else\n @population * 0.05\n end\n\n print \"#{@state} will lose #{number_of_deaths.floor} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n number_of_deaths = 0\n density_hash = {200 => 0.4, 150 => 0.3, 100 => 0.2, 50 => 0.1,0 => 0.05}\n density_hash.each_key { |key|\n if @population_density >= key\n number_of_deaths = (@population * density_hash[key]).floor\n end\n }\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # (population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n #.floor => returns the largest integer less than or equal to float (rounds down to nearest integer)\n end", "def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n speed = 0.0\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n speed += 0.5\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n speed += 1\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n speed += 1.5\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n speed += 2.0\n else\n number_of_deaths = (@population * 0.05).floor\n speed += 2.5\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak and will spread across the state in #{speed} months.\\n\\n\"\n #puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n death_factor = case @population_density.floor\n when 0..49\n 0.05\n when 50..99\n 0.1\n when 100..149\n 0.2\n when 150..199\n 0.3\n else\n 0.4\n end\n number_of_deaths = (@population * death_factor).floor\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\r\n # predicted deaths is solely based on population density\r\n \r\n \r\n\r\n if @population_density >= 200\r\n x = 0.4\r\n\r\n elsif @population_density >= 150\r\n x = 0.3\r\n elsif @population_density >= 100\r\n x = 0.2\r\n\r\n elsif @population_density >= 50\r\n x = 0.1\r\n\r\n else\r\n x = 0.05\r\n end\r\n number_of_deaths = (@population * x).floor \r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end", "def predicted_deaths\r\n # predicted deaths is solely based on population density\r\n if @population_density >= 200\r\n (@population * 0.4).floor\r\n elsif @population_density >= 150\r\n (@population * 0.3).floor\r\n elsif @population_density >= 100\r\n (@population * 0.2).floor\r\n elsif @population_density >= 50\r\n (@population * 0.1).floor\r\n else\r\n (@population * 0.05).floor\r\n end\r\n\r\n \r\n\r\n end", "def predicted_deaths(population_density, population)\n # predicted deaths is solely based on population density\n\n n = [50, 100, 150, 200]\n \n if @population_density >= n[3]\n coefficient = n[3]/500.0\n elsif @population_density >= n[2]\n coefficient = n[2]/500.0\n elsif @population_density >= n[1]\n coefficient = n[1]/500.0\n elsif @population_density >= n[0]\n coefficient = n[0]/500.0\n else\n coefficient = 0.05\n end\n \n number_of_deaths = (@population * coefficient).floor\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n\n case @population_density\n when 0..50\n number_of_deaths = (@population * 0.05).floor\n when 50..100\n number_of_deaths = (@population * 0.1).floor\n when 100..150\n number_of_deaths = (@population * 0.2).floor\n when 150..200\n number_of_deaths = (@population * 0.3).floor\n else\n number_of_deaths = (@population * 0.4).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n case @population_density\n when 0...50 then number_of_deaths = calc_density(0.05)\n when 50...100 then number_of_deaths = calc_density(0.1)\n when 100...150 then number_of_deaths = calc_density(0.2)\n when 150...200 then number_of_deaths = calc_density(0.3)\n else number_of_deaths = calc_density(0.4)\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n speed = 0\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n speed += 0.5\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n speed += 1\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n speed += 1.5\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n speed += 2\n else\n number_of_deaths = (@population * 0.05).floor\n speed += 2.5\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def predicted_deaths\r\n # predicted deaths is solely based on population density\r\n\r\n coefficient = case @population_density\r\n when 200..15000 then 0.4\r\n when 150..199 then 0.3\r\n when 100..149 then 0.2\r\n when 50..99 then 0.1\r\n else 0.05\r\n end\r\n\r\n number_of_deaths = @population * coefficient\r\n print \"#{@state} will lose #{number_of_deaths.floor} people in this outbreak\"\r\n\r\n end", "def predicted_deaths\n case @population_density\n when 0..50 then (@population * 0.05).floor\n when 51..100 then (@population * 0.1).floor\n when 101..150 then (@population * 0.2).floor\n when 151..200 then (@population * 0.3).floor\n else (@population * 0.4).floor\n end\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n #if @population_density >= 200\n # number_of_deaths = (@population * 0.4).floor\n #elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n #elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n #elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n #else\n # number_of_deaths = (@population * 0.05).floor\n #end\n if @population_density >= 50\n mult_factor = (@population_density.fdiv(50)).floor.fdiv(10)\n # pop_density / 50,(fdiv returns float which is more precise), floor it, then divide by 10\n # example: 200/50 = 4, 4/10 = 0.4\n # example: 100/50 = 2, 2/10 = 0.2\n else\n mult_factor = 0.05\n end\n\n number_of_deaths = (@population * mult_factor).floor\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n prediction = 0.4\n elsif @population_density >= 150\n prediction = 0.3\n elsif @population_density >= 100\n prediction = 0.2\n elsif @population_density >= 50\n prediction = 0.1\n else\n prediction = 0.05\n end\n\n print \"#{@state} will lose #{(prediction * @population).floor} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n case\n when @population_density >= 200 then number_of_deaths = (@population * 0.4).floor\n when @population_density >= 150 then number_of_deaths = (@population * 0.3).floor\n when @population_density >= 100 then number_of_deaths = (@population * 0.2).floor\n when @population_density >= 50 then number_of_deaths = (@population * 0.1).floor\n else (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\r\n # predicted deaths is solely based on population density\r\n\r\n estimated_deaths = case @population_density\r\n when 0...50 then 0.05\r\n when 50...100 then 0.1\r\n when 100...150 then 0.2\r\n when 150...200 then 0.3\r\n else 0.4\r\n end\r\n\r\n number_of_deaths = (@population * estimated_deaths).floor\r\n\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n # if @population_density >= 200\r\n # number_of_deaths = (@population * 0.4).floor\r\n # elsif @population_density >= 150\r\n # number_of_deaths = (@population * 0.3).floor\r\n # elsif @population_density >= 100\r\n # number_of_deaths = (@population * 0.2).floor\r\n # elsif @population_density >= 50\r\n # number_of_deaths = (@population * 0.1).floor\r\n # else\r\n # number_of_deaths = (@population * 0.05).floor\r\n # end\r\n\r\n # print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n case @population_density\n when 0..49\n multiplier_factor = 0.05\n when 50..99\n multiplier_factor = 0.1\n when 100..149\n multiplier_factor = 0.2\n when 150..199\n multiplier_factor = 0.3\n else\n multiplier_factor = 0.4\n end\n \n number_of_deaths = (@population * multiplier_factor).floor\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(state_density, population)\n # predicted deaths is solely based on population density\n number_of_deaths = ''\n hash = {200 => 0.4, 150 => 0.3, 100 => 0.2, 50 => 0.1}\n\n hash.each do |density, float|\n if @population_density >= density\n number_of_deaths = (@population * float).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n number_of_deaths\n end\n\n # if @population_density >= 200\n # number_of_deaths = (@population * 0.4).floor\n # elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n # elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n # elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n # else\n # number_of_deaths = (@population * 0.05).floor\n # end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n rate = 0.4\n elsif @population_density >= 150\n rate = 0.3\n elsif @population_density >= 100\n rate = 0.2\n elsif @population_density >= 50\n rate = 0.1\n else\n rate = 0.05\n end\n return number_of_deaths = (@population * rate).floor\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n\n estimated_deaths = case @population_density\n when 0...50 then 0.05\n when 50...100 then 0.1\n when 100...150 then 0.2\n when 150...200 then 0.3\n else 0.4\n end\n\n number_of_deaths = (@population * estimated_deaths).floor\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n # if @population_density >= 200\n # number_of_deaths = (@population * 0.4).floor\n # elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n # elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n # elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n # else\n # number_of_deaths = (@population * 0.05).floor\n # end\n\n # print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n # if @population_density >= 200\n # number_of_deaths = (@population * 0.4).floor\n # elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n # elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n # elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n # else\n # number_of_deaths = (@population * 0.05).floor\n # end\n\n # print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n pdeathshash1 = {0..49 => (@population * 0.05).floor, 50..99 => (@population * 0.1).floor, 100..149 => (@population * 0.2).floor, 150..199 => (@population * 0.3).floor, 200..10000000 => (@population * 0.04).floor}\n pdeathshash1.each do |range, deaths|\n if (range).include?(@population_density.floor)\n print \"#{@state} will lose #{deaths} people in this outbreak\"\n end\n end\n\n\n end", "def predicted_deaths(population_density, population, state)\n case \n when @population_density >= 200 then number_of_deaths = (@population * 0.4).floor\n when @population_density >= 150 then number_of_deaths = (@population * 0.3).floor\n when @population_density >= 100 then number_of_deaths = (@population * 0.2).floor\n when @population_density >= 50 then number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n death_quotient = 1\n if @population_density >= 200\n death_quotient = 0.4\n elsif @population_density >= 150\n death_quotient = 0.3\n elsif @population_density >= 100\n death_quotient = 0.2\n elsif @population_density >= 50\n death_quotient = 0.1\n else\n death_quotient = 0.05\n end\n\n number_of_deaths = (@population * death_quotient).floor\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n case @population_density\n # predicted deaths is solely based on population density\n when @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n when @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n when @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n when @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\r\n # predicted deaths is solely based on population density\r\n number_of_deaths=0\r\n density=[200,150,100,50,0]\r\n death_percentage=[0.4, 0.3, 0.2, 0.1, 0.05]\r\n\r\n density.each_index do |index|\r\n if @population_density >= density[index]\r\n number_of_deaths = (@population * death_percentage[index]).floor\r\n break\r\n end\r\n end\r\n=begin\r\n if @population_density >= 200\r\n number_of_deaths = (@population * 0.4).floor\r\n elsif @population_density >= 150\r\n number_of_deaths = (@population * 0.3).floor\r\n elsif @population_density >= 100\r\n number_of_deaths = (@population * 0.2).floor\r\n elsif @population_density >= 50\r\n number_of_deaths = (@population * 0.1).floor\r\n else\r\n number_of_deaths = (@population * 0.05).floor\r\n end\r\n=end\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n case @population_density\n when 1..49 then death_factor = 0.05\n when 50..99 then death_factor = 0.1\n when 100..149 then death_factor = 0.2\n when 150..199 then death_factor = 0.3\n else death_factor = 0.4\n end\n \n deaths = (@population*death_factor).floor\n \n print \"#{@state} will lose #{deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n \n if @population_density < 50\n \tnumber_of_deaths = (@population * 0.05).floor\n elsif @population_density < 100\n \tnumber_of_deaths = (@population * 0.1).floor\n elsif @population_density < 150\n \tnumber_of_deaths = (@population * 0.2).floor\n elsif @population_density < 200\n \tnumber_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 200\n \tnumber_of_deaths = (@population * 0.4).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density < 200 && @population_density >= 50\n number_of_deaths = (@population * ((@population_density/50).floor*0.1)).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n STATE_FORMULA.each do |state_size, calculation|\n if @population_density >= calculation[:pop_density]\n return number_of_deaths = (@population * calculation[:deaths]).floor\n end\n end\n number_of_deaths = (@population * 0.05).floor\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n case @population_density\n when @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n when @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n when @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n when @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n end", "def predicted_deaths#(population_density, population, state)\n # predicted deaths is solely based on population density\n # if population_density >= 200\n # number_of_deaths = (population * 0.4).floor\n # elsif population_density >= 150\n # number_of_deaths = (population * 0.3).floor\n # elsif population_density >= 100\n # number_of_deaths = (population * 0.2).floor\n # elsif population_density >= 50\n # number_of_deaths = (population * 0.1).floor\n # else\n # number_of_deaths = (population * 0.05).floor\n # end\n pop_percentage = 0.0\n density_test = 50\n if population_density >= 50\n while population_density >= density_test do \n pop_percentage += 0.1\n density_test += 50\n end\n number_of_deaths = (population * pop_percentage).floor\n else\n number_of_deaths = (population * 0.05).floor\n end\n print \"#{state} will lose #{number_of_deaths} people in this outbreak\"\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density > 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density <= 200 && @population_density >= 50\n number_of_deaths = (@population * (@population_density/50 * 0.1)).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density < 50\n number_of_deaths = (@population * 0.05).floor\n else\n number_of_deaths = (@population*((@population_density/50).floor)*(0.1)).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if (@population_density >= 50) && (@population_density < 200)\n death_rate = ((@population_density / 50).floor).to_f\n number_of_deaths = ((death_rate / 10) * @population).to_i\n elsif @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\r\n # predicted deaths is solely based on population density\r\n case \r\n when @population_density >= 200\r\n death_factor = 0.4\r\n when @population_density >= 150\r\n death_factor = 0.3\r\n when @population_density >= 100\r\n death_factor = 0.2\r\n when @population_density >= 50\r\n death_factor = 0.1\r\n else\r\n death_factor = 0.05\r\n end\r\n \r\n deaths = (@population*death_factor).floor\r\n \r\n print \"#{@state} will lose #{deaths} people in this outbreak\"\r\n\r\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n death_factor = if @population_density >= 200\n 0.4\n elsif @population_density >= 150\n 0.3\n elsif @population_density >= 100\n 0.2\n elsif @population_density >= 50\n 0.1\n else\n 0.05\n end\n\n number_of_deaths = (@population * death_factor).floor\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n\n number_of_deaths = case @population_density\n when 0..49 then (@population * 0.05).floor\n when 50..99 then (@population * 0.1).floor\n when 100..149 then (@population * 0.2).floor\n when 150..199 then (@population * 0.3).floor\n else (@population * 0.4).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end" ]
[ "0.82097036", "0.80442274", "0.8000502", "0.7989199", "0.7984549", "0.7965929", "0.79637337", "0.796013", "0.79590917", "0.7955569", "0.7954668", "0.7950697", "0.79427505", "0.79364544", "0.7925952", "0.79180056", "0.7909566", "0.7907798", "0.78996736", "0.78996736", "0.78996736", "0.78996736", "0.78996736", "0.78975606", "0.7897159", "0.7897099", "0.7896923", "0.7893628", "0.78932744", "0.78932744", "0.78922105", "0.789122", "0.78870314", "0.7885382", "0.7878493", "0.78766716", "0.78766716", "0.7867495", "0.7865107", "0.78612554", "0.7860519", "0.7854765", "0.78535175", "0.7852718", "0.78507555", "0.7849063", "0.7849041", "0.78484136", "0.78444844", "0.7844078", "0.78434825", "0.7840404", "0.7836423", "0.7821563", "0.7821341", "0.78127444", "0.78122866", "0.7808943", "0.78010356", "0.77968615", "0.7792992", "0.7789087", "0.77885914", "0.7786298", "0.77834517", "0.778218", "0.778218", "0.778218", "0.778218", "0.778218", "0.778218", "0.7778296", "0.7777199", "0.7775027", "0.7773588", "0.7773002", "0.77720964", "0.7771561", "0.77715", "0.77704144", "0.77660644", "0.7765192", "0.7765151", "0.7765021", "0.7761632", "0.77606225", "0.7756352", "0.775619", "0.7747831", "0.7747736", "0.77468204", "0.77441156", "0.7738707", "0.7737266", "0.7730195", "0.7729798", "0.77288514", "0.7727327", "0.7721821", "0.77180165", "0.771683" ]
0.0
-1
======================================================================= DRIVER CODE initialize VirusPredictor for each state
def report STATE_DATA.each do |state, population_stats| state = VirusPredictor.new(state, population_stats[:population_density], population_stats[:population]) state.virus_effects end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_states\n STATE_DATA.each do |x, y|\n state = VirusPredictor.new(x, STATE_DATA[x][:population_density], STATE_DATA[x][:population], STATE_DATA[x][:region], STATE_DATA[x][:regional_spread])\n state.virus_effects\n end\nend", "def all_states\n STATE_DATA.each do |state_name, data|\n territory = VirusPredictor.new(state_name, data[:population_density], data[:population])\n territory.virus_effects\n end\nend", "def all_states\n STATE_DATA.each do |state_name, data|\n territory = VirusPredictor.new(state_name, data[:population_density], data[:population])\n territory.virus_effects\n end\nend", "def all_50\n STATE_DATA.each do |state_name,values|\n # state = Alabama\n # values ={population_density: 94.65, population: 4822023}\n state = VirusPredictor.new(state_name, values[:population_density], values[:population])\n state.virus_effects\n end\nend", "def access_state_data\n STATE_DATA.each do |state, population_hash|\n VirusPredictor.new(state, population_hash[:population_density], population_hash[:population]).virus_effects\n end\nend", "def check_50_states\n STATE_DATA.each do |state, state_data_hash|\n VirusPredictor.new(state, state_data_hash[:population_density], state_data_hash[:population]).virus_effects\n end\nend", "def full_list (state_list)\n state_list.each do |key,value|\n state = VirusPredictor.new(key,value[:population_density],value[:population])\n state.virus_effects\n end\n\nend", "def report\n STATE_DATA.each do |state, population_info|\n state = VirusPredictor.new(state, population_info[:population_density], population_info[:population])\n state.virus_effects\n end\nend", "def print_all_states\n STATE_DATA.each_key { |key|\n new_state = VirusPredictor.new(key, STATE_DATA[key][:population_density], STATE_DATA[key][:population])\n new_state.virus_effects\n }\n end", "def report(states)\n states.each do | state, data |\n VirusPredictor.new(state, data[:population_density], data[:population]).virus_effects\n end\nend", "def full_country_report(hash)\n\n hash.each do |key, value|\n new_state = VirusPredictor.new(key, STATE_DATA[key][:population_density], STATE_DATA[key][:population])\n new_state.virus_effects\n end\n\nend", "def show_all_states(hash)\n hash.each do |key,state|\n all_state = VirusPredictor.new(key, state[:population_density], state[:population])\n all_state.virus_effects\n end\nend", "def initialize \n\t\t@predictions = []\n\tend", "def setup(state) ; end", "def initialize(kernel_type='RBF')\n @training_data_set = Diabetic.pick(538)\n @training = @training_data_set.collect {|d| [d.pregnant,\n d.oral_glucose_tolerance,\n d.blood_pressure,\n d.skin_fold_thickness,\n d.serum_insulin,\n d.body_mass_index,\n d.pedigree_function,\n d.age,\n d.positive]}\n\n\n @problem = Libsvm::Problem.new\n @parameter = Libsvm::SvmParameter.new\n @parameter.kernel_type = \"Libsvm::KernelType::#{kernel_type}\".constantize\n @parameter.cache_size = 100 # in megabytes\n @parameter.eps = 0.001\n @parameter.c = 10\n\n\n @labels = @training.collect {|t| t.pop}\n @examples = @training.map {|ary| Libsvm::Node.features(ary)}\n\n\n @problem.set_examples(@labels, @examples)\n\n @svm = Libsvm::Model.train(@problem, @parameter)\n end", "def initialize_state\n load_and_process_n3 '{ <http://example.com/x> <http://example.com/y> <http://example.com/z>.} a <http://purl.org/restdesc/states#State>.'\n end", "def prepare\r\n\t\t@machine \t||= @machineClass.new @trainTestStruct.trainingData, @target, @parameters\r\n\t\t@machine.train\r\n\tend", "def initialize(state); end", "def initialize_attributes\n @training_model = Hash.new { |h, k| h[k] = Hash.new(0) }\n @classes = Set.new\n @total_words_counter = 0\n @negative_population = 0\n @neutral_population = 0\n @positive_population = 0\n @training_negatives = 0\n @training_neutrals = 0\n @training_positives = 0\n end", "def pre_initialize\n end", "def define_state_initializer; end", "def report(hash)\n hash.each do |state, info|\n states= VirusPredictor.new(state, info[:population_density], info[:population])\n states.virus_effects\n end\n end", "def initialize(predictions)\n\t\t@predictions = predictions\n\t\t@error_list = make_error_list\n\tend", "def pre_run_initialize\n @evaluator = @evaluator_class.new(self) if @evaluator.nil?\n @evolver = @evolver_class.new(self) if @evolver.nil?\n end", "def pre_initialize; end", "def run_report(hash)\n hash.each do |key, value|\n key = VirusPredictor.new(key, hash[key][:population_density], hash[key][:population])\n key.virus_effects\n end\nend", "def initialize(state_of_origin, data)#when taking hash values as parameters, better to use 'data' as parameter and use [] notation to get specific values \n @state = state_of_origin\n @population = data[:population]\n @population_density = data[:population_density]\n end", "def initialize(state_of_origin, population_density, population)\n puts \"creating\"\n @state = state_of_origin\n @population = population\n @population_density = population_density\n\n end", "def print_all(hash)\n hash.each_key do |state|\n usa = VirusPredictor.new(state, hash[state][:population_density], hash[state][:population])\n usa.virus_effects\n end\n\nend", "def initialize_environment\n end", "def initialize_environment\n end", "def initialize(data_set)\n\t\t@user_info = Hash.new() # user to array of movies they have seen and what they rated them\n\t\t@movie_viewers = Hash.new() # user to array of movies they have seen\n\t\t@movie_ratings = Hash.new() # movies to an array of their ratings\n\t\t@test_set = [] # this holds all relevant information in .test files\n\t\t@predictions = []\n\t\tload_data(data_set)\n\tend", "def setup_state(identity = '1')\n cleanup_state\n InstanceState.const_set(:STATE_FILE, state_file_path)\n InstanceState.const_set(:SCRIPTS_FILE, past_scripts_path)\n InstanceState.const_set(:BOOT_LOG_FILE, log_path)\n InstanceState.const_set(:OPERATION_LOG_FILE, log_path)\n InstanceState.const_set(:DECOMMISSION_LOG_FILE, log_path)\n ChefState.const_set(:STATE_FILE, chef_file_path)\n @identity = identity\n @results_factory = ResultsMock.new\n mapper_proxy = flexmock('MapperProxy')\n flexmock(MapperProxy).should_receive(:instance).and_return(mapper_proxy).by_default\n mapper_proxy.should_receive(:request).and_yield(@results_factory.success_results)\n mapper_proxy.should_receive(:push)\n InstanceState.init(@identity)\n end", "def initialize\n \tself.seed_data\n end", "def initialize\n # set some defaults\n @has_downloaded_cookbooks = false\n @reboot = false\n @startup_tags = []\n @log_level = Logger::INFO\n @log_file = nil\n\n # replace defaults with state on disk\n load_state\n\n true\n end", "def report\r\n\r\n STATE_DATA.each do |key, value|\r\n\r\n initialize(key, value[:population_density], value[:population]) \r\n virus_effects\r\n end\r\n \r\n end", "def my_initialize\n\t\t@classes = 1\n\t\t@toys = 0\n\t\t@books = 0\t\t\n\t\tsrand seed.to_i\n\t\t@location = nil\n\t\tnext_spot()\n\t\t@random_number = 0\n\t\ttrue\n\tend", "def initialize(state_of_origin, population_density, population)\n @state = state_of_origin\n @population = population\n @population_density = population_density\n end", "def run_test\n for i in 0..@count-1\n @predictions << Prediction.new(@test_set[i].user_id,@test_set[i].movie_id, @test_set[i].rating,@database.predict(@test_set[i].user_id, @test_set[i].movie_id))\n end\n end", "def initvars\n @provider_instances = []\n @needs_flush = false\n @failed = false\n end", "def basic_setup\n [\"FL\",\"IL\",\"NY\"].each do |state|\n ClosestWeightliftingGem::Scraper.scrape_state_page(state)\n end\nend", "def initialize_env(named_params)\n _init_attrs(named_params.fetch(:imf))\n @source_path = named_params.fetch(:data)\n im_path = _initialize_ingest_manifest(named_params)\n _initialize_collection_manifest(im_path: im_path, named_params: named_params)\n _initialize_config(ingest_manifest_path: im_path, named_params: named_params)\n end", "def virus_effects #HINT: What is the SCOPE of instance variables? these methods can only be used within a virusPredictor class, its scope.\n predicted_deaths(@population_density, @population, @state)\n speed_of_spread(@population_density, @state)\n end", "def initialize(params = nil)\n @params = params\n @state = {}\n end", "def initialize(limit, offset, kernel_type='RBF', features=nil)\n @features = features||Diabetic::FEATURES\n\n @test_data_set = Diabetic.limit(limit).offset(offset)\n @training_data_set = Diabetic.excludes(@test_data_set.collect(&:id))\n\n @training = @training_data_set.collect {|d| @features.collect {|f| d.send(f)}}\n\n @problem = Libsvm::Problem.new\n @parameter = Libsvm::SvmParameter.new\n @parameter.kernel_type = \"Libsvm::KernelType::#{kernel_type}\".constantize\n @parameter.cache_size = 200 # in megabytes\n @parameter.eps = 0.001\n @parameter.c = 100\n\n @parameter.svm_type = Libsvm::SvmType::NU_SVC unless ['PRECOMPUTED'].include?(kernel_type)\n @parameter.nu = 0.0001\n @parameter.degree = 1 if ['POLY'].include?(kernel_type)\n @parameter.coef0 = 0.1 if ['SIGMOID', 'POLY'].include?(kernel_type)\n @parameter.gamma = 0.1 if ['RBF', 'SIGMOID', 'POLY'].include?(kernel_type)\n\n @labels = @training.collect {|t| t.pop}\n @examples = @training.map {|ary| Libsvm::Node.features(ary)}\n\n\n @problem.set_examples(@labels, @examples)\n\n @svm = Libsvm::Model.train(@problem, @parameter)\n end", "def init_au_states(all_or_none)\n @state_name_list = [];\n @states = params['states']\n if (@states.nil?) then \n if (all_or_none == :all) then \n @states = AuState.find(:all);\n else \n @states = []; \n end\n else \n @states = AuState.getList(params['states']); \n @state_name_list = @states.collect { |s| s.name }\n end\n end", "def driver_initialize\n\t\t#Driver initialization happens here.\n\t\tdriver = Driver::new\n\t\tdriver.seed = rand(100)\n\t\tdriver.my_initialize\n\t\tdriver\n\tend", "def initialize_states(object, options = T.unsafe(nil), attributes = T.unsafe(nil)); 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 construct(provider)\n self.generate_resources_data(provider.id)\n self.generate_ingredients_data(provider.id)\n self.status = DeploymentRecommendation::UNEVALUATED\n self.save!\n end", "def prepare_for_caching\n @predictor.instance_variable_set(:@data_set, nil)\n end", "def initialize(first_name, last_name, year_of_birth) # => states\n @first_name = first_name # => instence variable\n @last_name = last_name # => instence variable\n @year_of_birth = year_of_birth # => instence variable\n @job_title = 'Baby'\n end", "def initialize\n @consistency_checker = ConsistencyChecker.new\n @grammar_tester = GrammarTest.new\n @fsf_learner = FewestSetFeatures.new\n @mmr_learner = MaxMismatchRanking.new\n @step_type = INDUCTION\n end", "def initialize(env)\n @env = env\n super(_compute_params)\n # freeze\n end", "def initialize(username = nil, api_key = nil, dev_mode = false, \n debug = false, set_locale = false, storage = nil, domain = nil,\n project=nil, organization=nil)\n super(username, api_key, dev_mode, debug, set_locale, storage, domain,project, organization)\n @source_url = @url + SOURCE_PATH\n @project_url = @url + PROJECT_PATH\n @dataset_url = @url + DATASET_PATH\n @model_url = @url + MODEL_PATH\n @prediction_url = @url + PREDICTION_PATH\n @batch_prediction_url = @url + BATCH_PREDICTION_PATH\n @cluster_url = @url + CLUSTER_PATH\n @centroid_url = @url + CENTROID_PATH\n @batch_centroid_url = @url + BATCH_CENTROID_PATH \n @ensemble_url = @url + ENSEMBLE_PATH\n @anomaly_url = @url + ANOMALY_PATH\n @anomaly_score_url = @url + ANOMALY_SCORE_PATH\n @association_url = @url + ASSOCIATION_PATH\n @association_set_url = @url + ASSOCIATION_SET_PATH\n @batch_anomaly_score_url = @url + BATCH_ANOMALY_SCORE_PATH\n @correlation_url = @url + CORRELATION_PATH\n @evaluation_url = @url + EVALUATION_PATH\n @logistic_regression_url = @url + LOGISTIC_REGRESSION_PATH\n @sample_url = @url + SAMPLE_PATH \n @statistical_test_url = @url + STATISTICAL_TEST_PATH\n @script_url = @url + SCRIPT_PATH\n @library_url = @url + LIBRARY_PATH\n @execution_url = @url + EXECUTION_PATH\n @topic_model_url = @url + TOPIC_MODEL_PATH\n @topic_distribution_url = @url + TOPIC_DISTRIBUTION_PATH\n @batch_topic_distribution_url = @url + BATCH_TOPIC_DISTRIBUTION_PATH\n @time_series_url = @url + TIME_SERIES_PATH\n @forecast_url = @url + FORECAST_PATH\n @deepnet_url = @url + DEEPNET_PATH\n @configuration_url = @url + CONFIGURATION_PATH\n @optiml_url = @url+OPTIML_PATH\n @fusion_url = @url+FUSION_PATH\n end", "def initialize_with_test_runner\n initialize_without_test_runner\n\n @test_priorities = {}\n @test_filters = Hash.new { |h, k| h[k] = [] }\n end", "def initialize(state_territory=5, ilf_factor=6)\n @state_territory, @ilf_factor = state_territory, ilf_factor # internal instance variablesj\n end", "def initialize\n set_robot_agents\n end", "def initialize_state\n @value_hash, @result_hash = {}, {}\n @derived_values, @attrs = [], []\n @timevec = []\n @utc_offset = Time.now.utc_offset\n @enum_index = 0\n end", "def initialize\n @do_training = false\n @do_testing = false\n @do_importances = true\n\n @forest_size = DEFAULTS[:forest_size]\n @tree_SNP_sample_size = DEFAULTS[:tree_SNP_sample_size]\n @tree_SNP_total_count = DEFAULTS[:tree_SNP_total_count]\n @tree_node_min_size = DEFAULTS[:tree_node_min_size]\n @loss_function_discrete = DEFAULTS[:loss_function_discrete]\n @loss_function_continuous = DEFAULTS[:loss_function_continuous]\n\n @output_forest_file = File.expand_path(DEFAULTS[:output_forest_file], Dir.pwd)\n @output_training_file = File.expand_path(DEFAULTS[:output_training_file], Dir.pwd)\n @output_testing_file = File.expand_path(DEFAULTS[:output_testing_file], Dir.pwd)\n @output_tree_errors_file = File.expand_path(DEFAULTS[:output_tree_errors_file], Dir.pwd)\n @output_snp_importances_file = File.expand_path(DEFAULTS[:output_snp_importances_file], Dir.pwd)\n\n @silent = ENV['nimbus_test'] == 'running_nimbus_tests' ? true : DEFAULTS[:silent]\n end", "def initialize(first_name, last_name, year_of_birth) # => states\n @first_name = first_name # => instences variable\n @last_name = last_name # => instences variable\n @year_of_birth = year_of_birth # => instences variable\n @job_title = 'Baby'\n end", "def initialize\n # Create temporary data directory\n create_data_dir\n\n # Init connection to ADS\n init_ads\n\n # Initialize Data science toolkit\n init_dstk\n\n # Init connection to SQLite\n # init_sqlite3\n end", "def initialize()\n\t\tsuper\n\t\tself.servicekinds = []\n\t\tself.status = ''\n\t\tsetup_known_services\n\t\tload_rc\n\t\tself\n\tend", "def virus_effects\n # This is the beginning of object oriented design.\n predicted_deaths #(@population_density, @population, @state)\n speed_of_spread #(@population_density, @state)\n print_results\n end", "def initialize(state_of_origin, population_density, population)\r\n @state = state_of_origin\r\n @population = population\r\n @population_density = population_density\r\n end", "def Init(conditions)\r\n\t\t@start_state = conditions\r\n\tend", "def init\n @running = false\n @stack = []\n @nodes = []\n @roots = []\n\n log :info, \"FactoryProf enabled (#{config.mode} mode)\"\n\n FACTORY_BUILDERS.each(&:patch)\n end", "def init_env\n @resource_descriptions = HashWithIndifferentAccess.new { |h, version| h[version] = {} }\n @controller_to_resource_id = {}\n @param_groups = {}\n\n # what versions does the controller belong in (specified by resource_description)?\n @controller_versions = Hash.new { |h, controller| h[controller] = [] }\n end", "def initialize_component\n initialize_key\n initialize_state\n end", "def initialize\n @models_by_instrument = {}\n end", "def initialize(env)\n @env = env\n @params = _compute_params\n freeze\n end", "def prepare_environment\n data = resource['data'] || {}\n data.each do |key, value|\n data[key] = nil if value == 'nil'\n data[key] = false if value == 'false'\n data[key] = true if value == 'true'\n data[key] = data[key].to_i if key == 'vlanId'\n end\n uri_validation(data)\n @data = data\n data_parse\nend", "def post_init\n end", "def init_states\n russia_states = Country.find_by_iso(\"RU\").states\n ukraine_states = Country.find_by_iso(\"UA\").states\n @states = russia_states + ukraine_states\n end", "def post_initialize\n end", "def initialize(params = nil)\n set_params(params)\n set_simulation\n end", "def initializeDefaultParameters()\n @phasing = 0\n @prePhasing = 0\n @yield = 0\n @percentPFReads = 0 # Percentage of purity filtered reads\n @numRawReads = 0 # Number of raw reads\n @numPFReads = 0 # Number of purity filtered reads\n @referencePath = \"\"\n @percentAligned = 0\n @percentError = 100\n @firstCycleInt = 0 # First cycle intensity\n @percentIntAfter20 = 0 # Percent intensity after 20 cycles\n @percentPerfectIndex = 0 # Percent of index reads matching perfectly\n @percent1MismatchIndex = 0 # Percentage of index reads with 1 mismatch\n @percentQ30Bases = 0 # Percentage of bases with Q30 or higher\n @meanQualScore = 0 # Mean quality score\n end", "def initialize(p)\n \n @parameters = p\n\n @parameters = RImageAnalysisTools.create_parameter_dictionary(p) unless @parameters.is_a? ParameterDictionary\n\n @failures = {r2: 0, edge: 0, sat: 0, sep: 0, err: 0}\n\n if @parameters[:darkcurrent_image] then\n\n @dark_image = FileInteraction.load_image(@parameters[:darkcurrent_image])\n\n end\n\n set_up_logging\n \n end", "def generate_initial_state\n @state.each_with_index do |row, row_index|\n end\n end", "def initialize(state_of_origin, population_density, population)\n @state = state_of_origin\n @population = population\n @population_density = population_density\n end", "def initialize(state_of_origin, population_density, population)\n @state = state_of_origin\n @population = population\n @population_density = population_density\n end", "def initialize(state_of_origin, population_density, population)\n @state = state_of_origin\n @population = population\n @population_density = population_density\n end", "def initialize(state_of_origin, population_density, population)\n @state = state_of_origin\n @population = population\n @population_density = population_density\n end", "def initialize(state_of_origin, population_density, population)\n @state = state_of_origin\n @population = population\n @population_density = population_density\n end", "def initialize(state_of_origin, population_density, population)\n @state = state_of_origin\n @population = population\n @population_density = population_density\n end", "def initialize(state_of_origin, population_density, population)\n @state = state_of_origin\n @population = population\n @population_density = population_density\n end", "def initialize(state_of_origin, population_density, population)\n @state = state_of_origin\n @population = population\n @population_density = population_density\n end", "def initialize(state_of_origin, population_density, population)\n @state = state_of_origin\n @population = population\n @population_density = population_density\n end", "def initialize(state_of_origin, population_density, population)\n @state = state_of_origin\n @population = population\n @population_density = population_density\n end", "def initialize(state_of_origin, population_density, population)\n @state = state_of_origin\n @population = population\n @population_density = population_density\n end", "def initialize(state_of_origin, population_density, population)\n @state = state_of_origin\n @population = population\n @population_density = population_density\n end", "def initialize(state_of_origin, population_density, population)\n @state = state_of_origin\n @population = population\n @population_density = population_density\n end", "def initialize(state_of_origin, population_density, population)\n @state = state_of_origin\n @population = population\n @population_density = population_density\n end", "def initialize(state_of_origin, population_density, population)\n @state = state_of_origin\n @population = population\n @population_density = population_density\n end", "def initialize(state_of_origin, population_density, population)\n @state = state_of_origin\n @population = population\n @population_density = population_density\n end", "def initialize(state_of_origin, population_density, population)\n @state = state_of_origin\n @population = population\n @population_density = population_density\n end", "def initialize(params = {})\n if params[:training_file_name]\n @attributes = []\n @attribute_types = {}\n default_value = \"\"\n training_data = [] # each data instance represented by an array with attribute values and class value last\n \n File.open(\"#{Training_Data_Folder}/#{params[:training_file_name]}\") do |f|\n header_array = f.gets.chomp.split(',')\n header_array.each do |attribute_with_type|\n attribute_type_pair = attribute_with_type.split(':')\n @attributes << attribute_type_pair.first\n @attribute_types[attribute_type_pair.first.to_sym] = attribute_type_pair.last.to_sym\n end\n \n default_value = f.gets.chomp\n \n f.each_line do |line|\n training_data << extract_data_instance(line)\n end\n end\n \n @tree = DecisionTree::ID3Tree.new(@attributes, training_data, default_value, @attribute_types)\n elsif params[:config_file_name]\n @tree = DecisionTree::ID3Tree.load_from_file(\"#{Config_Folder}/#{params[:config_file_name]}\")\n else\n puts \"Unrecognized parameters\"\n end\n end", "def virus_effects\n predicted_deaths(@population_density, @population)\n speed_of_spread(@population_density)\n # Deleted out @state because it isn't being used in either method\n end", "def setup(params)\n\n\t\t@selected = []\n\t\t@driver = []\n\t\t@errors = []\n\t\t# @output_tmp = Dir.mktmpdir\n\n\tend", "def initialize(k, test_set, database)\n @test_set = test_set\n @database = database\n @count = k\n @predictions = []\n run_test\n @mean = mean_calc\n end" ]
[ "0.7417357", "0.7052343", "0.7042467", "0.6969133", "0.696759", "0.6920956", "0.6801349", "0.66025865", "0.62853175", "0.6267976", "0.61330366", "0.6016149", "0.597069", "0.5828679", "0.58225214", "0.5819091", "0.57947904", "0.57842296", "0.57432914", "0.5667945", "0.5659236", "0.5649957", "0.56144", "0.5584102", "0.5560709", "0.5550179", "0.5548739", "0.55452883", "0.5540533", "0.5535374", "0.5535374", "0.553368", "0.55212355", "0.5514837", "0.5505326", "0.5484858", "0.5478237", "0.54750997", "0.54609424", "0.54520726", "0.54356515", "0.54000944", "0.53980774", "0.5394886", "0.53871584", "0.53851306", "0.53834647", "0.5376101", "0.537574", "0.5350091", "0.5340505", "0.53297836", "0.5328319", "0.53269756", "0.5326926", "0.53154075", "0.5310274", "0.52920485", "0.52876776", "0.5287228", "0.52836794", "0.52618676", "0.52553844", "0.5243519", "0.52348626", "0.52335733", "0.52134526", "0.52077866", "0.52073693", "0.5203156", "0.52003646", "0.51906997", "0.5189464", "0.51855797", "0.5177836", "0.51666546", "0.51651186", "0.5162821", "0.5162325", "0.5157695", "0.5155597", "0.5155597", "0.5155597", "0.5155597", "0.5155597", "0.5155597", "0.5155597", "0.5155597", "0.5155597", "0.5155597", "0.5155597", "0.5155597", "0.5155597", "0.5155597", "0.5155597", "0.5155597", "0.51524496", "0.5147499", "0.5139452", "0.5136721" ]
0.65119123
8
dumps all of the raw backup data to the specified directory
def dump_data(to) data.keys.each do |key| FileUtils.mkdir_p(to + File.dirname(key)) File.open(to + key, "wb") do |out| case data[key] when StringIO out.write data[key].read # .mbackup file data when Hash out.write Plist::Emit.dump(data[key]) # Info.plist, etc. else puts "couldn't write out #{key}, don't know how to handle a #{data[key].class}" end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def backup(dest_dir)\n logger.info \"Dumping MySQL#{db.db_and_table_names}\"\n @db.backup dest_dir\n end", "def make_mysql_backup\n if @all_databases\n options = {\n :name => \"--all-databases\",\n :dump_options => \"\",\n :append_name => \"\"\n }\n file_name = mysqldump(options)\n compress_file(file_name)\n end\n if @databases && !@databases.empty?\n @databases.each do |db|\n options = {\n :name => db[:name].to_s,\n :dump_options => db[:dump_options].to_s,\n :append_name => db[:append_name].to_s\n }\n file_name = mysqldump(options)\n compress_file(file_name)\n end\n end\nend", "def zip_dump\n\t system(\"mongodump --host localhost --db #{@mongo_database} --out #{@base_path}\")\n\t Dir[@base_path + '*.zip'].select { |e| File.delete(e) }\n\t Zip::File.open(@zipfile_name, Zip::File::CREATE) do |zipfile|\n\t Dir[File.join(@directory, '**', '**')].each do |file|\n\t\t zipfile.add(file.sub(@directory + '/', ''), file)\n\t end\n\t end\n\t end", "def perform_backup\n \n add_memories_to_dropbox! if has_dropbox?\n\n # Clone the repo incase something is writing to it while we are backing up\n run \"cd #{@home} && git clone --bare #{@repo} #{@repo}.mirror\"\n output=run \"backup perform --trigger=daily_backup --log-path #{@dirs[:logs ]}\"\n run \"cd #{@home} && rm -fr #{@repo}.mirror\"\n \n get_timestamp(output)\n end", "def store_backup\n ret = true\n base = Util.data_path(EMMConfig[\"DATA_BACK_DIR\"])\n $files.each do |f|\n # directory of the file \n # LSMSS10, LSMSS30 , etc\n dir = File.basename(File.expand_path(\"#{f}/..\"))\n back_path = base + \"/\" + dir + \"/\" + File.basename(f)\n cmd = \"mv #{f} #{back_path}\"\n unless system(cmd)\n $stderr.puts \"Move #{cmd} did not work ... Next\" if $opts[:v]\n ret = false\n next\n end\n\n # compress the file\n cmd = EMMConfig[\"COMPRESS\"] + \" #{back_path}\"\n unless system(cmd)\n $stderr.puts \"Compress #{cmd} did not work ... Next\" if $opts[:v]\n ret = false\n next\n end\n end \n ret\nend", "def backup \n begin\n check_if_db_exists\n is_allowed = @conn.exec(\"select datallowconn from pg_catalog.pg_database where datname='#{@options[:database]}'\")[0]['datallowconn']\n if is_allowed == 'f'\n # unquiece temporarily\n set_dataallowcon_to true\n end\n\n # Check to see if the directory for backups exists and if not, create it with parents\n unless File.exist?(@options[:bkdir])\n FileUtils.mkdir_p @options[:bkdir]\n end\n filename = \"postgresbk_#{@options[:database]}_#{Time.new.strftime(\"%m%d%y%H%M%S\")}.dump\"\n\n # The below system call assumes you have passwordless access as the user passed into the executable tool\n # either due to ~/.pgpass or pg_hba.conf has your user as a 'trust' auth method\n `pg_dump -U #{@options[:user]} #{@options[:database]} -F c -f #{@options[:bkdir]}/#{filename}`\n\n rescue Exception => e\n raise e\n ensure\n if is_allowed == 'f'\n # re quiesce \n set_dataallowcon_to false\n end\n end\n end", "def dump\n FileUtils.rm_rf(backup_builds_dir)\n # Ensure the parent dir of backup_builds_dir exists\n FileUtils.mkdir_p(Gitlab.config.backup.path)\n # Fail if somebody raced to create backup_builds_dir before us\n FileUtils.mkdir(backup_builds_dir, mode: 0700)\n FileUtils.cp_r(app_builds_dir, backup_dir)\n end", "def wDumpAllDatabase()\n puts \"Back up commencing...\"\n Dir.chdir('/Users/jeydurai')\n system('start_mongodump.bat')\n end", "def make_backup\n print_title('Data backup')\n\n @backup_type ||= prompt.select('What type of backup do you want?',\n 'Full (redmine root and database)' => :full,\n 'Only database' => :database,\n 'Nothing' => :nothing)\n\n logger.info(\"Backup type: #{@backup_type}\")\n\n # Dangerous option\n if @backup_type == :nothing\n if prompt.yes?('Are you sure you dont want backup?', default: false)\n logger.info('Backup option nothing was confirmed')\n return\n else\n @backup_type = nil\n return make_backup\n end\n end\n\n @backup_root ||= prompt.ask('Where to save backup:', required: true, default: DEFAULT_BACKUP_ROOT)\n @backup_root = File.expand_path(@backup_root)\n\n @backup_dir = File.join(@backup_root, Time.now.strftime('backup_%d%m%Y_%H%M%S'))\n create_dir(@backup_dir)\n\n files_to_backup = []\n Dir.chdir(root) do\n case @backup_type\n when :full\n files_to_backup = Dir.glob(File.join('**', '{*,.*}'))\n end\n end\n\n if files_to_backup.any?\n files_to_backup.delete_if do |path|\n path.start_with?(*BACKUP_EXCLUDE_FILES)\n end\n\n @backup_package = File.join(@backup_dir, 'redmine.zip')\n\n Dir.chdir(root) do\n puts\n puts 'Files backuping'\n Zip::File.open(@backup_package, Zip::File::CREATE) do |zipfile|\n progressbar = TTY::ProgressBar.new(PROGRESSBAR_FORMAT, total: files_to_backup.size, frequency: 2, clear: true)\n\n files_to_backup.each do |entry|\n zipfile.add(entry, entry)\n progressbar.advance(1)\n end\n\n progressbar.finish\n end\n end\n\n puts \"Files backed up on #{@backup_package}\"\n logger.info('Files backed up')\n end\n\n @database = Database.init(self)\n @database.make_backup(@backup_dir)\n\n puts \"Database backed up on #{@database.backup}\"\n logger.info('Database backed up')\n end", "def xDumpAllDatabase()\n puts \"Back up commencing...\"\n Dir.chdir('/Users/jeydurai')\n system('start_mongodump.bat')\n end", "def dump_directory\n \"--out='#{ dump_path }'\"\n end", "def backup_data(src_file)\n backup_path = src_file + '.simplib_migration.bak.' + Time.now.strftime('%Y_%m_%d_%s')\n puts %Q(Making backup at #{backup_path})\n FileUtils.cp_r(src_file, backup_path)\nend", "def backup\n\t\tunless (@options && @options[:path] && @options[:dataset])\n\t\t\traise OptionParser::InvalidArgument, \"Missing arguments for 'backup'.\"\n\t\tend\n\t\t# Only attempt backup if the service is running\n\t\tstate = false\n\t\tself.launch(\"/usr/sbin/serveradmin status postgres\") do |output|\n\t\t\tstate = ((/RUNNING/ =~ output) != nil)\n\t\tend\n\t\torig_state = state\n\t\t$log.debug(\"@options = #{@options.inspect}\")\n\t\tarchive_dir = @options[:path]\n\t\tunless (archive_dir[0] == ?/)\n\t\t\traise OptionParser::InvalidArgument, \"Paths must be absolute.\"\n\t\tend\n\t\twhat = @options[:dataset]\n\t\tunless self.class::DATASETS.include?(what)\n\t\t\traise OptionParser::InvalidArgument, \"Unknown data set '#{@options[:dataset]}' specified.\"\n\t\tend\n\t\t# The passed :archive_dir and :what are ignored because the dump is put\n\t\t# on the live data volume\n\t\tarchive_dir = self.backupDir\n\t\tdump_file = \"#{archive_dir}/#{BACKUP_FILE}\"\n\t\tdump_file_uncompressed = \"#{archive_dir}/#{BACKUP_FILE_UNCOMPRESSED}\"\n\t\t# Create the backup directory as necessary.\n\t\tunless File.directory?(archive_dir)\n\t\t\tif File.exists?(archive_dir)\n\t\t\t\t$log.info \"Moving aside #{archive_dir}...\\n\"\n\t\t\t\tFileUtils.mv(archive_dir, archive_dir + \".applesaved\")\n\t\t\tend\n\t\t\t$log.info \"Creating backup directory: #{archive_dir}...\\n\"\n\t\t\tFileUtils.mkdir_p(archive_dir, :mode => 0700)\n\t\t\t# _postgres:_postgres has uid:gid of 216:216\n\t\t\tFile.chown(216, 216, archive_dir)\n\t\tend\n\t\t# Backup only once a day\n\t\tmod_time = File.exists?(dump_file) ? File.mtime(dump_file) : Time.at(0)\n\t\tif (Time.now - mod_time) >= (24 * 60 * 60)\n\t\t\t# Attempt to start the service if needed\n\t\t\tif (! state)\n\t\t\t\tself.launch(\"/usr/sbin/serveradmin start postgres\") do |output|\n\t\t\t\t\tstate = ((/RUNNING/ =~ output) != nil)\n\t\t\t\tend\n\t\t\tend\n\t\t\tif (! state)\n\t\t\t\t$log.info \"PostgreSQL is not running, skipping database backup\"\n\t\t\t\treturn\n\t\t\tend\n\n\t\t\t$log.info \"Creating dump file \\'#{dump_file}\\'...\"\n\t\t\tsystem(\"/usr/bin/sudo -u _postgres /usr/bin/pg_dumpall > #{dump_file_uncompressed.shellescape}\")\n\t\t\tif ($?.exitstatus != 0)\n\t\t\t\t$log.error \"...Backup failed on pg_dumpall, Status=#{$?.exitstatus}\"\n\t\t\telse\n\t\t\t\tsystem(\"/usr/bin/gzip #{dump_file_uncompressed.shellescape}\")\t\t\t\t\n\t\t\t\tif ($?.exitstatus == 0)\n\t\t\t\t\tFile.chmod(0640, dump_file)\n\t\t\t\t\tFile.chown(216, 216, dump_file)\n\t\t\t\t\t$log.info \"...Backup succeeded.\"\n\t\t\t\telse\n\t\t\t\t\t$log.error \"...Backup failed on gzip! Status=#{$?.exitstatus}\"\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t# Restore original service state\n\t\t\tif (! orig_state)\n\t\t\t\t# What if a dependent service was launched while we were backing up? We\n\t\t\t\t# don't want to shut down postgres in that case.\n\t\t\t\twiki_state = false\n\t\t\t\tcalendar_state = false\n\t\t\t\taddressbook_state = false\n\t\t\t\tdevicemgr_state = false\n\t\t\t\tself.launch(\"/usr/sbin/serveradmin status wiki\") do |output|\n\t\t\t\t\twiki_state = ((/RUNNING/ =~ output) != nil)\n\t\t\t\tend\n\t\t\t\tself.launch(\"/usr/sbin/serveradmin status calendar\") do |output|\n\t\t\t\t\tcalendar_state = ((/RUNNING/ =~ output) != nil)\n\t\t\t\tend\n\t\t\t\tself.launch(\"/usr/sbin/serveradmin status addressbook\") do |output|\n\t\t\t\t\taddressbook_state = ((/RUNNING/ =~ output) != nil)\n\t\t\t\tend\n\t\t\t\tself.launch(\"/usr/sbin/serveradmin status devicemgr\") do |output|\n\t\t\t\t\tdevicemgr_state = ((/RUNNING/ =~ output) != nil)\n\t\t\t\tend\n\t\t\t\tif (! (wiki_state || calendar_state || addressbook_state || devicemgr_state))\n\t\t\t\t\tself.launch(\"/usr/sbin/serveradmin stop postgres\")\n\t\t\t\tend\n\t\t\tend\n\t\telse\n\t\t\t$log.info \"Dump file is less than 24 hours old; skipping.\"\n\t\tend\n\tend", "def backup\n inexistent_files = check_for_inexistent_files\n unless inexistent_files.empty?\n STDERR.puts \"Cannot backup inexistent files\"\n STDERR.puts inexistent_files.join(\" \")\n exit 1\n end\n\n FileUtils.mkdir_p @backup_folder unless File.exists? @backup_folder\n\n if @no_compress \n copy_files \n delete_uncompressed_backups\n else\n compress_files_and_copy\n delete_compressed_backups\n end\n\n end", "def dump_directory\n \"--out='#{ @dump_path }'\"\n end", "def package!\n Logger.message \"#{ self.class } started packaging the backup files.\"\n run(\"#{ utility(:tar) } -c -f '#{ File.join(Backup::TMP_PATH, \"#{ Backup::TIME }.#{ Backup::TRIGGER }.tar\") }' -C '#{ Backup::TMP_PATH }' '#{ Backup::TRIGGER }'\")\n end", "def dump(path, backup_id)\n raise NotImplementedError\n end", "def backup\n # solve override problem\n if backup_exist? && !@opt[:bkp_args][:quiet]\n while true\n print \"Already have backup in #{@cfg[:backup]},override?(y/n)\"\n opt = gets\n case opt\n when /^y/i\n break\n when /^n/i\n return\n else\n next\n end\n end\n end\n \n # do backup\n FileUtils.mkdir_p @cfg[:backup] unless File.directory? @cfg[:backup]\n CommonUtils.copy_files @cfg[:local_files], File.join(__dir__, @cfg[:backup]) do |src, dest|\n @logger.debug \"Copying #{src} to #{dest}\"\n puts \"Backup: #{File.basename src}\" unless @opt[:bkp_args][:quiet]\n end\n @logger.debug('Backup completed')\n puts \"Backup completed, saved in: #{@cfg[:backup]}\" unless @opt[:bkp_args][:quiet]\n end", "def run_backups\n puts \"Starting backups...\" if options[:verbose]\n for database in database_list\n Dir.chdir(temp_directory)\n name, user, pass = database.split(\",\")\n password = pass.strip.empty? ? '' : \"-p#{pass.strip}\"\n tgz_filename = \"#{name}.#{DATE}.#{TIME}.tgz\"\n # stop the slave if necessary\n puts \"Stopping the slave...\" if options[:verbose] && options[:slave]\n `mysql -u #{user} #{password} --execute='stop slave;'` if options[:slave]\n \n # switch to the current database and backup each table\n tables = `echo 'show tables' | mysql -u #{user} #{password} #{name} | grep -v Tables_in_`\n for table in tables\n table.strip!\n puts \"Backing up table #{table}...\" if options[:verbose]\n filename = \"#{table}.#{DATE}.#{TIME}.sql\"\n `mysqldump --add-drop-table --allow-keywords -q -c -u #{user} #{password} #{name} #{table} > #{filename}`\n end\n \n # restart the slave if necessary\n puts \"Restarting the slave...\" if options[:verbose] && options[:slave]\n `mysql -u #{user} #{password} --execute='start slave;'` if options[:slave]\n \n # zip it up and move it to the backup directory\n puts \"Completed backups, zipping it up...\" if options[:verbose]\n `tar -zcvf #{backup_directory}/#{tgz_filename} *`\n puts \"Cleaning up...\" if options[:verbose]\n Dir.chdir(backup_directory)\n `rm -rf #{temp_directory}`\n \n # copy it to any remote hosts if needed\n scp_results(tgz_filename) unless scp_hosts.empty?\n puts \"And we're done!\" if options[:verbose]\n end\n end", "def create_backup\n files = []\n if @options.database\n db_backup = MySQLBackup.new(@options.database, \n @options.user,\n @options.password)\n files << db_backup.backup\n end\n \n files << @options.files if @options.files\n\n files.flatten!\n\n process = Process.new(@options.backup_folder,\n files, \n @options.override, \n @options.no_compress,\n @options.max_backups)\n process.backup\n puts \"--> backed up files\"\n puts \" #{files.join(\"\\n \")}\"\n puts \"--> to #{@options.backup_folder}\"\n\n File.delete files[0] if @options.database\n end", "def archive(dir)\n @archiver.archive(dir)\n end", "def save(dir)\n # Ruta dataset\n dataset_path = \"#{dir}/#{@name}/%s_#{@memory}\"\n\n # Rutas de archivos para el dataset\n sample_file = dataset_path % 'sample'\n summary_file = dataset_path % 'summary'\n count_file = dataset_path % 'count'\n\n # Se prepara el directorio que contendrá resultados, a no ser que exista\n unless File.exists?(\"\")\n status \"Creating directory #{dir}/#{@name}\", \"mkdir -p #{dir}/#{@name}\"\n end\n\n save_sample sample_file \n save_summary summary_file\n save_count count_file\n end", "def dump\n check_dependencies('mysqldump', 'bzip2', '/bin/sh')\n options = {}\n while arg = args.shift\n case arg\n when '-f', '--force'\n options[:force] = true\n when /^[^-]/\n raise CommandFailed, \"too many arguments passed\" if options[:filename]\n options[:filename] = arg\n else\n raise CommandFailed, \"unsupported option: #{arg}\"\n end\n end\n\n options[:filename] ||= \"#{app}-#{Time.now.strftime('%Y-%m-%d')}.sql.bz2\"\n options[:filename] += '.sql.bz2' unless options[:filename] =~ /\\.sql(\\.bz2)?$/\n options[:filename] += '.bz2' unless options[:filename] =~ /\\.bz2$/\n\n if File.exists?(options[:filename]) && !options[:force]\n raise CommandFailed, \"file already exists. use --force to override.\"\n end\n\n exec('/bin/sh', '-c',\n \"mysqldump --compress --single-transaction #{args_to_s(mysql_args(database_uri))}\" +\n pv_pipe +\n %{| bzip2 > '#{options[:filename]}'})\n end", "def backup_dir\n @backup_dir ||= create_backup_dir\n end", "def transfer!\n backup = connection.backups.create\n Logger.info \"Created backup [#{backup.id}]\"\n\n package.filenames.each do |filename|\n src = File.join(Config.tmp_path, filename)\n metadata = {}\n\n [:sha512sum, :sha1sum, :cksum].each do |cmd|\n if !`which #{cmd}`.empty?\n metadata[cmd] = %x|#{cmd} #{src}|.split.first\n break\n end\n end\n\n metadata[:size] = %x|ls -sh #{src}|.split.first\n\n backup_file = backup.files.create(filename: src, metadata: metadata)\n Logger.info \"Created backup file [#{backup_file.id}]\"\n\n Logger.info \"EngineYard performing upload of '#{File.join(src)}' to '#{backup_file.upload_url}' with metadata '#{metadata.inspect}'.\"\n\n backup_file.upload(file: src)\n end\n Logger.info \"Finished uploading files for backup [#{backup.id}]\"\n\n backup.finish!\n\n Logger.info \"Finished backup [#{backup.id}]\"\n end", "def dump_and_download_to!(local_working_dir)\n dump!\n download_to!(local_working_dir)\n ensure\n clean_dump_if_needed!\n end", "def generate_data_zip(rootdir)\n tmpdir = File.join(rootdir, 'temp')\n logger.debug \"Changing to #{tmpdir}\"\n raise \"package-data: #{bare_druid} is missing #{tmpdir}\" unless File.directory?(tmpdir)\n\n Dir.chdir(tmpdir)\n File.umask(002)\n\n fns = []\n recurse_flag = false\n fn = Dir.glob('*.shp.xml').first\n if fn.nil?\n fn = Dir.glob('*/metadata.xml').first\n if fn.nil?\n fn = Dir.glob('*.tif.xml').first\n raise \"package-data: #{bare_druid} cannot locate metadata in temp\" if fn.nil?\n\n # GeoTIFF\n basename = File.basename(fn, '.tif.xml')\n Dir.glob(\"#{basename}.*\").each do |x|\n fns << x\n recurse_flag = true if File.directory?(x)\n end\n Dir.glob(\"#{basename}-*.xml\").each do |x|\n fns << x\n end\n else # ArcGRID\n fns << File.basename(File.dirname(fn))\n recurse_flag = true\n end\n else # Shapefile\n basename = File.basename(fn, '.shp.xml')\n Dir.glob(\"#{basename}.*\").each do |x|\n fns << x\n recurse_flag = true if File.directory?(x)\n end\n Dir.glob(\"#{basename}-*.xml\").each do |x|\n fns << x\n end\n end\n\n zipfn = File.join(rootdir, 'content', 'data.zip')\n FileUtils.mkdir_p(File.dirname(zipfn)) unless File.directory?(File.dirname(zipfn))\n FileUtils.rm_f(zipfn) if File.size?(zipfn)\n\n logger.debug \"Compressing #{bare_druid} into #{zipfn}\"\n system(\"zip -v#{recurse_flag ? 'r' : ''} '#{zipfn}' #{fns.join(' ')}\")\n end", "def sync_dir dir\n # TODO: think of a better name scheme\n # maybe the title should include the relative path?\n calculated_photoset_name = \"[ruphy-backup] #{dir}\"\n Dir.chdir @root + '/' + dir\n\n if photoset_exist? calculated_photoset_name\n #sync\n flickr_list = get_file_list calculated_photoset_name\n local_list = Dir[\"*\"]\n remotely_missing = []\n locally_missing = []\n \n local_list.each do |f|\n remotely_missing << f unless flickr_list.include? f\n end\n# puts \"remotely missing files: \" + remotely_missing.join(',')\n \n remotely_missing.each do |f|\n upload f, calculated_photoset_name\n end\n \n \n flickr_list.each do |f|\n locally_missing << f unless local_list.include? f\n end\n puts \"we're locally missing: \" + locally_missing.join(', ')\n \n # TODO: really perform sync\n \n else\n # set not existing: just upload\n Dir[\"*\"].each do |f|\n upload f, calculated_photoset_name\n end\n end\n end", "def backup!(file=nil)\n file = file || FILENAME\n dir = root + BACKUP_DIRECTORY\n FileUtils.mkdir(dir.dirname) unless dir.dirname.directory?\n FileUtils.mkdir(dir) unless dir.directory?\n save!(dir + DOTRUBY_FILENAME)\n end", "def system_backup\n\n\n end", "def perform\n tmp_mongo_dir = \"mongodump-#{Time.now.strftime(\"%Y%m%d%H%M%S\")}\"\n tmp_dump_dir = File.join(tmp_path, tmp_mongo_dir)\n\n case self.backup_method.to_sym\n when :mongodump\n #this is the default options \n # PROS:\n # * non-locking\n # * much smaller archive sizes\n # * can specifically target different databases or collections to dump\n # * de-fragements the datastore\n # * don't need to run under sudo\n # * simple logic\n # CONS:\n # * a bit longer to restore as you have to do an import\n # * does not include indexes or other meta data\n log system_messages[:mongo_dump]\n exit 1 unless run \"#{mongodump} #{mongodump_options} #{collections_to_include} -o #{tmp_dump_dir} #{additional_options} > /dev/null 2>&1\"\n when :disk_copy\n #this is a bit more complicated AND potentially a lot riskier: \n # PROS:\n # * byte level copy, so it includes all the indexes, meta data, etc\n # * fast recovery; you just copy the files into place and startup mongo\n # CONS:\n # * locks the database, so ONLY use against a slave instance\n # * copies everything; cannot specify a collection or a database\n # * will probably need to run under sudo as the mongodb db_path file is probably under a different owner. \n # If you do run under sudo, you will probably need to run rake RAILS_ENV=... if you aren't already\n # * the logic is a bit brittle... \n log system_messages[:mongo_copy]\n\n cmd = \"#{mongo} #{mongo_disk_copy_options} --quiet --eval 'printjson(db.isMaster());' admin\"\n output = JSON.parse(run(cmd, :exit_on_failure => true))\n if output['ismaster']\n puts \"You cannot run in disk_copy mode against a master instance. This mode will lock the database. Please use :mongodump instead.\"\n exit 1\n end\n \n begin\n cmd = \"#{mongo} #{mongo_disk_copy_options} --quiet --eval 'db.runCommand({fsync : 1, lock : 1}); printjson(db.runCommand({getCmdLineOpts:1}));' admin\"\n output = JSON.parse(run(cmd, :exit_on_failure => true))\n\n #lets go find the dbpath. it is either going to be in the argv just returned OR we are going to have to parse through the mongo config file\n cmd = \"mongo --quiet --eval 'printjson(db.runCommand({getCmdLineOpts:1}));' admin\"\n output = JSON.parse(run(cmd, :exit_on_failure => true))\n #see if --dbpath was passed in\n db_path = output['argv'][output['argv'].index('--dbpath') + 1] if output['argv'].index('--dbpath') \n #see if --config is passed in, and if so, lets parse it\n db_path ||= $1 if output['argv'].index('--config') && File.read(output['argv'][output['argv'].index('--config') + 1]) =~ /dbpath\\s*=\\s*([^\\s]*)/ \n db_path ||= \"/data/db/\" #mongo's default path\n run \"cp -rp #{db_path} #{tmp_dump_dir}\" \n ensure\n #attempting to unlock\n cmd = \"#{mongo} #{mongo_disk_copy_options} --quiet --eval 'printjson(db.currentOp());' admin\"\n output = JSON.parse(run(cmd, :exit_on_failure => true))\n (output['fsyncLock'] || 1).to_i.times do\n run \"#{mongo} #{mongo_disk_copy_options} --quiet --eval 'db.$cmd.sys.unlock.findOne();' admin\"\n end\n end\n else\n puts \"you did not enter a valid backup_method option. Your choices are: #{BACKUP_METHOD_OPTIONS.join(', ')}\"\n exit 1\n end \n \n log system_messages[:compressing]\n run \"tar -cz -C #{tmp_path} -f #{File.join(tmp_path, compressed_file)} #{tmp_mongo_dir}\"\n end", "def backup(job)\n path = @filesystem.get_tmp_path\n s3 = @storage.parse_location(job['location'])\n db = @db.get_opts(job['db'])\n \n Mongolicious.logger.info(\"Starting job for #{db[:host]}:#{db[:port]}/#{db[:db]}\")\n\n @db.dump(db, path)\n @filesystem.compress(path) \n \n key = \"#{s3[:prefix]}_#{Time.now.strftime('%m%d%Y_%H%M%S')}.tar.bz2\"\n @storage.upload(s3[:bucket], key, path)\n \n @filesystem.cleanup(path)\n @storage.cleanup(s3[:bucket], s3[:prefix], job['versions'])\n \n Mongolicious.logger.info(\"Finishing job for #{db[:host]}:#{db[:port]}/#{db[:db]}\") \n end", "def package!\n return unless @model.compressor\n\n pipeline = Pipeline.new\n base_dir = File.dirname(@dump_path)\n dump_dir = File.basename(@dump_path)\n timestamp = Time.now.to_i.to_s[-5, 5]\n outfile = @dump_path + '-' + timestamp + '.tar'\n\n Logger.info(\n \"#{ database_name } started compressing and packaging:\\n\" +\n \" '#{ @dump_path }'\"\n )\n\n pipeline << \"#{ utility(:tar) } -cf - -C '#{ base_dir }' '#{ dump_dir }'\"\n @model.compressor.compress_with do |command, ext|\n pipeline << command\n outfile << ext\n end\n pipeline << \"cat > #{ outfile }\"\n\n pipeline.run\n if pipeline.success?\n Logger.info(\n \"#{ database_name } completed compressing and packaging:\\n\" +\n \" '#{ outfile }'\"\n )\n FileUtils.rm_rf(@dump_path)\n else\n raise Errors::Database::PipelineError,\n \"#{ database_name } Failed to create compressed dump package:\\n\" +\n \"'#{ outfile }'\\n\" +\n pipeline.error_messages\n end\n end", "def sync_local\n sync_hash = {\n ['~/Library/Application\\\\ Support/Firefox', '~/Library/Application\\\\ Support/Quicksilver',\n '~/Library/Preferences' ] =>'library/',\n ['~/.boson', '~/.sake', '~/.cronrc', '~/.gemrc', '~/.gitconfig', '~/.gem/specs']=>'dotfiles/',\n }\n sync_hash.each do |src, dest|\n src.each do |e| \n cmd = \"rsync -av #{e} #{File.join('~/backup', dest)}\"\n system cmd\n end\n end\n end", "def backup!(file=nil)\n file = file || FILENAME\n dir = root + BACKUP_DIRECTORY\n FileUtils.mkdir(dir.dirname) unless dir.dirname.directory?\n FileUtils.mkdir(dir) unless dir.directory?\n save!(dir + FILENAME)\n end", "def backup_and_download\n @config.each do |config|\n connect_to_host(config[:host],config[:port],config[:user],config[:password])\n backup_config(config[:name],config[:format])\n download_backup(config[:host],config[:port],config[:user],config[:password],config[:name],config[:path],config[:format])\n end\n return true\n end", "def backup2Drive(src,conf)\n dest = conf[:backupDrive]\n dest = dest + \"/\" unless dest [-1] =~ /[\\/\\\\]/\n dest = dest + src\n puts src\n puts dest\n FileUtils.mkdir_p(File.dirname(dest))\n FileUtils.cp(src, dest)\n puts aktTime()+\" archive copied\"\n cleanUp(conf) if conf[:generations]\n \nend", "def backup\n #EternosBackup::BackupJobPublisher.add_source(self)\n end", "def flush\n flush_block unless @buffer.empty? \n process_hardlinks\n\n # writing the location of the archive (it's after the dump data)\n writeloc(@file, [@location].pack('V'), 0) \n\n indexloc = @location\n location = (sha1subset('FFFFFFFFFF', @idx_size) * 8) + indexloc\n # p = File.open(\"zlog\", \"w\")\n each_entry_with_index do |entry, idx|\n next if entry.nil? \n\n writeloc(@file, [location, entry.size].pack('V2'), (idx * 8) + indexloc)\n writeloc(@file, entry, location)\n\n # p << \"*\" * 80 << \"\\n\" \n # p << \"seek #{(idx * 8) + indexloc} location #{location} size #{entry.size}\" << \"\\n\"\n # p << unpack(entry).join(\":\") << \"\\n\"\n\n location += entry.size\n end\n\n # meta location\n writeloc(@file, [location, @compressor.method, @idx_size].pack('VCC'), 4)\n\n writeloc(@file, Marshal.dump(@meta), @location) if defined?(@meta)\n\n @file.close\n end", "def dump(data_path=File.join(DATA_DIR, \"#{Time.now.to_i}.json\"))\n\n if(File.exists?(data_path))\n raise ArgumentError.new(\"Refusing to overwrite existing file #{data_path}\")\n else\n dir, base = File.split(data_path)\n cmd = \"mkdir -p #{dir}\"\n pid = status = stderr = nil\n #Open3.popen3([env,] cmd... [, opts]) {|stdin, stdout, stderr, wait_thr|\n Open3.popen3(cmd) {|stdin, stdout, stderr, wait_thr|\n pid = wait_thr.pid # pid of the started process.\n status = wait_thr.value # Process::Status object returned.\n }\n if(status.success?)\n else\n raise ArgumentError.new(\"Could not create directory #{dir}; stderr of #{cmd} : #{stderr}\")\n end\n end\n\n sql = \"select * from #{TABLE_KEY}\"\n query = [\n \"key=#{PROJECT_KEY}\",\n \"sql=#{CGI.escape(sql)}\"\n ]\n url = \"#{TABLE_URL}?#{query.join(\"&\")}\"\n response = get(url)\n \n File.open(data_path, \"w\"){|ff|\n size = ff.write(response.body)\n }\nend", "def save_json(dir)\n save_json_one(dir, country_data, 'country')\n save_json_one(dir, us_state_data,'us_state')\n save_json_one(dir, us_metro_data, 'us_metro')\n save_json_one(dir, us_county_data, 'us_county')\n\n bn = File.basename(dir)\n dn = File.dirname(dir)\n\n\n puts \"Uploading json data\"\n Dir[File.join(dir,'*.json')].each do |path|\n bn = File.basename(path)\n dn = File.dirname(path)\n cmd = \"curl -u 'corona@coronamodel.com:Pp[31415926]' --ftp-create-dirs -s -T #{dn}/#{bn} ftp://160.153.91.2/standalone/#{bn}\"\n r = `#{cmd} 2>&1`.chomp\n r = ' - ERRORS: ' + r unless r.empty?\n puts \" #{bn}#{r}\"\n end\n end", "def install\n backupdir = BackupDir.new(\"./vim-ruby-backup.#{Process.pid}\")\n Dir.chdir(@source_dir) do\n SOURCE_FILES.each do |path|\n\tsource_path = Pathname.new(path)\n\ttarget_path = @target_dir[path]\n\t# FIXME: Backup everything for now\n\tif $options[:backup] and target_path.file?\n\t backupdir.backup(@target_dir, path)\n\telsif target_path.file? and target_path.mtime > source_path.mtime\n\t # We're going to overwrite a newer file; back it up, unless they're the same.\n\t unless _same_contents?(target_path, source_path)\n\t backupdir.backup(@target_dir, path)\n\t end\n\tend\n\t@target_dir.copy(path)\n end\n end\n backups = backupdir.contents\n unless backups.empty?\n puts\n puts \"The following backups were made:\"\n backups.each do |path|\n\tputs \" * #{path}\"\n end\n puts\n puts \"These backups are located in this directory: #{backupdir.path}\"\n end\n end", "def backup_database\n #todo handle db prefix\n #todo proper error handling\n\n dbuser = @attributes[:dbuser]\n dbhost = @attributes[:dbhost]\n dbpass = @attributes[:dbpass]\n dbname = @attributes[:dbname]\n\n # see https://docs.moodle.org/20/en/Site_backup\n\n cmd = %Q{mysqldump -u #{dbuser} -h'#{dbhost}' -p'#{dbpass}' -C -Q -e --create-options '#{dbname}' | gzip -9 > '#{mk_backup_filename('database')}'}\n system cmd\n\n nil\n end", "def backupAllVolumes(profile,region,daystokeep,name,json,tags)\n parsed = JSON.parse(json)\n parsed[\"Volumes\"].each do |volume|\n backupVolume(profile,region,volume[\"VolumeId\"],daystokeep,name,tags)\n end\nend", "def prep_command\n \"mysqldump #{dump_options} -u #{db_user} --password=#{db_password} #{database} > #{remote_backup_path}\"\n end", "def dump(backup_file_name)\n @mysqlcmds ||= ::Rds::S3::Backup::MySqlCmds.new(backup_server.endpoint['Address'],\n @opts['mysql_username'],\n @opts['mysql_password'],\n @opts['mysql_database'])\n\n\n\n\n @mysqlcmds.dump(backup_file_path(backup_file_name)) # returns the dump file path\n end", "def copy_data_dir_here\n copy_all from: content, to: current_dir\nend", "def pack directory_path\n Dir.chdir directory_path\n name = Dir.pwd.split(@fs).last\n files = Dir.glob \"**#{@fs}*\"\n File.open([name, @ext].join(\".\"), \"wb\") do |tar|\n Minitar.pack(files, tar)\n end\n end", "def dump_directory\n File.join(@relative_to_base, DUMP_DIRECTORY_NAME)\n end", "def save_brins\n brins_file.write( Marshal.dump(brins))\n update_all_data_in_file\n end", "def wRestoreDump()\n puts \"Back up commencing...\"\n Dir.chdir('/Users/jeydurai')\n system('start_mongorestore.bat')\n end", "def generate_bulk_export\n # Delete the bulk_export directory if it exists.\n FileUtils.rm_rf(\"bulk_export\")\n\n get_all_insurance_plans\n get_all_location_resources\n p \"===============================================================\"\n p \"Creating the Bulk export folder output ...\"\n generate_payer_bulk_data\n generate_formulary_bulk_data\nend", "def backup\n BACKUP_MODELS.each do |obj|\n puts \"Preparing to back up #{obj}\"\n self.send(obj.to_sym)\n end \n end", "def local\n db_dump\n sync_local\n system_lists\n commit_git_repo(\"~/backup\")\n end", "def backup_sqlite3 (prefix)\n bkfilename = Rails.root.join(\"db\",\"backups\",\"#{prefix}-backup-\" + Time.now.strftime(\"%Y%m%d%H%M%S\") + \".tar.gz\").to_s\n `tar -zcvf \"#{addslashes(bkfilename)}\" db/*.sqlite3`\n bkfilename\nend", "def tar_data(verbose)\n shell = SwrShell.new\n @fileutils.su_mkdir_p @config[\"tar_data\"], verbose\n @fileutils.su_du_sh \"#{@datadir}\", verbose\n cmd = \"tar -C #{@datadir} -c . | snzip > #{File.join(@config[\"tar_data\"],\"data.tar.snz\")}\"\n shell.su_execute(cmd,verbose)\n if @datadir == @logdir\n #log and data dirs are the same so creating empty log.tar.gz\n @fileutils.su_mkdir_p \"empty\", verbose\n @fileutils.su_tar \" -C empty \",\" -cf #{File.join(@config[\"tar_data\"],\"log.tar\")}\",\".\", verbose\n @fileutils.su_rm_rf \"empty\", verbose\n elsif @logdir != ''\n cmd = \"tar -C #{@logdir} -c . | snzip > #{File.join(@config[\"tar_data\"],\"log.tar.snz\")}\"\n shell.su_execute(cmd,verbose)\n end\n cmd = \"cd #{@config[\"tar_data\"]}; du -h; sudo touch md5sums.txt; sudo chmod a+rw md5sums.txt; sudo md5sum data.tar* >> md5sums.txt; sudo md5sum log.tar* >> md5sums.txt;\"\n shell.execute(cmd,verbose,true)\n @fileutils.sync verbose\n end", "def archive!\n archive\n save!(validate: false)\n end", "def tgz___( directory, filename )\r\n raise StandardError, \"Under investigation\" \r\n got = @ndev.rpc.file_archive( :destination => filename, :source => directory, :compress => true )\r\n end", "def run_dir(root)\n\tDir.foreach(root) { |fn|\n\t\tnext if fn == \".\" || fn == \"..\"\n\t\tcombined = File.join(root, fn)\n\t\tif File.directory?(combined)\n\t\t\trun_dir(combined)\n\t\telsif File.file?(combined) && (fn[\".dll\"] || fn[\".pdb\"])\n\t\t\tfpath = combined\n\t\t\tfpath = fpath[2..-1] if fpath[0..1] == \"./\"\n\t\t\tfpath = fpath.gsub(\"/\", \"\\\\\")\n\t\t\tprint(\"#{fpath}\\n\")\n\t\t\t`compress -R #{fpath}`\n\t\t\texit(1) if $?.exitstatus != 0\n\t\t\t`del #{fpath}`\n\t\tend\n\t}\t\nend", "def make_tarball(destination, conf,curDir)\n\tDir.chdir(curDir)\n\n gzip = Zlib::GzipWriter.new(File.open(destination, 'wb'))\n tar = Minitar::Output.new(gzip)\n\t conf[:zipFiles].each { |f|\tMinitar.pack_file(f, tar) }\n tar.close\n\n conf[:backupSize]=File.size(destination) #remember archive size\nend", "def dump_directory\n @relative_location.end_with?('/') ? @relative_location + DUMP_DIRECTORY_NAME : @relative_location + '/' + DUMP_DIRECTORY_NAME\n end", "def serialize(save_directory)\n\t\t[\n\t\t\t# @live_wrapper,\n\t\t\t@input_test,\n\t\t].each do |dynamic_obj|\n\t\t\tdynamic_obj.serialize save_directory\n\t\tend\n\tend", "def package!\n Backup::Packager.new(self).package!\n end", "def unpack_to(dir)\n sh \"cp -R #{local_path} #{dir}\"\n end", "def xRestoreDump()\n puts \"Back up commencing...\"\n Dir.chdir('/Users/jeydurai')\n system('start_mongorestore.bat')\n end", "def copy_files\n @files.each do |file|\n basename = File.basename file\n FileUtils.cp file, @backup_folder + basename if File.file? file\n FileUtils.cp_r file, @backup_folder + basename if File.directory? file\n end\n end", "def write_archive(archive, dir)\n\t\tIO.popen(\"cd #{dir}; tar x\", \"w\") do |p|\n\t\t\tp.write archive\n\t\tend\n\tend", "def perform!\n super\n\n dump = \"echo '.dump' | #{sqlitedump_utility} #{path}\"\n\n pipeline = Pipeline.new\n dump_ext = \"sql\".dup\n\n pipeline << dump\n if model.compressor\n model.compressor.compress_with do |command, ext|\n pipeline << command\n dump_ext << ext\n end\n end\n\n pipeline << \"cat > '#{File.join(dump_path, dump_filename)}.#{dump_ext}'\"\n\n pipeline.run\n\n if pipeline.success?\n log!(:finished)\n else\n raise Error,\n \"#{database_name} Dump Failed!\\n\" + pipeline.error_messages\n end\n end", "def download_prepared_dump id\n name = \"trunk-#{id}.dump\"\n target_path = File.expand_path(\"../../fixtures/#{name}\", __FILE__)\n \n puts \"Accessing prepared DB test snapshot #{id} from S3.\"\n \n require 's3'\n service = S3::Service.new(:access_key_id => access_key_id, :secret_access_key => secret_access_key)\n bucket = service.buckets.find(\"cocoapods-org-testing-dumps\")\n \n # Due to a bug in the s3 gem we are searching for the object via iterating.\n bucket.objects.each do |obj|\n if obj.key == name\n puts \"Downloading prepared DB test snapshot #{id} from S3.\"\n File.open(target_path, 'w') do |file|\n file.write(obj.content)\n end\n break\n end\n end\n \n puts \"Prepared DB test snapshot #{id} downloaded to #{target_path}\"\n end", "def archive\n files.each do |path|\n path_obj = Pathname.new(path)\n path_name = path_obj.dirname.to_s\n compress = Kellerkind::Compress.new(:target_path => out,\n :source_path => path,\n :tarball_prefix => path_obj.basename.to_s)\n compress.find_at_source_path = true\n if File.exists?(path)\n Kellerkind::Process.verbose(:start_compressing)\n compress.gzip\n if File.exists?(\"#{path_name}/#{compress.tarball_name}\")\n Kellerkind::Process.verbose(:finished_compressing)\n FileUtils.mv(\"#{path_name}/#{compress.tarball_name}\",\n \"#{out}/#{compress.tarball_name}\")\n FileUtils.rm_rf(path)\n FileUtils.touch(path) if self.recreate\n end\n end\n end\n end", "def compress_files_and_copy\n timestamp = Time.now.strftime(\"%Y%m%d-%H%M%S\") + '_'\n tar_file = @backup_folder + timestamp + \"syc-backup.tar.gz\" \n tar_command = \"tar cfz #{tar_file} #{@files.join(\" \")}\"\n\n stdout, stderr, status = Open3.capture3(tar_command)\n\n unless status.exitstatus == 0\n STDERR.puts \"There was a problem executing command\"\n STDERR.puts tar_command\n STDERR.puts stderr\n exit status.exitstatus\n end\n\n tar_file\n end", "def backup_folder(folder_id, path)\n backup_folder_rec folder_id, path\n puts 'Progress:'\n @threads.each_with_index do |thread, i| # <- Finish all jobs\n thread.join\n print '#' if i % @threads.size / 10 == 1\n end\n end", "def transfer!\n package.filenames.each do |filename|\n src = File.join(Config.tmp_path, filename)\n dest = File.join('/', remote_path, filename)\n Logger.info \"Storing '#{ dest }'...\"\n\n File.open(src, 'r') do |file|\n @uploader = ChunkedUploader.new(client, file)\n with_retries do\n @uploader.upload(1024**2 * chunk_size)\n end\n end\n\n with_retries do\n @uploader.finish(dest)\n end\n end\n rescue => err\n raise Error.wrap(err, \"Upload Failed!\")\n end", "def setup_backup_directory(folder_prefix)\n tmp_path = \"tmp\"\n backups_folder = \"backups\"\n backups_path = \"#{tmp_path}/#{backups_folder}\"\n dir_path = \"#{backups_path}/#{Time.now.strftime(\"#{folder_prefix}-%F-%H%M%S\")}\"\n\n Dir.mkdir(tmp_path) unless File::directory?(tmp_path)\n Dir.mkdir(backups_path) unless File::directory?(backups_path)\n Dir.mkdir(dir_path) unless File::directory?(dir_path)\n\n dir_path\n end", "def generate_drupal_backup\n @process_runner.execute!(\"cd #{@working_directory} && docker-compose run --rm drupal_data_generator\")\n end", "def export_all\n File.foreach(File.join(@export_dir, @pidlist)) do |line|\n begin\n short_pid = strip_pid(line.strip)\n puts \"Exporting datastreams for #{short_pid}.\" if @verbose\n bag = BagIt::Bag.new(File.join(@bags_dir, short_pid))\n item = GenericAsset.find(line.strip)\n rem_graph = remediate(@remediation, item.descMetadata.graph)\n export_profile(item, rem_graph, short_pid)\n export_content(item, short_pid)\n export_metadata(item, rem_graph, short_pid)\n export_workflow_metadata_profile(item, short_pid)\n bag_finisher(bag)\n rescue StandardError => e\n message = \"Error #{e.message}:#{e.backtrace.join(\"\\n\")}\"\n puts message if @verbose\n @logger.error(message)\n end\n end\n end", "def write_tgz\n # Grab the contents of the gzipped tarball for reading\n contents = gzipped_tarball\n\n # Write the .tar.gz into the staging directory\n File.open(\"#{staging_dir}/#{package_name}\", \"wb\") do |tgz|\n while chunk = contents.read(1024)\n tgz.write(chunk)\n end\n end\n\n # Copy the .tar.gz into the package directory\n FileSyncer.glob(\"#{staging_dir}/*.tar.gz\").each do |tgz|\n copy_file(tgz, Config.package_dir)\n end\n end", "def backup\n FileUtils.cp options[:file], backup_file if File.file? options[:file]\n end", "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 perform!\n super\n\n pipeline = Pipeline.new\n dump_ext = 'sql'\n\n pipeline << mysqldump\n\n model.compressor.compress_with do |command, ext|\n pipeline << command\n dump_ext << ext\n end if model.compressor\n\n pipeline << \"#{ utility(:cat) } > \" +\n \"'#{ File.join(dump_path, dump_filename) }.#{ dump_ext }'\"\n\n pipeline.run\n if pipeline.success?\n log!(:finished)\n else\n raise Error, \"Dump Failed!\\n\" + pipeline.error_messages\n end\n end", "def backup(id)\n server = @connection.servers.get(id)\n ssh(server,'~/backup.sh')\n server.scp_download('backup/current.tar.gz','backup.tar.gz')\n end", "def dump_progress(done, dumpfile)\n dump = Marshal.dump(done)\n open(dumpfile, 'wb') do |file|\n gzip = Zlib::GzipWriter.new(file)\n gzip.write(dump)\n gzip.close\n end\nend", "def build_archive # @location == LOCATION(group, user, mtime, experiment_id)\n restore_dir = Dir.pwd\n @mount_dir ||= ::ArchiveRoot\n FileUtils.mkdir_p(File.join(@mount_dir, @location))\n Dir.chdir(File.join(@mount_dir, @location))\n # cp the config file from the higher level down\n @@build_directories.each do |dir|\n FileUtils.mkdir dir unless Dir.exist?(dir)\n end\n Dir.chdir(restore_dir)\n # Find a config file and move it down to this directory... right?\n end", "def dump(path)\n infobase.designer do\n dumpDBCfg path\n end.run.wait.result.verify!\n path\n end", "def save_stage_one\n\tunless File.exists? @builddir + \"/stage01.tar.xz\"\n\t\t### Dir.chdir(@builddir + \"/stage01\")\n\t\t# system \"tar -C \" + @builddir + \"/stage01 -cvjf \" + @builddir + \"/stage01/chroot.tbz chroot\"\n\t\t# system \"mysqldump --add-drop-table --password='\" + @dbpass + \"' -u '\" + @dbuser + \"' '\" + @dbname + \"' > chroot.sql \"\n\t\t# system \"bzip2 -c \" + @builddir + \"/lesslinux.sqlite > \" + @builddir + \"/stage01/chroot.sqlite.bz2\"\n\t\tsystem \"tar -C \" + @builddir + \"/ -cvJf \" + @builddir + \"/stage01.tar.xz stage01/chroot lesslinux.sqlite\"\n\tend\nend", "def backup!(chroot=nil)\n self.root = chroot if chroot\n return unless stores.any?{ |dir| File.exist?(dir) }\n FileUtils.mkdir_p(cache) unless File.exist?(cache)\n stores.each do |store|\n temp, $DEBUG = $DEBUG, false\n FileUtils.cp_r(store, cache) if File.exist?(store)\n $DEBUG = temp\n end\n return cache\n end", "def compressFiles\n Dir.chdir(\"#{@outputDir}/RDPsummary\")\n #system(\"tar -zcf #{@sampleSetName1}.tar.gz * --exclude=*.log --exclude=*.sra --exclude=*.sff --exclude=*.local.metadata\")\n system(\"tar czf class.result.tar.gz class\")\n system(\"tar czf domain.result.tar.gz domain\")\n system(\"tar czf family.result.tar.gz family\")\n system(\"tar czf genus.result.tar.gz genus\")\n system(\"tar czf order.result.tar.gz order\")\n system(\"tar czf phyla.result.tar.gz phyla\")\n system(\"tar czf species.result.tar.gz species\")\n system(\"tar czf pdf.result.tar.gz 'find . -name `*.pdf`'\")\n Dir.chdir(@scratch)\n end", "def save\n path = UPLOADS_DIR.join(archive.original_filename)\n File.open(path, 'w') do |file| \n file.write(archive.read)\n end\n if backend = Instance.backend\n backend.deploy path\n end\n end", "def dump_database(app_name, instance_name)\n app_config = RailsPwnerer::Config[app_name, instance_name]\n db_name, db_user, db_pass = app_config[:db_name], app_config[:db_user], app_config[:db_pass]\n\n pwnerer_user = app_config[:pwnerer_user]\n pwnerer_uid = uid_for_username(pwnerer_user)\n pwnerer_gid = gid_for_username(pwnerer_user)\n \n timestamp = Time.now.strftime '%Y%m%d%H%M%S'\n dump_file = \"db/#{app_name}.#{instance_name}_#{timestamp}.sql\"\n Dir.chdir app_config[:backup_path] do\n system(\"mysqldump --add-drop-database --add-drop-table\" +\n \" --skip-extended-insert --single-transaction\" +\n \" -u#{db_user} -p#{db_pass} #{db_name} > #{dump_file}\")\n # lockdown the file\n File.chmod(0400, dump_file)\n File.chown(pwnerer_uid, pwnerer_gid, dump_file)\n end\n end", "def storeDirectory(path)\n history_path = File.join(Dir.pwd, @configuration[:configuration][:history_folder])\n backup_folder = @configuration[:configuration][:backup_folder]\n Dir.foreach(history_path) do |item|\n file_name = File.join(history_path, item)\n next if item == '.' || item == '..' || File.directory?(file_name)\n data = File.read(file_name)\n # TODO: Add sperator logic\n # TODO: comment while call it twice\n storeOutputData(data, path, backup_folder)\n # Clear history\n FileUtils.rm(file_name)\n # TODO: logging\n end\n end", "def genDataZip(dir='generated', file_name='OdinSampleDataSet.zip', zip_dir='generated')\n # make sure the target file does not already exist\n # if it does, rename it to a tmp file\n runShellCommand(\"zip -j #{dir}/#{file_name} #{zip_dir}/*.xml #{zip_dir}/*.ctl\")\nend", "def dump_apps_dir\n now = Time.now\n pid = fork do\n # YYYYMMDD_HHMM\n tsig = \"%04d%02d%02d_%02d%02d\" % [now.year, now.month, now.day, now.hour, now.min]\n summary_file = File.join(@apps_dump_dir, \"apps.du.#{tsig}.summary\")\n details_file = File.join(@apps_dump_dir, \"apps.du.#{tsig}.details\")\n exec(\"du -skh #{@apps_dir}/* > #{summary_file} 2>&1; du -h --max-depth 6 #{@apps_dir} > #{details_file}\")\n end\n Process.detach(pid)\n pid\n end", "def restore_from_disk\n log(\"Loading Data in...\")\n\n if File.directory?('buckets') then\n entries = Dir.entries(\"buckets\").collect do |f| f unless f.match(\"bucket\").nil? end.compact\n\n entries.each do |e|\n File.open(\"buckets/\" + e) do |f|\n @contents = Marshal.load(f)\n end\n\n buckets[\"#{e.gsub(\".bucket\", \"\")}\"] = @contents\n\n end\n\n end\n\n end", "def restore_files(paths, snapshot, all)\n #\n # Basic args\n #\n args = %w(rsync --archive --numeric-ids --inplace --relative --compress)\n\n #\n # Add on the I/O-timeout\n #\n args += ['--timeout', @io_timeout.to_s ] unless ( @io_timeout.nil? )\n args += ['--rsh', \"ssh -o BatchMode=yes -x -a -i #{@ssh_key} -l #{@destination_user}\"]\n args << '--verbose' if @verbose\n args += ['--rsync-path', \"byteback-restore --fake-super --snapshot #{snapshot}\" + (all ? \" --all\" : \"\")]\n\n #\n # To add extra rsync flags, a file can be used. This can have flags all on one line, or one per line.\n #\n if File.exists?(\"/etc/byteback/rsync_flags\")\n args += File.readlines(\"/etc/byteback/rsync_flags\").map(&:chomp)\n end\n\n dst = \"#{@destination_user}@#{@destination_host}:\"\n\n paths.each do |path|\n path = Byteback::Restore.encode_args(path).first\n args << File.join(dst,path)\n dst = \":\"\n end\n\n args << \".\"\n puts args.join(\" \") if @verbose\n system(*args)\nend", "def delete_uncompressed_backups\n end", "def backup(frequency,dir,t,condition)\n frequency.each do |vm|\n break if (Time.now.hour >= 5) && (Time.now.hour <= 20)\n mkdir = system(\"mkdir #{BACKUP_DIR}#{dir}#{vm} > /dev/null 2>&1\")\n %x[/bin/rm #{BACKUP_DIR}#{dir}#{vm}/*.log] if (File.exist?(\"#{BACKUP_DIR}#{dir}#{vm}/#{frequency.last}-#{t.month}-#{t.year}.log\"))#{condition}\n next if File.exist?(\"#{BACKUP_DIR}#{dir}#{vm}/#{vm}-#{t.month}-#{t.year}.log\")\n @logger = Logger.new(\"#{BACKUP_DIR}#{dir}#{vm}/#{vm}-#{t.month}-#{t.year}.log\", LOG_AGE)\n @logger.info(\"Started running\")\n case true\n when DOE_POOL.include?(vm)\n server = ''\n pass = \"\"\n when DOMAIN_POOL.include?(vm)\n server = ''\n pass = \"\"\n when SAMBP_XEN.include?(vm)\n server = ''\n pass = \"\"\n when SUNFIRE_XEN.include?(vm)\n server = ''\n pass = \"\"\n end\n result = []\n run_time = Benchmark.realtime do\n begin\n @logger.info(\"Suspend start\")\n result << system(\"xe vm-suspend vm=#{vm} -s #{server} -u root -pw #{pass} >> #{BACKUP_DIR}#{dir}#{vm}/#{vm}-#{t.month}-#{t.year}.log 2>&1\") \n @logger.info(\"Backup start\")\n result << system(\"xe vm-export vm=#{vm} filename=#{BACKUP_DIR}#{dir}#{vm}/#{vm}-$(date +%d-%m-%Y).backup -s #{server} -u root -pw #{pass} >> #{BACKUP_DIR}#{dir}#{vm}/#{vm}-#{t.month}-#{t.year}.log 2>&1\")\n @logger.info(\"Resume start\")\n result << system(\"xe vm-resume vm=#{vm} -s #{server} -u root -pw #{pass} >> #{BACKUP_DIR}#{dir}#{vm}/#{vm}-#{t.month}-#{t.year}.log 2>&1\")\n end\n end\n @logger.info(\"Removing old backup\")\n %x[rm #{BACKUP_DIR}#{dir}#{vm}/`ls -t1r #{BACKUP_DIR}#{dir}#{vm} | head -n 1`] if (result[1] == true) && (mkdir != true)\n @logger.info(\"Finished running - Backup run time: #{run_time.to_s[0, 5]}\")\n send_email_with_log(vm,t,dir) if result.include?(false) \n end\nend", "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 backup\n self.keep_backup && !File.exists?( backup_path ) && FileUtils.cp( self.resource.path, backup_path )\n end", "def dump(database, program_name, file, dump_all: false)\n file.write(\"SET foreign_key_checks = 0;\\n\")\n\n program = Program.find_by_name(program_name)\n\n RdsService::MODELS.each do |model|\n offset = dump_all ? RdsService::TIME_EPOCH : database_offset(model, database)\n records = recent_records(model, offset, database)\n\n last_record_container = OpenStruct.new\n\n # Chunk retrieved records while converting them to JSON at the same time.\n record_chunks = chunk_records(records, RdsService::RECORDS_BATCH_SIZE) do |record|\n last_record_container.record = record\n\n record = serialize_record(record, program)\n record.delete('record_type')\n record\n end\n\n # Convert the chunks to SQL INSERT statements and write them to file\n record_chunks.each do |chunk|\n record_fields = chunk.first.keys\n\n sql_values = chunk.map do |record|\n values = record_fields.map { |field| sql_quote(record[field]) }\n\n \"(#{values.join(', ')})\"\n end\n\n sql_statement = <<~SQL\n REPLACE INTO #{model.table_name} (#{record_fields.join(', ')})\n VALUES #{sql_values.join(', ')};\n SQL\n\n file.write(sql_statement)\n end\n\n next unless last_record_container.record\n\n save_database_offset(model, record_update_time(last_record_container.record), database)\n end\n\n file.write(\"SET foreign_key_checks = 1;\\n\")\nend", "def restore_files_to(to_db, jobs)\n [\n restore_pg_dump_file(to_db, %w(pre-data data), jobs),\n *restore_table_copy_files(to_db),\n restore_pg_dump_file(to_db, %w(post-data), jobs)\n ]\n end" ]
[ "0.63595617", "0.63573366", "0.63459903", "0.6285311", "0.62774307", "0.62644607", "0.6242722", "0.6140153", "0.6122677", "0.60619456", "0.6017124", "0.59770685", "0.5974368", "0.59730303", "0.5958908", "0.5929987", "0.58651674", "0.5850751", "0.5782572", "0.5768702", "0.57572985", "0.5755353", "0.57175565", "0.56977326", "0.5680482", "0.5677371", "0.56756705", "0.5658534", "0.5600227", "0.55920213", "0.5585406", "0.5572623", "0.5546739", "0.551227", "0.55003047", "0.54826176", "0.54683036", "0.54663616", "0.5460808", "0.54598665", "0.54520166", "0.5451002", "0.5429611", "0.5410417", "0.53738993", "0.5367267", "0.5355195", "0.5346151", "0.5343265", "0.53358376", "0.5333098", "0.5312163", "0.5309061", "0.5302208", "0.52809614", "0.52806693", "0.52801406", "0.5274857", "0.52699685", "0.52679324", "0.5266414", "0.52610916", "0.52570486", "0.52505016", "0.5242344", "0.52418464", "0.5240141", "0.52395225", "0.52267104", "0.5222249", "0.5221342", "0.52202696", "0.52125627", "0.5198088", "0.5197883", "0.5197798", "0.5188004", "0.51743793", "0.5174285", "0.51716167", "0.5150419", "0.5143915", "0.51425976", "0.51332015", "0.51264185", "0.51262087", "0.5118116", "0.51137406", "0.51129496", "0.51106054", "0.5102171", "0.50944006", "0.5090996", "0.50819886", "0.50802773", "0.5079735", "0.5077319", "0.50768197", "0.50745803", "0.5073402" ]
0.5443456
42
associate messages into a thread. assumes the messages are only between two people, and there cannot be any variation in from/to address names (i ignore the numbers, since sometimes they change slightly)
def threadify(messages) last_id = {} messages.map do |message| last_id[message.from[0]] = message.message_id message.in_reply_to = last_id[message.to[0]] message end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_message(other_user, room_id, content)\n from_messages.create!(to_id: other_user.id, room_id: room_id, content: content)\n end", "def thread_message! message\n startt = Time.now\n\n ## build the path of msgids from leaf to ancestor\n ids = [message.safe_msgid] + message.safe_refs.reverse\n seen = {}\n ids = ids.map { |x| seen[x] = true && x unless seen[x] }.compact\n\n ## write parent/child relationships\n if ids.size > 1\n ids[0 .. -2].zip(ids[1 .. -1]).each do |id, parent|\n pkey = \"pmsgid/#{id}\"\n next if contains_key? pkey # don't overwrite--potential for mischief?\n write_string pkey, parent\n\n ckey = \"cmsgids/#{parent}\"\n v = load_set(ckey)\n v << id\n write_set ckey, v\n end\n end\n\n ## find the root of the whole thread\n root = ids.first\n seen = {} # guard against loops\n while(id = load_string(\"pmsgid/#{root}\"))\n #puts \"parent of #{root} is #{id}\"\n break if seen[id]; seen[id] = true\n root = id\n end\n\n ## get the thread structure in terms of docids docs we've actually seen.\n ## generate psuedo-docids to join trees with parents we haven't seen yet\n ## when necessary.\n thread_structure = build_thread_structure_from root\n #puts \"thread structure is #{thread_structure.inspect}\"\n threadid = thread_structure.first # might actually be a psuedo-docid\n #puts \"root msgid is #{root.inspect}, root docid is #{threadid}\"\n\n ## if any of these docs are roots of old threads, delete those old threads,\n ## but keep track of all the labels we've seen\n old_labels = thread_structure.flatten.inject(Set.new) do |labels, id|\n tkey = \"thread/#{id}\"\n labels + if contains_key? tkey\n lkey = \"tlabels/#{id}\"\n v = load_set lkey\n @store.delete lkey\n @store.delete tkey\n v\n else\n Set.new\n end\n end\n\n ## write the thread ids for all documents. we need this at search time to\n ## do the message->thread mapping.\n thread_structure.flatten.each do |id|\n next if id < 0 # pseudo root\n write_int \"threadid/#{id}\", threadid\n end\n\n @thread_time += (Time.now - startt)\n [threadid, thread_structure, old_labels]\n end", "def send_linked_in_message(sendto, subject, message)\n send_message({:sendto => sendto, :subject => subject, :message => message})\n end", "def thread(messages)\n # create id_table\n @id_table = create_id_table(messages)\n\n # create root hierachy siblings out of containers with zero children\n # TODO: would probably be nicer to use a list instead of empty root node\n root = Container.new()\n @id_table.each_pair { |message_id, container| root.add_child(container) if container.parent.nil? }\n \n # discard id_table\n @id_table = nil\n\n # prune dummy containers\n prune_empty_containers(root)\n\n # group again this time use Subject only\n #subject_table = group_root_set_by_subject(root)\n\n root\n end", "def create_sent_messages \n target_members = self.members +\n (Group.members_in_multiple_groups(to_groups_array) & # an array of users\n Member.those_in_country)\n @contact_info = target_members.map {|m| {:member => m, :phone => m.primary_phone, :email => m.primary_email}}\n # Remove members from @contact_info if they do not have the needed contact info (phone or email)\n # We may want to keep track of those people since they _should_ get the message but we don't have\n # the necessary info to get it to them by the specified routes (phone or email).\n case\n when self.send_sms && !self.send_email\n @contact_info.delete_if {|c| c[:phone].nil?}\n when !self.send_sms && self.send_email\n @contact_info.delete_if {|c| c[:email].nil?}\n when self.send_sms && self.send_email\n @contact_info.delete_if {|c| c[:email].nil? && c[:phone].nil?}\n end\n self.members = @contact_info.map {|c| c[:member]}\n end", "def send_message(to_user, content)\n from_messages.create!(to_user_id: to_user.id, content: content)\n end", "def process_mass_join(message)\n channel = message.channel\n /:(?<user_list>.+)/ =~ message.payload\n user_list.split.each do |user|\n channel.users[user] = User.new user unless channel.users.key? user\n end\n end", "def forward_message_id=(*args); end", "def send_linked_in_message!(sendto, subject, message)\n send_message!({:sendto => sendto, :subject => subject, :message => message})\n end", "def process_join(message)\n channel = message.channel\n /:(?<user>\\w+)/ =~ message.raw\n channel.users[user] = User.new user unless channel.users.key? user\n end", "def create\n\n @message = current_user.messages.build\n @message.subject = params[:message][:subject]\n @message.body = params[:message][:body]\n# @message.to User.find_by_username(params[:message][:to])\n @message.to User.find(:all, :conditions=>[\"username IN (\\\"#{params[:message][:to].split(',').join(\"\\\",\\\"\")}\\\")\" ]) unless params[:message][:to].nil?\n\n\n respond_to do |format|\n if @message.save\n @message.deliver\n\n flash[:notice] = 'Message was successfully created.'\n format.html { redirect_to(@message) }\n format.xml { render :xml => @message, :status => :created, :location => @message }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @message.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_thread_for_replies\n self.thread = self.commentable.thread if self.reply_comment?\n end", "def record_message(thread, timestamp)\n message = {\n :thread => thread,\n :timestamp => timestamp\n }\n @messages << message\n message\n end", "def add_msg(msg, sender)\n\n @chatters.each do |chatter_id, chatter|\n if chatter_id != sender.id\n chatter.client_socket.puts \"#{sender.id} said: #{msg}\"\n end\n end\n\n end", "def reply_to_thread(username, thread_id, params = {})\n $LOG.i \"running \" + __method__.to_s\n @client.post '/mc/v1/threads/' + username + '/' + thread_id, params\n end", "def new_message(message)\n @message = message\n mail_ids = @message.batch.students.pluck(:email)*\",\"\n mail to: \"#{mail_ids}\", subject: \"A message from your trainer\"\n end", "def create\n @message = Message.new(message_param)\n @message_thread = MessageThread.find(@message.message_thread_id)\n\n @message.receiver = current_user.equal_user?(@message_thread.started_user) ? @message_thread.to_user : @message_thread.started_user\n @message.sender = current_user\n @message.is_sender_read = true\n @message.is_receiver_read = false\n\n if @message.save\n flash[:success] = \"Message has been sent!\"\n redirect_to @message_thread\n end\n end", "def im(*messages)\n @@jabbers[@from].deliver @rcpt_to || @headers['To'], messages.join\n end", "def thread_messages\n #thread.messages + [thread]\n Message.where([\"id = ? or parent_id = ?\", thread_id, thread_id])\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 sendMessages\n account_sid = 'ACcadef504f050d32a61aa43b3f3d939da'\n auth_token = ENV['TWILIO_AUTH']\n client = Twilio::REST::Client.new account_sid, auth_token\n\n from = '+14159664302'\n\n participants = {}\n\n self.persons.each do |person|\n participants[\"+1#{person.phone_number}\"] = {name: person.name, password: person.password}\n end\n\n # Example:\n # friends = {\n # '+19255863672' => 'Edgar Barajas'\n # }\n\n participants.each do |key, value|\n client.messages.create(\n from: from,\n to: key,\n body: \"Hey #{value[:name]}, welcome to Secret Santa!\\nVisit http://secret-santa-plus.herokuapp.com/family/#{self.id} to reveal the person you'll be buying a gift for this year, and to fill out your gift suggestions form!\\n\\nYour password is: #{value[:password]}\\n\\nHappy Holidays! :)\"\n )\n end\n end", "def message_params\n params.require(:message).permit(:from_id, :to_id, :text, :readed)\n end", "def new_message_event(message_hash)\n\t\tputs \"Processing new message...\"\n\t\tmessage_hash[:to].each do |rcpt|\n\t\t\tto = strip_brackets(rcpt)\n\t\t\tfrom = strip_brackets(message_hash[:from])\n\t\t\tsubj = message_hash[:subject]\n\t\t\tmsg = build_message(from, to, subj, message_hash[:data])\n\t\t\tdomain = to.split('@')[1]\n\t\t\tmx = get_MX_server(domain)\n\t\t\tNet::SMTP.start(mx) do |smtp|\n if $debug then puts \"Sending message to \" + to end\n\t\t\t\tsmtp.send_message(msg, from, to)\n\t\t\tend\n\t\tend\n\tend", "def send_im(fromnick,tonick,message)\n return ret_fail('can not send IM to yourself') if fromnick==tonick #self-explainatory\n\n usr = User.first(:nickname=>fromnick) #find own record\n return ret_fail('own user not found') if usr == nil #must be error\n\n tousr = User.first(:nickname=>tonick)\n return ret_fail('addressee not found') if tousr == nil #must be error\n\n contact = usr.contacts.first(:userid => tousr.id)\n return ret_fail('not in list') if contact == nil #that nick is not in contact list!\n\n\n if message['type'] != 'auth_request' #Normal message\n return ret_fail('not authorized') if contact.authgiven != 't' #failure: not authorized!\n else #its an authorization request!\n return ret_fail('already given') if contact.authgiven == 't' #already has permission!\n return ret_fail('already sent') if contact.authgiven == 'p' #already sent a request!\n\n #ok... its a valid auth request... so set state to 'p' and update db record\n contact.authgiven = 'p' #awaiting to be answered\n contact.save\n end\n\n #append message to addressees message queue, update database record\n msg = tousr.messages.new\n msg.data = JSON.generate({'from'=>fromnick, 'message'=>message})\n msg.save\n\n return ret_success\nend", "def followup_send\n @id = params[:id] # Id of original message\n original_message = Message.find @id\n fu_message = Message.create(params[:record].merge(:following_up => @id)) # a new message object to send the follow up\n fu_message.members = original_message.members_not_responding\n fu_message.create_sent_messages # Sigh, we need this because contact list is generated upon _save_, and unless we\n # call create_sent_messages again (or use another tactic), the specified members\n # will not be included\n#puts \"**** fu_message.members =#{fu_message.members[0].last_name}, #{fu_message.members[0].primary_email}\"\n deliver_message(fu_message)\n flash[:notice] = 'Follow up message sent'\n redirect_to messages_path\n end", "def receive_email\n \n \n #if one of the to addresses matches us, use that one. todo - correctly handle mulitple emails, or correctly fail\n if params[:to].match(/group\\+(\\d+)@/) && @group = Group.find($1)\n from = params[:from]\n body = params[:plain].gsub(/^On .* wrote:$\\s*(^>.*$\\s*)+/,'') #strip out replies and whatnot\n\n if @sender = @group.students.find_by_email(from)\n @group.send_message(@sender.name+\": \"+body,@sender,[@group.user])\n elsif @group.user.email==from\n @group.send_message(@group.user.display_name+\": \"+body,@group.user)\n end\n end\n render :text => 'success', :status => 200\n end", "def set_message_thread\n @message_thread = @current_shop.message_threads.find(params[:id])\n end", "def new_message(from, to, subject, message)\r\n rec = to.clone\r\n subs = to.concat([from])\r\n conv = Conversation.create(subs)\r\n time = Time.new\r\n message = Message.create(from, rec, subject, time, message, nil)\r\n\r\n subs.each{ |s| self.message_boxes[s.to_s].add_conversation(conv)}\r\n conv.add_message(message)\r\n\r\n self.conversations.store(conv.conversation_id.to_s, conv)\r\n conv\r\n end", "def create\n #@message = Message.new(params[:message])\n @to_names = params[:message][:to_name].gsub(/,\\s+/,',')\t\t#sample - \"Saadah,Sulijah\"\n \t@to_name_A = @to_names.split(\",\") \t\t\t\t\t\t\t\t\t\t\t#will become - [\"Saadah\",\"Sulijah\"]\n \t@to_id_A = []\n \t@to_name_A.each do |to_name|\n \t\taa = Staff.find_by_name(to_name).id\t\t\t\t\t\t\t\t\t\t#result(sample)- [\"1\",\"7\"]\n \t\t@to_id_A << aa.to_i\n \tend\n\n \t@message = Message.new\n \t@message.staff_ids = []\n \t#@message.staff_ids = [\"1\",\"7\"] \t\t\t\t\t\t\t\t\t\t\t#the BEST-correct format for this association\n \t@message.staff_ids = @to_id_A \n \t@message.message = params[:message][:message]\n\n respond_to do |format|\n if @message.save\n flash[:notice] = t('messages.title')+\" \"+t('created')\n format.html { redirect_to(@message) }\n format.xml { render :xml => @message, :status => :created, :location => @message }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @message.errors, :status => :unprocessable_entity }\n end\n end\n end", "def test_create_reply_to_reply_to_standalone_message_about_kevins_review_59\r\n reply_to = messages(:tim_reply_to__andy_to_kevin_about_kevins_review_59)\r\n about = Factory :review\r\n about.user = @kevin\r\n send_message(@matt, @tim, reply_to, about)\r\n end", "def add_to_message_queue(msg_type, socket_send_message)\n #message = [\"#{msg_type}|#{socket_send_message}|\\n\"] # Cria o array de mensagens\n # Verifica todos os objetos em comum e partilha entre os jogadores\n # [:uuid, :x, :y, :direction].each do |instance|\n # # Pega cada instancia do objeto e adiciona na mensagem \n # end\n @messages.push << \"#{msg_type}|#{socket_send_message}\"\n p \"CLIENT: Added to queue: #{@messages}\"\n end", "def message_to_at_user(at_user)\n # return if self.user.id == at_user.id\n message = self.messages.build(\n is_read: false,\n user_id: at_user.id,\n from_user_id: self.user.id,\n body: \"#{self.user.uid} @了你: #{self.content}\"\n )\n message.save\n end", "def new_record_notification(message_info, contacts, sender)\n @message_info = message_info\n @sender = sender.email\n contacts.each do |contact|\n @reciever = contact.email\n mail(to: @reciever, subject: @message_info.subject) unless @reciever == @sender\n end\n end", "def build_and_send_pastepin(messages)\n # XXX: start a thread with a new message scope (ugly)\n threaded {\n # The message that caused all this!\n Thread.current[:ricer_message] = messages.first\n Thread.current[:ricer_user] = sender\n # Inform_user\n sender.localize!.send_message(t(:msg_autopasting, :count => messages.length))\n # Paste it!\n get_plugin('Paste/Paste').\n send_pastebin(\n autopaste_title(messages),\n autopaste_message(messages),\n messages.length,\n 'text',\n 'ricer4.plugins.paste.auto_paste.msg_autopasted',\n )\n }\n end", "def test_create_reply_to_reply_to_reply_to_standalone_message_about_nothing\r\n about = nil\r\n reply_to = messages(:matt_reply_to__kevin_reply_to__andy_to_kevin_about_nothing)\r\n send_message(@tim, @matt, reply_to, about)\r\n end", "def new_message_admin(from_user, to_user, message)\n @from_user = from_user\n @to_user = to_user\n @message = message\n\n mail(:subject => \"#{@to_user.full_name} has a new message!\")\n end", "def message_me(msg)\n @msg = msg\n mail subject: \"From: #{@msg.name} : #{@msg.email} says : #{@msg.subject}\", body: \"From: #{@msg.name} @ #{@msg.email} | Subject: #{@msg.subject} | Body of email : #{@msg.content}\"\n #@msg.content << \"From : #{@msg.name} :: Subject : #{@msg.subject}\" # previous one\n end", "def send_to_multiple(receiver_ids, pars)\n @receivers = receiver_ids.reject(&:blank?).map { |id| User.find(id) }\n @messages = @receivers.map do |user|\n Message.create sender: current_user,\n receiver: user,\n content: pars[:content]\n end\n flash[:info] = \"Your message has been sent\"\n end", "def add_message_send message\n @drb_messages_sent += 1\n\n msg = message.message\n argc = message.argument_count\n\n source = message.source\n destination = message.destination\n\n @last_peer_send[source][destination] = message.timestamp\n @last_sent_message[source][destination] = msg, argc, message.allocations\n end", "def create\n params[:message][:to] = User.find_by_fullname(params[:message][:to]).id\n @message = Message.new(params[:message])\n @message.from = current_user.id\n @message.seen = false\n if @message.save\n flash[:notice] = \"Message sent\"\n else\n flash[:notice] = \"Message not sent\"\n end\n redirect_to(:action => 'index')\n end", "def contact_to!(subject)\n contact_to(subject) ||\n sent_contacts.create!(:receiver => Actor.normalize(subject))\n end", "def load_thread thread_id\n results = perform :thread, :args => [thread_id]\n results.map { |m, depth| [MessageSummary.new(m), depth] }\n end", "def reply\n message = self.class.new(:subject => subject, :body => body)\n message.sender = sender\n message.to(to)\n message\n end", "def add_to_message_queue(msg_type, socket_send_message)\n #message = [msg_type] # Cria o array de mensagens\n # Verifica todos os objetos em comum e partilha entre os jogadores\n # [:uuid, :x, :y, :direction].each do |instance|\n # # Pega cada instancia do objeto e adiciona na mensagem \n # end\n @messages.push << \"#{msg_type}|#{socket_send_message}\"\n p \" Messages Push --> #{msg_type}|#{socket_send_message}\"\n end", "def mention(conversation_id, user_id, author_id)\n @conversation = Conversation.find(conversation_id)\n @user = User.find(user_id)\n @author = User.find(author_id)\n mail(:to => @user.email, :subject => _('%s mentioned you in %s on %s.') % [\n @author.full_name, @conversation.title, Founden::Config.app_name\n ])\n end", "def set_members\n members_ids = params[:message][:recipient_ids].reject(&:empty?)\n members_ids.each do |members_id|\n @message = current_user.messages.create(:conversation_id => members_id , :body => params[:message][:body])\n\n #send notification\n reciver = User.find(members_id)\n if reciver.notification_setting.try(:new_update)\n Notification.create(recepient_id: members_id, user: current_user, body: \"#{current_user.screen_name } has send a message #{@message.topic} \", notificable: @message, :accept => false)\n end\n end\n end", "def build_thread\n @private_messages = PrivateMessage.find_conversation(current_user,params[:id])\n end", "def broadcast_msg_from( user, msg )\n\t\tuserDesc = user.to_s\n\n\t\t@users.each do |cl|\n\t\t\tnext if cl == user\n\t\t\tcl.add_output( \"#{userDesc}>> #{msg}\" )\n\t\tend\n\tend", "def send_to_followers(from)\n\t\ttopic = self.commentable\n\t\ttopic.users.each do |user|\n\t\t\tdeliver(\"#{from.name} posted a comment on #{topic.name}\", user, from) unless user.eql? from\n\t\tend\n\tend", "def send_to_friend(params, template, record = nil)\n ActivityScore.boost_score(record, :email) if (record.class == Story)\n setup_email(:recipients => params[:to],\n :from => \"\\\"#{params[:from_name]}\\\"<#{params[:from]}>\",\n :from_name => params[:from_name],\n :body => render_message(\"mailer/send_to_friend/#{template}\", :record => record, :recipient => params[:to], :page =>params[:page], :body => params[:body]))\n @subject = \"#{params[:from_name]} sent you a link to #{APP_NAME}\"\n end", "def send!(to_array, subject)\n begin\n conversation = Conversation.new\n conversation.subject = subject\n \n conversation.messages << self\n \n self.save!\n conversation.save!\n \n senderconversation = Userconversation.new\n senderconversation.user = self.sender\n senderconversation.readed = true\n senderconversation.conversation = conversation\n senderconversation.hide = false\n senderconversation.save!\n \n to_array.each do |to|\n receiverconversation = Userconversation.new\n receiverconversation.user = to\n receiverconversation.readed = false\n receiverconversation.hide = false\n receiverconversation.conversation = conversation\n receiverconversation.save!\n end\n return true\n rescue\n return false\n end\n end", "def test_create_reply_to_up_in_chain_reply_to_standalone_message_about_nothing\r\n about = nil\r\n reply_to = messages(:kevin_reply_to__andy_to_kevin_about_nothing)\r\n send_message(@tim, @kevin, reply_to, about)\r\n end", "def test_create_reply_to_standalone_message_about_kevins_review_59\r\n reply_to = messages(:andy_to_kevin_about_kevins_review_59)\r\n about = Factory :review\r\n about.user = @kevin\r\n send_message(@tim, @andy, reply_to, about)\r\n end", "def write_message\n\t\t# sender will be the current user\n\t\t@user = current_user\n\t\t@message = Message.new\n\t\t@message.sender = current_user\n\t\t@unread_messages = Message.find(:all, :conditions => {:receiver_id => current_user.id, :unread => true})\n\t\t# if reciever has been specified, automatically use his/her name in the \"To:\" box\n\t\tif params[:receiver]\n\t\t\t@message.receiver = User.find_by_login(params[:receiver])\n\t\tend\n end", "def test_create_reply_to_reply_to_reply_to_standalone_message_about_kevins_review_59\r\n reply_to = messages(:matt_reply_to__tim_reply_to__andy_to_kevin_kevins_review_59)\r\n about = Factory :review\r\n about.user = @kevin\r\n notified_users = send_message(@kevin, @matt, reply_to, about)\r\n assert !notified_users.include?(@kevin),\r\n \"Owner of the review should not receive their own comments on the review.\"\r\n end", "def create\n @message = current_user.messages.create(message_params)\n @friend = User.friendly.find(params[:message][:conversation_id])\n # Notification.create(recepient: @friend, user: current_user, body: \"#{current_user.screen_name } message to you \", notificable: @message, :accept => false)\n\n if @friend.archive.eql?(true)\n @friend.update(archive: false)\n get_users\n @archive=\"true\"\n end\n # @unread_incoming_messages = Message.incoming_messages\n # incoming_messages\n @messages = Message.between(current_user, @friend)\n set_members if params[:message][:recipient_ids].present?\n # conversation_message_path(@friend, current_user)\n # @conversation = Conversation.find(params[:conversation_id])\n # @message = @conversation.messages.build(message_params)\n # @message.user_id = current_user.id\n # @message.save!\n\n # @path = conversation_path(@conversation)\n # redirect_to :back\n end", "def getThreadForUser\n allMessages = Message.where(\"receiver_id = '#{params[:user_id]}' OR \n receiver_id = '#{current_user.id}' AND\n sender_id = '#{current_user.id}' OR\n sender_id = '#{params[:user_id]}'\"\n ).order(\"created_at asc\")\n sender = User.find(params[:user_id])\n sender_name = sender.first_name + \" \" + sender.last_name\n initialHTML = \"<div class=\\\"message-thread\\\" id = \\\"thread#{params['user_id']}\\\" style=\\\"display: none\\\">\"\n middleHTML = \"\"\n allMessages.each do |message|\n if (message.sender_id == current_user.id.to_s)\n bubble = \"left\"\n user_name = current_user.first_name + \" \" + current_user.last_name\n else\n bubble = \"right\"\n user_name = sender_name\n end\n middleHTML = middleHTML + \"<div class=\\\"message bubble-#{bubble}\\\"> <label class=\\\"message-user\\\">#{user_name}</label> <label class=\\\"message-timestamp\\\">#{time_ago_in_words(message.created_at)} ago</label> <p>#{message.message}</p></div>\"\n end\n endingHTML = \"</div> </div>\"\n respond_to do |format|\n format.json { render :json=> { :chatHistory => initialHTML + middleHTML + endingHTML}}\n end\n end", "def new_message_email_to_user(message, receiver)\n @message = message\n @user = receiver\n @structure = message.sender.structure\n\n mail to: @user.email,\n subject: t('mailboxer.message_mailer.subject_new', sender: @structure.name),\n template_name: 'new_message_email_to_user',\n reply_to: generate_reply_to('user')\n end", "def create\n\n\n @message = Message.new(message_params)\n @message.user_id = current_user.id\n @message.body = params[:message][:body]\n @message.save\n\n Recipient.create!(:message_id=>@message.id, :user_id=>params[:to_user_id],:sender_id => current_user.id, :receiver_id => params[:to_user_id],:status=>false)\n\n redirect_to \"/profile/#{current_user.id}\"\n end", "def send_followup(params={})\n @contact_info = sent_messages.map do |sm| # including only sent_messages w/o response\n m = sm.member # member to whom this message was sent\n if m.msg_status < MessagesHelper::MsgDelivered\n {:member => m, :phone => m.primary_phone, :email => m.primary_email} \n else\n nil\n end\n end\n deliver_email if send_email\n deliver_sms(:sms_gateway=>params[:sms_gateway]) if send_sms\n end", "def reply\n message = self.message.class.new(:subject => subject, :body => body)\n message.sender = receiver\n message.to(sender)\n message\n end", "def handle_message( from, to_list, message )\n # Strip SMTP commands from To: and From:\n from.gsub!( /MAIL FROM:\\s*/, \"\" )\n to_list = to_list.map { |to| to.gsub( /RCPT TO:\\s*/, \"\" ) }\n\n puts \"* Message begins\"\n puts \" From: #{from}\"\n puts \" To: #{to_list.join(\", \")}\"\n puts \" Body:\"\n puts message\n puts \"\\n* Message ends\"\n\n end", "def test_message_state_is_propagated_to_threadinfo_even_if_it_is_just_on_the_root\n m1 = MockMessage.new :msgid => \"1\", :has_attachment? => true\n m2 = MockMessage.new :msgid => \"2\", :refs => [\"1\"]\n m3 = MockMessage.new :msgid => \"3\", :refs => [\"2\"]\n\n docid1, threadid1 = @metaindex.add_message m1\n docid2, threadid2 = @metaindex.add_message m2\n docid3, threadid3 = @metaindex.add_message m3\n\n assert_equal threadid1, threadid2\n assert_equal threadid2, threadid3\n\n assert_equal Set.new(%w(attachment)), @metaindex.load_threadinfo(threadid1)[:state]\n end", "def process\n parsed = {}\n parsed[:contents] = \"#{@email.subject} ::: #{@email.body}\"\n parsed[:from] = \"#{@email.from[:email]}\"\n #[:to] is an array of hashes, since possible multiple to's\n parsed[:to] = \"#{@email.to[0][:email]}\"\n\n email_of_interest = parsed[:to]\n if !(/@/.match(parsed[:to]))\n Rails.logger.warn \"Poorly formatted email! parsed: #{parsed}\"\n end\n\n object = Person.react_to_email(email_of_interest)\n if object.class.to_s == \"Person\"\n Communication.create(person_id: object.id,\n contents: parsed[:contents],\n medium: \"email\",\n when: Date.today)\n end\n end", "def send_messages(event)\n begin\n scheme = request.scheme\n host = request.host\n rescue NameError\n scheme = 'http'\n host = 'testing'\n end\n message = <<EOL\nPlease attend this blood drive event and help save lives.\n#{scheme}://#{host}/events/#{event.id}\nEOL\n Donor.where(zipcode: event.zipcode).map(&:phone).each do |ph|\n @client.messages.create(:from => twilio_number, :to => ph , :body =>message)\n end\n end", "def message_params\n params.require(:message).permit(:sender_id, :receiver_id, :message, :message_thread_id)\n end", "def thread_address(thread)\n \"<thread-#{thread.public_token}@#{domain}>\"\n end", "def twilio_broadcast_queue!(client,members)\n client.account.sms.messages.list.each do |sms|\n\t\t\t# only look at messages that twilio has recieved\n\t\t\tif sms.direction == 'inbound'\n \tif TextMessages.count(:sms_id => sms.sid) == 0\n \t# spam it to others\n \tmembers.each do |name,info|\n \tif info[:phone] != sms.from\n \ttwilio_send_text_message!(client,info[:phone],sms.body)\n \tend\n \tend\n \t\tTextMessages.create(:sms_id => sms.sid)\n \t\tend\n\t\t\tend\n end\n end", "def set_message\n @message = @app_thread.messages.find(params[:id])\n end", "def match_availability_message_to_convo\n if conversation_id.nil? && !availability_id.nil?\n conversation = Conversation.where(availability_id: availability_id).first\n if conversation.nil?\n conversation = Conversation.create(availability_id: availability_id, name: \"Teaching #{availability.start_time.strftime('%H:%M %d/%m/%Y')}\")\n availability.availability_users.each do |join|\n conversation.conversation_members.create!(user: join.user, admin: join.admin)\n end\n end\n self.conversation = conversation\n end\n end", "def process_message_response\n # Is this email confirming receipt of a previous message? \n msg_id = find_message_id_tag(:subject=>@subject, :body=>@body)\n#puts \"**** body=#{@body}, msg_id=#{msg_id}\"\n if msg_id \n # Does the \"confirmed message\" id actually match a message?\n message = Message.find_by_id(msg_id)\n if message\n msg_tag = message_id_tag(:id => msg_id, :action => :confirm_tag) # e.g. !2104\n search_target = Regexp.new('[\\'\\s\\(\\[]*' + \"#{Regexp.escape(msg_tag)}\" + '[\\'\\s\\.,\\)\\]]*')\n # The main reason to strip out the tag (like !2104) from the message is that it may be the\n # first part of the response, if there is one; e.g. \"!2104 Kafanchan\" replying to a message\n # requesting location. \n user_reply = first_nonblank_line(@body)\n#puts \"**** user_reply='#{user_reply}'\"\n user_reply = user_reply.sub(search_target, ' ').strip if user_reply\n # Mark all members with this email address as having responded to this message\n @possible_senders.each do |a_member|\n message.process_response(:member => a_member, :text => user_reply, :mode => 'email')\n end\n else\n msg_tag = message_id_tag(:id => msg_id, :action => :create, :location => :body)\n Notifier.send_generic(@from_address, I18n.t('error_msg.invalid_confirmation')).deliver\n end\n end\n end", "def reply\n message = self.message.class.new(:subject => \"Re: #{subject}\",\n :body => body.gsub(/^/, '> '))\n message.sender = receiver\n message.to(sender)\n message\n end", "def send_to(other_player, msg)\n\t\t\tm = GreyGoo::Message.new({ from: self, to: other_player, text: msg })\n\t\t\tm.save!\n\t\t\tother_player.send_message(m)\n\t\tend", "def forward\n message = self.message.class.new(:subject => subject, :body => body)\n message.sender = receiver\n message\n end", "def create\n puts \"########## messages create #############\"\n recipients = params[:user_ids].split(',')\n puts recipients\n recipient_ids = recipients.collect{|i| i.to_i}\n \n @message = current_user.messages.new\n @message.subject = params[:message][:subject]\n if !@message.save\n flash[:notice] = 'Can not sent message.'\n return render :action => \"new\"\n end\n\n @conversation = @message.conversations.new\n @conversation.sender = current_user\n @conversation.content = params[:message][:conversation][:content]\n\n respond_to do |format|\n if @conversation.save\n MessageStatus.associate_user(@message, current_user, recipient_ids)\n format.html { redirect_to(messages_path, :notice => 'Message was successfully sent.') }\n format.xml { render :xml => @message, :status => :created, :location => @message }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @message.errors, :status => :unprocessable_entity }\n end\n end\n end", "def forward\n message = self.class.new(:subject => subject, :body => body)\n message.sender = sender\n message\n end", "def create\n\n @message = Message.new(message_params)\n @message.sender = current_user\n @message.recipients << current_user\n to = params[:to]\n if to.nil?\n group = Group.find_by(id: params[:group_id])\n @message.groups << group\n to = []\n unless group.nil?\n group.users.each do |user|\n to << user.username\n end\n end\n else\n to = to.split(/\\s*,\\s*/)\n end\n to.each do |user_str|\n user = User.find_by(username: user_str)\n if user.nil?\n user = User.find_by(email: user_str)\n end\n unless user.nil?\n unless @message.recipients.include?(user)\n @message.recipients << user\n end\n end\n end\n\n respond_to do |format|\n if @message.save\n if group.nil?\n format.html { redirect_to messages_url, notice: 'Message was successfully created.' }\n else\n format.html { redirect_to group, notice: 'Message was successfully created.' }\n end\n format.json { render :show, status: :created, location: @message }\n else\n format.html { redirect_to messages_url }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def messaging\n end", "def create\n @main_thread = MessageThread.new\n @channel = PublicChannel.new(channel_params.merge main_thread: @main_thread)\n @memebership = ChannelMembership.new(user: current_user, channel: @channel)\n ThreadMembership.create message_thread: @main_thread, channel: @channel\n\n respond_to do |format|\n if @main_thread.save and @channel.save and @memebership.save\n format.html { redirect_to @channel }\n format.json { render :show, status: :created, location: @channel }\n else\n format.html { render :new }\n format.json { render json: @channel.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_message(reason, klass, name, priority, object, *message)\r\n __add_task(reason, klass, MessageTask.new(name, priority, object, message))\r\n end", "def set_recipient\n end", "def mark_thread(username, thread_id, params = {})\n $LOG.i \"running \" + __method__.to_s\n @client.put '/mc/v1/threads/' + username + '/' + thread_id, params\n end", "def distribute(client)\n client.account.messages.create(\n :from => '+16412438808',\n :to => contact.Phone_Number,\n :body => message.contents)\n end", "def request_has_been_discussed_by_user_to_teacher(participation_request, message)\n @message = message\n retrieve_participation_request_variables(participation_request)\n mail to: @admin.email, subject: \"Nouveau message - #{@user.name}\",\n reply_to: generate_reply_to('admin')\n end", "def set_form\n # find the maximum number of users possible\n @max_count = User.all.count\n # check if a message already exists\n if !(defined?(@message)).nil?\n @sender = @message.sender\n @reciever = @message.reciever\n else # else the message is then being created\n # set the sender as the user creating the message\n @sender = params[:user_id]\n # let user determine the reciever of his message\n @reciever = nil\n end\n \n end", "def dm(message)\n raise \"Could not send message because of invalid options #{options}\" unless NOTIFICARE_SETTINGS\n recipients = NOTIFICARE_SETTINGS[\"recipients\"].split(/\\s*,\\s*/)\n username = NOTIFICARE_SETTINGS[\"username\"]\n password = NOTIFICARE_SETTINGS[\"password\"]\n recipients.each do |recipient|\n uri = \"http://#{username}:#{password}@twitter.com/direct_messages/new.json\"\n yell \"Sending #{recipient}: #{message}\"\n Net::HTTP.post_form(URI.parse(uri), {'user' => recipient, 'text' => message})\n end \nend", "def assign_to_message(message)\n message.subject = @subject if @subject\n\n message.headers['bcc'] = @bcc if @bcc\n message.headers['cc'] = @cc if @cc\n\n message.headers['from'] = @from if @from\n message.headers['reply-to'] = @reply_to if @reply_to\n\n message.headers[::Message::DO_NOT_SEND_HEADER] = true if @do_not_send\n\n @headers.each_pair do |name, value|\n message.headers[name] = value\n end\n end", "def contact\n\t\t@musician = User.find_by_id(params[:id])\n\t\t@message = Message.new\n\n\t\t# if there is a user signed in, attribute the message made to both musicians\n\t\t@message.sent_by = current_user.id if user_signed_in?\n\tend", "def contact_to!(actor)\n contact_to(actor) || sent_contacts.create!(receiver: actor)\n end", "def message_params\n # Get messagebox_id\n usercontact = Usercontact.find_by(user_id: current_user.id, contacted_id: params[:user_to_id])\n params.permit(:content, :user_to_id).merge(user_from_id: current_user.id, messagebox_id: usercontact.messagebox_id)\n end", "def broadcastMsgFrom( user, msg )\n\t\tuserDesc = user.to_s\n\n\t\t@users.each {|cl|\n\t\t\tnext if cl == user\n\t\t\tcl.addOutput( \"#{userDesc}>> #{msg}\" )\n\t\t}\n\tend", "def sendChatMessage(a_to, a_text)\n\t\tp 'JabberClient.sendChatMessage'\n\tend", "def like_and_post_on_matching_feed( words_to_match, messages_array )\n regex = /#{words_to_match.map{|w|Regexp.escape(w)}.join('|')}/i\n \n messages = []\n \n posts = get_feed.each do |post|\n name = post[\"message\"]\n if regex === name\n message = \"#{messages_array.sample} #{post['from']['name']}\"\n messages << message\n add_comment_and_like_on_post( post[\"id\"], message )\n end\n end\n end", "def email_friend(sent_to,message,subject)\n @message=message\n mail to: 'shashitripathi253@gmail.com,'+sent_to,:subject => subject\n end", "def chat(data)\n # uid of the intended recipient\n # only the intended recipient will be able to decrypt\n to = data['to'].to_s\n\n if ConnectedList.include?(to)\n relay_message(to, data)\n else\n intended_recipient_not_found(to)\n end\n end", "def handle(time, send, message)\n match(message, \"(join|switch to) (.*)\") do |md|\n new_room_name = md[2]\n \n old_room_name = Robut::Connection.config.room\n \n # nasty gsub of the room name in the room name string\n full_new_room_name = old_room_name.gsub(/[\\d]+_(.*)\\@.*/) { |str| str.gsub($1, new_room_name) }\n \n Robut::Connection.config.room = full_new_room_name\n \n # Reconnect to the new channel.\n # There is a lighter-weight way to accomplish this,\n # but we don't have access to the muc accessor here.\n begin\n Robut::Connection.new.connect\n rescue => e\n $stderr.puts e\n # reply(\"I can't join that room, bro.\")\n \n # reconnect to the original room if we can't connect to the new one\n Robut::Connection.config.room = old_room_name\n Robut::Connection.new.connect\n end\n end\n end", "def enqueue_message(message); end", "def recipient; end", "def message_params\n params.permit(:content, :user_id, :mthread_id, :message_id)\n end", "def send_message(from, recipients)\n self.sent = true\n self.read = true\n \n if recipients == :all\n self.peer = \"All\"\n else\n if recipients.class.to_s != \"Array\"\n recipients = [recipients]\n end\n self.peer = recipients.join(\", \")\n end \n \n if from == :system\n self.user_id = 0\n else\n sender = User.find_by_username(from)\n if sender\n self.user_id = sender.id\n else\n return\n end \n end\n if self.save\n async_send_message(self.id, recipients)\n end\n end" ]
[ "0.5749039", "0.56749094", "0.5664571", "0.56416094", "0.5601903", "0.5589465", "0.55216014", "0.551259", "0.5502344", "0.5498952", "0.5493851", "0.5443518", "0.542724", "0.5423484", "0.53741634", "0.5358581", "0.5355106", "0.5331421", "0.5331259", "0.530086", "0.529664", "0.5293079", "0.5287743", "0.52688515", "0.5268801", "0.52677256", "0.5262413", "0.52608013", "0.5257346", "0.5257206", "0.5251101", "0.5238281", "0.52320445", "0.52293324", "0.52202976", "0.51796347", "0.5172155", "0.51671433", "0.51663005", "0.5162005", "0.51524967", "0.5146945", "0.51418626", "0.5140916", "0.5139909", "0.5138357", "0.5127187", "0.5126426", "0.51249844", "0.51234895", "0.5119361", "0.51176363", "0.5109359", "0.50860006", "0.5078374", "0.5077624", "0.5076167", "0.5070667", "0.5063571", "0.50579244", "0.50577724", "0.50524396", "0.5043454", "0.5036803", "0.50341535", "0.50335747", "0.5027684", "0.5026241", "0.50240326", "0.501985", "0.50091916", "0.5007444", "0.5003947", "0.5003264", "0.5002603", "0.5000544", "0.49900147", "0.49764672", "0.49731332", "0.49718094", "0.49704275", "0.49686655", "0.4967106", "0.49643388", "0.49595863", "0.4959478", "0.49568737", "0.49516496", "0.4951508", "0.49391803", "0.4939058", "0.4938258", "0.49350232", "0.4934253", "0.49341336", "0.49321958", "0.49293697", "0.49279714", "0.4921467", "0.4918848" ]
0.7152579
0
Sort the array so that whenever nums[i] is odd, i is odd, and whenever nums[i] is even, i is even. Return any answer array that satisfies this condition. Example 1: Input: nums = [4,2,5,7] Output: [4,5,2,7] Explanation: [4,7,2,5], [2,5,4,7], [2,7,4,5] would also have been accepted. Example 2: Input: nums = [2,3] Output: [2,3] O(n) time | O(n) space
def sort_array_by_parity(array) res_array = Array.new(array.length, 0) current_even_idx = 0 current_odd_idx = 1 until array.empty? num = array.pop if num.even? res_array[current_even_idx] = num current_even_idx += 2 else res_array[current_odd_idx] = num current_odd_idx += 2 end end res_array end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def odd_even_sort(array)\n return array if array.length <= 1\n\n sorted = false\n length = array.length\n odds, evens = (0...length - 1).to_a.partition(&:odd?)\n until sorted\n sorted = true\n odds.each do |i|\n array, sorted = swap(array, i, i + 1) unless sorted?(array, i)\n end\n\n evens.each do |i|\n array, sorted = swap(array, i, i + 1) unless sorted?(array, i)\n end\n end\n array\nend", "def only_even(arr)\n\tnumsOnly = arr.select { |num| num.is_a? Integer } \n\toddOnly = numsOnly.select { |num| num % 2 != 0 }\n\treturn oddOnly.sort()\nend", "def odd_even(a)\n\tlen = a.length - 1\n\tis_sorted = 0\n\twhile is_sorted == 0\n\t\tis_sorted = 1\n\t(0..len).step(2) do |j|\n\t\tif (j+1) <= len \n\t\t\tif a[j] > a[j+1]\n\t\t\t\ttemp = a[j]\n\t\t\t\ta[j] = a[j+1]\n\t\t\t\ta[j+1] = temp\n\t\t\t\tis_sorted = 0\n\t\t\tend\n\t\tend\n\tp a,j, \"even\", \"sorted?\", is_sorted\n\tend\n\t(1..len).step(2) do |j|\n\t\tif (j+1) <= len \n\t\t\tif a[j] > a[j+1]\n\t\t\t\ttemp = a[j]\n\t\t\t\ta[j] = a[j+1]\n\t\t\t\ta[j+1] = temp\n\t\t\t\tis_sorted = 0\n\t\t\tend\n\t\tend\n\tp a,j,\"odd\"\n\tend\n\tend\n\treturn a\n\nend", "def oddities(arr)\n\tarr.select.with_index { |num, index| num if index.even? }\nend", "def oddSort arr\n #create an empty array to store odd numbers\n finalArr = []\n #loop to shovel odd numbers to the array\n arr.map do |value|\n if value.class == Integer && value.abs()%2 == 1\n finalArr << value\n end\n end\n #sort the array in ascending order\n return finalArr.sort\nend", "def odds_and_ordered (array)\n # Use filter to take out only the odd numbers\n odd_num_array = array.select do | value |\n (value.instance_of? Integer) && (value % 2 != 0)\n end\n # Sort the array of numbers\n odd_num_array.sort { |a, b| a <=> b}\nend", "def oddities(arr)\n arr.select{ |a| arr.index(a).even? }\nend", "def sort_array(arr)\n \n odds = arr.select { |num| num. odd? }.sort\n evens = arr.select{ |num| num.even? }.sort.reverse\n \n arr.map! do |num|\n if num.odd?\n odds.shift\n else\n evens.shift\n end\n end\n \nend", "def oddities(arr)\n new_arr = []\n arr.each_with_index { |v, idx| new_arr << v if idx.even? }\n new_arr\nend", "def oddities(arr)\n arr2 = []\n arr.each_with_index { |elem, ndx| arr2 << elem if ndx.even? }\n arr2\nend", "def sort_array_by_parrity(nums)\n even_misplaced = 0\n odd_misplaced = 1\n arr_len = nums.length\n\n while even_misplaced < nums.length && odd_misplaced < nums.length\n if nums[even_misplaced].even?\n even_misplaced += 2\n elsif nums[odd_misplaced].odd?\n odd_misplaced += 2\n else\n nums[even_misplaced] , nums[odd_misplaced] = nums[odd_misplaced], nums[even_misplaced]\n even_misplaced += 2\n odd_misplaced += 2\n end\n end\n\n nums\nend", "def odd_order array\n array.select do |value|\n array.sort\n value.odd?\n end\nend", "def oddities(arr)\n new_arr = []\n arr.each.with_index do |item, idx|\n new_arr << item if idx == 0 || idx.even?\n end\n new_arr\nend", "def odds_sorted array\n odd_nums = array.select do |value|\n value.is_a?(Integer) && value.odd?\n end\n odd_nums.sort\nend", "def solution(a)\n # write your code in Ruby 2.2\n\n # sort a\n a = a.sort\n odd = 0\n\n # loop over the array\n (0..(a.length-1)).step(2) do |i|\n if((i+1 >= a.length) || ((i+1 < a.length) && (a[i] != a[i+1])))\n odd = a[i]\n break\n end\n end\n\n odd\nend", "def oddities(array)\n new_array = []\n array.each_with_index { |num, idx| new_array << num if idx.even? }\n new_array\nend", "def oddities(arr)\r\n arr2 = arr.select do |x|\r\n arr.index(x).even?\r\n end\r\n arr2\r\nend", "def oddities(arry)\n arry.select { |n| n if arry.index(n).even? }\nend", "def oddities(array)\r\n array.select.with_index { |_, i| i.even? }\r\n end", "def oddNums array\n # Go through the array and select only the integers\n numArray = array.select { |value| value.is_a?(Integer) }\n # Go through the array of integers and select the ones that are odd\n oddNumArray = numArray.select { |value| value.odd? }\n # Sort the array of odd numbers in place using the bang operator\n oddNumArray.sort!\n # Implicity return the array of odd numbers, sorted from least to greatest\nend", "def sort_by_odd(arr)\n arr.sort_by do |sub_arr|\n sub_arr.select(&:odd?)\n end\nend", "def oddities(array)\n new_array = []\n array.each_with_index { |val, idx| new_array << val if idx.even? }\n new_array\nend", "def oddities(arr)\n arr.select.with_index do |_, idx|\n idx.even?\n end\nend", "def oddies(numerals, odd = true)\n odd ? numerals.select { |item| numerals.index(item).even? } : arr.select { |item| numerals.index(item).odd? } \nend", "def oddities(array)\n odd_elements = []\n array.each do |element|\n odd_elements << element if array.index(element).even?\n end\n odd_elements\nend", "def odd_numb array\n new_arr= array.select! do |value|\n value.class == Integer\n end\n new_arr.select { |value| value % 2 != 0 }.sort\nend", "def sort_array_by_parity(a)\n even = []\n odd = []\n \n a.each do |n|\n if n % 2 == 0\n even << n\n else\n odd << n\n end\n end\n \n even + odd\nend", "def sort_array(array)\n n = array.size\n return array if n < 2\n (0..n - 2).each do |i|\n (i + 1..n - 1).each do |j|\n next if array[i].even? || array[j].even?\n interchange(array, i, j) if array[i] > array[j]\n end\n end\n array\nend", "def oddities1(arr)\n (arr.map.with_index { |element,i| element if i.even? }).compact\nend", "def oddities(array)\n odd_array = []\n array.each_with_index { |e, idx| odd_array << e if idx.even? }\n odd_array\nend", "def oddities(arr)\n new_arr = []\n arr.each_with_index do |val, index|\n new_arr << val if index.even?\n end\n new_arr\nend", "def oddities(array)\n array.select { |element| array.index(element).even? }\nend", "def oddities(array)\n array.select.with_index { |e, idx| e if idx.even? }\nend", "def oddities(array)\n odd_array = []\n array.each_with_index do |e, idx|\n odd_array << e if idx.even?\n end\n odd_array\nend", "def oddities(array)\n ret_array = []\n array.each_with_index do |value, index|\n if index.even?\n ret_array << value\n end\n end\n ret_array\nend", "def sort_array_by_parity(nums)\n nums.each_with_index do |num, i|\n if i.even? && num.odd?\n (i..nums.length - 1).each do |j|\n nums[i], nums[j] = nums[j], nums[i] if nums[j].even?\n end\n elsif i.odd? && num.even?\n (i..nums.length - 1).each do |j|\n nums[i], nums[j] = nums[j], nums[i] if nums[j].odd?\n end\n end\n end\n\n nums\nend", "def oddOrEven(arr)\n even = false\n evenCnt = 0\n for i in 0..2 do\n if arr[i] % 2 == 0 then\n evenCnt += 1\n end\n end\n\n if evenCnt > 1 then\n even = true\n for x in arr do\n if x % 2 != 0 then\n return x\n end\n end\n else\n for x in arr do\n if x % 2 == 0 then\n return x\n end\n end\n end\n\nend", "def non_oddities(arr)\n arr_length = arr.size\n index = 0\n even_elements = []\n\n loop do\n even_elements << arr[index] if index.odd?\n\n index += 1\n break if index > arr_length\n end\n even_elements.compact\nend", "def odds(arr)\n\tret = []\n\tarr.each_index { |i|\n\t\tif i % 2 == 1\n\t\t\tret << arr[i]\n\t\tend\n\t}\n\tret\nend", "def oddities(array)\n array.partition {|element| array.index(element).even?}\nend", "def oddities(array)\n result = []\n array.select do |element|\n result << element if array.index(element).even?\n end\n result\nend", "def oddities(arr)\n arr.select.with_index do |element, index|\n index.even?\n end\nend", "def oddities(array)\n return_array =[]\n array.each_with_index do |element, index|\n return_array << element if index.even?\n end\n return_array\nend", "def oddities2(arr)\n index = 0\n result = []\n loop do\n break if index >= arr.size\n result << arr[index]\n index += 2\n end\n result\nend", "def oddities_method_1(arr)\n new_arr = []\n arr.each_with_index do |item, ind|\n new_arr << item if ind.even?\n end\n new_arr\nend", "def evenies(array)\n even_array = []\n array.each_with_index { |e, idx| even_array << e if idx.odd? }\n even_array\nend", "def separate_arr_into_even_and_odd_num(arr)\n arr.select { |e| e.even? || e == odd }\nend", "def odds_only(array)\n # seperate odd numbers .odd?\n odd_arr = array.select do |val|\n # filter out integers\n if val.is_a? Integer \n # odd numbers only\n val.odd?\n end\n end\n # sort the array\n odd_arr.sort\nend", "def alternate_order(array)\n array.select{ |a| a % 2 != 0 }\nend", "def separate_arr_into_even_and_odd_num(arr)\n odd_array = []\n even_array = []\n odd_index = 0\n even_index = 0\n arr.each do |number|\n if number % 2 == 0\n even_array.insert(odd_index, number)\n even_index += 1\n else\n odd_array.insert(odd_index, number)\n odd_index += 1\n end\n end\n\n # remove nils\n index = 0\n for num in even_array\n if num == nil\n even_array.delete(num)\n end\n\n index += 1\n end\n\n return [even_array, odd_array]\nend", "def oddities(arr)\n counter = 0\n return_array = []\n loop do\n return_array << arr[counter]\n counter += 2\n break if counter >= arr.size\n end\n return_array.compact\nend", "def oddities(arr)\n arr.each_with_index.with_object([]) do |(el, i), new_arr|\n new_arr << el if i.even?\n end\nend", "def oddities(array)\n array.select {|item| array.index(item).even?}\nend", "def oddities_1(array)\n array.select { |element| array.index(element) % 2 == 0 }\nend", "def sort_array(source_array)\n odd=[]\n nArr=[]\n for x in source_array do\n if x != 0 && x % 2 != 0\n odd.push(x)\n end\n end\n odd.sort!\n i=0\n for x in source_array do\n if x != 0 && x %2 != 0\n nArr.push(odd[i])\n i += 1\n else\n nArr.push(x)\n end\n end\n p nArr\nend", "def evenies(array)\n array.select.with_index { |e, idx| e if idx.odd? }\nend", "def oddities(arr)\n arr.select.with_index do |_,index|\n (index + 1).odd?\n end\nend", "def odd_sort array\n # create a variable that selects the odd numbers from the aray\n only_odd_numbers = array.select do |value|\n value.is_a?(Numeric) && value.odd?\n end\n #sort this variable from least to greatest\n only_odd_numbers.sort\nend", "def oddities(array)\n result = []\n index = 0\n\n loop do\n result << array[index]\n index += 2\n break if index >= array.size\n end\n\n result\nend", "def odd_sort array\n new_arr = array.grep(Numeric)\n (new_arr.select { |value| value%2!=0 }).sort()\n \nend", "def oddities(array)\n odd_element_array = []\n index = 0\n loop do\n break if index >= array.size\n odd_element_array << array[index] if index.even?\n index += 1\n end\n odd_element_array\nend", "def oddities(array)\n new_array = []\n array.each_with_index do |item, index|\n new_array << item if index.even?\n end\n new_array\nend", "def oddities(array)\nresult = []\narray.each_with_index do |value, idx|\n result << value if (idx + 1).odd?\nend\nresult\nend", "def oddities(input_array)\n input_array.select.each_with_index { |_, i| i.even? } # => [2, 4, 6], [\"abc\"], [123], []\nend", "def oddities(array)\n result = []\n count = 0\n array.each do |element|\n result << element if count.even?\n count += 1\n end\n result\nend", "def oddities(array)\n array.select {|element| array.index(element).even?}\nend", "def oddities(array)\n new_array = []\n array.each_with_index do |num, index|\n new_array << num if index.odd?\n end\n new_array\nend", "def select_odds(nums)\n odds = []\n\n i = 0\n while i < nums.length\n if nums[i] % 2 == 1\n odds << nums[i]\n end\n i += 1\n end\n return odds\nend", "def oddities(array)\n array.select.with_index { |e, i| (i + 1).odd? }\nend", "def oddities(array)\n new_array = []\n\n index = 0\n while index < array.size\n new_array << array[index] if index.even?\n index += 1\n end\n new_array\nend", "def sort_indexes(arr_of_integers=[1, 8, 3, 16, 11, 100])\n odd_arr = []\n even_arr = []\n i = 0\n arr_of_integers.length.times do\n if i.odd?\n odd_arr.push(arr_of_integers[i])\n else\n even_arr.push(arr_of_integers[i])\n end\n i += 1\n end\n puts \"Elements with odd indexes: \" + odd_arr.to_s\n puts \"Elements with even indexes: \" + even_arr.to_s\n end", "def oddities(array)\n new_array = []\n array.each_with_index do |element, index|\n new_array.push(element) if (index + 1).odd?\n end\n new_array\nend", "def even_index_nums(array)\n even_index_array = []\n \n array.each_with_index do |element, index|\n if index.even?\n even_index_array << element\n end\n end\n even_index_array\nend", "def evens_and_odds(arr)\r\n arr.partition{ |num| num.odd?}\r\nend", "def sort_array(source_array)\n odd_array = source_array.select{|number| number.odd?}.sort \n source_array.map{ |number| number.even? ? number : odd_array.shift }\n\nend", "def oddities(array)\n new_array = []\n index_range = (1..array.size-1)\n for n in index_range do \n new_array << array[n] if n.odd?\n end\n new_array\nend", "def oddities(ary)\n new_array = []\n counter = 0\n loop do\n break if counter == ary.size\n new_array << ary[counter] if counter.even?\n counter += 1\n end\n new_array\nend", "def evens(arr)\n even_places = []\n arr.each_with_index do |el, idx|\n even_places << el if idx.odd?\n end\n even_places\nend", "def oddball(arr)\n is_even = []\n is_odd = []\n i = 0\n while i < arr.length\n if arr[i] % 2 = 0\n is_even += arr[i]\n else\n is_odd += arr[i]\n end\n i += 1\n end\n if is_even.length == 1\n return is_even[0]\n else\n return is_odd[0]\n end\nend", "def oddball(arr)\n oddcount = evencount = 0\n arr.each do |num|\n if num % 2 == 0\n evencount +=1\n else\n oddcount +=1\n end\n if oddcount > 1 || evencount > 1\n break\n end\n end\n if oddcount > 1\n arr.each do |num| return num if num % 2 == 0 end\n elsif evencount > 1\n arr.each do |num| return num if num % 2 != 0 end\n end\nend", "def only_odd array\n new_array = array.select { |value| value.is_a?(Integer) && value % 2 != 0}\n p new_array.sort\nend", "def sort_array_by_parity(a)\n even = []\n odd = []\n a.each do |e|\n even << e if e.even?\n odd << e if e.odd?\n end\n even.concat(odd)\nend", "def oddities(array)\n count = 0\n new_array = []\n loop do\n break if array.size == 0\n new_array << array[count]\n count += 2\n break if count >= array.size\n end\n new_array\nend", "def separate_array_into_even_and_odd_numbers(array)\n array.partition {|x| x.even?}\nend", "def no_odds(arr)\n\teven_arr = []\n\tarr.each { |x| even_arr << x if x.even?}\n\treturn even_arr\nend", "def oddities(init_array)\n odd_bods = []\n init_array.each_with_index do |element, index|\n odd_bods << element if index.odd?\n end\n odd_bods\nend", "def sort_array(source_array)\n odd_num = source_array.select(&:odd?).sort.each\n source_array.map { |n| n.odd? ? odd_num.next : n }\nend", "def even_index_nums(array)\n counter = 0\n even_index_array = []\n \n loop do\n break if counter == array.length\n \n current_element = array[counter]\n \n if counter % 2 == 0\n even_index_array << current_element\n end\n \n counter += 1\n end \n even_index_array\nend", "def sort_array(xs)\r\n odd = xs.select(&:odd?).sort.each\r\n xs.map{ |x| x.odd? ? odd.next : x }\r\nend", "def odd_nums_ascending (array)\n #map through array\n #create new array to hold numbers\n num_array = array.select do | num |\n num.class == Integer\n #chaining on select to see if number is odd\n end.select do | num |\n num.odd?\n #sort by ascending\n end.sort\n #return array\n num_array\nend", "def oddities3(arr)\n result = []\n index_array = (0..arr.size-1).select {|idx| idx.even?}\n index_array.each do |index|\n result << arr.fetch(index)\n end\n result\nend", "def oddities(array)\n\n result = [] # empty array to push each item in the array to.\n index = 0 # creates a counter called index\n\n while index < array.size\n result << array[index] # array index is the number in the array.\n index += 2 # += 2 iterates over and returns even items.\n end\n result # again with loops put the result outside of the loop.\nend", "def oddball(arr)\n a, b, c = arr\n if a %2 == b %2\n expected = a %2\n arr.drop(2).each{|n| return n if n != a}\n elsif a%2 == c %2\n return b\n else\n return a\n end\nend", "def oddities(input)\n input.select.with_index {|_, index| index.even?}\nend", "def find_outlier(array)\n odd_array=[]\n even_array=[]\n array.each do |i|\n odd_array << i if i % 2 == 0\n even_array << i if i % 2 != 0\n end\n odd_array.size > even_array.size ? even_array[0] : odd_array[0]\nend", "def get_even_numbers_from_array(numbers)\n even_numbers = []\n\n for number in numbers\n\n if number.even? == true\n even_numbers << number\n end\n \n end\n\n return even_numbers\nend", "def oddball(arr)\n\tnew_arr = arr.map { |n| n % 2}\n\tnew_arr.count(0) == 1 ? arr[new_arr.index(0)] : arr[new_arr.index(1)]\nend", "def odds_small_to_big (array) \n #Use .select, .is_a? Numeric, and .is_odd? to pull odd numbers\n #Use .sort to sort the numbers, return implicitly\n p array.select {|item| item.is_a? Numeric and item.odd?}.sort\nend", "def oddities(list)\n new_list = []\n list.each_index do |ind|\n new_list << list[ind] if (ind + 1).odd?\n end\n new_list\nend", "def even_numbers_less_than num\n\t# array_of_nums = []\n\t# i = 0\n\t# while i < num\n\t# \tarray_of_nums.push(i)\n\t# \t# array_of_nums.delete_if &:odd?\n\t# \ti += 2\n\t# end\n\t# array_of_nums\n\t(0...num).select { |numbers| numbers.even? }\nend", "def odd_index_nums(array)\n array.select do |num|\n current_index = array.index(num)\n \n if current_index % 2 == 1\n num\n end\n end\nend" ]
[ "0.80113614", "0.7768278", "0.7496941", "0.7452541", "0.73995095", "0.7396255", "0.7376422", "0.73662925", "0.73509264", "0.73277175", "0.73043334", "0.72962344", "0.7295605", "0.7281025", "0.7254218", "0.7225104", "0.72238475", "0.7218958", "0.72014195", "0.7184898", "0.71770954", "0.7159532", "0.7155251", "0.71514577", "0.7141093", "0.71363956", "0.7132374", "0.7131359", "0.71214145", "0.71152335", "0.7114653", "0.71053326", "0.7081069", "0.70713055", "0.70506316", "0.7047906", "0.70397997", "0.7038897", "0.7022236", "0.7017728", "0.70156866", "0.7010929", "0.7006075", "0.7006054", "0.6999621", "0.6983749", "0.69579047", "0.69536716", "0.69418234", "0.6941419", "0.69357914", "0.69253063", "0.69240224", "0.69167", "0.6913675", "0.6893994", "0.6893484", "0.68921775", "0.68764555", "0.6874442", "0.6873875", "0.6872314", "0.68673897", "0.68669647", "0.686386", "0.685925", "0.68518496", "0.68475556", "0.6841631", "0.6828728", "0.6828114", "0.68251693", "0.68038994", "0.67732805", "0.6771681", "0.677134", "0.6767155", "0.6760424", "0.6760179", "0.67159265", "0.6711066", "0.66930157", "0.6688275", "0.66850376", "0.66625184", "0.66508573", "0.6642692", "0.66367", "0.6629427", "0.66268396", "0.66184604", "0.66107255", "0.660176", "0.65956515", "0.6587372", "0.6578206", "0.6577203", "0.6576668", "0.65708536", "0.65696764", "0.6559613" ]
0.0
-1
Follow up: Can you solve it inplace? O(n^2) time | O(1) space
def sort_array_by_parity(nums) nums.each_with_index do |num, i| if i.even? && num.odd? (i..nums.length - 1).each do |j| nums[i], nums[j] = nums[j], nums[i] if nums[j].even? end elsif i.odd? && num.even? (i..nums.length - 1).each do |j| nums[i], nums[j] = nums[j], nums[i] if nums[j].odd? end end end nums end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_dublicate(array)\n sum = 1000000*(1000000+1)/2 # (n*(n+1))/2\n array.each do |el| \n sum -= el\n end\n return sum\nend", "def solution(m, a)\n n = a.count\n result = 0\n front = 0\n numbers = Array.new(m + 1, false)\n n.times { |back|\n while front < n and not numbers[a[front] - 1]\n numbers[a[front] - 1] = true\n front += 1\n result += front - back\n return 1_000_000_000 if result >= 1_000_000_000\n end\n numbers[a[back] - 1] = false\n }\n result\nend", "def solve( n = 10_000 )\n (1..n).select {|i| i.amicable?}.reduce( :+ )\n end", "def solution(a)\n n = a.size\n passing_cars = 0\n\n suffix_sums = Array.new(n + 1, 0)\n\n a.reverse.each_with_index do |elem, i|\n suffix_sums[i + 1] = suffix_sums[i] + elem\n end\n suffix_sums.reverse!\n\n a.each_with_index do |car, i|\n if car == 0\n passing_cars += suffix_sums[i]\n end\n end\n\n passing_cars > 1_000_000_000 ? -1 : passing_cars\nend", "def solution(a)\r\n n=a.size\r\n i=1\r\n for k in a.sort do\r\n\tif k!=i \r\n\t then \r\n\t return 0\r\n\t break;\r\n\tend\r\n i+=1;\r\n end\t\r\n return 1 if a.inject(:+) ==n*(n+1)/2;\r\nend", "def find_solution(arr)\n arr.each_with_index do |e, i|\n rest = arr[0..i - 1] + arr[i + 1..-1]\n prod = rest.reduce(:*)\n arr[i] = prod\n end\n\n arr\nend", "def slow_solution(a)\n m = 0\n a.size.times do |i|\n a[i] = a[i].abs\n m = [a[i], m].max\n end\n maxsum = a.sum # sum of absolute val of all nums in array\n # maxsum = a.map(&:abs).sum <- Ruby shortcut\n\n # If dp = 1 at an index, it means some combo of elements in a add up to that index\n dp = [0] * (maxsum + 1)\n dp[0] = 1\n\n a.size.times do |j|\n maxsum.downto(0).each do |possible_sum|\n puts \"a[j]: #{a[j]}, possible sum: #{possible_sum}\"\n if (dp[possible_sum] == 1) and (possible_sum + a[j] <= maxsum)\n\n # if possible_sum + new element a[j] is possible sum, dp = 1!\n dp[possible_sum + a[j]] = 1\n puts \"Mark #{possible_sum + a[j]} as possible sum in dp\"\n end\n end\n puts \"row: #{j}, a[j]: #{a[j]}, dp: #{dp}\"\n puts\n end\n\n min_q_minus_p = maxsum\n\n # Divide array a into 2 parts, where P = sum of part 1 and Q = sum of part 2,\n # P + Q = maxsum, and P <= maxsum / 2 <= Q.\n # We want largest possible P to get smallest possible Q-P.\n\n # loop from 0 to maxsum / 2, covering every possible P, Q division\n (maxsum / 2 + 1).times do |possible_half_sum|\n # puts \"possible_half_sum: #{possible_half_sum}\"\n if dp[possible_half_sum] == 1 # means P or Q = possible_half_sum\n q_minus_p = maxsum - 2 * possible_half_sum\n # puts \"Q - P: #{q_minus_p}\"\n min_q_minus_p = [min_q_minus_p, q_minus_p].min\n # puts \"min Q - P: #{min_q_minus_p}\"\n end\n end\n\n min_q_minus_p\nend", "def arrayManipulation(n, queries)\n nums = Array.new(n+1, 0)\n queries.each do |query|\n nums[query[0]-1] += query[2]\n nums[query[1]] -= query[2]\n end\n\n max = nums.first\n (1..nums.length-1).each do |i|\n nums[i] += nums[i - 1]\n max = nums[i] if nums[i] > max && i < (nums.size - 1)\n end\n\n max\nend", "def solution(a)\n # write your code in Ruby 2.2\n sum = a.inject(:+)\n acc = 0\n\n min = 99999999\n a[0..-2].each do |n|\n sum -= n\n acc += n\n\n min = [(acc - sum).abs, min].min\n end\n min\nend", "def solution(a)\n left = 0\n right = a.sum\n a.each_with_index do |element, index|\n right -= element\n return index if left == right\n left += element\n end\n -1\nend", "def solution(a)\n accessed = Array.new(a.size + 1, nil)\n caterpillar_back = 0\n count = 0\n\n a.each_with_index do |x, caterpillar_front|\n if accessed[x] == nil\n accessed[x] = caterpillar_front\n else\n new_caterpillar_back = accessed[x] + 1\n first_part_size = caterpillar_front - caterpillar_back\n second_part_size = caterpillar_front - new_caterpillar_back\n count += first_part_size * (first_part_size + 1) / 2\n count -= (second_part_size) * (second_part_size + 1) / 2\n caterpillar_back.upto(new_caterpillar_back - 1) { |n| accessed[a[n]] = nil}\n accessed[x] = caterpillar_front\n caterpillar_back = new_caterpillar_back\n end\n end\n\n remaining_size = a.size - caterpillar_back\n count += (remaining_size) * (remaining_size + 1) / 2\n end", "def find3(a, X)\n # scan through array\n # build hash storing complement in each key\n complements = {}\n a.each_with_index do |val, ind|\n if complements[X - val]\n complements[X - val].push(ind)\n else\n complements[X - val] = [ind]\n end\n end\n\n # scan through the array again\n # get complement\n # for each value scan the remainder of the arrray\n # for a value such taht a + b = the complement\n\n # for each character we have built a dictionary such that, we can find\n # x = a + complement\n\n # [1, 2, 3]\n # 1 + 2 = 3\n # 1 + 3 = 4 =>\n\n # for each value in the array (a) look at all following values (b) and see if a + b\n # is in the dictionary, if it is, check that their indices do not collide with the index\n # stored at dict(a+b)\n\n a.each_with_index do |va, i|\n a.each_with_index do |vb, j|\n break if i == j\n\n complement = va + vb\n indices = complements[complement]\n\n indices.each do |z|\n # every index is unique\n return [i, j, z] unless z == i || z == j\n end\n end\n end\n\n return nil\nend", "def solution(a)\n min_val = 10_000\n min_pos = 0\n \n sums = [0]\n for i in (0..a.count - 1) \n sums << sums.last + a[i] \n end\n for p in (0..a.count - 2)\n for q in (p + 1..[p + 2, a.count - 1].min)\n s = (sums[q + 1] - sums[p]).to_f / (q - p + 1)\n if s < min_val\n min_val = s\n min_pos = p\n end\n end\n end\n min_pos\nend", "def naive(array)\n max = -10000\n for i in (0..array.length - 1)\n for j in (i..array.length - 1)\n total = array[i..j].inject { |m,k| m + k }\n max = total if total > max\n end\n end\n max\nend", "def naive_algorithm(arr)\n\tproduct = 0\n\tarr.each do |i|\n\t arr.each do |j|\n\t \tp = arr[i] * arr[j]\n\t \tproduct = p if product < p\n\t end\t\n\tend\t\t\n\tproduct\nend", "def get_products_but_self(arr)\n # raise 'need more than itself to get all other products' if arr.length < 2\n # result = [] \n # #first just try to come up with a way that works even if it's slow \n # arr.each_with_index do |el,idx|\n # arr[idx] = 1 \n # result << arr.reduce(:*) O(n) in a O(n) loop \n # arr[idx] = el \n # end \n # result This works, Time: O(n^2) space:O(n), created 1 new array Now try to optimize \n \n # Faster way, trying greedy way, constanly update the variable\n products_before_el = [1] # when we are at the first el, the product before that we use 1\n products_after_el = [] #we know that product after the last el, we can use 1, and since\n #we can only multiply, we backwards from the last el for products after el\n end_idx = arr.length - 1 \n products_after_el[end_idx] = 1\n (1..end_idx).each do |i| # time O(n)\n products_before_el[i] = products_before_el[i-1]*arr[i-1]\n products_after_el[end_idx - i] = products_after_el[end_idx - i + 1]*arr[end_idx - i +1]\n end \n result = []\n arr.length.times do |i| \n result[i] = products_before_el[i] * products_after_el[i]\n end \n result \n\n # Can we improve on space? \nend", "def solution(arr)\n dp = Array.new(arr.max+2, 0)\n arr.each { |a| dp[a] += 1 }\n\n for i in 2...dp.size do\n dp[i] = [dp[i-2] + i*dp[i], dp[i-1]].max\n end\n dp.last\nend", "def dp_possible_trees(n)\n array = Array.new(n+2) { Array.new(n+1) { 0 } }\n (0...n+2).to_a.each do |i|\n array[i][0] = 1\n end\n\n sum = 0\n (1...n+1).to_a.each do |i|\n sum = 0\n (1..i).to_a.each do |j|\n array[j][i] = array[n+1][i-j] * array[n+1][j-1]\n sum += array[j][i]\n end\n array[n+1][i] = sum\n end\n array[n+1].last\nend", "def solve(arr)\n ((arr.map {|n| n * -1}) - arr).first * -1\nend", "def largest_subsum(list)\n max = list[0] # O(1)\n current_sum = list[0] # O(1)\n\n (1...list.length).each do |i| # O(n)\n # debugger\n if current_sum < 0 # O(1)\n current_sum = 0 # O(1)\n end \n current_sum += list[i] # O(1)\n if current_sum > max # O(1)\n max = current_sum # O(1)\n end\n end\n\n max # O(1)\n\nend", "def solution(x, a)\n perm = (1..x).to_a\n return -1 unless (perm - a).empty?\n a.index(a.uniq.last)\nend", "def solution(a)\n length = a.length\n sum = (length + 1) * (length + 1 + 1) / 2\n\n sum - a.inject(0) { |acc, e| acc += e }\nend", "def find_duplicate(nums)\n if !nums or nums.size == 0\n return nil\n else\n fast = nums[ 0 ]\n slow = nums[ 0 ]\n while true\n fast = nums[ fast ]\n fast = nums[ fast ]\n slow = nums[ slow ]\n if fast == slow\n new_node = nums[ 0 ]\n while new_node != slow\n new_node = nums[ new_node ]\n slow = nums[ slow ]\n end\n return slow\n end\n end\n end\nend", "def solve_again_with_issues(array, sum)\n result = {}\n freq = {}\n count = 0\n\n array.each do |el|\n freq[el] ? freq[el] += 1 : freq[el] = 1\n end\n\n array.each do |el|\n if freq[sum - el] && !result[sum - el]\n count += freq[sum - el]\n end\n end\n count/2\nend", "def seesaw?(arr)\n left_sum = 0\n arr.each_index do |i| #O(n)\n if i > 0\n left_sum = arr[0...i].reduce(:+) #O(n)\n end\n if i < arr.size-1\n right_sum = arr[i+1..-1].reduce(:+); #O(n)\n else\n right_sum = 0\n end\n if left_sum == right_sum\n return true\n end\n end\n return false\nend", "def solution_slow_2(n, p, q)\n sieve = sieve_of_erathosteneses(n)\n # puts \"sieve:#{sieve}\"\n semi = semiprimes(n, sieve)\n # puts \"sp:#{semi}\"\n prefix = [0,0,0,0,1]\n 5.upto(n) do |x|\n if semi.include? x \n prefix << prefix.last + 1\n else\n prefix << prefix.last\n end\n end\n # puts \"prefix:#{prefix}\"\n\n queries = [p,q].transpose\n\n\n res = queries.map do |query|\n prefix[query.last] - prefix[query.first - 1]\n end\n\n # puts \"res:#{res}\"\n\n res\n end", "def solution(arr)\n zeros = 0\n pass_cars = 0\n\n (0...arr.size).each do |idx|\n arr[idx] == 0 ? zeros += 1 : pass_cars += zeros\n\n return -1 if pass_cars > 1000000000\n end\n\n pass_cars\nend", "def arrayManipulation(n, queries)\n arr = Array.new(n + 2, 0)\n\n queries.each do |a, b, k|\n arr[a] += k\n arr[b + 1] -= k\n end\n\n max_sum = 0\n sum = 0\n arr.filter { |diff| diff != 0 }.each do |diff|\n sum += diff\n max_sum = [max_sum, sum].max\n end\n\n max_sum\nend", "def solution(a, k)\n # write your code in Ruby 2.2\n \n unless a.empty?\n for i in 1..k\n last = a.pop\n a.insert(0, last)\n end\n end\n \n return a\nend", "def solution(a)\n result = 0\n tmp_count = 0\n a.each_with_index do |val, idx|\n if val.zero?\n tmp_count += 1\n else\n result += tmp_count\n end\n end\n return result > 1000000000 ? -1 : result\nend", "def solution(a)\n # write your code in Ruby 2.2\n \n is_perm = 0\n \n n = a.length\n b = [0]*n\n \n \n a.each do |v|\n break if v > n \n break if b[v] == 1 \n b[v] = 1\n end\n \n sum = b.inject(:+)\n if sum == n\n is_perm = 1\n end\n \n is_perm\nend", "def my_min_2(array)#O(n)\n array.inject do |acc, ele|#O(n)\n if acc < ele\n acc\n else\n ele\n end\n end\nend", "def seesaw2?(arr)\n left_sum = 0\n right_sum = arr.size > 1 ? arr[1..-1].reduce(:+) : 0\n\n arr.each_index do |i| #O(n)\n return true if left_sum == right_sum\n left_sum += arr[i]\n i < arr.size-1 ? right_sum -= arr[i+1] : right_sum = 0\n end\n return false\nend", "def largest_cont_subsum_fast(list)\n # for constant size to be true, you cant create any variables\n # whose memory size depends on the size of the input\n curr_sum = list[0]\n largest_sum = list[0]\n\n # we know there are n^2 potential, so if we ever check all of them\n # it must be n^2\n\n # there must be a way to find the max without checking every subarray\n list[1..-1].each do |ele|\n # debugger\n if curr_sum > largest_sum\n largest_sum = curr_sum\n end\n\n if curr_sum < 0\n curr_sum = 0\n end\n\n curr_sum += ele\n\n end\n\n # debugger\n return [largest_sum, curr_sum].max\n\nend", "def solve( n = 100_000_000 )\n # Assuming the largest valid sum of squares is S = a^2 + (a - 1)^2 < n,\n # first find a and set aside space to cache that many running sums.\n len = (1 + Math.sqrt( 2*n )) / 2\n sos = Array.new( len )\n\n seen = []\n sos[0] = 1\n\n (1...len).each do |i|\n # Precompute the ∑ i^2 for all i <= a. \n ds = i*i + 2*i + 1\n sos[i] = sos[i - 1] + ds\n\n seen << sos[i] if sos[i].palindrome?\n\n # Most of the sum of square values will exceed n, so subtract lower sums\n # to check shorter runs.\n (i - 2).downto( 0 ) do |j|\n diff = sos[i] - sos[j]\n break unless diff < n\n\n # Update our total if the shorter run a[j] + a[j + 1] + ... + a[i] is\n # a palindrome.\n seen << diff if diff.palindrome?\n end\n end\n\n seen.uniq.reduce( :+ )\n end", "def solve( n = 100 )\n n.partition_sieve[-1] - 1\n end", "def three_sum_fastest(arr)\n count = 0\n\n (0..arr.length - 2).each { |i|\n set = Set.new\n\n (i + 1..arr.length - 1).each { |j|\n if set.include?(-arr[i] - arr[j])\n count += 1\n end\n\n set.add(arr[j])\n }\n }\n count\nend", "def josephus_survivor(n,k)\n arr = (1..n).to_a\n\n while arr.length > 1\n idx = k % arr.length\n\n if arr.length > k\n arr = arr.drop(k) + arr.take(k - 1)\n elsif arr.length == k \n arr = arr[0...-1]\n else\n arr = arr.drop(idx) + arr.take(idx - 1)\n end\n end\n \n arr[0]\nend", "def sorted_squares(nums)\n # This takes O(n)\n nums.map! { |num| num**2 }\n # This can take Ο(n logn)\n bubble_sort(nums)\nend", "def solution(a)\n ((1..a.size + 1).to_a - a).first\nend", "def okay_two_sum?(arr, target)\n arr = arr.sort #n log n\n (0...arr.length).each do |i| #n\n search = bsearch(arr, target-arr[i]) # log n\n return true unless search.nil?\n end #n log n\n false\nend", "def sub_sum(list)\n sub_arr = []\n (0...list.length).each do |i| #O(n)\n (i...list.length).each do |j| #O(n)\n sub_arr << list[i..j] if i <= j\n end\n end\n largest_continuous_sub_sum1(sub_arr)\nend", "def largest_contiguous_sub_sum2(arr)\n #one varable tracks largest sum\n #one variable tracks current sum\n #O(n) + O(1)\n # list = [2, 3, -6, 7, -6, 7]\n\n # largest_sum= arr.first\n\n # i = 0\n # arr_end = true\n\n # while arr_end\n # current_sum = arr[i]\n # if arr[i+1] == nil\n # arr_end = false\n # puts \"This is current sum: #{current_sum}\"\n # else\n # if current_sum > largest_sum\n # current_sum += arr[i+1]\n # largest_sum = current_sum\n # end\n # end\n # if i < arr.length\n # arr_end = true\n # i += 1\n # end\n # end\n # largest_sum\n \n\n\n # arr.each_with_index do |ele, idx|\n # if ele > largest_sum\n # largest_sum = ele\n # end\n\n # i = idx\n # sum = ele\n # while i < arr.length - 1\n # if sum <= sum + arr[i+1]\n # largest_sum = sum + arr[i+1]\n # end\n # sum = sum + arr[i+1]\n # i+=1\n # end\n # end\n # largest_sum\n\nend", "def findDiffSquares(n)\n sum = 0\n (1..n).each { |i|\n (1..n).each { |j|\n sum += i*j unless i == j\n }\n }\n sum\nend", "def brute_force_two_sum(array, target)\n indexes = []\n array.each.with_index do |n1, index1|\n array.each.with_index do |n2, index2|\n indexes.push(index1) if target - n1 == n2 && index1 != index2\n end\n end\n indexes\nend", "def solution(n, a)\n # write your code in Ruby 2.2\n arr = [0] * n\n max_c = 0\n \n a.each_with_index do |value,index|\n if value == n + 1\n arr = [max_c] * n\n else\n arr[value - 1] = arr[value - 1] + 1\n max_c = (arr[value -1] > max_c ? arr[value -1] : max_c)\n end\n end\n arr\nend", "def mutateTheArray(n, a)\n prv = 0\n (0...a.size).each do |i|\n nxt = i < (a.size - 1) ? a[i+1] : 0\n tmp = a[i]\n a[i] += nxt + prv\n prv = tmp\n end\n a\nend", "def largest_contiguous_subsum_2(list)# [2, 3, -6, 7, -6, 7]\n largest_num = list[0]#2 O(1)\n running_sum = list[0]#2 - 5 after entering loop. O(1)\n\n (1...list.length).each do |i| #O(n) \n running_sum = 0 if running_sum < 0 #O(1)\n running_sum += list[i] #O(1)\n largest_num = running_sum if running_sum > largest_num #O(1)\n end\n return largest_num #O(1)\nend", "def dp(array)\n ary_size = array.size\n queue = [0]\n for i in 0..(ary_size - 1) do\n if i == 0\n queue << array[i]\n else\n cost_1 = (queue[i - 1] - array[i]).abs\n cost_2 = (queue[i - 2] - array[i]).abs\n queue << [cost_1, cost_2].min\n end\n end\n return queue.last\nend", "def largest_contiguous_subsum2(list)\n # O(N) ==> Time\n # O(1) ==> Space\n largest = list.first\n curr = list.first\n\n len = list.length\n (1...len).each do |i|\n curr = 0 if curr < 0 \n curr += list[i]\n largest = curr if curr > largest\n end\n largest\nend", "def solve(nums)\n arr = nums.map {|num| num * num}\n arr.each_with_index do |el1, idx1|\n arr.each_with_index do |el2, idx2|\n if idx2 > idx1\n if arr.include?(el1 + el2)\n if (arr.index(el1 + el2) != idx1) && (arr.index(el1 + el2) != idx2)\n return true\n end\n end\n end\n end\n end\n false\nend", "def problem_57\n ret,n,d = 0,1,1\n 1000.times do |i|\n n,d = (n+2*d),(n+d)\n ret += 1 if n.to_s.length > d.to_s.length\n end\n ret\nend", "def my_solution(array)\n hash = {}\n\n array.each do |element|\n hash[element] = 0 if element > 0\n end\n\n (1..array.size).each do |i|\n return i if hash[i].nil?\n end\nend", "def naive(set)\n solutions = []\n indexes = (0..set.size-1).to_a\n\n Backtracker.generate do\n candidates { |a| indexes - a }\n solution? { |a| a.size == set.size }\n found_solution do |a| \n solution = a.map { |i| set[i] } \n solutions << solution unless solutions.include? solution\n end\n end\n\n return solutions\nend", "def efficient_contiguous_subsum(list)\n current_sum = list[0] #0\n largest_sum = list[0] #5\n # debugger\n (1...list.length).each do |i| \n if current_sum + list[i] > 0 \n current_sum += list[i] \n largest_sum = current_sum if current_sum > largest_sum\n else \n current_sum = 0\n end \n end \n largest_sum\nend", "def my_min_2(list)\r\n min = 0 # O(1)\r\n \r\n list.each do |ele| # O(n) \r\n if ele < min # O(1)\r\n min = ele # O(1)\r\n end\r\n end\r\n min # O(1) \r\nend", "def equil_idcs(a)\n left = 0\n sum = a.inject(:+)\n equils = []\n a.each_with_index do |num, idx|\n sum -= num\n equils << idx if left == sum\n left += num\n end\n equils.empty? ? -1 : equils\nend", "def problem_76a\n num = 100\n solve = lambda do |a,off,max|\n n = 0\n while a[off] < max && (a.length-off) >= 2 \n a[off] += a.pop\n n += 1\n n += solve.call(a.dup,off+1,a[off]) if a.length - off > 1\n end\n n\n end\n puts 1 + solve.call([1] * num, 0,num-1)\nend", "def optimize(ary, total)\n return [] if ary.empty?\n table = []\n (ary.size+1).times { |i| table[i] = [] }\n (0..total).each { |zerg| table[0][zerg] = 0 }\n (1..ary.size).each do |base|\n table[base][0] = 0\n (1..total).each do |zerg|\n if ary[base-1].zerg <= zerg && (ary[base-1].minerals + table[base-1][zerg - ary[base-1].zerg] > table[base-1][zerg])\n table[base][zerg] = ary[base-1].minerals + table[base-1][zerg - ary[base-1][1]]\n else\n table[base][zerg] = table[base-1][zerg]\n end\n end\n end\n result = []\n i, k = ary.size, total\n while i > 0 && k > 0\n if table[i][k] != table[i-1][k]\n result << ary[i-1]\n k -= ary[i-1].zerg\n end\n i -= 1\n end\n result\nend", "def eliminacion_gaussianda(n, a)\n n = n - 1\n\n for j in (0..n - 1)\n k = (j..n).select { |i| !a[i][j].zero? }.first\n\n if k.nil?\n puts \"El sistema no tiene solucion unica.\"\n return\n end\n\n if !k.eql?(j)\n a[k], a[j] = a[j], a[k]\n end\n\n for i in (j + 1..n)\n m = a[i][j].fdiv(a[j][j])\n resta = a[i].map.with_index { |x, index| x - m * a[j][index] }\n a[i].replace(resta)\n end\n end\n\n if a[n][n].zero?\n puts \"El sistema no tiene solucion unica.\"\n return\n end\n\n x = Array.new(n + 1)\n x[n] = a[n][n + 1].fdiv(a[n][n])\n\n (0..n - 1).reverse_each do |i|\n sumatoria = (i + 1..n).inject(0) { |sum, k| sum + a[i][k] * x[k] }\n x[i] = (a[i][n + 1] - sumatoria).fdiv(a[i][i])\n end\n\n puts \"Una solucion aproximada del sistema es X = #{x}\"\n return x\nend", "def arrayManipulation(n, queries)\r\n arr = Array.new(n, 0)\r\n\r\n queries.each do |query|\r\n left = query[0] - 1\r\n right = query[1] - 1\r\n summand = query[2]\r\n\r\n arr[(left..right)] = arr[(left..right)].map { |a| a + summand }\r\n end\r\n\r\n arr.max\r\nend", "def solution(a)\n s= a.sort\n 0.step(s.size - 1).inject(0) do |result, x|\n z= x+2\n (x+1).step(s.size - 1).inject(result) do |acc, y|\n z+=1 while z < s.size && s[x] + s[y] > s[z]\n acc += z-y-1\n end\n end\nend", "def largest_contiguous_subsum(arr) #BigO of O(n)\n max = 0 \n current_sum = 0\n arr.each_with_index do |el,idx|\n if current_sum + el >= el \n current_sum += el \n else \n current_sum = el \n end \n max = current_sum if current_sum > max \n end \n max\nend", "def solve(nums, target)\n nums.each_with_index do |e, i|\n nums.each_with_index do |e_, i_|\n return [i, i_] if ((e + e_ == target) && (i != i_))\n end\n end\nend", "def bad_contig_subsum(arr)\n # n! || n^3 ?\n sub_arrays = []\n arr.each_index do |i|\n (i...arr.length).each do |j|\n sub_arrays << arr[i..j]\n end\n end\n\n # above * n^2 ? << bottleneck\n max = sub_arrays.first.inject(&:+)\n sub_arrays.each do |sub_arr|\n sub_sum = sub_arr.inject(&:+)\n max = sub_sum if sub_sum > max\n end\n max\nend", "def solution(k, m, a)\n from = a.max\n to = a.inject(:+)\n min = from\n while from <= to\n mid = (from + to) / 2\n if check(mid, k, m, a)\n min = mid\n to = mid - 1\n else\n from = mid + 1\n end\n end\n min\nend", "def solution(a)\n n = a.size\n starting = Array.new(n, 0)\n ending = Array.new(n, 0)\n\n (1..n - 2).each {|i| starting[i] = [starting[i - 1] + a[i], 0].max}\n (1..n - 2).reverse_each {|i| ending[i] = [ending[i + 1] + a[i], 0].max}\n\n sum = 0\n (1..n - 2).each {|i| sum = [sum, starting[i - 1] + ending[i + 1]].max}\n sum\nend", "def arrayManipulation(n, queries)\n diffArr =[]\n for i in 0..n\n diffArr.push(0)\n end\n for j in queries\n diffArr[j[0]-1] += j[2]\n diffArr[j[1]] -= j[2]\n end\n max = 0\n sum = 0\n for k in diffArr\n sum += k\n max = [sum, max].max\n end\n return max\n\nend", "def solution(a)\n # write your code in Ruby 2.2\n seen = {}\n\n a.each do |number|\n seen[number] = true\n end\n\n max = a.max\n\n for i in 1..(max + 1)\n return i unless seen[i]\n end\n\n 1\nend", "def solution(a)\n # write your code in Ruby 2.2\n binding.pry\n trips = Hash.new {|h,k| h[k]=0}\n start = 0\n ending = 0\n min = nil\n a.each_with_index do |trip,i|\n ending = i\n\n if trips[trip] == 0\n min = ending - start\n end\n trips[trip] += 1\n\n while start < ending\n break if trips[a[start]] - 1 == 0\n trips[start] -= 1\n start += 1\n min = ending - start if ending-start < min\n end\n end\n min\nend", "def resolve\n\t\treturn 1 if @n == 0\n\t\trow = [1,1]\n\t\t2.upto(@n) do\n\t\t\tcurrent = [1]\t\t\t\n\t\t\t1.upto(row.size-1) do |i|\n\t\t\t\tcurrent << row[i-1] + row[i]\n\t\t\tend\n\t\t\tcurrent << 1\n\t\t\trow = current\n\t\tend\n\t\trow.inject(0) {|sum, n| sum + n*n}\n\tend", "def solution_dp_bu(p, n)\n dp = Array.new(n, MIN_INT)\n # we set p[0] and dp[0] to 0\n dp[0] = 0\n p = p.dup.unshift(0)\n\n (1..n).each do |i|\n dp[i] = (0..(i - 1)).reduce(MIN_INT) do |max, j|\n [max, dp[j] + p[i - j]].max\n end\n end\n\n dp.last\nend", "def solution(a)\n # write your code in Ruby 2.2\n n = a.length\n \n counter = Array.new(n+1, 0)\n \n a.each do |x|\n counter[x-1] += 1\n end\n \n return counter.index { |x| x == 0 } + 1\nend", "def merge_three_pointers_inplace(nums1, m, nums2, n)\n p1 = m - 1\n p2 = n - 1\n for p in (m+n-1).downto(0)\n if (nums1[p1] > nums2[p2] && p1 >=0 ) || p2 < 0\n nums1[p] = nums1[p1]\n p1 -= 1\n else\n nums1[p] = nums2[p2]\n p2 -= 1\n end\n end \nend", "def dbl_linear(n)\n result = [1] # base\n\n i = 0 # pointer for 2x + 1\n j = 0 # pointer for 3x + 1\n\n until result.size == n + 1 # because n is an index (size - 1)\n list1 = 2 * result[i] + 1\n list2 = 3 * result[j] + 1\n min = [list1, list2].min\n\n result << min\n\n i += 1 if min == list1\n j += 1 if min == list2\n end\n\n result.last\nend", "def fibonacci(n)\n return fib_helper([0, 1], 2, n)\n # if you'd like to test what i THINK is an O(1) space complexity solution.....\n # i did run this through the tests and it SHOULD work:\n # return faster_fib_helper([0, 1], 2, n)\nend", "def solution(a)\n n = a.size\n return 0 unless n > 2\n a.sort!\n\n (2..n - 1).each do |i|\n return 1 if a[i - 2] + a[i - 1] > a[i]\n end\n\n return 0\nend", "def test(arr)\n arr.map do |el|\n arr.inject(1) do |memo, el2|\n next memo if arr.index(el2) == arr.index(el)\n memo * el2\n end\n end\nend", "def productify(array)\n len = array.length\n left = Array.new(len){1}\n right = Array.new(len){1}\n\n # step 1 create left array and right array O(n)\n array.each_index do |i|\n next if i == 0\n left[i] = left[i - 1] * array[i - 1]\n right[len - i - 1] = right[len - 1] * array[len - i]\n end\n\n # step 2 multiply products O(n)\n array.each_index do |i|\n array[i] = left[i] * right[i]\n end\n\n # step 3 return results\n array\n\n # time complexity O(n + n) => O(n)\nend", "def solution(a)\n return 1 if a.empty?\n a.sort!\n return 1 if a.first > 1\n return a.first + 1 if a.length <2\n (0..(a.length)).each do |index|\n return a[index] + 1 if a[index] + 1 != a[index + 1]\n end\n return a.last + 1\nend", "def collisions(arr)\n new_arr = []\n result = []\n arr.each do |i|\n if i > 0\n new_arr << i\n else\n if new_arr.empty?\n result << i\n else\n if new_arr[-1] == -(i)\n new_arr.pop\n else\n while !new_arr.empty? && new_arr[-1] < -(i)\n new_arr.pop\n end\n if new_arr.empty?\n result << i\n end\n end\n end\n end\n end\n return (result.concat(new_arr))\nend", "def backtrack(nums, cur_array, result)\n if cur_array.size == nums.size\n result << cur_array.clone\n\n return\n end\n\n (0..nums.length - 1).each do |i|\n next if cur_array.include?(nums[i])\n\n cur_array << nums[i]\n\n backtrack(nums, cur_array, result)\n\n cur_array.pop\n end\nend", "def solution(a)\n return 0 if a.uniq.size != a.size\n \n max = a.size \n sum = (1 + max) * max / 2\n \n array_sum = a.inject(0, &:+) \n sum == array_sum ? 1 : 0 \nend", "def apply_solution array\n\n # Reverse the String to iterate right to left JUST because is easier :P\n index = find_small_neighbors array.reverse!\n \n return \"no answer\" unless index\n\n # Find rightmost successor to pivot in the suffix\n sec_index = array.index(array.slice(0..index).select{ |num| num > array[index] }.sort.first)\n # Swap with pivot\n array[index], array[sec_index] = array[sec_index], array[index]\n\n # Reverse the suffix REVERT rathern than sort\n solution = array.slice!(0..index-1).sort.join.reverse\n solution << array.join\n return solution.reverse\nend", "def solve2( n = 150_000_000 )\n # Brute force.\n sum = 10\n i = 20\n\n while i < n\n if 0 != i % 3\n i2 = i*i\n\n # Must verify that the primes are consecutive (i.e. there aren't any\n # primes hiding between entries).\n if (i2 + 1).miller_rabin? &&\n (i2 + 3).miller_rabin? &&\n (i2 + 7).miller_rabin? &&\n (i2 + 9).miller_rabin? &&\n !(i2 + 11).miller_rabin? &&\n (i2 + 13).miller_rabin? &&\n !(i2 + 17).miller_rabin? &&\n !(i2 + 19).miller_rabin? &&\n !(i2 + 21).miller_rabin? &&\n !(i2 + 23).miller_rabin? &&\n (i2 + 27).miller_rabin?\n \n sum += i\n i += 315410\n end\n end\n\n # From observation that 10 | a_n in similar sequences.\n i += 10\n end\n\n sum\n end", "def sluggish_octopus(array)\n array.each_with_index do |el,i|\n max_found = true\n array.each_with_index do |x,j|\n next if i == j\n max_found = false if el.length < x.length\n end\n return el if max_found == true\n end\nend", "def fast_lcss(arr)\n i_arr = []\n biggest = 0\n max_sub_arr = []\n arr.length.times do |x|\n arr.map do |ele1|\n i_arr += [ele1]\n sum = i_arr.inject(0) do |a, b|\n a + b\n end\n max_sub_arr = i_arr if sum > biggest\n biggest = sum if sum > biggest \n end\n i_arr = []\n arr.shift\n end\n max_sub_arr\nend", "def solution(a)\n a.sort!\n a.each_with_index do |element, index|\n return 0 if element != index + 1\n end\n 1\nend", "def better_solution(temps)\n result = []\n stack = []\n stack << [temps[0], 0]\n\n (1..temps.length - 1).each do |i|\n curr = temps[i]\n curr_index = i\n prev_temp, prev_index = stack.pop()\n\n if prev_temp == nil\n stack << [curr, curr_index]\n next\n end\n \n if curr < prev_temp \n stack << [prev_temp, prev_index]\n stack << [curr, curr_index]\n else\n while prev_temp != nil && prev_temp < curr\n result[prev_index] = curr_index - prev_index\n prev_temp, prev_index = stack.pop()\n end\n if prev_temp != nil\n stack << [prev_temp, prev_index]\n end\n stack << [curr, curr_index]\n end\n end\n\n prev_temp, prev_index = stack.pop()\n\n while prev_temp != nil\n result[prev_index] = 0\n prev_temp, prev_index = stack.pop()\n end\n result\nend", "def solve(array)\n results = [0] * (array.max + 1)\n\n array.each do |element|\n results[element] + 1\n end\n array.index(1)\nend", "def make_better_change(amount, coin_denoms)\n return [amount] if coin_denoms.include?(amount)\n return [] if amount <= 0\n\n coin_denoms.sort.reverse!\n all_possible_arr = []\n\n coin_denoms.each do |value|\n change_arr = []\n change_arr << value\n change_arr.concat(make_better_change(amount - value, coin_denoms))\n all_possible_arr << change_arr if change_arr.inject(:+) == amount\n end\n\n all_possible_arr.min_by { |arr| arr.length }\n\nend", "def solve( n = 16 )\n max = 0\n \n (1..10).each do |a|\n (1..10).each do |b|\n next if b == a\n (1..10).each do |c|\n next if c == b || c == a\n (1..10).each do |d|\n next if d == c || d == b || d == a\n (1..10).each do |e|\n next if e == d || e == c || e == b || e == a\n\n rotate = 3*[a, b, c, d, e].each_with_index.min[1]\n (1..10).each do |f|\n next if f == e || f == d || f == c || f == b || f == a\n (1..10).each do |g|\n next if g == f || g == e || g == d || g == c || g == b || g == a\n \n t = a + f + g\n (1..10).each do |h|\n next if h == g || h == f || h == e || h == d || h == c || h == b || h == a\n next unless t == b + g + h\n\n (1..10).each do |i|\n next if i == h || i == g || i == f || i == e || i == d || i == c || i == b || i == a\n next unless t == c + h + i\n\n (1..10).each do |j|\n next if j == i || j == h || j == g || j == f || j == e || j == d || j == c || j == b || j == a\n next unless t == d + i + j && t == e + j + f\n\n s = [a, f, g, b, g, h, c, h, i, d, i, j, e, j, f]\n rotate.times {s.push s.shift}\n\n s = s.join\n next if n != s.length\n\n max = [max, s.to_i].max\n end\n end\n end\n end\n end\n end\n end\n end\n end\n end\n\n max\n end", "def solution(a)\n first_sum = a[0]\n second_sum = a.inject(&:+) - a.first\n result = (first_sum - second_sum).abs\n\n a[1..-2].each do |elem|\n first_sum = first_sum + elem\n second_sum = second_sum - elem\n tmp_result = (first_sum - second_sum).abs\n result = tmp_result if tmp_result < result\n end\n\n result\nend", "def solution(x, a)\n count = 1\n indices = []\n while count <= x\n indices << a.find_index(count)\n count += 1\n end\n\n if indices.include?(nil)\n -1\n else\n indices.sort.last\n end\nend", "def move_zeros(array)\n zero_count = 0\n # O(n)\n array.each do |num|\n\n zero_count += 1 if num == 0\n end\n\n # O(n)\n array = array.select { |num| num != 0 }\n \n # O(1)\n zero_count.times do\n array += [0]\n end\n\n array\nend", "def find_duplicate_space(nums)\n # sort nums first (lgn), then check for dups by iterate over (n)\n last_seen = 0\n nums.sort!.each do |num|\n return num if last_seen == num\n last_seen = num\n end\nend", "def my_min(arr) # Find\n min = arr[0]\n\n arr.each do |el| # Go through array once O(n)\n min = el if el < min # update min while going through if found min\n end\n min\nend", "def josephus_survivor(n,k)\n result = 1\n for i in 1...n + 1\n result = (result + k - 1) % i + 1\n end\n \n result\nend", "def largest_contiguous_subsum_once(arr)\n largest_subsum = 0\n current = 0\n\n arr.each do |elm|\n current += elm\n if largest_subsum < current\n largest_subsum = current\n elsif current < 0\n current = 0 \n end \n end \n\n # (0...arr.count).each do |i|\n # current_subsum = (largest_subsum + arr[i])\n # if current_subsum > largest_subsum \n # largest_subsum = current_subsum \n # elsif current_subsum < 0 \n # largest_subsum = 0 \n # end\n # end \n\n largest_subsum \nend", "def equal(arr)\n size = arr.size\n hash = Hash.new{|h,k| h[k] = []}\n (0...size).each do |i|\n (i + 1...size - 1).each do |j|\n sum = arr[i] + arr[j]\n if hash.has_key?(sum)\n values = hash[sum]\n values << i\n values << j\n return values\n else\n hash[sum] = [i, j]\n end\n end\n end\nend", "def space_edition(input_array)\n lowest_range = 1\n highest_range = input_array.length - 1\n \n while (lowest_range < highest_range)\n \n mid = (lowest_range + highest_range) /2\n \n first_half_lowest_range = lowest_range\n first_half_highest_range = mid\n \n second_half_lowest_range = mid + 1\n second_half_highest_range = highest_range\n \n number_of_elements_in_first_half = 0\n input_array.each do |number|\n if number >= first_half_lowest_range && number <= first_half_highest_range \n number_of_elements_in_first_half += 1\n end\n \n number_of_unique_possibilities_in_first_half = first_half_highest_range - first_half_lowest_range + 1\n \n if number_of_elements_in_first_half > number_of_unique_possibilities_in_first_half\n lowest_range, highest_range = first_half_lowest_range, first_half_highest_range\n else\n lowest_range, highest_range = second_half_lowest_range, second_half_highest_range\n end\n end\n \n end\n\n return lowest_range\nend" ]
[ "0.63811857", "0.62854993", "0.6232834", "0.6165759", "0.61451924", "0.61238", "0.60595083", "0.6059027", "0.60275334", "0.60139996", "0.60075784", "0.5987782", "0.5978814", "0.5970351", "0.5968859", "0.59342283", "0.5913471", "0.590254", "0.5901931", "0.5894802", "0.5844339", "0.5839871", "0.5838203", "0.5822639", "0.58193475", "0.58133227", "0.5807727", "0.58061045", "0.5769497", "0.57604843", "0.5756312", "0.5754205", "0.57535195", "0.57523996", "0.5751222", "0.5747557", "0.5721386", "0.57204354", "0.57174486", "0.5714794", "0.5706749", "0.5700315", "0.56911945", "0.568799", "0.56825936", "0.56823075", "0.56725776", "0.5671997", "0.5657387", "0.56570077", "0.5650772", "0.5650095", "0.5645511", "0.56406945", "0.563475", "0.56346", "0.56339085", "0.56298786", "0.5623396", "0.5621743", "0.5619245", "0.5614548", "0.56104255", "0.56080425", "0.560763", "0.559987", "0.5599017", "0.55983853", "0.5598281", "0.5597716", "0.55850786", "0.5583527", "0.55823135", "0.5578492", "0.5571437", "0.5571417", "0.55664074", "0.55645895", "0.55628616", "0.55626386", "0.55594546", "0.55506146", "0.5540132", "0.5535754", "0.5535126", "0.55342424", "0.55331445", "0.552795", "0.5524515", "0.55244213", "0.55214113", "0.5521197", "0.5519152", "0.5519081", "0.55072004", "0.55028737", "0.54978555", "0.5497131", "0.54943806", "0.54936355", "0.5492665" ]
0.0
-1
O(n) time | O(1) psace
def sort_array_by_parrity(nums) even_misplaced = 0 odd_misplaced = 1 arr_len = nums.length while even_misplaced < nums.length && odd_misplaced < nums.length if nums[even_misplaced].even? even_misplaced += 2 elsif nums[odd_misplaced].odd? odd_misplaced += 2 else nums[even_misplaced] , nums[odd_misplaced] = nums[odd_misplaced], nums[even_misplaced] even_misplaced += 2 odd_misplaced += 2 end end nums end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_dublicate(array)\n sum = 1000000*(1000000+1)/2 # (n*(n+1))/2\n array.each do |el| \n sum -= el\n end\n return sum\nend", "def my_min_2(list)\r\n min = 0 # O(1)\r\n \r\n list.each do |ele| # O(n) \r\n if ele < min # O(1)\r\n min = ele # O(1)\r\n end\r\n end\r\n min # O(1) \r\nend", "def solution(a)\r\n n=a.size\r\n i=1\r\n for k in a.sort do\r\n\tif k!=i \r\n\t then \r\n\t return 0\r\n\t break;\r\n\tend\r\n i+=1;\r\n end\t\r\n return 1 if a.inject(:+) ==n*(n+1)/2;\r\nend", "def sorted_squares(nums)\n # This takes O(n)\n nums.map! { |num| num**2 }\n # This can take Ο(n logn)\n bubble_sort(nums)\nend", "def find_duplicate(nums)\n if !nums or nums.size == 0\n return nil\n else\n fast = nums[ 0 ]\n slow = nums[ 0 ]\n while true\n fast = nums[ fast ]\n fast = nums[ fast ]\n slow = nums[ slow ]\n if fast == slow\n new_node = nums[ 0 ]\n while new_node != slow\n new_node = nums[ new_node ]\n slow = nums[ slow ]\n end\n return slow\n end\n end\n end\nend", "def largest_subsum(list)\n max = list[0] # O(1)\n current_sum = list[0] # O(1)\n\n (1...list.length).each do |i| # O(n)\n # debugger\n if current_sum < 0 # O(1)\n current_sum = 0 # O(1)\n end \n current_sum += list[i] # O(1)\n if current_sum > max # O(1)\n max = current_sum # O(1)\n end\n end\n\n max # O(1)\n\nend", "def my_min(list) \n\n list.each_with_index do |ele, i| #O(n)\n compare_arr = list[0...i] + list[i+1..-1] # O(2n) \n return ele if compare_arr.all? { |ele2| ele < ele2 } #O(n)\n end\n\n #time complexity = O(n^2) + O(2n)\n\nend", "def my_min2 # O(n) time complexity\n smallest = self.first\n self.each do |num|\n sleep(1)\n smallest = num if num < smallest \n end\n smallest\n end", "def fibonacci(n)\n return fib_helper([0, 1], 2, n)\n # if you'd like to test what i THINK is an O(1) space complexity solution.....\n # i did run this through the tests and it SHOULD work:\n # return faster_fib_helper([0, 1], 2, n)\nend", "def my_min_2(array)#O(n)\n array.inject do |acc, ele|#O(n)\n if acc < ele\n acc\n else\n ele\n end\n end\nend", "def solution(m, a)\n n = a.count\n result = 0\n front = 0\n numbers = Array.new(m + 1, false)\n n.times { |back|\n while front < n and not numbers[a[front] - 1]\n numbers[a[front] - 1] = true\n front += 1\n result += front - back\n return 1_000_000_000 if result >= 1_000_000_000\n end\n numbers[a[back] - 1] = false\n }\n result\nend", "def josephus_survivor(n,k)\n arr = (1..n).to_a\n\n while arr.length > 1\n idx = k % arr.length\n\n if arr.length > k\n arr = arr.drop(k) + arr.take(k - 1)\n elsif arr.length == k \n arr = arr[0...-1]\n else\n arr = arr.drop(idx) + arr.take(idx - 1)\n end\n end\n \n arr[0]\nend", "def solution(a)\n # In production environment this will be my solution:\n # a.uniq.size\n #\n # But since this is a coding challenge, my assumption\n # is that you're looking for a by-hand O(N*logN) solution\n\n return 0 if a.empty?\n\n n = a.size\n ary = a.sort\n uniques = 1\n (1...n).each do |i|\n uniques += 1 if ary[i] != ary[i - 1]\n end\n uniques\nend", "def solve( n = 10_000 )\n (1..n).select {|i| i.amicable?}.reduce( :+ )\n end", "def my_min_2(arr)\n\n smallest_value = arr[0] # O(1)\n\n arr.each do |ele1| # [ 0, 3, 5, 4, -5, 10, 1, 90 ] O(n)\n smallest_value = ele1 if ele1 <= smallest_value #O(1)\n end\n\n smallest_value #O(1)\n\nend", "def largest_contiguous_subsum_2(list)# [2, 3, -6, 7, -6, 7]\n largest_num = list[0]#2 O(1)\n running_sum = list[0]#2 - 5 after entering loop. O(1)\n\n (1...list.length).each do |i| #O(n) \n running_sum = 0 if running_sum < 0 #O(1)\n running_sum += list[i] #O(1)\n largest_num = running_sum if running_sum > largest_num #O(1)\n end\n return largest_num #O(1)\nend", "def okay_two_sum?(arr, target)\n arr = arr.sort #n log n\n (0...arr.length).each do |i| #n\n search = bsearch(arr, target-arr[i]) # log n\n return true unless search.nil?\n end #n log n\n false\nend", "def third_anagram?(str1, str2)\n beginning_time = Time.now\n str1.split(\"\").sort == str2.split(\"\").sort #O(nlogn)\n \"Time complexity of first_anagram: #{(Time.now - beginning_time)}\"\nend", "def fast_hash_additive_find(arr, target)\n lookup_table = Hash.new\n\n arr.each do |element|\n return true if lookup_table[target - element]\n if lookup_table[element]\n lookup_table[element] += 1\n else\n lookup_table[element] = 1\n end\n end\n\n return false\n end", "def solution(a)\n n = a.size\n passing_cars = 0\n\n suffix_sums = Array.new(n + 1, 0)\n\n a.reverse.each_with_index do |elem, i|\n suffix_sums[i + 1] = suffix_sums[i] + elem\n end\n suffix_sums.reverse!\n\n a.each_with_index do |car, i|\n if car == 0\n passing_cars += suffix_sums[i]\n end\n end\n\n passing_cars > 1_000_000_000 ? -1 : passing_cars\nend", "def solution(a)\n len = a.size\n unique = {}\n i = 0\n while i < len\n item = a[i]\n if unique.has_key?(item)\n unique[item] += 1\n else\n unique[item] = 1\n end\n i += 1\n end\n pairs = 0\n unique.each do |key,count|\n (1...count).step {|n| pairs += n }\n end\n return pairs > 1_000_000_000 ? 1_000_000_000 : pairs\nend", "def cache_intersection2(nums1, nums2)\n outer_cache = {}\n nums1.each do |n|\n next if outer_cache[n]\n outer_cache[n] = true\n end\n array = []\n inner_cache = {}\n nums2.each do |n|\n next if inner_cache[n]\n array << n if outer_cache[n]\n inner_cache[n] = true\n end\n array\nend", "def o1\n hasher = {}\n (0...@n).each do |n|\n sym = n.to_s.to_sym\n hasher[sym] = n\n end\n\n print_header('O(1) examples')\n\n hash_count = hasher.count\n do_benchmark(\"O(1) - Hash with #{hash_count} items\") do\n hasher[hash_count.to_s.to_sym]\n end\n\n self\n end", "def canBeSum(n, array, cache)\n\ti = 0\n\twhile array[i] <= n / 2\n\t\tif cache[n-array[i]] # array.include?(n-array[i]) is OK, but very slow\n\t\t\treturn true\n\t\tend\n\n\t\ti += 1\n\tend\n\n\treturn false\nend", "def sub_sum(list)\n sub_arr = []\n (0...list.length).each do |i| #O(n)\n (i...list.length).each do |j| #O(n)\n sub_arr << list[i..j] if i <= j\n end\n end\n largest_continuous_sub_sum1(sub_arr)\nend", "def find_duplicate_space(nums)\n # sort nums first (lgn), then check for dups by iterate over (n)\n last_seen = 0\n nums.sort!.each do |num|\n return num if last_seen == num\n last_seen = num\n end\nend", "def josephus_survivor(n,k)\n result = 1\n for i in 1...n + 1\n result = (result + k - 1) % i + 1\n end\n \n result\nend", "def stones(n, a, b)\n ar=[0]\n (n-1).times do |val|\n tmp=[]\n ar.each do |v|\n tmp << v+a if !tmp.include?(v+a)\n tmp << v+b if !tmp.include?(v+b)\n end\n ar=tmp\n end\n ar.sort\nend", "def fifth_anagram?(word1, word2) # O(n)\n \n p \"Running fifth_anagram...\" \n\n start = Time.now\n \n hash1 = Hash.new(0)\n # hash2 = Hash.new(0)\n\n word1.each_char {|char| hash1[char] += 1}\n word2.each_char {|char| hash1[char] += 1}\n\n hash1.values.all? {|v| v.even?}\n\n\n # puts \"Took #{Time.now - start} seconds\"\n\n \nend", "def solution_slow_2(n, p, q)\n sieve = sieve_of_erathosteneses(n)\n # puts \"sieve:#{sieve}\"\n semi = semiprimes(n, sieve)\n # puts \"sp:#{semi}\"\n prefix = [0,0,0,0,1]\n 5.upto(n) do |x|\n if semi.include? x \n prefix << prefix.last + 1\n else\n prefix << prefix.last\n end\n end\n # puts \"prefix:#{prefix}\"\n\n queries = [p,q].transpose\n\n\n res = queries.map do |query|\n prefix[query.last] - prefix[query.first - 1]\n end\n\n # puts \"res:#{res}\"\n\n res\n end", "def find_amicables(n)\n pairs = []\n sum = 0\n for i in 0..n do \n next if pairs.include? i\n d = sum_proper_divisors(i)\n next if d == i\n p = sum_proper_divisors(d)\n if p == i \n pairs << d\n pairs << i\n sum += d + i\n end\n end\n return sum\nend", "def amicable_numbers(n)\r\n numbers = Array.new\r\n 2.upto(n) do |x|\r\n y = d(x)\r\n if !numbers.include?(y)\r\n numbers.push(x,y) if d(y) == x && y != x\r\n end\r\n end\r\n return numbers\r\nend", "def hash_two_sum(arr,target_sum)\n #creates a new hash with each element that is satisfying the target_sum\n hash = Hash.new(0) #{|h,k| h[k] = []}\n (0...arr.length).each { |i| hash[i] = arr[i]} #O(n)\nend", "def seesaw?(arr)\n left_sum = 0\n arr.each_index do |i| #O(n)\n if i > 0\n left_sum = arr[0...i].reduce(:+) #O(n)\n end\n if i < arr.size-1\n right_sum = arr[i+1..-1].reduce(:+); #O(n)\n else\n right_sum = 0\n end\n if left_sum == right_sum\n return true\n end\n end\n return false\nend", "def intersect nums1, nums2\n result = []\n return result if nums1.size == 0 or nums2.size == 0\n\n counter_cache = {}\n counter_cache = nums1.inject({}) { |result, n|\n result[n] ||= 0\n result[n] += 1\n result\n }\n\n nums2.each do |n|\n if counter_cache[n] and counter_cache[n] > 0\n result << n\n counter_cache[n] -= 1\n end\n end\n result\nend", "def solution(a)\n n = a.size\n return 0 unless n > 2\n a.sort!\n\n (2..n - 1).each do |i|\n return 1 if a[i - 2] + a[i - 1] > a[i]\n end\n\n return 0\nend", "def two_sum?(array, target)\n #O(n)\n hash = Hash.new(0)\n i = 1\n array.each do |ele|\n hash[ele] = i \n i += 1\n end\n hash.each_key do |k|\n return true if hash.has_key?(target - k) && hash[k] != hash[target - k]\n end\n false \nend", "def efficient_contiguous_subsum(list)\n current_sum = list[0] #0\n largest_sum = list[0] #5\n # debugger\n (1...list.length).each do |i| \n if current_sum + list[i] > 0 \n current_sum += list[i] \n largest_sum = current_sum if current_sum > largest_sum\n else \n current_sum = 0\n end \n end \n largest_sum\nend", "def solution(a)\n n = a.size\n a.sort!\n\n count = 0\n for i in 0...n-2 do\n k = i+2\n for j in i+1...n-1 do\n while k < n and a[i] + a[j] > a[k] do\n k += 1\n end\n count += k - j - 1\n end\n end\n count\nend", "def my_min(arr) # Find\n min = arr[0]\n\n arr.each do |el| # Go through array once O(n)\n min = el if el < min # update min while going through if found min\n end\n min\nend", "def three_sum_fastest(arr)\n count = 0\n\n (0..arr.length - 2).each { |i|\n set = Set.new\n\n (i + 1..arr.length - 1).each { |j|\n if set.include?(-arr[i] - arr[j])\n count += 1\n end\n\n set.add(arr[j])\n }\n }\n count\nend", "def my_min_2(nums) # O(n)\n smallest = 0\n nums.each do |num|\n smallest = num if num < smallest\n end\n smallest\nend", "def arrayManipulation(n, queries)\n nums = Array.new(n+1, 0)\n queries.each do |query|\n nums[query[0]-1] += query[2]\n nums[query[1]] -= query[2]\n end\n\n max = nums.first\n (1..nums.length-1).each do |i|\n nums[i] += nums[i - 1]\n max = nums[i] if nums[i] > max && i < (nums.size - 1)\n end\n\n max\nend", "def second_anagram?(word_1, word_2) #O(n^2)\n matching_word = word_2.split(\"\")\n\n word_1.each_char do |ele|\n if matching_word.index(ele) #evaluating the conditional\n matching_word.delete_at(matching_word.index(ele)) #n many times, do this\n end\n end\n\n matching_word.empty? #constant O(1)\nend", "def move_zeros(array)\n zero_count = 0\n # O(n)\n array.each do |num|\n\n zero_count += 1 if num == 0\n end\n\n # O(n)\n array = array.select { |num| num != 0 }\n \n # O(1)\n zero_count.times do\n array += [0]\n end\n\n array\nend", "def largest_contiguous_subsum_1(list) \n subs = [] #O(1)\n (0...list.length).each do |start_num| #O(n)\n (start_num...list.length).each do |end_num| #O(n)\n subs << list[start_num..end_num] #O(n)\n end\n end\n subs_sum = [] #O(1)\n subs.each do |sub| #O(n**2)\n sub_sum = 0 #O(1)\n sub.each {|s| sub_sum += s} #O(n)\n subs_sum << sub_sum #O(1)\n end\n subs_sum.inject do |acc,el| #O(n)\n if acc > el #O(1)\n acc #O(1)\n else\n el #O(1)\n end\n end\n end", "def second_anagram?(word1, word2)\n p \"Running second_anagram?...\" \n\n start = Time.now\n word2 = word2.split(\"\") #O(n)\n word1.each_char do |char| #O(n)\n char_index = word2.index(char) #O(n)\n if char_index.nil? #O(1)\n return false #O(1)\n else\n word2.delete_at(char_index) #O(1)\n end\n end\n word2.empty? #O(1)\n p \"Took #{Time.now - start} seconds\"\nend", "def naive(array)\n max = -10000\n for i in (0..array.length - 1)\n for j in (i..array.length - 1)\n total = array[i..j].inject { |m,k| m + k }\n max = total if total > max\n end\n end\n max\nend", "def three_sum_fast(arr)\n arr = merge_sort(arr)\n count = 0\n\n (0..arr.length - 1).each { |i|\n (i + 1..arr.length - 1).each { |j|\n if bin_search(arr, -arr[i] - arr[j]) > j\n count += 1\n end\n }\n }\n count\nend", "def dp_possible_trees(n)\n array = Array.new(n+2) { Array.new(n+1) { 0 } }\n (0...n+2).to_a.each do |i|\n array[i][0] = 1\n end\n\n sum = 0\n (1...n+1).to_a.each do |i|\n sum = 0\n (1..i).to_a.each do |j|\n array[j][i] = array[n+1][i-j] * array[n+1][j-1]\n sum += array[j][i]\n end\n array[n+1][i] = sum\n end\n array[n+1].last\nend", "def largest_contiguous_subsum(arr) #BigO of O(n)\n max = 0 \n current_sum = 0\n arr.each_with_index do |el,idx|\n if current_sum + el >= el \n current_sum += el \n else \n current_sum = el \n end \n max = current_sum if current_sum > max \n end \n max\nend", "def fourth_anagram?(str1, str2)\n hash1 = Hash.new(0)#O(1)\n beginning_time = Time.now\n str1.each_char {|char| hash1[char]+=1}#O(n)\n str2.each_char {|char| hash1[char]-=1}#O(n)\n hash1.all? {|_, v| v.zero?}#O(n)\n \"Time complexity of first_anagram: #{(Time.now - beginning_time)}\"\nend", "def unique_items(arr) #O(n)\n hash = Hash.new(0)\n results = []\n arr.each do |el|\n hash[el] += 1\n end\n hash.select { |k, v| k if v == 1 }.keys\nend", "def p(n)\r\n (return @ps[n]) if @ps[n]\r\n\r\n sum = 0\r\n @pk.each_with_index do |k, i|\r\n if k > n\r\n break\r\n end\r\n sign = ( i % 4 <= 1 ? 1 : -1)\r\n sum += sign * p( n - k )\r\n sum %= 1_000_000 #keep it under control\r\n end\r\n @ps[n] = sum\r\n return sum\r\n end", "def my_min1(arr)\n arr.each do |el1| #O(n)\n if arr.all? {|el2| el1 <= el2 } #O(n + 1)\n return el1\n end\n end \nend", "def largest_contiguous_subsum_fast(list)\n start = Time.now\n max_sum = list[0]\n cur_sum = list[0]\n list[1..-1].each do |el|\n if el >= cur_sum && cur_sum < 0\n cur_sum = el\n else\n cur_sum += el\n end\n max_sum = cur_sum if cur_sum > max_sum\n end\n finish = Time.now\n puts \"Runtime: #{finish - start}\"\n return max_sum\nend", "def okay_two_sum?(arr, target)\n sorted = arr.sort # n log n => quicksort => is nlogn DOMINANT\n sorted.each_with_index do |num, i| # => O(n)\n # return true if sorted[i] + sorted[-1 - i] == target\n return true if sorted[i + 1 .. - 1].bsearch {|number| target - num <=> number} # => O(log(n))\n # ASK TA ABOUT BSEARCH\n # bsearch {|ele| pivot <=> ele}\n end\n false\nend", "def running_time(array)\n cnt = 0\n (1...(array.length)).each do |x|\n y = x\n while y.positive?\n break unless array[y - 1] > array[y]\n\n temp_num = array[y]\n array[y] = array[y - 1]\n array[y - 1] = temp_num\n cnt += 1\n y -= 1\n end\n end\n cnt\nend", "def my_min_2(arr) #O(N)\n min_num = arr.first\n \n arr.each { |num| min_num = num if num < min_num }\n \n min_num\n end", "def largest_contiguous_subsum2(list)\n # O(N) ==> Time\n # O(1) ==> Space\n largest = list.first\n curr = list.first\n\n len = list.length\n (1...len).each do |i|\n curr = 0 if curr < 0 \n curr += list[i]\n largest = curr if curr > largest\n end\n largest\nend", "def find_unique(array)\n unique_id = 0\n\n array.each do |num|\n unique_id ^= num\n end\n\n unique_id\nend", "def linear_search(n)\n\t(1..100).to_a.shuffle.each do |x|\n\t\tif x == n\n\t\t\tbreak\n\t\tend\n\tend\nend", "def equal(arr)\n size = arr.size\n hash = Hash.new{|h,k| h[k] = []}\n (0...size).each do |i|\n (i + 1...size - 1).each do |j|\n sum = arr[i] + arr[j]\n if hash.has_key?(sum)\n values = hash[sum]\n values << i\n values << j\n return values\n else\n hash[sum] = [i, j]\n end\n end\n end\nend", "def find_it(seq)\n uniqueInts=seq.uniq\n\n uniqueInts.each do |value|\n k=0\n seq.each do |mainSeq|\n k+=1 if mainSeq==value\n end\n return value if k%2==1\n end\nend", "def cache_intersection(nums1, nums2)\n array = []\n outer_cache = {}\n inner_cache = {}\n nums1.each do |outer|\n next if outer_cache[outer]\n outer_cache[outer] = true\n nums2.each do |inner| \n next if inner_cache[inner]\n if outer == inner \n array << inner\n inner_cache[inner] = true\n end\n end\n end\n array\nend", "def my_min(arr)\n l = arr.length - 1 # constant\n # min = 0 # is this more efficient than swapping? \n (0...l).each do |i| # n times1\n if arr[i] < arr[i+1] # 1\n arr[i], arr[i+1] = arr[i+1], arr[i] # 1\n end\n end\n\n arr.last # 1\nend", "def main\n\n sum = 0\n\n (0..999).each do |i|\n sum += check(i)\n end\n\n puts \"Total - O(n) #{sum}\"\n\n # Needed to refresh following: https://en.wikipedia.org/wiki/Arithmetic_progression\n sum2 = sum_multiples(3, 1000) + sum_multiples(5, 1000) - sum_multiples(15, 1000)\n\n # Refreshed Big O too : http://stackoverflow.com/questions/487258/plain-english-explanation-of-big-o \n puts \"Total - O(1) #{sum2}\"\n\nend", "def compute_cache\n\n\t\t# cache of equality will be stored on @equals\n\t\t# we store if a number if equal to the successor\n\t\t@equals = Array.new( @sequence.size )\n\n\t\t# for every number on the list\n\t\ti = 0\n\t\t@sequence.reduce do |left,right|\n\n\t\t\t# We compute and store the equality\n\t\t\t@equals[i] = ( left === right )\n\n\t\t\t# next number!!!\n\t\t\ti += 1\n\n\t\t\t# we return right to continue the reduce\n\t\t\tright\n\t\tend\n\n\t\t# The last number is NOT equal to the successor\n\t\t@equals[ i ] = false\n\tend", "def largest_contiguous_subsum1(list)\n p Time.now\n sub_arrays = []\n list.each_index do |i|\n list.each_index do |j|\n next if j < i\n sub_arrays << list[i..j]\n end\n end\n sub_arrays.map{|numbers| numbers.inject(:+)}.max\n p Time.now\nend", "def answer(n, a)\n count = 0\n n.times do |nn|\n next if a[nn] != nn + 1\n a[nn], a[nn + 1] = a[nn + 1], a[nn]\n count += 1\n end\n count\nend", "def slow_dance(tile, array)\n array.each_with_index do |el, i|\n return i if el == tile\n end\nend", "def fds(n)\n\n # arr = []\n # (n + 1).times.each{|e| arr << e if e > 0}\n # arr.flat_map.reduce(:*)\n # arr.flat_map.reduce(:*).to_s.split(//).map(&:to_i).reduce(:+)\n (1..n).to_a.flat_map.reduce(:*).to_s.split(//).map(&:to_i).reduce(:+)\n\nend", "def my_min_v2(arr) # O(n)\n num = arr[0]\n arr.each { |int| num = int if int < num }\n num\nend", "def my_min(array) # O(n) - Linear\n counter = array[0]\n\n (1...array.length).each do |i|\n if counter > array[i]\n counter = array[i]\n end\n end\n counter\nend", "def largest_cont_subsum_fast(list)\n # for constant size to be true, you cant create any variables\n # whose memory size depends on the size of the input\n curr_sum = list[0]\n largest_sum = list[0]\n\n # we know there are n^2 potential, so if we ever check all of them\n # it must be n^2\n\n # there must be a way to find the max without checking every subarray\n list[1..-1].each do |ele|\n # debugger\n if curr_sum > largest_sum\n largest_sum = curr_sum\n end\n\n if curr_sum < 0\n curr_sum = 0\n end\n\n curr_sum += ele\n\n end\n\n # debugger\n return [largest_sum, curr_sum].max\n\nend", "def cat_compatibility_algorithm(all_cats)\n puts \"Assessing cats...\"\n \n before_assessment_time = Time.now\n all_cats.each { |cat| cat.assess } #=> O(n)\n \n puts \"Catssessments completed in #{(Time.now - before_assessment_time)}s\"\n \n puts \"Comparing cats...\"\n before_compare_time = Time.now\n all_cats.each_with_index do |cat_1, i|\n all_cats.drop(i + 1).each do |cat_2|\n next if cat2 == cat1 #=> O(n*(n-1)/2) O(n^2/2-n/2) O(n^2)\n cat_1.compare(cat_2)\n end\n end #=> O(n^2)\n [1,2,3,4]\n\n \n puts \"Cat comparisons completed in #{(Time.now - before_compare_time)}s\"\n end", "def solve( n = 100 )\n n.partition_sieve[-1] - 1\n end", "def two_sum?(arr, target_sum) # O(N)\n hash = Hash.new(0)\n count = Hash.new(0)\n\n arr.each do |num|\n hash[num] = target_sum - num\n count[num] += 1\n end\n\n hash.each do |key, value|\n if hash.has_key?(value) \n if key == value \n if count[value] > 1\n return true\n end\n else\n return true\n end\n end\n end\n\n false\nend", "def solution(a)\n # write your code in Ruby 2.2\n seen = {}\n\n a.each do |number|\n seen[number] = true\n end\n\n max = a.max\n\n for i in 1..(max + 1)\n return i unless seen[i]\n end\n\n 1\nend", "def tdist(n, t); p_t(n, t); end", "def solution(a)\n counter = Hash.new(0)\n a.each do |elem|\n counter[elem] += 1\n end\n\n (1..a.size).each do |number|\n return 0 if counter[number] != 1\n end\n\n 1\nend", "def mutateTheArray(n, a)\n prv = 0\n (0...a.size).each do |i|\n nxt = i < (a.size - 1) ? a[i+1] : 0\n tmp = a[i]\n a[i] += nxt + prv\n prv = tmp\n end\n a\nend", "def lAS(n: 0)\n array = [1]\n puts \"#{array.inspect}\"\n previous = array.first\n new_array = []\n counter = 0\n \n n.times do\n previous = array.first\n counter = 0\n new_array = []\n \n array.each do |element|\n if(element == previous)\n counter = counter + 1\n else\n new_array << counter\n new_array << previous\n counter = 1\n previous = element\n end\n end\n \n new_array << counter\n new_array << previous\n array = new_array.dup\n puts \"#{array.inspect}\"\n end\nend", "def boustrophedon_at(k,n)\n raise ArgumentError.new \"k must be < size\" unless k < size\n raise ArgumentError.new \"n must be < size\" unless n < size\n return 0 if n < 0 || k < n\n @b_cache ||= []\n @b_cache[k] ||= []\n\n @b_cache[k][n] ||= if k==0\n self[k]\n else\n boustrophedon_at(k,n-1) + boustrophedon_at(k-1,k-n)\n end\n end", "def solution(a)\n accessed = Array.new(a.size + 1, nil)\n caterpillar_back = 0\n count = 0\n\n a.each_with_index do |x, caterpillar_front|\n if accessed[x] == nil\n accessed[x] = caterpillar_front\n else\n new_caterpillar_back = accessed[x] + 1\n first_part_size = caterpillar_front - caterpillar_back\n second_part_size = caterpillar_front - new_caterpillar_back\n count += first_part_size * (first_part_size + 1) / 2\n count -= (second_part_size) * (second_part_size + 1) / 2\n caterpillar_back.upto(new_caterpillar_back - 1) { |n| accessed[a[n]] = nil}\n accessed[x] = caterpillar_front\n caterpillar_back = new_caterpillar_back\n end\n end\n\n remaining_size = a.size - caterpillar_back\n count += (remaining_size) * (remaining_size + 1) / 2\n end", "def solve2( n = 150_000_000 )\n # Brute force.\n sum = 10\n i = 20\n\n while i < n\n if 0 != i % 3\n i2 = i*i\n\n # Must verify that the primes are consecutive (i.e. there aren't any\n # primes hiding between entries).\n if (i2 + 1).miller_rabin? &&\n (i2 + 3).miller_rabin? &&\n (i2 + 7).miller_rabin? &&\n (i2 + 9).miller_rabin? &&\n !(i2 + 11).miller_rabin? &&\n (i2 + 13).miller_rabin? &&\n !(i2 + 17).miller_rabin? &&\n !(i2 + 19).miller_rabin? &&\n !(i2 + 21).miller_rabin? &&\n !(i2 + 23).miller_rabin? &&\n (i2 + 27).miller_rabin?\n \n sum += i\n i += 315410\n end\n end\n\n # From observation that 10 | a_n in similar sequences.\n i += 10\n end\n\n sum\n end", "def two_sum_v3?(arr, target) \n hash = Hash.new\n arr.each { |ele| hash[ele] = ele } #o(n)\n arr.each do |ele| #o(n)\n search_value = target - ele\n return true if !hash[search_value].nil? && hash[search_value] != ele\n end\n false\nend", "def better_sum1(arr, target) # this one is going to return true or false\n pairs = Set.new\n\n arr.each do |ele|\n if pairs.include?(ele)\n return true\n else\n pairs << target - ele\n end\n end\n false\nend", "def bigSorting(unsorted)\n\nend", "def fast\n ARRAY.bsearch { |num| num > 80_000_000 }\nend", "def solution(a)\n result = 0\n tmp_count = 0\n a.each_with_index do |val, idx|\n if val.zero?\n tmp_count += 1\n else\n result += tmp_count\n end\n end\n return result > 1000000000 ? -1 : result\nend", "def solution(a)\n # write your code in Ruby 2.2\n n = a.length\n \n counter = Array.new(n+1, 0)\n \n a.each do |x|\n counter[x-1] += 1\n end\n \n return counter.index { |x| x == 0 } + 1\nend", "def solution(a)\n return 1 if a.empty?\n a.sort!\n return 1 if a.first > 1\n return a.first + 1 if a.length <2\n (0..(a.length)).each do |index|\n return a[index] + 1 if a[index] + 1 != a[index + 1]\n end\n return a.last + 1\nend", "def n_naught_brute_vs_recursive(a)\n time_brute = Benchmark.realtime { brute_force_maximum_subarray(a) }\n time_recursive = Benchmark.realtime { maximum_subarray(a, 0, a.length - 1) }\n\n while time_brute < time_recursive do\n a << a.sample\n time_brute = Benchmark.realtime { brute_force_maximum_subarray(a) }\n time_recursive = Benchmark.realtime { maximum_subarray(a, 0, a.length - 1) }\n end\n\n result = a.length\nend", "def test(arr)\n arr.map do |el|\n arr.inject(1) do |memo, el2|\n next memo if arr.index(el2) == arr.index(el)\n memo * el2\n end\n end\nend", "def solution(a)\n # write your code in Ruby 2.2\n num_of_elements=a.length\n num_of_zeros=0\n tot_num_car_pairs=0\n a.each do |element|\n if element == 0\n num_of_zeros+=1\n else\n tot_num_car_pairs+=num_of_zeros\n end\n end\n return tot_num_car_pairs>1_000_000_000?-1:tot_num_car_pairs\nend", "def solution(a)\n a.uniq.count\nend", "def anagram4(str1, str2)\n count = Hash.new(0) #O(1)\n \n str1.each_char do |char| #O(n)\n count[char] += 1 #O(1)\n end\n\n str2.each_char do |char| #O(n)\n count[char] -= 1 #O(1)\n end\n\n # count.values.uniq.length == 1\n count.values.each do |v| #O(n)\n return false if v > 0\n end\n true\nend", "def find_missing(array, n)\n i = 0\n\n (1..n).each { |number| i = i ^ number }\n array.each { |number| i = i ^ number }\n\n i\nend", "def seesaw2?(arr)\n left_sum = 0\n right_sum = arr.size > 1 ? arr[1..-1].reduce(:+) : 0\n\n arr.each_index do |i| #O(n)\n return true if left_sum == right_sum\n left_sum += arr[i]\n i < arr.size-1 ? right_sum -= arr[i+1] : right_sum = 0\n end\n return false\nend", "def unique_paths(m, n, cache = {})\n return 0 if m < 0 || n < 0\n return 1 if m == 1 || n == 1\n\n result = (cache[[m - 1, n]] || unique_paths(m - 1, n, cache)) + (cache[[m, n - 1]] || unique_paths(m, n -1, cache))\n cache[[m, n]] = result\n result\nend" ]
[ "0.67800605", "0.64266706", "0.6130893", "0.603541", "0.5995231", "0.59760404", "0.59662724", "0.5959182", "0.5955157", "0.59153235", "0.5779115", "0.5754146", "0.5723721", "0.5719918", "0.567288", "0.56585014", "0.5654644", "0.5649943", "0.562785", "0.56263036", "0.5622015", "0.56083405", "0.55904496", "0.5590367", "0.5582023", "0.5577243", "0.5575059", "0.5570997", "0.556147", "0.5560223", "0.55599594", "0.5536575", "0.553613", "0.55330837", "0.55163026", "0.5512008", "0.5496848", "0.5490344", "0.5487682", "0.54859537", "0.54740614", "0.5464966", "0.54509366", "0.54481936", "0.5434473", "0.54310703", "0.5429642", "0.5427396", "0.54209924", "0.54151076", "0.5404576", "0.54042137", "0.5397164", "0.53970987", "0.539334", "0.5391789", "0.5390572", "0.5388719", "0.53878045", "0.53869706", "0.5385702", "0.5382838", "0.53823876", "0.5380936", "0.53710556", "0.53706014", "0.5365004", "0.5362699", "0.53622353", "0.53620857", "0.53587896", "0.53584486", "0.53437346", "0.53425705", "0.53404266", "0.5334573", "0.5332405", "0.53292656", "0.532801", "0.53270197", "0.5324383", "0.53110206", "0.53098696", "0.53087336", "0.53043664", "0.5302513", "0.52994704", "0.52979857", "0.52905005", "0.5289528", "0.528848", "0.5287243", "0.5286809", "0.52867347", "0.52825874", "0.52802354", "0.5275982", "0.52746737", "0.5271257", "0.5269998", "0.52698594" ]
0.0
-1
Checks whether auto validations are currently disabled (see +disable_auto_validations+ method that takes a block)
def disabled_auto_validations? @disable_auto_validations || false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def without_auto_validations\n previous, @disable_auto_validations = @disable_auto_validations, true\n yield\n ensure\n @disable_auto_validations = previous\n self\n end", "def run_validations\n true\n end", "def perform_validation?\n self.skip_validation == true ? false : true\n end", "def skip_validations\n true\n end", "def enable_validations\n include ActiveModel::Validations unless respond_to?(:_validators)\n end", "def auto_validate_presence?\n @auto_validate_presence\n end", "def validate_hand_off(options = {})\n # Return true until we add validation\n true\n end", "def supports_validations?\n true\n end", "def should_validate\n validation_trigger\n end", "def check_validity!\n # nothing\n end", "def has_validations?()\n validator.has_validations?\n end", "def error_on_disabled?\n false\n end", "def validate!\n true\n end", "def supports_validate_constraints?\n false\n end", "def supports_validate_constraints?\n false\n end", "def _valid?(opts)\n return errors.empty? if frozen?\n errors.clear\n called = false\n skip_validate = opts[:validate] == false\n around_validation do\n called = true\n before_validation\n validate unless skip_validate\n after_validation\n end\n\n return true if skip_validate\n\n if called\n errors.empty?\n else\n raise_hook_failure(:around_validation)\n end\n end", "def valid?\n run_validations unless validated?\n failed_validators.list.empty?\n end", "def validators_for?(attribute)\n !validators_for(attribute).empty?\n end", "def patch_valid?\n validate(false).empty?\n end", "def check_valid?\n self.validating = true\n\n begin\n res = !marked_invalid? && valid?\n rescue StandardError => e\n errors.add 'unexpected error', e.message\n res = false\n end\n self.validating = false\n res\n end", "def _valid?(opts)\n return errors.empty? if frozen?\n errors.clear\n called = false\n # skip_validate = opts[:validate] == false # SEQUEL5\n around_validation do\n called = true\n if before_validation == false\n Sequel::Deprecation.deprecate(\"Having before_validation return false to mark the object as invalid\", \"Instead, call cancel_action inside before_validation\")\n raise_hook_failure(:before_validation)\n else\n validate # unless skip_validate # SEQUEL5\n after_validation\n end\n end\n # return true if skip_validate # SEQUEL5\n if called\n errors.empty?\n else\n raise_hook_failure(:around_validation)\n end\n end", "def auto_validate_types?\n @auto_validate_types\n end", "def supports_check_constraints?\n false\n end", "def valid_without_global?\n valid?\n end", "def validate!\n\t\t\t\treturn true\n\t\t\tend", "def force_validations!\n valid_associated_activity_logs.each(&:force_option_config_parse)\n associated_dynamic_models.each(&:force_option_config_parse)\n associated_external_identifiers.each(&:force_option_config_parse)\n end", "def validate\r\n validate! rescue false\r\n end", "def valid?\n reset_errors\n valid_date?\n valid_user?\n valid_activity_type?\n self.errors.empty?\n end", "def validate\n self.class.validations.each do |(method, args, opts)|\n send(method, *args) if !opts[:if] || instance_exec(&opts[:if])\n end\n end", "def validation(&validation_block)\n raise HullValidationMethods::NoValidationBlockGiven if !block_given?\n errors.clear\n begin\n yield validation_block\n rescue HullValidationMethods::ValidationError\n return false\n end\n self.errors.empty?\n end", "def absence_validator?\n validators&.any? do |validator|\n validator.is_a? ActiveRecord::Validations::AbsenceValidator\n end\n end", "def validating?\n @validating\n end", "def validate\n true\n end", "def defer_validation(&block)\n #p [:defer_validation, self.validation_on, @this]\n old_validation = self.validation_on\n self.validation_on = false\n v = nil\n begin\n v = @this.instance_eval(&block)\n ensure\n self.validation_on = old_validation\n end\n @this.validate!(false)\n v\n end", "def has_validations?\n !contents.detect(&:has_validations?).blank?\n end", "def validate!\n # pass\n end", "def valid?\n self.errors = Mongomatic::Errors.new\n do_callback(:before_validate)\n check_required_fields\n validate\n do_callback(:after_validate)\n self.errors.empty?\n end", "def validate\n @invalid=false\n end", "def passes_validations?\n return true if skip_validations\n result = true\n pages.each do |page|\n result = false unless page.passes_validations?\n end\n result\n end", "def validate?\n !@valid.nil?\n end", "def is_valid\n return true\n end", "def _always_valid!\n @always_valid = true\n self\n end", "def valid?(force=false)\n @valid = nil if force\n @valid = validates? if @valid.nil?\n @valid\n end", "def validate\r\n @invalid=false\r\n end", "def validates?\n reset\n @passed = catch :validation_done do\n validate\n pass\n end\n end", "def valid?\n self.class.validations.all? do |validation|\n send(validation)\n end\n end", "def looks_valid?\n check!(false).empty?\n end", "def extra_validations\n success\n end", "def validate_around\n validate_down\n validate_up\n end", "def skip_auto_validations(type)\n case type\n when :all\n [:not_null, :types, :unique, :max_length].each{|v| skip_auto_validations(v)}\n when :not_null\n auto_validate_not_null_columns.clear\n auto_validate_explicit_not_null_columns.clear\n when :types\n @auto_validate_types = false\n else\n send(\"auto_validate_#{type}_columns\").clear\n end\n end", "def validate?\n !!options[:validate]\n end", "def valid?\n run_validation\n @errors.empty?\n end", "def valid?\n return @validators.empty?\n end", "def valid?\n return @validators.empty?\n end", "def dry_validation?\n @dry_validation ||= @gems.include?(:dry_validation)\n end", "def _check_validators(text)\n ret = true\n if @validator_objects\n @validator_objects.each do |v|\n v.validate(text)\n unless v.is_valid\n @last_error_message = v.message\n ret = false\n end\n end\n end\n ret\n end", "def validate\n ensure_exclude_option_array_exists\n ensure_linter_section_exists\n ensure_linter_include_exclude_arrays_exist\n end", "def valid?\n return validate\n end", "def valid?\n begin\n validate\n true\n rescue\n false\n end\n end", "def validate?\n !!validation\n end", "def invalid?\n !@valid\n end", "def valid?\n check!\n true\n rescue\n false\n end", "def __valid__\n defined?(valid) ? valid : false\n end", "def disabled_callbacks?\n @disable_callbacks\n end", "def perform_validations(options={}) # :nodoc:\n if options.is_a?(Hash)\n options[:validate] == false || valid?(options[:context])\n else\n valid?\n end\n end", "def validations_on_update\n check_if_can_be_set_to_visible_against_price if Validations.on_update('product','not_visible_if_price_lower_than_zero')\n check_if_can_be_set_to_visible_against_images if Validations.on_update('product','not_visible_if_no_images')\n end", "def valid?\n not invalid?\n end", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def valid?\n errors.none?\n end", "def valid?\n errors.none?\n end", "def valid?\n errors.none?\n end", "def valid?\n errors.none?\n end", "def is_valid\n self.set_errors\n\n if @errors.length > 0\n return false\n else\n return true\n end\n end", "def validatable?\n true\n end", "def determine_useful_validations\n useful_checks = [\n useful_validations_for_qrda_type,\n useful_validations_for_measure_type\n # TODO: Add useful_validations_for_performance_rate\n ]\n useful_checks.inject(:&)\n end", "def without_validations\n with_validations(false)\n end", "def email_available?\n\t\tself.valid?\n\tend", "def check!\n true\n end", "def valid?\n false\n end", "def valid?\n false\n end", "def valid?\n validate!\n true\n rescue\n false\n end", "def validation_default; false; end", "def error_check?\n !@error_rules.empty?\n end", "def validate!; end", "def validate!; end", "def validate!; end", "def required_fields_valid?\n check_required\n errors.empty?\n end", "def required_fields_valid?\n check_required\n errors.empty?\n end", "def validate?\n @options[:validate]\n end", "def valid?\n !invalid?\n end", "def run_validations!\n run_callbacks(:validation) do\n super\n end\n end", "def validate_only(&block)\n return (block_given?) ?\n run_with_temporary_flag(:@validate_only, true, block) :\n @credential_handler.validate_only\n end", "def valid?\n !@errors.present?\n end", "def has_validation_hint?\n validation_hint.present?\n end", "def allowed?\n errors_count = self.errors.count\n self.validate_allows_response\n errors_count == self.errors.count\n end", "def validate\n # add errors if not validate\n end", "def check\n if valid?\n report_template(:ok)\n else\n report_template(:fail, VALIDATOR_MISSING)\n end\n end", "def validate_with_callbacks\n run_callbacks(:before_validation)\n validate_without_callbacks\n run_callbacks(:after_validation) if errors.empty?\n end", "def load_schema_validations #:nodoc:\n # Don't bother if: it's already been loaded; the class is abstract; not a base class; or the table doesn't exist\n return unless create_schema_validations?\n load_column_validations\n load_association_validations\n self.schema_validations_loaded = true\n end", "def invalid?\n !valid?\n end" ]
[ "0.72191864", "0.70191395", "0.677645", "0.6667524", "0.65297925", "0.6347098", "0.6329164", "0.6315907", "0.6284857", "0.6218642", "0.6195896", "0.61859536", "0.6157636", "0.6151492", "0.6151492", "0.6143809", "0.6104223", "0.5998064", "0.59955347", "0.597162", "0.59692377", "0.5959186", "0.5952523", "0.5934361", "0.59265834", "0.5924448", "0.5912386", "0.58939254", "0.5892423", "0.5875182", "0.5874551", "0.58595246", "0.58571136", "0.5852268", "0.58429337", "0.5820417", "0.58155334", "0.57740563", "0.5769784", "0.5769391", "0.5769251", "0.57655764", "0.5760267", "0.57569027", "0.5744395", "0.5739116", "0.5734982", "0.5726257", "0.57239455", "0.57220596", "0.5698751", "0.5691244", "0.5674421", "0.5671191", "0.56682205", "0.56624496", "0.56582904", "0.5653746", "0.56530035", "0.564714", "0.56394386", "0.5605365", "0.5605147", "0.56014574", "0.5591183", "0.55898386", "0.5589186", "0.5577316", "0.5574955", "0.5574955", "0.5574955", "0.5574955", "0.5572038", "0.55710137", "0.55704457", "0.55675805", "0.55661327", "0.55613965", "0.5561356", "0.5561356", "0.55607766", "0.55556846", "0.5554796", "0.55523676", "0.55523676", "0.55523676", "0.5549333", "0.5549333", "0.55486655", "0.55465233", "0.5545834", "0.5538409", "0.5537234", "0.55351144", "0.5529503", "0.55242926", "0.5522522", "0.5521944", "0.5517596", "0.55120003" ]
0.8485069
0
Disable generation of validations for the duration of the given block
def without_auto_validations previous, @disable_auto_validations = @disable_auto_validations, true yield ensure @disable_auto_validations = previous self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eval_validation_directives_block(state, &block)\n # each validate block should be a \"fresh start\" and not interfere with the\n # previous blocks\n state.singleton_class.clear_validators!\n state.singleton_class.class_eval(&block)\n\n state.validate || invalid!(state)\n state\n end", "def invalid?(&_block)\n end", "def invalidate(&block)\n yield\n ensure\n @attributes = nil\n end", "def defer_validation(&block)\n #p [:defer_validation, self.validation_on, @this]\n old_validation = self.validation_on\n self.validation_on = false\n v = nil\n begin\n v = @this.instance_eval(&block)\n ensure\n self.validation_on = old_validation\n end\n @this.validate!(false)\n v\n end", "def test_bad_block\r\n\t\ts = \"SYSTEM>Gaozu(100)\"\r\n\t\ttb = Block.new(\"0\", \"0\", s, \"1518893687.329767000\", \"fd19\")\r\n\t\t\r\n\t\tassert_equal 0, tb.validate_block\r\n\tend", "def valid()\n if (@block) then @block.call(true) end\n end", "def disable(&block)\n @disable_block = block\n end", "def disabled(&_block)\n @disabled = true\n yield\n ensure\n @disabled = false\n end", "def valid_blocks(base_time)\n set_base_time(base_time)\n time_entries = time_entries_for(base)\n end", "def valid(&block)\n raise \"validation method must take two arguments\" unless block.arity == 2\n @_valid = block\n #remove_method(:valid) rescue nil #if method_defined?(:valid)\n #define_method(:valid, &block)\n end", "def validate_block\n shrine_class.opts[:validate]\n end", "def create_blocked\n end", "def skip_validations\n true\n end", "def reject(&block)\n new_instance_with_inherited_permitted_status(@parameters.reject(&block))\n end", "def validate_only(&block)\n return (block_given?) ?\n run_with_temporary_flag(:@validate_only, true, block) :\n @credential_handler.validate_only\n end", "def validate_block(block)\n # check block ready conditions\n # 1. parent block must already be accepted.\n parent_block = get_block(block.parent_hash)\n raise BlockNotReadyError.new(\"can't find parent block by hash #{block.parent_hash.to_hex}\") unless parent_block\n # TODO 2. pow_chain_ref block must already be accepted.\n # 3. local time must greater or equal than minimum timestamp.\n unless (local_timestamp = Time.now.to_i) >= (minimum_timestamp = genesis_time + block.slot_number * SLOT_DURATION)\n raise BlockNotReadyError.new(\"local_timestamp(#{local_timestamp}) must greater than or equal with minimum_timestamp(#{minimum_timestamp})\")\n end\n end", "def without_auditing(&block)\n self.class.without_auditing(&block)\n end", "def valid_after; end", "def test_invalid_block\n chain = \"SYSTEM>Kurt(50)\"\n block = Blockchain.new(\"5\", \"5\", chain, \"1518892051.812065000\", \"ch78\")\n\n assert_equal 0, block.is_valid\n end", "def without_auditing(&block)\n self.class.without_auditing(&block)\n end", "def without_auditing(&block)\n self.class.without_auditing(&block)\n end", "def validate_time_blocks(time_blocks)\n b = time_blocks.select(&:collision_free?)\n\n # Test environment has unreliable data entry for start times.\n b = b.select(&:in_future?) unless Rails.env.test?\n\n b\n end", "def if_absent(params = {}, &block); validation_chain.if_absent(params, &block); end", "def without_auditing(&block)\n auditing_was_enabled = auditing_enabled\n disable_auditing\n block.call\n ensure\n enable_auditing if auditing_was_enabled\n end", "def without_validations\n with_validations(false)\n end", "def validity_period\n super\n end", "def validation(&validation_block)\n raise HullValidationMethods::NoValidationBlockGiven if !block_given?\n errors.clear\n begin\n yield validation_block\n rescue HullValidationMethods::ValidationError\n return false\n end\n self.errors.empty?\n end", "def invalidate\n @valid = false\n end", "def validate!\n # If we get num_blocks and block_size, then the user's done something\n # wrong; just take block_size\n self.num_blocks = 0 if num_blocks.positive? && block_size.positive?\n\n # Default to a single block unless otherwise specified\n self.num_blocks = 1 if num_blocks <= 0 && block_size <= 0\n\n reset!\n end", "def block!\n self.blocked = Time.now\n self.save\n end", "def validate(&block)\n if block\n @validate = block\n else\n @validate\n end\n end", "def block!\n self.update_attribute(:blocked, true)\n end", "def refute_valid\n @validator = validator\n refute @validator.validate(data_sample, fail_fast: true)\n refute @validator.validate(data_sample, fail_fast: false)\n end", "def block_valid?(block)\n # ...\n end", "def not &blk\n @negative = !@negative\n if blk\n @block = blk\n execute_block\n end\n end", "def test_good_block\r\n\t\ts = \"SYSTEM>Gaozu(100)\"\r\n\t\ttb = Block.new(\"0\", \"0\", s, \"1518893687.329767000\", \"fd18\")\r\n\t\t\r\n\t\tassert_equal 1, tb.validate_block\r\n\tend", "def validate(&block)\n shrine_class.opts[:validate] = block\n end", "def run_nonblock(&block)\n @timeout = 0\n run &block\n end", "def validate!(t)\n # None.\n end", "def reject(&block)\n alter do\n @lines = @lines.reject(&block)\n end\n end", "def setInvalid()\n\t\t@isValid = false\n\tend", "def disallow_phi\n raise ArgumentError, 'block required. use disallow_phi! without block' unless block_given?\n\n add_disallow_flag!\n add_disallow_flag_to_extended_phi!\n\n yield if block_given?\n\n remove_disallow_flag_from_extended_phi!\n remove_disallow_flag!\n end", "def assert_not_valid(model,msg=\"record was valid but shouldn't be\")\n assert_block(msg) { !model.valid? }\n end", "def disable_content_blocks\n cannot :manage, ContentBlock\n end", "def verify_not_before; end", "def verify_not_before; end", "def unprotected(&block)\n begin\n @unprotected = true\n block.call\n ensure\n @unprotected = false\n end\n end", "def unblock!\n self.blocked = nil\n self.save\n end", "def dj_audit_validations(&block)\n with_options(on: [:dj_audit], &block)\n end", "def test_disable_parametered\n hash_ = Hash.new\n block1_ = proc do ||\n set_value1('a', 1)\n end\n block2_ = proc do |target_|\n target_.set_value1('b', 2)\n end\n block3_ = proc do\n set_value1('c', 3)\n end\n Blockenspiel.invoke(block1_, Target1.new(hash_), :parameter => false)\n assert_raise(Blockenspiel::BlockParameterError) do\n Blockenspiel.invoke(block2_, Target1.new(hash_), :parameter => false)\n end\n Blockenspiel.invoke(block3_, Target1.new(hash_), :parameter => false)\n assert_equal(1, hash_['a1'])\n assert_equal(3, hash_['c1'])\n end", "def invalidate\n @invalid=true\n end", "def mark_unavailable\n t = @offering_interviewer.interview_availabilities.find_by_time_and_offering_interview_timeblock_id(\n params[:time].to_time, params[:timeblock_id])\n t.destroy\n render :partial => \"apply/timeslot_not_available\", :locals => { :b => params[:timeblock_id], :ti => params[:ti], :time => params[:time] }\n end", "def assert_not_expire_fragments(*names)\n fragment_cache_store.clear\n \n yield *names\n\n raise NoRequestInBlockError.new(\"no request was send while executing block.\") if @controller.nil?\n \n names.each do |name|\n assert_block(\"#{name.inspect} is expired after executing block\") do\n !fragment_cache_store.deleted?(@controller.fragment_cache_key(name))\n end\n end\n \n fragment_cache_store.clear\n end", "def block!\n self.update_attribute(:status, BLOCKED)\n end", "def invalidate\r\n @invalid=true\r\n end", "def mark_unavailable\n t = @user_application.interview_availabilities.find_by_time_and_offering_interview_timeblock_id(\n params[:time].to_time, params[:timeblock_id])\n t.destroy\n render :partial => \"timeslot_not_available\", :locals => { :b => params[:timeblock_id], :ti => params[:ti], :time => params[:time] }\n end", "def test_disable_parameterless\n hash_ = Hash.new\n block1_ = proc do ||\n set_value1('a', 1)\n end\n block2_ = proc do |target_|\n target_.set_value1('b', 2)\n end\n block3_ = proc do\n set_value1('c', 3)\n end\n assert_raise(Blockenspiel::BlockParameterError) do\n Blockenspiel.invoke(block1_, Target1.new(hash_), :parameterless => false)\n end\n Blockenspiel.invoke(block2_, Target1.new(hash_), :parameterless => false)\n assert_raise(Blockenspiel::BlockParameterError) do\n Blockenspiel.invoke(block3_, Target1.new(hash_), :parameterless => false)\n end\n assert_equal(2, hash_['b1'])\n end", "def without_scope_condition(&block)\n if block_given?\n disable_scope_condition\n yield\n enable_scope_condition\n end\n end", "def invalidate(msg = nil, &block)\n field = @field\n add_callback(:validate) do |from, to|\n if block\n msg = instance_exec(from, to, &block)\n if msg\n self.errors[field] << msg\n end\n else\n self.errors[field] << msg || 'is an invalid'\n end\n end\n end", "def valid_timing\n errors.add(:review, \"Invalid timing for review\") unless !reservation.nil? && reservation.status == \"accepted\" && reservation.checkout < Time.current\n end", "def check_validity!\n # nothing\n end", "def invalidate\n @invalid = true\n end", "def block_valid?(block, difficulty = 4)\n block.valid?(difficulty) &&\n block.parent_digest == head_digest &&\n balances([block]).none? { |user, balance| balance < 0 }\n end", "def validate(new_block)\n previous_block = find_block_by_height(new_block.height - 1)\n\n # 1. Height.\n if previous_block&.height.to_i + 1 != new_block.height.to_i\n raise \"Height isn't valid\"\n end\n\n if previous_block.nil? == false\n # 2. Previous block hash\n if previous_block.block_header_hash != new_block.previous_block_header_hash\n raise \"Previous block header hash is wrong\"\n end\n\n # 2. Time: Can't be before the previous block.\n if previous_block.time > new_block.time\n raise \"New block can't have been created before the previous one\"\n end\n end\n\n # 3. Transactions: Wallets should only spend fund they own.\n new_block.transactions.each do |transaction|\n if WalletTransfer.find(transaction[\"id\"]).nil? == false\n raise \"A transaction with the same ID already exists on the blockchain\"\n end\n\n case transaction[\"message\"][\"type\"]\n when \"funds_transfer\"\n if valid_cryptography?(transaction) == false\n raise \"Cryptography of the transaction is invalid\"\n end\n\n # The amount + fee needs to be available to the wallet.\n if address_has_enough_funds?(transaction[\"message\"]) == false\n raise \"From address doesn't have enough funds\"\n end\n\n when \"mining_reward\"\n fees = new_block.transactions.reject { |t| t[\"message\"][\"type\"] == \"mining_reward\" }\n .map { |t| BigDecimal(t[\"message\"][\"fee\"]) }\n .reduce(&:+) || BigDecimal(0)\n\n mining_reward = BigDecimal(transaction[\"message\"][\"amount\"])\n if mining_reward != fees + 1\n raise \"Mining reward amount is invalid (#{mining_reward.to_s(\"F\")})\"\n end\n end\n end\n\n # 4. There should be exactly one mining reward transaction.\n mining_rewards = new_block.transactions.reject { |t| t[\"message\"][\"type\"] != \"mining_reward\" }\n if mining_rewards.size != 1\n raise \"Unexpected amount of mining rewards\"\n end\n\n # 5. Merkle tree root: Should be valid.\n merkle_root = MerkleTree.new(*new_block.transactions.map(&:to_json).sort { |a, b| a[\"id\"] <=> b[\"id\"] }).root.value\n if new_block.merkle_root != merkle_root\n raise \"Merkle root is invalid\"\n end\n\n # 6. Block hash: Is it valid and is the level of difficulty what's expected.\n if new_block.compute_block_header_hash != new_block.block_header_hash\n raise \"Block header hash is invalid\"\n end\n\n if new_block.block_header_hash[0, DIFFICULTY_LEVEL] != \"0\" * DIFFICULTY_LEVEL\n raise \"Block doesn't match expected difficulty level\"\n end\n end", "def each_invalid_attempt(&block)\n invalid_attempts.each(&block)\n end", "def invalid; end", "def stop_condition(&block)\n self.gracefully_stop_mark = block\n end", "def validator(&block)\n return @validator unless block_given?\n\n @validator = Dry::Validation.Schema(&block)\n end", "def disable_only_if(&block)\n set_or_return(:disable_only_if, block, kind_of: Proc)\nend", "def valid_after=(_arg0); end", "def without_locking(&block)\n self.class.without_locking(&block)\n end", "def without_approval(&block)\n memory = self.class.approvals_active # If we use #approvals_enabled? the global state might be incorrectly applied.\n self.class.approvals_off\n instance_eval &block\n ensure\n self.class.approvals_on if memory\n end", "def create_dry_validator(type, &block)\n unless ['form', 'schema'].include?(type)\n fail \"validator type must 'form' or 'schema' (#{type}) given\"\n end\n\n fail \"block is required to build a validator\" unless block_given?\n\n method = type.capitalize\n Dry::Validation.send(method, &block)\n end", "def remove_deadline_for(generator, time)\n found = false\n deadlines.delete_if do |deadline, _, gen|\n if found\n false\n else\n found = (deadline > time && generator == gen)\n end\n end\n found\n end", "def none(&block)\n @validators <<\n if block_given?\n val = ValidatorBuilder.new(self, @options, &block)\n ->(obj) { val.validators.map { |v| v.call(obj) }.none? }\n else\n ANY\n end\n end", "def partially_valid_clear\n @partially_valid_attributes = []\n end", "def record_block\n @block = true\n end", "def run_validations\n true\n end", "def disable_paranoid\n if block_given?\n @paranoid = false\n yield\n else\n raise 'Only block form is supported'\n end\n ensure\n @paranoid = true\n end", "def dont_process_while &blk\n self.update_attributes(:persistence_checksum => \"skip\") \n yield\n self.update_persistence_checksum\n end", "def validate!\n ensure_valid_tick\n end", "def reservations_exist_in_block\n if timeslot_contains_reservations?\n errors.add(:base, I18n.t('reservation.reservations_exist_in_block'))\n end\n end", "def validate!\n raise \"Missing period\" if throttle_period.nil?\n end", "def optional(&block)\n @validators <<\n if block_given?\n opts = @options.dup\n opts[:optional] = true\n ValidatorBuilder.new(self, opts, &block).build\n else\n ANY\n end\n end", "def validate\n @invalid=false\n end", "def tolerate_all_deprecations(&block)\n handle_deprecations(all: :tolerate, &block)\nend", "def block_params\n params.require(:block).permit(:result_no, :generate_no, :block_no, :e_no)\n end", "def disable\n \n orignial_state = @enabled\n @enabled = false\n \n if block_given?\n yield\n @enabled = orignial_state\n end\n \n return self\n \n end", "def check_emission_validity # :nodoc:\n if (error = super)\n refine_emit_exception(error)\n else\n task.check_emission_validity(self)\n end\n end", "def eval_custom_validator_block(state, original_state = nil)\n yield(state, original_state)\n invalid!(state) if state.errors.present?\n state\n end", "def partition_validations\n @post_load_validations = @validations.select(&:deferred?)\n @pre_load_validations = @validations.reject(&:deferred?)\n end", "def make_block_reservation(name)\n block = find_block(name)\n reservation = block.confirm_reservation\n return reservation\n end", "def is_not(&block)\n [:is_not, block]\n end", "def is_not(&block)\n [:is_not, block]\n end", "def non_embargoed\n must_not_range(\"#{Item::IndexFields::EMBARGOES}.#{Embargo::IndexFields::ALL_ACCESS_EXPIRES_AT}\",\n :gt,\n Time.now.strftime(\"%Y-%m-%d\"))\n self\n end", "def reject_without_hooks!( & block )\n\n @without_hooks = true\n\n reject!( & block )\n \n @without_hooks = false\n\n return return_value\n\n end", "def without_timestamps\n self.record_timestamps = false\n yield\n self.record_timestamps = true\n end", "def validator(&block)\n @validator = DSL::Validator.new\n @validator.instance_exec(&block)\n end", "def user_is_not_blocked\n return errors.add(:user, 'You cannot block yourself')\\\n if user_id == blocked_id\n end", "def skip_validation_for(*args)\n args.each { |attr| send(\"skip_#{attr}_validation=\", true) }\n end" ]
[ "0.62083584", "0.61888754", "0.61296207", "0.60618997", "0.6052558", "0.6046336", "0.5999179", "0.5992014", "0.5943124", "0.5930466", "0.5856872", "0.584841", "0.582962", "0.5810356", "0.5808401", "0.5782497", "0.57733977", "0.57358164", "0.570605", "0.5702345", "0.5702345", "0.5675692", "0.56588084", "0.5636107", "0.5633147", "0.5627306", "0.5609683", "0.556293", "0.55574065", "0.55512655", "0.55453044", "0.55380756", "0.5509749", "0.5487923", "0.54828537", "0.54636645", "0.54621434", "0.544551", "0.54184777", "0.5416435", "0.54071385", "0.5394311", "0.5363974", "0.5363096", "0.53473324", "0.53473324", "0.534079", "0.5334066", "0.5330366", "0.5328154", "0.53221476", "0.5312751", "0.53035134", "0.53031427", "0.5302698", "0.5299638", "0.5293213", "0.52634907", "0.52596974", "0.5251356", "0.52476484", "0.52398396", "0.5227865", "0.5220322", "0.521551", "0.5210789", "0.5207842", "0.52077806", "0.5207545", "0.52067155", "0.51986665", "0.5192094", "0.5184122", "0.51833564", "0.51832694", "0.5171694", "0.5159923", "0.5158944", "0.51541615", "0.51473194", "0.5145813", "0.5135797", "0.51336163", "0.51088756", "0.5096952", "0.5095039", "0.5090162", "0.5087758", "0.50854236", "0.50852853", "0.50822586", "0.5080287", "0.50795716", "0.50795716", "0.5072252", "0.5067176", "0.50638956", "0.5063125", "0.50512785", "0.50496215" ]
0.6628382
0
Pwrake version of backquote command
def pwrake_backquote(cmd) conn = Pwrake::Shell.current if conn.kind_of?(Pwrake::Shell) res = conn.backquote(*cmd) status = Rake::PseudoStatus.new(conn.status) else res = `#{cmd}` status = $? status = Rake::PseudoStatus.new(1) if status.nil? end [res,status] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quote\n %q[(?:\"|')?]\n end", "def requote(value) return restore_ends(value, '\"') end", "def change_quotemarks!\n local_copy.in_place :perl, \"s/\\\"/'/g\"\n end", "def shq(s) # sh(1)-style quoting\n sprintf(\"'%s'\", s.gsub(/'/, \"'\\\\\\\\''\"))\nend", "def unquote\n\t\teach { |e| Concatenative::System.process e }\n\tend", "def quote_arg(arg)\n '\"' + arg.to_s.gsub(ARG_QUOTER) { |m| \"\\\\#{m}\" } + '\"'\n end", "def qq esc = nil\n %[\"#{esc ? self.gsub('\"') { esc } : self}\"]\n end", "def quoted_shell_param s\n \"\\\"#{s}\\\"\"\n end", "def unquote\n match = /\"(.*)\"/.match(self)\n match ? match[1] : self\n end", "def hamlet_quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote( val )\n\t\treturn %q{\"%s\"} % [ val.to_s.gsub(/\"/, '\\\\\"') ]\n\tend", "def shell_quote(str = \"\")\n @tmp_command_line ||= Cocaine::CommandLine.new(\"\")\n @tmp_command_line.send :shell_quote, str\n end", "def single_quote\n # single quote string here\n 'Hello World and others!'\nend", "def shell_regex\n /\n (\\`.+\\`)\n /xm\n end", "def quoted_string; end", "def unquote(part)\n return part if part.blank?\n\n part.start_with?('\"') ? part[1..-2] : part\n end", "def as_you_like_it_quote; end", "def quote\n %Q{\"#{self}\"}\n end", "def rake(app_name, cmd)\n # deprecated by virtue of start deprecation 08/02/2012\n start(app_name, \"rake #{cmd}\", :attached).to_s\n end", "def quote(*args)\n arr = args.map {|x| '\"' + x + '\"'}\n return arr.join(\" \")\nend", "def quote(value); end", "def romeo_and_juliet_quote; end", "def generate_sql_escape(token)\n escaped_token = token.gsub(/\\\\|'/, '\\0\\0\\0\\0').gsub(\"?\", \"\\\\\\\\77\")\n \"'\" + escaped_token + \"'\"\n end", "def quote_and_escape(text, quote = '\"')\n \"#{quote}#{text.gsub(/#{quote}/) { |m| \"#{m}\\\\#{m}#{m}\" }}#{quote}\"\n end", "def lex_en_interp_backslash_delimited=(_arg0); end", "def lex_en_interp_backslash_delimited=(_arg0); end", "def lex_en_interp_backslash_delimited=(_arg0); end", "def quote(&block)\n result = \"\"\n bind_pos = 0\n\n tokens.each do |part|\n case part\n when '?'\n result << block.call(bind_pos)\n bind_pos += 1\n when '??'\n result << \"?\"\n else\n result << part\n end\n end\n\n return result\n end", "def rb_quote(str)\n return '' if !str || str.empty?\n \"\\\"#{str.gsub(\"\\\"\", \"\\\\\\\"\")}\\\"\"\n end", "def marvin_quote; end", "def my_backticks(cmd)\n rd, wr = IO.pipe\n\n pid = fork {\n rd.close\n\n $stdout.reopen(wr)\n exec(cmd)\n }\n\n wr.close\n Process.wait(pid)\n rd.read\nend", "def shell_escape(s)\n s = s.to_s\n if s !~ /^[0-9A-Za-z+,.\\/:=@_-]+$/\n s = s.gsub(\"'\") { \"'\\\\''\" }\n s = \"'#{s}'\"\n end\n s\n end", "def my_quote\n\tend", "def _quoteString ( str )\n str.gsub( /\\\\/, '\\&\\&' ).gsub( /'/, \"''\" ) # ' (for ruby-mode)\n end", "def to_s\n require \"shellwords\"\n\n escaped_args = @args.map do |arg|\n escaped = Shellwords.escape(arg)\n next escaped if escaped == arg\n next escaped if arg.include?(\"'\")\n \"'#{arg}'\"\n end\n escaped_args.join(\" \")\n end", "def backtic(cmd) \n\t\tself.log \"VantagePoint::backtic: running \\`#{cmd}\\`\"\n\t\treturn Kernel::`(cmd) \n\t\t# `\n\tend", "def command_raw(args)\n\n end", "def rake(*args) run_command('rake', args) end", "def quick_command\n @raw[0] || \"\"\n end", "def lex_en_interp_backslash_delimited; end", "def lex_en_interp_backslash_delimited; end" ]
[ "0.61661613", "0.60998255", "0.5990482", "0.5903647", "0.5884288", "0.58399826", "0.5773177", "0.57671887", "0.57631254", "0.5745385", "0.57357204", "0.57357204", "0.57357204", "0.57357204", "0.57357204", "0.57357204", "0.57357204", "0.57357204", "0.57357204", "0.57357204", "0.57357204", "0.57357204", "0.57357204", "0.57357204", "0.57357204", "0.57357204", "0.57357204", "0.57357204", "0.57357204", "0.57357204", "0.57357204", "0.57357204", "0.57357204", "0.57357204", "0.57357204", "0.57357204", "0.57357204", "0.57357204", "0.57357204", "0.57357204", "0.57357204", "0.57357204", "0.57357204", "0.57357204", "0.57357204", "0.57357204", "0.57357204", "0.57357204", "0.57357204", "0.57357204", "0.57357204", "0.57357204", "0.57357204", "0.57357204", "0.57357204", "0.57357204", "0.57357204", "0.57357204", "0.57357204", "0.57357204", "0.57357204", "0.57357204", "0.57357204", "0.57357204", "0.57357204", "0.57357204", "0.57357204", "0.57357204", "0.57357204", "0.57156694", "0.56748354", "0.56218195", "0.55592793", "0.5557638", "0.5549615", "0.5502771", "0.55006397", "0.5499363", "0.549731", "0.54531723", "0.54479045", "0.5444571", "0.54328215", "0.54107237", "0.54107237", "0.54107237", "0.5402089", "0.53848976", "0.53701687", "0.53511393", "0.5336973", "0.53315973", "0.5329209", "0.530697", "0.5292611", "0.528627", "0.52739143", "0.52681005", "0.5266089", "0.5266089" ]
0.74655515
0
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.blogmailer.register.subject
def register(seller) @seller = seller mail(:to => seller.emailadd, :subject => "Welcome to the Car Sales site") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translate(mapping, key)\n I18n.t(:\"#{mapping.name}_subject\", :scope => [:devise, :mailer, key],\n :default => [:subject, key.to_s.humanize])\n end", "def subject=(string)\n set('Subject', string)\n end", "def subject\n self['subject'] || msg['subject']\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 message_subject=(value)\n @message_subject = 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_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 subject=(subject); @message_impl.setSubject subject; end", "def subject_name=(value)\n @subject_name = 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 self['subject']\n end", "def subject_name\n subject_full_name\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 set_subject(subject)\n\t\tend", "def subject\n @subject ||= Envelope::MessageTools.normalize(message.subject || '')\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_name\n return @subject_name\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\n @mail.subject\n 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 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 subject() self.headers[\"Subject\"] || \"[NO SUBJECT]\" end", "def subject\n @options.fetch(:subject) { \"Invitation\" }\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\n title \n end", "def subject\n message.subject\n end", "def SetSubject(subject)\n\t\t#Subject of document\n\t\t@subject = subject\n\tend", "def get_subject\n\t\tend", "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 email_subject(form)\n \"#{form.type_of_enquiry} - #{reference}\"\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 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 subject=(subject)\n self.subjects = [subject]\n end", "def i18n_label\n \"email.#{name}_label\"\n end", "def set_subject\n @subject = Subject.friendly.find(params[:id])\n end", "def subject; @message_impl.getSubject; end", "def subject\n map_field(:subject)&.map { |a| a.gsub(/ \\$[a-z] /, '--') }\n end", "def subject\n @subject\n end", "def subject\n @subject\n end", "def message_subject\n return @message_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 normalize_subject_name\n self.subject = subject.downcase.titleize\n end", "def named_subject\n map_field(:named_subject)&.map { |a| a.gsub(/ \\$[a-z] /, ' ') }\n end", "def subject\n @subject=EzCrypto::Name.new(@cert.subject) unless @subject\n @subject\n end", "def set_title\n @title = t(:message_2, :scope => [:controller, :exams])\n end", "def subject\n @subject\n end", "def subject_names\n @subject_names ||= sw_subject_names\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 data_subject=(value)\n @data_subject = value\n end", "def validate_subject\n errors << 'invalid email domain' unless domain_valid?\n end", "def adhoc_test_subj_call\n ->(candidate) { I18n.t('email.test_adhoc_subject_initial_input', candidate_account_name: candidate.account_name) }\n end", "def subject_titles\n @subject_titles ||= sw_subject_titles\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 new_registration(account)\n @account = account\n mail subject: \"#{APP::NAME}: new registration\"\n end", "def subject_topic\n map_field(:subject_topic)&.map { |a| a.gsub(/ \\$[a-z] /, '--') }\n end", "def email_subject(&blk)\n @email_subject_block = blk if blk\n @email_subject_block\n end", "def newcompany_email(company)\n @company = company\n @message = t('mailers.company.created')\n \n emails = AdminUser.all.collect(&:email).join(\",\")\n\n mail(:to => emails, :subject => \"#{t('site_title')}: #{@message}\")\n \n end", "def registered(user)\n mail_to user, registered_subject\n end", "def subject=(text)\n current_div.text_field(:id=>\"comp-subject\").set text\n end", "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 subject_alternative_name\n extensions[R509::Cert::Extensions::SubjectAlternativeName]\n end", "def set_subject\n @subject = Subject.find(params[:subject_id])\n end", "def compose_email\n @title = t 'conclusion_draft_review.send_by_email'\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", "def set_subject\n @subject = Subject.find params[:subject_id]\n end", "def raf_submitted(study_subject)\n#\t\t@greeting = \"Hi\"\n\t\t@study_subject = study_subject\n\n\t\tmail to: \"magee@berkeley.edu\"\n\t\tmail cc: [\"jakewendt@berkeley.edu\", \"notifyccls@berkeley.edu\"]\n\t\tmail subject: \"TEST [CCLS Patient Notification Received] Identifier: #{@study_subject.icf_master_id_to_s}\"\n\tend", "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 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 subject_name\n subject&.name\n end", "def subject; end", "def subject; end", "def subject; end", "def subject; end", "def subject; end", "def subject; end", "def subject; end", "def subject; end", "def subject; end", "def subject; end" ]
[ "0.67464787", "0.6669763", "0.6641568", "0.66309553", "0.6630084", "0.6534335", "0.649207", "0.64914674", "0.64386857", "0.64386857", "0.64386857", "0.64386857", "0.64386857", "0.64386857", "0.64386857", "0.64386857", "0.64245605", "0.6386189", "0.6371353", "0.6361605", "0.63306", "0.6317645", "0.6317645", "0.6317645", "0.6317645", "0.630093", "0.62758446", "0.62450206", "0.62450206", "0.62450206", "0.62450206", "0.62450206", "0.62450206", "0.62244296", "0.6220902", "0.6219945", "0.61595", "0.61322486", "0.6104375", "0.60862225", "0.60724556", "0.6039229", "0.60391587", "0.5933868", "0.59260535", "0.5916518", "0.59030914", "0.58464944", "0.581883", "0.58164704", "0.5800096", "0.5774465", "0.57163495", "0.5708657", "0.56802094", "0.56802094", "0.567197", "0.5662782", "0.5661691", "0.5651344", "0.56113195", "0.5602718", "0.5599702", "0.5582844", "0.5575373", "0.5573191", "0.5553119", "0.5547642", "0.5526369", "0.5520483", "0.55005306", "0.5500232", "0.54785174", "0.54764736", "0.54643387", "0.5459905", "0.54571885", "0.5435598", "0.5424101", "0.54208", "0.5408787", "0.54013896", "0.5398758", "0.5398266", "0.5390047", "0.5390047", "0.5390047", "0.5390047", "0.5390047", "0.5390047", "0.5371555", "0.53706354", "0.53706354", "0.53706354", "0.53706354", "0.53706354", "0.53706354", "0.53706354", "0.53706354", "0.53706354", "0.53706354" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_api_key @api_key = ApiKey.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 setup_handler\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; 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 workflow\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def setup\n # override and do something appropriate\n end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def 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 startcompany(action)\n @done = true\n action.setup\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 setup\n #implement in subclass;\n end", "def after_set_callback; 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 setup(easy)\n super\n easy.customrequest = @verb\n end", "def around_hooks; end", "def save_action; 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 shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def duas1(action)\n action.call\n action.call\nend" ]
[ "0.6165152", "0.60463154", "0.59467196", "0.5917112", "0.5890387", "0.58345735", "0.57773316", "0.56991524", "0.56991524", "0.565454", "0.5622282", "0.54232633", "0.54119074", "0.54119074", "0.54119074", "0.53937256", "0.53801376", "0.5358599", "0.53412294", "0.5340814", "0.53314966", "0.53114754", "0.52984965", "0.52977055", "0.5296272", "0.5260649", "0.5245076", "0.52388334", "0.52388334", "0.52388334", "0.52388334", "0.52388334", "0.5235081", "0.52321917", "0.5228592", "0.5220735", "0.52198535", "0.52139324", "0.5208539", "0.5206585", "0.5178542", "0.5175199", "0.5173538", "0.5167041", "0.51614195", "0.51577675", "0.5153909", "0.51528823", "0.5152225", "0.51429904", "0.5141399", "0.51345575", "0.51145", "0.5114052", "0.5114052", "0.5110216", "0.5108656", "0.50935394", "0.5089196", "0.5081936", "0.5079627", "0.50675833", "0.5056105", "0.5053687", "0.5050475", "0.5050475", "0.503471", "0.5028311", "0.501982", "0.50157547", "0.5013552", "0.50014806", "0.50011593", "0.49976763", "0.4990292", "0.4990292", "0.49882022", "0.4981269", "0.49792367", "0.49766538", "0.4967978", "0.49667212", "0.4958987", "0.49572337", "0.49550423", "0.4954479", "0.4952353", "0.494726", "0.4944055", "0.4935437", "0.4931248", "0.49283475", "0.49281213", "0.49268973", "0.4921738", "0.49204507", "0.4918924", "0.49182287", "0.4916538", "0.49158585", "0.49156788" ]
0.0
-1