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
True if the app has been built for the simulator
def simulator? arches.include?("i386") || arches.include?("x86_64") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def simulator?\n !physical_device?\n end", "def app_is_installed?\n if installed_app_bundle_dir ||\n simctl.app_container(device, app.bundle_identifier)\n true\n else\n false\n end\n end", "def is_simulator? uuid\n # Check if UUID is from a device or a simulator\n # Getting all the simulator's UUID\n uuids = `xcrun simctl list`\n return true if uuids.include? uuid\n return false\nend", "def instruments_app_running?\n ps_output = `ps x -o pid,comm | grep Instruments.app | grep -v grep`.strip\n if ps_output[/Instruments\\.app/, 0]\n true\n else\n false\n end\n end", "def sim_is_running?\n not sim_pid.nil?\n end", "def ios? ; RUBY_PLATFORM =~ /arm-darwin/i end", "def mac?\n Config::CONFIG['target_os'] == \"darwin\"\n end", "def has_required_xcode_version?\n # TODO: bring in from build_runner\n rand(10) > 3 # 1 in 3 chance of failure\n end", "def installer_appdmg?\n installer_type == \"appdmg\"\n end", "def ios?\n platform_name.to_s.upcase == IOS\n end", "def built?\n @built = false if @built.nil?\n @built\n end", "def backup_minister_installed?\n software_installed?(APP_NAME)\n end", "def should_build?\n config.auto_build && !dev_server_running?\n end", "def apple_silicon?\n RUBY_PLATFORM.match(/arm64/)\n end", "def simulator_needs_update?\n return false if state == :dont_care && @simulator_state == :dont_care\n state != @simulator_state || value != @simulator_value\n end", "def darwin?\n platform =~ /darwin/\n end", "def mac?\n !!(ua =~ /Mac OS X/ && !ios?)\n end", "def mac?\n Config::CONFIG[\"host_os\"] =~ /darwin/i ? true : false\n end", "def build?\n config[:mode] == :build\n end", "def ios_app?\n ios? && !ua.include?(\"Safari\")\n end", "def darwin?\n RUBY_PLATFORM.include?('darwin')\n end", "def built?\n !@view.nil?\n end", "def release_build?\n false # we currently have nothing that qualifies. previously LTS was a type of this\n end", "def is_hearthstone_running?\n NSWorkspace.sharedWorkspace.runningApplications.each do |app|\n if app.localizedName == 'Hearthstone'\n return true\n end\n end\n\n # debugging from actual log file, fake HS is running\n if KDebugFromFile\n true\n else\n false\n end\n end", "def machined\n environment.machined\n end", "def app_starting?\n @launching\n end", "def xctools_fucked?\n xcode_folder == \"/\"\n end", "def installer?\n @kind == :installer\n end", "def pre_7?\n UI.user_error!(\"Unable to locate Xcode. Please make sure to have Xcode installed on your machine\") if xcode_version.nil?\n v = xcode_version\n is_pre = v.split('.')[0].to_i < 7\n is_pre\n end", "def macys?\n ExecutionEnvironment.macys?\n end", "def mac?\n RUBY_PLATFORM =~ /darwin/i\nend", "def mac?\n (/darwin/ =~ RUBY_PLATFORM) != nil\n end", "def physical_device?\n arches.any? do |arch|\n arch[/arm/, 0]\n end\n end", "def is_darwin?\n Sprout.current_system.is_a?(Sprout::System::OSXSystem)\n end", "def just_set_up?\n AppConfig[:just_set_up] == true\n end", "def live?\n configuration.release_stage?\n end", "def have_exact_prebuild_cache?\n\n # check if need build frameworks\n return false if local_manifest == nil\n \n changes = prebuild_pods_changes\n added = changes.added\n changed = changes.changed \n unchanged = changes.unchanged\n deleted = changes.deleted \n \n exsited_framework_pod_names = sandbox.exsited_framework_pod_names\n missing = unchanged.select do |pod_name|\n not exsited_framework_pod_names.include?(pod_name)\n end\n\n needed = (added + changed + deleted + missing)\n \n return needed.empty?\n end", "def app_name_configured?\n names = Agent.config[:app_name]\n return names.respond_to?(:any?) && names.any?\n end", "def xcode_file?\n ['.nib', '.xcworkspacedata', '.xcuserstate'].include?(extname)\n end", "def built?\n Namespace.root.executed_blueprints.include?(self)\n end", "def macos_ruby?\n !!(RUBY_PLATFORM =~ /darwin/)\n end", "def complete_app_install?(app_bundle_dir)\n base_dir = File.dirname(app_bundle_dir)\n plist = File.join(base_dir, METADATA_PLIST)\n File.exist?(plist)\n end", "def mac?\n (/darwin/ =~ ruby_platform) != nil\n end", "def mac?\n kind_of? Mac::Platform rescue false\n end", "def deployment_completed?\n begin\n return true if db_execution_status == \"complete\"\n rescue Data::NoExecution # rubocop:disable Lint/HandleExceptions\n end\n\n return false if boot_from_san? || !has_os?\n\n os_installed?\n end", "def simulate_mode?\n !! ENV['simulate']\n end", "def darwin?\n /darwin/.match(RUBY_PLATFORM)\n end", "def building?\n !build_stack.empty?\n end", "def is_watchkit_app?(app_path)\n plist_path = \"#{app_path}/Info.plist\"\n `/usr/libexec/PlistBuddy -c 'Print :DTSDKName' #{plist_path.shellescape} 2>&1`.match(/^\\s*watchos2\\.\\d+\\s*$/) != nil\n end", "def mobile?\n os_parser.mobile?\n end", "def ensure_app_same\n installed_app_bundle = installed_app_bundle_dir\n\n if !installed_app_bundle\n RunLoop.log_debug(\"App: #{app} is not installed\")\n return true\n end\n\n installed_sha = installed_app_sha1\n app_sha = app.sha1\n\n if installed_sha == app_sha\n RunLoop.log_debug(\"Installed app is the same as #{app}\")\n return true\n end\n\n RunLoop.log_debug(\"The app you are testing is not the same as the app that is installed.\")\n RunLoop.log_debug(\" Installed app SHA: #{installed_sha}\")\n RunLoop.log_debug(\" App to launch SHA: #{app_sha}\")\n RunLoop.log_debug(\"Will install #{app}\")\n\n uninstall_app_with_simctl\n install_app_with_simctl\n true\n end", "def os_s\n\t\tif(os == 'iPad' || os == 'BlackBerry' || os == 'iPhone' || os == 'Android')\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend", "def not_a_mac\n if mac?\n return false\n else\n puts I18n.t(:mac_only)\n return true\n end\n end", "def mac? ; RUBY_PLATFORM =~ /.*(sal|86).*-darwin1/i end", "def simulation?\n self[:simulation].present?\n end", "def debug?\n @debug || to_bool( ENV['LAUNCHY_DEBUG'] )\n end", "def running?\n @applications.each { |a| return true if a.running? }\n return false\n end", "def developer?\n config[\"developer\"] == true\n end", "def buildable?\n [:finished, :failed, :not_started].include? build_state\n end", "def can_post_install?\n return false unless has_os?\n\n ![\"vmware_esxi\", \"hyperv\", \"suse11\", \"suse12\"].include?(os_image_type.downcase)\n end", "def devkit?\n @kind == :devkit\n end", "def as_framework?\n (self.installed? and File.exists? prefix+\"Frameworks/Python.framework\") or build_framework?\n end", "def has_installer?\n !installer_path.nil?\n end", "def has_visor?\n File.exists?(\"#{ENV['HOME']}/Library/Application\\ Support/SIMBL/Plugins/Visor.bundle/\")\n end", "def instruments_running?\n instruments_pids.count > 0\n end", "def mac?\n @mac ||= is? /mac|darwin/\n end", "def run_build?\n ENV['BUILD_ASSETS'].to_s == 'true' ||\n build_files.blank? ||\n src_files.select { |f| File.mtime(f) >= File.mtime(cache_file) }.any?\n end", "def standalone?\n not $SLICED_APP\n end", "def standalone?\n not $SLICED_APP\n end", "def run?\n @run ||= true\n @run and !@running and app_file? and $0.expand_path == app_file.expand_path\n end", "def local?\n test_framework?\n end", "def beta?\n developer_dir[/Xcode-[Bb]eta.app/, 0]\n end", "def simulation_mode?\n controller.simulation_mode\n end", "def exit_ok?\n current_project.load_agents.empty?\n end", "def os_x?\n RUBY_PLATFORM.match(/darwin/)\n end", "def ios_onboarded\n return @ios_onboarded\n end", "def needs_director? #:nodoc:\n !!@build_director\n end", "def mac_os_onboarded\n return @mac_os_onboarded\n end", "def ready?\n File.exist?(desktop_path) && \n File.directory?(libs_path)\n end", "def is_arm?\n !RUBY_PLATFORM.index(\"arm64e\").nil?\nend", "def is_arm?\n !RUBY_PLATFORM.index(\"arm64e\").nil?\nend", "def iphone?\n request.user_agent =~ /iPhone/i\n end", "def should_load?\n test_framework? || trace_observer_configured?\n end", "def is_mac_sync_app_enabled\n return @is_mac_sync_app_enabled\n end", "def ios_dockerized_database_clients?\n # use the installed environment variable required to make ibm gems work on mac to determine whether\n # to use the dockerized version or not.\n ENV['IBM_DB_HOME'].nil?\n end", "def setup?\n @setup\n end", "def status?\n # Is the VNC port open?\n unless system(\"nc -z localhost 5900 > /dev/null\")\n info(\"VNC port not open...\")\n return false\n end\n # Is at least one of the trigger files present?\n components = ['/Library/Preferences/com.apple.RemoteManagement.launchd', '/private/etc/RemoteManagement.launchd']\n components.each do |component|\n\t components.delete(component) if not File.exist?(component)\n end\n return false if components.empty?\n # Is the ARDAgent running?\n # This appears to be the only consistently active process on Leo, Snowy, and Lion.\n unless system(\"ps axc | grep ARDAgent > /dev/null\")\n info(\"ARD agent not running...\")\n return false\n end\n true\n end", "def app_available?(app)\n `which #{app}`.strip == \"\" ? false : true\n end", "def what_is_installed?\n which_os = os.green\n package_manager = ( has_installer? ? 'Yes'.green : 'No'.red.blink )\n exe_installed = ( pianobar? ? 'Yes'.green : 'No'.red.blink )\n ctl_file = ( ctl? ? 'Yes'.green : 'No'.red.blink )\n has_notifier = ( notify? ? 'Yes'.green : 'No'.red.blink )\n ok = ( has_installer? ? 'Yes'.green : 'No'.red.blink )\n\n puts get_template 'what_is_installed', binding\n\n has_installer?\n end", "def installed?\n MacOS.dev_tools_path == Pathname.new(\"/usr/bin\")\n end", "def installer_package?\n installer_type.blank?\n end", "def is_platform(symbol)\n platform = ENV['PLATFORM'] || 'all'\n platform = platform.downcase # If set, will be frozen.\n\n if platform == 'macos'\n # CocoaPods calls this osx\n platform = 'osx'\n end\n platform = platform.to_sym\n\n if symbol == platform || platform == :all\n puts \"Adding #{symbol} targets to the project\"\n return true\n else\n return false\n end\nend", "def installed?\n false\n end", "def from_iphone?\n app_matcher = /(DustTag|Dust Tag|Fat Tag|Katsu)/\n test = !(self.gml_application =~ app_matcher || self.application =~ app_matcher).blank?\n # puts \"from_iphone?(#{self.gml_application} || #{self.application}) = #{test}\"\n return test\n end", "def release?\n prerelease.empty? && build.empty?\n end", "def installed?\n !!@installed\n end", "def building?\n return (!$game_switches[Yuki::Sw::Env_CanFly] && $game_player.system_tag == 0)\n end", "def ready_for_execution?\n any_signature_pages_signed? && executable_version&.page_count && !any_signature_pages_executing?\n end", "def as_framework?\n (self.installed? and File.exists? prefix+\"Frameworks/Python.framework\") or build_framework?\nend", "def test_framework?\n NewRelic::Agent.config[:framework] == :test\n end" ]
[ "0.72491986", "0.67323536", "0.6594455", "0.6532866", "0.6484054", "0.63872564", "0.63567764", "0.63398707", "0.633865", "0.6174636", "0.6112148", "0.6102487", "0.6090419", "0.60245824", "0.5986401", "0.5958775", "0.5936207", "0.591218", "0.5902242", "0.5862038", "0.585671", "0.5854879", "0.5850457", "0.58499414", "0.5832187", "0.58312094", "0.580826", "0.5803558", "0.57940906", "0.57757026", "0.5760755", "0.57514817", "0.5751463", "0.57400435", "0.5737454", "0.57313836", "0.5723833", "0.5720298", "0.5702496", "0.56939846", "0.56899905", "0.5688891", "0.56859875", "0.56824434", "0.5670975", "0.56418717", "0.5634106", "0.5621203", "0.5614855", "0.5614529", "0.56106484", "0.5609983", "0.5601915", "0.55974305", "0.559114", "0.5565178", "0.5564232", "0.5561897", "0.55592823", "0.5556731", "0.55527896", "0.5552021", "0.55517846", "0.5521732", "0.5520103", "0.5515119", "0.5507858", "0.5499125", "0.5499125", "0.54980874", "0.5487032", "0.54833347", "0.5482865", "0.5475461", "0.5473661", "0.5472211", "0.54675335", "0.54668826", "0.5463193", "0.5455765", "0.5455765", "0.54534775", "0.5448176", "0.5434366", "0.5431556", "0.54287475", "0.54249096", "0.54226077", "0.54126346", "0.5412213", "0.5406593", "0.54055065", "0.539679", "0.53925973", "0.5384487", "0.53840923", "0.5382972", "0.53730243", "0.5372859", "0.53724104" ]
0.73415387
0
True if the app has been built for physical devices
def physical_device? arches.any? do |arch| arch[/arm/, 0] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_physical_device\n return @has_physical_device\n end", "def simulator?\n !physical_device?\n end", "def has_physical_device\n return @has_physical_device\n end", "def physical_device?\n if udid.nil?\n stack = Kernel.caller(0, 6)[0..-1].join(\"\\n\")\n raise RuntimeError,\n %Q[udid is nil\n\n#{stack}\n\n name: #{name}\nversion: #{version}\n]\n end\n !udid[DEVICE_UDID_REGEX, 0].nil?\n end", "def has_physical_device=(value)\n @has_physical_device = value\n end", "def device?\n type == :device\n end", "def has_physical_device=(value)\n @has_physical_device = value\n end", "def building?\n return (!$game_switches[Yuki::Sw::Env_CanFly] && $game_player.system_tag == 0)\n end", "def mobile?\n os_parser.mobile?\n end", "def attached?\n return true if (device_type.to_s != 'device')\n !!( device && File.exists?(device) )\n end", "def is_mobile_device?\n !!mobile_device\n end", "def is_mobile_device?\n !!mobile_device\n end", "def app_is_installed?\n if installed_app_bundle_dir ||\n simctl.app_container(device, app.bundle_identifier)\n true\n else\n false\n end\n end", "def should_build?\n config.auto_build && !dev_server_running?\n end", "def supported?\n supports_platform? && supports_runtime?\n end", "def no_device?\n\ttrue if devices.size < 1\nend", "def mobile?\n true\n end", "def mobile?\n true\n end", "def is_mobile_device?\n self.class.supported_devices.any? do |os, version_range|\n mobile_device_info.operating_system == os &&\n version_range.member?(mobile_device_info.version)\n end\n end", "def installable_platform?\n Gem::Platform.match_spec? spec\n end", "def windows_mobile?\n !!(ua =~ /Windows CE/)\n end", "def screen_is_on?\n dpms_screen_is_on?\n end", "def mobile_device?\n !!(request.user_agent =~ /Mobile|webOS/i)\n end", "def is_mobile_device()\n res = self.send_request 'is_mobile_device'\n return res.body\n end", "def is_arm?\n !RUBY_PLATFORM.index(\"arm64e\").nil?\nend", "def is_arm?\n !RUBY_PLATFORM.index(\"arm64e\").nil?\nend", "def can_post_install?\n return false unless has_os?\n\n ![\"vmware_esxi\", \"hyperv\", \"suse11\", \"suse12\"].include?(os_image_type.downcase)\n end", "def backup_minister_installed?\n software_installed?(APP_NAME)\n end", "def is_mobile?\n !!self.mobile_device_name\n end", "def simulator?\n arches.include?(\"i386\") || arches.include?(\"x86_64\")\n end", "def ios? ; RUBY_PLATFORM =~ /arm-darwin/i end", "def instruments_app_running?\n ps_output = `ps x -o pid,comm | grep Instruments.app | grep -v grep`.strip\n if ps_output[/Instruments\\.app/, 0]\n true\n else\n false\n end\n end", "def mobile?\n is_mobile_device?\n end", "def desktop_request?\n !mobile_request?\n end", "def installed?\n super && source_api.electricity_output_capacity.positive?\n end", "def release_build?\n false # we currently have nothing that qualifies. previously LTS was a type of this\n end", "def booted?\n IO.popen([\"systemctl\", \"is-system-running\"], &:read).chomp != \"offline\"\n end", "def multiple_devices?\n\ttrue if devices.size > 1\nend", "def physical?\n return data.atk_class == 1\n end", "def apple_silicon?\n RUBY_PLATFORM.match(/arm64/)\n end", "def iphone_4?\n GBDeviceInfo.deviceDetails.model == GBDeviceModeliPhone4\n end", "def device_locked?\n @bridge.device_locked?\n end", "def mobile_device?\n request.user_agent =~ /Mobile|webOS/\n end", "def build?\n config[:mode] == :build\n end", "def attached?\n\t\tCommon.device_status(@handle);\n end", "def appium_available?\n `appium -v`\n true\n rescue Errno::ENOENT\n false\n end", "def devkit?\n @kind == :devkit\n end", "def valid_for_platform?; true; end", "def mobile_device?\n if Rails.env.development?\n if session[:mobile_param] \n session[:mobile_param] == \"1\" \n else \n request.user_agent =~ /Mobile/ \n end\n else\n false\n end \n end", "def is_per_device_acceptance_required\n return @is_per_device_acceptance_required\n end", "def ready?\n File.exist?(desktop_path) && \n File.directory?(libs_path)\n end", "def platform?(what)\n\t\t(platform & what).empty? == false\n\tend", "def install?\n return false unless allowed_host?\n return false unless packages_installed?\n true\n end", "def meets_minimum_system_requirements?(resources)\n return true if @option_no_minimum_system_requirements\n (resources['cpu'] >= 4 && resources['ram'] >= 8192)\n end", "def app_available?(app)\n `which #{app}`.strip == \"\" ? false : true\n end", "def os_s\n\t\tif(os == 'iPad' || os == 'BlackBerry' || os == 'iPhone' || os == 'Android')\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend", "def tooling?\n true\n end", "def desktop?\n !is_mobile_device? && !is_tablet_device?\n end", "def android_onboarded\n return @android_onboarded\n end", "def platform_filters_available?\n !options.platform.nil?\n end", "def dev?\n without_extension.end_with?(DEV_IDENTIFIER)\n end", "def version_supported?\n\tKitchenplan::Log.debug \"#{self.class} : Is platform version lower than #{@lowest_version_supported}?\"\n\treturn false if self.version.to_s < @lowest_version_supported\n\ttrue\n end", "def version_supported?\n\tKitchenplan::Log.debug \"#{self.class} : Is platform version lower than #{@lowest_version_supported}?\"\n\treturn false if self.version.to_s < @lowest_version_supported\n\ttrue\n end", "def version_supported?\n\tKitchenplan::Log.debug \"#{self.class} : Is platform version lower than #{@lowest_version_supported}?\"\n\treturn false if self.version.to_s < @lowest_version_supported\n\ttrue\n end", "def windows_phone?\n !!(ua =~ /Windows Phone/)\n end", "def vendor?\n !vendor.empty?\n end", "def is_mobile_device?\n return false if session[:force_agent] == :html\n return true if session[:force_agent] == :mobile\n \n get_device unless @device\n return @device.is_mobile? if @device\n return false\n end", "def mobile?\n @mobile\n end", "def installed?\n false\n end", "def provisional?\n registered? && @provisional\n end", "def used?(device)\n sync do\n dev = devices.detect { |v| v == device }\n next(false) unless dev\n !dev.inherited?\n end\n end", "def provision?\n true\n end", "def is_mobile_device?\n Handset.is_mobile? request.user_agent\n end", "def built?\n @built = false if @built.nil?\n @built\n end", "def present?\n ['/dev/ipmi0', '/dev/ipmi/0', '/dev/ipmidev/0'].find { |dev| File.exist? dev }\n end", "def is_dev?\n @dev\n end", "def locked?\n @bridge.device_locked?\n end", "def installer_appdmg?\n installer_type == \"appdmg\"\n end", "def used?\n !used_ports.empty? || !used_properties.empty?\n end", "def mobile_device?\n # We CAN'T check if the device is an +Appium::Driver+ since it is not a RemoteWebDriver. Because of that we use a\n # flag we got as an option in the constructor.\n @is_mobile_device\n end", "def app_starting?\n @launching\n end", "def installed?\n !!@installed\n end", "def developer?\n config[\"developer\"] == true\n end", "def mobile_device?\r\n if session[:mobile_param]\r\n session[:mobile_param] == \"1\"\r\n else\r\n request.user_agent =~ /Mobile|webOS/\r\n end\r\n end", "def installed?\n source_api.number_of_units.positive? && positive_availability?\n end", "def macys?\n ExecutionEnvironment.macys?\n end", "def have_sip_device?\n self.sip_devices and self.sip_devices.size.to_i > 0\n end", "def sensible_os?\n\n return ::RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ ? false : true\n\n end", "def building?\n self.status == 'building'\n end", "def live?\n configuration.release_stage?\n end", "def available?\n true\n end", "def just_set_up?\n AppConfig[:just_set_up] == true\n end", "def desktop?\n false # FIXME\n end", "def ios_mobile_application_management_enabled\n return @ios_mobile_application_management_enabled\n end", "def has_otp_device?\n !yubico_identity.nil?\n end", "def android?\n platform_name.to_s.upcase == ANDROID\n end", "def sdk_gte_8?\n device.version >= RunLoop::Version.new('8.0')\n end", "def supports_device_licensing\n return @supports_device_licensing\n end", "def android_mobile_application_management_enabled\n return @android_mobile_application_management_enabled\n end", "def baremetal?\n if dell_server?\n !related_switches.empty? && related_volumes.empty? && related_clusters.empty?\n else\n related_volumes.empty? && related_clusters.empty?\n end\n end" ]
[ "0.7209093", "0.7082249", "0.7076486", "0.6745608", "0.67099816", "0.6629076", "0.6607009", "0.6545895", "0.65223587", "0.64753515", "0.64401746", "0.64401746", "0.6433799", "0.6406859", "0.6386592", "0.6385835", "0.6380059", "0.6380059", "0.6361137", "0.63259614", "0.6324706", "0.6314607", "0.63051283", "0.62969464", "0.6279176", "0.6279176", "0.62699217", "0.62658936", "0.62617373", "0.62510484", "0.6250035", "0.6216466", "0.6212115", "0.62090635", "0.6200613", "0.6194292", "0.6182537", "0.6168347", "0.6155787", "0.61539483", "0.6143831", "0.614007", "0.612518", "0.61244744", "0.6123433", "0.6114433", "0.6094397", "0.60918224", "0.6088368", "0.60613143", "0.60573703", "0.60549587", "0.60447073", "0.6038725", "0.60315794", "0.6028719", "0.60206324", "0.6001561", "0.59836215", "0.59775335", "0.5969668", "0.59666616", "0.59666616", "0.59666616", "0.59622747", "0.59619284", "0.5946023", "0.5942545", "0.5940366", "0.5938568", "0.59379226", "0.5926743", "0.59061146", "0.5903982", "0.5894246", "0.58874214", "0.58851695", "0.5884502", "0.5884092", "0.5877519", "0.58661777", "0.5855629", "0.5855521", "0.58551306", "0.584945", "0.58354723", "0.58302575", "0.58295155", "0.5809438", "0.5806921", "0.58063006", "0.5806121", "0.58027697", "0.5800316", "0.5797467", "0.5792396", "0.5783239", "0.5770529", "0.5769725", "0.5769547" ]
0.78236574
0
Inspects the app's file for the server version
def calabash_server_version version = nil executables.each do |executable| version = strings(executable).server_version break if version end version end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def version_info\n path = File.join(SERVER_ROOT, 'public', 'version_info.json')\n JSON.load File.read(path)\nend", "def get_app_version\n if File.exists?(Rails.root.join('VERSION'))\n return File.read(Rails.root.join('VERSION')).strip\n elsif File.directory?(Rails.root.join('.git'))\n return `cd '#{Rails.root}'; git describe`.strip! rescue 'unknown'\n end\n\n 'unknown'\nend", "def version(app, env)\n response = env == \"staging\" ? \"#{app}-#{env}\" : \"#{app}\"\n #if env == \"staging\"\n #response = \"#{app}-#{env}\"\n #else\n #response = \"#{app}\"\n #end\n \":satellite: [CAP #{app.upcase}] version: https://#{response}.medivo.com/version.html\" unless response.empty?\n end", "def get_version_info\n version_file = Rails.root.join('lib', 'version.json')\n\n File.exist?(version_file) ? read_version_file(version_file) : development_version_info\nend", "def server_version\n request(auth: false, expects: 200)['version']\n rescue => ex\n error { \"Server version exception\" }\n error { ex }\n nil\n end", "def app_info\n \"#{app_name} v#{app_version}\"\n end", "def version_info\n # thanks to Roger Pack on ruby-forum for how to get to the version\n # file\n filename = File.open(File.dirname(__FILE__) + \"/../../../VERSION\")\n v = nil\n if File.exists?(filename)\n v = File.open(filename).read.chomp if File.exists?(filename)\n #else\n #$stderr.puts \"could not locate file #{filename}. \" \n #puts `pwd`\n end\n v\n end", "def version_info\n # thanks to Roger Pack on ruby-forum for how to get to the version\n # file\n filename = File.open(File.dirname(__FILE__) + \"/../../VERSION\")\n v = nil\n if File.exists?(filename)\n v = File.open(filename).read.chomp if File.exists?(filename)\n #else\n #$stderr.puts \"could not locate file #{filename}. \" \n #puts `pwd`\n end\n v\n end", "def show_file_version\n\t\t\tputs \" Version: #{@elf_version.to_h}\"\n\t\tend", "def app_version\n return @app_version\n end", "def app_version\n return @app_version\n end", "def application_version\n read('application_version')\n end", "def zapp_version\n host = plant_attributes[self.plant.intern][self.env.intern][:host]\n #results = submit_cmd('show zapp',:topology,\"-host #{host} -csv\",0) \n results = exec_open(\"#{Zapptop} show zapp -host #{host} -csv\") \n puts results\n populate_app_attributes(results,'zapp_version',self.plant.intern,self.env.intern)\n [plant_attributes[self.plant.intern][self.env.intern][:version],plant_attributes[self.plant.intern][self.env.intern][:prodid],plant_attributes[self.plant.intern][self.env.intern][:contact]]\n end", "def server_version\n status['value']['build']['version']\n end", "def fetch_app_version(options)\n metadata = AppRepo::Uploader.new(options).download_manifest_only\n FastlaneCore::UI.command_output('TODO: Parse version out from metadata')\n puts JSON.pretty_generate(metadata) unless metadata.nil?\n FastlaneCore::UI.important('TODO: parse out the bundle-version')\n metadata['bundle-version']\n end", "def server_version; end", "def get_app_ver(app_name)\n app_ver = \"\"\n app_dir = get_app_dir(app_name,app_ver)\n ver_file = app_dir+\"/Contents/Info.plist\"\n if File.exist?(ver_file)\n if app_name.match(/ServeToMe/)\n app_ver = %x[defaults read \"#{ver_file}\" CFBundleVersion].chomp\n else\n cf_check = %x[cat \"#{ver_file}\" | grep CFBundleGetInfoString]\n if cf_check.match(/CFBundleGetInfoString/)\n app_ver = %x[defaults read \"#{ver_file}\" CFBundleGetInfoString].chomp\n end\n if app_ver !~ /[0-9]\\.[0-9]/\n cf_check = %x[cat \"#{ver_file}\" | grep CFBundleShortVersionString]\n if cf_check.match(/CFBundleShortVersionString/)\n app_ver = %x[defaults read \"#{ver_file}\" CFBundleShortVersionString].chomp\n end\n end\n end\n app_ver = app_ver.gsub(/\\.$/,\"\")\n if app_name.match(/Spotify/) and app_ver.match(/g/)\n app_ver = app_ver.split(/\\./)[0..-2].join(\".\")\n end\n if !app_ver\n app_ver = get_min_ver(app_name)\n else\n if !app_ver.match(/[0-9]/)\n app_ver = get_min_ver(app_name)\n end\n end\n app_ver = app_ver.gsub(/#{app_name} /,\"\")\n else\n if $verbose == 1\n puts \"Application information file \"+ver_file+\" does not exist\"\n end\n app_ver = \"Not Installed\"\n end\n return app_ver\nend", "def get_server_version\n server_info[:server_version]\n end", "def app_version\n APP_VERSION\n end", "def get_application_version()\n res = search(\"/ApplicationStatus\")\n root = JSON.parse(res.xmldata)\n\n if ! root.has_key? 'application'\n return nil\n end\n application = root[\"application\"]\n if ! application.has_key? 'user'\n return nil\n end\n user = application[\"user\"]\n if ! user.has_key? 'version'\n return nil\n end\n return user[\"version\"]\n end", "def file\n @file ||= find_version_file\n end", "def app_version\n '0.0.1'\n end", "def version\n p\n version = File.read(HOSTER_PATH+\"/hoster.version\")\n puts PROGNAME + \" version \" + version\nend", "def get_min_ver(app_name)\n min_ver = \"\"\n app_ver = \"\"\n app_dir = get_app_dir(app_name,app_ver)\n ver_file = app_dir+\"/Contents/Info.plist\"\n if File.exist?(ver_file)\n cf_check = %x[cat \"#{ver_file}\" | grep CFBundleVersion]\n if cf_check.match(/CFBundleVersion/)\n min_ver = %x[defaults read \"#{ver_file}\" CFBundleVersion].chomp\n end\n else\n if $verbose == 1\n puts \"Application information file \"+ver_file+\" does not exist\"\n end\n min_ver = \"Not Installed\"\n end\n return min_ver\nend", "def version\n self.class.get(\"/get/version\")\n end", "def get_server_url\n if params && params[:version] && params[:type]\n app_version = Core::Version.find_by(name: params[:version], app_type: params[:type])\n current_version = params[:version].split('.').map{|s|s.to_i}\n latest_version = Core::Version.where(app_type: params[:type]).last.name.split('.').map{|s|s.to_i}\n if app_version.nil? && (current_version <=> latest_version) >= 0\n # this version is the develop version, doesn't exist in our data set\n render :json => {message: Settings.client_heroku_dev_server}, :status => 200\n else\n # otherwise get the production url\n render :json => {message: Settings.client_heroku_server}, :status => 200\n end\n else\n # otherwise get the production url\n render :json => {message: Settings.client_heroku_server}, :status => 200\n end\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 fetch_versions\n http_get(\"#{host}/#{Configuration.versions_file}\").body\n end", "def version_file(path)\n \"#{@home}/versions/#{@version_name}/#{path}\"\nend", "def appcache_version_string\n RailsAppcache.config.version\n end", "def test_version_files_found\n Dir.glob( @setup_issue_show.issues_directory.join('*.show*') ).each do |file|\n version = /(\\d\\.)+/.match( file )[0][0...-1]\n @setup_issue_show.current_version = version\n\n assert_equal \"#{version}.show.html.erb\", @setup_issue_show.show_file.basename.to_s, 'Did not find the expected version file.'\n end\n end", "def version_from_404\n\t\ttarget = \"http://#{@base_uri.host}:#{@base_uri.port.to_s}/#{random_string}\"\n\t\tinfo = []\n\t\tbegin \n\t\t\tstatus, url, ip, body, headers = open_target(target)\n\t\t\t\t\t\t\n\t\t\tif status == 404\n\t\t\t\tv= body.scan(/Apache Tomcat\\/([456]\\.\\d+\\.\\d+)/)[0]\n\t\t\t\tunless v.nil?\n\t\t\t\t\tinfo << {:name=>\"Tomcat version\", :certainty=>100, :version=>v }\n\t\t\t\tend\n\t\t\tend\n\t\trescue\n\t\tend\n\t\tinfo\n\tend", "def server_version\n call! :server_version\n end", "def koi_version\n version_file_path = self.rails_template[/.*(?=templates)/]\n version_file_path += 'koi/version.rb'\n version_data = open(version_file_path) {|f| f.read }\n\n version = version_data.split(\"\\n\")[1].split('=').last.strip.gsub(/\\\"/, '')\nend", "def read_versions\n spec_files.map do |spec_file|\n spec = File.read(spec_file)\n spec.match(/^\\s*Version:\\s*(\\S+)$/)[1]\n end\nend", "def version_file\n version_rb_file = File.dirname(Buildr.application.buildfile.to_s) + '/version.rb'\n return version_rb_file if File.exists?(version_rb_file)\n return Buildr.application.buildfile.to_s\n end", "def app_file\n @app_file ||= Chef::Resource::RemoteFile.new(\n ::File.join(deploy_dir, app_name), run_context\n )\n @app_file.mode('0755')\n @app_file.source(asset_url.to_s)\n @app_file\n end", "def original_application_version\n read('original_application_version')\n end", "def app\n @app ||= Rack::Builder.parse_file(File.join(OpenRecipeApp.root,\"config.ru\"))[0]\n end", "def local_version\n `grep ' * Version' vendor/assets/javascripts/jquery.fancybox.js | \\\n cut -d ' ' -f 4`.chomp\nend", "def version\n @version ||= exec('SHOW server_version')[0]['server_version'].split[0]\n end", "def src_for(filename, env={})\n @semaphore.synchronize do\n refresh(env)\n file = @files[filename]\n unless file and file.has_key? :path\n raise \"#{filename.dump} is not available from file server\"\n end\n \"#{file[:path]}?#{file[:mtime].to_i}\"\n end\n end", "def find_manifest_entry(name)\n if dev_server_running?\n { 'file' => prefix_vite_asset(name.to_s) }\n else\n manifest[name.to_s]\n end\n end", "def version; env['api.version'] end", "def get_current_files\n get_files(OcflTools::Utils.version_string_to_int(@head))\n end", "def contextversion # ook elders gebruiken\n filename = Kpse.found('context.mkii')\n version = 'unknown'\n begin\n if FileTest.file?(filename) && IO.read(filename).match(/\\\\contextversion\\{(\\d+\\.\\d+\\.\\d+.*?)\\}/) then\n version = $1\n end\n rescue\n end\n return version\n end", "def version\n @version ||= File.open(@filename) do |io|\n io.read(8)[5..-1].to_sym\n end\n end", "def server_version\n ServerVersion.new(server_info[\"version\"])\n end", "def changed_files_since_deploy\n if File.exists?(\"log/latest-REVISION-syntaxcheck\")\n revision = File.read(\"log/latest-REVISION-syntaxcheck\").chomp\n\n `git whatchanged #{revision}..HEAD`.split(\"\\n\").select{|l| l =~ /^\\:/}.collect {|l| l.split(\"\\t\")[1]}.sort.uniq\n else\n puts \"log/latest-REVISION-syntaxcheck not found. run 'cap fetch_currently_deployed_version' to get it\"\n []\n end\n end", "def show_file(version, file)\n git(\"show #{version}:#{file}\", cwd: cache_path.to_s)\n end", "def get_rem_ver(app_name)\n app_url = get_app_url(app_name)\n if $verbose == 1\n puts \"Getting version (or date) of latest release from #{app_url}\"\n end\n rem_ver = eval(\"get_#{app_name.downcase.gsub(/ |-/,'_')}_rem_ver(app_name,app_url)\")\n if rem_ver.to_s !~ /[0-9]/\n puts \"Remote build version (or date) not found\"\n exit\n end\n if !rem_ver.class.to_s.match(/Date/)\n rem_ver = rem_ver.gsub(/\\.$/,\"\")\n end\n return rem_ver\nend", "def version\n @version ||= File.read(path('version.txt')).strip\n end", "def file_version(fname)\n fname.split('.')[-2]\n end", "def rails_version\n return 3 if File.exists?(File.join(fetch(:rails_root), 'script', 'rails'))\n return 2 if File.exists?(File.join(fetch(:rails_root), 'script', 'server'))\n nil\nend", "def html_version\n File.open(path,'wb'){|f| f.write code_html}\n `open -a '#{BROWSER_APP}' #{path}`\n end", "def get_loc_ver(app_name)\n loc_ver = eval(\"get_#{app_name.downcase.gsub(/ |-/,'_')}_loc_ver(app_name)\")\n if loc_ver.to_s.match(/Installed/)\n loc_ver = \"Not Installed\"\n end\n return loc_ver\nend", "def get_version(apps)\n apps.each do |app|\n if File.exists?(\"#{app}/Contents/Info.plist\")\n short = app.sub(/\\/Applications\\//, '')\n vers = `/usr/bin/defaults read \"#{app}\"/Contents/Info CFBundleShortVersionString`.chomp\n res = puts \"#{short}: #{vers}\"\n $?.success? ? res : \"ERROR: could not get version\"\n else\n puts \"#{app} is not installed.\"\n end\n end\nend", "def current_version\r\n version = File.read(\"VERSION\").strip\r\n fail \"Invalid version information\" unless version =~ /\\./\r\n version\r\nend", "def version\n @version ||= File.read(path('version.txt')).strip\n end", "def version\n path = File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__\n dir = File.dirname(path)\n if File.exist?(dir+'/version.stamp')\n version = File.read(dir+'/version.stamp')\n else\n version = \"Unknown version\"\n end\n version\n end", "def inspect\n \"#<HG Versioned File: #{to_s}>\"\n end", "def app\n Rack::Lint.new(Verge::Server::Base.new)\n end", "def show\n @app_version = @app.app_versions.find(params[:id])\n # @app_version = AppVersion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @app_version }\n end\n end", "def server_version\n check_connection\n @protocol.server_version\n end", "def get_runtime(path = '.')\n File.open(path + \"/runtime/src/lib.rs\") do |f|\n f.find { |l| l =~ /spec_version:/ }.match(/[0-9]+/)[0]\n end\nend", "def version\n content = File.read(File.join(@path, 'Gemfile.lock'))\n content.match(REGEX_VERSION)[1]\n rescue\n raise Pbtd::Error::FileNotFound, \"Your Gemfile.lock not found for this environment\"\n end", "def api_version\n self.class.get('/api')['api_ver']\n end", "def server_version\n server_info.present? ? @server_info[:parseServerVersion] : nil\n end", "def app_root_for app, version\n\t\t\t\"#{Nacreon::Config.deploy_root}/#{app.name}/#{version.name}\"\n\t\tend", "def app_ver\n @values.fetch('appVer') { \n @values['appVer'] = nil\n }\n end", "def get_version_short_string(path)\n plist_hash = info_plist_to_hash path\n plist_hash['CFBundleShortVersionString']\nend", "def check_version_from_custom_file(uripath, regex, fixed_version = nil, vuln_introduced_version = nil)\n res = send_request_cgi(\n 'uri' => uripath,\n 'method' => 'GET'\n )\n\n unless res && res.code == 200\n return Msf::Exploit::CheckCode::Unknown(\"Unable to retrieve the custom file\")\n end\n\n extract_and_check_version(res.body.to_s, :custom, 'custom file', fixed_version, vuln_introduced_version, regex)\n end", "def file_version(filepath)\n file_version_info_size = client.railgun.version.GetFileVersionInfoSizeA(\n filepath,\n nil\n )['return']\n\n buffer = session.railgun.kernel32.VirtualAlloc(\n nil,\n file_version_info_size,\n MEM_COMMIT|MEM_RESERVE,\n PAGE_READWRITE\n )['return']\n\n client.railgun.version.GetFileVersionInfoA(\n filepath,\n 0,\n file_version_info_size,\n buffer\n )\n\n result = client.railgun.version.VerQueryValueA(buffer, \"\\\\\", 4, 4)\n ffi = client.railgun.memread(result['lplpBuffer'], result['puLen'])\n\n vs_fixed_file_info = ffi.unpack('V13')\n\n unless vs_fixed_file_info and (vs_fixed_file_info.length == 13)\tand\n(vs_fixed_file_info[0] = 0xfeef04bd)\n return nil\n end\n\n major = hiword(vs_fixed_file_info[2])\n minor = loword(vs_fixed_file_info[2])\n build = hiword(vs_fixed_file_info[3])\n revision = loword(vs_fixed_file_info[3])\n branch = revision.to_s[0..1].to_i\n\n return major, minor, build, revision, branch\n end", "def mounted_apps_of(file)\n Padrino.mounted_apps.select { |app| File.identical?(file, app.app_file) }\n end", "def app_version=(value)\n @app_version = value\n end", "def app_version=(value)\n @app_version = value\n end", "def app_file_path\n File.join(tmp_dir, \"example_app_#{$example_app_counter}.rb\")\n end", "def json_for_version(version)\n JSON.parse(json_pathname(version).read)['content']\n end", "def vserver\n @vfiler\n end", "def version\n copy_file('VERSION', 'VERSION')\n end", "def server_version\n db.server_version(@opts[:server])\n end", "def totest_version\n Rails.cache.fetch(\"totest_version_for_#{name}\", expires_in: 10.minutes) do\n begin\n d = Xmlhash.parse(ActiveXML::backend.direct_http \"/build/#{name}:ToTest/#{TOTEST_VERSION_FILE}\")\n d.elements('binary') do |b|\n matchdata = %r{.*Snapshot(.*)-Media\\.iso$}.match(b['filename'])\n return matchdata[1] if matchdata\n end\n rescue\n nil\n end\n end\n end", "def get_app_version_name()\n return get_version_code(\n #app_folder_name:\"project\"\n gradle_file_path:\"build.gradle\",\n ext_constant_name:\"versionName\"\n )\nend", "def health_check\n render json: {\n rails_version: Rails.version,\n deploy_version: ENV.fetch(\"DEPLOY_VERSION\")\n }, status: :ok\n end", "def current_deployed_version\n 5\n end", "def app_server\n app_server_integration.name\n end", "def application_version\n return @application_version\n end", "def application_version\n return @application_version\n end", "def version\n api_execute('/version', :get).body\n end", "def connectorj_ver\n new_resource.url.match(/[0-9]+\\.[0-9]+\\.[0-9]+/)[0]\n end", "def get_app_version_code()\n return get_version_code(\n #app_folder_name:\"project\"\n gradle_file_path:\"build.gradle\",\n ext_constant_name:\"versionCode\"\n )\nend", "def public_file_server; end", "def public_file_server; end", "def find_server_attributes_swift_file\n project_folder_path = ARGV[0]\n project_folder_path = project_folder_path.strip.gsub('\\\\','')\n FastlaneCore::UI.important \"🔍 Searching ServerAttributes.swift file inside folder: #{project_folder_path}.\"\n @server_attributes_file_path = Dir[\"#{project_folder_path}**/**/ServerAttributes.swift\"][0]\n FastlaneCore::UI.important \"👊 Found ServerAttributes.swift file at path: #{@server_attributes_file_path}.\"\n end", "def locate_app_file\n app_const = app_constant\n\n candidates = []\n candidates << app_const.app_file if app_const.respond_to?(:app_file)\n candidates << Padrino.first_caller if File.identical?(Padrino.first_caller.to_s, Padrino.called_from.to_s)\n candidates << Padrino.mounted_root(name.downcase, \"app.rb\")\n simple_name = name.split(\"::\").last.downcase\n mod_name = name.split(\"::\")[0..-2].join(\"::\")\n Padrino.modules.each do |mod|\n if mod.name == mod_name\n candidates << mod.root(simple_name, \"app.rb\")\n end\n end\n candidates << Padrino.root(\"app\", \"app.rb\")\n candidates.find { |candidate| File.exist?(candidate) }\n end", "def puppetserver_version_on(host)\n result = on(host, 'puppetserver --version', accept_all_exit_codes: true)\n if result.exit_code.zero?\n matched = result.stdout.strip.scan(/\\d+\\.\\d+\\.\\d+/)\n return matched.first\n end\n nil\n end", "def get_version_info(apk_file)\n version_info = Hash.new\n if(File.exist? apk_file)\n @@log.info(\"Running aapt on APK file: #{apk_file}\")\n aapt_executor = AaptExecutor.new(apk_file)\n version_info = aapt_executor.get_version_info\n else\n @@log.error(\"APK file does not exist. #{apk_file}\")\n end\n version_info\n end", "def version_installed()\n droplet=droplet_file_path()\n return unless droplet\n version_available_file = version_available_file_path()\n unless version_available_file\n puts \"Don't know what file stores the version installed of #{@current_name}\" if VMC::Cli::Config.trace\n return\n end\n cmd = cmd_read_version_installed()\n unless cmd\n puts \"Don't know how to read the version installed with a cmd.\" if VMC::Cli::Config.trace\n return\n end\n puts \"Looking for the installed version here #{droplet} // #{version_available_file}\" if VMC::Cli::Config.trace\n puts \" with cmd #{cmd}\" if VMC::Cli::Config.trace\n droplet_dot_version=\"#{droplet}.version\"\n unless File.exists? droplet_dot_version\n Dir.chdir(\"/tmp\") do\n `[ -f #{version_available_file} ] && rm #{version_available_file}`\n `tar -xzf #{droplet} #{version_available_file}`\n if File.exist?(version_available_file)\n `cp #{version_available_file} #{droplet_dot_version}`\n else\n put \"Could not find the installed version file here: here #{droplet} // #{version_available_file}\" if VMC::Cli::Config.trace\n end\n end\n end\n installed_version=read_version(droplet_dot_version,cmd)\n end", "def iOSVersion\n\treturn server_version[\"iOS_version\"]\nend", "def iiif\n return unless manifestable? && file_set\n \"#{iiif_path}/info.json\"\n end" ]
[ "0.6794606", "0.625704", "0.61288667", "0.6110509", "0.6073814", "0.6047778", "0.6046727", "0.6029775", "0.6027853", "0.6011089", "0.6011089", "0.5997139", "0.599433", "0.5979038", "0.5923165", "0.58796096", "0.585552", "0.5813605", "0.5812535", "0.5723691", "0.57144445", "0.57022434", "0.5698862", "0.5693705", "0.5690442", "0.5682219", "0.56673354", "0.5666409", "0.56365013", "0.5631267", "0.56303614", "0.56239814", "0.56075865", "0.5602288", "0.55975616", "0.5597501", "0.55411226", "0.5538084", "0.55320364", "0.55286336", "0.55264413", "0.5504363", "0.55033314", "0.5502551", "0.5499153", "0.5486324", "0.5483422", "0.5474987", "0.5449832", "0.54399204", "0.54200107", "0.5416227", "0.5411209", "0.5399617", "0.5398525", "0.5383838", "0.53821826", "0.53782064", "0.5374102", "0.53736836", "0.5373081", "0.53720343", "0.5366676", "0.5361956", "0.535665", "0.53510046", "0.53431123", "0.53428996", "0.5338397", "0.5333794", "0.53316104", "0.5330206", "0.5328604", "0.5323532", "0.5319575", "0.5319575", "0.5317104", "0.5310146", "0.53062844", "0.5304425", "0.52989393", "0.52979755", "0.5297838", "0.5295904", "0.5294437", "0.52933323", "0.5291059", "0.5291059", "0.5281486", "0.5277806", "0.5258676", "0.5258578", "0.5258578", "0.5246215", "0.5232264", "0.52286226", "0.5222039", "0.52209514", "0.52174", "0.5217304" ]
0.5596729
36
Returns the CFBundleShortVersionString of the app as Version instance. Apple docs: CFBundleShortVersionString specifies the release version number of the bundle, which identifies a released iteration of the app. The release version number is a string comprised of three periodseparated integers. The first integer represents major revisions to the app, such as revisions that implement new features or major changes. The second integer denotes revisions that implement less prominent features. The third integer represents maintenance releases. The value for this key differs from the value for CFBundleVersion, which identifies an iteration (released or unreleased) of the app. This key can be localized by including it in your InfoPlist.strings files.
def marketing_version string = plist_buddy.plist_read("CFBundleShortVersionString", info_plist_path) begin version = RunLoop::Version.new(string) rescue if string && string != "" RunLoop.log_debug("CFBundleShortVersionString: '#{string}' is not a well formed version string") else RunLoop.log_debug("CFBundleShortVersionString is not defined in Info.plist") end version = nil end version end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_version_short_string(path)\n plist_hash = info_plist_to_hash path\n plist_hash['CFBundleShortVersionString']\nend", "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 versionString()\n\t\t\t\treturn \"#{major}.#{minor}.#{build}\"\n\t\t\tend", "def get_version\n\t\tself.dev_stage.blank? ? dev_stage_string = \"\" : dev_stage_string = self.dev_stage + \" \"\n\t\treturn dev_stage_string + self.maj_version.to_s + \".\" + self.min_version.to_s\n\tend", "def version\n @version ||= version_hex.to_s(16).chars.entries.join('.')\n end", "def to_s\n version = get_version_string\n version << \"-#{get_pre_string}\" unless @pre == nil\n version << \"+#{get_build_string}\" unless @build == nil\n version\n end", "def version\n build_string\n end", "def version\n unless @version\n\n # Extract version information (if available)\n @version = metadata['bundleShortVersionString'] || metadata['bundleVersion'] rescue nil\n\n # Otherwise, use the filename\n unless @version\n @version = filename[FILENAME_VERSION_REGEX, 1]\n end\n\n end\n\n @version\n end", "def version_name\n self.class.version_names.join('_').to_sym unless self.class.version_names.blank?\n end", "def version(app, env)\n response = env == \"staging\" ? \"#{app}-#{env}\" : \"#{app}\"\n #if env == \"staging\"\n #response = \"#{app}-#{env}\"\n #else\n #response = \"#{app}\"\n #end\n \":satellite: [CAP #{app.upcase}] version: https://#{response}.medivo.com/version.html\" unless response.empty?\n end", "def version\n [@major_version, @minor_version].join('.')\n end", "def get_version(version)\n \"V#{version.gsub('-','_')}\"\n end", "def app_version\n return @app_version\n end", "def app_version\n return @app_version\n end", "def to_s\n @version\n end", "def to_s\n @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 version\n (version_from_class.to_f / 10).to_s\n end", "def version\n @version_helper.to_s\n end", "def version\n @version_helper.to_s\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 to_s\n @version\n end", "def to_s\n \"<Version #{number}>\"\n end", "def version_const\n \"Version_\" + @__version.upcase.gsub(\".\", \"_\")\n end", "def pkg_version(item)\n # refactoring! :revision points to same revision as item!\n v = revision.checkout.extract_version\n return \"#{v}pre.#{item.version}.#{item.id}\"\n end", "def app_info\n \"#{app_name} v#{app_version}\"\n end", "def application_version\n read('application_version')\n end", "def version_tag\n version_composition.join(\".\")\n end", "def app_ver\n @values.fetch('appVer') { \n @values['appVer'] = nil\n }\n end", "def to_s\n self.version.to_s\n end", "def get_app_ver(app_name)\n app_ver = \"\"\n app_dir = get_app_dir(app_name,app_ver)\n ver_file = app_dir+\"/Contents/Info.plist\"\n if File.exist?(ver_file)\n if app_name.match(/ServeToMe/)\n app_ver = %x[defaults read \"#{ver_file}\" CFBundleVersion].chomp\n else\n cf_check = %x[cat \"#{ver_file}\" | grep CFBundleGetInfoString]\n if cf_check.match(/CFBundleGetInfoString/)\n app_ver = %x[defaults read \"#{ver_file}\" CFBundleGetInfoString].chomp\n end\n if app_ver !~ /[0-9]\\.[0-9]/\n cf_check = %x[cat \"#{ver_file}\" | grep CFBundleShortVersionString]\n if cf_check.match(/CFBundleShortVersionString/)\n app_ver = %x[defaults read \"#{ver_file}\" CFBundleShortVersionString].chomp\n end\n end\n end\n app_ver = app_ver.gsub(/\\.$/,\"\")\n if app_name.match(/Spotify/) and app_ver.match(/g/)\n app_ver = app_ver.split(/\\./)[0..-2].join(\".\")\n end\n if !app_ver\n app_ver = get_min_ver(app_name)\n else\n if !app_ver.match(/[0-9]/)\n app_ver = get_min_ver(app_name)\n end\n end\n app_ver = app_ver.gsub(/#{app_name} /,\"\")\n else\n if $verbose == 1\n puts \"Application information file \"+ver_file+\" does not exist\"\n end\n app_ver = \"Not Installed\"\n end\n return app_ver\nend", "def version\n app = detect_product(GSA) || detect_product(GOOGLEPODCASTS)\n app.version\n end", "def package_version\n @semver.to_s '%M.%m.%p%s'\n end", "def build_version\n string = plist_buddy.plist_read(\"CFBundleVersion\", info_plist_path)\n begin\n version = RunLoop::Version.new(string)\n rescue\n if string && string != \"\"\n RunLoop.log_debug(\"CFBundleVersion: '#{string}' is not a well formed version string\")\n else\n RunLoop.log_debug(\"CFBundleVersion is not defined in Info.plist\")\n end\n version = nil\n end\n version\n end", "def version_number\n \"#{self.major}.#{self.minor}\"\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 version\n \"Version: #{VERSION.split[1]} Created on: \" +\n \"#{REVISION_DATE.split[1]} by #{AUTHOR}\"\n end", "def version\n \"Version: #{VERSION.split[1]} Created on: \" +\n \"#{REVISION_DATE.split[1]} by #{AUTHOR}\"\n end", "def version\n \"Version: #{VERSION.split[1]} Created on: \" +\n \"#{REVISION_DATE.split[1]} by #{AUTHOR}\"\n end", "def get_app_version_name()\n return get_version_code(\n #app_folder_name:\"project\"\n gradle_file_path:\"build.gradle\",\n ext_constant_name:\"versionName\"\n )\nend", "def version_without_build\n version.split('-')[0]\n end", "def version\n name.split('_')[1]\n end", "def version_name\n if self.version.nil?\n 'First Submission'\n else\n \"#{self.version.ordinalize}\"\n end\n end", "def version_key(key)\n return \"#{key}_v#{VERSION}\"\n end", "def ver\n @values.fetch('ai.application.ver') { \n @values['ai.application.ver'] = nil\n }\n end", "def full_version\n return nil unless exact\n\n \"~> \".concat(version)\n end", "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 appcache_version_string\n RailsAppcache.config.version\n end", "def ver\n @values['ver']\n end", "def API_version(options={})\n return \"#{@major}.#{@minor}\"\n end", "def getterminalappversion()\r\n return getvalue(SVTags::TERMINAL_APP_VERSION)\r\n end", "def get_min_ver(app_name)\n min_ver = \"\"\n app_ver = \"\"\n app_dir = get_app_dir(app_name,app_ver)\n ver_file = app_dir+\"/Contents/Info.plist\"\n if File.exist?(ver_file)\n cf_check = %x[cat \"#{ver_file}\" | grep CFBundleVersion]\n if cf_check.match(/CFBundleVersion/)\n min_ver = %x[defaults read \"#{ver_file}\" CFBundleVersion].chomp\n end\n else\n if $verbose == 1\n puts \"Application information file \"+ver_file+\" does not exist\"\n end\n min_ver = \"Not Installed\"\n end\n return min_ver\nend", "def full\n @version\n end", "def latest_production\n Origen::VersionString.new(origen[:latest_version_prod])\n end", "def to_s\n \"#{@major}.#{@minor}.#{@update} Build #{@build}\"\n end", "def latest_development\n Origen::VersionString.new(origen[:latest_version_dev])\n end", "def version_key version=nil\n\n version = \"release\" if version.blank?\n\n Rails.logger.info \"*\"*25\n Rails.logger.info \"VersionKey:\"\n Rails.logger.info version\n\n case version\n when 'release' then 'release'\n when 'canary' then $redis.lindex('releases',0)\n else\n version\n end\n end", "def productVersion \n \"productVersion\" \n end", "def version\n @instruments_version ||= lambda do\n version_string = pbuddy.plist_read('CFBundleShortVersionString',\n path_to_instruments_app_plist)\n RunLoop::Version.new(version_string)\n end.call\n end", "def getsfLma__PackageVersionObjName\r\n\t\t\treturn \"sfLma__Package_Version__c\"\r\n\t\tend", "def rubygems_version_string\n VERSION.gsub(/[-\\+]/,'.')\n end", "def to_s\n self.api_version\n end", "def to_version_string(version)\n version = version.to_s\n if version.match(/\\./)\n version\n else\n from_version_code(version).to_s\n end\n end", "def current_version_key\n \"#{::Album.hash_schema_version}.#{current_versions.version(self.album_type)}\"\n end", "def to_s\n getUIversion().to_s\n end", "def to_s\n getUIversion().to_s\n end", "def to_s\n getUIversion().to_s\n end", "def to_s\n getUIversion().to_s\n end", "def to_s\n getUIversion().to_s\n end", "def application_version\n return @application_version\n end", "def application_version\n return @application_version\n end", "def version\n @gemspec.version || @version_helper.to_s\n end", "def to_s\n getUIversion.to_s\n end", "def tag_version\n v = @git_repo.lib.describe('--long').split('-')\n tag_version = v[0].split('.')\n tag_version[0].gsub!('v', '')\n r = {\n major: tag_version[0],\n minor: tag_version[1],\n revision: tag_version[2],\n short_hash: v[2],\n long_hash: long_hash,\n changes_since_last_tag: v[1]\n }\n puts \"GitRevision: tag_version #{r.inspect}\" if @debug\n r\n end", "def name_with_version\n if self.version.nil?\n return name\n else\n return [name, version].join(':')\n end\n end", "def version\n '2.0.7.7' # Version number <major-update>.<minor-update>.<patch-update>.<commit-count>\n end", "def version\n options['version']\n end", "def version\n \"\\e[36mThis program is currently in version number: #{v_num}\\e[0m\"\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 v string\n Gem::Version.create string\n end", "def v string\n Gem::Version.create string\n end", "def version\n super.to_s\n end", "def version\n super.to_s\n end", "def xlate_minor_version()\n return MIN_VERSION_XLATES[@minor_version] if (MIN_VERSION_XLATES.has_key?(@minor_version))\n return(@minor_version.to_s) \n end", "def version_number\n @version\n end", "def name_and_version\n [display_name, version].compact.join(' ')\n end", "def server_version\n status['value']['build']['version']\n end", "def build_version\n @semver.to_s '%M.%m.%p'\n end", "def get_last_build_version(appName)\n appcenter_fetch_version_number(\n api_token: ENV['APPCENTER_API_TOKEN'],\n owner_name: ENV['APPCENTER_OWNER_NAME'],\n app_name: appName\n )\nend", "def fetch_app_version(options)\n metadata = AppRepo::Uploader.new(options).download_manifest_only\n FastlaneCore::UI.command_output('TODO: Parse version out from metadata')\n puts JSON.pretty_generate(metadata) unless metadata.nil?\n FastlaneCore::UI.important('TODO: parse out the bundle-version')\n metadata['bundle-version']\n end", "def version\n VERSION\n end", "def version\n self.class.name + ' ' + VERSION\n end", "def get_version\n request('getVersion')\n end", "def full_version\n segments = self.segments\n segments.push 0 while segments.size < 3\n segments.join(\".\")\n end", "def version\n response = get('/getVersion', {}, false)\n ApiVersion.new(response.body['version'], response.body['builddate'])\n end", "def version\n [ \"lib/#{ name }.rb\", \"lib/#{ name }/version.rb\" ].each do |v|\n path = project_path( v )\n line = path.read[/^\\s*VERSION\\s*=\\s*.*/]\n if line then\n return line.match(/.*VERSION\\s*=\\s*['\"](.*)['\"]/)[1]\n end\n end\n end", "def version\n VERSION\n end", "def app_version\n APP_VERSION\n end", "def version_number\n return @version_number\n end", "def version\n self[:version]\n end" ]
[ "0.719738", "0.6818819", "0.6684686", "0.65164167", "0.6411788", "0.6387728", "0.63853985", "0.6211624", "0.61269206", "0.6105226", "0.6074693", "0.6070289", "0.60635144", "0.60635144", "0.60511786", "0.60511786", "0.60455155", "0.6037908", "0.603283", "0.603283", "0.6031106", "0.60243654", "0.6022616", "0.60148084", "0.59878534", "0.5981538", "0.5951162", "0.59475505", "0.59443706", "0.5928691", "0.5925254", "0.59234864", "0.5907896", "0.5897433", "0.588781", "0.58784837", "0.58670473", "0.58670473", "0.58669823", "0.5865539", "0.5854516", "0.58362824", "0.5805831", "0.5803832", "0.5791897", "0.57914764", "0.5786798", "0.5782417", "0.57692295", "0.5765892", "0.57556945", "0.5734713", "0.5734691", "0.571406", "0.5713239", "0.569874", "0.56725866", "0.56715643", "0.5659661", "0.56529355", "0.565089", "0.5643378", "0.5628492", "0.5601015", "0.5597896", "0.5597896", "0.5597896", "0.5597896", "0.5597896", "0.55873233", "0.55873233", "0.5582", "0.5578434", "0.5575905", "0.5572012", "0.5564417", "0.5559079", "0.5553461", "0.55498266", "0.55355465", "0.55355465", "0.5527718", "0.5527718", "0.5521209", "0.5518569", "0.5509352", "0.5489008", "0.5488378", "0.54876196", "0.54840547", "0.54751027", "0.5469823", "0.5467283", "0.5466843", "0.5466556", "0.5455475", "0.544528", "0.5442292", "0.5435306", "0.5431802" ]
0.6532217
3
Returns the CFBundleVersion of the app as Version instance. Apple docs: CFBundleVersion specifies the build version number of the bundle, which identifies an iteration (released or unreleased) of the bundle. The build version number should be a string comprised of three nonnegative, periodseparated integers with the first integer being greater than zero. The string should only contain numeric (09) and period (.) characters. Leading zeros are truncated from each integer and will be ignored (that is, 1.02.3 is equivalent to 1.2.3).
def build_version string = plist_buddy.plist_read("CFBundleVersion", info_plist_path) begin version = RunLoop::Version.new(string) rescue if string && string != "" RunLoop.log_debug("CFBundleVersion: '#{string}' is not a well formed version string") else RunLoop.log_debug("CFBundleVersion is not defined in Info.plist") end version = nil end version end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def version\n unless @version\n\n # Extract version information (if available)\n @version = metadata['bundleShortVersionString'] || metadata['bundleVersion'] rescue nil\n\n # Otherwise, use the filename\n unless @version\n @version = filename[FILENAME_VERSION_REGEX, 1]\n end\n\n end\n\n @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 marketing_version\n string = plist_buddy.plist_read(\"CFBundleShortVersionString\", info_plist_path)\n begin\n version = RunLoop::Version.new(string)\n rescue\n if string && string != \"\"\n RunLoop.log_debug(\"CFBundleShortVersionString: '#{string}' is not a well formed version string\")\n else\n RunLoop.log_debug(\"CFBundleShortVersionString is not defined in Info.plist\")\n end\n version = nil\n end\n version\n end", "def version\n @version ||= version_hex.to_s(16).chars.entries.join('.')\n end", "def version\n (version_from_class.to_f / 10).to_s\n end", "def version\n @version ||= if token.nil? || Array(packages).empty?\n '0.1.0'\n else\n packages.map do |p|\n Gem::Version.new(p['version'])\n end.sort.last.bump.to_s << '.0'\n end\n end", "def app_version\n return @app_version\n end", "def app_version\n return @app_version\n end", "def get_app_ver(app_name)\n app_ver = \"\"\n app_dir = get_app_dir(app_name,app_ver)\n ver_file = app_dir+\"/Contents/Info.plist\"\n if File.exist?(ver_file)\n if app_name.match(/ServeToMe/)\n app_ver = %x[defaults read \"#{ver_file}\" CFBundleVersion].chomp\n else\n cf_check = %x[cat \"#{ver_file}\" | grep CFBundleGetInfoString]\n if cf_check.match(/CFBundleGetInfoString/)\n app_ver = %x[defaults read \"#{ver_file}\" CFBundleGetInfoString].chomp\n end\n if app_ver !~ /[0-9]\\.[0-9]/\n cf_check = %x[cat \"#{ver_file}\" | grep CFBundleShortVersionString]\n if cf_check.match(/CFBundleShortVersionString/)\n app_ver = %x[defaults read \"#{ver_file}\" CFBundleShortVersionString].chomp\n end\n end\n end\n app_ver = app_ver.gsub(/\\.$/,\"\")\n if app_name.match(/Spotify/) and app_ver.match(/g/)\n app_ver = app_ver.split(/\\./)[0..-2].join(\".\")\n end\n if !app_ver\n app_ver = get_min_ver(app_name)\n else\n if !app_ver.match(/[0-9]/)\n app_ver = get_min_ver(app_name)\n end\n end\n app_ver = app_ver.gsub(/#{app_name} /,\"\")\n else\n if $verbose == 1\n puts \"Application information file \"+ver_file+\" does not exist\"\n end\n app_ver = \"Not Installed\"\n end\n return app_ver\nend", "def version_for(version_string)\n Mixlib::Versioning.parse(version_string)\n end", "def version\n root.attribute('version').value.split('.').map { |n| n.to_i }\n end", "def get_min_ver(app_name)\n min_ver = \"\"\n app_ver = \"\"\n app_dir = get_app_dir(app_name,app_ver)\n ver_file = app_dir+\"/Contents/Info.plist\"\n if File.exist?(ver_file)\n cf_check = %x[cat \"#{ver_file}\" | grep CFBundleVersion]\n if cf_check.match(/CFBundleVersion/)\n min_ver = %x[defaults read \"#{ver_file}\" CFBundleVersion].chomp\n end\n else\n if $verbose == 1\n puts \"Application information file \"+ver_file+\" does not exist\"\n end\n min_ver = \"Not Installed\"\n end\n return min_ver\nend", "def application_version\n read('application_version')\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 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_without_build\n version.split('-')[0]\n end", "def v string\n Gem::Version.create string\n end", "def v string\n Gem::Version.create string\n end", "def minor_version(version = nil)\n version ||= installed_version?\n return \"0.0\" if version.nil?\n\n version.sub(/\\.\\d+$/, '')\n end", "def version\n @version ||= File.read(path('version.txt')).strip\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 version\n [@major_version, @minor_version].join('.')\n end", "def version\n [ \"lib/#{ name }.rb\", \"lib/#{ name }/version.rb\" ].each do |v|\n path = project_path( v )\n line = path.read[/^\\s*VERSION\\s*=\\s*.*/]\n if line then\n return line.match(/.*VERSION\\s*=\\s*['\"](.*)['\"]/)[1]\n end\n end\n end", "def version\n @version ||= `git --version`.split(/\\s/).last.split(\".\").collect {|i| i.to_i}\n end", "def version\n '2.0.7.7' # Version number <major-update>.<minor-update>.<patch-update>.<commit-count>\n end", "def major_version(version = nil)\n version ||= installed_version?\n return \"0\" if version.nil?\n\n version.sub(/(\\.\\d+)+$/, '')\n end", "def version\n m = VERSION_REGEX.match(@text)\n return -1 unless m\n\n m[1].to_i\n end", "def version\n name.split('_')[1]\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 version(arg = nil)\n if arg\n @version = Chef::Version.new(arg)\n end\n\n @version.to_s\n end", "def major_version\n version.match(/(\\d\\.\\d)/)[0] if name.is_a? String\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_const\n \"Version_\" + @__version.upcase.gsub(\".\", \"_\")\n end", "def version_number\n \"#{self.major}.#{self.minor}\"\n end", "def version\n @version ||= File.read(path('version.txt')).strip\n end", "def version\n build_string\n end", "def versionString()\n\t\t\t\treturn \"#{major}.#{minor}.#{build}\"\n\t\t\tend", "def version\n version_file = File.join(RAILS_ROOT, \"config\", \"version.ini\")\n current_version = if File.exists? version_file\n File.read(version_file)\n else\n \"0.0.1\"\n end\n current_version.strip\n end", "def get_last_build_version(appName)\n appcenter_fetch_version_number(\n api_token: ENV['APPCENTER_API_TOKEN'],\n owner_name: ENV['APPCENTER_OWNER_NAME'],\n app_name: appName\n )\nend", "def version_number\n @version\n end", "def version\n @version ||= File.read(file)[version_regex]\n end", "def version\n return @version if defined?(@version)\n \n @version = JSON.parse(File.read('package.json'))['version']\nend", "def version_from_ruby_version_file\n shell_return = run_shell(\"cat .ruby-version\")\n shell_return.nil? ? nil : shell_return.stdout\n end", "def version\n app = detect_product(GSA) || detect_product(GOOGLEPODCASTS)\n app.version\n end", "def application_version\n return @application_version\n end", "def application_version\n return @application_version\n end", "def version\n path = File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__\n dir = File.dirname(path)\n if File.exist?(dir+'/version.stamp')\n version = File.read(dir+'/version.stamp')\n else\n version = \"Unknown version\"\n end\n version\n end", "def get_version_short_string(path)\n plist_hash = info_plist_to_hash path\n plist_hash['CFBundleShortVersionString']\nend", "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 update_app_version_numbers()\n \n version_string = ENV[\"FORCED_VERSION_NUMBER_STRING\"]\n xcode_project_version = nil\n \n if version_string != nil && version_string.length > 0\n\n puts \"using forced version \\\"#{version_string}\\\"\"\n\n else\n\n version_string = get_semver_from_branch\n\n if version_string == nil\n\n app_store_build_number(live: false)\n latest_app_store_version = lane_context[SharedValues::LATEST_VERSION]\n xcode_project_version = get_project_xcode_version\n\n # use largest version (note ascii comparison - not sure if accurate enough)\n version_string = latest_app_store_version > xcode_project_version ? latest_app_store_version : xcode_project_version\n puts \"using version #{version_string} (latest app store = #{latest_app_store_version}, project version = #{xcode_project_version})\"\n\n end\n\n end\n\n # increment build number\n forced_build_number = ENV[\"FORCED_BUILD_NUMBER\"]\n unless forced_build_number == nil || forced_build_number.empty?\n puts \"using forced build number \\\"#{forced_build_number}\\\"\"\n build_number = forced_build_number\n increment_build_number(build_number: build_number)\n else\n current_build_number = latest_testflight_build_number(version: version_string, initial_build_number: 0)\n\n if current_build_number == 0\n if m = version_string.match($semver_regex)\n # if no existing number was found we need to check variations of the same version\n # since Apple handles 1, 1.0, and 1.0.0 independently, but they share build number\n puts \"build number is 0 - checking version variations in case there's a match\"\n\n major = m.captures[0]\n minor = m.captures[1]\n patch = m.captures[2]\n\n puts \"major=#{major} minor=#{minor} patch=#{patch}\"\n if patch == \"0\"\n variation = \"#{major}.#{minor}\"\n current_build_number = latest_testflight_build_number(version: variation, initial_build_number: 0)\n puts \"variation \\\"#{variation}\\\" = #{current_build_number}\"\n \n if current_build_number == 0 && minor == \"0\"\n variation = major\n current_build_number = latest_testflight_build_number(version: variation, initial_build_number: 0)\n puts \"variation \\\"#{variation}\\\" = #{current_build_number}\"\n end\n end\n else\n UI.important \"build number is 0 and version is not semantically correct - unable to check version variations (build number may be incorrect)\"\n end\n \n end\n\n build_number = current_build_number + 1\n increment_build_number(build_number: build_number)\n end\n\n # set version number\n current_version_string = xcode_project_version || get_project_xcode_version\n increment_version_number(version_number: version_string)\n\n\n puts \"build_number #{current_build_number} => #{build_number}\"\n puts \"version_number #{current_version_string} => #{version_string}\"\n end", "def osgi_version_for(version)\n parts = version.split(/[\\.,-]/)\n result = Array.new(3, 0)\n parts.each_index { |i|\n if (result.size == 3) then\n if (parts[i] =~ /\\d+/) then result[i] = parts[i] else result = result << parts[i] end\n else\n result[3] = [result[3], parts[i]].join(\"-\")\n end\n }\n result.join(\".\")\nend", "def get_app_version\n if File.exists?(Rails.root.join('VERSION'))\n return File.read(Rails.root.join('VERSION')).strip\n elsif File.directory?(Rails.root.join('.git'))\n return `cd '#{Rails.root}'; git describe`.strip! rescue 'unknown'\n end\n\n 'unknown'\nend", "def version\n logger.debug \"Parsing version from output using #{description}\"\n matches = output.match PARSE_VERSION_FROM_OUTPUT\n raise InvalidFormat.new output if matches.nil?\n matches.captures[0]\n end", "def version\n content = File.read(File.join(@path, 'Gemfile.lock'))\n content.match(REGEX_VERSION)[1]\n rescue\n raise Pbtd::Error::FileNotFound, \"Your Gemfile.lock not found for this environment\"\n end", "def version\n @instruments_version ||= lambda do\n version_string = pbuddy.plist_read('CFBundleShortVersionString',\n path_to_instruments_app_plist)\n RunLoop::Version.new(version_string)\n end.call\n end", "def package_version\n @semver.to_s '%M.%m.%p%s'\n end", "def version_number\n return @version_number\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 semver_version\n if Build::Check.on_tag?\n # timestamp is disabled in omnibus configuration\n Omnibus.load_configuration('omnibus.rb')\n Omnibus::BuildVersion.semver\n else\n latest_git_tag = Info.latest_tag.strip\n latest_version = latest_git_tag && !latest_git_tag.empty? ? latest_git_tag[0, latest_git_tag.match(\"[+]\").begin(0)] : '0.0.1'\n commit_sha = Build::Info.commit_sha\n ver_tag = \"#{latest_version}+\" + (Build::Check.is_nightly? ? \"rnightly\" : \"rfbranch\")\n [ver_tag, Gitlab::Util.get_env('CI_PIPELINE_ID'), commit_sha].compact.join('.')\n end\n end", "def version_major_minor\n version.split('.')[0..1].join('.')\n end", "def get_application_version()\n res = search(\"/ApplicationStatus\")\n root = JSON.parse(res.xmldata)\n\n if ! root.has_key? 'application'\n return nil\n end\n application = root[\"application\"]\n if ! application.has_key? 'user'\n return nil\n end\n user = application[\"user\"]\n if ! user.has_key? 'version'\n return nil\n end\n return user[\"version\"]\n end", "def version\n '1.5.1.2' # Version number <major>.<minor>.<patch>.<monthly commit>\n end", "def parsed_version\n return \"~\\\"#{new_resource.version}\\\"\" if new_resource.version\n ''\n end", "def version\n return last_version if versionable?\n version_number\n end", "def version\n @xcode_version ||= lambda do\n execute_command(['-version']) do |stdout, _, _|\n version_string = stdout.read.chomp[VERSION_REGEX, 0]\n RunLoop::Version.new(version_string)\n end\n end.call\n end", "def app_ver\n @values.fetch('appVer') { \n @values['appVer'] = nil\n }\n end", "def update_app_version_numbers\n version_string = ENV['FORCED_VERSION_NUMBER_STRING']\n xcode_project_version = nil\n\n if !version_string.nil? && version_string.length > 0\n\n puts \"using forced version \\\"#{version_string}\\\"\"\n\n else\n\n version_string = get_semver_from_branch(ENV['GIT_HEAD_REF'])\n\n if version_string.nil?\n\n app_store_build_number(live: false)\n latest_app_store_version = lane_context[SharedValues::LATEST_VERSION]\n xcode_project_version = get_project_xcode_version\n\n # use largest version (note ascii comparison - not sure if accurate enough)\n version_string = latest_app_store_version > xcode_project_version ? latest_app_store_version : xcode_project_version\n puts \"using version #{version_string} (latest app store = #{latest_app_store_version}, project version = #{xcode_project_version})\"\n\n end\n\n end\n\n # increment build number\n forced_build_number = ENV['FORCED_BUILD_NUMBER']\n if forced_build_number.nil? || forced_build_number.empty?\n current_build_number = parse_latest_testflight_build_number(version_string)\n\n if current_build_number == 0\n if m = version_string.match(semver_regex)\n # if no existing number was found we need to check variations of the same version\n # since Apple handles 1, 1.0, and 1.0.0 independently, but they share build number\n puts \"build number is 0 - checking version variations in case there's a match\"\n\n major = m.captures[0]\n minor = m.captures[1]\n patch = m.captures[2]\n\n puts \"major=#{major} minor=#{minor} patch=#{patch}\"\n if patch == '0'\n variation = \"#{major}.#{minor}\"\n current_build_number = latest_testflight_build_number(version: variation, initial_build_number: 0)\n puts \"variation \\\"#{variation}\\\" = #{current_build_number}\"\n\n if current_build_number == 0 && minor == '0'\n variation = major\n current_build_number = latest_testflight_build_number(version: variation, initial_build_number: 0)\n puts \"variation \\\"#{variation}\\\" = #{current_build_number}\"\n end\n end\n else\n UI.important 'build number is 0 and version is not semantically correct - unable to check version variations (build number may be incorrect)'\n end\n\n end\n\n build_number = current_build_number + 1\n increment_build_number(build_number: build_number)\n else\n puts \"using forced build number \\\"#{forced_build_number}\\\"\"\n build_number = forced_build_number\n increment_build_number(build_number: build_number)\n end\n\n # set version number\n current_version_string = xcode_project_version || get_project_xcode_version\n increment_version_number(version_number: version_string)\n update_package_version(version_string)\n\n puts \"build_number #{current_build_number} => #{build_number}\"\n puts \"version_number #{current_version_string} => #{version_string}\"\nend", "def version_file\n version_rb_file = File.dirname(Buildr.application.buildfile.to_s) + '/version.rb'\n return version_rb_file if File.exists?(version_rb_file)\n return Buildr.application.buildfile.to_s\n end", "def version\n response = get('/getVersion', {}, false)\n ApiVersion.new(response.body['version'], response.body['builddate'])\n end", "def pkg_version(item)\n # refactoring! :revision points to same revision as item!\n v = revision.checkout.extract_version\n return \"#{v}pre.#{item.version}.#{item.id}\"\n end", "def fetch_app_version(options)\n metadata = AppRepo::Uploader.new(options).download_manifest_only\n FastlaneCore::UI.command_output('TODO: Parse version out from metadata')\n puts JSON.pretty_generate(metadata) unless metadata.nil?\n FastlaneCore::UI.important('TODO: parse out the bundle-version')\n metadata['bundle-version']\n 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 ver\n @values.fetch('ai.application.ver') { \n @values['ai.application.ver'] = nil\n }\n end", "def getterminalappversion()\r\n return getvalue(SVTags::TERMINAL_APP_VERSION)\r\n end", "def version(arg = nil)\n set_or_return(:version,\n arg,\n kind_of: String,\n default: 'latest',\n callbacks: {\n \"Valid versions are 'latest' or 'x.y.z'\" =>\n ->(a) { valid_version?(a) }\n })\n end", "def extract_version\n buildfile = File.read(Rake.application.rakefile).force_encoding(\"ISO-8859-1\").encode(\"utf-8\", replace: nil)\n buildfile.scan(THIS_VERSION_PATTERN)[0][2]\n rescue\n fail 'Looking for THIS_VERSION = \"1.0.0-rc1\" in your Buildfile, none found'\n end", "def version\n version_property ? version_property.ruby_value : nil\n end", "def version(app, env)\n response = env == \"staging\" ? \"#{app}-#{env}\" : \"#{app}\"\n #if env == \"staging\"\n #response = \"#{app}-#{env}\"\n #else\n #response = \"#{app}\"\n #end\n \":satellite: [CAP #{app.upcase}] version: https://#{response}.medivo.com/version.html\" unless response.empty?\n end", "def ver\n @values['ver']\n end", "def gem_version\n ::Gem::Version.new(VERSION::STRING)\n end", "def version(arg = nil)\n set_or_return(:version, arg, kind_of: String, default: 'latest')\n end", "def version(arg = nil)\n set_or_return(:version, arg, kind_of: String, default: 'latest')\n end", "def version\n @gemspec.version || @version_helper.to_s\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 version_tag\n version_composition.join(\".\")\n end", "def version\n @version || 0\n end", "def current_version\r\n version = File.read(\"VERSION\").strip\r\n fail \"Invalid version information\" unless version =~ /\\./\r\n version\r\nend", "def app_version=(value)\n @app_version = value\n end", "def app_version=(value)\n @app_version = value\n end", "def version\n Cleaner.extract_version @id\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 version\n v = KJess::Request::Version.new\n r = send_recv( v )\n return r.version if Response::Version === r\n raise KJess::Error, \"Unexpected Response from VERSION command\"\n end", "def version\n @version ||= create_version\n end", "def get_rem_ver(app_name)\n app_url = get_app_url(app_name)\n if $verbose == 1\n puts \"Getting version (or date) of latest release from #{app_url}\"\n end\n rem_ver = eval(\"get_#{app_name.downcase.gsub(/ |-/,'_')}_rem_ver(app_name,app_url)\")\n if rem_ver.to_s !~ /[0-9]/\n puts \"Remote build version (or date) not found\"\n exit\n end\n if !rem_ver.class.to_s.match(/Date/)\n rem_ver = rem_ver.gsub(/\\.$/,\"\")\n end\n return rem_ver\nend", "def version\n @version ||= config(\"version\", \"0.0.1\")\n end", "def appcache_version_string\n RailsAppcache.config.version\n end", "def get_version\n\t\tself.dev_stage.blank? ? dev_stage_string = \"\" : dev_stage_string = self.dev_stage + \" \"\n\t\treturn dev_stage_string + self.maj_version.to_s + \".\" + self.min_version.to_s\n\tend", "def server_version\n status['value']['build']['version']\n end", "def turbolinks_app_version\n return \"\" unless turbolinks_app?\n return @turbolinks_app_version if defined? @turbolinks_app_version\n version_str = request.user_agent.to_s.match(/version:[\\d.]+/).to_s\n @turbolinks_app_version = version_str.split(\":\").last\n @turbolinks_app_version\n end" ]
[ "0.67691374", "0.6712796", "0.66911435", "0.6355196", "0.6248604", "0.6223768", "0.6180121", "0.6180121", "0.61711687", "0.6122696", "0.6110176", "0.6108745", "0.606516", "0.6047987", "0.60398024", "0.60374045", "0.5974485", "0.5974485", "0.59664965", "0.5959343", "0.59451455", "0.59446216", "0.5944487", "0.59208107", "0.59188324", "0.59175944", "0.59041446", "0.5900765", "0.59006286", "0.5898172", "0.5889547", "0.58797216", "0.5861725", "0.58607346", "0.58551365", "0.5854129", "0.58481264", "0.5807687", "0.5807659", "0.58065003", "0.5790053", "0.5786617", "0.5778576", "0.5760194", "0.5755863", "0.5755863", "0.5755694", "0.574942", "0.5748687", "0.57485825", "0.574224", "0.573194", "0.5729963", "0.5722922", "0.57093924", "0.57052386", "0.57016885", "0.5690371", "0.5690028", "0.5685851", "0.5663299", "0.5661769", "0.56564784", "0.5655641", "0.5647579", "0.5644518", "0.56432647", "0.5642468", "0.5641186", "0.5639911", "0.56394255", "0.56392473", "0.56363046", "0.5633645", "0.5631547", "0.5622206", "0.5618844", "0.56163263", "0.56102455", "0.56039506", "0.5601631", "0.5601631", "0.5600681", "0.5598789", "0.5598789", "0.55959487", "0.5591097", "0.5575816", "0.5573583", "0.5573583", "0.55706954", "0.55681545", "0.5568037", "0.5563008", "0.5559768", "0.55575293", "0.553654", "0.55343467", "0.55316997", "0.55310243" ]
0.73189855
0
Returns the sha1 of the application.
def sha1 RunLoop::Directory.directory_digest(path) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sha1; end", "def sha1; end", "def installed_app_sha1\n installed_bundle = installed_app_bundle_dir\n if installed_bundle\n RunLoop::Directory.directory_digest(installed_bundle)\n else\n nil\n end\n end", "def sha1\n @sha1 ||= digest(path, :sha1)\n end", "def digest\n Digest::SHA1.hexdigest(self)\n end", "def sha1?; @sha1; end", "def to_sha1(length = 40)\n Digest::SHA1.hexdigest(self)[0,length]\n end", "def sha1(name)\n Digest::SHA1.file(path(name)).hexdigest\n end", "def short_sha1(length=7)\n sha1[0, length]\n end", "def short_sha1(length=7)\n sha1[0, length]\n end", "def digest\n @digest ||= Digest::SHA1.new.update(version.to_s)\n @digest.dup\n end", "def sha1=(_); end", "def sha1_fingerprint\n @sha1_fingerprint ||= @node['sha1Fingerprint']\n end", "def sha1\n Digest::SHA1.hexdigest self.record\n end", "def to_sha1(salt = \"\")\n hashsum(:sha1, salt)\n end", "def sha1_hex\n Digest::SHA1.hexdigest(salted_name)\n end", "def same_sha1_as_installed?\n app.sha1 == installed_app_sha1\n end", "def sha1(string)\n\tOpenSSL::Digest::SHA1.hexdigest(string)\nend", "def file_sha1\n Digest::SHA1.file(self).hexdigest\n end", "def get_sha1(path)\n return @cache_sha1 unless @cache_sha1.nil?\n sha1 = \"\"\n if File.exist?(path)\n Dir.chdir(path) do\n sha1 = %x(git rev-parse HEAD).delete(\"\\n\")\n end\n end\n\n @cache_sha1 = sha1\n sha1\n end", "def hmac_sha1 key, signature\n\t\trequire 'openssl'\n\t\treturn OpenSSL::HMAC.hexdigest('sha1', key, signature)\n\tend", "def get_hash_sha1(user)\n begin\n guid = user['generateduid'][0].to_ruby\n password_hash = nil\n password_hash_file = \"#{@@password_hash_dir}/#{guid}\"\n if File.exists?(password_hash_file) and File.file?(password_hash_file)\n fail(\"Could not read password hash file at #{password_hash_file}\") if not File.readable?(password_hash_file)\n f = File.new(password_hash_file)\n password_hash = f.read\n f.close\n end\n password_hash\n rescue\n return String,new\n end\n end", "def sha1(data)\n @connection.sha1(data)\n end", "def sha1\n Digest::SHA1.hexdigest(subject.identification + 0.chr + source)\n end", "def hash(message)\n return Digest::SHA1.hexdigest(message)\n end", "def uri_hash # :nodoc:\n require_relative '../openssl'\n\n normalized =\n if @repository =~ %r{^\\w+://(\\w+@)?}\n uri = URI(@repository).normalize.to_s.sub %r{/$},''\n uri.sub(/\\A(\\w+)/) { $1.downcase }\n else\n @repository\n end\n\n OpenSSL::Digest::SHA1.hexdigest normalized\n end", "def fedora_shasum\n \"urn:sha1:#{Digest::SHA1.file(file_path)}\"\n end", "def sha\n @sha ||= ENV['HEROKU_SLUG_COMMIT'] || ENV['GIT_SHA'] || `git rev-parse HEAD`.chomp\n end", "def spki_sha1_hash(cert)\n spki = OpenSSL::ASN1.decode(cert).value[0].find { |e|\n e.tag == 16 && e.value[0].tag == 16\n }\n return unless spki\n [\"sha1\", [OpenSSL::Digest::SHA1.digest(spki.to_der)].pack('m*').chomp].join(\"/\")\n end", "def sha\n result_hash['sha']\n end", "def to_s\n id_for(sha1)\n end", "def generate_hmac(content)\n OpenSSL::HMAC.hexdigest('sha1'.freeze, app_secret, content)\n end", "def sha1_hexdigest\n @hexdigest ||= begin\n raise StateError, \"not finished reading object\" unless @closed\n @sha1.hexdigest\n end\n end", "def sha1_base64\n str = Base64.encode64(Digest::SHA1.digest(salted_name)).strip\n str.tr('+/', '-_').gsub(/=/,'')\n end", "def short_sha\n self.sha[0..6]\n end", "def sha(str)\n Digest::SHA1.hexdigest(str)[0, 40]\n end", "def version_guid\n \"#{digest_type}:#{checksum}\"\n end", "def sha\n Digest::SHA2.new.update(self.source).to_s\n end", "def signature(args)\n str = args.to_s\n if str.length <= SHA1_THRESHHOLD\n args\n else\n Digest::SHA1.hexdigest args.to_s\n end\n end", "def sha\n id.sha\n end", "def generate_sha(file)\n\n sha1 = Digest::SHA1.file file\n return sha1\n\nend", "def hex_sha1(s)\n return binb2hex(core_sha1(str2binb(s), s.length * $chrsz))\n end", "def revision_id\n Digest::SHA1.new.hexdigest(canonical_revision_string)\n end", "def app_name\n @data['CFBundleExecutable'].to_s\n end", "def digest\n Digest::SHA2.new\n end", "def hex_sha1(s)\n binb2hex(core_sha1(str2binb(s), s.length * $chrsz))\n end", "def digest( str )\n Digest::SHA1.hexdigest( str )\n end", "def sha\n @commit.sha\n end", "def digest\n OpenSSL::HMAC.digest(\n OpenSSL::Digest.new('sha1'),\n secret,\n document\n )\n end", "def app_name\n ApplicationService.application_name\n end", "def createSHAHash(data)\n\t\treturn Digest::SHA1.digest(data)\n\tend", "def uri_hash # :nodoc:\n normalized =\n if @repository =~ %r%^\\w+://(\\w+@)?% then\n uri = URI(@repository).normalize.to_s.sub %r%/$%,''\n uri.sub(/\\A(\\w+)/) { $1.downcase }\n else\n @repository\n end\n\n Digest::SHA1.hexdigest normalized\n end", "def digest\n ''\n end", "def digest\n ''\n end", "def digest\n Digest::SHA1.hexdigest(@pub.to_der)\n end", "def app_name\n return File.basename(File.expand_path(root)).freeze\n end", "def short_id\n Digest::SHA1.hexdigest(hex)[0, 6]\n end", "def hmac_sha1(crypto, keyBytes, text)\n digest = OpenSSL::Digest::Digest.new(crypto)\n str2hex(OpenSSL::HMAC.digest(digest, keyBytes, text))\n end", "def application_id\n get_key('ALGOLIA_APPLICATION_ID', 'application_id')\n end", "def hash\r\n # TODO what if file is empty?\r\n @hash ||= Digest::SHA1.file(File.join(@directory, @filename)).hexdigest\r\n end", "def sha1(data, c: true)\n if c && $linux && File.file?(PATH_SHA1)\n File.binwrite(\"util/#{HASH_INPUT_FN}\", data)\n code = shell(\"./util/sha1 ./util/#{HASH_INPUT_FN} ./util/#{HASH_OUTPUT_FN}\")\n return nil if !code\n hash = File.binread(\"util/#{HASH_OUTPUT_FN}\")\n FileUtils.rm([\"./util/#{HASH_INPUT_FN}\", \"./util/#{HASH_OUTPUT_FN}\"])\n hash\n else\n Digest::SHA1.digest(data)\n end\nrescue => e\n lex(e, 'Failed to compute the SHA1 hash')\n nil\nend", "def unique_identifier\n Digest::SHA1.hexdigest (\"#{self.screen_name}:#{self.password}\")\n end", "def sha1(path)\n result = nil\n chunk_size = 10240\n File.open(path, \"r\") do |file|\n sha1 = Digest::SHA1.new\n\n while true\n chunk = file.read chunk_size\n break if ! chunk\n sha1.update chunk\n end\n result = sha1.hexdigest\n end\n result\n end", "def git_sha_for(path)\n website.git_repository.git_sha path\n end", "def computed_sha(string)\n provider.computed_sha(string)\n end", "def unique_identifier\n Digest::SHA1.hexdigest(\"#{screen_name}:#{password}\")\n end", "def unique_identifier\n Digest::SHA1.hexdigest(\"#{screen_name}:#{password}\")\n end", "def git_sha(length = 40)\n Pkg::Util.in_project_root do\n stdout, _, _ = Pkg::Util::Execution.capture3(\"#{GIT} rev-parse --short=#{length} HEAD\")\n stdout.strip\n end\n end", "def default_key \n Digest::SHA1.hexdigest(\"riaque:#{name}\")\n end", "def compute_hash( path )\n res = '0'\n autorelease_pool { res = NSData.sha1FromContentsOfFile(path) }\n res\n end", "def upstream_sha1=( checksum )\n @digest = Crate::Digest.sha1( checksum )\n end", "def call\n secret_token = APISecretKey.find_by!(name: @app_name).key\n path = @request.fullpath.split('?').first\n Digest::MD5.hexdigest(path + secret_token)\n end", "def app_identifier\n return @app_identifier\n end", "def file_remote_digestsha1(file_name)\n data = read_file(file_name)\n chksum = nil\n if data\n chksum = Digest::SHA1.hexdigest(data)\n end\n return chksum\n end", "def signature(key)\n Digest::SHA1.hexdigest(\"#{key}#{Config.secret}\")[0...8]\n end", "def current_sha\n @current_sha ||= Digest::SHA512.hexdigest(File.read(hostsfile_path))\n end", "def sha_hash (arg)\r\n Digest::SHA2.hexdigest(arg)\r\n end", "def app_identifier\n Origen.config.initials || 'Anon App'\n end", "def application_name\n return @application_name\n end", "def gem_signature(gem_full_name)\n Digest::SHA256.new(@gems[gem_full_name].to_yaml).to_s\n end", "def app_id\n @app.id\n end", "def hex(string)\n Digest::SHA1.hexdigest(string)\n end", "def application_version\n read('application_version')\n end", "def create_sha1_id\n self.sha1_id = Digest::SHA1.hexdigest(\"#{self.id}-#{self.contactable_type}-#{self.contactable_id}\")\n end", "def app_name\n return @app_name\n end", "def app_name\n return @app_name\n end", "def appid\n if (@appid.nil? or @appid.empty?)\n fatal(\"Error: appid: App ID was not set. Aborting.\")\n end\n @appid\n end", "def signature\n OpenSSL::HMAC.hexdigest('sha1', Redtail.config.sentry_key, \"#{@timestamp} #{@message}\")\n end", "def app_name\n @app_name || Sapience.app_name\n end", "def name\n if app_name = @args[:props][\"application_name\"].to_s.strip and !app_name.empty?\n return app_name\n else\n raise \"Could not figure out the input-name.\"\n end\n end", "def app_name\n c.application\n end", "def shasum\n @shasum ||= begin\n digest = Digest::SHA256.new\n\n update_with_string(digest, project.shasum)\n update_with_string(digest, builder.shasum)\n update_with_string(digest, name)\n update_with_string(digest, version_for_cache)\n update_with_string(digest, FFI_Yajl::Encoder.encode(overrides))\n\n if filepath && File.exist?(filepath)\n update_with_file_contents(digest, filepath)\n else\n update_with_string(digest, \"<DYNAMIC>\")\n end\n\n digest.hexdigest\n end\n end", "def first_app_id\r\n make_sure_apps_page unless @driver.current_url =~ /.*apps.*/\r\n if is_element_present(:new_app_page,:first_app_id)\r\n first_app_id=new_app_locator(:first_app_id).text\r\n puts \"+ <action> first_app_id: #{first_app_id}\"\r\n return first_app_id\r\n end\r\n end", "def app_id\n return @app_id\n end", "def app_id\n return @app_id\n end", "def app_id\n return @app_id\n end", "def unique_identifier\n\t\tDigest::SHA1.hexdigest(\"#{email}:#{password}\")\n\tend", "def value\n if show_secret\n secret\n else\n Digest::SHA1.hexdigest secret\n end\n end", "def program_name\n File.basename($0)\n end", "def original_application_version\n read('original_application_version')\n end" ]
[ "0.724577", "0.724577", "0.72063017", "0.71606636", "0.6884074", "0.6868169", "0.67570126", "0.66603243", "0.6614894", "0.6614894", "0.6602884", "0.6588803", "0.6545805", "0.65310323", "0.65087163", "0.6505089", "0.6379582", "0.6347948", "0.63150054", "0.63134116", "0.6311835", "0.6289007", "0.6267366", "0.625684", "0.6190248", "0.6115288", "0.6108399", "0.60259193", "0.6008405", "0.6007425", "0.59837687", "0.5966668", "0.59382504", "0.59276366", "0.59275377", "0.59122694", "0.5911796", "0.59107655", "0.59008086", "0.5898619", "0.587484", "0.58719784", "0.5834966", "0.58287346", "0.5816864", "0.5815322", "0.57978636", "0.57768244", "0.577547", "0.57665944", "0.57514465", "0.5721191", "0.5708906", "0.5708906", "0.5694272", "0.5686185", "0.5664043", "0.565929", "0.5658843", "0.5642455", "0.5608045", "0.5575646", "0.55625373", "0.55501175", "0.5539201", "0.5533838", "0.5533838", "0.55075026", "0.54737127", "0.5472383", "0.5472359", "0.5467145", "0.5461743", "0.5459378", "0.54454875", "0.5444392", "0.544251", "0.5439842", "0.5427341", "0.54247636", "0.5419496", "0.5416457", "0.5412467", "0.5411807", "0.5404342", "0.5404342", "0.54034793", "0.5389209", "0.5385515", "0.5379771", "0.5374301", "0.53678966", "0.5365768", "0.5365301", "0.5365301", "0.5365301", "0.5362643", "0.53598845", "0.5357685", "0.53565466" ]
0.6888225
4
method takes positive integer returns number with its digits reversed
def reversed_number(num) num.to_s.reverse.to_i end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reversed_number(int)\r\n int.digits.join.to_i\r\nend", "def reversed_number(integer)\n p integer.digits.join.to_i # .to_i automatically omit the leading 0s\n end", "def reversed_number(num)\n num.digits.join.to_i\nend", "def reversed_number(number)\n number.to_s.chars.reverse.join.to_i\nend", "def reversed_number(number)\n number.to_s.reverse.to_i\nend", "def reversed_number(number)\n number.to_s.reverse.to_i\nend", "def reversed_number(number)\n number.to_s.reverse.to_i\nend", "def reversed_number(int)\n int.to_s.reverse.to_i\nend", "def reversed_number(int)\n int.to_s.reverse.to_i\nend", "def reversed_number(int)\n int.to_s.reverse.to_i\nend", "def reversed_number(number)\n number.to_s.chars.reverse.join('').to_i\nend", "def reversed_number(n)\n n.to_s.reverse.to_i\nend", "def reversed_number(n)\n n.to_s.reverse.to_i\nend", "def reversed_number(integer)\n integer.to_s.reverse.to_i\nend", "def reversed_number(integer)\n integer.to_s.reverse.to_i\nend", "def reversed_number(integer)\n integer.to_s.reverse.to_i\nend", "def reversed_number(num)\n num.to_s.reverse.to_i\nend", "def reversed_number(num)\n num.to_s.reverse.to_i\nend", "def reversed_number(num)\n num.to_s.reverse.to_i\nend", "def reversed_number(num)\n num.to_s.reverse.to_i\nend", "def reversed_number(num)\n num.to_s.reverse.to_i\nend", "def reversed_number(num)\n num.to_s.reverse.to_i\nend", "def reversed_number_re(num)\n num.to_s.reverse.to_i\nend", "def reversed_number(num)\n num.to_s.reverse.to_i \nend", "def reversed_number(num)\n num.to_s.chars.reverse.join.to_i\nend", "def reverse_digits(int)\n \nend", "def reversed_number(num)\n num.to_s.chars.reverse.join('').to_i\nend", "def reversed_number(num)\n reversed_num = num.to_s.reverse\n reversed_num.to_i # convert back to integer (and drop leading zeroes)\nend", "def reverse(num)\n num.to_s.reverse.to_i\nend", "def reversed_number2(num)\n num.to_s.reverse.to_i\nend", "def reversed_number(num)\n num.to_s.split('').reverse.join('').to_i\nend", "def reversed_number(num)\n num.to_s.split(//).reverse.join.to_i\nend", "def reversed_number(number)\n \n reversed_num = number.to_s.reverse\n reversed_num.to_i\nend", "def reverse(number)\n digits = number.to_s.split(\"\")\n digits.reverse!\n return digits.to_s.to_i\nend", "def reversed_number(number)\n reversed = []\n leading = true\n\n number.digits.each do |digit|\n unless leading && digit == 0\n leading = false\n reversed.push(digit)\n end\n end\n\n reversed.join.to_i\nend", "def reversed_number(num)\n num_as_str = num.to_s\n num_as_str.reverse.to_i\nend", "def reversed_number(pos_int)\n pos_int.to_s.reverse.to_i\nend", "def reverse(number)\n digits = number.to_s.chars\n reversed = []\n if digits.length <= 1\n number\n else\n reversed << digits.pop\n reversed << reverse(digits.join.to_i)\n reversed.join.to_i\n end\nend", "def reversed_number(int)\n final = []\n until int <= 0\n int, to_push = int.divmod(10)\n final << to_push\n end\n final.join.to_i\nend", "def reversed_number(integer)\n result = []\n until integer.zero?\n integer, remainder = integer.divmod(10)\n result.push(remainder)\n end \n p result.inject { |number, digit| number * 10 + digit }\nend", "def reverse(int)\n int.to_s.chars.reverse.delete_if{|num| num.to_i <= 0}.join.to_i\nend", "def reverse_digits(int)\n # return int.to_s.reverse.to_i\n\n digs = int.to_s\n rev_digs = \"\" \n\n i = digs.length - 1\n while i >= 0\n rev_digs << digs[i]\n i -= 1\n end\n return rev_digs\nend", "def reverse_number\n number = 12345\n tmp = 0\n while number != 0 do\n tmp = tmp * 10 + (number % 10)\n number = number / 10\n end\n puts tmp\nend", "def rev(n)\n n.to_s.chars.reverse.join('').to_i\nend", "def number_reverser(integer)\n string = integer.to_s.reverse!\n string.to_i\nend", "def reverse_digit(original)\n reverse = 0\n # check if there is any numbers left\n while original > 0\n # adding the lass digit to reverse\n reverse = (reverse*10) + (original%10)\n # removing the lass digit from the original\n original=original/10\n end\n return reverse\nend", "def reverse(number)\n return number if number < 10\n array = number.to_s.split(//)\n\n test_number = array.first.to_i\n new_array = array.drop(1)\n\n new_number = reverse(new_array.join.to_i)\n new_number * 10 + test_number\nend", "def digit_list(integer)\n integer.digits.reverse\nend", "def reverse(num)\n reverse = 0\n while num > 0\n last_num = num % 10\n reverse = (reverse * 10) + last_num\n num = num / 10\n end\n return reverse\nend", "def reversed_number(number)\n list_reversed = []\n number.to_s.split('').each {|num| list_reversed.unshift(num) }\n list_reversed.join.to_i\nend", "def reversed_number(integer)\n integer_array = integer.to_s.chars\n\n reversed_string = integer_array.reverse.join\n\n result = ''\n reversed_string.each_char do |int|\n result << Integer(int, 10).to_s\n end\n result.to_i\nend", "def reverse(n)\n reversed = 0\n while n > 0\n reversed = 10 * reversed + n % 10\n n = n / 10\n end\n reversed\nend", "def reversed_number(num)\n\nend", "def digit_list(int)\n int.digits.reverse\nend", "def digit_list(int)\n int.digits.reverse\nend", "def reverse_int(int)\nend", "def reverse_digits(num)\n num_array = num.to_s.chars\n return num_array[0] if num_array.length == 1\n\n \"#{num_array.pop} \" + reverse_digits(num_array.join.to_i)\nend", "def digit_list(integer)\n integer.digits.reverse\nend", "def reverse(number)\n \n digits = number.to_s.split(\"\").dup\n return number if digits.length == 1\n last = digits.pop\n p \"last == #{last.inspect}\"\n new_num = Integer(digits.to_s)\n Integer(last << reverse(new_num).to_s)\nend", "def reverse_integer(given)\n split_given = given.to_s.split('')\n reversed = []\n split_given.length.times { reversed << split_given.pop }\n reversed.join.to_i\nend", "def digit_list1(num)\n num.digits.reverse\nend", "def reverse(number)\n if number < 10\n return number\n end\n \n multiplier = 10\n \n until multiplier > number / 10\n multiplier *= 10\n end\n \n return ((number % 10) * multiplier) + reverse(number / 10) \n \nend", "def reverseNumber(n)\n n.to_s[0] == '-' ? -(n.to_s.reverse.to_i) : n.to_s.reverse.to_i\n # if n.to_s[0] == '-'\n # -(n.to_s.reverse.to_i)\n # else\n # n.to_s.reverse.to_i\n # end\nend", "def reversed_number(number)\n result = ''\n numbers = number.to_s\n numbers.each_char do |num|\n result.prepend(num) # prepend to take the end of the array and add it to the 'result' array.\n end\n result.to_i # convert to integer\nend", "def reverse(x)\n int_str = x.to_s\n res_str = String.new\n if int_str[0] == '-'\n res_str << int_str[0]\n int_str.slice!(0)\n end\n i = int_str.size - 1\n int_str.size.times do\n res_str << int_str[i]\n i -= 1\n end\n res = res_str.to_i\n res.between?(-2**31, 2**31 - 1) ? res : 0\nend", "def digit_list(num)\n num.digits.reverse\nend", "def digit_list(num)\n num.digits.reverse\nend", "def reverse(number)\n return number if number.to_s.length == 1 #1 is the last number to go\n number_array = number.to_s.split(\"\")\n first_element = number_array.pop #ie 2 (from base)\n new_number = number_array.join(\"\").to_i\n recursive_call = first_element.to_s + reverse(new_number).to_s #take advantage of string concat\n\n output_string = \"\"\n number = output_string + recursive_call\n number.to_i\nend", "def digit_list(positive_integer)\n positive_integer.digits.reverse!\nend", "def number_reverser(number)\n result = 0\n while number != 0\n digit = number % 10\n result = (result * 10) + digit\n number = number / 10\n end\n result\nend", "def reversed_number(number)\n number_string = number.to_s # convert to string\n number_chars = number_string.chars # chars to split string to individual characters in an array\n reversed_string = number_chars.reverse # 'reverse' the array\n numbers = reversed_string.join('') # join the array\n numbers.to_i # convert array to integers\nend", "def reverse_digits(number)\n numberArray = number.to_s.split('')\n numberArray = numberArray.reverse\n \n newInt = \"\"\n numberArray.each do |element|\n newInt += element\n end\n return newInt.to_i\n \n \nend", "def rotate_rightmost_digits(number, n)\n arr = number.digits.reverse\n e = arr.delete_at(-n)\n arr << e\n arr.join.to_i\nend", "def reversed_number(int)\n # output = 0\n # reversed_array = int.to_s.chars.reverse\n # p reversed_array\n int.to_s.reverse.to_i\nend", "def integer_to_string(num)\n num.digits.reverse.join\nend", "def invertirNumero(numero)\n @numero = numero.to_s\n return (@numero.reverse).to_i\nend", "def integer_reverse (i)\n y = 0\n #reversed = []\n\n while i > 0 do\n y = y*10\n y += (i%10)\n i /= 10\n #reversed << y\n end\n\n #return reversed[-1]\n return y\nend", "def rotate_rightmost_digits(num, n)\n arr = num.digits.reverse\n number = arr.delete_at(-n)\n arr.append(number).join.to_i\nend", "def rotate_rightmost_digits(num, n)\n arr = num.digits.reverse\n number = arr.delete_at(-n)\n arr.append(number).join.to_i\nend", "def reverse(z)\n\tx = z\n\ty = 0\n\twhile x!=0 do\n\t\ty *= 10\n\t\ty += x%10\n\t\tx /= 10\n\tend\n\treturn y\nend", "def rotate_rightmost_digits(integer, n)\n ary = integer.digits.reverse\n new_ary = Array.new(ary) # avoid mutating the original argument\n new_ary << new_ary.delete_at(-n)\n new_ary.join('').to_i\nend", "def integer_to_string(integer)\n integer.abs.digits.reverse.join\nend", "def rotate_rightmost_digits(num, n)\n digits = num.to_s.chars\n digits << digits.delete_at(-n)\n digits.join.to_i\nend", "def rotate_rightmost_digits(number, n)\n number_array = number.to_s.chars\n number_array[-n..-1] = rotate_array(number_array[-n..-1])\n number_array.join.to_i\nend", "def descending_order(n)\n if n.to_i >= 0\n n.digits.sort.reverse.join.to_i\n end\n\nend", "def integer_to_string(int)\n int.digits.reverse.join\nend", "def reverse(x)\n negative = false\n negative = true if x < 0 \n result = 0\n divisor = 10\n x = x.abs\n while(x > 0)\n result = (result * 10) + x % divisor\n x = x / divisor \n end\n result = result * -1 if negative\n return 0 if (result > 2147483648 || result < -2147483647)\n result\nend", "def reverse(x)\n if x >= 0\n return arr = x.to_s.chars.map(&:to_i).reverse.join.to_i\n else\n arr = x.to_s.chars.map(&:to_i)\n return arr.shift\n end\nend", "def rotate_rightmost_digits(number, num)\n digits = number.to_s.chars.map(&:to_i)\n index_to_rotate = digits.size - num\n digits << digits.delete_at(index_to_rotate)\n p digits.join.to_i\nend", "def rotate_rightmost_digits(number, n)\n all_digits = number.to_s.chars\n all_digits[-n..-1] = rotate_array(all_digits[-n..-1])\n all_digits.join.to_i\nend", "def rotate_rightmost_digits(number, n)\nall_digits = number.to_s.chars\nall_digits[-n..-1] = rotate_array(all_digits[-n..-1])\nall_digits.join.to_i\nend", "def reverse(x)\n if x >= 0\n arr = x.to_s.chars.map(&:to_i).reverse.join.to_i\n puts(arr)\n else\n arr = x.to_s.chars.map(&:to_i)\n arr.shift\n arr = -(arr.reverse.join.to_i)\n puts(arr)\n end\nend", "def rotate_rightmost_digits(number, digit)\n string_number = number.to_s\n sliced_num = string_number[-digit]\n string_number.delete!(sliced_num)\n (string_number << sliced_num).to_i\nend", "def rotate_rightmost_digits(int, r)\n arr = int.to_s.chars\n remove = arr.delete_at(-r)\n arr << remove\n arr.join.to_i\nend", "def descending_order(n)\n n.digits.sort().reverse.join.to_i\nend", "def rotate_rightmost_digits_alt(number, n)\n digits = number.digits.reverse\n digits[-n..-1] = rotate_array_alt(digits[-n..-1])\n digits.join.to_i\nend", "def rotate_rightmost_digits(num, n)\n num = num.digits.reverse\n rotators = num.pop(n)\n result = num + rotate_array(rotators)\n result.join.to_i\nend", "def rotate_rightmost_digits(number, n)\n array = number.to_s.split(//)\n removed_element = array[-n]\n array.slice!(-n)\n [array, removed_element].flatten.join.to_i\nend", "def rotate_rightmost_digits(num, n)\n arr = num.to_s.chars\n arr[-n..-1] = arr[-n..-1].rotate\n arr.join.to_i\nend", "def rotate_rightmost_digits(int, position)\n int_arr = int.digits.reverse\n shifting = int_arr.pop(position)\n int_arr.concat(rotate_array(shifting)).join.to_i\nend" ]
[ "0.89697117", "0.88830954", "0.8818218", "0.86833465", "0.86824256", "0.86824256", "0.86824256", "0.86484367", "0.86484367", "0.86484367", "0.86471885", "0.86382926", "0.86382926", "0.8630175", "0.8630175", "0.8630175", "0.86286277", "0.86286277", "0.86286277", "0.86286277", "0.86286277", "0.86286277", "0.8625866", "0.86243814", "0.8617318", "0.86104673", "0.8590225", "0.8552551", "0.8515156", "0.84731346", "0.8454147", "0.8453531", "0.8390837", "0.83500916", "0.8324343", "0.8307257", "0.8294094", "0.82425547", "0.82066095", "0.8167998", "0.8165408", "0.815568", "0.8155258", "0.81550276", "0.81504023", "0.808938", "0.8069453", "0.8065066", "0.8052057", "0.80500376", "0.80489045", "0.8044437", "0.804046", "0.8033294", "0.8033294", "0.80193734", "0.7992022", "0.7970087", "0.79665", "0.79581857", "0.791572", "0.7905659", "0.7890055", "0.7865236", "0.78565663", "0.78457564", "0.78457564", "0.78265756", "0.78165436", "0.78121465", "0.7782745", "0.77809656", "0.77737015", "0.7752108", "0.7750165", "0.77357405", "0.77118444", "0.77085197", "0.77085197", "0.7701502", "0.76779544", "0.76524013", "0.76346815", "0.7624581", "0.7621328", "0.76161814", "0.7602916", "0.7578196", "0.7555588", "0.75478685", "0.75394607", "0.7535715", "0.75340885", "0.753364", "0.7523177", "0.75096184", "0.75072676", "0.7505343", "0.75023013", "0.7501245" ]
0.8635786
13
izvelas kadu no kategorijam Nekust ip, Auto, vakances
def select_category #Parbauda vai ekrans ir redzams @screens.screen_create_filter.visible? #Pievieno kategoriju no filtra datiem @screens.screen_create_filter.select_row(@filter_data.category) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def konversiMenit(menit) \n # =================================\n # Area Kode Kode di sini\n \n \n \n # =================================\n end", "def noticias\n @vocalia = Vocalium.find(params[:id])\n @actual = \"Vocalia\"\n @noticias = Seccion.find(@vocalia.seccion_id).posts\n end", "def lancamentos_para_efetivar\n\t\t@entries = []\n\t\tself.categories.each do |c|\n\t\t\tc.lancamentos_ate_mes(Date.today).each do |e|\n\t\t\t\tif(e.mes_nao_efetivado(Date.today))\n\t\t\t\t\t@entries << e\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t@entries\n\tend", "def veichles\n ['Bil', 'Moped', 'Motorsykkel', 'Tungt kjøretøy', 'ATV', 'Buss', 'Sykkel']\n end", "def solicitudes_atrasadas\n end", "def category\n\n User.find(@toko.user_id).produks.each do |produk|\n @cat = produk.category_id\n end\n end", "def index\n\n if params[:titleSearch].nil?\n if params[:category_id].nil?\n if params[:id].nil?\n @adverts = Advert.all\n @adverts = Advert.order(:views).order(:title)\n @categories = Category.all\n else\n @adverts = Advert.where(:user_id => params[:id]).order(:views).order(:title)\n @categories = Category.all\n end\n\n else\n if params[:id].nil?\n @adverts = Advert.where(:category_id => params[:category_id]).order(:views).order(:title)\n @categories = Category.all\n flash[:notice] = \"Existem <b>#{@adverts.count}</b> anúncios nessa categoria\".html_safe\n else\n @adverts = Advert.where(:category_id => params[:category_id]).order(:views).order(:title)\n @adverts = Advert.where(:user_id => params[:id]).order(:views).order(:title)\n @categories = Category.all\n end\n\n end\n\n else\n if params[:category_id].nil?\n if params[:id].nil?\n @adverts = Advert.titleSearch(params[:titleSearch]).order(:views).order(:title)\n @categories = Category.all\n else\n @adverts = Advert.titleSearch(params[:titleSearch]).order(:views).order(:title)\n @adverts = Advert.where(:user_id => params[:id]).order(:views).order(:title)\n @categories = Category.all\n end\n\n else\n if params[:id].nil?\n @adverts = Advert.where(:category_id => params[:category_id]).order(:views).order(:title)\n @adverts = Advert.titleSearch(params[:titleSearch]).order(:views).order(:title)\n @categories = Category.all\n flash[:notice] = \"Existem <b>#{@adverts.count}</b> anúncios nessa categoria\".html_safe\n else\n @adverts = Advert.where(:category_id => params[:category_id]).order(:views).order(:title)\n @adverts = Advert.titleSearch(params[:titleSearch]).order(:views).order(:title)\n @adverts = Advert.where(:user_id => params[:id]).order(:views).order(:title)\n @categories = Category.all\n flash[:notice] = \"Existem <b>#{@adverts.count}</b> anúncios nessa categoria\".html_safe\n end\n\n end\n\n end\n\n\n end", "def devolver_azucar \n\t\treturn @azucares\n\tend", "def categoria_por_nivel\n if taxon.present? && params[:cat].present? && params[:nivel].present?\n # Aplica el query para los descendientes\n self.taxones = taxones.where(\"#{Especie.attribute_alias(:ancestry_ascendente_directo)} LIKE '%,#{taxon.id},%'\")\n\n # Se limita la busqueda al rango de categorias taxonomicas de acuerdo al nivel\n self.taxones = taxones.nivel_categoria(params[:nivel], params[:cat])\n end\n end", "def nacti_data(data, pomer)\n poc_nactenych_klauzuli = 0 \n pole_radku = data.split(\"\\n\")\n \n pole_radku.each do |radek|\n if(radek[0]!=\"c\")then #preskakuji komentar\n pole_hodnot = radek.split(' ') # ulozim si hodnoty do pole\n \n case radek[0]\n \n when \"p\"\n #nacteni zakladniho nastaveni instance\n @pocet_promennych = pole_hodnot[2].to_i\n @pocet_klauzuli = pole_hodnot[3].to_i\n # pokud je nastaven pomer (tj. obtiznost instance)\n if((pomer!=-1)&&(@pocet_klauzuli>=@pocet_promennych.to_f*pomer))then\n @pocet_klauzuli = @pocet_promennych.to_f*pomer\n end\n \n when \"w\"\n #nacitani vahoveho vektoru\n citac = 1\n while(citac < pole_hodnot.length)do\n @pole_vah[citac-1] = pole_hodnot[citac].to_i\n citac +=1\n end\n\n # when \"%\" # pouze pro kontrolu\n #ukoncovaci znak\n # puts \"%\" \n \n else\n #nacitani klauzuli\n if(poc_nactenych_klauzuli<@pocet_klauzuli)then\n citac = 0\n while(citac < pole_hodnot.length-1)do\n if(@klauzule[poc_nactenych_klauzuli]==nil)then\n nove_pole = []\n @klauzule[poc_nactenych_klauzuli]= nove_pole\n end\n @klauzule[poc_nactenych_klauzuli][@klauzule[poc_nactenych_klauzuli].length] = pole_hodnot[citac].to_i\n citac +=1\n end\n poc_nactenych_klauzuli+=1\n end \n end\n end\n end \n end", "def PodstawAn(ans) \n @RownanieWielomianu.each{ |wezel| \n if(ans.key?(wezel.Wspolczynnik))\n wezel.Wspolczynnik = ans[wezel.Wspolczynnik]\n end\n }\n end", "def impuestos_municipales\n npad(0, 15)\n end", "def get_city\n page = Nokogiri::HTML(open(\"http://annuaire-des-mairies.com/val-d-oise.html\"))\n villes =[]\n page.xpath('//*[@class=\"lientxt\"]').each do |ville|\n villes << ville.text\n end\n return villes\n end", "def variables\n @countries = [\"Australia\",\"Canada\",\"France\",\"Mexico\",\"Spain\",\"Norway\",\"Netherlands\",\"United States\"]\n @categories = [\"Art\",\"Music\",\"Film and Video\",\"Tech\",\"Dance\",\"Fashion\",\"Games\",\"Photography\",\"Theather\",\"Food\"]\n end", "def zuruecksetzen()\n end", "def index\n\t@posts = Post.order(sort_column_votes + \" \" + sort_direction)\n\n\t@posts = @posts.tipo(\"url\")\n\t@contador = 0\n\n end", "def show\n @lokasis = Rute.select(\"id_jalan\").uniq\n end", "def kml_naturalista\n return [] unless naturalista_obs.present?\n obs = eval(naturalista_obs.decodifica64)\n return [] unless obs.count > 0\n cadenas = []\n h = HTMLEntities.new # Para codificar el html y no marque error en el KML\n\n obs.each do |ob|\n # Para evitar las captivas\n #next if ob['captive']\n\n cadena = Hash.new\n\n # Los numere para poder armar los datos en el orden deseado\n cadena['01_nombre_cientifico'] = h.encode(especie.nombre_cientifico)\n cadena['02_nombre_comun'] = h.encode(especie.nom_com_prin(true))\n cadena['05_place_guess'] = h.encode(ob['place_guess'])\n cadena['06_observed_on'] = ob['observed_on'].gsub('-','/') if ob['observed_on'].present?\n cadena['07_captive'] = ob['captive'] ? 'Organismo silvestre / naturalizado' : nil\n cadena['08_quality_grade'] = ob['quality_grade']\n cadena['09_uri'] = ob['uri']\n\n if cadena['09_uri'].present?\n cadena['09_uri'] = cadena['09_uri'].gsub('www.inaturalist.org','naturalista.conabio.gob.mx').gsub('conabio.inaturalist.org', 'naturalista.conabio.gob.mx')\n end\n\n cadena['10_longitude'] = ob['longitude']\n cadena['11_latitude'] = ob['latitude']\n\n ob['photos'].each do |photo|\n cadena['03_thumb_url'] = photo['thumb_url']\n cadena['04_attribution'] = h.encode(photo['attribution'])\n break\n end\n cadenas << cadena\n end\n self.naturalista_kml = to_kml_naturalista(cadenas)\n end", "def index\n @categoriaprodutos = Categoriaproduto.all\n end", "def set_categoriaproduto\n @categoriaproduto = Categoriaproduto.find(params[:id])\n end", "def classpos\n if params[:pupil_set]\n @pupil_set=PupilSet.find(params[:pupil_set]) \n @setlinks=@pupil_set.setlinks.sort_by{|s| s.pupil.surname}\n end\n end", "def show\n @adver = Advertisement.find(params[:id])\n if(@adver.visualizacao.nil?)\n @view = 1\n else\n @view = @adver.visualizacao + 1;\n end\n\n Advertisement.all.update(@adver.id, :visualizacao => @view)\n @atu = Advertisement.all.where(category_id: @adver.category_id) unless params[:id].blank?\n end", "def show\n @limpeza = LogLimpeza.find(params[:id])\n @user_reporter = User.find_by_id(@limpeza.user_id)\n @categorias = Limpeza.select(:categoria).group(:categoria,:categoria_id).order(:categoria_id)\n end", "def adv_categories\n return ['AIR', 'BIKING', 'CULTURAL', 'CAMPING', 'MOTOR', 'CLIMBING', 'HIKING', 'SNOW', 'WATER', 'OTHER']\n end", "def index\n @laporan_guru_agama_katolik = LaporanGuruAgamaKatolik.order(\"created_at DESC\").page(params[:daftar_laporan_guru_agama_katolik_page]).per(6)\n end", "def ffck_categories_detailed()\n ['Pitchoun', 'Poussin 1', 'Poussin 2', 'Benjamin 1', 'Benjamin 2', 'Minime 1', 'Minime 2', 'Cadet 1', 'Cadet 2',\n 'Junior 1', 'Junior 2', 'Senior', 'Veteran 1', 'Veteran 2', 'Veteran 3', 'Veteran +', 'Inconnu']\n end", "def list_viaticos\n @company = Company.find(1)\n @caja = Caja.find(params[:id])\n \n @pagetitle = \"#{@company.name} - Viaticos\"\n @filters_display = \"block\"\n \n @locations = Location.where(company_id: @company.id).order(\"name ASC\")\n @divisions = Division.where(company_id: @company.id).order(\"name ASC\")\n \n \n if(@company.can_view(current_user))\n @viaticos = Viatico.where(caja_id: params[:id]).order('id DESC').paginate(:page => params[:page])\n\n if params[:search]\n @viaticos = Viatico.where(caja_id: params[:id]).search(params[:search]).order('id DESC').paginate(:page => params[:page])\n else\n @viaticos = Viatico.where(caja_id: params[:id]).order('id DESC').paginate(:page => params[:page]) \n end\n \n else\n errPerms()\n end\n end", "def show\n @categorias = @livro.assunto.split(',')\n end", "def illustration_IP_votes\n if (votes = read_attribute(:illustration_IP_votes))\n votes\n else\n write_attribute(:illustration_IP_votes, [])\n illustration_IP_votes\n end\n end", "def tecnicos_postulados\n coleccion = []\n self.request.each do |request|\n info = {}\n info[:id] = request.id\n info[:article] = request.article\n info[:servicio] = request.service.description\n info[:tecnicos] = request.proposal\n coleccion.append(info)\n end\n coleccion\n end", "def posti_disponibili\n self.vehicle.posti - self.n_passeggeri\n end", "def retourAvant()#TOTEST\n if(@indiceCoup < tabCoup.size) #vérification normalement inutile puisque le bouton devrait être disable\n #On annule en passant au coup suivant\n coupSuivant = tabCoup.at(@indiceCoup)\n @grilleEnCours.tabCases[coupSuivant.case.positionY][coupSuivant.case.positionX].couleur = coupSuivant.couleur\n @grilleRaz = nil\n\n @indiceCoup += 1 #On passe au coup suivant\n\n socket = Fenetre1v1.getSocket\n if(socket != nil)\n socket.puts (\"av\" + @grilleEnCours.getPourcentage(@grilleBase, nil).to_s )\n end\n end\n\n return [peutRetourAvant?, coupSuivant.case] #Pour dire aux fonctions appelantes si on peut encore aller en avant\n end", "def nombres_comunes\n datos = eval(naturalista_info.decodifica64)\n datos = datos.first if datos.is_a?(Array)\n return [] unless datos['taxon_names'].present?\n nombres_comunes_faltan = []\n\n # Nombres comunes de la base de catalogos\n nom_comunes = especie.nombres_comunes\n nom_comunes = nom_comunes.map(&:nombre_comun).map{ |nom| I18n.transliterate(nom).downcase }.sort if nom_comunes\n\n datos['taxon_names'].each do |datos_nombres|\n next unless datos_nombres['is_valid']\n next if datos_nombres['lexicon'] == 'Scientific Names'\n\n # Nombre comun de NaturaLista\n nombre = I18n.transliterate(datos_nombres['name']).downcase\n lengua = datos_nombres['lexicon']\n\n if nom_comunes.present?\n next if nom_comunes.include?(nombre)\n end\n nombres_comunes_faltan << \"#{especie.catalogo_id},\\\"#{datos_nombres['name']}\\\",#{lengua},#{especie.nombre_cientifico},#{especie.categoria_taxonomica.nombre_categoria_taxonomica},http://naturalista.conabio.gob.mx/taxa/#{naturalista_id}\"\n end\n\n nombres_comunes_faltan\n end", "def show\n $total = VoteLog.all.count\n ## 임시코드 xxx\n #for k in 0..@lotto.winnum.to_i\n # instance_variable_set \"@winner_#{k}\" , Voter.where(id: $result[k]).pluck(:studentid).to_s.gsub('{\"studentid\"=>','').gsub('}','')\n #end \n\n ##테스트 코드 xxx\n #@firstwinner = Voter.where(id: $result[0]).pluck(:studentid).to_s.gsub('{\"studentid\"=>','').gsub('}','')\n end", "def ip_statistics\n super\n end", "def categories_by_vote_count\n\t\tself.given_votes.group(:category_id).count.each_with_object({}) { |(k, v), h| ( h[v] ||= [] ) << self.given_votes.find_by(category_id: k) }\n\tend", "def set_categoria_ing\n @categoria_ing = CategoriaIng.find(params[:id])\n end", "def set_categorias_produto\n #@categorias_produto = CategoriasProduto.find(params[:id])\n end", "def index\n if params[:tag]\n @articles = Article.tagged_with(params[:tag])\n else\n @articles = Article.left_joins(:votes).group(:id).order('COUNT(vote) DESC')\n @latest = Article.order('created_at DESC')\n end\n @client_ip = remote_ip()\n end", "def index\n @bonificacions = Bonificacion.order(\"@bonificacions.categorium_id\")\n end", "def category22\n return @category22\n end", "def show\n @onscrits = Onscrit.order(nom: :asc).to_a\n @votes = Vote.where('pg_id ='+session[:pg_id].to_s+' AND sondage_id ='+@sondage.id.to_s).to_a\n end", "def index\n @categoria_ings = CategoriaIng.all\n end", "def gesendete_lesen\r\n @postausgang.each{|x| puts x}\r\n end", "def controller2right c\n {\n articles: 0,\n categories: 1,\n dishes: 1,\n gallery: 2,\n reservations: 3,\n users: 4\n\n }[c]\n end", "def category24\n return @category24\n end", "def labels; end", "def category6\n return @category6\n end", "def mijnkunst\n max = 20.0\n @currentpage = 0\n spage = 0\n if params[:page] && params[:page].to_i > 0\n spage = (params[:page].to_i * max).ceil\n @currentpage = params[:page].to_i\n end\n countarr = Kunstvoorwerp.count(:all, \n :conditions => { active: true, user_id: @me.id }, \n :include => [:kunstimage, :user], \n :order => 'kunstvoorwerps.created_at DESC'\n )\n @kvs = Kunstvoorwerp.find(:all, \n :conditions => { active: true, user_id: @me.id }, \n :include => [:kunstimage, :user],\n :order => 'kunstvoorwerps.created_at DESC',\n :offset => spage,\n :limit => max\n )\n @pagecount = countarr / max\n @pagecount = @pagecount.ceil\n @kvi = Kunstvoorwerp.find(:all, \n :conditions => { active: false, user_id: @me.id }, \n :order => 'kunstvoorwerps.updated_at DESC'\n )\n end", "def get_all_the_urls_of_val_doise_townhalls(page_url)\n tab = []\n doc = Nokogiri::HTML(open(page_url))\n tab_lien = doc.css(\"a\").select{|link| link['class']==\"lientxt\"}\n lien =\"http://annuaire-des-mairies.com/\"\n tab_lien.each{|link| tab.push(lien+link['href'])}\n tab\nend", "def index\n q = params[\"query\"]\n \n @articles = Article.search(q).records.all if q\n @articles = @articles || Article.all\n\n id = params[:category_id]\n @articles = @articles.with_category(id) if id\n\n page = params[:page] || 1\n @articles = @articles.page(page).per(6) \n\n @sort = params[:sort] || 'new'\n @category_id = params[:category_id] || 'new'\n\n case @sort\n when \"views\"\n @articles = @articles.order(\"view_counter DESC\")\n @sort_text = I18n.t 'articles.sorting.views' \n when \"new\"\n @articles = @articles.order(\"created_at DESC\")\n @sort_text = I18n.t 'articles.sorting.new'\n when \"old\"\n @articles = @articles.order(\"created_at ASC\")\n @sort_text = I18n.t 'articles.sorting.old'\n when \"time_less\"\n @articles = @articles.order(\"reading_time ASC\")\n @sort_text = I18n.t 'articles.sorting.time_less'\n when \"time_more\" \n @articles = @articles.order(\"reading_time DESC\")\n @sort_text = I18n.t 'articles.sorting.time_more'\n end\n @sort_text = @sort_text.html_safe\n\n @category_id_text = I18n.t 'articles.cathegory.Все статьи'\n\n case @category_id\n when \"7\"\n @category_id_text = I18n.t 'articles.cathegory.Невроз и психосоматика'\n when \"8\"\n @category_id_text = I18n.t 'articles.cathegory.Тревога' \n when \"13\"\n @category_id_text = I18n.t 'articles.cathegory.Навязчивые мысли и действия'\n when \"14\"\n @category_id_text = I18n.t 'articles.cathegory.Низкая самооценка'\n when \"15\"\n @category_id_text = I18n.t 'articles.cathegory.Психотравмы и ПТСР'\n when \"9\"\n @category_id_text = I18n.t 'articles.cathegory.Депрессия и уныние'\n when \"11\"\n @category_id_text = I18n.t 'articles.cathegory.Панические атаки'\n when \"2\"\n @category_id_text = I18n.t 'articles.cathegory.Психология отношений'\n when \"3\"\n @category_id_text = I18n.t 'articles.cathegory.Общая психология'\n when \"4\"\n @category_id_text = I18n.t 'articles.cathegory.Исследования'\n when \"5\"\n @category_id_text = I18n.t 'articles.cathegory.Саморазвитие'\n when \"6\"\n @category_id_text = I18n.t 'articles.cathegory.Для профи'\n end\n\n tag = params[:tag_name]\n if tag\n contents = ArticleContent.where(\"tags like '%#{tag}%'\")\n article_ids = contents.map(&:article).map(&:id).uniq\n @articles = @articles.where(id: article_ids)\n end\n\n end", "def index\n @cuadros= @categorium.cuadros.order(:id)\n end", "def interieur\n @kv = Kunstvoorwerp.includes(:kunstimage).find(params[:id])\n @kv_width = (@kv.kunstimage.dimensions.width / 3).ceil\n @kv_height = (@kv.kunstimage.dimensions.height / 3).ceil\n\n if params[:int] and @logged_in\n @interieur = Interieur.find_by_id(params[:int], conditions: { user_id: current_user.id})\n @interieur_height = @interieur.dimensions.height\n @interieur_width = @interieur.dimensions.width\n\n resizes_if_necessary\n else\n if @logged_in and !@me.interieurs.blank?\n if params[:ssid]\n if params[:cp]\n redirect_to :int => @me.interieurs[0].id, :ssid => params[:ssid], :cp => params[:cp]\n else\n redirect_to :int => @me.interieurs[0].id, :ssid => params[:ssid]\n end\n else\n redirect_to :int => @me.interieurs[0].id\n end\n end\n end\n \n @cp = 0\n if params[:ssid]\n # search session id\n @ssid = params[:ssid]\n if session[@ssid]\n spage = 0\n if params[:cp] and !params[:cp].blank? and is_a_number?(params[:cp])\n spage = (params[:cp].to_i * 20).ceil\n @cp = params[:cp]\n end\n @kvs = Kunstvoorwerp.find(:all, \n :conditions => session[@ssid][:where], \n :include => [:kunstimage, :user, :favourites],\n :order => session[@ssid][:sort], :offset => spage,\n :limit => 20)\n end\n else\n @kvs = Kunstvoorwerp.find(:all,\n :conditions => { active: true, user_id: @kv.user_id },\n :order => 'kunstvoorwerps.created_at DESC',\n :limit => 20)\n end\n @title = @kv.title \n end", "def suivre; end", "def vrat_soucet_vah(jedinec)\n soucet = 0\n citac = 0\n jedinec.each do |prvek| \n if(prvek)then\n soucet += @pole_vah[citac].to_i\n end\n citac +=1\n end\n return soucet\n end", "def secoes(zona)\n\n \tsecoes = 0\n\n @logistica[\"ze\"][zona.numero][\"mun\"].each do |nmun, log_mun|\n log_mun[\"local\"].each do |nlocal, log_local|\n secoes += log_local[\"secoes\"]\n end\n end\n \n return secoes\n end", "def lan_nics\n x = nics.find_all_by_network_type('lan', :order =>:port_name)\n x = [] if x.nil?\n x\n end", "def category; end", "def index\n #@imovels = Imovel.all\n \n #Traz apenas os imoveis ativos\n @imovels = Imovel.all.select { |i| i.ativo == true }\n \n # Mapa para guardar os valores das transacoes associadas a cada imovel.\n # key: imovel_id, value: lista com [0]:transacao, [1]: tipos, [2] responsavel\n @hash_informacoes_imoveis = Hash.new\n \n @imovels.each do |imovel|\n popular_imovel(imovel)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @imovels }\n end\n end", "def index\n if @current_user.login == 'admin' then\n @bails = Bail.find(:all)\n else\n @appartements = getAppart\n @bails = Bail.find(:all, :conditions=>{:etat=> 0..2, :appartement_id =>@appartements} )\n end \n @etat = etat\n maj_etat(@bails) \n maj_apayer(@bails)\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @bails }\n end\n end", "def show\n #@most_voted = Post.order('category_id=#{@post.category_id} and ').limit(2)\n @most_voted = Vote.limit(5).where(:category_id => @post.category_id).order(\"count_all desc\").count(group: :post_id)\n @my_photos = Post.find_all_by_user_id_and_category_id(current_user.id, @post.category_id)\n end", "def generate_lvs_nodes(c)\n dcnut = Datacenter.find_by_name(\"nut\")\n svc = c.cluster_nodes.map do |cn|\n if cn.node.is_server? and cn.node.datacenter == dcnut then\n [ip(cn.ip_address), ip(cn.node.mgmt_ip_address), dec2ip(cn.cluster.fw_mark), cn.node.hostname ] \n else\n nil\n end\n end.compact\n#########################################################33\nend", "def show\n #begin\n #@lien = Lien.find(params[:id])\n @liens = Lien.find_by_sql(\"SELECT a.titre_lien, a.url_lien, a.description_lien, a.image_lien, a.created_at, b.lien_id, c.pseudo_auteur, c.prenom_auteur, c.nom_auteur, d.sum_lien_votes_positifs FROM liens a LEFT JOIN liens_auteurs b ON (b.lien_id = a.id) LEFT OUTER JOIN liens_votes d ON (d.lien_id = a.id) LEFT JOIN auteurs c ON (b.auteur_id = c.id) WHERE a.id=#{params[:id].to_i}\") \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lien }\n end\n #rescue\n #flash[:notice] = \"Désolé monsieur ou madame !!\"\n #redirect_to '/'\n #end\n end", "def categorize\n #sólo muestra los eventos de cierta categoría.\n #@events = Event.where([\"category_id = ?\", params[:id]]).all\n @events = Event.find_by_sql([\"SELECT e.*, c.name as category_name FROM events e, categories c WHERE c.id = ? AND e.category_id = c.id\", params[:id]])\n \n #se agregan las categorias para poder navegar a través de ellas.\n @categories = Category.all\n\n #se renderiza la misma vista del index para reutilización.\n render :index\n\n # respond_to do |format|\n # format.html # categorize.html.erb\n # format.json { render json: @events }\n #end\n end", "def set_categories\n @categories = {}\n @mechanize.page.search('//*[@id=\"prtcalst\"]//li').each do |cat|\n cat_link = cat.search('a')[0]\n cat_name = cat.search('.//em')[0].inner_text()\n catObj = Category.new()\n catObj.elem = cat_link\n catObj.name = cat_name\n @categories[cat_name] = catObj\n\n puts(\"#{cat_name}\")\n puts(\"-------------------\")\n end\n end", "def index\n @jalans = Jalan.all\n @lokasis = Rute.select(\"id_jalan\").uniq\n end", "def show\n @itemvalue = 15\n @min = 0\n @max = 1000000000\n @maxvalue = \"-\"\n @sort = \"Produk Terbaru\"\n if params[:sort]\n @itemvalue = params[:item]\n @min = params[:min]\n @max = params[:max]\n if params[:max] == \"1000000000\"\n @max = params[:max]\n @maxvalue = \"-\"\n else\n @maxvalue = params[:max]\n end\n @hargaselect = \"max=\" + @max + \"&min=\" + @min\n if params[:sort] == \"1\"\n @sort = \"Produk Terbaru\"\n @sortselect = 1\n @sortvalue = \"created_at desc\"\n elsif params[:sort] == \"2\"\n @sort = \"Produk Terpopuler\"\n @sortselect = 2\n @sortvalue = \"bought asc\"\n elsif params[:sort] == \"3\"\n @sort = \"Diskon Terbesar\"\n @sortselect = 3\n @sortvalue = \"diskon desc\"\n elsif params[:sort] == \"4\"\n @sort = \"Rating Tertinggi\"\n @sortselect = 4\n @sortvalue = \"rating desc\"\n else\n @sort = \"Random\"\n @sortselect = 5\n @sortvalue = \"created_at desc\"\n end\n end\n if params[:sort]\n @cat = Produk.where(\"harga_beli > ? AND harga_beli < ? AND category_id = ?\", params[:min], params[:max], params[:id]).order(@sortvalue).paginate(:page => params[:page], :per_page => params[:item])\n else\n @cat = Produk.where(\"category_id = ?\", params[:id]).order(\"created_at desc\").paginate(:page => params[:page], :per_page => 15)\n end\n @categories = Category.all\n @category_id = Category.find(params[:id]).id\n @subcategory = Subcategory.where(category_id: @category_id)\n end", "def index\n\n\n @cont = 0 # Variable para acceso al arreglo de @usuarios en la vista\n @clinicas = Clinica.all\n @usuarios = Usuario.find(:all, :conditions => \"datos_type = 'Clinica'\")\n\n\n end", "def mi_carrera\n\n\tend", "def verdi; end", "def show\n #訪問\n @houmons = @kofu.houmons.all\n @houmon = @kofu.houmons.build\n \n #訪問回数の自動セット\n @houmon.houmon_su = @houmons.length + 1\n @houmon.build_tenko\n @houmon.build_zaitakufuzai\n \n #点検結果\n @tenkenkekka = @houmon.tenkenkekka\n if @tenkenkekka.nil?\n @tenkenkekka = @houmon.build_tenkenkekka\n end\n \n #問診\n @monshin = @tenkenkekka.monshin\n if @monshin.nil?\n @monshin = @tenkenkekka.build_monshin\n #契約種別が011ならば問診未実施理由自動登録\n if @kofu.keiyaku.keiyakushubetsu_code == \"011\"\n @monshin.jisshi_umu = 2 \n @monshin.mijisshi_riyu = \"街路灯\"\n end\n end\n \n #屋内\n @okunai = @tenkenkekka.okunai\n if @okunai.nil?\n @okunai = @tenkenkekka.build_okunai\n #契約種別が011ならば屋内未実施理由自動登録\n if @kofu.keiyaku.keiyakushubetsu_code == \"011\" \n @okunai.jisshi_umu = 2\n @okunai.mijisshi_riyu = \"街路灯\"\n end\n end\n #屋外\n @okugai = @tenkenkekka.okugai\n if @okugai.nil?\n @okugai = @tenkenkekka.build_okugai\n end\n #測定値\n @sokutei = @tenkenkekka.sokutei\n if @sokutei.nil?\n @sokutei = @tenkenkekka.build_sokutei\n end\n \n \n end", "def index\n @posts = Post.paginate(page: params[:page], per_page:4).ultimos #mostrará de 4 en 4 los post publicados, y ordenados desde el mas actual al mas antiguo\n @categories = Category.all #podremos ver todas las categorias\n\n \n end", "def resultados_basica\n paginado_y_offset\n estatus\n solo_publicos\n solo_categoria\n\n return unless por_id_o_nombre\n\n conteo_por_categoria_taxonomica\n dame_totales\n resultados\n\n resultados_fuzzy_match if totales == 0 && pagina == 1 && params[:solo_categoria].blank?\n end", "def category16\n return @category16\n end", "def candidatUnique()\n\t\tlisteCase = Array.new\n\t\t@partie.getPlateau().each do |x,y,laCase|\n\t\t\tlaCase.getCandidat.getListeCandidat.compact.each do |val|\n\t\t\t\t# print @partie.getPlateau().getLigne(x).compact.map(&:getCandidat).map(&:getListeCandidat).flatten,\"\\n\"\n\t\t\t\tif @partie.getPlateau().getLigne(x).compact.map(&:getCandidat).map(&:getListeCandidat).flatten.compact.count(val) == 1\n\t\t\t\t\tlisteCase.push([Position.new(x,y), val, 1])\n\t\t\t\telsif @partie.getPlateau().getColonne(y).compact.map(&:getCandidat).map(&:getListeCandidat).flatten.compact.count(val) == 1\n\t\t\t\t\tlisteCase.push([Position.new(x,y), val, 2])\n\t\t\t\telsif @partie.getPlateau().getRegion(x,y).compact.map(&:getCandidat).map(&:getListeCandidat).flatten.compact.count(val) == 1\n\t\t\t\t\tlisteCase.push([Position.new(x,y), val, 0])\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\tif listeCase.empty?\n\t\t\treturn nil \n\t\tend\n\n\t\treturn listeCase\n\tend", "def show\n\t\t# @procategories = active_procategories_follow_ddc_level(@procategory.level)\n\t\t# @procategories = paginate(@procategory.cousin)\n @procategories = @procategory.cousin\n end", "def get_townhall_urls(url)\n urls_department = []\n \n doc = Nokogiri::HTML(open(url))\n \n # Extraire le texte et mettre ça dans un hash \n \n doc.xpath(\"//a[@class=\\\"lientxt\\\"]\").each do |node|\n urls_department << { name: node.text, url: \"http://annuaire-des-mairies.com\" + node[:href][1, node[:href].size - 1]}\n end\n urls_department\n end", "def vigencias=(value)\n @vigencias = value\n end", "def get_nom(url)\n tab = []\n doc = Nokogiri::HTML(open(\"http://annuaire-des-mairies.com/\"))\n tab_lien = doc.css(\"a\").select{|link| link['class']==\"lientxt\"}\n tab_lien.each{|link| tab.push(link.text)}\n tab\n end", "def index\n @data_keagamaan_katolik = DataKeagamaanKatolik.all\n end", "def vrat_modif_instanci\n vystup=\"\"\n @pole_dat.each do |radek| \n if(radek[0]==\"p\")then \n vystup +=radek\n vystup += \"w #{generuj_vahy(radek).join(' ')}\\n\" #pridani radku s vahami\n else\n vystup +=radek\n end \n end\n # puts vystup\n return vystup\n end", "def list\n @categories = ArticleCategory.find(:all, :order => 'name',:include => :approved_articles) \n @tag_cloud, @min_count, @max_count = Article.top_tags_min_max(50)\n end", "def index\n @projektid = params[:projekt]\n @produktkats = Produktkategorie.find(:all, :conditions=>[\"projekt_id=?\",@projektid])\n @produkte = Array.new \n \n\n @produktkats.each do |kat|\n @produkt = Produkt.find( :all, :conditions=>[\"kat_id=?\", kat.id])\n @produkte.concat @produkt\n end\n end", "def my_cults_slogans\n self.cults.each do |cult|\n puts cult.slogans\n end\n end", "def exibe_possibilidades(categoria)\n categoria.each_with_index {|value, index| puts \"#{index})#{value}\"}\n end", "def category18\n return @category18\n end", "def category12\n return @category12\n end", "def articles\n return AP.category(@id)\n end", "def get_link\n page = Nokogiri::HTML(open(\"http://annuaire-des-mairies.com/val-d-oise.html\"))\n faux_liens_villes =[]\n page.xpath('//*[@class=\"lientxt\"]').each do |lien|\n faux_liens_villes << lien.values[1]\n end\n liens_villes = faux_liens_villes.map{ |el| \"http://annuaire-des-mairies.com\" + el[1..-1]}\n return liens_villes\n end", "def index\n @mk_categories = MkCategoria.all\n end", "def index\n @cidades = Cidade.mais_ativas(:order => \"cidades.relevancia DESC\",\n :limit => @settings[\"home_cloud_items\"].to_i).sort_by { |c| c.nome }\n @tags = Tag.do_contexto(:pais => nil,\n :estado => nil,\n :cidade => nil,\n :bairro => nil,\n :topico_type => nil,\n :ultimos_dias => nil,\n :order => \"tags.relevancia DESC\",\n :limit => @settings[\"home_cloud_items\"].to_i)\n @usuarios = User.nao_admin.ativos.com_avatar.aleatorios.find(:all, :limit => 8)\n \n @topicos = Topico.de_user_ativo.find(:all, :include => [:locais], :order => \"topicos.id DESC\", :limit => @settings[\"home_numero_topicos\"].to_i)\n @topicos_mais_comentados = Topico.de_user_ativo.find(:all, :include => [:locais], :order => \"topicos.comments_count DESC\", :limit => @settings[\"home_numero_topicos\"].to_i)\n @topicos_mais_apoiados = Topico.de_user_ativo.find(:all, :include => [:locais], :order => \"topicos.adesoes_count DESC\", :limit => @settings[\"home_numero_topicos\"].to_i)\n \n @apoios = Adesao.por_user_ativo.find(:all, :include => [:user, :topico], :order => \"adesoes.created_at DESC\", :limit => @settings[\"home_numero_apoios\"].to_i)\n @seguidores = Seguido.por_user_ativo.find(:all, :include => [:topico], :order => \"seguidos.created_at DESC\", :limit => @settings[\"home_numero_seguidores\"].to_i)\n @comentarios = Comentario.de_user_ativo.find(:all, :order => \"comments.id DESC\", :limit => @settings[\"home_numero_comentarios\"].to_i)\n end", "def cantidad_solicitudes tipo, session\n #ciudad = Ciudad.find(:first, :conditions=>['ciudad.id=?',session[:oficina][:ciudad_id].to_s],:include=>:estado)\n oficina_id=session[:oficina].to_s\n estado= tipo=='e' ? \" and oficina_id=#{oficina_id} \" : \"\"\n total=ComiteDecisionHistorico.count(:conditions=>\" tipo_comite='#{tipo}' and comite_id=#{self.id} #{estado} \")\n total_decision=ComiteDecisionHistorico.count(:conditions=>\" tipo_comite='#{tipo}' and comite_id=#{self.id} and decision is not null #{estado} \") \n {:total=>total,:total_con_decision=>total_decision} \n end", "def funktionsname\n\tanweisung\nend", "def basic_clasificator origen,dpworld_data,stwd_data,hit_data\n origen.each do |params|\n\tputs \"FILA: #{params.to_s}\"\n $LOG.debug \" LIBERACION: #{params.to_s}\"\n case [ params['ptocreacion'] , params['solvenciaNotifId'] ]\n when ['DOCAU',1]\n dpworld_data << ReleaseCaucedo.new( params )\n when ['DOCAU',4]\n stwd_data << ReleaseSTWD.new( params )\n when ['DOHAI',2]\n\t hit_data << ReleaseHIT.new( params )\n end\n end\n [dpworld_data,stwd_data,hit_data]\nend", "def candidatGrille()\n\n\tend", "def show\n @article = Article.find(params[:id])\n @articles = Article.left_joins(:votes).group(:id).order('COUNT(vote) DESC')\n tag_list = @article.tag_list\n relevant = Article.tagged_with(tag_list, :any => true,:wild => true)\n @relevant_tag = []\n\n relevant.each do |x|\n if x.id != @article.id\n @relevant_tag << x\n end\n end\n\n # impressionist(@article)\n end", "def status_da_divulgacao(topico)\n end", "def show\n @adverts = Advert.all\n @adverts = Advert.where(:category_id => @advert.category_id).order(:views).order(:title)\n @advert.increment\n end", "def define_clusters_ip_24\n @nodes_graph.each_key do |node_name|\n next unless @nodes_graph[node_name][:type] == :node && !@node_metadata[node_name][:private_ips].nil? && !@node_metadata[node_name][:private_ips].empty?\n\n ip_24 = \"#{@node_metadata[node_name][:private_ips].first.split('.')[0..2].join('.')}.0/24\"\n @nodes_graph[ip_24] = ip_range_graph_info(ip_24) unless @nodes_graph.key?(ip_24)\n @nodes_graph[ip_24][:includes] << node_name unless @nodes_graph[ip_24][:includes].include?(node_name)\n end\n end", "def get_townhall_urls(url)\n urls_department = []\n\n doc = Nokogiri::HTML(open(url))\n\n# Extraire le texte et mettre ça dans un hash \n\n doc.xpath(\"//a[@class=\\\"lientxt\\\"]\").each do |node|\n urls_department << { name: node.text, url: \"http://annuaire-des-mairies.com\" + node[:href][1, node[:href].size - 1]}\n end\n\n urls_department\nend", "def ip_list\n super\n end" ]
[ "0.5792286", "0.57387924", "0.56054103", "0.55633235", "0.5473946", "0.5417429", "0.5394761", "0.53102034", "0.5299386", "0.52879983", "0.5261943", "0.5224768", "0.5204517", "0.51422983", "0.5138521", "0.5130041", "0.51204973", "0.5070955", "0.50635934", "0.5051135", "0.504877", "0.50334316", "0.50269", "0.5019113", "0.49937275", "0.4983398", "0.4976402", "0.49651304", "0.4929579", "0.49281833", "0.4918951", "0.49124512", "0.49091515", "0.490258", "0.48985082", "0.48973104", "0.48918313", "0.48742613", "0.48706338", "0.48590454", "0.48567182", "0.48566335", "0.4847073", "0.48466882", "0.48465523", "0.48455968", "0.48450905", "0.48447573", "0.48438352", "0.48411742", "0.48405167", "0.48379004", "0.48363572", "0.4824678", "0.4823514", "0.48176575", "0.4812311", "0.4809403", "0.48011592", "0.4794968", "0.47892252", "0.47811708", "0.47788975", "0.47777078", "0.47628546", "0.47582522", "0.47497365", "0.47492054", "0.4747823", "0.47451943", "0.47401363", "0.47385764", "0.47372147", "0.47327617", "0.47293288", "0.4728652", "0.47259018", "0.47245553", "0.47237042", "0.47231498", "0.4721837", "0.4712248", "0.47111136", "0.47106975", "0.47085437", "0.4708245", "0.47077864", "0.4706476", "0.47018644", "0.46988606", "0.4696124", "0.4694275", "0.46940187", "0.46884602", "0.46882752", "0.46877143", "0.46863103", "0.46854493", "0.4684734", "0.46840513", "0.46831322" ]
0.0
-1
Uzseto visus parametrus filtram. Iziet cauri failam un ieraksta info filtra logos
def set_all_parameters @screens.screen_set_filter_parameters.visible? @filter_data.parameters.each do |parameter| #ieraksta datus laukos @screens.screen_set_filter_parameters.set_parameter(parameter) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logueo_params\n params.require(:logueo).permit(:usuario, :clave)\n end", "def realizar_login (perfil_usuario)\n\n @perfil = perfil_usuario\n\n \n case @perfil\n\n when \"pessoa fisica\"\n \n escolher_perfil(@perfil)\n realizar_login_pf(\"41906\", \"#ufCrm > option:nth-child(19)\", \"123\")\n\n when \"pessoa juridica\"\n\n visit \"/\"\n sleep(1)\n escolher_perfil(@perfil)\n realizar_login_pj(\"36172\", \"#ufCrmPJ > option:nth-child(19)\", \"'#prestador > option:nth-child(3)'\", \"cn&n77&9\")\n\n when \"area restrita\"\n\n escolher_perfil(@perfil)\n sleep(1)\n realizar_login_restrito(\"ODANIELE\", \"123\")\n\n else\n\n puts \"Erro na selecao de perfil\"\n\n end\n\n\n end", "def filme_params\n params.require(:filme).permit(:id, :anoA, :anoF, :cor, :cotacao, :dataA, :genero_id, :midia_id, :pais_id, :titulo, :titulorg, :ator_ids => [], :diretor_ids => [])\n end", "def index\n session[:filtro] = nil\n \t#@bots = Bot.all\n @user = User.find(session[:login]);\n @bots = @user.bots;\n if params['usuario'].present?\n if @user.perfil == 1\n usuario = User.find(params['usuario']);\n @bots = usuario.bots\n end\n end\n end", "def logradouro_params\n params.require(:logradouro).permit(:descricao, :localizacao,\n :quadra_direita_id,:quadra_esquerda_id,\n :numeracao_direita, :numeracao_esquerda, :infraestrutura_existente)\n end", "def show\n @usuario = Usuario.find(params[:id])\n clientesIds = Cliente.where(:usuario_id => params[:id])\n @clientes = clientesIds.map{|c| Usuario.find(c.cliente_id)}\n\n logs = Logsesion.new(:usuario_id => @usuario.id, \n :superu_id => current_usuario.id,\n :tipo => \"Visualizado\", \n :nusuario => @usuario.login, \n :nsuperu => current_usuario.login)\n\n if logs.save\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @usuario }\n end\n else\n format.json { render json: @usuario, notice:\"La información no fue almacenada en el log.\" }\n end\n end", "def login\n if request.post? then\n if params[:courriel] && !params[:courriel].empty?\n # Trouvez les profils ayant cette adresse.\n fs = Famille.where(\"courriel1 = :courriel1 or courriel2 = :courriel2\", {:courriel1 => params[:courriel], :courriel2 => params[:courriel]})\n if !fs.empty?\n fs.each do |f|\n msg = t(:public_login_link)\n sujet = t(:public_login_sujet)\n FamilleMailer.info(f, sujet, params[:courriel], msg, f.langue).deliver\n end\n flash[:notice] = t(:public_login_sent)\n else\n flash[:notice] = t(:public_login_unk)\n end\n else\n flash[:notice] = t(:public_login_inv) \n end\n \n end\n \n # On recommence avec le meme formulaire de login\n render 'login'\n end", "def set_logradouro\n @logradouro = Logradouro.find(params[:id])\n end", "def list\n # caso onde recebo um caracter para buscar\n if params[:char].size == 1\n @siglas = Sigla.all( :conditions => [\"sigla like ?\", params[:char]+\"%\" ], \n :order => \"created_at DESC\" )\n # caso particular para buscar números\n elsif params[:char] == \"0-9\"\n busca_arr = []\n (0..9).each do |num|\n busca_arr << \"sigla like '#{num}%'\"\n end\n @siglas = Sigla.all( :conditions => busca_arr.join(' OR '), \n :order => \"created_at DESC\" ) \n end\n \n \n if @siglas.size < 1\n @moto = \"Não temos definições com esse caracter :/\"\n elsif @siglas.size == 1\n @moto = \"1 única definição encontrada\"\n else\n @moto = \"#{@siglas.size} definições encontradas\"\n end\n \n end", "def filtra_acceso(current_usuario, pf, params = nil)\n if params && params[:filtro] && params[:filtro][:busoficina] &&\n params[:filtro][:busoficina] != ''\n pf = pf.joins(:oficina_proyectofinanciero).\n where('sivel2_sjr_oficina_proyectofinanciero.oficina_id = ?',\n params[:filtro][:busoficina])\n end\n return pf\n end", "def fiado_params\n params.require(:fiado).permit(:nombre, :direccion, :rfc, :telefono, :email, :cdf, :ife, :cf, :da, :ac, :mac, :ah, :ber, :cc, :osife, :oscdf, :osg)\n \n end", "def loggin_opc(puser, pcontroller, paction, pcomment)\n #para que no haga logging de clicks de navegacion\n if pcontroller == 'home'\n\t\treturn\n else\n\t logmodel = Logeclubapi.new\n\t logmodel.login = puser.login\n\t logmodel.username = puser.name\n\t logmodel.log_option = pcontroller\n\t logmodel.log_action = paction[0..9]\n\t logmodel.log_comment = pcomment\n\t logmodel.origin = 'W' #origen web\n\t #logmodel.save\n end\n end", "def update\n if @logro.update_attributes(params.require(:logro).permit(:nombre,:descripcion,:marca, :limite_inferior_rango,:limite_superior_rango))\n flash[:notice] = \"Se ha editado el logro exitosamente.\"\n redirect_to logros_path\n else\n flash[:notice] = \"Problemas en la edición del logro.\"\n render 'edit'\n end\n end", "def index\n if params[:filtrado] == nil\n @rooms = Room.all.order(:name)\n else\n if (current_user != nil)\n @rooms = Room.filtered(current_user.name)\n else\n @requerLogin = 1\n @rooms = Room.all.order(:name)\n end\n end\n end", "def setar_data\n if params[\"laudo\"]\n unless params[\"laudo\"][\"data_formatada\"].blank?\n $data_formatada = params[\"laudo\"][\"data_formatada\"]\n end\n else\n if params['voluntario'] and params['voluntario']['criterios'] and params['voluntario']['criterios']['data_formatada']\n $data_formatada = params['voluntario']['criterios']['data_formatada']\n end\n end\n end", "def list_viaticos\n @company = Company.find(1)\n @caja = Caja.find(params[:id])\n \n @pagetitle = \"#{@company.name} - Viaticos\"\n @filters_display = \"block\"\n \n @locations = Location.where(company_id: @company.id).order(\"name ASC\")\n @divisions = Division.where(company_id: @company.id).order(\"name ASC\")\n \n \n if(@company.can_view(current_user))\n @viaticos = Viatico.where(caja_id: params[:id]).order('id DESC').paginate(:page => params[:page])\n\n if params[:search]\n @viaticos = Viatico.where(caja_id: params[:id]).search(params[:search]).order('id DESC').paginate(:page => params[:page])\n else\n @viaticos = Viatico.where(caja_id: params[:id]).order('id DESC').paginate(:page => params[:page]) \n end\n \n else\n errPerms()\n end\n end", "def index\n if current_usuario.admin?\n @campeonatos = Campeonato.all.order('data_inicio DESC')\n else\n @campeonatos = current_usuario.campeonatos.order('data_inicio DESC')\n end\n @title = I18n.t('views.cadastros.campeonatos_title',\n length: @campeonatos.length.to_s)\n end", "def show\n if params[:thumbnail]\n @image = Logotype.find(params[:thumbnail])\n end\n #if params[:usuario]\n # @usuario = User.find(params[:usuario])\n # if @usuario.profile.logotype\n # @image = @image = Logotype.find(:first, :conditions => {:parent_id => @usuario.profile.logotype, :thumbnail => ''})\n # end\n #elsif params[:image_space]\n # @this_space = Space.find_by_name(params[:image_space])\n # if @this_space.logotype\n # @image = Logotype.find(:first, :conditions => {:parent_id => @this_space.logotype, :thumbnail => 'space'})\n # end\n #else\n #si hubiera algún otro tipo de modelo con logo iría aquí en otro elsif\n #end\n respond_to do |format|\n format.html {\n if @image\n send_data @image.current_data, :filename => @image.filename,\n :type => @image.content_type,\n :disposition => 'inline'\n end\n } # show.html.erb\n format.xml { render :xml => @logotype }\n end\n end", "def ogrenci_params\n params.require(:ogrenci).permit(:avatar, :adi, :soyadi, :tc_no, :tel_no, :kan_grubu, :okul, :sinif, :bolum, :adres, :veli_ad, :veli_soyad, :veli_tel, :veli_tel2, :date, :ogrsinif)\n end", "def usuario_params\n \n end", "def show\n @limpeza = LogLimpeza.find(params[:id])\n @user_reporter = User.find_by_id(@limpeza.user_id)\n @categorias = Limpeza.select(:categoria).group(:categoria,:categoria_id).order(:categoria_id)\n end", "def docentes\n\t\t@seccion = \"Docentes\"\n @titulo = \"Docentes\"\n\n if Docente.all().size > 0\n \t\tif params[:orden]\n \t\t\t@orden = params[:orden]\n \t\telse\n \t\t\t@orden = \"Cédula\"\n \t\tend\n\n \t\t#Guardo todos los docentes\n \t\tcase @orden\n \t\twhen \"Cédula\"\n \t\t\t@usuarios = Usuario.order('cedula').where(:id => Docente.all)\n \t\twhen \"Nombre\"\n \t\t\t@usuarios = Usuario.order('nombre').where(:id => Docente.all)\n \t\twhen \"Apellido\"\n \t\t\t@usuarios = Usuario.order('apellido').where(:id => Docente.all)\n \t\twhen \"Correo\"\n \t\t\t@usuarios = Usuario.order('correo').where(:id => Docente.all)\n \t\tend\n\n end\n\t\t\n\t\t @categorias = ['Cédula', 'Nombre', 'Apellido', 'Correo'] #Este es el orden que se mostrará en el select de la vista\n\n \t\t@docente_datos = [] #En este arreglo se guardan los pares \"Cedula - Nombre Apellido\" de cada usuario para mostrar en el campo de busqueda\n \t\tUsuario.order('nombre').where(:id => Docente.all).each do |usuario|\n \t\t\t#En este foro se agregan uno a uno los valores de cada docente al arreglo de la manera indicada arriba\n \t\t\t@docente_datos << usuario.cedula.to_s + \" - \" + usuario.nombre_y_apellido.to_s\n \t\tend\n\tend", "def index\n\n if session[:perfil] == \"Comum\" or session[:perfil] == \"Técnico\" or session[:perfil] == \"Zelador\"\n\n @informativo_obras = InformativoObra.where(:usuario_id => current_user).order(\"id desc\")\n\n elsif session[:perfil] == \"Administrador\"\n\n @informativo_obras = InformativoObra.all\n\n end\n\n\n end", "def show\n @fotos = Foto.where(:registro_id => @registro.id)\n \n @usuario = User.where(:id => current_user.id).pluck(:id).first\n @unir = Unir.new\n @nombre = Grupo.where(:clave => params[:clave]).pluck(:nombre).first\n @descripcion = Grupo.where(:clave => params[:clave]).pluck(:descripcion).first\n @registros = Registro.all\n @grupos = Grupo.all\n @grupo = Grupo.new\n @foto = Foto.new\n @comentario = Comentario.new\n @respuestum = Respuestum.new\n #---- Actualiza el contador -->\n @registro = Registro.find(params[:id])\n @query = Registro.where(:id => @registro).pluck(:user_id).first\n if @query.to_i == current_user.id\n else\n @count=@registro.countclicks+1\n @registro.countclicks = @count\n @registro.save\n end\n #------Fin--------------------->\n\n\n\n end", "def parametros_de_usuario\n params.require(:usuario).permit(:celular, :contrasena, :recuerdame, :rol, :nombre, :ubicacion, :correo, :gerencia, :telefono, :fh_sesion, :f_creado, :f_actualizado, :area)\n end", "def foto_params\n params.require(:foto).permit(:usuario_id,:DESCRIPCION, :FECHA, :TITULO, :imagen)\n end", "def clinica_params\n params.require(:clinica).permit(:nome, :email, :password, :logo)\n end", "def usuario_params\n # Nao pode criar usuarios com perfil admin, cria um android\n params[:perfil_id] = 2 if params.values_at(:perfil_id).first == 1\n\n params.permit(:nome, :email, :ano, :password, :password_confirmation, :profissao, :restricao, :restricao_outras,\n :genero_id, :perfil_id, :escolaridade_id)\n end", "def decideur_show\n @user = Admin.where(role_id: 2).order(name: :asc)\n add_breadcrumb 'utilisateur', parametre_admin_path\n add_breadcrumb 'decideurs', parametre_decideurs_path\n render layout: 'fylo'\n end", "def aluno_params\n params.require(:aluno).permit(:nome, :ra, :email, :curso_id, :search)\n end", "def login(user)\n\tif $users_profil.include?(user)\n\t\tputs \"Username: #{user}\"\n\t\tputs \"Profil: #{$users_profil[user]}\" \n\telse \n\t\tputs \"Numele de utilizator este gresit.\"\n\t\tprima # daca a scris usernamul gresit sau daca acel username nu exista atunci scriptul practic se reinitializeaza\n\tend\nend", "def index\n\n if params[:search] != 0\n @usuarios = User.where(\"name LIKE ? or apellidos LIKE ?\",\"%#{params[:search]}%\",\"%#{params[:search]}%\").where(activo: true)\n\n else\n #obtener todos los usuarios y pasarlos a la variable @usuarios\n @usuarios = User.where(activo: true).order(:apellidos)\n end\n #obtener todos los usuarios y pasarlos a la variable @usuarios\n #cambiar al directorio /public\n Dir.chdir \"#{Rails.root.join('public')}\"\n\n #iteración de todos los usuarios en el arreglo @usuarios\n @usuarios.each do |u|\n # creamos una variable que va a crear en string el nombre de la foto que se va a guardar\n # ej. user_image_23.png para el usuario con id 23\n saveName = \"user_image_#{u.id}.png\"\n\n # abrimos el filestream para escritura con el nombre de la variable saveName\n fotoUsuario = File.open(saveName, 'wb') do |f|\n\n # el begin y rescue es el clásico try/catch\n begin\n # intentamos convertir los bytes que se reciben de la base de datos en encoding BASE64\n # y lo escribimos en el filestream usando decode64. Se guardaría en /public/user_image_23.png\n f.write(Base64.urlsafe_decode64(u.foto))\n\n # cambiamos el contenido de la propiedad foto para que no sea el arreglo de bytes sino el\n # nombre con el que quedó guardado en /public/\n u.foto=saveName\n\n # cerramos el stream\n f.close\n\n # si escribir la foto falla por algún motivo...\n rescue => ex\n # ignoramos lo que se haya jalado de la base de datos y ponemos de nombre una imagen genérica\n # esta imagen debe estar guardada eb /public/\n u.foto=\"default_user_image.png\"\n end\n end\n\n end\n\n\n\n\n end", "def list_date\r\n #Si es el dueo del log poner un botn para que pueda aadir sesiones\r\n @buttons = write_permission?\r\n\r\n conditions = \"user_id=#{log_owner.id}\"\r\n\r\n initial_date = sprintf(\"%d-%d-%d\", params[:year], params[:month]||1, params[:day]||1)\r\n if params[:month].nil?\r\n final_date = sprintf(\"%d-01-01\", params[:year].to_i+1)\r\n conditions << \" AND done_on >= '#{initial_date}' AND done_on < '#{final_date}'\"\r\n elsif params[:day].nil?\r\n final_date = sprintf(\"%d-%d-01\", params[:year].to_i+(params[:month].to_i==12?1:0), (params[:month].to_i==12?1:params[:month].to_i+1))\r\n conditions << \" AND done_on >= '#{initial_date}' AND done_on < '#{final_date}'\"\r\n else\r\n conditions << \" AND done_on = '#{initial_date}'\"\r\n end\r\n\r\n conditions << \" AND private = FALSE\" unless write_permission?\r\n\r\n #Listar las sesiones de entrenamiento entre las fechas dispuestas\r\n @pages, @ses = paginate(:training_sessions,\r\n :per_page =>15,\r\n :conditions => conditions,\r\n :order => 'done_on DESC, id DESC')\r\n\r\n render \"journal/log/index\"\r\n end", "def new\n @orden = Orden.new\n @maquina = Maquina.find(params[:maquina_id])\n @tecnicos = Usuario.find(:all,:conditions => [\"tipo_usuario = ? and capacidad_tecnica = ? \", Usuario::TECNICO, @maquina.tipo_area_tecnica ])\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @orden }\n end\n end", "def motorista_params\n params.require(:motorista).permit(:nome, :cnh, :telefone, :email, :cpf, :empresa_id)\n end", "def index\r\n\r\n if params[:sivic_situacoesrelatorio_id] == nil\r\n params[:sivic_situacoesrelatorio_id] = '0'\r\n end\r\n\r\n if params[:nome_pessoa] == nil\r\n params[:nome_pessoa] = '0'\r\n end\r\n\r\n if params[:sivic_situacoesrelatorio_id] != '0' && params[:nome_pessoa] != '0'\r\n if current_user.role == 'LIDER_DE_CELULAS'\r\n @sivic_relatorioscelulas = SivicRelatorioscelula.joins('INNER JOIN sivic_celulas sp on sivic_celula_id = sp.id INNER JOIN sivic_pessoas p on sp.sivic_pessoa_id = p.id and p.id = ' + current_user.sivic_pessoa.id.to_s).where('lower(p.nome_pessoa) like ? and sivic_situacoesrelatorio_id ='+ params[:sivic_situacoesrelatorio_id].to_s, \"%#{params[:nome_pessoa]}%\").paginate(:page => params[:page], :per_page => 10)\r\n else\r\n @sivic_relatorioscelulas = SivicRelatorioscelula.joins('INNER JOIN sivic_celulas sp on sivic_celula_id = sp.id INNER JOIN sivic_pessoas p on sp.sivic_pessoa_id = p.id').where('lower(p.nome_pessoa) like ? and p.sivic_igreja_id = ? and sivic_situacoesrelatorio_id ='+ params[:sivic_situacoesrelatorio_id].to_s, \"%#{params[:nome_pessoa]}%\", current_user.sivic_pessoa.sivic_igreja_id.to_s).paginate(:page => params[:page], :per_page => 10)\r\n end\r\n elsif params[:sivic_situacoesrelatorio_id] != '0'\r\n if current_user.role == 'LIDER_DE_CELULAS' \r\n @sivic_relatorioscelulas = SivicRelatorioscelula.joins('INNER JOIN sivic_celulas sp on sivic_celula_id = sp.id INNER JOIN sivic_pessoas p on sp.sivic_pessoa_id = p.id and p.id = ' + current_user.sivic_pessoa.id.to_s).where('sivic_situacoesrelatorio_id = ' + params[:sivic_situacoesrelatorio_id].to_s + 'and sivic_situacoesrelatorio_id ='+ params[:sivic_situacoesrelatorio_id].to_s).paginate(:page => params[:page], :per_page => 10)\r\n else\r\n \r\n #@sivic_relatorioscelulas = SivicRelatorioscelula.where(:sivic_situacoesrelatorio_id => params[:sivic_situacoesrelatorio_id]).paginate(:page => params[:page], :per_page => 10)\r\n @sivic_relatorioscelulas = SivicRelatorioscelula.joins('INNER JOIN sivic_celulas sp on sivic_celula_id = sp.id INNER JOIN sivic_pessoas p on sp.sivic_pessoa_id = p.id').where('sivic_situacoesrelatorio_id = ? and p.sivic_igreja_id =' + current_user.sivic_pessoa.sivic_igreja_id.to_s, params[:sivic_situacoesrelatorio_id].to_s).paginate(:page => params[:page], :per_page => 10)\r\n end\r\n elsif params[:nome_pessoa] != '0'\r\n if current_user.role == 'LIDER_DE_CELULAS'\r\n \r\n @sivic_relatorioscelulas = SivicRelatorioscelula.joins('INNER JOIN sivic_celulas sp on sivic_celula_id = sp.id INNER JOIN sivic_pessoas p on sp.sivic_pessoa_id = p.id and p.id = ' + current_user.sivic_pessoa.id.to_s).where('lower(p.nome_pessoa) like ?', \"%#{params[:nome_pessoa]}%\").paginate(:page => params[:page], :per_page => 10)\r\n else\r\n @sivic_relatorioscelulas = SivicRelatorioscelula.joins('INNER JOIN sivic_celulas sp on sivic_celula_id = sp.id INNER JOIN sivic_pessoas p on sp.sivic_pessoa_id = p.id').where('lower(p.nome_pessoa) like ? and p.sivic_igreja_id ='+ current_user.sivic_pessoa.sivic_igreja_id.to_s, \"%#{params[:nome_pessoa]}%\").paginate(:page => params[:page], :per_page => 10)\r\n end\r\n elsif\r\n if current_user.role == 'LIDER_DE_CELULAS'\r\n \r\n @sivic_relatorioscelulas = SivicRelatorioscelula.joins('INNER JOIN sivic_celulas cel on sivic_celula_id = cel.id').where('cel.sivic_pessoa_id' => current_user.sivic_pessoa.id).paginate(:page => params[:page], :per_page => 10)\r\n else \r\n @sivic_relatorioscelulas = SivicRelatorioscelula.joins(:sivic_celula).where(sivic_celulas: {sivic_igreja_id: current_user.sivic_pessoa.sivic_igreja_id}).paginate(:page => params[:page], :per_page => 10)\r\n end\r\n end\r\n end", "def show\n\n Dir.chdir \"#{Rails.root.join('public/')}\"\n\n #iteración de todos los usuarios en el arreglo @usuarios\n # creamos una variable que va a crear en string el nombre de la foto que se va a guardar\n # ej. user_image_23.png para el usuario con id 23\n saveName = \"user_image_#{@usuario.id}.png\"\n\n # abrimos el filestream para escritura con el nombre de la variable saveName\n fotoUsuario = File.open(saveName, 'wb') do |f|\n\n # el begin y rescue es el clásico try/catch\n begin\n # intentamos convertir los bytes que se reciben de la base de datos en encoding BASE64\n # y lo escribimos en el filestream usando decode64. Se guardaría en /public/user_image_23.png\n f.write(Base64.urlsafe_decode64(@usuario.foto))\n\n # cambiamos el contenido de la propiedad foto para que no sea el arreglo de bytes sino el\n # nombre con el que quedó guardado en /public/\n\n if @usuario.foto != \"\"\n\n # cambiamos el contenido de la propiedad foto para que no sea el arreglo de bytes sino el\n # nombre con el que quedó guardado en /public/\n @usuario.foto=saveName\n\n else\n @usuario.foto=\"default_user_image.png\"\n end\n\n # cerramos el stream\n f.close\n # si escribir la foto falla por algún motivo...\n rescue => ex\n # ignoramos lo que se haya jalado de la base de datos y ponemos de nombre una imagen genérica\n # esta imagen debe estar guardada eb /public/\n @usuario.foto=\"default_user_image.png\"\n end\n end\n end", "def camino_retorno(menuname, pmenu_item, ptipo)\n sql = \" \"\n resstr = \" \"\n mdescr = \" \"\n if ptipo == 'I' #si recibe el menu_item\n sql = \" AND opc_item = '#{pmenu_item}'\"\n else #si recibe menu_controller \n sql = \" AND opc_controller = '#{pmenu_item}'\"\n end\n menutblcaminos = Vgemenuroute.where(\"menu_cod = '#{menuname}' \"+sql)\n menutblcaminos.each do |camino|\n mcontroller = camino.menu_controller\n\t vdescr = I18n.t('menu.'+mcontroller)\n\t if vdescr.empty? \n\t mdescr = camino.menu_descr\n\t else \n\t if vdescr['missing'] == 'missing' \n\t mdescr = camino.menu_descr\n\t\telse\n\t\t\tmdescr = vdescr\n\t\tend\n\t end\n case camino.item_type \n\t when 'R'\n\t resstr += link_to(mdescr, root_path)\n\t when 'N'\n\t\t vurl = url_for({:controller => 'home', :action => 'index', :itemnode=>camino.menu_item})\n\t\t resstr += \" >> \"+link_to(mdescr, vurl, :class => 'quick')\n\t else\n resstr += \" >> \"+link_to(mdescr, url_for( {:controller => camino.menu_controller }))\t \n\t end\n end\n return resstr\n end", "def index\n if logged_in? && (current_user.cliente.estoque_mp == \"Sim\") && (current_user.nivel_usuario == \"admin\")\n @receita = Receitum.where(cliente_id: current_user.cliente_id)\n else\n redirect_to root_path\n flash[:danger] = \"Você precisa estar logado para realizar essa ação.\"\n end\n end", "def clinicas_todas(id)\n Usuario.find_by_datos_id(id, :conditions => \"datos_type = 'Clinica'\")\n end", "def mostrar_dados\n puts \"Partido: #{@nome} - Votos: #{@votos}\" \n end", "def livro_params\n params.require(:livro).permit(:nome, :autor, :editora, :assunto, :descricao, :thumbnail)\n end", "def show\n @area = Area.find_by(nombre: 'Fisioterapia')\n if params[:name] == nil\n @medicos = User.where(area: @area).paginate(:page => params[:page], :per_page => 5)\n else\n @medicos = User.where(area: @area)\n .and(\n User.or(name: /.*#{params[:name].downcase}.*/i).or(last_name: /.*#{params[:name].downcase}.*/i).selector\n ).paginate(:page => params[:page], :per_page => 5)\n end\n end", "def obtener\narray = Tarea.all\n \n @@tareas = Array.new\n array.each{|x| @@tareas.push(x) if /#{@@usuario}/.match(x[\"title\"])}\n\n @@tareas.each do |x|\nstring = x[\"title\"].split\n string.pop\nx[\"title\"] = string.join(\" \")\n\n\n end\n #esto es para que no quede una tarea vacia al principio, la cual es la correspondiente login\n@@tareas.shift\n @@tareas\n\nend", "def save_logradouro(c, b, cep, n, i, f, l) \n log = Logradouro.where(cep: cep, cidade: c, bairro: b, inicio: i, fim: f, lado: l).first\n if log == nil\n puts \"Criando novo logradouro...\"\n log = Logradouro.create!(cep: cep, cidade: c, bairro: b, nome: n, inicio: i, fim: f, lado: l)\n puts log\n else\n puts \">>>> Logradouro Já cadastrado #{cep}\"\n end \n log\n end", "def empresa_params\n \n params.require(:empresa).permit(:logo, :descricao, :mapa, :login, :senha)\n \n end", "def show\n Dir.chdir \"#{Rails.root.join('public/')}\"\n\n #iteración de todos los usuarios en el arreglo @usuarios\n # creamos una variable que va a crear en string el nombre de la foto que se va a guardar\n # ej. user_image_23.png para el usuario con id 23\n saveName = \"business_image_#{@negocio.id}.png\"\n\n # abrimos el filestream para escritura con el nombre de la variable saveName\n fotoUsuario = File.open(saveName, 'wb') do |f|\n\n # el begin y rescue es el clásico try/catch\n begin\n # intentamos convertir los bytes que se reciben de la base de datos en encoding BASE64\n # y lo escribimos en el filestream usando decode64. Se guardaría en /public/user_image_23.png\n f.write(Base64.urlsafe_decode64(@negocio.imagen))\n\n # cambiamos el contenido de la propiedad foto para que no sea el arreglo de bytes sino el\n # nombre con el que quedó guardado en /public/\n @negocio.imagen=saveName\n\n # cerramos el stream\n f.close\n # si escribir la foto falla por algún motivo...\n rescue => ex\n # ignoramos lo que se haya jalado de la base de datos y ponemos de nombre una imagen genérica\n # esta imagen debe estar guardada eb /public/\n @negocio.imagen=\"default_user_image.png\"\n end\n end\n end", "def set_logueo\n @logueo = Logueo.find(params[:id])\n end", "def rotina_params\n params.require(:rotina).permit(:descricao, :data_vencimento, :data_pagamento, :categoria_id, :tipo_lancamento_id, :user_id, :valor, :data_inicial, :data_final, :ativo, :sub_categoria_id)\n end", "def index\n\n\n @cont = 0 # Variable para acceso al arreglo de @usuarios en la vista\n @clinicas = Clinica.all\n @usuarios = Usuario.find(:all, :conditions => \"datos_type = 'Clinica'\")\n\n\n end", "def index\n @User = current_user\n if params[:monitore_id].present?\n @monitoria = Monitorium.where(monitor_id: params[:monitore_id]).order(:data)\n else\n if params[:disciplina_id].present?\n lId_parametro = params.require(:disciplina_id)\n @monitoria = Monitorium.where(disciplina: lId_parametro).order(:data)\n else\n @monitoria = Monitorium.order(:data)\n end\n end\n end", "def lui_params\n params.require(:lui).permit(:name, :apellido, :edad, :email, :contrasena)\n end", "def index\n authorize! :ver, UsuarioPrestamo.new\n @usuarios_prestamos = UsuarioPrestamo.all\n @alumnos = UsuarioPrestamo.where(:categoria => UsuarioPrestamo.categorias[:alumno])\n @profesores = UsuarioPrestamo.where(:categoria => UsuarioPrestamo.categorias[:profesor])\n @personal = UsuarioPrestamo.where(:categoria => UsuarioPrestamo.categorias[:personal])\n end", "def perfil_params\n params.require(:perfil).permit( :usuario_id, :imagemPerfil, :descricao, :imagemCapa, :datacap, :datagcb, :corda ) # List here whitelisted params\n end", "def show\n @usuario = User.find(@vendedor.user_id)\n\n #iteración de todos los usuarios en el arreglo @usuarios\n # creamos una variable que va a crear en string el nombre de la foto que se va a guardar\n # ej. user_image_23.png para el usuario con id 23\n saveName = \"user_image_#{@usuario.id}.png\"\n\n # abrimos el filestream para escritura con el nombre de la variable saveName\n fotoUsuario = File.open(saveName, 'wb') do |f|\n\n # el begin y rescue es el clásico try/catch\n begin\n # intentamos convertir los bytes que se reciben de la base de datos en encoding BASE64\n # y lo escribimos en el filestream usando decode64. Se guardaría en /public/user_image_23.png\n f.write(Base64.urlsafe_decode64(@usuario.foto))\n\n # cambiamos el contenido de la propiedad foto para que no sea el arreglo de bytes sino el\n # nombre con el que quedó guardado en /public/\n\n if @promocion.poster != \"\"\n\n # cambiamos el contenido de la propiedad foto para que no sea el arreglo de bytes sino el\n # nombre con el que quedó guardado en /public/\n @usuario.foto=saveName\n\n else\n @usuario.foto=\"default_user_image.png\"\n end\n\n # cerramos el stream\n f.close\n # si escribir la foto falla por algún motivo...\n rescue => ex\n # ignoramos lo que se haya jalado de la base de datos y ponemos de nombre una imagen genérica\n # esta imagen debe estar guardada eb /public/\n @usuario.foto=\"default_user_image.png\"\n end\n end\n\n end", "def save_transporte\n @logger = File.new(\"log/upload.log\",\"wb\")\n @logger.puts params\n start_anlage_spalten_name = session[:spalte_start]\n ziel_anlage_spalten_name = session[:spalte_ziel]\n stoff_spalten_name = session[:spalte_stoff]\n datum_spalten_name = params[:datum] \n # Weitere optionale Spaltennamen\n anzahl_spalten_name = params[:anzahl] == \"Nicht vorhanden\" ? nil : params[:anzahl] \n menge_brutto_spalten_name = params[:menge_brutto] == \"Nicht vorhanden\" ? nil : params[:menge_brutto] \n menge_brutto_umrechnungsfaktor = params[:menge_brutto_umrechnungsfaktor].gsub(\",\",\".\").to_f\n menge_netto_spalten_name = params[:menge_netto] == \"Nicht vorhanden\" ? nil : params[:menge_netto] \n menge_netto_umrechnungsfaktor = params[:menge_netto_umrechnungsfaktor].gsub(\",\",\".\").to_f\n behaelter_spalten_name = params[:behaelter] == \"Nicht vorhanden\" ? nil : params[:behaelter] \n firmen_spalten_name = params[:firmen] == \"Nicht vorhanden\" ? nil : params[:firmen] \n firma_trennzeichen = params[:firma_trennzeichen] \n # Genehmigungen werden nur eingelesen, wenn eine Genehmigungsnummer existiert.\n genehmigungen = params[:lfd_nr] == \"Nicht vorhanden\" ? nil : params[:lfd_nr] \n genehmigungs_params = genehmigungen.nil? ? nil : read_genehmigungs_params(params)\n umschlag_params = (params[:umschlag_ort] == \"Nicht vorhanden\") ? nil : read_umschlag_params(params)\n @logger.puts \"umschlag: #{umschlag_params}\"\n quelle = params[:quelle]\n \n @transporte_liste = {}\n @transporte_anzahl = 0\n @anzahl_verschmolzene = 0\n\n # Datei einlesen\n file_path = session[:file_path]\n csv_text = File.read(file_path) \n csv = CSV.parse(csv_text, :headers => true, :col_sep => session[:csv_trennzeichen])\n # TODO: Fehlerbehandlung\n row_count = 2 # Start bei Zeile 2 wegen Überschriften\n csv.each do |row|\n row_as_hash = row.to_hash\n if row_as_hash[start_anlage_spalten_name] && row_as_hash[ziel_anlage_spalten_name]\n start_anlage = AnlagenSynonym.find_anlage_to_synonym(row_as_hash[start_anlage_spalten_name])\n ziel_anlage = AnlagenSynonym.find_anlage_to_synonym(row_as_hash[ziel_anlage_spalten_name])\n # Nehmen mal Format dd.mm.yyyy an.\n #datum_werte = row_as_hash[datum_spalten_name].split(\".\") \n @logger.puts \"Datum: #{row_as_hash[datum_spalten_name]}\"\n begin\n datum = Date.strptime(row_as_hash[datum_spalten_name],\"%d.%m.%y\")\n @logger.puts \"converted datum: #{datum}\"\n transport_params = { :start_anlage => start_anlage, :ziel_anlage => ziel_anlage, :datum => datum }\n #@logger.puts \"row #{row_as_hash}\"\n transport_params[:stoff] = StoffSynonym.find_stoff_to_synonym(row_as_hash[stoff_spalten_name]) \n \n # Optionale Parameter\n transport_params[:anzahl] = row_as_hash[anzahl_spalten_name] if anzahl_spalten_name\n transport_params[:menge_netto] = menge_netto_spalten_name.nil? ? nil : row_as_hash[menge_netto_spalten_name].to_f *\n menge_netto_umrechnungsfaktor\n transport_params[:menge_brutto] = menge_brutto_spalten_name.nil? ? nil : row_as_hash[menge_brutto_spalten_name].to_f *\n menge_brutto_umrechnungsfaktor\n transport_params[:behaelter] = row_as_hash[behaelter_spalten_name] if behaelter_spalten_name\n transport_params[:quelle] = quelle\n # TODO: Genehmigung erstellen!\n #genehmigung = create_or_find_genehmigung(row_as_hash, genehmigungs_params)\n #transport_params[:transportgenehmigung] = genehmigung if genehmigung\n\n transport = Transport.new(transport_params)\n @logger.puts \"Transport eingelesen #{transport.attributes}\"\n if transport.save \n @transporte_anzahl += 1\n @logger.puts \"Transport gespeichert.\"\n # Transportabschnitte zu Transportfirmen erstellen, wenn vorhanden\n if firmen_spalten_name\n create_transportabschnitte_to_firmen(row_as_hash[firmen_spalten_name], firma_trennzeichen, transport)\n end\n # Umschlaege erstellen \n unless umschlag_params.nil?\n create_umschlag_data(row_as_hash, umschlag_params, transport)\n end\n else \n @logger.puts \"Transport nicht gespeichert #{transport.errors.first}.\"\n # Je nach Einstellung Transporte verschmelzen\n if params[:einstellung_vorhandene_transporte] == \"J\"\n @logger.puts \"Verschmelze_Transporte\"\n old_transport = join_to_old_transport(row_count, transport) \n if umschlag_params && transport.umschlaege.empty?\n create_umschlag_data(row_as_hash, umschlag_params, old_transport)\n end\n else \n @transporte_liste[row_count] = transport \n end\n end\n rescue => e\n @logger.puts \"Probleme beim Einlesen von Transport in Zeile #{row_count} von #{start_anlage} nach #{ziel_anlage}\"\n @logger.puts e\n end\n row_count += 1\n else \n @logger.puts \"Probleme beim Einlesen von Transport in Zeile #{row_count} - Start- oder Zielanlage fehlt.\"\n row_count += 1\n end\n end \n @logger.puts \"Fertig\"\n @logger.close\n # session.clear if @transporte_liste.empty?\n render \"fertig\"\n end", "def show\n @producto = Producto.find(params[:id])\n @cliente = Usuario.find(@producto.usuario_id)\n flash.keep\n @documentos = get_documentos(@producto.id, current_usuario.admin > 0 )\n @presentaciones = Presentacion.where(:productos_id => @producto.id)\n @importadores_todos = Importador.all\n\n logp = Logproducto.new(:usuario_id => current_usuario.id, \n :producto_id => @producto.id, \n :tipo => \"Visualizado\", \n :nusuario => current_usuario.nombre, \n :nproducto => @producto.nombre)\n\n if logp.save\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @producto }\n end\n else\n format.json { render json: @producto, notice:\"La información no fue almacenada en el log.\" }\n end\n end", "def livro_params\n params.require(:livro).permit(:autor, :titulo, :ano_publicacao, :curso_id, :semestre_id, :materia_id, :search)\n end", "def filtro_particular(conscaso, params_filtro)\n return conscaso\n end", "def read_anlagen\n # Logger ist für Debugging-Zwecke im log-Verzeichnis\n @logger = File.new(Rails.root.join(\"log\",\"upload.log\"), \"w\")\n file_path = params[:file_path]\n session[:file_path] = file_path\n @spalte_nr1 = params[:start]\n @spalte_nr2 = params[:ziel]\n @spalte_stoff = params[:stoff]\n session[:spalte_start] = @spalte_nr1\n session[:spalte_ziel] = @spalte_nr2\n session[:spalte_stoff] = @spalte_stoff\n @logger.puts \"Anlagen sind in #{@spalte_nr1} und #{@spalte_nr2}\"\n # Erstelle @anlagen_liste als Liste von Namen, die in den Spalten auftauchen.\n @anlagen_liste = []\n @stoff_liste = []\n csv_text = File.read(file_path) \n csv = CSV.parse(csv_text, :headers => true, :col_sep => session[:csv_trennzeichen])\n csv.each do |row|\n row_as_hash = row.to_hash\n @anlagen_liste << row_as_hash[@spalte_nr1]\n @anlagen_liste << row_as_hash[@spalte_nr2]\n @stoff_liste << row_as_hash[@spalte_stoff]\n @logger.puts \"Anlage Start #{row_as_hash[@spalte_nr1]}\"\n end \n # Duplikate rauswerfen\n @anlagen_liste.uniq!\n @stoff_liste.uniq!\n @logger.puts \"Stoffliste #{@stoff_liste}\"\n # Für jeden Anlagennamen ein Synonym erstellen und speichern.\n create_anlagen_synonyme(@anlagen_liste) \n create_stoff_synonyme(@stoff_liste)\n \n @all_anlagen = Anlage.get_anlagen_for_selection_field\n @logger.puts \"all Anlagen #{@all_anlagen}\"\n # Für das neue-Anlage-Formular\n @anlage = Anlage.new\n @redirect_params = upload_anlagen_zuordnung_path\n # Zu jedem dieser Synonyme muss manuell eine Anlage zugeordnet werden,\n # alternativ eine neue angelegt werden, die dann mit dem Synonym verbunden wird. \n # Hierzu wird weiter geleitet, da die Zuordnung iterativ passiert\n # zur Vermeidung von Code-Doppelungen.\n @logger.close\n redirect_to upload_anlagen_zuordnung_path\n end", "def camino_params\n params.require(:camino).permit(:unidade_id, :alternativo, :correlativo)\n end", "def oficio_params\n params.require(:oficio).permit(:tema, :titulo, :resumo, :numero, :data_criacao, :data_envio, :data_recebimento, :destinatario, :instituicao_destinatario, :remetente, :instituicao_remetente)\n end", "def show\n @area = Area.find_by(nombre: 'Emergencia')\n if params[:name] == nil\n @medicos = User.where(area: @area).paginate(:page => params[:page], :per_page => 5)\n else\n @medicos = User.where(area: @area)\n .and(\n User.or(name: /.*#{params[:name].downcase}.*/i).or(last_name: /.*#{params[:name].downcase}.*/i).selector\n ).paginate(:page => params[:page], :per_page => 5)\n end\n end", "def logistica\n @cegonha = Cegonha.find(params[:id])\n @cars = @cegonha.cars.select {|car| car.cidade_destino == @cegonha.cidade_id and car.estado_destino == @cegonha.estado_id }\n\n #unless @cars.nil?\n # @cars.each do |car|\n # car.historicos.last.update_attributes(:data_saida => Time.now, :localizacao_saida => car.cegonha.localizacao)\n # car.ativo = 2\n # car.cegonha = nil\n # car.save\n # end\n #end\n end", "def filiere_params\n params.require(:filiere).permit(:code, :libelle, :systeme_id, :deleted_at)\n end", "def index\n $asignatura = Asignatura.find(params['id'])\n \t@perfil_egresados= PerfilEgresado.where([\"asignatura_id = ?\", params['id']])\n end", "def list\n\n #@orden_despacho = ViewListOrdenDespacho.find(:all)\n identificador_estado=Oficina.find(Usuario.find(session[:id]).oficina_id).ciudad.estado_id\nidentificador_oficina=Usuario.find(session[:id]).oficina_id\n\n\n #anterior @condition =\"solicitud_id > 0 and oficina_id = #{identificador_oficina}\"\n @condition =\"solicitud_id > 0 \"\n\n params['sort'] = \"numero\" unless params['sort']\n\n\n # busqueda por estado\n unless params[:estado_id].nil?\n unless params[:estado_id][0].to_s=='' \n @condition << \" AND estado_id = #{params[:estado_id][0].to_i}\"\n @form_search_expression << \"#{I18n.t('Sistema.Body.Controladores.SearchComun.estado_igual')} '#{Estado.find(params[:estado_id][0]).nombre}'\"\n logger.info \"XXXXXXXXXXXX==============>>>>>>>\" << @form_search_expression.inspect\n end\n end\n\n\n\n # busqueda por numero de tramite\n unless params[:numero].to_s==\"\"\n @condition << \" AND numero = #{params[:numero].to_i}\"\n @form_search_expression << \"#{I18n.t('Sistema.Body.Controladores.SearchComun.numero_tramite')} '#{params[:numero]}'\"\n logger.info \"XXXXXXXXXXXX==============>>>>>>>\" << @form_search_expression.inspect\n end\n\n # busqueda por cedula\n unless params[:identificacion].to_s==\"\" \n @condition << \" AND (cedula_rif) = '#{params[:tipo].to_s}#{params[:identificacion].to_s}' \"\n @form_search_expression << \"#{I18n.t('Sistema.Body.Controladores.SearchComun.rif_cedula_contenga')} '#{params[:tipo].to_s}#{params[:identificacion]}'\"\n end\n\n # busqueda por nombre o apellido\n \n unless params[:nombre].to_s==\"\" \n @condition << \" AND UPPER(nombre) LIKE UPPER('%#{params[:nombre].strip}%')\"\n @form_search_expression << \"#{I18n.t('Sistema.Body.Controladores.SearchComun.nombre_apellido')} '#{params[:nombre]}'\"\n end\n\n # busqueda por estatus orden de despacho nuevo filtro al 24/05/2013\n unless params[:estatus_orden_id].nil?\n unless params[:estatus_orden_id][0].to_s=='' \n estatus_id = params[:estatus_orden_id][0].to_s\n orden = OrdenDespacho.find_all_by_estatus_id(estatus_id)\n estatus_nombre=Estatus.find(estatus_id).nombre \n \n unless orden.empty?\n condi=\"(\"\n orden.each{ |ordene|\n condi+=ordene.id.to_s << \",\"\n }\n condi=condi[0,condi.length-1]\n condi+=\")\" \n @condition << \" and (orden_despacho_id in #{condi})\"\n else\n @condition << \" and (orden_despacho_id = 0)\"\n end\n \n @form_search_expression << \"#{I18n.t('Sistema.Body.Controladores.SearchComun.estatus_od_igual')} '#{estatus_nombre}'\"\n end\n end\n\n # busqueda por casa proveedora\n unless params[:casa_proveedora_id].nil?\n unless params[:casa_proveedora_id][0].to_s=='' \n casa=CasaProveedora.find(params[:casa_proveedora_id][0]) \n unless (OrdenDespachoDetalle.find_by_sql(\"select orden_despacho_id from orden_despacho_detalle where id in (select orden_despacho_detalle_id from factura_orden_despacho where casa_proveedora_id =#{params[:casa_proveedora_id][0]})\")).empty?\n @condition << \" AND orden_despacho_id in (select orden_despacho_id from orden_despacho_detalle where id in (select orden_despacho_detalle_id from factura_orden_despacho where casa_proveedora_id =#{params[:casa_proveedora_id][0]}))\"\n @form_search_expression << \"#{I18n.t('Sistema.Body.Controladores.SearchComun.casa_proveedora_igual')} '#{casa.nombre}'\"\n end\n end\n end\n\n \n if (params[:fecha_desde_f].to_s!='' && params[:fecha_hasta_f].to_s!='') \n\n fecha =format_fecha_conversion(params[:fecha_desde_f])\n fecha_hasta =format_fecha_conversion(params[:fecha_hasta_f]) \n \n @condition << \"and (fecha_orden_despacho >= '#{fecha}'\"\n @condition << \" and fecha_orden_despacho <= '#{fecha_hasta}')\"\n @form_search_expression << \"#{I18n.t('Sistema.Body.Controladores.SearchComun.fecha_registro_desde')} '#{params[:fecha_desde_f].to_s}'\"\n @form_search_expression << \"#{I18n.t('Sistema.Body.Controladores.SearchComun.fecha_registro_hasta')} '#{params[:fecha_hasta_f].to_s}'\" \n \n \n # casos especiales \n elsif (params[:fecha_desde_f].to_s=='' && params[:fecha_hasta_f].to_s!='')\n \n fecha_hasta =format_fecha_conversion(params[:fecha_hasta_f]) \n @condition << \" and fecha_orden_despacho <= '#{fecha_hasta}'\"\n @form_search_expression << \"#{I18n.t('Sistema.Body.Controladores.SearchComun.fecha_registro_hasta')} '#{params[:fecha_hasta_f].to_s}'\" \n \n \n \n elsif (params[:fecha_desde_f].to_s!='' && params[:fecha_hasta_f].to_s=='') \n \n fecha =format_fecha_conversion(params[:fecha_desde_f])\n @condition << \"and fecha_orden_despacho >= '#{fecha}'\" \n @form_search_expression << \"#{I18n.t('Sistema.Body.Controladores.SearchComun.fecha_registro_desde')} '#{params[:fecha_desde_f].to_s}' #{I18n.t('Sistema.Body.Controladores.SearchComun.en_adelante')}\" \n \n end \n \n @list = ViewListOrdenDespacho.search(@condition, params[:page], params['sort']) \n @total=@list.count\n\n\n form_list\n end", "def reuniao_params\n params.require(:reuniao).permit(:titulo, :data, :horaInicio, :horaFim, :status, :local_id, :pautum_id, :atum_id, :category_id)\n end", "def index\n @usuarios = Usuario.all\n #@habilidades = Usuario.first.curso_dictado.first.curso.profile_image\n end", "def Index\n \t @datos_salida = []\n \t # valor_solicitado = 400000\n \t # @billete = ContarBilletes(valor_solicitado)\n # @devuelve = ValorRetirado(@billete,valor_solicitado)\n if !params['total_retito'].nil? \n \t @datos_salida = tratar_datos(params['id_cuenta'], params['total_retito'])\n \t\n end\n @informesDiarios = User.joins(:clientes=> :atms).select(:name, :dni,'atms.fecha_retiro , atms.valor_retiro').where(id: current_user.id)\n end", "def index\n add_breadcrumb \"Meus Comentários\", comentars_path, :title => \"Voltar para a página principal\"\n user = Digest::SHA2.new << current_user.username+ENV['CHAVE']\n @usuarios = Usuario.where(\"username=:username\",{username:user.to_s}).all\n user_id=0\n @usuarios.each do |usuario| \n user_id = usuario.id \n end\n @comentars = Comentar.where(\"user_id =:user_id\",{user_id:user_id}).all\n .paginate(:page => params[:page], :per_page => 7)\n end", "def oficio_params\n params.require(:oficio).permit(:institucion, :fecha_de_emision, :descripcion)\n end", "def index\n @fiados = current_user.fiados\n end", "def veiculo_params\n params.require(:veiculo).permit(:placa, :chassi, :renavan, :ano, :modelo, :usuario_id, :cor)\n end", "def print_log(logtype_id, search, from, to)\n\n message_res = []\n\n unless search == nil\n message_res = Log.select(:message).where(\"message like ?\", \"%#{search}%\")\n end\n #Filtrerer etter kategori, og fra-til dato\n unless logtype_id == nil\n unless from == nil || to == nil\n logs = Log.includes(:user, :logtype).where(\"logtype_id = ? and Date(created_at) >= ? AND Date(created_at) <= ?\" ,logtype_id, from, to).order('created_at desc').limit(100)\n else\n logs = Log.includes(:user, :logtype).where(logtype_id: logtype_id).order('created_at desc').limit(100)\n end\n else\n unless from == nil || to == nil\n logs = Log.includes(:user, :logtype).where(\"Date(created_at) >= ? AND Date(created_at) <= ?\" ,from, to).order('created_at desc').limit(100)\n else\n logs = Log.includes(:user, :logtype).order('created_at desc').limit(100)\n end\n end\n\n #mapper opp kun logbeskjedene fra message_res arrayet.\n message = message_res.map {|log| log.message}\n message_filtered_logs = logs.find_all_by_message(message)\n\n unless search == nil\n logs = message_filtered_logs\n end\n\n printable_logs = []\n\n unless logs == nil\n printable_logs = logs\n end\n return printable_logs\n end", "def index\n @usuario = Usuario.new\n $error_login = false;\n #Verifica si se ha enviado el formulario.\n if request.post?\n \n @user = Usuario.find_by_user(params[:nombre_usuario])\n #Verifica si el nombre de usuario y la contraseña son correctos.\n if login(params[:nombre_usuario], params[:contrasena])\n #Los datos son correctos así que redirecciona a la página de bienvenida.\n redirect_to :controller => \"principal\", :action => \"principal\";\n \n else\n #Los datos son incorrectos así que setea la variable @error_login a true para mostrar el error por pantalla.\n $error_login = true;\n redirect_to usuarios_index_path\n end\n end\n end", "def show\n @objetivos = Objetivo.select(\"id\", \"nombre\",\"descripcion\").where(:mision_id => params[:id])\n @estrellas = Estrella.select(\"idobjetivo_id\", \"idusuario_id\", \"est1\", \"est2\", \"est3\").where(idusuario_id: current_usuario.id)\n #Para optimizar se deberá agregar un campo de idmision y requerirlo en la misma consulta de la línea anterior, para disminuir el tamaño del array\n end", "def aluguel_params\n params.require(:aluguel).permit(:veiculo_modelo, :usuario_nome, :dataInicio, :datafim)\n end", "def empresa_params\n params.require(:empresa).permit(:name, :ruc, :direccion, :telefono, :moneda, :igv, :about_1, :about_2, :logo)\n end", "def conf_universidad\n reset_session\n @valin = params['in']\n @alert = params['alert']\n valor = @valin.split(\"_\")\n cod = desencriptar(valor[0].to_i)\n id = desencriptar(valor[1].to_i)\n data = Usuario.find_by(cod_recovery: cod, id: id)\n if data.blank?\n redirect_to({:action=>\"index\", :controller=>\"perfil\"})\n else\n if data['validado'] == SIN_VALIDAR\n @nombre = data['nombre']\n session[:id] = id\n session[:email] = data['correo']\n render layout: \"login\"\n else\n redirect_to({:action => 'index', :controller=>\"login\"})\n end\n end\n end", "def index\n\n if usuario_logado && user.cadastro_id == 1\n @ciclos = Ciclo.all.order(:numerociclo)\n else\n redirect_to root_path\n end\n\n end", "def lancamento_params\n params.require(:lancamento).permit(:fornecedor_id, :fonte_id, :centro_id, :orcamento_id, :data, :descricao, :valor, :id, :tipo, :parcela, :number).merge(user_id: current_user.id)\n end", "def cofre_params\n params.require(:cofre).permit(:data, :dineiro, :moeda, :chqvista, :dolares, :euros)\n end", "def foto_params\n params.require(:foto).permit(:descripcion, :src, :id, :es_portada)\n end", "def home\n @sidebar = false\n @footer = false\n @carga_diarium = CargaDiarium.new\n @tipos_objetivos = TipoObjetivo.where(tipo: 'KPI')\n if current_user.has_role? :vendedor and !(current_user.has_role? :punto_venta) \n @vendedor = current_user.persona.vendedors.first\n else\n if (current_user.has_role? :punto_venta) && (!params[:vendedor].nil?) && (params[:vendedor] != \"Mis datos como vendedor\" )\n @vendedor = Vendedor.find_by(numero: params[:vendedor], punto_venta_id: current_user.punto_venta_id)\n else\n @vendedor = current_user.persona.vendedors.first\n end\n end\n end", "def offre_params\n params.require(:offre).permit(:user_id, :url, :language, :contrat, :salaire, :localisation)\n end", "def foto_params\n params.require(:foto).permit(:legenda, :produto_id, :foto)\n end", "def aviso_params\n params.require(:aviso).permit(:usuario_id, :texto)\n end", "def index\n if user_signed_in? \n @mentor = Mentor.where(user_id: current_user.id)\n \n end\n if params[:matiere].blank?\n @mentors = Mentor.all.order(\"created_at DESC\")\n else\n @matieres = Matiere.where(name: params[:matiere])\n @mentor_id = @matieres.select(:mentor_id)\n @mentors = Mentor.where(id: @mentor_id).order(\"created_at DESC\")\n end\n\n\n end", "def show\n @ficha = (params[:ficha].present? && params[:ficha] == '1')\n\n cuantos = @comentario.descendants.count\n categoriaContenido = @comentario.categorias_contenido_id\n\n if cuantos > 0\n resp = @comentario.descendants.map{ |c|\n c.completa_info(@comentario.usuario_id)\n c\n }\n\n @comentarios = {estatus:1, cuantos: cuantos, resp: resp}\n\n else\n @comentarios = {estatus:1, cuantos: cuantos}\n end\n\n # Para saber el id del ultimo comentario, antes de sobreescribir a @comentario\n ultimo_comentario = @comentario.subtree.order('ancestry ASC').map(&:id).reverse.first\n\n # Especie\n especie_id = @comentario.especie_id\n\n # Crea el nuevo comentario con las clases de la gema ancestry\n @comentario = Comentario.children_of(ultimo_comentario).new\n\n # El ID del administrador\n @comentario.usuario_id = current_usuario.id unless @ficha\n\n # Estatus 6 quiere decir que es parte del historial de un comentario\n @comentario.estatus = Comentario::RESPUESTA\n\n # Categoria comentario ID\n @comentario.categorias_contenido_id = categoriaContenido\n\n # Para no poner la caseta de verificacion\n @comentario.con_verificacion = false\n\n # Proviene de un administrador\n @comentario.es_admin = true\n\n # Asigna la especie\n @comentario.especie_id = especie_id\n end", "def list_compros\n \n @company = Company.find(params[:company_id])\n @pagetitle = \"#{@company.name} - Viaticos\"\n @filters_display = \"block\"\n \n \n if(params[:search] and params[:search] != \"\") \n \n @compros = Compro.where([\"company_id = ? and (detalle LIKE ? OR code LIKE ?)\", @company.id,\"%\" + params[:search] + \"%\", \"%\" + params[:search] + \"%\"]).order('code').paginate(:page => params[:page]) \n else\n @compros = Compro.where(company_id: @company.id).order('fecha DESC').paginate(:page => params[:page])\n end\n \n end", "def index\n if current_user != NIL\n if current_user.rol == \"bioquimica\"\n @analise = Analisis.all\n @values = Valor.all\n else \n redirect_to '/'\n end\n else\n redirect_to '/'\n end\n end", "def grabar_concesionario\n # puts 'AQUI'\n @concesionario = Concesionario_vehiculos.new\n @usuario = Usuario.new\n @rif=params[:rif]\n @nombre=params[:nombre]\n @correo=params[:correo]\n @telefono=params[:telefono]\n @ciudad=params[:ciudad]\n @direccion=params[:direccion]\n @marca=params[:marca]\n #------\n @nombre_usuario=params[:nombre_usuario]\n @contrasena=params[:contrasena]\n # puts ''+@nombre_usuario+''\n @usuario.grabar_usuario_concesionario(@nombre_usuario, @contrasena);\n # puts '+++++++++++++++++++++++++++++++++++++++++++++++++++++++metio usuario'\n @concesionario.grabar_concesionario(@rif,@nombre,@correo,@telefono,@ciudad,@direccion,@marca,@nombre_usuario)\n render :text => $tirajson\n end", "def index \n if params[:datai].present? && params[:dataf].present?\n verifica_dados(params[:pessoa], params[:esq], params[:mov], params[:sel], params[:busca], \n params[:datai], params[:dataf], params[:horai], params[:horaf], params[:cracha])\n else\n @postgresql_view_people = Hash.new\n flash[:alert] = 'Os campos data inicial e data final não podem ficar em brancos.' \n end \n end", "def show\n if params == [:usuario_id,:tweet_id,:texto_id,:id]\n @usuario = Usuario.find(params[:usuario_id])\n @tweet = Tweet.find(params[:tweet_id])\n @textos = Texto.find(params[:texto_id])\n end\n if params == [:palabra_bolsa_id,:id]\n @palabra_bolsa = PalabraBolsa.find(params[:palabra_bolsa_id])\n end\n @texto_palabras = TextoPalabra.find(params[:id])\n end", "def index\n @usuario = User.where(:id => current_user.id).pluck(:id).first\n @registros = Registro.where(:grupo_id => params[:clave]).paginate(:page => params[:page]).order('id DESC')\n @name = Grupo.where(:clave => params[:clave]).pluck(:nombre).first\n @grupos = Grupo.all\n @grupo = Grupo.new\n end", "def bienvenida\n if session[:rol].class.to_s.eql?(\"Docente\")\n @titulo_pagina= \"Materias\"\n elsif session[:rol].class.to_s.eql?(\"Administrador\")\n @titulo_pagina= \"Administrador\" \n elsif session[:rol].class.to_s.eql?(\"Estudiante\")\n @titulo_pagina= \"Materias\" \n end\n \n end", "def sessao_params\n params.require(:sessao).permit(:dia, :horario, :status, :cinema_id, :filme_id)\n end", "def index\n logger.debug \"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\"\n\n if params[:os_id]!=nil\n logger.debug \"ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ\"\n\n @os_tarefas = OsTarefa.where(\"id_os_pagamento = ?\",params[:os_id])\n else\n @os_tarefas = OsTarefa.all\n end\n end", "def index\n if params.key? :usuario\n if params[:usuario].key? :nome\n @usuarios = Usuario.where(\"lower(nome) like '%#{params[:usuario][:nome].strip.downcase}%'\").order(created_at: :desc).page(params[:page])\n elsif params[:usuario].key? :cpf\n @usuarios = Usuario.where(\"cpf like '%#{params[:usuario][:cpf].strip}%'\").order(created_at: :desc).page(params[:page])\n elsif params[:usuario].key? :email\n @usuarios = Usuario.where(\"lower(email) like '%#{params[:usuario][:email].strip.downcase}%'\").order(created_at: :desc).page(params[:page])\n end\n else\n @usuarios = Usuario.all.order(created_at: :desc).page(params[:page])\n end\n end", "def imagen_params\n params.require(:imagen).permit(:orden, :imagen, :nota, :linea_id, :directorio_id)\n end" ]
[ "0.5946864", "0.5804443", "0.5764939", "0.57238686", "0.57009286", "0.56567764", "0.5628498", "0.55611914", "0.5554599", "0.5546465", "0.55316764", "0.55121386", "0.5460667", "0.54525214", "0.5435036", "0.5434566", "0.54315484", "0.5420554", "0.5412014", "0.540791", "0.54029155", "0.53919303", "0.53827447", "0.53757656", "0.53751034", "0.5374071", "0.5365896", "0.53538376", "0.5345202", "0.5338085", "0.53375924", "0.5332751", "0.53310204", "0.5316731", "0.53166544", "0.53130233", "0.5309474", "0.5297344", "0.52863485", "0.52842575", "0.527924", "0.52687377", "0.5267513", "0.52634233", "0.5245249", "0.52438116", "0.52425945", "0.5240478", "0.52376455", "0.5236707", "0.523656", "0.52314144", "0.5220583", "0.5215198", "0.5213049", "0.5210059", "0.52050704", "0.52026886", "0.51966405", "0.519054", "0.51842713", "0.5180388", "0.5173838", "0.51701903", "0.51672477", "0.5164705", "0.51552427", "0.51548404", "0.51539063", "0.51473916", "0.5144836", "0.5143999", "0.5140078", "0.51362634", "0.51329273", "0.5132827", "0.5127117", "0.51223916", "0.512004", "0.511806", "0.51160717", "0.51126206", "0.51099515", "0.51063424", "0.51032627", "0.51015127", "0.5096805", "0.5096308", "0.5094049", "0.5091537", "0.5088716", "0.507849", "0.50761396", "0.50761044", "0.50736654", "0.5071921", "0.50659055", "0.5065142", "0.5065026", "0.5058307", "0.50574136" ]
0.0
-1
'records' method based off of code by Ryan Bates retrieved from in May, 2013
def records respond_to do |format| format.csv { send_data Book.to_csv } format.xls { send_data Book.to_csv(col_sep: "\t") } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def anchored; end", "def private; end", "def witcher; end", "def probers; end", "def who_we_are\r\n end", "def king_richard_iii; end", "def superweening_adorningly(counterstand_pyrenomycetales)\n end", "def chords\n \n end", "def offences_by; end", "def villian; end", "def prapor_quest; end", "def peacekeeper_quest; end", "def cmd; end", "def schubert; end", "def romeo_and_juliet; end", "def suivre; end", "def jack_handey; end", "def transact; end", "def weber; end", "def internship_passed; end", "def mech; end", "def mech; end", "def rest_positionals; end", "def relatorios\n end", "def celebration; end", "def nasa_space_craft; end", "def commands; end", "def add_original_commands; end", "def gounod; end", "def command_found; end", "def intensifier; end", "def remote_the\n\n end", "def mitch_hedberg; end", "def subcommands(cmd); end", "def subcommands(cmd); end", "def operations; end", "def operations; end", "def execute actor, target=[nil]\n def himher thing\n multiple = thing.count > 1 \n\n if multiple \n return \"them\"\n end\n\n case thing[0]\n when Player then \"him\"\n when ItemFacade then \"it\"\n else \"\"\n end\n end\n room_msg, self_msg, vict_msg = @ofound.dup, @found.dup, @tfound.dup\n\n\n if target.include?(actor) # if they're the same person then it's an auto\n target = [actor]\n room_msg = @oauto.dup\n self_msg = @auto.dup\n vict_msg = nil\n elsif target[0] == nil\n room_msg = @onoarg.dup\n self_msg = @noarg.dup\n vict_msg = nil\n end\n room_msg.gsub!(\"$n\", \"<%=other.peek(actor)%>\")\n room_msg.gsub!(\"$N\", \"<%=other.peek(if arg[0].include?(other) then arg[0]-[other]+['You'] else arg[0] end)%>\")\n room_msg.gsub!(\"$m\", himher([actor]))\n room_msg.gsub!(\"$M\", himher(target))\n\n self_msg.gsub!(\"$M\", himher(target))\n self_msg.gsub!(\"$m\", himher([actor]))\n if target\n self_msg.gsub!(\"$N\", actor.peek(target))\n end\n actor.view(\"#G\"+self_msg+\"#n\" + ENDL)\n \n room_msg.untaint\n if target[0]\n if target.count > 1 \n actor.in_room.display([:visual, \"other.can_see?(actor) || other.can_see?(arg[0])\"], actor, [actor], \"#G\"+room_msg+\"#n\", target)\n else\n actor.in_room.display([:visual, \"other.can_see?(actor) || other.can_see?(arg[0])\"], actor, [actor, *target], \"#G\"+room_msg+\"#n\", target)\n target.each do |one_targ|\n vm = vict_msg.dup\n vm.gsub!(\"$n\", one_targ.peek(actor))\n one_targ.view(\"#G\"+vm+ \"#n\" + ENDL)\n end\n end\n else\n puts room_msg\n actor.in_room.display([:visual, \"other.can_see?(actor)\"], actor, [actor], \"#G\"+room_msg+\"#n\", \"\")\n end\n end", "def soft_ace\n # softy method refactor for when an ace is played\nend", "def buzzword; end", "def buzzword; end", "def next_message; end", "def next_message; end", "def mechanic_quest; end", "def preflight=(_arg0); end", "def ygg_attacker() ; return nil ; end", "def whiny; end", "def refutal()\n end", "def robots; end", "def robots; end", "def calls; end", "def calls; end", "def leeway; end", "def leeway; end", "def chord; end", "def origin; end", "def origin; end", "def origin; end", "def respond(); end", "def mascot; end", "def silly_adjective; end", "def getc() end", "def getc() end", "def getc() end", "def king_richard_iii_quote; end", "def command; end", "def command; end", "def command; end", "def command; end", "def command; end", "def command; end", "def wrapper; end", "def nn\n end", "def whiny=(_arg0); end", "def affichage_player\n\n\n end", "def all_by_magic(io); end", "def motto; end", "def r; end", "def r; end", "def formation; end", "def preflight; end", "def post_match() end", "def doors; end", "def subcommands() __subcommands__ end", "def robin; end", "def fix_potato\n last_msg = $nv2_channel.history(1)[0] rescue nil\n $last_potato = last_msg.timestamp.to_i rescue Time.now.to_i\n if last_msg.author.id == $config['discord_client']\n $potato = ((FRUITS.index(last_msg.content) + 1) % FRUITS.size) rescue 0\n end\nrescue\n nil\nend", "def feruchemist; end", "def scientist; end", "def simple_blind_ror\n \n end", "def starship; end", "def tongue_twister; end", "def command_list m\n get_list escape m.channel.to_s #logic/pug\n end", "def channels; end", "def original_result; end", "def probers=(_arg0); end", "def notations; end", "def executor; end", "def executor; end", "def executor; end", "def rossini; end", "def custom; end" ]
[ "0.59721124", "0.5881805", "0.56712943", "0.5649555", "0.5450669", "0.5394315", "0.5394121", "0.5388", "0.5303813", "0.5261791", "0.5255843", "0.5198806", "0.5198161", "0.51865184", "0.51747364", "0.51447976", "0.5130566", "0.51302", "0.50942564", "0.50884837", "0.5082771", "0.5082771", "0.5074663", "0.5074446", "0.50719774", "0.5063869", "0.5062159", "0.50511056", "0.5048338", "0.5047473", "0.5033514", "0.5025212", "0.50188494", "0.50074947", "0.50074947", "0.5002659", "0.5002659", "0.49806097", "0.4968872", "0.49548686", "0.49548686", "0.49548036", "0.49548036", "0.49531397", "0.49441993", "0.4939593", "0.49272606", "0.4924176", "0.4923755", "0.4923755", "0.492142", "0.492142", "0.49161813", "0.49161813", "0.4904854", "0.49038157", "0.49038157", "0.49038157", "0.48879585", "0.48811895", "0.48800853", "0.4878987", "0.4878987", "0.4878987", "0.48702985", "0.4863234", "0.4863234", "0.4863234", "0.4863234", "0.4863234", "0.4863234", "0.48583314", "0.48551896", "0.48517412", "0.48470062", "0.48447984", "0.48389134", "0.48357242", "0.48357242", "0.48323748", "0.48318917", "0.48296332", "0.4825231", "0.48195067", "0.48152256", "0.48137492", "0.48078287", "0.48038596", "0.47999913", "0.47997406", "0.4796482", "0.47913986", "0.47912818", "0.4790301", "0.4782405", "0.477773", "0.4777715", "0.4777715", "0.4777715", "0.47739562", "0.47728693" ]
0.0
-1
In the case where an argument is given, use an optimized version.
def map(sym=nil) if sym if block_given? super else rows = [] clone(:_sequel_pg_type=>:map, :_sequel_pg_value=>sym).fetch_rows(sql){|s| rows << s} rows end else super end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def optimize_every=(_arg0); end", "def optimize(_src, _dst, options = {})\n fail NotImplementedError, \"implement method optimize in #{self.class}\"\n end", "def optimize(**options)\n self.dup\n end", "def optimize(_optimized, _layer)\n raise 'TODO'\n end", "def a_method(arg1, arg2='default value')\n do_stuff\n end", "def method_name(arguments = 'default parameters')\n #do something\n new_thing = arguments\n return new_thing\nend", "def optimize\n wrap_operand(operand)\n end", "def optimize\n wrap_operand(operand)\n end", "def one_parameter_method (argument=\"nothing\")\n return argument\nend", "def cache=(_arg0); end", "def cache=(_arg0); end", "def cache=(_arg0); end", "def cache=(_arg0); end", "def call(name, *args)\n memoize(name) {\n if options.key?(name)\n execute_option_function(options[name], *args)\n else\n send(name, *args)\n end\n }\n end", "def strategy=(_arg0); end", "def meth(\n # this is important\n arg)\nend", "def process_base_argument(arg)\n case arg\n when *@mapping[:help] then check_and_set_helpvalue\n when *@mapping[:version] then @parameters[:version] = true\n when *@mapping[:file] then create_argument_entry(:file) \n when /-[a-z]|--[a-z]+/ then process_argument(arg)\n else\n check_and_set_argument(@unflagged_arguments.shift, arg)\n end\n nil\n end", "def meth(\n # this is important\n important_arg,\n # a default, because we're not animals!\n default=nil)\nend", "def always_run=(_arg0); end", "def foo(param = 'no')\n 'yes'\nend", "def foo(param = 'no')\n 'yes'\nend", "def foo(param = \"no\")\r\n \"yes\"\r\nend", "def autofinish=(_arg0); end", "def disable_caching=(_arg0); end", "def in_kwarg=(_arg0); end", "def optimize(**options)\n optimized = self.deep_dup\n #optimized.lexical = nil if optimized.respond_to?(:lexical=)\n #optimized\n end", "def foo(param = \"no\")\n \"yes\"\nend", "def foo(param = \"no\")\n \"yes\"\nend", "def foo(param = \"no\")\n \"yes\"\nend", "def foo(param = \"no\")\n \"yes\"\nend", "def foo(param = \"no\")\n \"yes\"\nend", "def foo(param = \"no\")\n \"yes\"\nend", "def foo(param = \"no\")\n \"yes\"\nend", "def foo(param = \"no\")\n \"yes\"\nend", "def foo(param = \"no\")\n \"yes\"\nend", "def foo(param = \"no\")\n \"yes\"\nend", "def foo(param = \"no\")\n \"yes\"\nend", "def method(a=3)\r\n a\r\nend", "def optimize\n wrap_operand\n end", "def test_function(arg = 'hello')\n puts arg + ' world'\nend", "def default_if_not_specified(opt,default_opt)\n opt ? opt : default_opt\nend", "def method_missing(m, *args, &block)\n if has? m.to_s\n opt(m.to_s)\n else\n super(m, *args, &block)\n end\n end", "def compile_arg(arg, thread_num, invocation_num)\n if arg[:overrides] && arg[:overrides_config]\n overrides = DataOverrideEngine.new(arg[:overrides], arg[:overrides_config]).override(thread_num, invocation_num)\n data = raw_data(data: arg[:data], overrides: overrides)\n else\n data = arg[:data]\n end\n end", "def smoothing=(_arg0); end", "def process_argument(arg)\n if arg\n arg == '--help' ? help : get_ips(arg)\n else\n get_ips\n end\n exit(0)\nend", "def switch_option(arg)\n if match = no_or_skip?(arg) # rubocop:disable AssignmentInCondition\n @switches[arg] || @switches[\"--#{match}\"]\n else\n @switches[arg]\n end\n end", "def process_argument(arg)\n case arg\n when *@mapping[:http_request] then set_mode(:http_request)\n when *@mapping[:source] then set_mode(:source)\n when *@mapping[:http_status] then set_mode(:http_status)\n when *@mapping[:timestamp] then set_mode(:timestamp) \n when *@mapping[:index] then create_argument_entry(:index)\n else\n raise_invalid_parameter(arg)\n end\n nil\n end", "def memo=(_arg0); end", "def optimize_every; end", "def task1(argument, option:)\nend", "def name_parameter_method(name: \"default\", options: {})\n options.merge!(name: name)\n some_action_with(options)\nend", "def fallbacks=(_arg0); end", "def method_with_optional_param(param = foo)\nend", "def foo(param = \"no\")\n \"yes\" #Returns yes\nend", "def method(c=c)\r\nend", "def PO114=(arg)", "def foo(param = \"no\") #this is default param\n \"yes\"\nend", "def argue(argument)\n return argument\nend", "def using(*args)\n args.pop.each { |key, value| options.send \"#{key}=\", value } if Hash === args.last\n self.compiler = args.pop until args.empty?\n self\n end", "def call_arg_processor(ver,params={})\n processor=get_arg_processor(ver)\n if processor.nil?\n params\n else\n processor.call(params)\n end\n end", "def assignment_without_argument_usage(argument); end", "def isolated=(_arg0); end", "def isolated=(_arg0); end", "def optimize_image!(original)\n original = Path.convert(original)\n return unless (result = optimize_image(original))\n result.replace(original)\n OptimizedPath.new(original, result.original_size)\n end", "def f2(x, x=0); end", "def cache_if(condition, name = T.unsafe(nil), options = T.unsafe(nil), &block); end", "def optimize_image(original)\n original = Path.convert(original)\n return unless (workers = workers_for_image(original))\n\n optimized = @cache.fetch(original) do\n Handler.for(original) do |handler|\n current_worker = nil\n\n begin\n with_timeout(@timeout) do\n workers.each do |worker|\n current_worker = worker\n handler.process{ |src, dst| worker.optimize(src, dst) }\n end\n end\n rescue TimeoutExceeded => e\n if current_worker && current_worker.pid\n pid = current_worker.pid\n cleanup_process(pid)\n end\n\n raise e\n end\n end\n end\n\n return unless optimized\n OptimizedPath.new(optimized, original)\n end", "def cached_call(compiler)\n cache_check(compiler) << call_cached_method(compiler)\n end", "def cached_call(compiler)\n cache_check(compiler) << call_cached_method(compiler)\n end", "def assign_name(arg='Bob')\n return arg # don't need return\nend", "def optimize(**options)\n self.deep_dup\n end", "def method (a=3, b)\r\nend", "def extra=(_arg0); end", "def safe_by_default=(_arg0); end", "def very_slow\n \"foo\" + \"bar\"\nend", "def optimize!\n rsp = post(\"<optimize/>\")\n success?(rsp.body) or log_error(rsp.body)\n end", "def bar(param = \"no\")\n p param == \"no\" ? \"yes\" : \"no\"\nend", "def process with_opts = {}\n task.opts.update with_opts\n (cached? ? cached_result : process_and_cache).tap {\n Base.sources.uncache! if with_opts[:top_level]\n }\n end", "def PO113=(arg)", "def optimize\n operation.class.call(operand)\n end", "def preproc=(_arg0); end", "def PO111=(arg)", "def underwater _args\n \"underwater _args;\" \n end", "def processor=(_arg0); end", "def put_var_arg\nend", "def optimize=(value)\n set_attr(:optimize, value ? 2 : 1)\n @optimize = value\n end", "def memoize\n cache = {} # An empty cache. The lambda captures this in its closure.\n lambda {|*args|\n # notice that the hash key is the entire array of arguments!\n unless cache.has_key?(args) # If no cached result for these args\n cache[args] = self[*args] # Compute and cache the result\n end\n cache[args] # Return result from cache\n }\n end", "def up_speed(arg)\n @speed += arg\n end", "def update!(**args)\n @disable_fast_process = args[:disable_fast_process] if args.key?(:disable_fast_process)\n @filter = args[:filter] if args.key?(:filter)\n end", "def update!(**args)\n @disable_fast_process = args[:disable_fast_process] if args.key?(:disable_fast_process)\n @filter = args[:filter] if args.key?(:filter)\n end", "def passed_arg\n <<-CODE\n next_int;\n if((unsigned long int)_int < cpu_current_argcount(c)) {\n stack_push(Qtrue);\n } else {\n stack_push(Qfalse);\n }\n CODE\n end", "def profile_parameter=(_arg0); end", "def PO109=(arg)", "def memoize(name)\r\n cache = {}\r\n (class<<self; self; end).send(:define_method, name) do |*args|\r\n cache[args] = super unless cache.has_key?(args)\r\n cache[args]\r\n end\r\n cache\r\nend", "def method (a=3, b=4)\r\nend", "def update!(**args)\n @calibrated_parsing_score = args[:calibrated_parsing_score] if args.key?(:calibrated_parsing_score)\n @effective_arg_span_length = args[:effective_arg_span_length] if args.key?(:effective_arg_span_length)\n @in_query_max_effective_arg_span_length = args[:in_query_max_effective_arg_span_length] if args.key?(:in_query_max_effective_arg_span_length)\n @qrewrite_call_path_info_fingerprint = args[:qrewrite_call_path_info_fingerprint] if args.key?(:qrewrite_call_path_info_fingerprint)\n @source = args[:source] if args.key?(:source)\n end", "def in_kwarg; end", "def method(c=-1, d=c+5)\r\n\tc + d\r\nend", "def transformed_argname=(_); end", "def method(c=d, d=4)\r\n\tc+d\r\nend", "def method(c=d, d=4)\r\n\tc+d\r\nend" ]
[ "0.6207128", "0.5885197", "0.58170927", "0.576805", "0.573602", "0.5436902", "0.5374002", "0.5374002", "0.53660774", "0.5329126", "0.5329126", "0.5329126", "0.5329126", "0.5314729", "0.529628", "0.5295453", "0.5284935", "0.5278582", "0.5274118", "0.52647084", "0.52647084", "0.5230792", "0.5230702", "0.5226815", "0.5226444", "0.52244437", "0.5217201", "0.5217201", "0.5217201", "0.5217201", "0.5217201", "0.5217201", "0.5217201", "0.5217201", "0.5217201", "0.5217201", "0.5217201", "0.5197287", "0.51931596", "0.5176003", "0.5159774", "0.5157417", "0.5151135", "0.51491237", "0.5147728", "0.51378745", "0.5123864", "0.5122762", "0.5104257", "0.5104109", "0.50748587", "0.5064585", "0.5024936", "0.5023234", "0.5021339", "0.5018074", "0.49954483", "0.4986375", "0.4973315", "0.49696323", "0.4968785", "0.49660102", "0.49660102", "0.49587026", "0.49444252", "0.49404976", "0.49124712", "0.49103528", "0.49103528", "0.48891017", "0.4885795", "0.48815867", "0.4876853", "0.4871052", "0.4870965", "0.48645613", "0.48642445", "0.4863292", "0.4857223", "0.48533082", "0.48438358", "0.483946", "0.48321307", "0.48317137", "0.4823094", "0.48221833", "0.4821395", "0.4817719", "0.4816234", "0.4816234", "0.4816234", "0.48148835", "0.48133194", "0.4810904", "0.48082787", "0.48017174", "0.47908083", "0.47809425", "0.47686327", "0.4768301", "0.4768301" ]
0.0
-1
Return a modified copy with the optimize_model_load setting changed.
def with_optimize_model_load(v) clone(:optimize_model_load=>v) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def optimize(**options)\n self.dup\n end", "def reload\n @dirty = []\n @cache = Preference.find_all_by_model_type_and_model_id(@model.class.name, @model.id).index_by(&:key)\n end", "def reload!\n clear_changes_information\n self.exclude_from_save = false\n end", "def optimize(**options)\n self.deep_dup\n end", "def lazy\n raise Error, \"lazy loading disabled\" if model.cti_subclass_load == :eager_only\n clone(:eager_load => false)\n end", "def eager\n raise Error, \"eager loading disabled\" if model.cti_subclass_load == :lazy_only\n clone(:eager_load => true)\n end", "def reload(options = nil)\n self.class.connection.clear_query_cache\n\n # override with the `where(retried_good_job_id: nil)` scope\n override_query = self.class.where(retried_good_job_id: nil)\n fresh_object =\n if options && options[:lock]\n self.class.unscoped { override_query.lock(options[:lock]).find(id) }\n else\n self.class.unscoped { override_query.find(id) }\n end\n\n @attributes = fresh_object.instance_variable_get(:@attributes)\n @new_record = false\n @previously_new_record = false\n self\n end", "def load_model\n self.model = new_model\n model.load_model model_path\n model.print_model\n self.fm = Model::FunctionMap.load_function_map\n end", "def reload_with_clear_original_attributes #:nodoc:\n clear_original_attributes\n reload_without_clear_original_attributes\n end", "def reload\n @ignored = nil\n ignored\n end", "def reload\n model = self.class.find(to_remote)\n\n if model.errors?\n add_errors(model.errors)\n else\n copy_from(model)\n persist!\n end\n\n self\n end", "def set_dirty(value)\n orig = nil\n CouchRest::Model::Base.configure do |config|\n orig = config.use_dirty\n config.use_dirty = value\n end\n BenchmarkModel.instance_eval do\n self.use_dirty = value\n end\n orig\nend", "def restore\n _update_hash = {}\n object.attributes.reject {|k,v| object.class.ignore_fields_on_restore.include?(k)}.each do |key, value|\n _update_hash.merge! get_restore_hash(key,value)\n end\n object.update_attributes(parameterize(_update_hash))\n end", "def reload!(conditions = {})\n unless new_record?\n reloaded_object = self.class.find(client, primary_key, scope_parameters, conditions)\n self.attributes.clear\n self.attributes = reloaded_object.attributes\n mark_as_saved!\n end\n\n self\n end", "def optimize(**options)\n optimized = self.deep_dup\n #optimized.lexical = nil if optimized.respond_to?(:lexical=)\n #optimized\n end", "def cache\n clone.tap { |crit| crit.options.merge!(:cache => true) }\n end", "def reload\n old_data = @data.dup\n self.load\n @data = old_data.merge! @data\n end", "def tune(&block)\n deep_clone.tune!(&block)\n end", "def reload\n new_attributes = resource.find(self)._attributes_\n @_attributes_ = nil\n mass_assign(new_attributes)\n self\n end", "def reload!\n ensure_service!\n @gapi_json = service.get_model dataset_id, model_id\n @reference = nil\n @exists = nil\n self\n end", "def optimize\n session.optimize\n end", "def frozen_copy\n if frozen?\n self\n else\n dup.freeze\n end\n end", "def initialize_copy( original )\n\t\t@settings = original.settings.dup\n\t\t@overridden_settings = {}\n\tend", "def restore_merge_state; end", "def restore_merge_state; end", "def make_copy\n\t\t\tMarshal.load(Marshal.dump(self))\n\t\tend", "def reload!\n load force: true\n end", "def eager_load=(_arg0); end", "def eager_load=(_arg0); end", "def eager_load=(_arg0); end", "def reload\n return false if source.frozen?\n\n final_parent.persistence_strategy.class.new(source).reload\n self.graph = source.to_a\n\n @persisted = true unless graph.empty?\n\n true\n end", "def initialize_copy(original)\n initialize(original.repository, original.model, original.options)\n end", "def dup\n self.class.new(self, @loaded)\n end", "def reload\n begin_reset_model\n @id_to_module = []\n @filtered_out_modules = Set.new\n \n info = discover_module(Object)\n info.id = id_to_module.size\n info.name = title\n update_module_type_info(info)\n info.row = 0\n id_to_module << info\n\n @object_paths = Hash.new\n generate_paths(object_paths, info, \"\")\n ensure\n end_reset_model\n end", "def reload\n self.load self.class.find(id, @prefix_options).attributes\n end", "def reload(options = nil)\n self.class.connection.clear_query_cache\n\n fresh_object =\n if options && options[:lock]\n self.class.unscoped { self.class.lock(options[:lock]).find(id) }\n else\n self.class.find(id)\n end\n\n @attributes = fresh_object.instance_variable_get(\"@attributes\")\n @new_record = false\n self\n end", "def tune(&block)\n clone().tune!(&block)\n end", "def load(model, options = {}, &block)\n end", "def reload!\n @configuration = nil\n load\n self\n end", "def reload\r\n self.load self.class.find(id, @prefix_options).attributes\r\n end", "def reload\n current_options = executed_requests['GET']['options'] rescue {}\n stale!\n self.load(current_options.merge(:reload => true))\n end", "def reload(options = nil)\n clear_changes\n clear_relationships\n clear_composition_cache\n reset_attributes\n unless reload_from_database\n set_deleted_properties\n freeze\n end\n self\n end", "def freeze\n @original_deserialized_values ||= {}\n @original_deserialized_values.freeze\n super\n end", "def skip_subdirectory_model_load=(_arg0); end", "def load_target_with_scrooge\n scrooge_seen_association!(@reflection)\n load_target_without_scrooge\n end", "def clone(opts = OPTS)\n c = super(:freeze=>false)\n c.opts.merge!(opts)\n unless opts.each_key{|o| break if COLUMN_CHANGE_OPTS.include?(o)}\n c.clear_columns_cache\n end\n c.freeze if frozen?\n c\n end", "def optimize_image!(original)\n original = Path.convert(original)\n return unless (result = optimize_image(original))\n result.replace(original)\n OptimizedPath.new(original, result.original_size)\n end", "def optimize_workflow\n end", "def storage_optimization\n @storage_optimization ||= StorageOptimization.new(\n plugin.adapters.values,\n graph.forecast_storage_order\n )\n end", "def refresh\n # re-download the model from the server\n set_model\n end", "def reset!(model = nil)\n @model = model unless model.blank?\n @conditions = \"1\"\n @replacements = {}\n @includes = []\n @joins = []\n @order_by = []\n @after_filters = {}\n @group_by = []\n @subqueries = {}\n @subquery_ids = {}\n @condition_replacements = 0\n @inner_joins = []\n @selects = []\n end", "def reload\n self.raw_data = self.class.find(app_id: app_id, build_id: id).raw_data\n end", "def reload!\n if data = self.class.load(job_id, job_class)\n @data = data\n end\n self\n end", "def update!(**args)\n @imported_model_evaluation_slices = args[:imported_model_evaluation_slices] if args.key?(:imported_model_evaluation_slices)\n end", "def get_loaded_model_by_path(model_path); end", "def naked\n clone.set_model(nil)\n end", "def reload\n options = { consistent_read: true }\n\n if self.class.range_key\n options[:range_key] = range_value\n end\n\n self.attributes = self.class.find(hash_key, options).attributes\n @associations.values.each(&:reset)\n self\n end", "def save_with_load\r\n @oksave = true\r\n save\r\n @oksave = nil\r\n end", "def reload(force = true)\n @load_path_size ||= nil\n\n if force\n @cache = fetch(load_path)\n @load_path_size = load_path.size\n elsif (size = load_path.size) != @load_path_size\n @cache = fetch(load_path)\n @load_path_size = size\n end\n end", "def best\n load\n end", "def reload!(msg)\n SETTINGS[:records] = {}\n Avn::Filter::build\n log(msg, \"REL #{Avn::Filter::regs}\")\nend", "def reload(force = false)\n klass.connection.clear_query_cache if force && klass\n reset\n reset_scope\n load_target\n self unless target.nil?\n end", "def copy\n self.class.load export\n end", "def get_loaded_model(model_path, file); end", "def update!(**args)\n @backing_hyperparameter_tuning_job = args[:backing_hyperparameter_tuning_job] if args.key?(:backing_hyperparameter_tuning_job)\n @best_trial_backing_custom_job = args[:best_trial_backing_custom_job] if args.key?(:best_trial_backing_custom_job)\n end", "def initialize_copy(original)\n super\n @query = @query.dup\n @cache = @cache.dup\n @orphans = @orphans.dup\n end", "def optimizer\n @optimizer ||= Optimizer.new\n end", "def load_cache\n a = dataset.all\n h = {}\n a.each{|o| h[o.pk.freeze] = o.freeze}\n @all = a.freeze\n @cache = h.freeze\n end", "def reload\n reset\n to_a\n self\n end", "def reload\n clear_memoizations!\n perform_reload\n self\n end", "def operate\n # by default, copy all attributes and no associations\n attributes_except\n end", "def load_for(key)\n input_efficiency, output_efficiency =\n Merit::Flex::OptimizingStorage.normalized_efficiencies(\n battery(key).optimizing_storage_params.output_efficiency\n )\n\n self.class.reserve_to_load(\n reserve_for(key),\n input_efficiency: input_efficiency,\n output_efficiency: output_efficiency\n )\n end", "def reload_from_rom\n @representation = nil\n clear_cache\n present\n self\n end", "def recache_source_dataset!\n if source_dataset_cache?\n if source_dataset.opts[:limit] == 1\n source_dataset.cache_set([self])\n else\n source_dataset.cache_del\n end\n end\n end", "def reload\n begin_reset_model\n clear\n\n @items_to_models = Hash.new\n @models_to_items = Hash.new\n @names_to_item = Hash.new\n @items_metadata = Hash[self => Metadata.new([], [], Set.new)]\n @resolver_from_model = Hash.new\n\n seen = Set.new\n sorted_roots = @root_models.\n sort_by(&:priority).reverse\n\n sorted_roots.each do |root_model|\n models = discover_model_hierarchy(root_model.model, root_model.categories, root_model.resolver, seen)\n models.each do |m|\n @resolver_from_model[m] = root_model.resolver\n end\n end\n\n rowCount.times do |row|\n compute_and_store_metadata(item(row))\n end\n self.horizontal_header_labels = [\"\"]\n ensure\n end_reset_model\n end", "def copy\n new_cfn_model = CfnModel.new\n @conditions.each do |k,v|\n new_cfn_model.conditions[k] = v\n end\n @globals.each do |k,v|\n new_cfn_model.globals[k] = v\n end\n @parameters.each do |k,v|\n new_cfn_model.parameters[k] = v\n end\n @resources.each do |k, v|\n new_cfn_model.resources[k] = v\n end\n @mappings.each do |k, v|\n new_cfn_model.mappings[k] = v\n end\n new_cfn_model.raw_model = @raw_model.dup unless @raw_model.nil?\n new_cfn_model\n end", "def reload!\n LOG.debug \"Attempting to reload #{self}.\"\n @lock.synchronize do\n expected = @pool_initializer.call \n actual = @pool\n # remove old destinations\n (actual - expected).each{|d| @pool.delete(d) }\n # append new ones \n @pool += (expected - actual)\n end\n LOG.debug \"Successfully to reloaded #{self}.\"\n end", "def load_filtered_policy(model, filter)\n db[table_name].where(filter).order(:id).each { |line| load_policy_line(line, model) }\n @filtered = true\n end", "def unused_eager_loading_enable=(_arg0); end", "def refine(opts)\n clone.tap { |r| r.refine_value = merge_hashes(r.refine_value, opts) }\n end", "def reload\n klasses = if @reflection.polymorphic?\n @reflection.active_record.distinct.order(reflection.foreign_type).pluck(reflection.foreign_type).map(&:safe_constantize)\n else\n [@reflection.klass]\n end\n @models = klasses.map { |k| @dump.model_for(k) }\n end", "def settings\n copy = OpenStruct.new\n @lock.synchronize do\n copy.marshal_load(@settings.marshal_dump)\n end\n copy\n end", "def reload!\n self.attributes = self.class.real_get(key)\n self\n end", "def reload!\n self.attributes = self.class.real_get(key)\n self\n end", "def reload(options = nil)\n @attributes.update(self.class.find(self.id, options).instance_variable_get('@attributes'))\n self\n end", "def freeze\n reindex unless @clean\n super\n end", "def load_states(fname)\n init_kvstore unless @kv_initialized\n\n if @update_on_kvstore\n @kvstore.load_optimizer_states(fname)\n @optimizer = @kvstore.updater.optimizer\n else\n states = IO.binread(fname)\n @updaters.each do |updater|\n updater.set_states(states)\n updater.optimizer = @updaters[0].optimizer\n end\n @optimizer = @updaters[0].optimizer\n end\n end", "def copy\n Marshal.load(Marshal.dump(self))\n end", "def reload\n return unless @reloading_enabled\n\n reload_lock.with_write_lock do\n @loader.reload\n end\n end", "def autoload_unsynced_quickery_attributes!\n model = self.class\n new_values = {}.with_indifferent_access\n\n defined_quickery_attribute_names = model.quickery_builders.keys\n\n defined_quickery_attribute_names.each do |defined_quickery_attribute_name|\n if has_attribute?(:\"#{defined_quickery_attribute_name}_is_synced\") && !send(:\"#{defined_quickery_attribute_name}_is_synced\")\n new_values[defined_quickery_attribute_name] = determine_quickery_value(defined_quickery_attribute_name)\n new_values[:\"#{defined_quickery_attribute_name}_is_synced\"] = true\n end\n end\n\n update_columns(new_values) if new_values.present?\n end", "def optimize!(path)\n @optimizer.optimize_image!(path)\n end", "def refresh!\n load if changed?\n end", "def clone(opts = nil || (return self))\n # return self used above because clone is called by almost all\n # other query methods, and it is the fastest approach\n c = super(:freeze=>false)\n c.opts.merge!(opts)\n unless opts.each_key{|o| break if COLUMN_CHANGE_OPTS.include?(o)}\n c.clear_columns_cache\n end\n c.freeze\n end", "def load_cache\n @load_cache\n end", "def freeze\n instance_filters.freeze\n super\n end", "def set_load\n @load = Load.find(params[:id])\n end", "def set_load\n @load = Load.find(params[:id])\n end", "def refresh\n load if changed?\n end", "def rehydrate_model_from(filename)\n log(\"Reading saved #{method2str} model from #{filename}.\")\n File.open(filename, \"r\") do |file|\n @model = JSON.parse(file.read)\n end \n end", "def rebind(coordination_model)\n dup\n end" ]
[ "0.60557187", "0.55130506", "0.5426008", "0.5413031", "0.53972054", "0.53337896", "0.53113925", "0.5289714", "0.520269", "0.5089417", "0.50867045", "0.5060151", "0.50241834", "0.4969344", "0.49685144", "0.49476632", "0.49384463", "0.48527497", "0.48046607", "0.48026195", "0.47796118", "0.47582433", "0.47524092", "0.47499683", "0.47499683", "0.47357908", "0.47250843", "0.47101927", "0.47101927", "0.47101927", "0.46984905", "0.46914145", "0.46902412", "0.46836376", "0.46821353", "0.4679908", "0.46768904", "0.4661079", "0.46589863", "0.4653961", "0.46495262", "0.46213117", "0.46118203", "0.46074513", "0.46033537", "0.46030092", "0.4602724", "0.4597444", "0.45787624", "0.4571392", "0.45679262", "0.4556769", "0.45461878", "0.45430216", "0.45377958", "0.45370018", "0.4535784", "0.4532745", "0.45281178", "0.45204332", "0.45175147", "0.45129353", "0.4508753", "0.45043492", "0.44920015", "0.44891626", "0.4487871", "0.44838572", "0.44806913", "0.44763553", "0.44752592", "0.44711488", "0.4465648", "0.44632202", "0.44593942", "0.44579834", "0.44556433", "0.4454984", "0.44549", "0.44546625", "0.44488636", "0.44466075", "0.44452402", "0.44452402", "0.44398636", "0.44391668", "0.44356364", "0.44312617", "0.44252765", "0.44152448", "0.4412095", "0.4406137", "0.44059688", "0.44000483", "0.439091", "0.43908995", "0.43908995", "0.43888876", "0.43863395", "0.43813667" ]
0.7943111
0
In the case where both arguments given, use an optimized version.
def as_hash(key_column, value_column = nil, opts = Sequel::OPTS) if value_column && !opts[:hash] clone(:_sequel_pg_type=>:hash, :_sequel_pg_value=>[key_column, value_column]).fetch_rows(sql){|s| return s} {} elsif opts.empty? super(key_column, value_column) else super end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def optimize(_src, _dst, options = {})\n fail NotImplementedError, \"implement method optimize in #{self.class}\"\n end", "def optimize(**options)\n self.dup\n end", "def optimize_every=(_arg0); end", "def optimize(_optimized, _layer)\n raise 'TODO'\n end", "def optimize(**options)\n optimized = self.deep_dup\n #optimized.lexical = nil if optimized.respond_to?(:lexical=)\n #optimized\n end", "def optimize\n operation.class.call(left, right)\n end", "def optimize(**options)\n self.deep_dup\n end", "def optimize\n operand.class.new(wrap_left, wrap_right)\n end", "def optimize\n wrap_operand(operand)\n end", "def optimize\n wrap_operand(operand)\n end", "def optimize_every; end", "def optimize\n wrap_operand\n end", "def optimize\n left\n end", "def optimize\n left\n end", "def optimize\n left\n end", "def optimize(**options)\n operands.last.optimize(**options)\n end", "def slow\n a, b = 1,2\nend", "def optimize\n right\n end", "def optimize\n right\n end", "def optimize\n operation.class.new(left, right)\n end", "def optimize\n left.ne(right.first)\n end", "def very_slow\n \"foo\" + \"bar\"\nend", "def optimize(**options)\n self.map do |op|\n op.optimize(**options) if op.respond_to?(:optimize)\n end\n end", "def use_merging(use = T.unsafe(nil)); end", "def optimize\n right\n end", "def optimize\n right\n end", "def optimize_image!(original)\n original = Path.convert(original)\n return unless (result = optimize_image(original))\n result.replace(original)\n OptimizedPath.new(original, result.original_size)\n end", "def optimize!(**options)\n ops = operands.map {|o| o.optimize(**options) }.select {|o| o.respond_to?(:empty?) && !o.empty?}\n @operands = ops\n self\n end", "def optimize\n left\n end", "def optimize\n left\n end", "def slow_concat\n 'foo'.concat 'bar'\nend", "def optimize!\n rsp = post(\"<optimize/>\")\n success?(rsp.body) or log_error(rsp.body)\n end", "def optimize_image(original)\n original = Path.convert(original)\n return unless (workers = workers_for_image(original))\n\n optimized = @cache.fetch(original) do\n Handler.for(original) do |handler|\n current_worker = nil\n\n begin\n with_timeout(@timeout) do\n workers.each do |worker|\n current_worker = worker\n handler.process{ |src, dst| worker.optimize(src, dst) }\n end\n end\n rescue TimeoutExceeded => e\n if current_worker && current_worker.pid\n pid = current_worker.pid\n cleanup_process(pid)\n end\n\n raise e\n end\n end\n end\n\n return unless optimized\n OptimizedPath.new(optimized, original)\n end", "def optimizable?\n super || extensions_optimizable?\n end", "def optimized?(src, dst)\n dst.size? && dst.size < src.size\n end", "def optimize\n operation.class.reverse.new(right, left)\n end", "def slow_plus\n 'foo' + 'bar'\nend", "def optimize\n left.left.exclude(merged_right_enumerables).optimize\n end", "def promote_cached(**options)\n promote(**options) if promote?\n end", "def optimize\n operation.class.call(operand)\n end", "def merge(opts); end", "def optimize\n left.left.include(merged_right_enumerables).optimize\n end", "def cache=(_arg0); end", "def cache=(_arg0); end", "def cache=(_arg0); end", "def cache=(_arg0); end", "def optimize_image(original)\n original = ImagePath.new(original)\n if workers = workers_for_image(original)\n result = nil\n ts = [original, original.temp_path]\n workers.each do |worker|\n if result && ts.length < 3\n ts << original.temp_path\n end\n if worker.optimize(*ts.last(2))\n result = ts.last\n if ts.length == 3\n ts[-2, 2] = ts[-1], ts[-2]\n end\n end\n end\n result\n end\n end", "def optimize_image(original)\n original = ImagePath.new(original)\n if workers = workers_for_image(original)\n result = nil\n ts = [original, original.temp_path]\n workers.each do |worker|\n if result && ts.length < 3\n ts << original.temp_path\n end\n if worker.optimize(*ts.last(2))\n result = ts.last\n if ts.length == 3\n ts[-2, 2] = ts[-1], ts[-2]\n end\n end\n end\n result\n end\n end", "def smoothing=(_arg0); end", "def fast_mode(v)\n return if $fast_mode == v\n if !v\n ActiveRecord::ConnectionAdapters::PostgreSQL::DatabaseStatements.switch_exec_query :orig\n $fast_mode = false\n else\n ActiveRecord::ConnectionAdapters::PostgreSQL::DatabaseStatements.switch_exec_query :new\n $fast_mode = true\n end\nend", "def memoize\n cache = {} # An empty cache. The lambda captures this in its closure.\n lambda {|*args|\n # notice that the hash key is the entire array of arguments!\n unless cache.has_key?(args) # If no cached result for these args\n cache[args] = self[*args] # Compute and cache the result\n end\n cache[args] # Return result from cache\n }\n end", "def optimize(options)\n\t\t\tmerge_4_part_longhands\n\t\t\t@declarations.each do |declaration|\n\t\t\t\tdeclaration.optimize_colors \t\t\t \tif options[:optimize_colors]\n\t\t\t\tdeclaration.fix_invalid_colors \t\t\tif options[:fix_invalid_colors]\n\t\t\t\tdeclaration.downcase_property \t\t \tif options[:downcase_properties]\n\t\t\t\tdeclaration.optimize_zeros\t\t\t\t \tif options[:optimize_zeros]\n\t\t\t\tdeclaration.optimize_mp_shorthands \tif options[:optimize_margin_padding]\n\t\t\t\tdeclaration.optimize_filters\t\t\t \tif options[:optimize_filters]\n\t\t\t\tdeclaration.optimize_urls\t\t\t\t\t\tif options[:optimize_urls]\n\t\t\t\tdeclaration.optimize_font_weight\t\tif options[:optimize_font_weight]\n\t\t\t\tdeclaration.optimize_punctuation # no option\n\t\t\tend\n\t\t\toptimize_selectors(options)\n\t\tend", "def optimize_image!(original)\n original = ImagePath.new(original)\n if result = optimize_image(original)\n result.replace(original)\n true\n end\n end", "def optimize_image!(original)\n original = ImagePath.new(original)\n if result = optimize_image(original)\n result.replace(original)\n true\n end\n end", "def optimize(opts = {})\n opts ||= {}\n { optimize: opts }.to_json\n end", "def using(*args)\n args.pop.each { |key, value| options.send \"#{key}=\", value } if Hash === args.last\n self.compiler = args.pop until args.empty?\n self\n end", "def optimize(**options)\n if operand(0).is_a?(Variable) && operand(0).bound? && operand(0).eql?(operand(1))\n RDF::Literal::TRUE\n else\n super # @see Operator#optimize!\n end\n end", "def update!(**args)\n @disable_fast_process = args[:disable_fast_process] if args.key?(:disable_fast_process)\n @filter = args[:filter] if args.key?(:filter)\n end", "def update!(**args)\n @disable_fast_process = args[:disable_fast_process] if args.key?(:disable_fast_process)\n @filter = args[:filter] if args.key?(:filter)\n end", "def optimized?(src, dst)\n dst_size = dst.size?\n dst_size && dst_size < src.size\n end", "def memo=(_arg0); end", "def fallbacks=(_arg0); end", "def optimize(options=nil)\n request(:post, \"_optimize\", options)\n end", "def merge!(new_args); end", "def optimizable?\n super || !predicate.equal?(operation.predicate)\n end", "def optimize\n if @raw_code.nil? || @raw_code.length == 0\n abort(\"Bad code.\")\n end\n \n #bf commands that can be optimized\n opt_comms = ['<', '>', '+', '-']\n \n #special command for the bf nil operator. '[-]' will always zero out the value\n #at the pointer, so shortcut it\n @raw_code = @raw_code.gsub(/\\[-\\]/, '=')\n \n #probably a more ruby-esque way to do this... find all optimizable commands\n #and find how many times they appear in order (sequential commands)\n i = 0\n while i < @raw_code.length do\n c, t = @raw_code[i, 1], @raw_code[i + 1, 1]\n j = 0\n \n if !(opt_comms.index(c).nil?) && t == c\n while t == c do\n j += 1\n i += 1\n t = @raw_code[i, 1]\n end\n i -= 1\n else\n j += 1\n end\n \n @opt_code.push(c).push(j)\n \n i += 1\n end\n \n stop = false\n i, j, l = 0, 0, 0\n \n #optimize bf loops, find the corresponding ']' to '[', so we can immediately\n #jump to that point instead of constantly having to look it up during run-time\n while i < @opt_code.length do\n l = i\n case @opt_code[i]\n when '['\n stop, j = false, 0\n while !(stop) do\n i += 2\n case @opt_code[i]\n when ']'\n stop = (j == 0)\n j -= 1\n when '['\n j + 1\n end\n end\n \n @opt_code[l + 1], @opt_code[i + 1] = i, l\n end\n \n i += 1\n end\n \n #puts @opt_code\n end", "def optimize opts = {}\n optimize_attributes = opts.delete :optimize_attributes\n update opts.merge(:data => xml.optimize(optimize_attributes))\n end", "def disable_caching=(_arg0); end", "def optimize!(path)\n @optimizer.optimize_image!(path)\n end", "def optimize(image_path)\n print_status(\"Optimizing #{image_path}, this may take a while...\")\n ImageOptimizer.new(image_path, quiet: true).optimize\nend", "def optimize=(value)\n set_attr(:optimize, value ? 2 : 1)\n @optimize = value\n end", "def a_method(arg1, arg2='default value')\n do_stuff\n end", "def simplify\n super\n return self if (@x == CAS::Zero and @y == CAS::Zero)\n return self if (@x == CAS::Infinity and @y == CAS::Infinity)\n return self if (@x == CAS::Infinity and @y == CAS::Zero)\n return self if (@x == CAS::Zero and @y == CAS::Infinity)\n\n return CAS::Zero if @x == CAS::Zero\n return CAS::Infinity if @y == CAS::Zero\n return @x if @y == CAS::One\n return CAS::Zero if @y == CAS::Infinity\n return CAS::One if @x == @y\n return CAS.const(self.call({})) if (@x.is_a? CAS::Constant and @y.is_a? CAS::Constant)\n return self\n end", "def optimize\n operand\n end", "def simplify\n super\n return self if (@x == CAS::Zero and @y == CAS::Zero)\n return self if (@x == CAS::Infinity and @y == CAS::Infinity)\n return self if (@x == CAS::Infinity and @y == CAS::Zero)\n return self if (@x == CAS::Zero and @y == CAS::Infinity)\n\n return CAS::Zero if @x == CAS::Zero\n return CAS::One if @x == CAS::One\n return @x if @y == CAS::One\n return CAS::One if @y == CAS::Zero\n return CAS.const(self.call({})) if (@x.is_a? CAS::Constant and @y.is_a? CAS::Constant)\n return self\n end", "def optimize\n operand\n end", "def optimize_retina!(name, options={})\n config = versions[name]\n options[:retina] = false\n\n processors = if config.respond_to?(:processors)\n config.processors.dup\n else\n config[:uploader].processors.dup\n end\n dimensions_processor = nil\n\n ## Check if there's a resize processor to get the dimensions\n processors.each do |p|\n dimensions_processor = processors.delete(p) if p[0].to_s.scan(/resize_to_fill|resize_to_limit|resize_to_fit|resize_and_pad/).any?\n end\n\n ## Define a retina version if processor is present\n if dimensions_processor\n dimensions = dimensions_processor[1].dup\n\n width = dimensions[0] * 2\n height = dimensions[1] * 2\n\n 2.times { dimensions.delete_at(0) }\n\n dimensions.insert(0, height)\n dimensions.insert(0, width)\n\n ## Reset the processors\n if config.respond_to?(:processors)\n config.processors = []\n else\n config[:uploader].processors = []\n end\n\n ## Override version with double height and width\n version name, options do\n process dimensions_processor[0] => dimensions\n\n quality_processor = nil\n\n ## Set other processors\n processors.each do |processor|\n process processor[0] => processor[1]\n\n quality_processor = true if processor[0] == :retina_quality\n end\n\n ## Set default quality if retina_quality is not defined\n process :retina_quality => 60 if quality_processor.nil?\n\n ## Store dimensions\n process :store_retina_dimensions\n end\n end\n end", "def forceSpeed _obj, _args\n \"_obj forceSpeed _args;\" \n end", "def cached_call(compiler)\n cache_check(compiler) << call_cached_method(compiler)\n end", "def cached_call(compiler)\n cache_check(compiler) << call_cached_method(compiler)\n end", "def process with_opts = {}\n task.opts.update with_opts\n (cached? ? cached_result : process_and_cache).tap {\n Base.sources.uncache! if with_opts[:top_level]\n }\n end", "def supports_optimizer_hints?\n false\n end", "def minimize; end", "def initialize(*)\n super\n @left = optimize_left\n @right = optimize_right\n end", "def warmup(prc = T.unsafe(nil), &block); end", "def memoize(name)\r\n cache = {}\r\n (class<<self; self; end).send(:define_method, name) do |*args|\r\n cache[args] = super unless cache.has_key?(args)\r\n cache[args]\r\n end\r\n cache\r\nend", "def eager_load=(_arg0); end", "def eager_load=(_arg0); end", "def eager_load=(_arg0); end", "def underwater _args\n \"underwater _args;\" \n end", "def warm_cache(target_files); end", "def supports_parallel=(_arg0); end", "def set_compiled_method_cache; end", "def camaleon_image_optimizer_on_active(plugin)\n end", "def _reduce_385(val, _values, result)\n @context.in_argdef = false\n\n result\nend", "def short_long_short(string1, string2)\n return string1 + string2 + string1 if string1.size < string2.size\n return string2 + string1 + string2\nend", "def _reduce_385(val, _values, result)\n @context.in_argdef = false\n \n result\nend", "def optimize_images!(paths, &block)\n run_method_for(paths, :optimize_image!, &block)\n end", "def optimize_images!(paths, &block)\n run_method_for(paths, :optimize_image!, &block)\n end", "def optimize_images!(paths, &block)\n run_method_for(paths, :optimize_image!, &block)\n end", "def update!(**args)\n @calibrated_parsing_score = args[:calibrated_parsing_score] if args.key?(:calibrated_parsing_score)\n @effective_arg_span_length = args[:effective_arg_span_length] if args.key?(:effective_arg_span_length)\n @in_query_max_effective_arg_span_length = args[:in_query_max_effective_arg_span_length] if args.key?(:in_query_max_effective_arg_span_length)\n @qrewrite_call_path_info_fingerprint = args[:qrewrite_call_path_info_fingerprint] if args.key?(:qrewrite_call_path_info_fingerprint)\n @source = args[:source] if args.key?(:source)\n end" ]
[ "0.6504555", "0.64189917", "0.62669885", "0.61037004", "0.58903116", "0.57826304", "0.5688964", "0.5569637", "0.55181783", "0.55181783", "0.5515863", "0.5508742", "0.5482555", "0.5482555", "0.5482555", "0.5423512", "0.5419098", "0.54014444", "0.54014444", "0.53318447", "0.5322856", "0.53165245", "0.52981836", "0.5257604", "0.5248787", "0.5248787", "0.5246565", "0.52405566", "0.52192134", "0.52192134", "0.5206363", "0.52016765", "0.51948726", "0.5177733", "0.51658404", "0.5165576", "0.5163412", "0.5153384", "0.5131489", "0.5114354", "0.5041344", "0.50400865", "0.50258356", "0.50258356", "0.50258356", "0.50258356", "0.5023088", "0.5023088", "0.5017464", "0.50024533", "0.4997202", "0.4978854", "0.49544674", "0.49544674", "0.495327", "0.49532324", "0.4924198", "0.49236283", "0.49236283", "0.49192923", "0.49179703", "0.49149644", "0.49051172", "0.48679376", "0.486395", "0.48623407", "0.48605555", "0.48411077", "0.48380542", "0.48375386", "0.4832132", "0.48241356", "0.48157728", "0.48118162", "0.4801172", "0.4795751", "0.47897035", "0.47751284", "0.4756277", "0.4756277", "0.47508475", "0.47285688", "0.47268626", "0.47216868", "0.47092244", "0.47060972", "0.4705972", "0.4705972", "0.4705972", "0.4696628", "0.46840447", "0.46831682", "0.46693942", "0.46672505", "0.4660956", "0.46607924", "0.46523437", "0.4650926", "0.4650926", "0.4650926", "0.46373132" ]
0.0
-1
:nocov: In the case where both arguments given, use an optimized version.
def to_hash_groups(key_column, value_column = nil, opts = Sequel::OPTS) if value_column && !opts[:hash] clone(:_sequel_pg_type=>:hash_groups, :_sequel_pg_value=>[key_column, value_column]).fetch_rows(sql){|s| return s} {} elsif opts.empty? super(key_column, value_column) else super end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def optimize(_src, _dst, options = {})\n fail NotImplementedError, \"implement method optimize in #{self.class}\"\n end", "def optimize_every=(_arg0); end", "def optimize(**options)\n self.dup\n end", "def optimize(_optimized, _layer)\n raise 'TODO'\n end", "def optimize(**options)\n optimized = self.deep_dup\n #optimized.lexical = nil if optimized.respond_to?(:lexical=)\n #optimized\n end", "def optimize_every; end", "def optimize(**options)\n self.deep_dup\n end", "def very_slow\n \"foo\" + \"bar\"\nend", "def test_will_return_via_tail_call\n src =<<-EOC\ndefn g() {9}\ndefn f(x) {\n zero?(:x) && return %g\n %g + 9\n}\nEOC\n vi = mkvi src+\"\\nf(0)\\n\";ti = mkti src+\"\\nf(0)\\n\"\n assert (vi.run == 9) && (ti.run == 9), \"Expected both optimized and non_optiized to return9, but one of them did not\"\n end", "def slow\n a, b = 1,2\nend", "def minimum_coverage(coverage = T.unsafe(nil)); end", "def warmup(prc = T.unsafe(nil), &block); end", "def bench_filters\n skip 'TODO'\n end", "def benchmark\nend", "def optimize\n operation.class.call(left, right)\n end", "def unused_eager_loading_enable=(_arg0); end", "def optimize(**options)\n self.map do |op|\n op.optimize(**options) if op.respond_to?(:optimize)\n end\n end", "def coverage_exceeding_source_warn; end", "def slow_plus\n 'foo' + 'bar'\nend", "def optimize!\n rsp = post(\"<optimize/>\")\n success?(rsp.body) or log_error(rsp.body)\n end", "def optimizable?\n super || extensions_optimizable?\n end", "def optimize\n left\n end", "def optimize\n left\n end", "def optimize\n left\n end", "def auto_analyze=(_arg0); end", "def a_method(arg1, arg2='default value')\n do_stuff\n end", "def set_compiled_method_cache; end", "def call(a,b, cache) # @closure\n\t\t# do nothing\n\t\t# but it will never be run anyway\n\tend", "def optimize\n wrap_operand\n end", "def use_merging(use = T.unsafe(nil)); end", "def start_coverage\n return unless sporkless? # Something funny about numbers right now under spork\n require 'simplecov'\nend", "def cached_call(compiler)\n cache_check(compiler) << call_cached_method(compiler)\n end", "def cached_call(compiler)\n cache_check(compiler) << call_cached_method(compiler)\n end", "def optimize\n operand.class.new(wrap_left, wrap_right)\n end", "def bench_my_algorithm\r\n assert_performance_linear 0.9999 do |n| # n is a range value\r\n n.times do\r\n @obj.my_algorithm\r\n end\r\n end\r\n end", "def optimize(opts = {})\n opts ||= {}\n { optimize: opts }.to_json\n end", "def optimize\n wrap_operand(operand)\n end", "def optimize\n wrap_operand(operand)\n end", "def optimize\n right\n end", "def optimize\n right\n end", "def forceSpeed _obj, _args\n \"_obj forceSpeed _args;\" \n end", "def ignore_method_conflicts=(_arg0); end", "def slow_concat\n 'foo'.concat 'bar'\nend", "def compare_performance(entity, method, *args)\n no_contract_label = \"#{entity}:#{method}_no_contract\"\n with_contract_label = \"#{entity}:#{method}\"\n \n Benchmark.bm(no_contract_label.length) do |x|\n x.report(no_contract_label) { entity.send(\"#{method}_no_contract\", *args) }\n x.report(with_contract_label) { entity.send(method, *args) }\n end\nend", "def benchmark!\n @benchmark = true\n end", "def performance\n fail NotImplementedError\n end", "def performance\n fail NotImplementedError\n end", "def foo2(a, ...)\n bar2(a, ...)\nend", "def args_builder_common(opts)\n gcovr_opts = get_opts(opts)\n\n args = \"\"\n args += \"--root \\\"#{gcovr_opts[:report_root] || '.'}\\\" \"\n args += \"--config \\\"#{gcovr_opts[:config_file]}\\\" \" unless gcovr_opts[:config_file].nil?\n args += \"--filter \\\"#{gcovr_opts[:report_include]}\\\" \" unless gcovr_opts[:report_include].nil?\n args += \"--exclude \\\"#{gcovr_opts[:report_exclude] || GCOV_FILTER_EXCLUDE}\\\" \"\n args += \"--gcov-filter \\\"#{gcovr_opts[:gcov_filter]}\\\" \" unless gcovr_opts[:gcov_filter].nil?\n args += \"--gcov-exclude \\\"#{gcovr_opts[:gcov_exclude]}\\\" \" unless gcovr_opts[:gcov_exclude].nil?\n args += \"--exclude-directories \\\"#{gcovr_opts[:exclude_directories]}\\\" \" unless gcovr_opts[:exclude_directories].nil?\n args += \"--branches \" if gcovr_opts[:branches].nil? || gcovr_opts[:branches] # Defaults to enabled.\n args += \"--sort-uncovered \" if gcovr_opts[:sort_uncovered]\n args += \"--sort-percentage \" if gcovr_opts[:sort_percentage].nil? || gcovr_opts[:sort_percentage] # Defaults to enabled.\n args += \"--print-summary \" if gcovr_opts[:print_summary]\n args += \"--gcov-executable \\\"#{gcovr_opts[:gcov_executable]}\\\" \" unless gcovr_opts[:gcov_executable].nil?\n args += \"--exclude-unreachable-branches \" if gcovr_opts[:exclude_unreachable_branches]\n args += \"--exclude-throw-branches \" if gcovr_opts[:exclude_throw_branches]\n args += \"--use-gcov-files \" if gcovr_opts[:use_gcov_files]\n args += \"--gcov-ignore-parse-errors \" if gcovr_opts[:gcov_ignore_parse_errors]\n args += \"--keep \" if gcovr_opts[:keep]\n args += \"--delete \" if gcovr_opts[:delete]\n args += \"-j #{gcovr_opts[:num_parallel_threads]} \" if !(gcovr_opts[:num_parallel_threads].nil?) && (gcovr_opts[:num_parallel_threads].is_a? Integer)\n\n [:fail_under_line, :fail_under_branch, :source_encoding, :object_directory].each do |opt|\n unless gcovr_opts[opt].nil?\n\n value = gcovr_opts[opt]\n if (opt == :fail_under_line) || (opt == :fail_under_branch)\n if not value.is_a? Integer\n puts \"Option value #{opt} has to be an integer\"\n value = nil\n elsif (value < 0) || (value > 100)\n puts \"Option value #{opt} has to be a percentage from 0 to 100\"\n value = nil\n end\n end\n args += \"--#{opt.to_s.gsub('_','-')} #{value} \" unless value.nil?\n end\n end\n\n return args\n end", "def coverage; end", "def coverage; end", "def generate_comprehensive\n\n end", "def supports_parallel=(_arg0); end", "def refuse_coverage_drop; end", "def fix_memory_limit!(context)\n if context.respond_to?(:optimization_level=)\n context.optimization_level = -1\n else\n context.instance_eval { @native.setOptimizationLevel(-1) }\n end\n end", "def optimize\n left\n end", "def optimize\n left\n end", "def optimize(image_path)\n print_status(\"Optimizing #{image_path}, this may take a while...\")\n ImageOptimizer.new(image_path, quiet: true).optimize\nend", "def nop(*argv) end", "def cache=(_arg0); end", "def cache=(_arg0); end", "def cache=(_arg0); end", "def cache=(_arg0); end", "def disable_caching=(_arg0); end", "def optimize(**options)\n operands.last.optimize(**options)\n end", "def minimize; end", "def optimize(options)\n\t\t\tmerge_4_part_longhands\n\t\t\t@declarations.each do |declaration|\n\t\t\t\tdeclaration.optimize_colors \t\t\t \tif options[:optimize_colors]\n\t\t\t\tdeclaration.fix_invalid_colors \t\t\tif options[:fix_invalid_colors]\n\t\t\t\tdeclaration.downcase_property \t\t \tif options[:downcase_properties]\n\t\t\t\tdeclaration.optimize_zeros\t\t\t\t \tif options[:optimize_zeros]\n\t\t\t\tdeclaration.optimize_mp_shorthands \tif options[:optimize_margin_padding]\n\t\t\t\tdeclaration.optimize_filters\t\t\t \tif options[:optimize_filters]\n\t\t\t\tdeclaration.optimize_urls\t\t\t\t\t\tif options[:optimize_urls]\n\t\t\t\tdeclaration.optimize_font_weight\t\tif options[:optimize_font_weight]\n\t\t\t\tdeclaration.optimize_punctuation # no option\n\t\t\tend\n\t\t\toptimize_selectors(options)\n\t\tend", "def optimize\n right\n end", "def optimize\n right\n end", "def disable_profiling=(_arg0); end", "def using(*args)\n args.pop.each { |key, value| options.send \"#{key}=\", value } if Hash === args.last\n self.compiler = args.pop until args.empty?\n self\n end", "def memo=(_arg0); end", "def optimize!(**options)\n ops = operands.map {|o| o.optimize(**options) }.select {|o| o.respond_to?(:empty?) && !o.empty?}\n @operands = ops\n self\n end", "def underwater _args\n \"underwater _args;\" \n end", "def overload; end", "def always_run=(_arg0); end", "def smoothing=(_arg0); end", "def optimizable?\n super || !predicate.equal?(operation.predicate)\n end", "def _reduce_385(val, _values, result)\n @context.in_argdef = false\n\n result\nend", "def quick(repetitions=100, &block)\n require 'benchmark'\n Benchmark.bmbm do |b|\n b.report {repetitions.times &block}\n end\n nil\nend", "def enable_gc_optimizations\r\n\t\t\tif GC.respond_to?(:copy_on_write_friendly=)\r\n\t\t\t\tGC.copy_on_write_friendly = true\r\n\t\t\tend\r\n\t end", "def supports_optimizer_hints?\n false\n end", "def merge(opts); end", "def warm_cache(target_files); end", "def _reduce_385(val, _values, result)\n @context.in_argdef = false\n \n result\nend", "def optimize_retina!(name, options={})\n config = versions[name]\n options[:retina] = false\n\n processors = if config.respond_to?(:processors)\n config.processors.dup\n else\n config[:uploader].processors.dup\n end\n dimensions_processor = nil\n\n ## Check if there's a resize processor to get the dimensions\n processors.each do |p|\n dimensions_processor = processors.delete(p) if p[0].to_s.scan(/resize_to_fill|resize_to_limit|resize_to_fit|resize_and_pad/).any?\n end\n\n ## Define a retina version if processor is present\n if dimensions_processor\n dimensions = dimensions_processor[1].dup\n\n width = dimensions[0] * 2\n height = dimensions[1] * 2\n\n 2.times { dimensions.delete_at(0) }\n\n dimensions.insert(0, height)\n dimensions.insert(0, width)\n\n ## Reset the processors\n if config.respond_to?(:processors)\n config.processors = []\n else\n config[:uploader].processors = []\n end\n\n ## Override version with double height and width\n version name, options do\n process dimensions_processor[0] => dimensions\n\n quality_processor = nil\n\n ## Set other processors\n processors.each do |processor|\n process processor[0] => processor[1]\n\n quality_processor = true if processor[0] == :retina_quality\n end\n\n ## Set default quality if retina_quality is not defined\n process :retina_quality => 60 if quality_processor.nil?\n\n ## Store dimensions\n process :store_retina_dimensions\n end\n end\n end", "def optimize\n if @raw_code.nil? || @raw_code.length == 0\n abort(\"Bad code.\")\n end\n \n #bf commands that can be optimized\n opt_comms = ['<', '>', '+', '-']\n \n #special command for the bf nil operator. '[-]' will always zero out the value\n #at the pointer, so shortcut it\n @raw_code = @raw_code.gsub(/\\[-\\]/, '=')\n \n #probably a more ruby-esque way to do this... find all optimizable commands\n #and find how many times they appear in order (sequential commands)\n i = 0\n while i < @raw_code.length do\n c, t = @raw_code[i, 1], @raw_code[i + 1, 1]\n j = 0\n \n if !(opt_comms.index(c).nil?) && t == c\n while t == c do\n j += 1\n i += 1\n t = @raw_code[i, 1]\n end\n i -= 1\n else\n j += 1\n end\n \n @opt_code.push(c).push(j)\n \n i += 1\n end\n \n stop = false\n i, j, l = 0, 0, 0\n \n #optimize bf loops, find the corresponding ']' to '[', so we can immediately\n #jump to that point instead of constantly having to look it up during run-time\n while i < @opt_code.length do\n l = i\n case @opt_code[i]\n when '['\n stop, j = false, 0\n while !(stop) do\n i += 2\n case @opt_code[i]\n when ']'\n stop = (j == 0)\n j -= 1\n when '['\n j + 1\n end\n end\n \n @opt_code[l + 1], @opt_code[i + 1] = i, l\n end\n \n i += 1\n end\n \n #puts @opt_code\n end", "def benchmark(methods)\n Benchmark.ips do |x|\n x.config(time: 5, warmup: 2)\n\n methods.each do |name, method|\n x.report(name) { method }\n end\n\n x.compare!\n end\nend", "def test_under_production_over_consumption_of_arguments\n assert_raises VishArgumentError do\n result = interpret 'low=->(f, g) { 1 };%low()'\n end\n end", "def benchmark(reporter); end", "def offences_by=(_arg0); end", "def benchmark(&block)\n end", "def __define_full_method_high_arity(method_cache)\n define_singleton_method(method_cache.method_name) do |*args, &inner_block|\n __run_wrappers(method_cache, args, true) do |*call_args|\n method_cache.strategy.new.public_send(method_cache.method_name, *call_args, &inner_block)\n end\n end\n end", "def assert_optimized_queries\n assert_nothing_raised { Prosopite.scan { yield } }\n end", "def test\n ITERATION_COUNT.times do\n x = rand(1_000_000)\n y = rand(1_000_000)\n max = yield(x, y)\n max.class # do something w/max so Java optimizer doesn't eliminate it\n end\nend", "def optimize(options=nil)\n request(:post, \"_optimize\", options)\n end", "def optimize\n left.left.exclude(merged_right_enumerables).optimize\n end", "def check_for_optimizely_function\n $tracer.trace(\"GameStopAnalyticsFunctions: #{__method__}, Line: #{__LINE__}\")\n $tracer.report(\"Should #{__method__}.\")\n optimizely_adroll_function.should include \"window['optimizely'] = window['optimizely'] || [];\"\n optimizely_adroll_function.should include \"window['optimizely'].push([\\\"trackEvent\\\", \\\"purchase\\\", { \\\"revenue\\\": totalSaleInCents }]);\"\n end", "def standard_cost_code; end", "def isolated=(_arg0); end", "def isolated=(_arg0); end" ]
[ "0.65035224", "0.6387214", "0.6309106", "0.5997602", "0.58226335", "0.581956", "0.56139374", "0.5547684", "0.5488999", "0.5472436", "0.536174", "0.52840173", "0.5254899", "0.5230683", "0.5229912", "0.5218105", "0.51818085", "0.5179575", "0.5178699", "0.5157117", "0.5144813", "0.513538", "0.513538", "0.513538", "0.51229274", "0.5121326", "0.5120303", "0.5112557", "0.50953436", "0.5088087", "0.50787187", "0.5077369", "0.5077369", "0.5071834", "0.506515", "0.50646055", "0.50571615", "0.50571615", "0.5049212", "0.5049212", "0.5044738", "0.5004586", "0.5003483", "0.5001118", "0.50004065", "0.49991527", "0.49991527", "0.49976438", "0.49940756", "0.49855888", "0.49855888", "0.49609593", "0.49593547", "0.4932615", "0.4921924", "0.49054462", "0.49054462", "0.49009356", "0.48991746", "0.48976812", "0.48976812", "0.48976812", "0.48976812", "0.48945576", "0.48920354", "0.48818845", "0.48796618", "0.48791292", "0.48791292", "0.48749426", "0.4867667", "0.48540992", "0.4849628", "0.48463216", "0.48389935", "0.48379242", "0.48344338", "0.48130333", "0.48009437", "0.47986084", "0.47943577", "0.47930062", "0.47857207", "0.47822514", "0.47786817", "0.47777864", "0.47729164", "0.47682828", "0.47654885", "0.47651815", "0.47635567", "0.47627428", "0.47622123", "0.47599715", "0.4758564", "0.47580194", "0.47572526", "0.47527248", "0.47493225", "0.47413486", "0.47413486" ]
0.0
-1
Always use optimized version
def _select_map_multiple(ret_cols) rows = [] clone(:_sequel_pg_type=>:array).fetch_rows(sql){|s| rows << s} rows end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def optimize_every; end", "def optimize(**options)\n self.dup\n end", "def optimize_every=(_arg0); end", "def optimize(_optimized, _layer)\n raise 'TODO'\n end", "def generate_comprehensive\n\n end", "def optimize(**options)\n optimized = self.deep_dup\n #optimized.lexical = nil if optimized.respond_to?(:lexical=)\n #optimized\n end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def benchmark!\n @benchmark = true\n end", "def enable_gc_optimizations\r\n\t\t\tif GC.respond_to?(:copy_on_write_friendly=)\r\n\t\t\t\tGC.copy_on_write_friendly = true\r\n\t\t\tend\r\n\t end", "def fast_mode(v)\n return if $fast_mode == v\n if !v\n ActiveRecord::ConnectionAdapters::PostgreSQL::DatabaseStatements.switch_exec_query :orig\n $fast_mode = false\n else\n ActiveRecord::ConnectionAdapters::PostgreSQL::DatabaseStatements.switch_exec_query :new\n $fast_mode = true\n end\nend", "def max_fast_inline(num_of_requests); end", "def optimizable?\n super || extensions_optimizable?\n end", "def set_compiled_method_cache; end", "def warm_cache(target_files); end", "def precompiled_assets(clear_cache = T.unsafe(nil)); end", "def precompiled_assets(clear_cache = T.unsafe(nil)); end", "def very_slow\n \"foo\" + \"bar\"\nend", "def cached?; end", "def cache_on?; end", "def cache_on?; end", "def auto_vivify?\n !fast?\n end", "def disable_caching=(_arg0); end", "def warmup(prc = T.unsafe(nil), &block); end", "def optimizely_obj\n p 'Checking to see if Optimizely object exists'\n # Checks to see if the optimizely_client variable has been intialized, if not it will run instantiate_optimizely method\n # Commenting this out temporarily to reinstantiate on every request for demo purposes\n # Uncomment line 44 and comment out line 45 to only instantiate Optimizely if it doesn't already exist\n # @@optimizely_client ||= instantiate_optimizely\n instantiate_optimizely\n end", "def go_faster\n ping_check \"go_faster\"\n end", "def optimize(_src, _dst, options = {})\n fail NotImplementedError, \"implement method optimize in #{self.class}\"\n end", "def optimize(**options)\n self.deep_dup\n end", "def compressor; end", "def optimize\n right\n end", "def optimize\n right\n end", "def freeze; end", "def optimize_workflow\n end", "def minimize; end", "def freeze() end", "def freeze() end", "def optimize\n left\n end", "def optimize\n left\n end", "def optimize\n left\n end", "def enable_gc_optimizations\n if GC.respond_to?(:copy_on_write_friendly=)\n GC.copy_on_write_friendly = true\n end\n end", "def benchmark\nend", "def unused_eager_loading_enable=(_arg0); end", "def speed_up(increment)\n BicycleInterface.api_not_implemented(self)\n end", "def used?; end", "def optimize!\n rsp = post(\"<optimize/>\")\n success?(rsp.body) or log_error(rsp.body)\n end", "def fast?\n settings['fast']\n end", "def pedal_faster\n\t\t@speed += 10\n\tend", "def fast_copies\n ENV['fast_copies'] == 'true' || ENV['fast_copies'] == 'yes'\n end", "def improve\n return false unless valid?\n true\n end", "def with_optimize_model_load(v)\n clone(:optimize_model_load=>v)\n end", "def request_debug_assets?; end", "def request_debug_assets?; end", "def without_cache(&block); end", "def without_cache(&block); end", "def runtime; end", "def standard_cost_code; end", "def one_gradable_ex_only\n end", "def disable_caching; end", "def benchmark_all!\n @benchmark_all = true\n end", "def memo; end", "def memoize_all; CurrentParser[:memoize]=:all; end", "def optimize\n right\n end", "def optimize\n right\n end", "def optimize\n if @raw_code.nil? || @raw_code.length == 0\n abort(\"Bad code.\")\n end\n \n #bf commands that can be optimized\n opt_comms = ['<', '>', '+', '-']\n \n #special command for the bf nil operator. '[-]' will always zero out the value\n #at the pointer, so shortcut it\n @raw_code = @raw_code.gsub(/\\[-\\]/, '=')\n \n #probably a more ruby-esque way to do this... find all optimizable commands\n #and find how many times they appear in order (sequential commands)\n i = 0\n while i < @raw_code.length do\n c, t = @raw_code[i, 1], @raw_code[i + 1, 1]\n j = 0\n \n if !(opt_comms.index(c).nil?) && t == c\n while t == c do\n j += 1\n i += 1\n t = @raw_code[i, 1]\n end\n i -= 1\n else\n j += 1\n end\n \n @opt_code.push(c).push(j)\n \n i += 1\n end\n \n stop = false\n i, j, l = 0, 0, 0\n \n #optimize bf loops, find the corresponding ']' to '[', so we can immediately\n #jump to that point instead of constantly having to look it up during run-time\n while i < @opt_code.length do\n l = i\n case @opt_code[i]\n when '['\n stop, j = false, 0\n while !(stop) do\n i += 2\n case @opt_code[i]\n when ']'\n stop = (j == 0)\n j -= 1\n when '['\n j + 1\n end\n end\n \n @opt_code[l + 1], @opt_code[i + 1] = i, l\n end\n \n i += 1\n end\n \n #puts @opt_code\n end", "def prepare_preferred_algorithms!; end", "def intern() end", "def optimize\n left\n end", "def optimize\n left\n end", "def optimize(image_path)\n print_status(\"Optimizing #{image_path}, this may take a while...\")\n ImageOptimizer.new(image_path, quiet: true).optimize\nend", "def parallelize_me!; end", "def frozen?; end", "def use_merging(use = T.unsafe(nil)); end", "def optimize\n @database.execute 'VACUUM'\n end", "def ready_optimizing?\n state == :READY_OPTIMIZING\n end", "def pedal_faster\n @current_speed = @current_speed+1\n end", "def recompile\n unmemoize(:compile)\n compile\n end", "def precompiled(local_keys); end", "def cached\n raise NotImplementedError\n end", "def cache=(_arg0); end", "def cache=(_arg0); end", "def cache=(_arg0); end", "def cache=(_arg0); end", "def big_bad; end", "def restore_simple_run\n Gem::Compiler.class_eval do\n remove_method :simple_run\n alias_method :simple_run, :orig_simple_run\n end\n end", "def use_cache?\n super && !against_head?\n end", "def use_cache?\n super && !against_head?\n end", "def optimize_image!(original)\n original = Path.convert(original)\n return unless (result = optimize_image(original))\n result.replace(original)\n OptimizedPath.new(original, result.original_size)\n end", "def optimize_image(original)\n original = Path.convert(original)\n return unless (workers = workers_for_image(original))\n\n optimized = @cache.fetch(original) do\n Handler.for(original) do |handler|\n current_worker = nil\n\n begin\n with_timeout(@timeout) do\n workers.each do |worker|\n current_worker = worker\n handler.process{ |src, dst| worker.optimize(src, dst) }\n end\n end\n rescue TimeoutExceeded => e\n if current_worker && current_worker.pid\n pid = current_worker.pid\n cleanup_process(pid)\n end\n\n raise e\n end\n end\n end\n\n return unless optimized\n OptimizedPath.new(optimized, original)\n end", "def precompile_assets; end", "def minify\n dup.minify!\n end", "def stand_alone?; end", "def stand_alone?; end", "def auto_analyze; end", "def used_invert\n\t\tif @used\n\t\t\t@used = false\n\t\telse\n\t\t\t@used = true\n\t\tend\n\tend", "def cache_value?; end", "def optimize\n session.optimize\n end" ]
[ "0.6226358", "0.5991848", "0.5793023", "0.570928", "0.56633604", "0.56574047", "0.5646279", "0.5646279", "0.5646279", "0.5646279", "0.5646279", "0.5646279", "0.5646279", "0.56008035", "0.55742824", "0.5567948", "0.5545231", "0.55314195", "0.5527053", "0.5507839", "0.5501653", "0.5501653", "0.547203", "0.542264", "0.5421012", "0.5421012", "0.540034", "0.5398406", "0.53698206", "0.5334638", "0.5321901", "0.5314628", "0.53095424", "0.52831763", "0.52829754", "0.52829754", "0.52738166", "0.5267454", "0.52608895", "0.5258165", "0.5258165", "0.5242371", "0.5242371", "0.5242371", "0.52364916", "0.52320063", "0.5204952", "0.52023107", "0.51996183", "0.5182814", "0.5163519", "0.51489323", "0.51390994", "0.5137524", "0.51356506", "0.5134785", "0.5134785", "0.5123934", "0.5123934", "0.51082534", "0.51050204", "0.5099878", "0.5084903", "0.5078393", "0.50782126", "0.5076652", "0.50755876", "0.50755876", "0.5075562", "0.5073724", "0.50735056", "0.5064669", "0.5064669", "0.5031467", "0.50268835", "0.5026436", "0.50152445", "0.5013698", "0.50106114", "0.5003183", "0.49996713", "0.4994724", "0.49871182", "0.4978993", "0.4978993", "0.4978993", "0.4978993", "0.49776727", "0.4977412", "0.49768177", "0.49768177", "0.49741128", "0.49495", "0.49467418", "0.49443758", "0.49417964", "0.49417964", "0.49391893", "0.4938335", "0.49219933", "0.4914141" ]
0.0
-1
Always use optimized version
def _select_map_single rows = [] clone(:_sequel_pg_type=>:first).fetch_rows(sql){|s| rows << s} rows end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def optimize_every; end", "def optimize(**options)\n self.dup\n end", "def optimize_every=(_arg0); end", "def optimize(_optimized, _layer)\n raise 'TODO'\n end", "def generate_comprehensive\n\n end", "def optimize(**options)\n optimized = self.deep_dup\n #optimized.lexical = nil if optimized.respond_to?(:lexical=)\n #optimized\n end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def benchmark!\n @benchmark = true\n end", "def enable_gc_optimizations\r\n\t\t\tif GC.respond_to?(:copy_on_write_friendly=)\r\n\t\t\t\tGC.copy_on_write_friendly = true\r\n\t\t\tend\r\n\t end", "def fast_mode(v)\n return if $fast_mode == v\n if !v\n ActiveRecord::ConnectionAdapters::PostgreSQL::DatabaseStatements.switch_exec_query :orig\n $fast_mode = false\n else\n ActiveRecord::ConnectionAdapters::PostgreSQL::DatabaseStatements.switch_exec_query :new\n $fast_mode = true\n end\nend", "def max_fast_inline(num_of_requests); end", "def optimizable?\n super || extensions_optimizable?\n end", "def set_compiled_method_cache; end", "def warm_cache(target_files); end", "def precompiled_assets(clear_cache = T.unsafe(nil)); end", "def precompiled_assets(clear_cache = T.unsafe(nil)); end", "def very_slow\n \"foo\" + \"bar\"\nend", "def cached?; end", "def cache_on?; end", "def cache_on?; end", "def auto_vivify?\n !fast?\n end", "def disable_caching=(_arg0); end", "def warmup(prc = T.unsafe(nil), &block); end", "def optimizely_obj\n p 'Checking to see if Optimizely object exists'\n # Checks to see if the optimizely_client variable has been intialized, if not it will run instantiate_optimizely method\n # Commenting this out temporarily to reinstantiate on every request for demo purposes\n # Uncomment line 44 and comment out line 45 to only instantiate Optimizely if it doesn't already exist\n # @@optimizely_client ||= instantiate_optimizely\n instantiate_optimizely\n end", "def go_faster\n ping_check \"go_faster\"\n end", "def optimize(_src, _dst, options = {})\n fail NotImplementedError, \"implement method optimize in #{self.class}\"\n end", "def optimize(**options)\n self.deep_dup\n end", "def compressor; end", "def optimize\n right\n end", "def optimize\n right\n end", "def freeze; end", "def optimize_workflow\n end", "def minimize; end", "def freeze() end", "def freeze() end", "def optimize\n left\n end", "def optimize\n left\n end", "def optimize\n left\n end", "def enable_gc_optimizations\n if GC.respond_to?(:copy_on_write_friendly=)\n GC.copy_on_write_friendly = true\n end\n end", "def benchmark\nend", "def unused_eager_loading_enable=(_arg0); end", "def speed_up(increment)\n BicycleInterface.api_not_implemented(self)\n end", "def used?; end", "def optimize!\n rsp = post(\"<optimize/>\")\n success?(rsp.body) or log_error(rsp.body)\n end", "def fast?\n settings['fast']\n end", "def pedal_faster\n\t\t@speed += 10\n\tend", "def fast_copies\n ENV['fast_copies'] == 'true' || ENV['fast_copies'] == 'yes'\n end", "def improve\n return false unless valid?\n true\n end", "def with_optimize_model_load(v)\n clone(:optimize_model_load=>v)\n end", "def request_debug_assets?; end", "def request_debug_assets?; end", "def without_cache(&block); end", "def without_cache(&block); end", "def runtime; end", "def standard_cost_code; end", "def one_gradable_ex_only\n end", "def disable_caching; end", "def benchmark_all!\n @benchmark_all = true\n end", "def memo; end", "def memoize_all; CurrentParser[:memoize]=:all; end", "def optimize\n if @raw_code.nil? || @raw_code.length == 0\n abort(\"Bad code.\")\n end\n \n #bf commands that can be optimized\n opt_comms = ['<', '>', '+', '-']\n \n #special command for the bf nil operator. '[-]' will always zero out the value\n #at the pointer, so shortcut it\n @raw_code = @raw_code.gsub(/\\[-\\]/, '=')\n \n #probably a more ruby-esque way to do this... find all optimizable commands\n #and find how many times they appear in order (sequential commands)\n i = 0\n while i < @raw_code.length do\n c, t = @raw_code[i, 1], @raw_code[i + 1, 1]\n j = 0\n \n if !(opt_comms.index(c).nil?) && t == c\n while t == c do\n j += 1\n i += 1\n t = @raw_code[i, 1]\n end\n i -= 1\n else\n j += 1\n end\n \n @opt_code.push(c).push(j)\n \n i += 1\n end\n \n stop = false\n i, j, l = 0, 0, 0\n \n #optimize bf loops, find the corresponding ']' to '[', so we can immediately\n #jump to that point instead of constantly having to look it up during run-time\n while i < @opt_code.length do\n l = i\n case @opt_code[i]\n when '['\n stop, j = false, 0\n while !(stop) do\n i += 2\n case @opt_code[i]\n when ']'\n stop = (j == 0)\n j -= 1\n when '['\n j + 1\n end\n end\n \n @opt_code[l + 1], @opt_code[i + 1] = i, l\n end\n \n i += 1\n end\n \n #puts @opt_code\n end", "def optimize\n right\n end", "def optimize\n right\n end", "def prepare_preferred_algorithms!; end", "def intern() end", "def optimize\n left\n end", "def optimize\n left\n end", "def optimize(image_path)\n print_status(\"Optimizing #{image_path}, this may take a while...\")\n ImageOptimizer.new(image_path, quiet: true).optimize\nend", "def parallelize_me!; end", "def frozen?; end", "def use_merging(use = T.unsafe(nil)); end", "def optimize\n @database.execute 'VACUUM'\n end", "def ready_optimizing?\n state == :READY_OPTIMIZING\n end", "def pedal_faster\n @current_speed = @current_speed+1\n end", "def recompile\n unmemoize(:compile)\n compile\n end", "def precompiled(local_keys); end", "def cached\n raise NotImplementedError\n end", "def cache=(_arg0); end", "def cache=(_arg0); end", "def cache=(_arg0); end", "def cache=(_arg0); end", "def use_cache?\n super && !against_head?\n end", "def use_cache?\n super && !against_head?\n end", "def restore_simple_run\n Gem::Compiler.class_eval do\n remove_method :simple_run\n alias_method :simple_run, :orig_simple_run\n end\n end", "def big_bad; end", "def optimize_image!(original)\n original = Path.convert(original)\n return unless (result = optimize_image(original))\n result.replace(original)\n OptimizedPath.new(original, result.original_size)\n end", "def optimize_image(original)\n original = Path.convert(original)\n return unless (workers = workers_for_image(original))\n\n optimized = @cache.fetch(original) do\n Handler.for(original) do |handler|\n current_worker = nil\n\n begin\n with_timeout(@timeout) do\n workers.each do |worker|\n current_worker = worker\n handler.process{ |src, dst| worker.optimize(src, dst) }\n end\n end\n rescue TimeoutExceeded => e\n if current_worker && current_worker.pid\n pid = current_worker.pid\n cleanup_process(pid)\n end\n\n raise e\n end\n end\n end\n\n return unless optimized\n OptimizedPath.new(optimized, original)\n end", "def precompile_assets; end", "def minify\n dup.minify!\n end", "def stand_alone?; end", "def stand_alone?; end", "def auto_analyze; end", "def used_invert\n\t\tif @used\n\t\t\t@used = false\n\t\telse\n\t\t\t@used = true\n\t\tend\n\tend", "def cache_value?; end", "def optimize\n session.optimize\n end" ]
[ "0.62257487", "0.5993082", "0.5793363", "0.5709998", "0.5661865", "0.56578344", "0.56454676", "0.56454676", "0.56454676", "0.56454676", "0.56454676", "0.56454676", "0.56454676", "0.560128", "0.5575395", "0.556824", "0.55442435", "0.5532482", "0.55274177", "0.5508869", "0.55024004", "0.55024004", "0.54716617", "0.5422914", "0.5421834", "0.5421834", "0.5401412", "0.5399704", "0.5369581", "0.5335403", "0.53225005", "0.5315853", "0.53103936", "0.52830505", "0.52813506", "0.52813506", "0.5272312", "0.5267054", "0.5259702", "0.5256928", "0.5256928", "0.52415943", "0.52415943", "0.52415943", "0.52379006", "0.52309704", "0.52059877", "0.52015936", "0.51983577", "0.5184565", "0.51636666", "0.5148252", "0.5141273", "0.5137157", "0.51366544", "0.51351994", "0.51351994", "0.51241326", "0.51241326", "0.5107297", "0.5104245", "0.5098394", "0.50858915", "0.5078716", "0.50767744", "0.5076233", "0.50757897", "0.50740486", "0.50740486", "0.5073652", "0.5072122", "0.5063929", "0.5063929", "0.5032408", "0.502632", "0.5024974", "0.50163776", "0.5015528", "0.5012013", "0.50027984", "0.50008523", "0.49941948", "0.49868083", "0.49787882", "0.49787882", "0.49787882", "0.49787882", "0.4978208", "0.4978208", "0.49778128", "0.49751568", "0.4974678", "0.49507895", "0.49471313", "0.494473", "0.49410427", "0.49410427", "0.49378213", "0.49375013", "0.49217436", "0.49145737" ]
0.0
-1
:nocov: Override Creator to use sequel_pg's Cbased parser instead of the pure ruby parser.
def call(string) Sequel::Postgres::PGArray.new(Sequel::Postgres.parse_pg_array(string, @converter), @type) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_parser( descriptor, file = nil )\n return RCC::Scanner::Interpreter::Parser.new( @parser_plan, open_source(descriptor, file) )\n end", "def build_parser( descriptor, file = nil )\n return RCC::Scanner::Interpreter::Parser.new( @parser_plan, open_source(descriptor, file) )\n end", "def initialize(opts = {})\n opts = opts.dup\n pg_version = opts.delete(:pg_version)\n if pg_version.is_a?( String )\n pg_version = pg_version.split( '.' ).map( &:to_i )\n end\n pg_version ||= []\n\n super\n\n # Phrase support starts in 9.6\n if ( pg_version <=> [9,6] ) >= 0\n # Handle what PG-sensitive chracters we can early as\n # whitespace. This can't include anything part of HumanQL,\n # e.g. ':' as used for scopes, so deal with the remainder\n # below.\n self.spaces = /[[:space:]*!<>\\0\\\\]+/.freeze\n else\n # Disable quote tokens\n self.lquote = nil\n self.rquote = nil\n # As above but add DQUOTE as well.\n self.spaces = /[[:space:]*!<>\\0\\\\\"]+/.freeze\n end\n\n # Use by custom #norm_phrase_tokens as a superset of the\n # #lparen, #rparen token patterns removed by default. In\n # PostgreSQL, the '|' and '&' still need to be filtered. Other\n # freestanding punctuation tokens are best removed entirely.\n @phrase_token_rejects = /\\A[()|&':]\\z/.freeze\n\n # SQUOTE is a problem only when at beginning of term.\n @lead_squote = /\\A'/.freeze\n\n # COLON is always a problem, but since its also part of Human QL\n # (scopes) it can't be included earlier in #spaces. Also per\n # scope parsing rules, its not always made a separate token.\n @term_rejects = /:/.freeze\n end", "def pluggable_parser; end", "def build(klazz_name)\n klazz_underscore = klazz_name.underscore\n klazzes = @repositories.map { |r| r.class_descriptors.filter(:rb_klazz => klazz_name).first }.compact\n raise StandardError if klazzes.empty?\n klazz = klazzes[-1] # keep the last one\n table = klazz.table\n if table.nil?\n raise ArgumentError # Fix this\n end\n string = %{\n$LOAD_PATH << Dir.pwd unless $LOAD_PATH.include? Dir.pwd\nrequire 'connection'\n\n}\n\n string = add_mapping_constants(klazz, klazz_name, string)\n string += string_methods(klazz_name)\n\n string << %{\n#{table}__#{klazz_name} = DB[:#{table}]\n#{table}__#{klazz_name}.identifier_input_method = :#{klazz_underscore}_db_in\n#{table}__#{klazz_name}.identifier_output_method = :#{klazz_underscore}_db_out\n}\n\n string << \"class #{klazz_name} < Sequel::Model\\n\"\n\n string << \" set_dataset #{table}__#{klazz_name}\\n\\n\"\n string = add_primary_keys(klazz, string)\n string = add_references(klazz, string)\n string = add_collections(klazz, string)\n string = add_ojb_entry(klazz, string)\n\n string << \"end\\n\"\n\n string << <<DEFN\nclass #{klazz_name}\n Definition = \"#{string}\"\n\n def self.definition\n OJBequel::Utils.less Definition\n end\nend\nDEFN\n\n #string << add_definition(klazz_name, string)\n string\n end", "def make_statement\n end", "def make_statement\n end", "def mkcompiler source=''\n VishCompiler.new source\nend", "def make_compiler(trim_mode)\n ERB::Compiler.new(trim_mode)\n end", "def compile_to_ruby_source_as parser_class_name\r\n result = \"class #{parser_class_name} < Dhaka::CompiledParser\\n\\n\"\r\n result << \" self.grammar = #{grammar.name}\\n\\n\"\r\n result << \" start_with #{start_state.id}\\n\\n\"\r\n states.each do |state|\r\n result << \"#{state.compile_to_ruby_source}\\n\\n\"\r\n end\r\n result << \"end\"\r\n result\r\n end", "def parser(name = T.unsafe(nil)); end", "def compile_parser(base, grammar_or_parser, opts={})\r\n compile(Class.new(base), grammar_or_parser, opts)\r\n end", "def parser; end", "def parser; end", "def parser; end", "def parser; end", "def build_parser\n code = ''\n\n %w[opal/ruby/nodes opal/ruby/parser opal/ruby/ruby_parser].each do |src|\n full = File.join OPAL_PATH, 'opal_lib', src + '.rb'\n compiled = compile_source full\n code += \"opal.register('#{src}.rb', #{compiled});\"\n end\n\n code += build_stdlib 'racc/parser.rb', 'strscan.rb', 'dev.rb'\n code += \"opal.require('dev');\"\n\n code\n end", "def parse(text)\n logprefix_match = LOG_LINE_PREFIX.match(text)\n database_name = \"UNKNOWN\"\n if logprefix_match\n text = \"LOG:\" + logprefix_match.post_match\n prefix = logprefix_match[1]\n database_match = DATABASE_NAME.match(prefix)\n if database_match\n database_name = database_match[1]\n end\n end\n logdebug_match = LOG_OR_DEBUG_LINE.match(text)\n if logdebug_match\n\n query_match = QUERY_STARTER.match(logdebug_match.post_match)\n if query_match\n return PGQueryStarter.new(query_match.post_match, nil, database_name)\n end\n\n duration_match = DURATION.match(logdebug_match.post_match)\n if duration_match\n additionnal_info = duration_match.post_match.strip.chomp\n if additionnal_info == \"\"\n return PGDurationLine.new(duration_match[1].strip, duration_match[2])\n else\n return PGQueryStarterWithDuration.new(additionnal_info, duration_match[1].strip, duration_match[2], database_name)\n end\n end\n\n status_match = STATUS.match(logdebug_match.post_match)\n if status_match\n return PGStatusLine.new(logdebug_match.post_match)\n end\n\n # $stderr.puts \"Unrecognized LOG or DEBUG line: #{text}\"\n return nil\n end\n\n error_match = ERROR_LINE.match(text)\n if error_match\n return PGErrorLine.new(error_match.post_match)\n end\n\n context_match = CONTEXT_LINE.match(text)\n if context_match\n return PGContextLine.new(context_match.post_match)\n end\n\n continuation_match = CONTINUATION_LINE.match(text)\n if continuation_match\n return PGContinuationLine.new(continuation_match.post_match)\n end\n\n statement_match = STATEMENT_LINE.match(text)\n if statement_match\n return PGStatementLine.new(statement_match.post_match)\n end\n\n hint_match = HINT_LINE.match(text)\n if hint_match\n return PGHintLine.new(hint_match.post_match)\n end\n\n detail_match = DETAIL_LINE.match(text)\n if detail_match\n return PGDetailLine.new(detail_match.post_match)\n end\n\n if text.strip.chomp == \"\"\n return PGContinuationLine.new(\"\")\n end\n\n # $stderr.puts \"Unrecognized PostgreSQL log line: #{text}\"\n return nil\n end", "def initialize(context, owner, file)\n# puts \"calling Compiler on #{file}\"\n @context = context\n @owner = owner\n @file = file\n utterance = ''\n File.open(file) do |f|\n f.each_line { |l| utterance << l }\n end\n # Since this is a new compiler, we need to wipe out any old compiler catalog stuff\n # Compiler.init_catalog(context)\n planner = OverlogPlanner.new(@context, utterance)\n planner.plan\n @the_program = planner.program\t\t\n\n # typeChecker = TypeChecker.new(@runtime, @the_program)\n # This is an XTC-ism\n # args = [\"-no-exit\", \"-silent\", file]\n # run(args)\n\n # if (runtime.errorCount > 0) then\n # @the_program.definitions.each { |table| Table.drop(table.name) }\n # end\n end", "def initialize(info = {})\n super(update_info(info,\n 'Name' => 'PostgreSQL for Linux Payload Execution',\n 'Description' => %q{\n On some default Linux installations of PostgreSQL, the\n postgres service account may write to the /tmp directory, and\n may source UDF Shared Libraries from there as well, allowing\n execution of arbitrary code.\n\n This module compiles a Linux shared object file, uploads it to\n the target host via the UPDATE pg_largeobject method of binary\n injection, and creates a UDF (user defined function) from that\n shared object. Because the payload is run as the shared object's\n constructor, it does not need to conform to specific Postgres\n API versions.\n },\n 'Author' =>\n [\n 'midnitesnake', # this Metasploit module\n 'egypt', # on-the-fly compiled .so technique\n 'todb', # original windows module this is based on\n 'lucipher' # updated module to work on Postgres 8.2+\n ],\n 'License' => MSF_LICENSE,\n 'References' =>\n [\n [ 'CVE', '2007-3280' ],\n [ 'URL', 'http://www.leidecker.info/pgshell/Having_Fun_With_PostgreSQL.txt' ]\n ],\n 'Platform' => 'linux',\n 'Payload' =>\n {\n 'Space' => 65535,\n 'DisableNops' => true,\n },\n 'Targets' =>\n [\n [ 'Linux x86', { 'Arch' => ARCH_X86 } ],\n [ 'Linux x86_64', { 'Arch' => ARCH_X64 } ],\n ],\n 'DefaultTarget' => 0,\n 'DisclosureDate' => '2007-06-05'\n\n ))\n\n deregister_options('SQL', 'RETURN_ROWSET')\n end", "def parser( &block )\n nested_class( 'Parser', Yacl::Define::Cli::Parser, &block )\n end", "def parser=(_arg0); end", "def build_statement(constructor, field, options = T.unsafe(nil)); end", "def ruby_parser\n @ruby_parser ||= parser_for_version ruby_version\n end", "def parser\n Parser.new(self, :mode=>mode)\n end", "def connect(handler) \n sequel_db = ::Sequel.connect(handler)\n schema = Rubyrel::DDL::Schema.new(:noname)\n schema.__load_from_database(sequel_db)\n ::Rubyrel::Database.new(schema, sequel_db)\n end", "def oracle; end", "def create_proc(name, columns=[], options={}, &block)\n if select_value(\"SELECT count(oid) FROM pg_language WHERE lanname = 'plpgsql' \",\"count\").to_i == 0\n# execute(\"CREATE FUNCTION plpgsql_call_handler() RETURNS language_handler AS '$libdir/plpgsql', 'plpgsql_call_handler' LANGUAGE c\")\n execute(\"CREATE TRUSTED PROCEDURAL LANGUAGE plpgsql HANDLER plpgsql_call_handler\")\n end\n\n if options[:force]\n drop_proc(name, columns) rescue nil\n end\n\n if block_given?\n execute get_proc_query(name, columns, options) { yield }\n elsif options[:resource]\n execute get_proc_query(name, columns, options)\n else\n raise StatementInvalid.new(\"Missing function source\")\n end\n end", "def initialize(db, opts = nil)\n @db = db\n @quote_identifiers = db.quote_identifiers? if db.respond_to?(:quote_identifiers?)\n @opts = opts || {}\n @row_proc = nil\n @transform = nil\n end", "def create_language_sql(name, opts=OPTS)\n \"CREATE#{' OR REPLACE' if opts[:replace] && server_version >= 90000}#{' TRUSTED' if opts[:trusted]} LANGUAGE #{name}#{\" HANDLER #{opts[:handler]}\" if opts[:handler]}#{\" VALIDATOR #{opts[:validator]}\" if opts[:validator]}\"\n end", "def configure_parser; end", "def to_parser\n parser = Racc::GrammarFileParser.new\n result = parser.parse to_yacc\n nfa = Racc::States.new(result.grammar).nfa\n parsegen = Racc::ParserFileGenerator.new nfa.dfa, result.params\n parser_src = parsegen.generate_parser\n\n if $DEBUG\n puts \"############# PARSED GRAMMAR\"\n puts parser_src\n puts \"############# END PARSED GRAMMAR\"\n end\n\n Module.new { class_eval parser_src }.const_get('GeneratedGrammar')\n end", "def parser (tokens)\n\n\t# create the new, concrete syntax tree\n\t# making it global to reduce headaches (hopefully XD )\n\t$cst = ConcreteSyntaxTree.new\n\t\n\t# define some other useful, global vars\n\t$tokens = tokens\n\t$index = 0\n\t\n\t# have to ask alan about this\n\tif $tokens.length <= 1\n\t\tputs \"Insufficient code present! There is only #{$tokens.length} token here!\"\n\t\texit\n\tend\t\n\t\n\t\n\t# Engine to full burn!!!\n\t#parse(\"Program\", program)\n\tprogram\n\t\n\t\n\tbegin\n\t\tif $tokens.length != $index\n\t\t\traise EOFDetectionError.new(\"early\", $tokens[$index - 1].lineno, $tokens[$index - 1].pos)\n\t\tend\n\trescue EOFDetectionError\n\tend\n\t\t\n\t\n\t\n\treturn $cst\nend", "def force_parse; end", "def create_table\n puts \"Creating table >> PEOPLE\"\n $db.execute %q{\n CREATE TABLE people(\n id integer primary key,\n name varchar(50),\n job varchar(50),\n gender varchar(6),\n age integer\n )\n }\nend", "def new_model(auto_migrate = true, &block)\n DB.create_table! :foo do\n primary_key :id\n column :state, :string\n end if auto_migrate\n model = Class.new(Sequel::Model(:foo)) do\n self.raise_on_save_failure = false\n def self.name; 'SequelTest::Foo'; end\n end\n model.plugin(:validation_class_methods) if model.respond_to?(:plugin)\n model.plugin(:hook_class_methods) if model.respond_to?(:plugin)\n model.class_eval(&block) if block_given?\n model\n end", "def parse(source, options = T.unsafe(nil)); end", "def parse(source, options = T.unsafe(nil)); end", "def generate_ruby sexp\n ruby = Ruby2Ruby.new.process(sexp)\n ruby.sub!(/\\A(def \\S+)\\(([^\\)]*)\\)/, '\\1 |\\2|') # move args\n ruby.sub!(/\\Adef[^\\n\\|]+/, 'proc { ') # strip def name\n ruby.sub!(/end\\Z/, '}') # strip end\n ruby.gsub!(/\\s+$/, '') # trailing WS bugs me\n ruby\n end", "def initialize(interpreter, opts={})\n self.interpreter = interpreter\n self.default_db = opts[:default_db] || \"mysql\"\n self.dba = opts[:dba] || \"root\"\n\n end", "def target_postgresql_version=(_arg0); end", "def initialize(db, stmt)\n @db = db\n @stmt = stmt\n end", "def initialize\n compiler = Treetop::Compiler::GrammarCompiler.new\n @where = File.expand_path(File.dirname(__FILE__))\n grammar = File.join(@where, 'seqpar.treetop')\n output = File.join(@where, 'seqpar.rb')\n compiler.compile(grammar, output)\n load output\n File.delete(output)\n @parser = SeqParParser.new\n end", "def compile\n raise NotImplementedError\n end", "def create_proc(name, columns=[], options={}, &block)\n if select_value(\"SELECT count(oid) FROM pg_language WHERE lanname = 'plpgsql' \",\"count\").to_i == 0\n execute(\"CREATE FUNCTION plpgsql_call_handler() RETURNS language_handler AS '$libdir/plpgsql', 'plpgsql_call_handler' LANGUAGE c\")\n execute(\"CREATE TRUSTED PROCEDURAL LANGUAGE plpgsql HANDLER plpgsql_call_handler\")\n end\n\n if options[:force]\n drop_proc(name, columns) rescue nil\n end\n\n if block_given?\n execute get_proc_query(name, columns, options) { yield }\n elsif options[:resource]\n execute get_proc_query(name, columns, options)\n else\n raise StatementInvalid.new(\"Missing function source\")\n end\n end", "def create_table\n puts \"Creating people table\"\n $db.execute %q{\n CREATE TABLE people(\n id integer primary key,\n name varchar(50),\n job varchar(50),\n gender varchar(6),\n age integer\n )\n }\nend", "def prepare(str, &block)\n st = Statement.new self\n st.prepare str\n if block\n begin\n return block.call(st)\n ensure\n st.close\n end\n end\n return st\n end", "def create_products_table\n c = PGconn.new(:host => \"localhost\", :dbname => dbname)\n c.exec %q{\n CREATE TABLE products (\n id SERIAL PRIMARY KEY,\n name varchar(255),\n price decimal,\n description text\n );\n }\n c.close\nend", "def prepare_args_parser\n @args_parser = Trollop::Parser.new do\n banner \"CRake #{Version::STRING} command-line tool\"\n banner \"\\nusage: crake [path] [options]\"\n banner \"\\nOptions:\"\n\n opt :generator, \"Project generator (see the list of supported generators below). If no generator is given, internally the generator will be set to Unknown and there might be generation errors.\",\n :type => String\n opt :version, \"Show CRake version\"\n opt :input, \"Set a specific input file\", :type => String, :default => 'CRakefile'\n opt :output, \"Set a specific output file\", :type => String, :default => 'CMakeLists.txt'\n opt :cmakeopts, \"Set some specific command options as a string literal to be passed to CMake\"\n opt :nocmake, \"Dont call CMake. Only generate the output file\"\n opt :verbose, \"Verbose generation output\"\n opt :help, \"Show this help message\"\n\n banner \"\\nGenerators:\"\n banner \"gen 1\"\n end\n end", "def initialize parser\n @parser = parser\n end", "def make_cpp name, _attr = nil\n\n\ts = \"#include \\\"#{name}.hpp\\\"\\n\\n\"\n\ts << \"// STATIC ########################################################\\n\\n\"\n\ts << \"// ###############################################################\\n\\n\"\n\ts << \"// CANONICAL #####################################################\\n\\n\"\n\ts << \"#{name}::#{name} ( void )\\n\"\n\ts << \"{\\n\"\n\ts << \"\treturn ;\\n\"\n\ts << \"}\\n\\n\"\n\ts << \"#{name}::#{name} ( #{name} const & src )\\n\"\n\ts << \"{\\n\"\n\ts << \"\t*this = src;\\n\"\n\ts << \"\treturn ;\\n\"\n\ts << \"}\\n\\n\"\n\ts << \"#{name} &\t\t\t\t#{name}::operator=( #{name} const & rhs )\\n\"\n\ts << \"{\\n\"\n\ts << \"\tif (this != &rhs)\\n\"\n\ts << \"\t{\\n\"\n\tif _attr\n\t\t_attr.each do |a|\n\t\t\tv = a.split('_')\n\t\t\ts << \"\t\tthis->_#{v.last} = rhs.get#{v.last.slice(0,1).capitalize + v.last.slice(1..-1)}();\\n\"\n\t\tend\n\telse\n\t\ts << \"\t\t// make stuff\\n\"\n\tend\n\ts << \"\t}\\n\"\n\ts << \"\treturn (*this);\\n\"\n\ts << \"}\\n\\n\"\n\ts << \"#{name}::~#{name} ( void )\\n\"\n\ts << \"{\\n\"\n\ts << \"\treturn ;\\n\"\n\ts << \"}\\n\\n\"\n\ts << \"// ###############################################################\\n\\n\"\n\ts << \"// CONSTRUCTOR POLYMORPHISM ######################################\\n\\n\"\n\ts << \"// ###############################################################\\n\\n\"\n\ts << \"// OVERLOAD OPERATOR #############################################\\n\\n\"\n\ts << \"std::ostream &\t\t\t\toperator<<(std::ostream & o, #{name} const & i)\\n{\\n\"\n\ts << \"\\t(void)i;\\n\\treturn (o);\"\n\ts << \"\\n}\\n\\n// ###############################################################\\n\\n\"\n\ts << \"// PUBLIC METHOD #################################################\\n\\n\"\n\ts << \"// ###############################################################\\n\\n\"\n\ts << \"// GETTER METHOD #################################################\\n\\n\"\n\tif _attr\n\t\t_attr.each do |a|\n\t\t\tv = a.split('_')\n\t\t\ts << \"#{v.first}\t\t\"\n\t\t\ts << \"\t\" if v.first.length < 16\n\t\t\ts << \"\t\" if v.first.length < 11\n\t\t\ts << \"\t\" if v.first.length < 6\n\t\t\ts << \"#{name}::get#{v.last.slice(0,1).capitalize + v.last.slice(1..-1)}( void ) const noexcept\\n\"\n\t\t\ts << \"{\\n\"\n\t\t\ts << \"\treturn(this->_#{v.last});\\n\"\n\t\t\ts << \"}\\n\"\n\t\tend\n\t\ts << \"\\n\"\n\tend\n\ts << \"// ###############################################################\\n\\n\"\n\ts << \"// SETTER METHOD #################################################\\n\\n\"\n\ts << \"// ###############################################################\\n\\n\"\n\ts << \"// PRIVATE METHOD ################################################\\n\\n\"\n\ts << \"// ###############################################################\\n\\n\"\n\ts << \"// EXCEPTION METHOD ##############################################\\n\\n\"\n\ts << \"// ###############################################################\\n\\n\"\n\ts << \"// EXTERNAL ######################################################\\n\\n\"\n\ts << \"// ###############################################################\\n\"\n\tputs \"create #{name}.cpp\"\n\ts\nend", "def compile(spec)\n handle_exceptions {\n @oneline = spec.index(\"\\n\").nil?\n @spec = spec.sub(/^\\s*\\n/, \"\")\n @file = find_caller_file\n @tokens = Lexer.lex(name, @spec, @oneline)\n ast = Parser.parse(tokens)\n\n help_spec = (@help == true ? \"-h,help\" : @help)\n version_spec = (@version == true ? \"--version\" : @version)\n quiet_spec = (@quiet == true ? \"-q,quiet\" : @quiet)\n verbose_spec = (@verbose == true ? \"+v,verbose\" : @verbose)\n debug_spec = (@debug == true ? \"--debug\" : @debug)\n\n @quiet_option = \n ast.inject_option(quiet_spec, \"Quiet\", \"Do not write anything to standard output\") if @quiet\n @verbose_option = \n ast.inject_option(verbose_spec, \"Increase verbosity\", \"Write verbose output\") if @verbose\n @debug_option = \n ast.inject_option(debug_spec, \"Write debug information\") if @debug\n @help_option = \n ast.inject_option(help_spec, \"Write short or long help\") { |option|\n short_option = option.short_names.first \n long_option = option.long_names.first\n [\n short_option && \"#{short_option} prints a brief help text\",\n long_option && \"#{long_option} prints a longer man-style description of the command\"\n ].compact.join(\", \")\n } if @help\n @version_option = \n ast.inject_option(version_spec, \"Write version number and exit\") if @version\n\n @grammar = Analyzer.analyze(ast)\n }\n self\n end", "def initialize(opts = {}, &block)\n @opts = opts\n \n @quote_identifiers = opts[:quote_identifiers] || @@quote_identifiers\n @single_threaded = opts[:single_threaded] || @@single_threaded\n @schemas = nil\n @pool = (@single_threaded ? SingleThreadedPool : ConnectionPool).new(connection_pool_default_options.merge(opts), &block)\n @pool.connection_proc = proc {connect} unless block\n\n @loggers = Array(opts[:logger]) + Array(opts[:loggers])\n ::Sequel::DATABASES.push(self)\n end", "def Factory(name, *args, &block)\n puts \"*** WARNING *** You should migrate over to using the proper Cobble methods as this won't be here forever!\"\n Cobble.create(name, *args, &block)\nend", "def compile_plan()\n return Plan::ParserPlan.build( self )\n end", "def prepare( str )\n @db.prepare( str )\n end", "def initialize( db, stmt )\n @db = db\n @driver = @db.driver\n @stmt = stmt\n commence\n end", "def standard_parser(file)\n resource_path = 'db/mappings/seed'\n CSV.foreach(Rails.root.join(resource_path, file)) do |result|\n standard = Standard.find_or_create_by(name: result[0], abbreviation: result[1])\n end\nend", "def parser\n @parser ||= Parser.new(self)\n end", "def parser\n @parser ||= Parser.new(self)\n end", "def configure_postgres\n<<BASH\necho \"deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main\" > /etc/apt/sources.list.d/pgdg.list\nwget --quiet https://www.postgresql.org/media/keys/ACCC4CF8.asc\napt-key add ACCC4CF8.asc\napt-get update\napt-get install postgresql-9.2 -y\necho \"host all all #{CS_VM_ADDRESS}/32 md5\" >> /etc/postgresql/9.2/main/pg_hba.conf\necho \"listen_addresses='*'\" >> /etc/postgresql/9.2/main/postgresql.conf\nservice postgresql restart\nexport PATH=/usr/lib/postgresql/9.2/bin:$PATH\nsudo -u postgres psql -c \"CREATE USER bofh SUPERUSER ENCRYPTED PASSWORD 'i1uvd3v0ps';\"\nBASH\nend", "def create_reader_comments(db)\r\n create_reader_comments_cmd = <<-SQL\r\n CREATE TABLE IF NOT EXISTS reader_comments(\r\n comment_id INTEGER PRIMARY KEY,\r\n comments VARCHAR(255),\r\n reader_id INTEGER,\r\n book_id INTEGER,\r\n FOREIGN KEY (reader_id) REFERENCES book_readers(reader_id),\r\n FOREIGN KEY (book_id) REFERENCES my_books(book_id)\r\n )\r\n SQL\r\n #create reader comments table\r\n # reader_id INTEGER,\r\n # book_id INTEGER,\r\n # FOREIGN KEY (reader_id) REFERENCES book_readers(reader_id),\r\n # FOREIGN KEY (book_id) REFERENCES my_books(book_id),\r\n db.execute(create_reader_comments_cmd)\r\nend", "def build_compiler\n node_name = nodename(:function)\n fact_values = facts_hash(node_name)\n\n # if we specify a pre_condition, we should ensure that we compile that\n # code into a catalog that is accessible from the scope where the\n # function is called\n Puppet[:code] = pre_cond\n\n node_options = {\n :parameters => fact_values,\n }\n\n stub_facts! fact_values\n\n node = build_node(node_name, node_options)\n\n compiler = Puppet::Parser::Compiler.new(node)\n compiler.compile\n compiler\n end", "def stmt_init\n Stmt.new @protocol, @charset\n end", "def compile(code, force=false)\r\n raise DBGeni::NotImplemented\r\n end", "def initialize(db, column_parser)\n @column_parser = column_parser\n @db = db\n end", "def compile\n end", "def schema_table_posts_content\n <<-MYSQL\nCREATE TABLE posts_content\n (\n id INTEGER,\n # Ajouté pour la version 2.0 :\n created_at INTEGER(10),\n updated_at INTEGER(10),\n content TEXT NOT NULL,\n\n PRIMARY KEY (id)\n )\n MYSQL\nend", "def create_parser(command_name)\n OptionParser.new do |parser|\n parser.banner = \"Usage: ./project.rb #{command_name} [options]\"\n parser\n end\nend", "def create_table(table_name)\n # translate into pinyin, then to symbol\n table = trans_pinyin(table_name).to_sym\n DB.create_table table do\n primary_key :id\n String :mid, :unique=>true\n DateTime :created_timestamp\n String :content, :text => true\n String :source\n String :user_id\n String :user_name\n String :user_gender\n Integer :user_status_count\n Integer :user_fansNum\n end\n return table\nend", "def create_authors(db)\r\n create_authors_cmd = <<-SQL\r\n CREATE TABLE IF NOT EXISTS authors(\r\n author_id INTEGER PRIMARY KEY,\r\n author_name VARCHAR(255)\r\n )\r\n SQL\r\n #create authors table\r\n db.execute(create_authors_cmd)\r\nend", "def initialize( db, sql )\n @db = db\n @statement = ParsedStatement.new( sql )\n @remainder = @statement.trailing\n @sql = @statement.to_s\n end", "def parse(source); end", "def initialize(opts={})\n if opts[:parser]\n @parser = opts[:parser]\n elsif opts[:grammar_file] and opts[:grammar_class]\n if @@parsers[opts[:grammar_class]]\n # already compiled the grammar, just use it\n @parser = @@parsers[opts[:grammar_class]]\n else\n # load the grammar\n Treetop.load(opts[:grammar_file])\n cls = eval(opts[:grammar_class])\n @parser = cls.new\n end\n else\n raise ArgumentError.new(\"Specify either :parser or :grammar_file and :grammar_class\")\n end\n end", "def target_postgresql_version; end", "def create_movies_table\n c = PGconn.new(:host => \"localhost\", :dbname => \"test\")\n c.exec %q{\n CREATE TABLE movies (\n id PRIMARY KEY,\n title TEXT,\n description TEXT,\n rating INTEGER\n );\n }\n c.close\nend", "def create_book_readers(db)\r\n create_book_readers_cmd = <<-SQL\r\n CREATE TABLE IF NOT EXISTS book_readers(\r\n reader_id INTEGER PRIMARY KEY,\r\n reader_name VARCHAR(255)\r\n )\r\n SQL\r\n #create the table\r\n db.execute(create_book_readers_cmd)\r\nend", "def create_table\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 4 )\n return_value = CreateTableReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n string_literal13 = nil\n __ID14__ = nil\n char_literal15 = nil\n char_literal17 = nil\n string_literal19 = nil\n create_table_def16 = nil\n create_table_def18 = nil\n\n tree_for_string_literal13 = nil\n tree_for_ID14 = nil\n tree_for_char_literal15 = nil\n tree_for_char_literal17 = nil\n tree_for_string_literal19 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 28:5: 'create table' ID '(' create_table_def ( ',' create_table_def )* ');'\n string_literal13 = match( CREATE_TABLE, TOKENS_FOLLOWING_CREATE_TABLE_IN_create_table_151 )\n\n tree_for_string_literal13 = @adaptor.create_with_payload( string_literal13 )\n root_0 = @adaptor.become_root( tree_for_string_literal13, root_0 )\n\n __ID14__ = match( ID, TOKENS_FOLLOWING_ID_IN_create_table_154 )\n\n tree_for_ID14 = @adaptor.create_with_payload( __ID14__ )\n @adaptor.add_child( root_0, tree_for_ID14 )\n\n char_literal15 = match( T__17, TOKENS_FOLLOWING_T__17_IN_create_table_156 )\n @state.following.push( TOKENS_FOLLOWING_create_table_def_IN_create_table_159 )\n create_table_def16 = create_table_def\n @state.following.pop\n @adaptor.add_child( root_0, create_table_def16.tree )\n # at line 28:46: ( ',' create_table_def )*\n while true # decision 4\n alt_4 = 2\n look_4_0 = @input.peek( 1 )\n\n if ( look_4_0 == T__18 )\n alt_4 = 1\n\n end\n case alt_4\n when 1\n # at line 28:47: ',' create_table_def\n char_literal17 = match( T__18, TOKENS_FOLLOWING_T__18_IN_create_table_162 )\n @state.following.push( TOKENS_FOLLOWING_create_table_def_IN_create_table_165 )\n create_table_def18 = create_table_def\n @state.following.pop\n @adaptor.add_child( root_0, create_table_def18.tree )\n\n else\n break # out of loop for decision 4\n end\n end # loop for decision 4\n string_literal19 = match( T__19, TOKENS_FOLLOWING_T__19_IN_create_table_169 )\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 4 )\n\n end\n \n return return_value\n end", "def create_movies_table\n c = connect\n # this is another way to write a string, using %q{}\n c.exec %q{ \n CREATE TABLE movies (\n id SERIAL PRIMARY KEY,\n title TEXT,\n description TEXT,\n rating INTEGER\n );\n }\n c.close\nend", "def target_sql_mode=(_arg0); end", "def sql\n @parser.sql\n end", "def sql\n @parser.sql\n end", "def parse(argv)\n rdoc_parse(argv)\n if %w{redfish twofish blackfish longfish onefish newfish}.include?(@template)\n require \"webri/generators/#{template}\"\n @generator = WebRI.const_get(@template.capitalize)\n end\n end", "def compile!\n raise NotImplementedError\n end", "def create_parser(options)\n parser = OptionParser.new\n\n parser.on \"-o DIR\", \"--output-dir DIR\", \"Specify custom output directory\" do |value|\n options.custom_output_dir_set = true\n options.custom_output_dir_value = value\n end\n parser.on \"-s FILENAME\", \"--single-file FILENAME\", \"Output all quotes in a single file\" do |name|\n options.single_file = true\n options.single_file_name = name\n end\n parser.on \"-l\", \"--list-categories\", \"List all available categories\" do\n options.list_only = true\n end\n\n parser.on \"-h\", \"--help\", \"Print this help text\" do\n puts parser\n exit\n end\n\n parser.on \"-v\", \"--version\", \"Print program version\" do\n puts \"gnomikologikon-fortune #{Gnomika::Ruby::VERSION}\"\n exit\n end\n end", "def construct_new_object(db_object)\n end", "def connect( *args )\n return PG::Connection.new( *args )\n end", "def pre_exec\n OptionParser.new do |opt|\n opt.banner = \"vermillion create [...-flags]\"\n\n opt.on(\"-n\", \"--name=NAME\", \"Directory to be created\") { |o| @name = o }\n end.parse!\n\n super\n end", "def parser\n dsl.parser\n end", "def process(parser)\n end", "def generate_syntax_tree\n build_ast(@parse_tree).first\n end", "def ruby_bnf_grammar_parser\r\n parser = nil\r\n time_and_puts(\"Generating parser for Ruby BNF grammar\") do\r\n begin\r\n parser = Parse.generate_parser <<-'EOG'\r\nGrammar BnfGrammars\r\n Tokens\r\n Blank = /\\s+/ [:Skip]\r\n EpsilonComment = /\\/\\* none \\*\\//\r\n Nonterm = /[a-z][a-z_\\d]*/ \r\n Keyword = /k\\w+/\r\n Token = /t[A-Z_\\d]+/\r\n String = /'[^']*'/\r\n Productions\r\n BnfGrammar -> Prod+ [: productions]\r\n Prod -> Nonterm ':' list(Alt, '|') [: nonterm,_,alts]\r\n Alt -> Element* [: elements]\r\n Element -> (Nonterm | Keyword | Token | \r\n String | EpsilonComment) [^]\r\nEOG\r\n rescue Exception => e\r\n puts e.inspect\r\n exit -1\r\n end\r\n end\r\n parser\r\nend", "def create_book_owners(db)\r\n create_book_owners_cmd = <<-SQL\r\n CREATE TABLE IF NOT EXISTS book_owners(\r\n owner_id INTEGER PRIMARY KEY,\r\n owner_name VARCHAR(255)\r\n )\r\n SQL\r\n #create book_owners table \r\n db.execute(create_book_owners_cmd)\r\nend", "def initialize(arg, respect_whitespace = T.unsafe(nil), parent = T.unsafe(nil), raw = T.unsafe(nil), entity_filter = T.unsafe(nil), illegal = T.unsafe(nil)); end", "def initialize_pragmas!\n execute(%q(PRAGMA encoding = \"UTF-8\";))\n execute(%q(PRAGMA foreign_keys = ON;))\n execute(%q(PRAGMA secure_delete = ON;))\n execute(%q(PRAGMA synchronous = FULL;))\n end", "def compiler\n @compiler ||= Compiler.new(self)\n end", "def compiler\n @compiler ||= Compiler.new(self)\n end", "def parser\n @parser ||= Parser.new(self)\n end", "def parse_statements(content)\n case parser_type\n when :c\n CParser.new(content, file).parse\n when :ruby18\n Ruby::Legacy::StatementList.new(content)\n when :ruby\n Ruby::RubyParser.parse(content, file)\n else\n raise ArgumentError, \"invalid parser type or unrecognized file\"\n end\n end", "def schema_table_projets\n <<-MYSQL\nCREATE TABLE projets\n (\n # ID\n # --\n # IDentifiant du projet, pas forcément le même que l'ID\n # du programme auquel il est associé.\n id INTEGER AUTO_INCREMENT,\n\n # TITRE\n # ------\n # Titre du projet\n # Il n'est pas obligatoire et, surtout, il n'est pas encore\n # défini à la création du projet. Par défaut, on met \"sans titre\"\n titre VARCHAR(255) DEFAULT 'Sans titre',\n\n # AUTEUR_ID\n # ---------\n # ID de l'auteur du projet\n auteur_id INTEGER NOT NULL,\n\n # PROGRAM_ID\n # ----------\n # ID du programme auquel est associé le projet.\n # C'est une valeur non nulle car un projet ne peut pas\n # être dissocié d'un programme ÉCRIRE UN ROMAN/FILM EN UN AN\n program_id INTEGER NOT NULL,\n\n # RÉSUMÉ\n # ------\n # Le résumé (littéraire) du projet\n resume TEXT,\n\n # SPECS\n # -----\n # Spécificités du projet, comme le fait que ce soit un\n # roman, etc.\n # Chaque bit représente une spécificité. Cf. le fichier\n # ./objet/unan/lib/required/projet/specs.rb pour le détail.\n specs VARCHAR(32),\n\n # CREATED_AT\n # ----------\n # Timestamp de la création du projet\n created_at INTEGER(10),\n\n # UPDATED_AT\n # ----------\n # Timestamp de la modification de cette donnée\n updated_at INTEGER(10),\n\n\n PRIMARY KEY (id)\n );\n MYSQL\nend", "def parser=(p)\n @@parser = choose_parser(p)\n end" ]
[ "0.56453454", "0.56453454", "0.5338402", "0.53379583", "0.5316389", "0.5303565", "0.5303565", "0.5268382", "0.52607775", "0.5249844", "0.51770294", "0.51506877", "0.512202", "0.512202", "0.512202", "0.512202", "0.5100584", "0.4981298", "0.49351522", "0.4934469", "0.49226242", "0.4910596", "0.4886294", "0.48661706", "0.48589215", "0.48457682", "0.484134", "0.47953337", "0.47874174", "0.47686625", "0.47656158", "0.47607863", "0.4760195", "0.47448292", "0.47419545", "0.47411522", "0.47224656", "0.47224656", "0.4719276", "0.46991998", "0.4698686", "0.46912232", "0.46906525", "0.46900156", "0.46872056", "0.4685102", "0.46773297", "0.4662662", "0.46611238", "0.46601132", "0.46578205", "0.46505475", "0.46461666", "0.46421015", "0.46325925", "0.4622332", "0.46102548", "0.46019495", "0.45965564", "0.45965564", "0.45881405", "0.4585741", "0.45837417", "0.45766965", "0.45572016", "0.45538083", "0.4549183", "0.45477802", "0.45430744", "0.45360833", "0.45340556", "0.45262063", "0.45258066", "0.45176575", "0.45102006", "0.45077875", "0.44992268", "0.4496561", "0.44919583", "0.44915903", "0.44840187", "0.44840187", "0.447608", "0.4469089", "0.44683817", "0.44652382", "0.44630694", "0.4459719", "0.44591555", "0.44545567", "0.44478092", "0.44421634", "0.44406885", "0.4429052", "0.44250327", "0.44249398", "0.44249398", "0.44207004", "0.44196254", "0.4416998", "0.44155443" ]
0.0
-1
GET /users GET /users.json GET /users/1 GET /users/1.json
def index @users = User.all @users = User.select('nationality, AVG(point) AS avg_point').group(:nationality) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n end", "def users(args = {})\n get(\"/users.json\",args)\n end", "def list_users\n self.class.get('/users')\n end", "def GetUsers params = {}\n\n params = params.merge(path: 'users.json')\n APICall(params)\n\n end", "def show\n begin\n user = User.find(params[:user_id])\n render json: { users: user }, status: :ok\n rescue => e\n render json: { errors: e.message}, status: 404\n end\n end", "def GetUser id\n\n APICall(path: \"users/#{id}.json\")\n\n end", "def users\n get('get_users')\n end", "def get \n render :json => User.find(params[:id])\n end", "def fetch_one_user_data\n get_url(\"/api/v1/users/#{@filter}\")\n end", "def show\n # When a http GET request to '/users/1' is received, have it show,\n # in json format, user 1's information.\n @id = params[:id]\n @user = User.find(@id)\n render json: @user\n end", "def show\n @users = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @users }\n end\n end", "def users(params = {})\n make_get_request('/account/users', params)\n end", "def index\n\t\t# specifying json format in the URl\n\t uri = \"#{API_BASE_URL}/users.json\"\n\t # It will create new rest-client resource so that we can call different methods of it\n\t rest_resource = RestClient::Resource.new(uri, USERNAME, PASSWORD)\n\n\t # this next line will give you back all the details in json format, \n\t #but it will be wrapped as a string, so we will parse it in the next step.\n\t users = rest_resource.get \n\n\t # we will convert the return data into an array of hash. see json data parsing here\n\t @users = JSON.parse(users, :symbolize_names => true)\n\tend", "def index\n users = User.all\n render json: { users: users }, status: :ok\n end", "def index\n users = User.all\n\n render json: users, each_serializer: Api::V1::UsersSerializer\n end", "def index\n users = User.all\n json_response(users)\n end", "def show\n render json: Users.find(params[\"id\"])\n end", "def show\n @users = User.all\n json_response(@users)\n end", "def get_users(request); end", "def user\n render :json=> User.find(params[:id])\n end", "def get_by_id\n \n # the user_id param comes from our route\n user = User.find(params[:user_id])\n \n if user\n render json: user, status: :ok\n else\n render json: { errors: 'User not found' }, status: :not_found\n end\n end", "def index\n json_response(User.all) \n end", "def show\n @users = User.find(params[:id])\n if @users\n respond_to do |format|\n format.json { render :json => @users }\n format.xml { render :xml => @users }\n end\n else\n head :not_found\n end\n end", "def index\n @users = User.all(limit: 100)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users.as_json(user: current_user) }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html\n format.json { render json: @users }\n end\n end", "def index\n \n @users = User.page(params[:page]).per_page(14)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n \n end", "def index\n @users = User.all\n render json: @users, status: :ok\n end", "def query_users(options={}) path = \"/api/v2/users\"\n get(path, options, AvaTax::VERSION) end", "def users(params = {})\n params.merge!(key: 'users')\n objects_from_response(Code42::User, :get, 'user', params)\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 index\n @users = User.all\n\n respond_with do |format|\n format.json do\n render json: @users,\n each_serializer: Api::UserSerializer,\n root: 'users'\n end\n end\n end", "def list\r\n users = User.all\r\n render json: users\r\n end", "def show\n render json: UserService.get_user(params[:id]), includes: 'questions, answers'\n end", "def list_users(user_id)\n self.class.get(\"/users/#{user_id}\")\n end", "def index\n user= User.all\n render json: {users:user}\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 user(user=nil)\n if user\n get(\"/users/#{user}\", {}, 3)\n else\n get(\"/user\", {}, 3)\n end\n end", "def user(id = nil)\n id.to_i.zero? ? get('/user') : get(\"/users/#{id}\")\n end", "def get_current_logged_in_user \n get(\"/users.json/current\")\nend", "def get_current_logged_in_user \n get(\"/users.json/current\")\nend", "def index\n @users = User.all\n render json: @users, status: :ok\n end", "def index\n users = User.all\n render json: users\n end", "def index\n users = User.all\n render json: users\n end", "def index\n users = User.all\n render json: users\n end", "def index\n users = User.all\n render json: users\n end", "def index\n @users = User.all\n logger.debug(\"user index\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\r\n users = User.all\r\n render json: users\r\n end", "def index\n \t@users = User.all\n\n respond_to do |format| \n format.json { render json: @users }\n end\n end", "def users_for_a_project\n uri = \"#{@api_url}/#{@project_id}/users?access_token=#{@access_token}\"\n get uri\n end", "def index\n \n @user = User.find(current_user.id) \n\n respond_to do |format|\n format.html { render action: \"show\" }\n format.json { render json: @user }\n end\n end", "def index\n @users = User.paginate(:page => params[:page], :per_page => 10).order(\"id\")\n\n respond_with do |format|\n format.html # index.html.erb\n format.json { render :json => @users }\n end\n end", "def manage_users\n \t@users = User.all\n\n \trespond_to do |format|\n format.json {\n render :json => @users.as_json(:only => [:id, :username, :firstname, :lastname, :email], :methods => [:avatar_url])\n }\n format.html {\n render 'manage_users'\n }\n end\n end", "def index\n render :json => User.all, status: 200\n end", "def index\n @users = @users.order('created_at DESC').page params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @users, :except => [:perishable_token, :persistence_token, :email, :single_access_token, :last_login_ip, :current_login_ip, :crypted_password, :password_salt] }\n end\n end", "def users\n\t\trespond_with User.all\n\tend", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.order_by(last_name: :desc)\n if @users\n render json: Oj.dump(json_for(@users, include: ['phones', 'cards'], meta: meta), mode: :compat)\n else\n return head :unauthorized\n end\n end", "def index\n users = User.all\n render json: users \n end", "def index\n\t\t@users = User.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render json: @users.map(&:as_json) }\n\t\tend\n\tend", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all \n render json: @users, status: :ok \n end", "def show\n user = User.find(params[:id])\n render json: @user\nend", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end" ]
[ "0.8192025", "0.7784465", "0.75287426", "0.74344736", "0.7427568", "0.7363614", "0.73261803", "0.7316772", "0.7293402", "0.7249611", "0.71899426", "0.70967597", "0.704251", "0.70275694", "0.7008053", "0.6997711", "0.6996519", "0.699205", "0.6957963", "0.6947861", "0.69417", "0.6917579", "0.6897275", "0.6885547", "0.68814266", "0.6859142", "0.68493235", "0.684689", "0.68431306", "0.6841798", "0.6841798", "0.6836088", "0.6824728", "0.6821466", "0.68205684", "0.6813685", "0.68098617", "0.6809178", "0.6805873", "0.6802895", "0.6802895", "0.68005836", "0.6798848", "0.6798848", "0.6798848", "0.6798848", "0.6790868", "0.67882806", "0.67879945", "0.6785735", "0.6784362", "0.6782572", "0.67811066", "0.67803466", "0.67789936", "0.67740744", "0.67699045", "0.67699045", "0.67699045", "0.67699045", "0.67699045", "0.67699045", "0.67699045", "0.67699045", "0.67699045", "0.67699045", "0.67656255", "0.6755129", "0.67520964", "0.6751698", "0.6751698", "0.6751698", "0.6751698", "0.6751698", "0.6751698", "0.67448527", "0.6744843", "0.67418027", "0.67418027", "0.67418027", "0.67418027", "0.67418027", "0.67418027", "0.67418027", "0.67418027", "0.67418027", "0.67418027", "0.67418027", "0.67418027", "0.67418027", "0.67418027", "0.67418027", "0.67418027", "0.67418027", "0.67418027", "0.67418027", "0.67418027", "0.67418027", "0.67418027", "0.67418027", "0.67418027" ]
0.0
-1
POST /users POST /users.json
def create @user = User.new(user_params) respond_to do |format| if @user.save format.html { redirect_to test_user_path(@user) } format.json { render :show, status: :created, location: @user } else format.html { redirect_to new_user_path, notice:'Please select your country' } format.json { render json: @user.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_users(users)\n self.class.post('https://api.yesgraph.com/v0/users', {\n :body => users.to_json,\n :headers => @options,\n })\n end", "def CreateUser params = {}\n \n APICall(path: 'users.json',method: 'POST',payload: params.to_json)\n \n end", "def post body=nil, headers={}\n @connection.post \"users.json\", body, headers\n end", "def create\n # render json: params\n render json: Users.create(params[\"user\"])\n end", "def create_user(params:)\n parse(JSON.parse(connection.post(\"users\", params.to_json).body))\n end", "def create\n user = User.create(user_params) \n render json: user, status: :created\n end", "def create\n user = User.new(user_params)\n if user.save\n render json: user\n else\n render json: {errors: \"Cannot create user\"}, :status => 420\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(form_params)\n\n respond_to do |format|\n if @user.save\n format.json { render json: { users: @user }, status: :created }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n user = User.new(\n username: user_params[:username],\n password: user_params[:password])\n if user.save\n create_example_collection(user)\n render json: user, except: [:password_digest, :created_at, :updated_at]\n else\n render json: {errors: user.errors.full_messages}\n end\n end", "def create\n user= User.create(user_params)\n render json: user\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n\t\t@user = User.new(users_params)\n\t\tif @user.save\n\t\t\tjson_response(@user, \"User is created Successfully.\")\n\t\telse\n\t\t\trender json: {message: @user.errors.full_messages.join(\" \")}, status: 400\n\t\tend\t\t\n\tend", "def create\n user = User.new(@user_info)\n if user.save && user.errors.empty?\n render json: { status: 200, data: UserSerializer.new(user).as_json }\n else\n render json: { status: 400, error: user.errors.full_messages }\n end\n end", "def create\n user = User.create(user_params)\n if user.valid?\n render json: user\n else\n render json: user.errors, status: :unprocessable_entity\n end\n end", "def create(options = {})\n request(:post, '/users.json', default_params(options))\n end", "def create\n @user = User.new user_params(params[:user])\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new user_params(params[:user])\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.create user_params\n \n if @user.save\n respond_with(@user) do |format|\n format.json {render}\n end\n end\n end", "def create\n @user = User.new(user_params(params))\n \n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.json { render json: @user }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(user_params(params))\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(user_params(params))\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create_user\n @user = User.new(user_params)\n if @user.save\n render json: UserSerializer.new(@user).serialized_json\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = @application.users.create(user_params)\n\n if @user.valid?\n render json: @user, status: :created, location: api_application_user_path(@application,@user)\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n user = User.create(user_params)\n if user.save\n render json: user\n else\n render json: user.errors, status: :bad\n end\n end", "def create\n r = @api.create_user(user_params)\n respond_to do |format|\n if r.code == 201\n format.html { redirect_to users_url, notice: 'User was successfully created.' }\n else\n response = JSON.parse(r.body)\n format.html { redirect_to users_url, alert: response['message']}\n end\n end\n end", "def create\n\n puts '-----------------------create in user controller'\n\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: UserSerializer.new(@user).serialized_json\n else\n render json: { error: I18n.t('user_create_error') }, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(user_params)\n if @user.save\n render json: { user: @user, success: 'User registration successful' }\n else\n render json: { error: 'User registration unsuccessful' }\n end\n end", "def create\n @user = User.new(user_params)\n \n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n\t\tputs user_params\n\t\tuser = User.new(user_params)\n\t\tif user.save\n\t\t\trender json: { user: user, status: :success }\n\t\telse\n\t\t\trender json: { status: :failure, errors: user.errors.full_messages.join('') }\n\t\tend\n\tend", "def create\n\t\t@user = User.new(user_params)\n\t\tif @user.save\n\t\t\trender json: @user, status: :created, location: @user\n\t\telse\n\t\t\trender json: @user.errors, status: :unprocessable_entity\n\t\tend\n\tend", "def add_user(name, value)\n self.class.post(\"/users/#{name}\",\n body: value,\n headers: {\n 'Content-Type' => 'application/json; charset=UTF-8',\n Connection: 'keep-alive',\n Accept: 'application/json, text/plain, */*'\n })\n end", "def create\n user = User.new(user_params)\n\n respond_to do |format|\n if user.save\n render json: user, status: :ok\n else\n format.json { render json: user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = current_user.users.build(user_params)\n\n if @user.save\n render json: @user\n else\n @user_items = []\n end\n end", "def create\n user = User.new(user_params)\n render json: { status: 200, msg: 'User was created.', data: \"User Id #{user.id}\" } if user.save\n end", "def create\n @users = User.new(params[:user])\n\n respond_to do |format|\n if @users.save\n format.html { redirect_to @users, notice: 'Regist was successfully created.' }\n format.json { render json: @users, status: :created, location: @users }\n else\n format.html { render action: \"new\" }\n format.json { render json: @users.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n user = User.new(user_params)\n if user.save\n render :json => user, :status => :created\n else\n render :json => {:ok => false, :message => user.errors}, :status => :unprocessable_entity\n end\n end", "def create\n logger.debug user_params\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :ok\n else\n render json: @user.errors, status: :not_acceptable\n end\n end", "def create\n user = User.create(user_params)\n render json: user, message: 'user succefully create', status: 200\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n\n up = user_params\n\n if up[:name].present?\n up[:first_name] = up[:name].split(' ')[0]\n up[:last_name] = up[:name].split(' ')[1]\n up.delete :name\n end\n @user = User.new(up)\n\n respond_to do |format|\n if @user.save\n # render json: {user: user, token: token}\n\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: api_user_url(@user)}\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n user = User.new(user_params)\n if user.save\n render json: {status: \"Se creo el usuario\"}, status: :ok\n else\n render json: {status: \"Error al crear el usuario\", errors: user.errors }, status: :unprocessable_entity\n end\n end", "def create\n user = User.new(params[:user].permit(:username))\n if user.save\n render json: user\n else\n render json: user.errors.full_messages, status: :unprocessable_entity\n end\n end", "def create\n puts '>>> params:'\n puts params.inspect\n @user = User.new(params[:user])\n puts '>>> User:'\n puts @user.inspect\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n \tdata = { data: @user, status: :created, message: \"User was successfully created.\" }\n render :json => data\n else\n \tdata = { data: @user.errors, status: :unprocessable_entity }\n render :json => data\n end\n end", "def create\n user_details = params.permit(:first_name, :last_name, :email)\n success = User.create(user_details)\n\n render json: { success: success }\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user.as_json(only: [:email, :authentication_token]), status: :created\n else\n head(:unprocessable_entity)\n end\n end", "def create_user\n params = {\n :client_id => Swiftype.platform_client_id,\n :client_secret => Swiftype.platform_client_secret\n }\n post(\"users.json\", params)\n end", "def create\n @user = User.new(params[:user])\n\n if @user.save\n respond_to do |format|\n format.json { render :json => @user.to_json, :status => 200 }\n format.xml { head :ok }\n format.html { redirect_to :action => :index }\n end\n else\n respond_to do |format|\n format.json { render :text => \"Could not create user\", :status => :unprocessable_entity } # placeholder\n format.xml { head :ok }\n format.html { render :action => :new, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(user_params)\n if @user.save\n render :ok, json: @user.to_json\n else\n @errors = @user.errors.full_messages\n render json: { message: @errors }, status: :unauthorized\n end\n end", "def create\n puts params\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render json: @user.as_json(user: current_user), status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n user = User.new(user_params)\n if user.save\n render json: {status: 200, msg: 'User was created.'}\n else\n render json: {errors: user.errors.messages}\n end\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_url, :notice => 'User was successfully created.' }\n format.json { render :json => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new({name: params[:name], email: params[:email], password: params[:password], photo: params[:photo]})\n @user.save\n render json:@user\n end", "def create\n user = User.create(user_params)\n\n if user.valid?\n render json: {user: UserSerializer.new(user), token: encode_token(user.id)}\n else\n render json: user.errors.full_messages\n end\n end", "def create\n\t\tresp = {} \n user = User.create(user_params)\n \tif user.valid?\n if user.save\n return render :json => user.as_json\n end\n end\n render json: user.errors.full_messages \n\tend", "def create\n\t\tnew_user = User.new(user_params)\n\t\tif new_user.save\n\t\t render status: 200, json: {\n\t\t \tstatus: 200,\n\t\t message:\"New User Created\",\n\t\t response: {\n\t\t name: new_user.name,\n\t\t email: new_user.email,\n\t\t id: new_user.id,\n\t\t facebook_id: new_user.facebook_id,\n\t\t device_id: new_user.device_id,\n\t\t authentication_token: new_user.authentication_token\n\t\t }\n\t\t \n\t\t }.to_json\n\t\telse\n\t\t render status: 404, json: {\n\t\t \tstatus: 404,\n\t\t errors: new_user.errors\n\t\t }.to_json\n\t\tend\n\tend", "def post_users_with_http_info(users, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UsersApi.post_users ...'\n end\n # verify the required parameter 'users' is set\n if @api_client.config.client_side_validation && users.nil?\n fail ArgumentError, \"Missing the required parameter 'users' when calling UsersApi.post_users\"\n end\n # resource path\n local_var_path = '/users'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(users) \n\n # return_type\n return_type = opts[:return_type] || 'User' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Bearer']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UsersApi#post_users\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create_user(options = {})\n post \"/users\", options\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_url, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_url, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save \n format.html { redirect_to users_url, notice: \"User #{@user.name} was successfully created.\" }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n user = User.new(user_params)\n\n if user.save\n\n render json: {status: 200, msg: 'User was created.'}\n\n else \n render json: {\n errors: user.errors.full_messages\n }, status: :unprocessable_entity\n\n end\n\n end", "def create_user(body)\n post 'create_user', body\n end", "def create\n @user = User.new(user_params)\n @user.email = params[:email].downcase\n if @user.save\n render json: @user, status: 200\n else\n render json: { errors: @user.errors.full_messages }, status: 400\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json:@user\n elsif @user.errors\n render json: {error: {code: 400, server_message: @user.errors}}, status: :bad_request\n else\n render json: {error: {code: 500, message: \"Could not save user\", server_message: @user.errors}}, status: :internal_server_error\n end\n\n end", "def create\n user = User.new(user_params)\n\n if user.valid?\n user.save\n render json: {user: user, token: encode_token({user_id: user.id})}\n else\n render json: {error: \"Failed to create the user\"}\n end\n end", "def create\n @user = User.new(user_params)\n @user.save\n respond_with @user\n end", "def create\n @user = User.new(user_params)\n render json: @user && return if @user.save\n\n render json: { error: \"Unable to save user: #{@user.errors.messages}\" }, status: 400\n end", "def create\n params[:user][\"_id\"] = params[:user][:name]\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save()\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_user(attributes)\n post(\"/v1/users\", attributes)\n end", "def create\n user = User.new(user_params)\n\n # if user is saved sucessfully it will return user and ith status 201 for created\n if user.save\n render json:user,status: :created\n #if request is properly served but data is wrong it ll give ubprocessable_entity with code 422\n else\n render json: user.errors, status: :unprocessable_entity\n end \n end", "def create\r\n @user = User.new(params[:user])\r\n\r\n respond_to do |format|\r\n if @user.save\r\n format.html { redirect_to users_path, notice: 'Os dados do usuário foram salvos com sucesso!' }\r\n format.json { render json: @user, status: :created, location: @user }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @user.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @user = User.new(\n first_name: params[:first_name],\n last_name: params[:last_name],\n birth_date: params[:birth_date],\n height: params[:height],\n weight: params[:weight],\n user_name: params[:user_name],\n password: params[:password],\n password_confirmation: params[:password_confirmation],\n facebook_url: params[:facebook_url],\n twitter_url: params[:twitter_url],\n instagram_url: params[:instagram_url],\n address: params[:address],\n email: params[:email]\n ) \n if @user.save!\n render 'successful.json.jb', status: :created\n else\n render 'unsuccessful.json.jb', status: :bad_request\n end\n end", "def post(hash)\n HttpClient::Preconditions.assert_class('hash', hash, Hash)\n @client.request(\"/users\").with_json(hash.to_json).post { |hash| Apidoc::Models::User.new(hash) }\n end", "def create\n user = User.create!(user_params)\n session[:user_id] = user.id\n render json: user, status: :created\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: {message: \"user create successfuly\"}\n else\n render json: {message: \"Error\"}\n end \n end", "def create\n # Insert new user in database\n user = User.new(user_params)\n\n if user.save\n # On success, send token information to authenticate user\n token = create_token(user.id, user.username)\n render json: {status: 200, token: token, user: user}\n # render json: @user, status: :created, location: @user\n else\n render json: user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(params[:user])\n @user.status = 'active'\n\n respond_to do |format|\n if @user.save\n format.json { render :json => @user, :status => :created }\n format.html { redirect_to(users_path) }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n respond_with(@user, location: users_url, notice: 'User was successfully created.')\n else\n respond_with(@user)\n end\n end", "def create\n user = User.new(user_params)\n \n if user.save\n token = JsonWebToken.encode(user_id: user.id)\n render json: { auth_token: token, user: AuthUserSerializer.new(user).serializable_hash }, status: 201\n else \n render json: { errors: user.errors.full_messages }, status: 400\n end\n end", "def create\n @user = User.new(params[:user])\n puts params[:user]\n respond_to do |format|\n if @user.save\n format.html { redirect_to :users, notice: 'Registration successful.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render :show, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render :show, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n user = User.create(user_params)\n if user.valid?\n user.username.downcase\n @token = issue_token(user)\n list = List.create(name: user.username)\n list.user_id = user.id\n user.save\n list.save\n render json: { user: UserSerializer.new(user), jwt: @token }, status: :created \n else \n render json: { error: user.errors.full_messages }, status: :not_acceptable\n end \n end", "def create\n @user = User.new(user_params)\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_path, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_path, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n user_response = API::V1::Users.authenticate params.as_json\n if user_response.success?\n json = HashWithIndifferentAccess.new(user_response.parsed_response)\n auth_response = API::V1::Auth.issue json[:data]\n respond_with auth_response.body, auth_response.code\n else\n respond_with nil, :unauthorized\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render :json => { :status => 0 }\n else\n render :json => { :status => 1, :msg => @user.errors}\n end\n end", "def create\n @user = User.new(user_params)\n if @user.save\n auth_token = Knock::AuthToken.new payload: { sub: @user.id }\n render json: { username: @user.username, jwt: auth_token.token }, status: :created\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n authorize :user, :create?\n @user = User.new(user_params)\n @user.save\n\n respond_to do |format|\n format.html\n format.json { render :json => @user, status: 200 }\n end\n end", "def post_accounts(json_hash)\n @options = {:path => '/users.json',\n :body => json_hash[:json]}.merge(@options)\n\n request(\n :expects => 201,\n :method => :post,\n :body => @options[:body]\n )\n end", "def create\n user = User.new(username: params[:username])\n if user.save\n payload = {'user_id': user.id}\n token = JWT.encode(payload, 'chatapp')\n render json: {\n user: user,\n token: token\n }\n else \n render json: { message: 'There was an error creating your account' }\n end\n end", "def create\n user = User.create!(user_params)\n if user\n session[:user_id] = user.id\n render json: user, status: :created\n else\n render json: { errors: user.errors.full_messages }, status: :unprocessable_entity\n end\n end", "def create\r\n @user = User.new user_params\r\n\r\n if @user.save\r\n render json: @user, serializer: SessionSerializer, root: nil\r\n else\r\n render json: { errors: @user.errors }, status: :unprocessable_entity\r\n end\r\n end", "def create\n user = User.new(user_params)\n if user.save\n render json: { status: 'OK', msg: 'User was created.', error: 'nil' },\n status: :created\n else\n not_good(422)\n end\n end" ]
[ "0.77178615", "0.751936", "0.73831904", "0.72412014", "0.719768", "0.7140784", "0.7103724", "0.70586866", "0.7041747", "0.70236677", "0.7003012", "0.7002012", "0.7002012", "0.7002012", "0.6992873", "0.6990429", "0.6980341", "0.69790155", "0.6978697", "0.6978697", "0.69763535", "0.6962294", "0.695194", "0.694517", "0.694517", "0.69202316", "0.6917723", "0.6913987", "0.69009656", "0.68981147", "0.6894472", "0.68896914", "0.68803185", "0.6879835", "0.6879686", "0.6879056", "0.6877317", "0.68685913", "0.68557876", "0.6850744", "0.68438756", "0.68140614", "0.68034494", "0.6777382", "0.6776193", "0.6767001", "0.675744", "0.6747358", "0.67386395", "0.67346144", "0.6733921", "0.6720284", "0.6710678", "0.6670139", "0.6658037", "0.665726", "0.6653911", "0.66385335", "0.66329634", "0.6619689", "0.6614647", "0.66141474", "0.6597641", "0.6590211", "0.65788305", "0.6578527", "0.65731233", "0.6572486", "0.65565205", "0.6553143", "0.6551308", "0.65460217", "0.6540497", "0.65400976", "0.6538745", "0.6534923", "0.65333605", "0.652561", "0.6510388", "0.6508043", "0.65071523", "0.65030766", "0.6489865", "0.6488904", "0.6487186", "0.6473134", "0.64718515", "0.6469831", "0.6469831", "0.6469282", "0.646749", "0.6461641", "0.6461577", "0.6461024", "0.645465", "0.6453074", "0.6449793", "0.6447059", "0.6446711", "0.6446099", "0.6441262" ]
0.0
-1
PATCH/PUT /users/1 PATCH/PUT /users/1.json
def update respond_to do |format| if @user.update(user_params) format.html { redirect_to @user } format.json { render :show, status: :ok, location: @user } else format.html { render :edit } format.json { render json: @user.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end", "def update\n render json: Users.update(params[\"id\"], params[\"user\"])\n end", "def UpdateUser params = {}\n \n APICall(path: 'users.json',method: 'PUT',payload: params.to_json)\n \n end", "def update \n user = User.find(params[:id])\n # byebug\n user.update(user_params)\n\n render json: user\n end", "def update\n user = User.find(params[:id])\n\n # Use update with user_params to do a mass-assignment update and save. \n if user.update_attributes(user_params)\n render json: user\n else \n render json: user.errors.full_messages, status: :unprocessable_entity\n end\n end", "def update\n user = User.find_by(id: params[:id])\n user.update(user_params)\n render json: user\n end", "def update\n \trespond_to do |format|\n if @user.update(user_params)\n format.json { render json: @user }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n\t \t\n end", "def update\n user = find_user\n user.update!(user_params)\n render json: user\n end", "def update\n if user.update(user_params)\n render json: user\n else\n render json: {errors: \"Cannot create user\"}, :status => 420\n end\n end", "def update\n if @api_v1_user.update(api_v1_user_params)\n head :no_content\n else\n render json: @api_v1_user.errors, status: :unprocessable_entity\n end\n end", "def update_current_logged_in_user(args = {}) \n put(\"/users.json/current\", args)\nend", "def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend", "def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend", "def update\n @user = User.find(params[:id])\n\n if @user.update_attributes(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update_attributes(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update_user(options)\n patch(\"/user\", options, 3)\n end", "def modify_user(user)\n query_api_object Model::User, '/rest/user', user.to_hash, 'PUT'\n end", "def update\n user = User.find(params[:id])\n user.update(user_params)\n if user.valid?\n render json: user\n else\n render json: user.errors\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { render action: \"edit\"}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n \n end", "def update\n @user = User.find(params[:id])\n @user.name = params[:name]\n @user.email = params[:email]\n @user.password = params[:password]\n @user.photo = params[:photo]\n @user.role = params[:type]\n @user.save\n render json:@user\n end", "def update\n if @user.id == current_api_user.id\n if @user.update(user_params)\n render json: @user.as_json(except: [:updated_at]), status: :ok\n else\n render json: @user.errors, status: :bad_request\n end\n else\n render json: '', status: :forbidden\n end\n end", "def update\n if @user.update(user_params)\n render json: @user\n else\n render json: {error: \"Could not update user\"}\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n render json:@user\n else\n render json: { error: {code: 404, message: 'Invalid user' }}, status: :not_found\n end\n end", "def update\n user = User.find(params[:id])\n if user.update(params_user)\n render json: user, status: 200\n else\n render json: user.errors, status: 422\n end\n\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update user_params(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n @user.name = params[:name]\n @user.email = params[:email]\n @user.password = params[:password]\n @user.photo = params[:photo]\n @user.save\n render json:@user\n end", "def updateUser\n options = {\n :body => params.to_json,\n :headers => {\n 'Content-Type' => 'application/json',\n 'Authorization' => request.headers['Authorization']\n }\n }\n results = HTTParty.put(\"http://192.168.99.101:4051/users/\"+@current_user[\"id\"].to_s, options)\n render json: results.parsed_response, status: results.code\n end", "def update\n user = @user_service.update_user(params[:id])\n render json: user, status: :ok\n end", "def update\n @user = User.find(params[:id]) \n \n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_url, notice: 'User #{@user.name} was successfully created.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @user.update(user_params)\n render json: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n if @user.update(user_params)\n render json: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n if @user.update(user_params)\n render json: @user, status: 200\n else\n render json: @user.errors, status: 422\n end\n end", "def update\n begin\n user = User.find(params[:user_id])\n if user.update(user_params)\n render json: { users: user }, status: :ok\n else\n render json: { errors: user.errors.messages }, status: 422\n end\n rescue => e\n render json: { errors: e.message }, status: 404\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if user.update(user_params)\n render json: user, status: :ok\n else\n format.json { render json: user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params(params[:user]))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n @user.update_attributes(params[:user])\n respond_with @user\n end", "def update\n @user = User.find(params[:id])\n @user.update_attributes(params[:user])\n respond_with @user\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_url, notice: 'User was successfully updated.' }\n\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes_from_api(params[:user])\n format.html { redirect_to @user, :notice => 'User was successfully updated.' }\n format.json { render_for_api :user, :json => @user }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = current_org.users.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'user was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_url, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch_user(user_id, body)\n raise Auth0::MissingUserId, 'Must supply a valid user_id' if user_id.to_s.empty?\n raise Auth0::InvalidParameter, 'Must supply a valid body' if body.to_s.empty? || body.empty?\n path = \"#{users_path}/#{user_id}\"\n patch(path, body)\n end", "def update\n @user = User.find(params[:id])\n @user.update(user_params)\n render json: @current_user\n end", "def update_current_logged_in_users_password(args = {}) \n put(\"/users.json/current/password\", args)\nend", "def update\n user = User.find(params[:id])\n render json: { status: 200, msg: 'User details have been updated.' } if user.update(user_params)\n end", "def modify_user(user)\n query_api_object User, \"/rest/user\", user.dump(), \"PUT\"\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params(params))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params(params))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_path, :notice => 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n user = User.find(params[:id])\n if user.update(user_params)\n render json: user\n else\n render json: user.errors.full_messages\n end\n end", "def update\n respond_to do |format|\n if @user.update(form_params)\n format.json { render json: { users: @user }, status: :ok, location: @user }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user.update(user_params)\n respond_with @user\n end", "def update\n @user = user.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'user was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_user\n @user = User.find(params[:id])\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n if @user.update(user_params(params))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = get_user(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to root_url, notice: \"User #{@user.login_name} was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @v1_user.update(v1_user_params)\n format.html { redirect_to @v1_user, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @v1_user }\n else\n format.html { render :edit }\n format.json { render json: @v1_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @user.update(user_params)\n render json: @user, status: :ok\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, :notice => t('user.update_success') }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status=> :unprocessable_entity }\n end\n end\n end", "def update\n @user.update(user_params_update)\n json_response(@user)\n end", "def update\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to users_path }\n format.json { render :json => @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = selected_user\n if @user.update(users_params)\n render 'api/users/show'\n else\n render json: @user.errors.full_messages, status: 422\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user.as_json(user: current_user), notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.json { head :ok }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to root_path}\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = V1::User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'V1::User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update \n user = User.where(:id => current_user.user)\n if user.update(user_params)\n render :json => {:user => user }\n else\n render :json => {:error => user.errors.full_messages.first}\n end\nend", "def update\n\t\tif @user.update(user_params)\n\t\t\trender json: @user\n\t\telse\n\t\t\trender json: @user.errors, status: :unprocessable_entity\n\t\tend\n\tend", "def update\n @user = User.find(params[:id])\n \n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, :notice => 'User was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update(id, params = {})\n request(:put, \"/users/#{id}\", body: params)\n end", "def update\n @user = current_api_user\n unless @user.update(user_params)\n render json: { error: @user.errors.full_messages.to_sentence }, status: :not_found\n end\n end", "def update\n # not_found unless @user\n # @user = User.get(params[:id]) || not_found\n\n respond_to do |format|\n if @user.update(params[:user])\n format.html { redirect_to @user, :notice => 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, :notice => \"This user was successfully updated!\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n user = User.find(params[:id])\n if user.update(user_params)\n render json: {\n status: 'OK',\n msg: 'User details have been updated.',\n error: 'nil'\n }, status: :accepted\n else\n not_good(406)\n end\n end", "def update\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: I18n.t(:users_update) }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = ::User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @todo = Todo.find(params[:todo][:id])\n if @todo.update_attributes(user_params)\n render json: @todo\n else\n render nothing: true, status: :bad_request\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to user_path(@user), notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update \n @current_user.update(user_params)\n render json: @current_user\n end", "def update\n @user = User.find(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7225568", "0.7129473", "0.70036036", "0.6903525", "0.6821961", "0.68157715", "0.6708618", "0.66936064", "0.66810983", "0.6673763", "0.6672601", "0.6664346", "0.6664346", "0.6659468", "0.6659468", "0.6654875", "0.66486204", "0.66436917", "0.6641295", "0.6635214", "0.6618464", "0.66153306", "0.6610267", "0.6607359", "0.6583569", "0.65825915", "0.65820843", "0.65801483", "0.65615994", "0.6558883", "0.6558883", "0.6543664", "0.6537492", "0.6515997", "0.6514648", "0.65062994", "0.65054137", "0.65054137", "0.65015376", "0.6468482", "0.6466442", "0.64641905", "0.6453641", "0.64496416", "0.6443516", "0.6441606", "0.6437562", "0.6428467", "0.6428467", "0.64279026", "0.6427495", "0.64269704", "0.6424723", "0.6424723", "0.64239854", "0.6418606", "0.64156115", "0.6411428", "0.64053625", "0.6405119", "0.6398354", "0.63945407", "0.6390761", "0.63903916", "0.63876307", "0.6383881", "0.63834596", "0.63829523", "0.6382388", "0.63776475", "0.63752687", "0.6374351", "0.63735604", "0.6373269", "0.6370833", "0.6363397", "0.63607967", "0.6360649", "0.6356513", "0.6356091", "0.6350332", "0.6342926", "0.6334242", "0.6333647", "0.6328633", "0.6327188", "0.6327188", "0.6327188", "0.6327188", "0.6327188", "0.6327188", "0.6327188", "0.6327188", "0.6327188", "0.6327188", "0.6327188", "0.6327188", "0.6327188", "0.6327188", "0.6327188", "0.6327188" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_user @user = User.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 user_params params.require(:user).permit(:name, :nationality, :point, :first, :second, :third, :fourth, :fifth, :six, :seventh, :eighth, :ninth, :ten, :eleven, :twelve, :thirteen, :fourteen, :fifteen, :sixteen, :seventeen) 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
Generates and sets file_digest attribute
def generate_model_digest! self.covercache_model_digest = generate_model_digest end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def digest\n assert_file!\n Digest::SHA256.hexdigest(@name + Digest::SHA256.file(@path).to_s)\n end", "def file_digest(path)\n if stat = self.stat(path)\n self.stat_digest(path, stat)\n end\n end", "def file_digest_key(stat)\n \"file_digest:#{compressed_path}:#{stat}\"\n end", "def digest_file( x)\n path = requested_file( x[:request] )\n if File.exist?(path) && !File.directory?(path)\n Digest::MD5.hexdigest(File.read(path))\n else\n nil\n end\n end", "def digest\n Digest::MD5.file(file).hexdigest\n end", "def checksum_file(digest_class, path)\n digester = digest_class.new\n digester.file(path)\n digester.hexdigest\n end", "def file_digest(pathname)\n key = pathname.to_s\n if @digests.key?(key)\n @digests[key]\n else\n @digests[key] = super\n end\n end", "def digest\n OpenSSL::Digest::SHA256.file(path).hexdigest\n end", "def file_hash=(value)\n @file_hash = value\n end", "def file_digest(file)\n # Get the actual file by #tempfile if the file is an `ActionDispatch::Http::UploadedFile`.\n Digest::SHA256.file(file.try(:tempfile) || file).hexdigest\n end", "def file_md5\n Digest::MD5.file(self).hexdigest\n end", "def files_digest(paths)\n self.digest(paths.map { |path| self.file_digest(path) })\n end", "def digest\n @digest ||= DEFAULT_DIGEST_PROC\n end", "def file_digest(path, data = nil)\n if stat = self.stat(path)\n # `data` maybe provided\n if data\n digest.update(data)\n\n # If its a file, digest the contents\n elsif stat.file?\n digest.file(path)\n\n # If its a directive, digest the list of filenames\n elsif stat.directory?\n contents = self.entries(path).join(',')\n digest.update(contents)\n end\n end\n end", "def digest\n @digest ||= Digest::MD5.hexdigest(self.attributes[self.class.config[:digest]])[0, 8]\n end", "def digest_key(digest)\n \"asset-uri-digest:#{compressed_path}:#{digest}\"\n end", "def file_sha256\n Digest::SHA256.file(self).hexdigest\n end", "def md5; Digest::MD5.file(fname).hexdigest; end", "def hexdigest\n self.class.hexdigest_for(path)\n end", "def hash\r\n # TODO what if file is empty?\r\n @hash ||= Digest::SHA1.file(File.join(@directory, @filename)).hexdigest\r\n end", "def generate_sha(file)\n\n sha1 = Digest::SHA1.file file\n return sha1\n\nend", "def asset_digest_path(path, options = T.unsafe(nil)); end", "def asset_digest_path(path, options = T.unsafe(nil)); end", "def update_file_metadata(data)\n update_attributes!( :file_size => data.bytesize, :file_hash => Digest::SHA1.hexdigest( data ) )\n end", "def hash\n Digest::MD5.hexdigest(abs_filepath)[0..5]\n end", "def file_digest(path)\n if stat = self.stat(path)\n # Caveat: Digests are cached by the path's current mtime. Its possible\n # for a files contents to have changed and its mtime to have been\n # negligently reset thus appearing as if the file hasn't changed on\n # disk. Also, the mtime is only read to the nearest second. Its\n # also possible the file was updated more than once in a given second.\n cache.fetch(['file_digest', path, stat.mtime.to_i]) do\n if stat.directory?\n # If its a directive, digest the list of filenames\n digest_class.digest(self.entries(path).join(','))\n elsif stat.file?\n # If its a file, digest the contents\n digest_class.file(path.to_s).digest\n end\n end\n end\n end", "def genfile(filename, args = nil, &block)\r\n realpath = file(filename)\r\n md5key = [MetaMD5, filename]\r\n filekey = [MetaFile, filename]\r\n if @cache.has?(md5key) && \r\n @cache.has?(filekey) &&\r\n FileTest.file?(realpath) && \r\n MD5.filehex(realpath) == @cache[md5key]\r\n elsif @cache.has?(filekey)\r\n _writefile realpath, @cache[filekey]\r\n else\r\n u = yield filekey\r\n @cache.transaction do |db|\r\n db[md5key] = MD5.hexdigest u\r\n db[filekey] = u\r\n _writefile realpath, @cache[filekey]\r\n end\r\n end\r\n realpath\r\n end", "def digest\n @digest ||= begin\n Digest::SHA1.hexdigest \"defaults-#{NilavuStylesheets.last_file_updated}\"\n end\n end", "def digest\n metadata[:digest]\n end", "def file_sha1\n Digest::SHA1.file(self).hexdigest\n end", "def append_md5(file, digest, hashless: false)\n return file if hashless\n\n [[file.split(ex = File.extname(file)).first, digest].join('-'), ex].join\n end", "def digest(data); end", "def update_digest\n\n path = self.bundle_dir\n sha = Digest::SHA2.new\n bundle_sha = Digest::SHA2.new\n\n digests = []\n Dir.glob(\"#{path}/**/*\").sort.each do |f|\n next if File.directory?(f) || File.basename(f) == \"digest\" || f =~ /^#{path}\\/test/\n bundle_sha.file(f)\n sha.reset()\n digests << { :file => f.gsub(/#{path}\\//, ''), :digest => sha.file(f).hexdigest() }\n end\n\n @digest = { :digest => bundle_sha.hexdigest(), :files => digests }\n File.open(path+\"/digest\", 'w'){ |f|\n f.write(MultiJson.dump(@digest, :pretty => true, :adapter => :json_gem) + \"\\n\")\n }\n\n end", "def update!(**args)\n @digest = args[:digest] if args.key?(:digest)\n end", "def hash_file path, hash_store\r\n\thexdigest = HASH_DIGEST.hexdigest(open(path, 'rb') { |io| io.read })\r\n\thash_store[hexdigest] << path\r\nend", "def fetch_md5\n # Create a hash digest for the current file.\n digest = Digest::MD5.new\n File.open(@path, 'r') do |handle|\n while buffer = handle.read(1024)\n digest << buffer\n end\n end\n digest\n end", "def digest!()\n #This is a stub, used for indexing\n end", "def digest_filename(filename)\n digest = Digest::SHA256.digest(filename.to_s)\n Base64.urlsafe_encode64(digest, padding: false)\n end", "def files_digest(paths)\n digest(paths.map { |path| file_digest(path) })\n end", "def create\n @user=User.find(params[:user_id])\n @file_upload = @user.file_uploads.new(file_upload_params)\n\n respond_to do |format|\n if @file_upload.save\n format.html { redirect_to user_file_upload_path(@user,@file_upload), notice: 'File was successfully uploaded.' }\n format.json { render :show, status: :created, location: @file_upload }\n @md5 = Digest::MD5.file(@file_upload.attachment.path).hexdigest \n @file_upload[:hash_val]=@md5\n @file_upload.save\n\n else\n format.html { render :new }\n format.json { render json: @file_upload.errors, status: :unprocessable_entity }\n end\n end\n end", "def full_digest_path\n File.join(@load_path, digest_path)\n end", "def digest_path\n if DigestUtils.already_digested?(@name)\n logical_path\n else\n logical_path.sub(/\\.(\\w+)$/) { |ext| \"-#{etag}#{ext}\" }\n end\n end", "def get_digest(file, version)\n # Make a hash with each individual file as a key, with the appropriate digest as value.\n inverted = get_state(version).invert\n my_files = {}\n inverted.each do |files, digest|\n files.each do |i_file|\n my_files[i_file] = digest\n end\n end\n # Now see if the requested file is actually here.\n unless my_files.key?(file)\n raise OcflTools::Errors::FileMissingFromVersionState, \"Get_digest can't find requested file #{file} in version #{version}.\"\n end\n\n my_files[file]\n end", "def calculated_checksum\n send(\"#{@resource[:checksum_type]}_file\".to_sym, @resource[:path]) \n end", "def asset_digest(source)\n asset_paths.digest_for(source)\n end", "def get_file_hash(fullPath)\n contents = File.read(fullPath)\n fileHash = Digest::MD5.hexdigest(contents)\n return fileHash\nend", "def file_fingerprint(options=nil)\n temp_options(options) if options\n fingerprint = Digest::MD5.hexdigest(all_files.map! { |path| \"#{File.mtime(path).to_i}\" }.join + @options.to_s)\n reset_options if options\n fingerprint\n end", "def create_registration_digest\n self.registration_token = LocalIdentity.new_token\n update_attribute(:registration_digest, LocalIdentity.digest(self.registration_token))\n end", "def hash_file(name, length)\n pieces = String.new\n file = ::File.open(name, 'r')\n pieces << Digest::SHA1.digest(file.read(length)) until file.eof?\n file.close\n pieces\n end", "def internal_file_attributes=(_arg0); end", "def create_reset_digest\n # self.reset_token = Chef.new_token\n # update_attribute(:reset_digest, Chef.digest(reset_token))\n #update_attribute(:reset_sent_at, Time.zone.now)\n end", "def checksum\n source[digest_type]\n end", "def hexdigest\n # Read bytes in chunks of the optimal digest size.\n while (chunk = @io.read(@digest.block_length))\n @digest.update(chunk)\n end\n @digest.hexdigest\n end", "def path_with_digest(filename, file_extension)\n full_filepath = \"#{filename}.#{file_extension}\"\n \"#{filename}-#{Rails.application.assets.find_asset(full_filepath).digest}.#{file_extension}\"\n end", "def populate_hash\n self.orig_image_url_hash = Digest::SHA1.hexdigest orig_image_url\n end", "def after_create\n super\n update(hash: md5_digest)\n end", "def fingerprint(digest, cert_file)\n if cert_file.is_a? String\n cert = OpenSSL::X509::Certificate.new(Util.read_file!(cert_file))\n elsif cert_file.is_a? OpenSSL::X509::Certificate\n cert = cert_file\n elsif cert_file.is_a? CertificateAuthority::Certificate\n cert = cert_file.openssl_body\n end\n digester = case digest\n when \"MD5\" then Digest::MD5.new\n when \"SHA1\" then Digest::SHA1.new\n when \"SHA256\" then Digest::SHA256.new\n when \"SHA384\" then Digest::SHA384.new\n when \"SHA512\" then Digest::SHA512.new\n end\n digester.hexdigest(cert.to_der)\n end", "def upstream_md5=( checksum )\n @digest = Crate::Digest.md5( checksum )\n end", "def digest\n @digest ||= Digest::SHA1.new.update(version.to_s)\n @digest.dup\n end", "def create_activation_digest\n self.activation_token = User.new_token\n update_attribute(:activation_digest, User.digest(activation_token))\n end", "def md5\n @md5 ||= digest(path, :md5)\n end", "def checksum(file, digest=nil)\n return nil unless digest\n if FileTest.directory?(file)\n @null_string ||= digester(digest).hexdigest(\"\") # TODO use other means\n else\n digester(digest).hexdigest(File.read(file))\n end\n end", "def fedora_shasum\n \"urn:sha1:#{Digest::SHA1.file(file_path)}\"\n end", "def checksum\n digest = @digest_klass.new\n buf = ''\n\n File.open(@path, \"rb\") do |f|\n while !f.eof\n begin\n f.readpartial(BUFFER_SIZE, buf)\n digest.update(buf)\n rescue EOFError\n # Although we check for EOF earlier, this seems to happen\n # sometimes anyways [GH-2716].\n break\n end\n end\n end\n\n digest.hexdigest\n end", "def digest\n ''\n end", "def digest\n ''\n end", "def generate_dummy_checksum()\n file = Pedant::Utility.new_random_file\n checksum = Pedant::Utility.checksum(file)\n sandbox = create_sandbox([file])\n upload_to_sandbox(file, sandbox)\n sleep 2 #give s3 some time\n commit_sandbox(sandbox)\n checksum\n end", "def file_checksum(file_path)\n Digest::SHA256.file(file_path).hexdigest\n end", "def create_activation_digest\n self.activation_token=User.new_token\n self.activation_digest=User.digest(activation_token)\n end", "def create_activation_digest\n self.activation_token=User.new_token\n self.activation_digest=User.digest(activation_token)\n end", "def generate_filename(filename)\n\t\t# Just some entropy to prevent collisions... not trying\n\t\t# to protect any information.\n\t\tfilename = \"#{filename}:#{SecureRandom.hex(10)}:#{Time.now}\"\n\n\t\tdigest = Digest::SHA256.new\n\t\treturn digest.hexdigest filename\n\tend", "def create_activation_digest\n self.activation_token = Golfer.new_token\n self.activation_digest = Golfer.digest(activation_token)\n end", "def create_activation_digest\n self.activation_token = User.new_token\n self.update_attribute(:activation_digest, User.digest(activation_token))\n end", "def create_reset_digest\n\t self.reset_token = User.new_token\n\t update_attribute(:reset_digest, User.digest(reset_token))\n\t update_attribute(:reset_sent_at, Time.zone.now)\n\tend", "def create_reset_digest\n\t self.reset_token = User.new_token\n\t update_attribute(:reset_digest, User.digest(reset_token))\n\t update_attribute(:reset_sent_at, Time.zone.now)\n\tend", "def digest\n Digest::MD5.digest(blob)\n end", "def initialize\n super('Digest')\n @auth = {}\n @nonce_count = 0\n end", "def create_reset_digest\n self.reset_digest = SecureRandom.urlsafe_base64.to_s\n update_attribute(:reset_digest, reset_digest)\n update_attribute(:reset_sent_at, Time.zone.now)\n end", "def write_temporary_file(file_attr)\n config = self.class.cached_uploads[file_attr.to_sym]\n file = send file_attr\n \n if file.present?\n # Read the uploaded file, calc its MD5, and write the MD5 instance variable.\n file.rewind\n md5 = Digest::MD5.hexdigest(file.read)\n send \"#{config[:tmp_md5_attr]}=\", md5\n \n # Write the temporary file, using its MD5 hash to generate the filename.\n file.rewind\n File.open(send(config[:tmp_path_method]), 'wb') do |out_file|\n out_file.write file.read\n end\n else\n raise \"Called #write_temporary_file(:#{file_attr}), but ##{file_attr} was not present.\"\n end\n end", "def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end", "def digest_method=(value)\n @children['digestMethod'][:value] = value\n end", "def digest_method=(value)\n @children['digestMethod'][:value] = value\n end", "def create_activation_digest\n\t self.activation_token = User.new_token\n\t self.activation_digest = User.digest(activation_token)\n\t end", "def gen_digest_byte_tests\n FILES.each do |path, hashlen|\n name = File.basename(path).split('.')[0]\n\n f = File.new(\"sha3_digest_#{hashlen}_spec.rb\", 'w')\n f.puts(REQUIRED)\n f.puts(\n SPEC\n .gsub(/HASH_LEN/, hashlen.to_s)\n .gsub(/NAME/, name)\n )\n\n contents = File.read(path).split('Len = ')\n contents.each do |test|\n lines = test.split(\"\\n\")\n next unless !lines.empty? && lines[0] !~ /^#/\n\n length = lines[0].to_i\n next unless (length % 8).zero? && length != 0\n\n msg_raw = lines[1].split(' = ').last\n digest = lines[2].split(' = ').last.downcase\n\n f.puts(\n EXPECT\n .gsub(/HASHLEN/, hashlen.to_s)\n .gsub(/MSG/, msg_raw)\n .gsub(/DIGEST/, digest)\n )\n end\n\n f.puts(ENDING)\n f.close\n end\nend", "def create_chksum_manifest\n chksum_manifest = {}\n files = Dir['*'].select{ |f| File.file? f }\n files.each do |file|\n chksum_manifest[file] = Digest::MD5.file(file).hexdigest\n end\n chksum_manifest\n end", "def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(self.activation_token)\n end", "def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end", "def create_activation_digest\n self.activation_token = User.token\n self.activation_digest = User.digest(self.activation_token)\n end", "def create_reset_digest\n\t self.reset_token = User.new_token\n\t update_attribute(:reset_digest, User.digest(reset_token))\n\t update_attribute(:reset_sent_at, Time.zone.now)\n end", "def digest\n Digest::SHA2.new\n end", "def create_reset_digest\n new_token = SecureRandom.urlsafe_base64\n update_attributes(reset_digest: User.hash_token(new_token), reset_sent_at: Time.zone.now)\n new_token\n end", "def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end", "def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end", "def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end", "def create_activation_digest\n self.activation_token = Gamer.new_token\n self.activation_digest = Gamer.digest(activation_token)\n end", "def sha1\n RunLoop::Directory.directory_digest(path)\n end", "def set_password_digest()\n\t\tself.password_digest = Password.create(self.password)\n\tend", "def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end", "def create_activation_digest\n\t\tself.activation_token = User.new_token\n\t\tself.activation_digest = User.digest(activation_token)\n\tend", "def create_activation_digest\n\t\tself.activation_token = User.new_token\n\t\tself.activation_digest = User.digest(activation_token)\n\tend" ]
[ "0.73590535", "0.7168483", "0.6995639", "0.6942275", "0.6928134", "0.6916887", "0.6914807", "0.66198033", "0.6572003", "0.6500383", "0.6472625", "0.6350513", "0.6334611", "0.6321128", "0.63136554", "0.6291911", "0.62890196", "0.6222034", "0.6176516", "0.6173127", "0.6171288", "0.6146638", "0.6146638", "0.6137122", "0.61308867", "0.6119929", "0.6109344", "0.60884213", "0.6081709", "0.6077328", "0.6071462", "0.6045118", "0.60378325", "0.6010418", "0.59993064", "0.5998473", "0.59970266", "0.59867513", "0.5975266", "0.59637076", "0.59593254", "0.59423655", "0.59380984", "0.5934846", "0.59118664", "0.59018016", "0.5894055", "0.5868505", "0.58679163", "0.58664006", "0.5857438", "0.58388966", "0.58242524", "0.5814304", "0.5812648", "0.5811103", "0.57962537", "0.57888496", "0.57842517", "0.57788", "0.57749975", "0.5771243", "0.5754788", "0.57517916", "0.57457405", "0.57457405", "0.5740068", "0.5738369", "0.57299787", "0.5721421", "0.5705954", "0.57044286", "0.57044214", "0.57020384", "0.57020384", "0.56939167", "0.56911296", "0.56904256", "0.5684007", "0.56690574", "0.5666102", "0.5666102", "0.56576467", "0.56555814", "0.56540835", "0.5647227", "0.5637656", "0.56372035", "0.5631773", "0.56316406", "0.5629066", "0.5624537", "0.5624537", "0.5621899", "0.5621848", "0.56208307", "0.56194776", "0.5619377", "0.5615988", "0.5615988" ]
0.59095436
45
flush cache on after_commit callback
def expire_covercache self.class.send :expire_covercache end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def before_commit\n cache.delete(id)\n end", "def flush_cache; end", "def _run_commit_callbacks\n if destroyed? || transaction_changed_attributes.present?\n expire_cache\n end\n super\n end", "def flush\n write_cache if @dirty\n @dirty = false\n end", "def after_commit(*); end", "def after_commit(unit); end", "def flush!\n @_cache = {}\n end", "def commit()\n #This is a stub, used for indexing\n end", "def after_save(object)\n expire_cache_for_all\n end", "def committed!\n @on_commit.each do |callback|\n callback.call\n end\n clear\n end", "def after_update(resume) \n expire_cache_for(resume) \n end", "def commit_if_dirty\n # no op\n end", "def ensure_flush\n flush if @cache.size > 0\n end", "def after_update(record)\n expire_cache_for(record)\n end", "def after_update(record)\n expire_cache_for(record)\n end", "def after_save(tag_mapping)\n invalidate_cache\n end", "def flush_cache!\n flush!(:manually_requested)\n end", "def after_update(data_set)\n expire_cache_for(data_set)\n end", "def sync\n @lock.synchronize do\n if @cache.in_transaction?\n @cache.abort_transaction\n @cache.flush\n PEROBS.log.fatal \"You cannot call sync() during a transaction: \\n\" +\n Kernel.caller.join(\"\\n\")\n end\n @cache.flush\n end\n end", "def commit_transaction(session)\n session.commit_transaction\n Threaded.clear_modified_documents(session).each do |doc|\n doc.run_after_callbacks(:commit)\n end\n end", "def commit\n update\n end", "def commit_if_delete_dirty\n # no op\n end", "def commit\n # Nothing to do for an in memory database\n end", "def flushdb; end", "def after_update(place)\n expire_cache_for(place)\n end", "def commit!\n save! unless persisted?\n end", "def memcache_flush\n memcache_key = self.singleton_class.get_memcache_key_object.key_template % {\n shard_identifier: self.singleton_class.shard_identifier,\n user_kyc_detail_id: self.user_kyc_detail_id,\n user_extended_detail_id: self.user_extended_detail_id\n }\n Memcache.delete(memcache_key)\n end", "def after_commit(&blk)\n ActiveRecord::Base.connection.add_transaction_record(\n AfterCommitWrapper.new(&blk)\n )\n end", "def after_update(doc)\n\t\t# expire_cache_for(doc)\n\tend", "def commit!\n _commit( false )\n end", "def commit; end", "def commit; end", "def commit; end", "def commit\n # no op\n end", "def do_after_create \n flush_redis()\n end", "def flush\n # super \n # self.info \"FLUSH_CALLED\"\n end", "def memcache_flush\n admin_memcache_key = EntityDraft.get_memcache_key_object.key_template % {id: self.id}\n Memcache.delete(admin_memcache_key)\n end", "def after_save(category)\r\n expire_cache_for(category)\r\n end", "def memcache_flush\n ukcd_memcache_key = self.singleton_class.get_by_ued_memcache_key_object.key_template % {\n user_extended_detail_id: self.user_extended_detail_id,\n shard_identifier: self.singleton_class.shard_identifier\n }\n Memcache.delete(ukcd_memcache_key)\n end", "def commit( defer=false )\n save_logic( defer, false )\n end", "def flush!\n @redis.flushdb\n end", "def dont_write_cache_commitment\n if changes['quantity_committed']\n self.quantity_committed = changes['quantity_committed'][0]\n end\n end", "def after_create(resume) \n expire_cache_for(resume) \n end", "def flush_cache!\n @cached_dependencies = {}\n end", "def after_update(entry)\n expire_cache_for(entry)\n end", "def memcache_flush\n customer_memcache_key = Customer.get_memcache_key_object.key_template % {id: self.id}\n Memcache.delete(customer_memcache_key)\n end", "def commit_db_transaction() end", "def commit_db_transaction() end", "def after_update(event)\r\n expire_cache_for(event)\r\n end", "def after_update(event)\n expire_cache_for(event)\n end", "def after_update(event)\n expire_cache_for(event)\n end", "def flush()\n #This is a stub, used for indexing\n end", "def after_update(bite)\n expire_cache_for(bite)\n end", "def after_save(change)\n timing \"Expiring change cache\"\n case change.change_type\n when Change::OWNERSHIP\n expire_item_cache(change)\n when Change::PERSON_LOCATION\n expire_map_cache(change)\n when Change::PERSON_MAIN_LOCATION\n expire_map_cache(change)\n end\n end", "def commiter() end", "def commit\n @read_lock.synchronize do\n @write_lock.synchronize do\n unless @saved\n storage.store(self.class, @id, @data.dup)\n end\n @saved = true\n end\n end\n end", "def after_update(post)\n expire_cache_for(post)\n end", "def after_update(post)\n expire_cache_for(post)\n end", "def flushdb\n end", "def commit\n query 'commit'\n self\n end", "def force_flush\n snapshot = lock { fetch_batch }\n export_batch(snapshot)\n end", "def commit\n {}\n end", "def commit\n {}\n end", "def on_prepare_transaction_commit(unit, transaction); end", "def commit(txn)\n @current_transaction = txn.outer\n if @current_transaction\n @mode = @current_transaction.mode\n @current_transaction.read_cache = @read_cache\n @current_transaction.write_cache = @write_cache\n @current_transaction.delete_cache = @delete_cache\n else\n close\n end\n end", "def after_update(category)\r\n expire_cache_for(category)\r\n end", "def memcache_flush\n memcache_key = self.singleton_class.get_memcache_key_object.key_template % {\n shard_identifier: self.singleton_class.shard_identifier,\n aml_search_uuid: aml_search_uuid\n }\n Memcache.delete(memcache_key)\n end", "def update_filter_cache_and_save!\n new_filter_cache = update_filter_cache!\n update_column(:filter_cache, new_filter_cache.to_yaml)\n end", "def flushdb\n @redis.flushdb\n end", "def flush\n remove!\n store!\n end", "def after_update(user)\n expire_cache_for(user)\n end", "def memcache_flush\n memcache_key = ClientWebhookSetting.get_memcache_key_object.key_template % {id: self.id}\n Memcache.delete(memcache_key)\n\n memcache_key = ClientWebhookSetting.get_active_memcache_key_object.key_template % {client_id: self.client_id}\n Memcache.delete(memcache_key)\n\n if self.previous_changes[\"secret_key\"].present?\n memcache_key = ClientWebhookSetting.get_decrypted_secret_key_memcache_key_object.key_template % {id: self.id, client_id: self.client_id}\n Memcache.delete(memcache_key)\n end\n\n end", "def after_update(comment)\n expire_cache_for(comment)\n end", "def after_save(announcement)\n expire_cache_for(announcement)\n end", "def commit\n if defined? _commit\n if dirty?\n _commit\n end\n end\n nil\n end", "def commit\n @handle.commit\n super\n end", "def on_prepare_commit(unit, aggregates, events); end", "def clear_cache; end", "def transaction(&block)\n @cache.transaction do\n yield(@cache)\n end\n end", "def flushdb\n redis.flushdb\n end", "def memcache_flush\n client_pepo_campaign_details_memcache_key = ClientPepoCampaignDetail.get_memcache_key_object.key_template % {client_id: self.client_id}\n Memcache.delete(client_pepo_campaign_details_memcache_key)\n end", "def after_update(record)\n if Rails.configuration.cache_classes == true\n expire_cache_for(record, 'update')\n end\n end", "def update_cache\n # Does nothing...up to subclasses to implement.\n end", "def after_create(data_set)\n expire_cache_for(data_set)\n end", "def commit\n @MySQLConnection.query('commit')\n end", "def commit(&block)\n autosave = @autosave\n @autosave = false\n result = nil\n\n reload\n\n begin\n result = block.call\n save\n rescue\n reload\n raise\n ensure\n @autosave = autosave\n end\n\n result\n end", "def after_update(flatseeker)\n expire_flatseeker_cache(flatseeker)\n end", "def after_update(category)\r\n expire_cache_for(category)\r\n end", "def after_create(record)\n expire_cache_for(record)\n end", "def after_create(record)\n expire_cache_for(record)\n end", "def flush\n #\n end", "def after_create(entry)\n expire_cache_for(entry)\n end", "def memcache_flush\n entity_group_draft_memcache_key = EntityGroupDraft.get_memcache_key_object.key_template % {entity_group_id: self.entity_group_id}\n Memcache.delete(entity_group_draft_memcache_key)\n end", "def do\n execute flush\n end", "def memcache_flush\n client_memcache_key = ClientKycPassSetting.get_memcache_key_object.key_template % {client_id: self.client_id}\n Memcache.delete(client_memcache_key)\n end", "def flush\n manager.flush\n end", "def save_with_after_commit_callback(*args)\n value = save_without_after_commit_callback(*args)\n callback(:after_commit) if value\n return value\n end", "def commit!() raise NotImplementedError end", "def initial_commit?; end", "def initial_commit?; end", "def after_create(place)\n expire_cache_for(place)\n end" ]
[ "0.7581641", "0.704463", "0.6856635", "0.6757413", "0.6685827", "0.6612565", "0.65489966", "0.6517052", "0.65009147", "0.6465788", "0.64382744", "0.6392084", "0.63724405", "0.627416", "0.627416", "0.62586933", "0.623441", "0.6228812", "0.621239", "0.617918", "0.6144191", "0.61289525", "0.6109743", "0.61062187", "0.61039615", "0.60442555", "0.60429215", "0.60411984", "0.6040699", "0.60339904", "0.6033139", "0.6033139", "0.6033139", "0.60118634", "0.59918374", "0.5983118", "0.59458154", "0.59419465", "0.5932517", "0.59315985", "0.59194076", "0.59130144", "0.590571", "0.5893356", "0.5887276", "0.5875392", "0.58651376", "0.58651376", "0.5852219", "0.5848383", "0.5848383", "0.58478236", "0.58434224", "0.5839123", "0.58324045", "0.58174217", "0.5816983", "0.5816983", "0.5805253", "0.5795688", "0.57795", "0.57788414", "0.57788414", "0.5772812", "0.57665986", "0.57485396", "0.573536", "0.57321346", "0.5731066", "0.5730619", "0.5706937", "0.5705344", "0.57017887", "0.56966215", "0.56893384", "0.56862694", "0.56859803", "0.5683257", "0.5679026", "0.5676941", "0.566745", "0.5655666", "0.5651612", "0.5645674", "0.563293", "0.5630861", "0.5628646", "0.5626236", "0.55978227", "0.55978227", "0.5592474", "0.5590351", "0.55889577", "0.557785", "0.5577278", "0.55682814", "0.55590934", "0.5556115", "0.5543269", "0.5543269", "0.5539558" ]
0.0
-1
module CoversWithCache add Covercache supporting to model
def covers_with_cache caller_source = caller.first[/[^:]+/] class_eval do @covercache_caller_source = caller_source include Covercache::ModelConcern extend Covercache::DefiningHelper end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configure_cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache_store; end", "def cache_store; end", "def cache_on?; end", "def cache_on?; end", "def add_cache_control; end", "def try_with_cache(obj, source, consume_all); end", "def cache\n DataCache\n end", "def cached?; end", "def expire_covercache\n self.class.send :expire_covercache\n end", "def _cache_control; end", "def class_cache # :nodoc:\n end", "def class_cache # :nodoc:\n end", "def cover\n # we have cover set test because not sufficient to\n # just test for @cover.nil? because nil is a valid\n # condition for @cover and we don't want to go\n # back through all the logic again\n if !@cover_set\n @cover = cover_fetch\n @cover_set = true\n end\n @cover\n end", "def cache; shrine_class.new(cache_key); end", "def move_to_cache\n true\n end", "def cacheable?\n true\n end", "def instance_cache; end", "def move_to_cache\r\n true\r\n end", "def cache!\n @@cache\n end", "def use_cache(cache)\n @cache = cache\n end", "def move_to_cache\n true\n end", "def move_to_cache\n true\n end", "def move_to_cache\n true\n end", "def cache(data); end", "def cache_classes; end", "def cache_classes; end", "def generate_model_digest!\n self.covercache_model_digest = generate_model_digest\n end", "def set_cache(value); end", "def set_cache(value); end", "def cache_request\n cache\n end", "def filter_cache; end", "def load_cache\n @load_cache\n end", "def update_cache\n # Does nothing...up to subclasses to implement.\n end", "def cache\n @cache ||= build_cache\n end", "def cached\n raise NotImplementedError\n end", "def save_client_cache\n self.client_cache = @client.cache\n end", "def cache_value?; end", "def cache\n clone.tap { |crit| crit.options.merge!(:cache => true) }\n end", "def cache\n yield\n end", "def to_json(*args)\n Rails.cache.fetch expand_cache_key(self.class.to_s.underscore, cache_key, 'to-json') do\n super\n end\n end", "def use_cache?\n super && !against_head?\n end", "def use_cache?\n super && !against_head?\n end", "def initialize(cache)\n self.cache = cache\n end", "def cache?\n false\n end", "def cache_collect\n\t\tRepository.repo.get_from_cache(@template)\n\tend", "def should_cache?\n false\n end", "def cache\n @cache ||= ::Shopidav::Cache.new(site)\n end", "def cache_fetch(*args)\n super { |key| @store[key] }\n end", "def simple_cache\n @@cache_store\n end", "def cache\n store = Moneta.new :File, dir: 'moneta'\n Cachy.cache_store = store\n Cachy\n end", "def flush_cache; end", "def get_cache_object\n return @cache_obj unless @cache_obj == nil\n @cache_obj = ChaiIo::Cache::RedisCache.new\n @cache_obj\n end", "def add_on(key, cache_class)\n CACHES[key] = new(cache_class)\n CACHES[key].instance_variable_set(\"@cache_name\", key)\n self.class.class_eval do\n define_method(key){ CACHES[key] }\n end\n end", "def without_cache(&block); end", "def without_cache(&block); end", "def create\n cache_id = params[:cache_id]\n match_id = params[:match_id]\n cache_hit = friend_client.get(cache_id, cache_type)\n if cache_hit.uin_belongs_to != current_uin()\n redirect_to root_url, status: 403\n else\n confirm_cache_hit(cache_hit, method: :update, match_id: match_id)\n friend_client.refresh()\n redirect_to friends_url\n end\n end", "def load_albums\n if (self.json = cache_fetch).nil?\n # not found in the cache, need to call the database to fetch them\n user_id = user.id\n if (public)\n albums = []\n else\n # get all the acls for this user so we can find albums in one query\n # also need to track album_id => role so after we have the album we\n # can attach that local data to each album result\n album_ids = []\n album_roles = {}\n tuples = AlbumACL.get_acls_for_user(user_id, AlbumACL::VIEWER_ROLE, false)\n tuples.each do |tuple|\n album_id = tuple.acl_id.to_i\n album_ids << album_id\n album_roles[album_id] = tuple.role.name\n end\n # now do the query to fetch all the albums\n albums = ::Album.find(:all, :conditions => ['id IN (?)', album_ids])\n end\n\n # add ourselves to the track set because we want to be\n # invalidated if our albums change\n # user_id, tracked_id, album_type\n user_id = user.id\n # now build the list of ones we should put in the cache\n # don't put in ones that are ours - should we also not show albums we are a viewer for unless it has batch > 0?\n visible_albums = []\n albums.each do |album|\n next if (user_id == album.user_id) # don't show our own albums\n album_id = album.id\n album.my_role = album_roles[album_id]\n # track the ones we care about if they change\n add_tracked_album(album_id, album_type)\n visible_albums << album\n end\n\n # track any additions or removals from our acl\n add_tracked_user_invites(user_id, album_type)\n\n # and update the cache with the albums\n self.current_version = updated_cache_version if current_version == 0\n self.albums = albums_to_hash(visible_albums)\n version_tracker.add([album_type, self.albums, current_version])\n end\n end", "def cache(opts = {}, &block)\n expiration_time = (opts[:expires_in] || default_expire_time).to_i\n stale_time = (opts[:stale_for] || default_stale_if_error_time).to_i\n cache_key = opts[:key]\n\n set_headers(expiration_time, stale_time)\n\n if expiration_time > 0\n ::Rails.cache.fetch(cache_key, raw: true, expires_in: expiration_time) do\n block.call.to_json\n end\n else\n block.call.to_json\n end\n end", "def find_with_cache hash, config\n cache = config.cache.get config.key.(hash, config)\n if cache\n hash = config.deserialize.(cache, config)\n if hash[:version] == config.model_class.unicache_version\n return dataset.row_proc.call hash[:values]\n end\n end\n model = yield\n Write.write model if model\n model\n end", "def update_cache\n if $redis.set(\"#{self.class.table_name}/#{self.id}\", self.to_json) == \"OK\"\n true\n else\n false\n end\n end", "def disable_caching; end", "def findIssueCover(unit, volume, issue, caption, dbAttrs)\n key = \"#{unit}:#{volume}:#{issue}\"\n if !$issueCoverCache.key?(key)\n # Check the special directories for a cover image.\n filename = \"#{volume.rjust(2,'0')}_#{issue.rjust(2,'0')}_cover\"\n imgPath = nil\n # Try a couple old directories, and both possible file extensions (for JPEG and PNG images)\n [\"/apps/eschol/erep/xtf/static/issueCovers\", \"/apps/eschol/erep/xtf/static/brand\"].each { |staticDir|\n [\"jpg\", \"png\"].each { |ext|\n path = \"#{staticDir}/#{unit}/#{volume.rjust(2,'0')}_#{issue.rjust(2,'0')}_cover.#{ext}\"\n File.exist?(path) and imgPath = path\n }\n }\n data = nil\n if imgPath\n data = putImage(imgPath)\n caption and data[:caption] = sanitizeHTML(caption)\n end\n $issueCoverCache[key] = data\n end\n\n $issueCoverCache[key] and dbAttrs['cover'] = $issueCoverCache[key]\nend", "def cache\n @cache ||= Flareshow::Cache.new\n end", "def call_with_cache(key)\n cache.key?(key) ? cache[key] : cache[key] = fetch(key).call\n end", "def cache\n @__cache ||= Cache.new self\n end", "def cache=(_arg0); end", "def cache=(_arg0); end", "def cache=(_arg0); end", "def cache=(_arg0); end", "def fetch_from_cache\n get_cache_object().get make_key\n end", "def disable_caching=(_arg0); end", "def cache(&block)\n if ActiveRecord::Base.configurations.blank?\n yield\n else\n self.connection_proxy.cache(&block)\n end\n end", "def cached(cache_key)\n begin\n result = yield\n $memcache.set(cache_key, result, 7200)\n warn \"Component #{cache_key} Set Successfully\" \n result\n rescue\n {}\n end\n end", "def cache(new_cache = nil)\n @cache = new_cache if new_cache\n @cache\n end", "def cacheable?\n @cacheable\n end", "def counter_cache; end", "def photo__cache\r\n@photo_cache ||= {}\r\nend", "def cache_key\n 'SmallStructureSerializer/' + object.cache_key + '/v1'\n end", "def cache_classes=(_arg0); end", "def cache_classes=(_arg0); end", "def cache_store=(_arg0); end", "def cache_store=(_arg0); end", "def load_cache\n q = @client.caches.get(:name=>name)\n @client.logger.debug \"GOT Q: \" + q.inspect\n @data = q.raw\n q\n end", "def cache_dir; end", "def cache_dir; end", "def cache(key, opts = {}, &block)\n instance.cache(key, opts, &block)\n end", "def fetch\n self.version = begin\n ver = cache.fetch(CACHE_VERSION_KEY) do\n {'version' => Tml.config.cache[:version] || 'undefined', 't' => cache_timestamp}\n end\n validate_cache_version(ver)\n end\n end", "def cache_size\n super\n end", "def cache_or_fetch(url)\n cache_key = \"badge_host_urls/#{url}\"\n if (cache = $redis.get cache_key)\n cache\n else\n body = Curl.get(url).body_str\n $redis.set cache_key, body\n body\n end\n end", "def cache(key)\n if !@cache_client\n # no cache client\n return yield self\n end\n\n if result = @cache_client.get(key)\n # cache hit\n result\n else\n #cache miss\n result = yield self\n @cache_client.set(key, result)\n result\n end\n end", "def cache_store_type\n \"dummy\"\n end", "def define_cachedp_method\n # we don't expect this to be called more than once, but we're being\n # defensive.\n return if defined?(cached?)\n\n if defined?(::ActiveRecord) && ::ActiveRecord::VERSION::STRING >= '5.1.0'\n def cached?(payload)\n payload.fetch(:cached, false)\n end\n else\n def cached?(payload)\n payload[:name] == CACHED_QUERY_NAME\n end\n end\n end" ]
[ "0.6357437", "0.6268477", "0.6268477", "0.6268477", "0.6268477", "0.6268477", "0.6268477", "0.6268477", "0.6183217", "0.6183217", "0.6162457", "0.6162457", "0.613618", "0.59364855", "0.5872063", "0.5791188", "0.57861686", "0.5727563", "0.57244796", "0.57244796", "0.57216614", "0.56901866", "0.56675196", "0.565195", "0.564498", "0.5634876", "0.56311154", "0.5615163", "0.5610522", "0.5610522", "0.5610522", "0.5591721", "0.55557275", "0.55557275", "0.55533504", "0.55357957", "0.55357957", "0.5522408", "0.5497025", "0.54954123", "0.54834986", "0.54719406", "0.5459558", "0.5458932", "0.5450016", "0.54461676", "0.540393", "0.54027945", "0.53531647", "0.53531647", "0.5348846", "0.5340824", "0.5337246", "0.53357905", "0.5332073", "0.5327385", "0.53267634", "0.5308135", "0.53030866", "0.52912384", "0.52874887", "0.5276253", "0.5276253", "0.5270715", "0.52620494", "0.52592444", "0.5256891", "0.5256515", "0.52512926", "0.5249883", "0.52318674", "0.5228922", "0.5215471", "0.5212835", "0.5212835", "0.5212835", "0.5212835", "0.5207741", "0.52077025", "0.5198094", "0.5197714", "0.5197112", "0.51920086", "0.5188406", "0.517972", "0.516268", "0.5152047", "0.5152047", "0.51492745", "0.51492745", "0.51472026", "0.5145834", "0.5145834", "0.51451266", "0.5139733", "0.5137612", "0.5135782", "0.51239485", "0.5121526", "0.5117294" ]
0.7835024
0
sum of all y cords
def initialize(x,y) @x, @y = x,y end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ady(y)\n y * MINIMAP_RATIO + P_Y\n end", "def sum_values\n points.sum\n end", "def y()\n val = @b;\n @n.times {|i|\n val += @wn[i] * @xn[i];\n }\n return val;\n end", "def y2\n y + h\n end", "def total(array)\n y = 0\n array.each {|x| y = x + y}\n return y\nend", "def sum\n [@r,@g,@b].inject(:+)\n end", "def y2\n y + height\n end", "def sum(array)\n y = 0\n array.each do |x|\n y += x\n end\n y\nend", "def suma_lyginiu(array)\n result = 0\n array.each do |number|\n result += number if yra_lyginis(number)\n end\n result\n end", "def x_add_y\n x = @x.content\n y = @y.content\n z = Array.new @x.length, 0\n\n carry = 0\n\n # claulate x + y = z\n @x.length.times do |i|\n tmp = x[i] + y[i] + carry\n z[i] = tmp % 2\n carry = tmp / 2\n end\n\n @z.content = z\n end", "def y2d(y)\n\treturn 0 if y.to_i == 0\n\ty.to_i - y.to_s.scan(/./).last.to_i\nend", "def sum; end", "def ady(n)\n ; n * MAP_RATIO + M_Y;\n end", "def total(x)\n sum = 0\n\tx.each do |i|\n\t\tsum += i\n\tend\n\treturn sum\nend", "def sum_operator_production(operator_id, zone_set)\n zone_set.inject(Yarray.new(year)) { |sum, zone_id| sum + Yarray.new(year, arr: @operator_production[operator_id][zone_id]) }\n end", "def y\n r * Math.sin(theta)\n end", "def sum(x, y)\n\nend", "def y2; y1 + HEIGHT ; end", "def sumOfXBelowY(x, y)\n y = y - 1\n tmp = y.div(x)\n return x*(tmp*tmp+tmp)/2\nend", "def sum_of_squares values\n values.collect { |v| v**2 }.reduce(:+)\nend", "def sse\n @sse ||= sum(@y.zip(y_hat).map { |y, yh| (y - yh)**2 })\n end", "def sum(x,y)\r\n\t x + y\r\n\tend", "def sum_of_squares\n\t\t\tinject(0) do |sum, elem|\n\t\t\t\tsum + (elem ** 2)\n\t\t\tend\n\t\tend", "def sum_of_the_squares\n sum = 0\n (1..self).each do |n|\n sum += n**2\n end\n sum\n end", "def y(from = 0)\n self[1,2].to_i - 1 + from\n end", "def xxx(x, y)\n sum = 0\n\n x.each_index do |i|\n sum += (x[i] * y[i])\n end\n\n sum\nend", "def sum_hours\n @hours.each do |row|\n @cycling[0] += row[0].to_f\n @entertainment[0] += row[1].to_f\n @programming[0] += row[2].to_f\n @reading[0] += row[3].to_f\n @yoga[0] += row[4].to_f\n end\n end", "def kcal\n x = collect{|a| a.kcal}\n y = x.inject(0, :+)\n y\n end", "def accumulate_points(points)\n points.map{|point| point.value}.reduce(0, :+)\n end", "def accumulate(xbar)\n @x.accumulate(@y.transposed_value*xbar)\n @y.accumulate(xbar*@x.transposed_value)\n end", "def sum_of_squares\n @range.sum { |n| n**2 }\n end", "def total\n @state[0]*VALUES[0] + @state[1]*VALUES[1] + @state[2]*VALUES[2] + @state[3]*VALUES[3] + @state[4]*VALUES[4]\n end", "def total\n squares = (1..64).map{|i| square(i)}\n squares.inject(:+)\n end", "def getY() @y end", "def sum\n\t\treturn self.reduce(:+)\n\tend", "def sum_of_squares\n squares = differences_from_mean.map { |diff| diff ** 2 }\n squares.reduce(:+)\n end", "def hd_sum(config = HD::HDConfig.new)\n total = 0\n all_pairs = []\n self.pairs.each {|x,y| all_pairs << [x,y]}\n all_pairs.each {|x| total += x[0].distance(x[1], config)}\n total\n end", "def getSum ( x , y )\n\tsum = x + y\n\treturn sum\nend", "def sum_of_squares\n self.inject(0) { |sos, n| sos + n**2 }\n end", "def sst\n @sst ||= sum(@y.map { |y| (y - y_bar)**2 })\n end", "def value(x, y)\r\n return 1 if x == 1 || y == 1\r\n value(x - 1, y) + value(x, y - 1)\r\nend", "def total array\n\tsum = 0\n\tarray.each do |x|\n\t\tsum = sum + x\n\tend\n\treturn sum\nend", "def sum_of_squares\n end", "def y\n @data[:y]\n end", "def sum (array)\n y=array.inject(:+).to_i\nend", "def total\n Float(@values.values.reduce(:+))\n end", "def get_y; \t\t@y \t\t\tend", "def sum_square(x, y)\n\tx**2 + y**2\nend", "def sum\n reduce(0, &:+)\n end", "def two_d_sum(arr)\r\n totalSum = 0\r\n arr.each do |ele|\r\n partialSum = 0\r\n ele.each do |num|\r\n partialSum += num\r\n end\r\n totalSum += partialSum\r\n end\r\n return totalSum\r\nend", "def sum_all()\n values = [700, 44, 10, 1, -4, 0, 44, 1001, 88]\n sum = 0\n values.each do |i|\n sum += i\n end\n p sum\nend", "def sumAllArray(adjacency, index, central)\n\t\tvalue = 0\n\t\ti = 0\n\n\t\tadjacency.each do |e|\n\t\t\tif i == central\n\t\t\t\ti+=1\n\t\t\tend\n\n\t\t\tif @solutions[index+1][i].nil?\n\t\t\t\tvalue += (e*@solutions[index][i])\n\t\t\telse\n\t\t\t\tvalue += (e*@solutions[index+1][i])\n\t\t\tend\n\n\t\t\ti+=1\n\t\tend\n\n\t\treturn value\n\tend", "def sum_of_point\n # Calculating point of each block\n calculate_points\n # Sum\n rubbish_count + not_clear_count + somewhat_count + understand_count\n end", "def sum\n self.inject(:+)\n end", "def square_sum\n self.inject(0.0){|accum, i| accum +i**2 }\n end", "def matrix_region_sum(matrix, top_left_coords, bottom_right_coords)\n\n x1, y1 = top_left_coords\n x2, y2 = bottom_right_coords\n sum = 0\n (x1..x2).each do |x|\n (y1..y2).each do |y|\n puts matrix[x][y]\n sum += matrix[x][y]\n end\n end\n sum\n\nend", "def total(arr)\n\tarr.inject(0) { |x, y| x + y }\nend", "def two_d_sum(arr)\ntotal = 0\n\narr.each do |sub_array|\n sub_array.each do |num|\n total += num\n end\nend\n\nreturn total\nend", "def two_d_sum(arr)\n\tsum = 0\n arr.each do |subArray|\n subArray.each do |i|\n sum += i\n end\n end\n return sum\nend", "def total(arr)\n\t output = 0\n\t arr.each do |x|\n\t output += x\n\t end\n\t output\nend", "def total(arr)\n\t output = 0\n\t arr.each do |x|\n\t output += x\n\t end\n\t output\nend", "def surface\n values.sum\n end", "def two_d_sum(arr)\n sum = 0\n arr.each do | el1 |\n el1.each do | el2|\n sum = sum + el2\n end\n end\n puts\n return sum\nend", "def diff_y\n self.y - @last_y\n end", "def square_of_sum\n\t\t@n**2*(@n+1)**2/4\n\tend", "def total_sum\n rows.collect(&:sum_with_vat).sum\n end", "def diff_y\n (@spr_battler.y + @spr_battler.oy) - y\n end", "def abs_sum()\n self.abs().sum()\n end", "def y\n @components[:y]\n end", "def total_digestate_tonnes\n\t\t(calculations.collect(&:calc_digestate_tonnes).sum).round 2\n\tend", "def square_of_sum\n @range.sum**2\n end", "def total_score \n \t\t@scores_array.reduce(0, :+) \n\tend", "def sum_overall\n @categories.inject(0.0) { |sum, (name, cat)| sum + cat[:sum] }\n end", "def total\n total = 0\n for i in 0...size\n total += i * self.frequency[i]\n end\n total\n end", "def cal()\n @v = 0.0;\n @n.times {|i|\n @v += @wn[i] * @xn[i];\n }\n nil;\n end", "def two_d_sum(arr)\n total = 0\n\n arr.each do |sub_array|\n sub_array.each do |num|\n total += num\n end\n end\n\n return total\nend", "def arraysum\n return self.inject(0){|acc,i|acc +i}\n end", "def two_d_sum(array)\n sum = 0 \n array.each do |sub_array|\n sub_array.each do |num|\n sum += num \n end\n end\n\n sum\nend", "def array_to_sum(input)\n arr_sum = []\n\n input.each_with_index do |x,y| \n arr_sum << x*10**(input.size - (y + 1))\n end\n\n arr_sum.sum\nend", "def sum arr\n return arr.sum() # 합\nend", "def suma_arreglo(array)\n array.reduce(:+)\nend", "def calculate(data = @data)\r\n ft = []\r\n for k in 0...data.length do\r\n tot = 0\r\n data.each_with_index do |x_n, n|\r\n tot += x_n * Math::E ** (Complex(0,-1) * 2.0 * Math::PI * k * n / data.length.to_f)\r\n end\r\n ft << tot\r\n end\r\n ft\r\n end", "def square_of_sum\n end", "def gety\n (@lines[0...@str_idx].map(&:ymax).reduce(:+) || 0) + @str_y_idx - @start_y\n end", "def gety\n (@lines[0...@str_idx].map(&:ymax).reduce(:+) || 0) + @str_y_idx - @start_y\n end", "def total arr\nsum_total = 0\narr.each do |el|\nsum_total += el\nend\nsum_total\nend", "def total(array)\n\tsum = 0\n\tarray.each { |x| sum += x }\t\n\tsum\nend", "def total(array)\n\tarray.inject(:+)\nend", "def sum(addends)\n addends.inject(0, :+)\n end", "def total(array1)\n sum=0.0\n array1.each do|i|\n sum+=i\n end\n return sum\n end", "def total array\n array.reduce(0, :+)\nend", "def sum_region(row1, col1, row2, col2)\n r1,c1 = row1+1, col1+1\n r2,c2 = row2+1, col2+1\n p [\"r1c1\",r1,c1] if @d\n p [\"r2c2\",r2,c2] if @d\n a = @mx[r2][c2]\n l = @mx[r2][c1-1]\n u = @mx[r1-1][c2]\n ul = @mx[r1-1][c1-1]\n a - l - u + ul\n end", "def total(carbon_or_km)\n self.trips.pluck(carbon_or_km).inject{ |sum,x| sum + x }\n end", "def sum_of_squares\n range.reduce { |a, e| a + e**2 }\n end", "def total(array)\n\ttoats = 0\n\tarray.each do |i|\n\t\ttoats = toats + i\nend\nreturn toats\nend", "def marcsCakewalk(calorie)\n arr = calorie.sort.reverse!\n\n sum = 0\n arr.each_with_index do |cal, index|\n sum += cal * (2**index)\n end\n sum\nend", "def total(arr)\n x = arr.reduce(:+)\n return x\nend", "def sum_of_squares\n sum(square(sequence))\n end", "def incr_y(val = 1)\n update(y + val, x)\n apply_pos\n end", "def calcular_ruta(pepsi_x, pepsi_y, indices, x, y)\n i = 0\n origen_x = pepsi_x\n origen_y = pepsi_y\n distancia_total = 0\n while (i < indices.length) do\n destino_x = x[indices[i]]\n destino_y = y[indices[i]]\n distancia = Math.sqrt((destino_x-origen_x)**2 + (destino_y-origen_y)**2)\n distancia_total = distancia_total + distancia\n \n origen_x = destino_x\n origen_y = destino_y\n \n i = i + 1\n end\n \n \n destino_x = pepsi_x\n destino_y = pepsi_y\n \n distancia = Math.sqrt((destino_x-origen_x)**2 + (destino_y-origen_y)**2)\n distancia_total = distancia_total + distancia\n \n return distancia_total\nend", "def sum arr\n total = 0\n arr.each do |i|\n total += i\n end\n total\nend" ]
[ "0.6585418", "0.6456139", "0.64337754", "0.62052333", "0.6080024", "0.60645014", "0.6054051", "0.6044588", "0.6018878", "0.59677845", "0.595193", "0.59281915", "0.59219617", "0.58807683", "0.5855866", "0.580149", "0.5791478", "0.57560444", "0.57200843", "0.5711262", "0.5709579", "0.57047755", "0.5692777", "0.5672394", "0.5669773", "0.5667994", "0.5641464", "0.5623082", "0.5622987", "0.5622893", "0.5619256", "0.56151265", "0.56096256", "0.5592539", "0.5571876", "0.5560919", "0.5560374", "0.5554317", "0.5554131", "0.5527838", "0.55270416", "0.55010694", "0.549766", "0.549326", "0.5492185", "0.5480878", "0.546217", "0.5460733", "0.545873", "0.5453319", "0.54471564", "0.5446911", "0.54457617", "0.54437405", "0.54427004", "0.542249", "0.54198056", "0.5401939", "0.54009295", "0.5395329", "0.5395329", "0.5393698", "0.5392206", "0.5391818", "0.53820324", "0.5377432", "0.53766197", "0.5374247", "0.5368221", "0.53657943", "0.53618467", "0.5361659", "0.5361458", "0.53504354", "0.5348852", "0.53483015", "0.53473", "0.53390026", "0.533745", "0.5337003", "0.53305215", "0.53265935", "0.53161556", "0.53151256", "0.53151256", "0.53138", "0.5310166", "0.53095007", "0.52987766", "0.5297288", "0.5287696", "0.52874774", "0.52848065", "0.5284717", "0.5284519", "0.52844745", "0.5282737", "0.5281236", "0.52793616", "0.5274821", "0.5273585" ]
0.0
-1
Examples: s = "leetcode" return 0. s = "loveleetcode", return 2. Note: You may assume the string contain only lowercase letters.
def first_uniq_char(s) s_hash = {} characters_in_order = [] s.each_char.with_index do |char, index| if s_hash[char] s_hash[char][:occurences] += 1 characters_in_order -= [char] else s_hash[char] = { occurences: 1, index: index } characters_in_order << char end end characters_in_order.empty? ? -1 : s_hash[characters_in_order.first][:index] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solution(s)\n return 0 if s.empty?\n t = 0\n ('A'..'Z').to_a.each do |c|\n t += s.count(c)\n end\n t + 1\nend", "def count_string s,ss\n s.downcase.scan(/(?=#{ss.downcase})/).count\nend", "def getCount(inputStr)\n inputStr.downcase.count('aeiou')\nend", "def getCount(inputStr)\n inputStr.downcase.count('aeiou')\nend", "def double_letter_count(string)\n\tcount = 0\n \tval = 0\n \twhile count < string.length\n if string[count] == string[count + 1]\n val +=1\n end\n count +=1\n end\n\treturn val\n end", "def getCount(inputStr)\n inputStr.downcase.count('aeiou')\nend", "def getCount(s)\n s.count('aeiou')\nend", "def get_count(input_str)\n input_str.downcase.count(\"aeiou\")\nend", "def getCount(inputStr)\n inputStr.downcase.count(\"aeiou\")\nend", "def getCount(inputStr)\n inputStr.count 'aeiouAEIOU'\nend", "def double_letter_count(string)\n\tcount = 0\t\n \t(0...string.length).each do |i|\n \tif string[i] == string[i-1]\n \t\tcount += 1\n end\n end\n \treturn count\nend", "def getCount(str)\n str.count(\"AEIOUaeiou\")\nend", "def LetterCountI(str)\n g_word, g_count = '', 0\n str.split.each do |word|\n word.chars.each do |char|\n if word.downcase.count(char) > g_count\n g_count = word.downcase.count(char)\n g_word = word\n end\n end\n end\n\n g_count <= 1 ? -1 : g_word\nend", "def get_count(input_str)\n input_str.count \"aeiou\"\nend", "def getCount(inputStr)\n return inputStr.count(\"aeiou\")\nend", "def getCount(inputStr)\n inputStr.count('aeiou')\nend", "def getCount(inputStr)\n inputStr.count('aeiou')\nend", "def calc_camel_case(\n string:\n )\n string_array = string.split('')\n result = (string_array[0].eql? string_array[0].downcase) ? 1 : 0\n # scan all characters for upper case\n string_array.each { |char| result += 1 if char.eql? char.upcase }\n # Return result\n result\nend", "def double_letter_count(string)\n count = 0\n\n string.each_char.with_index do |char, idx|\n if char == string[idx + 1]\n count += 1\n end \n end\n\n return count\nend", "def double_letter_count(string)\n count = 0\n string.split.each { |word| count += count(word) }\n count\nend", "def double_letter_count(string)\n\tcount = 0\n \tprev = \"\"\n \tstring.each_char do |c|\n \tif prev == c\n count += 1\n end\n \tprev = c\n end\n \treturn count\nend", "def double_letter_count(string)\ncount = 0\narr = string.split(\"\")\n\ni = 0\nwhile i < arr.length\n\tif arr[i] == arr[i + 1]\n\t\tcount += 1\n\tend\n\ti += 1\nend\n\n\n\nreturn count\n\nend", "def count_char(string, char)\n string.downcase.count(char.downcase)\nend", "def countA(string)\n counter = 0\n string.each_char do |char|\n if char == \"a\"\n counter +=1\n end\n end\n return counter\nend", "def count_syllables(str)\n\tstr = str.downcase\n\tarr = str.split('')\n\tsentry = arr[0]\n\tsyllable = arr[0]\n\tarr.shift\n\tarr.each do |n| \n\t\tif n == sentry\n\t\t\tbreak \n\t\telse\n\t\t syllable += n \n\t\tend\n\tend\n\tstr.scan(syllable).size\nend", "def str_count(word, letter)\n p word.count(letter)\nend", "def getCount(inputStr)\n inputStr.chars.count{|letter| letter=~/[aeiou]/}\nend", "def letter_case_count(str)\n lowercase_str = 'a-z'\n uppercase_str = 'A-Z'\n neither_str = '^A-Za-z'\n\n lowercase_count = str.count(lowercase_str)\n uppercase_count = str.count(uppercase_str)\n neither_count = str.count(neither_str)\n\n puts \"{ lowercase: #{lowercase_count}, uppercase: #{uppercase_count}, neither: #{neither_count} }\"\nend", "def count_char(string, char)\n string.downcase.chars.count(char.downcase)\nend", "def letter_case_count(string)\n hash = { lowercase: 0, uppercase: 0, neither: 0 }\n str_arr = string.chars\n counter = 0\n while counter < str_arr.size\n if str_arr[counter] =~ /[a-z]/\n hash[:lowercase] += 1\n elsif str_arr[counter] =~ /[A-Z]/\n hash[:uppercase] += 1\n else\n hash[:neither] += 1\n end\n counter += 1\n end\n hash\nend", "def str_count(word, letter)\n # Code here\n word.count(letter)\nend", "def getCount(inputStr)\n vowels = [\"a\",\"e\",\"i\",\"o\",\"u\"]\n count = 0\n \n letters = inputStr.split(\"\")\n letters.each { |letter|\n if vowels.include?(letter)\n count += 1\n end\n }\n count\nend", "def count_code(string) # return the number of times 'co'+any_char+'e' appears\n return string.scan(/co.e/).length #easy way with regex\nend", "def string_sum(string)\n letters = ('a'..'z').to_a\n sum = 0\n string.split(\"\").each{|x| sum += letters.index(x) + 1}\n sum \nend", "def double_letter_count(string)\n count = 0\n lastChar = ''\n string.each_char do |char|\n if char == lastChar\n count += 1\n end\n lastChar = char\n end\n return count\nend", "def getCount(str)\n # str = \"abracadabra\" => 5\n vowels = [\"a\", \"i\", \"e\", \"o\", \"u\"]\n str.split(\"\").filter { |letter| vowels.include?(letter) }.count # filter is an alias for select\nend", "def LetterCountI(str)\n\n arr=str.split\n arr.each{|word|\n word.each_char{|char|\n return word if word.count(char)>1\n }\n \n }\n -1\nend", "def count_as(string)\n string_array = string.split(\"\")\n count = 0\n\n string_array.each do |letter|\n if letter == \"a\"\n count += 1\n end\n end\n\n count\nend", "def letter_case_count(string)\n uppercase_counter = 0\n lowercase_counter = 0\n neither_counter = 0\n string.chars.each do |letter|\n case letter\n when /[A-Z]/ then uppercase_counter += 1\n when /[a-z]/ then lowercase_counter +=1\n else neither_counter += 1\n end\n end\n { lowercase: lowercase_counter, uppercase: uppercase_counter, neither: neither_counter }\nend", "def count_letters(string)\n i = 0\n \n length = string.length\n count = 1\n \n summary_string = \"\"\n \n while i < length\n if string[i] == string[i+1]\n count += 1\n else\n summary_string << \"#{string[i]}#{count}\"\n count = 1\n end\n i += 1\n end\n \n if summary_string.length < length\n return summary_string\n else\n return string\n end\nend", "def custom_count(string, search_characters)\n # Return the number of total times that\n # the search character are in the string\n\n # word = string.count(\"#{search_characters}\")\n # word\n count = 0\n word = string.downcase\n word.each_char do |char|\n if search_characters.include?(char)\n count += 1\n end\n end\n count\nend", "def letter_case_count(string)\n hash = { lowercase: 0, uppercase: 0, neither: 0 }\n str_arr = string.chars\n str_arr.each do |char|\n if char =~ /[a-z]/\n hash[:lowercase] += 1\n elsif char =~ /[A-Z]/\n hash[:uppercase] += 1\n else\n hash[:neither] += 1\n end\n end\n hash\nend", "def getCount(inputStr)\n #your code here\n count = 0\n inputStr.chars {|x| x.match(/[aeiou]/) ? count += 1 : count += 0 }\n count\nend", "def getCount(inputStr)\n inputStr.scan(/[aeiou]/i).size\nend", "def getCount(inputStr)\n inputStr.scan(/[aeiou]/i).size\nend", "def letter_case_count(string)\n letter_count = { lowercase: 0, uppercase: 0, neither: 0 }\n letter_count[:lowercase] = string.count('a-z')\n letter_count[:uppercase] = string.count('A-Z')\n letter_count[:neither] = string.count('^a-z', '^A-Z')\n letter_count\nend", "def number_of_vowels(string)\r\n count = string.downcase.scan(/[aeiou]/).size\r\n \r\n case count\r\n when 1\r\n \"There is 1 vowel in this word\"\r\n when 0 \r\n \"There are no vowels in this word\"\r\n else\r\n \"There are #{count} number of vowels\"\r\n end\r\n \r\nend", "def string_sum(string)\n sum = 0\n alphabets = (\"a\"..\"z\").to_a\n string.chars.each do |ch|\n sum += alphabets.index(ch) + 1\n end\n sum\nend", "def duos(str)\n count = 0\n str.each_char.with_index do |char, idx|\n count += 1 if char == str[idx+1]\n end\n count\nend", "def count_char(string, character)\n i = 0\n output = 0\n while i < string.length\n if character == string[i]\n output += 1\n end\n i += 1\n end\n return output\nend", "def ex_oh(str)\n str.downcase.scan(/x/).count == str.downcase.scan(/o/).count\nend", "def get_count(input_str)\n input_str.scan(/[euoai]/).size\nend", "def char_count(s,c)\n\t\tcont = 0\n\t\ts.length.times do |i|\n\t\t\tif(s[i] == c)\n\t\t\t\tcont += 1\n\t\t\tend\n\t\tend\n\t\tcont\n\tend", "def thing\n puts \"Enter String 1\"\n s1 = gets.strip.downcase\n puts \"Enter String 2\"\n s2 = gets.strip.downcase\n distance = 0\n length = s1.length\n for i in 1..length\n if s1[i] == s2[i] then\n distance += 1\n end\n end\n puts distance\nend", "def camelcase(s)\n string = s.split /(?=[A-Z])/\n count = 0\n string.each do |w|\n count +=1\n end\n count\nend", "def num_vowels(str)\n # your code goes here\n new_str = str.downcase\n vowels ='aeiou'\n count = 0\n new_str.each_char do |char|\n if vowels.include?(char)\n count += 1\n end\n end\n\n count\nend", "def getCount(input_str)\n regex = /[aeiou]/\n input_str.split('').select { |char| char if char =~ regex }.count\nend", "def char_counter_2(string, char)\n string.count(char)\nend", "def letter_case_count(string)\n final = { lowercase: 0, uppercase: 0, neither: 0 }\n string.split('').each do |el|\n final[:neither] += 1 unless ('a'..'z').include?(el.downcase)\n final[:lowercase] += 1 if el.downcase == el && ('a'..'z').include?(el.downcase)\n final[:uppercase] += 1 if el.upcase == el && ('a'..'z').include?(el.downcase)\n end\n final\nend", "def letter_case_count(string)\n h = {lowercase: 0, uppercase: 0, neither: 0}\n \n string.chars.each do |char|\n if char =~ /[a-z]/\n h[:lowercase] += 1\n elsif char =~ /[A-Z]/\n h[:uppercase] += 1\n else\n h[:neither] += 1\n end\n end\n\n h\nend", "def letterCountI(str)\n\t# count = 0\n\t# mostRepeatedLetters = ''\n\t# str = str.split('').each{|letter| \n\t# \tif(str.count(letter) > count)\n\t# \t\tcount = str.count(letter)\n\t# \t\tmostRepeatedLetters = str\n\t# \tend\n\t# }\n\t# return mostRepeatedLetters\n\n\tletterCount = 0\n\tletterMaxWord = ''\n\tstr = str.split(' ').each{|word| word.split('').each{|letter| \n\t\tif(word.downcase.count(letter) > letterCount)\n\t\t\tletterCount = word.downcase.count(letter)\n\t\t\tletterMaxWord = word\n\t\tend\n\t\t}}\n\tletterCount > 1 ? (return letterMaxWord) : (return -1)\n\t\nend", "def count_code(str)\n times = 0\n str.size.times do |n|\n if n != (str.size - 1) && n != (str.size - 2) && n != (str.size - 3) && str[n] == \"c\" && str[n + 1] == \"o\" && str[n + 3] == \"e\"\n times += 1\n end\n end\n return times\nend", "def num_vowels(str)\n # your code goes here\n str.downcase!\n str.count(\"aeiou\")\nend", "def old_e_words(str)\n words = str.split\n count = 0\n\n words.each do |word|\n count += 1 if word[-1] == \"e\"\n end\n\n count\nend", "def count_code(str)\n count = 0\n (str.size - 2).times do |i|\n slice = str[i..(i + 3)]\n if slice[0] == \"c\" && slice[1] == \"o\" && slice[3] == \"e\"\n count += 1\n end\n end\n\n return count\n\nend", "def getCount(inputStr)\n inputStr.scan(/[aeiou]/).count\nend", "def count_vowels(string)\n string.downcase.count('aeiou')\nend", "def duos(str)\n count = 0\n str.each_char.with_index do |char,idx|\n\n count += 1 if str[idx+1] == char \n\n end\n count\n\nend", "def count_vowels(str)\n str.count(\"aeoui\")\nend", "def solve(s)\n alphabet = ('a'..'z').to_a\n s.gsub(/[aeiou]/, ' ').split.map { |l| l.chars.map { |i| alphabet.index(i) + 1 }.sum }.max\nend", "def letter_case_count(string)\n count = {}\n string.split.each do |word|\n word.chars.each do |char|\n if char == char.downcase\n count[lowercase:] += 1\n elsif char == char.upcase\n count[uppercase:] += 1\n else\n count[neither:] += 1\n end\n end\n end\ncount\nend", "def funny string\n arr = string.chars\n count = 0\n arr.each_with_index do |x,xi|\n if xi > 0\n s1 = (x.ord - arr[xi-1].ord).abs\n s2 = (arr[-(xi+1)].ord - arr[-xi].ord).abs\n s1 == s2 ? count +=1 : break\n end\n end\n puts count == arr.size-1 ? 'Funny' : 'Not Funny'\nend", "def count_e(word)\n puts word.count('e')\nend", "def count_uppercase_letters(string)\n return string.scan(/[A-Z]/).length\nend", "def count_upcased_letters(string)\n string.chars.count { |character| /[A-Z]/.match character }\nend", "def letter_case_count(string)\n hash = {}\n string.chars.each do |char|\n case char\n when char =~ /[a-z]/\n if hash.keys.include?(:lowercase)\n hash[:lowercase] += 1\n else\n hash[:lowercase] = 1\n end\n when char =~ /[A-Z]/\n if hash.keys.include?(:uppercase)\n hash[:uppercase] += 1\n else\n hash[:uppercase] = 1\n end\n else\n if hash.keys.include?(:neither)\n hash[:neither] += 1\n else\n hash[:neither] = 1\n end\n end\nend\n\nletter_case_count('abCdef 123') == { lowercase: 5, uppercase: 1, neither: 4 }\nletter_case_count('AbCd +Ef') == { lowercase: 3, uppercase: 3, neither: 2 }\nletter_case_count('123') == { lowercase: 0, uppercase: 0, neither: 3 }\nletter_case_count('') == { lowercase: 0, uppercase: 0, neither: 0 }", "def custom_count(string, search_characters)\n total_chars = 0\n #\n search_characters.each_char do |sc|\n # split the string and review letter & sc\n letters = string.each_char { |letter| letter == sc ? total_chars += 1 : next }\n\n end # end of do (search chars)\n\n total_chars\nend", "def double_letter_count(string)\r\n repeats = 0\r\n oldChar = ''\r\n string.each_char do |char|\r\n if oldChar == char\r\n repeats += 1\r\n end\r\n oldChar = char\r\n end\r\n return repeats\r\nend", "def custom_count(string, char)\ncurrent = 0\nstring.chars do |i|\nif i == char\n current += 1\nend\nend\np current\nend", "def NameScore( s )\n\talphabet = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' ]\n\n\tsum = 0\n\n\tfor i in ( 0 .. s.length-1 )\n\t \tsum += alphabet.index( s[i] )+1\n\tend\n\n\treturn sum\nend", "def count_string(string, characters)\n i = 0\n size = characters.length\n hits = 0\n while i < string.length - size + 1\n if string[i,size] == characters\n hits += 1\n end\n i += 1\n end\n return hits\nend", "def count_vowels(s)\n\tp s.count('aeiou')\nend", "def score(s)\n count = 0\n s.split.each do |word|\n count += 1 if @words.include?(word)\n end\n count\n end", "def num_vowels(str)\n vowels = \"aeiou\"\n count = 0\n str.downcase.each_char do |char|\n if vowels.include?(char)\n count += 1\n end\n end\n return count\nend", "def VowelCount(str)\n str.count \"aeiou\" \nend", "def num_vowels(str)\n str.count(VOWELS)\nend", "def find_number_of_first_chars(string1=\"First string\", string2=\"Second string\")\n arr1 = string1.split('')\n arr2 = string2.split('')\n counter = 0\n arr1.each_with_index do |el, i|\n if arr1[i] == arr2[i]\n counter +=1\n else next\n end\n end\n print counter\nend", "def letter_case_count(string)\n lower_c_count = string.count('a-z')\n upper_c_count = string.count('A-Z')\n other_c_count = string.count('^a-zA-Z')\n { lowercase: lower_c_count, uppercase: upper_c_count, neither: other_c_count }\nend", "def letter_case_count(string)\n counter = {}\n\n counter[:lowercase] = string.count('a-z')\n counter[:uppercase] = string.count('A-Z')\n counter[:neither] = string.count('^a-zA-Z')\n\n counter\nend", "def letter_case_count(string)\n count = { lowercase: 0, uppercase: 0, neither: 0 }\n\n string.chars.each do |char|\n if (\"A\"..\"Z\").include?(char)\n count[:uppercase] += 1\n elsif (\"a\"..\"z\").include?(char)\n count[:lowercase] += 1\n else\n count[:neither] += 1\n end\n end \n count\nend", "def vowel_count(str)\n str.downcase.count('aeiou')\nend", "def num_vowels(str)\n vowels = 'aeiou'\n count = 0\n str.downcase.each_char do |char|\n count += 1 if vowels.include?(char)\n end\n count\nend", "def letter_case_count(string)\n counts = {}\n characters = string.chars # breaks up string into array of strings\n counts[:lowercase] = characters.count {|char| char =~ /[a-z]/}\n counts[:uppercase] = characters.count {|char| char =~ /[A-Z]/}\n counts[:neither] = characters.count {|char| char =~ /[^A-Za-z]/}\n counts\nend", "def letter_case_count(string)\n counts = {}\n characters = string.chars\n counts[:lowercase] = characters.count { |char| char =~ /[a-z]/ }\n counts[:uppercase] = characters.count { |char| char =~ /[A-Z]/ }\n counts[:neither] = characters.count { |char| char =~ /[^A-Za-z]/ }\nend", "def vowel_count(string)\n\t\n\tstring.downcase.count \"aeiou\"\n\t\nend", "def letter_case_count(str)\n count_hash = { \n lowercase: 0,\n uppercase: 0,\n neither: 0\n }\n\n str.chars.each do |character|\n if /[[:lower:]]/.match(character)\n count_hash[:lowercase] += 1\n elsif /[[:upper:]]/.match(character)\n count_hash[:uppercase] += 1\n else\n count_hash[:neither] += 1\n end\n end\n\n count_hash\nend", "def letter_case_count(str)\n count_hash = { \n lowercase: 0,\n uppercase: 0,\n neither: 0\n }\n\n str.chars.each do |character|\n if /[[:lower:]]/.match(character)\n count_hash[:lowercase] += 1\n elsif /[[:upper:]]/.match(character)\n count_hash[:uppercase] += 1\n else\n count_hash[:neither] += 1\n end\n end\n\n count_hash\nend", "def co_ecount(str)\n times = 0\n (str.length - 3).times do |i|\n if str[i] == \"c\" && str[i+1] == \"o\" && str[i+3] == \"e\"\n times += 1\n end\n end\n return times\nend", "def count(str, char)\n i = 0\n output = 0\n while i < str.length\n if str[i] == char\n output += 1\n end\n i += 1\n end\n return output\nend", "def count_a(word)\n\tcounter = 0\n \ti = 0\n \twhile i < word.length\n if word[i] == \"a\" || word[i] == \"A\"\n counter += 1\n end\n i += 1\n end\n return counter\nend", "def letter_case_count(string)\n counts = {}\n characters = string.chars\n counts[:lowercase] = characters.count { |char| char =~ /[a-z]/ }\n counts[:uppercase] = characters.count { |char| char =~ /[A-Z]/ }\n counts[:neither] = characters.count { |char| char =~ /[^A-Za-z]/ }\n counts\nend" ]
[ "0.76898426", "0.7440882", "0.73570216", "0.73570216", "0.7313056", "0.72841054", "0.72705716", "0.7260565", "0.72577375", "0.7255957", "0.7251422", "0.72499335", "0.7228801", "0.71582305", "0.71371764", "0.7109342", "0.7109342", "0.70872396", "0.7041113", "0.7034841", "0.7026912", "0.7013844", "0.701049", "0.6998834", "0.69955736", "0.6995117", "0.6990974", "0.69727755", "0.6965972", "0.69443846", "0.6931375", "0.6918964", "0.69084543", "0.69008607", "0.6898241", "0.6881652", "0.6879104", "0.6878755", "0.6868116", "0.686088", "0.68597883", "0.68508834", "0.6840784", "0.6838484", "0.6838484", "0.6835396", "0.6823527", "0.68182015", "0.68114406", "0.67894", "0.6788136", "0.67851466", "0.6782112", "0.6779481", "0.67760074", "0.67702615", "0.67682666", "0.6768242", "0.67662406", "0.6762363", "0.6759548", "0.67477524", "0.6742652", "0.67410475", "0.6737013", "0.67291087", "0.67170894", "0.6711302", "0.67056936", "0.67036414", "0.6700534", "0.66912633", "0.6691051", "0.6690571", "0.6686033", "0.6685015", "0.66815895", "0.66815245", "0.66789883", "0.66710484", "0.6664768", "0.666284", "0.66528237", "0.665211", "0.66443825", "0.6642335", "0.6633168", "0.66326976", "0.66282254", "0.66277844", "0.66273946", "0.6619108", "0.6618403", "0.66178024", "0.6613569", "0.6613464", "0.6613464", "0.6609638", "0.66043305", "0.6603926", "0.659908" ]
0.0
-1
Creates elevators, and floors. Places elevators on floors
def initialize(number_of_elevators, number_of_floors, elevator_capacity,elevator_resting_floor) puts "Setting up #{number_of_elevators} elevators of capacity #{elevator_capacity}" @elevators = Array.new(number_of_elevators).map{ |elevator| Elevator.new(self, elevator_capacity) } puts "Setting up #{number_of_floors} floors" @floors = Array.new(number_of_floors).each_with_index.map{ |floor, height|Floor.new(self, height) } puts "Placing elevators on floor #{elevator_resting_floor}" @elevators.map{ |elevator| elevator.install(@floors[elevator_resting_floor]) } puts "~~~~~~~~~~~~~~~~~~~~~~~~" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_elevators\n @elevator_number.times do |i|\n floor_gap = @building.floors / @elevator_number * i\n elevator_list.append(Elevator.new(i, 1 + floor_gap, 1 + floor_gap))\n end\n end", "def makeElevator\n for elevatorID in 1..@amountOfElevators\n elevator = Elevator.new(elevatorID, 'idle', @amountOfFloors, 1)\n @elevatorsList.push(elevator)\n end\n end", "def createElevatorsList\n for x in 1..@numberOfElevators do\n @elevatorsList.append(Elevator.new(x, @numberOfFloors, 1, ElevatorStatus::IDLE, SensorStatus::OFF, SensorStatus::OFF))\n # puts \"elevator#{@id} created\"\n end\n end", "def add_elevators(starting_floor, number_of_elevators)\n\t\tnumber_of_elevators.times do\n\t\t\te = Elevator.new(starting_floor, @elevator_strategy)\n\t\t\t@elevators << e\n\t\t\t@sim.register(e)\n\t\tend\n\tend", "def create_elevator_list\n \n for elevatorID in 1..Column.num_elevators do\n elevator = Elevator.new(elevatorID)\n elevator.create_floor_buttons()\n @elevator_list.append(elevator)\n end\n end", "def add_floors(number_of_floors)\n\t\tnumber_of_floors.times do |f| \n\t\t\tf = Floor.new(@elevator_strategy)\n\t\t\t@flrs << f\n\t\t\t@sim.register(f)\n\t\tend\n\tend", "def create_hydraulic(entities)\n # r = Geom::Transformation.rotation [$porch_width/2, 0, 0], [0,0,1], 180.degrees\n\t\t# t = Geom::Transformation.new [$porch_offset,0, $porch_height]\n\t\t# entities.transform_entities r, porch_group\n\t\t# entities.transform_entities t, porch_group\n\tif($hydraulic_side == \"SW1\")\n\t\tr = Geom::Transformation.rotation [0, 0, 0], [0,0,1], 360.degrees\n\t\tt = Geom::Transformation.new [$hydraulic_offset+$hydraulic_width,0, -6]\n\t\tbuild_hydraulic(entities,r,t)\n\tend\n\tif($hydraulic_side == \"SW2\")\n\t\tr = Geom::Transformation.rotation [0, 0, 0], [0,0,1], 180.degrees\n\t\tt = Geom::Transformation.new [$length-$hydraulic_offset-$hydraulic_width,$width, -6]\n\t\tbuild_hydraulic(entities,r,t)\n\tend\n\tif($hydraulic_side == \"EW2\")\n\t\tr = Geom::Transformation.rotation [0, 0, 0], [0,0,1], 90.degrees\n\t\tt = Geom::Transformation.new [$length,$hydraulic_offset+$hydraulic_width, -6]\n\t\tbuild_hydraulic(entities,r,t)\n\tend\n\tif($hydraulic_side == \"EW1\")\n\t\tr = Geom::Transformation.rotation [0, 0, 0], [0,0,1], 270.degrees\n\t\tt = Geom::Transformation.new [0,$width-$hydraulic_offset-$hydraulic_width, -6]\n\t\tbuild_hydraulic(entities,r,t)\n\tend\n end", "def towerBuilder(n_floors)\n layer = width = n_floors + (n_floors - 1)\n result = []\n\n while layer > 0\n result.unshift((\"*\" * layer).center(width))\n layer -= 2\n end\n result\nend", "def createFloorDoorsList\n for x in 1..@numberOfFloors do\n @floorDoorsList.append(Door.new(x, DoorStatus::CLOSED, x))\n # puts \"elevator#{@id} door floor #{@floorDoorsList[x - 1].id} created\"\n end\n end", "def build_lean(entities,r,t)\n\n\n\n lean_group = entities.add_group\n\n lean_group.entities.add_dimension_linear([0,0,0],[0,$lean_length,0], [-30,0,0]).arrow_type = Sketchup::Dimension::ARROW_SLASH\n lean_group.entities.add_dimension_linear([0,0,0],[$lean_width,0,0], [0,-60,0]).arrow_type = Sketchup::Dimension::ARROW_SLASH\n lean_group.entities.add_text(\"Lean-to\", [$lean_width/2,$lean_length/2,-2])\n\n\n o = Geom::Point3d.new(-$lean_overjet,-$lean_overhang,$lean_height-$lean_overhang*$lean_pitch/12)\n h = Geom::Vector3d.new(0,$lean_length+$lean_overhang, ($lean_length+$lean_overhang)*$lean_pitch/12)\n f = Geom::Vector3d.new(0,0,$facia)\n v = Geom::Vector3d.new($lean_width+2*$lean_overjet,0,0)\n p1 = o\n p2 = o + v\n p3 = o + v + h\n p4 = o + h\n p5 = o + f\n p6 = o + f + v\n p7 = o + f + v + h\n p8 = o + f + h\n\n lean_group.entities.add_face(p5,p6,p7,p8).material = $roofColor\n lean_group.entities.add_face(p1,p4,p8,p5).material = $faciaColor\n lean_group.entities.add_face(p2,p3,p7,p6).material = $faciaColor\n lean_group.entities.add_face(p1,p2,p6,p5).material = $faciaColor\n lean_group.entities.add_face(p1,p2,p3,p4)\n\n lean_group.entities.add_cline([-$lean_overjet,-$lean_overhang,0],[$lean_width+$lean_overjet,-$lean_overhang,0])\n lean_group.entities.add_cline([$lean_width+$lean_overjet,-$lean_overhang,0],[$lean_width+$lean_overjet,$lean_length,0])\n lean_group.entities.add_cline([-$lean_overjet,-$lean_overhang,0],[-$lean_overjet,$lean_length,0])\n\n\n if($lean_wall[0] == 1)\n pl1 = [$lean_width, 0, 0]\n pl2 = [$lean_width, $lean_length,0]\n pl3 = [$lean_width,$lean_length,$lean_height+$lean_length*$lean_pitch/12]\n pl4 = [$lean_width,0,$lean_height]\n lean_group.entities.add_face(pl1,pl2,pl3,pl4).material = $wallColor\n end\n\n if($lean_wall[1] == 1)\n pm1 = [$lean_width,0,0]\n pm2 = [0,0,0]\n pm3 = [0,0,$lean_height]\n pm4 = [$lean_width,0,$lean_height]\n a = lean_group.entities.add_face(pm1,pm2,pm3,pm4)\n a.back_material = $wallColor\n a.material = $wallColor\n end\n\n\n p = 6\n if($lean_wall[1] >= 2)\n c = 7\n #$lean_width = $lean_width-2*$lean_overhang\n lean_group.entities.add_face([0,$lean_length,0],[0,0,0],[$lean_width,0,0],[$lean_width,$lean_length,0],[$lean_width-c,$lean_length,0],[$lean_width-c,c,0],[c,c,0],[c,$lean_length,0],[0,$lean_length,0]).pushpull -3\n lean_group.entities.add_line([0,$lean_length,0],[c,$lean_length,0]).faces[0].erase!\n\n n = $lean_wall[1] \n # entities.add_face([0,0,0,],[0,p,0],[p,p,0],[p,0,0]).pushpull -$lean_height-$facia\n # entities.add_face([$lean_width,0,0],[$lean_width,p,0],[$lean_width-p,p,0],[$lean_width-p,0,0])\n d = ($lean_width - p*n)/(n-2+1)\n for i in 0..n-1 \n a = lean_group.entities.add_face([i*(p+d),0,0,],[i*(p+d),p,0],[i*(p+d)+p,p,0],[i*(p+d)+p,0,0])\n end\n d = $lean_width/(n-1)\n if n>2\n for i in 0..n-2\n lean_group.entities.add_dimension_linear([i*d,0,0],[(i+1)*d,0,0], [0,-30,0]).arrow_type = Sketchup::Dimension::ARROW_SLASH\n end\n end\n\n \n\n\n\n end\n\n if($lean_wall[2] == 1)\n pr1 = [0,0,0]\n pr2 = [0,$lean_length,0]\n pr3 = [0,$lean_length,$lean_height+$lean_length*$lean_pitch/12]\n pr4 = [0,0,$lean_height]\n lean_group.entities.add_face(pr1,pr2,pr3,pr4).back_material = $wallColor\n end\n\n entities.transform_entities r, lean_group\n entities.transform_entities t, lean_group\n \nend", "def create_lean(entities)\n\tif($lean_height > 0)\n\t\tif($lean_side == \"SW1\")\n\t\t\tr = Geom::Transformation.rotation [0,0,0],[0,0,1],360.degrees\n\t\t\tt = Geom::Transformation.new [$lean_offset,-$lean_length,0]\n\t\t\tbuild_lean(entities, r, t)\n\t\tend\n\t\tif($lean_side == \"SW2\")\n\t\t\tr = Geom::Transformation.rotation [0,0,0],[0,0,1],180.degrees\n\t\t\tt = Geom::Transformation.new [$length-$lean_offset,+$width+$lean_length,0]\n\t\t\tbuild_lean(entities, r, t)\n\t\tend\n\t\tif($lean_side == \"EW1\")\n\t\t\tr = Geom::Transformation.rotation [0,0,0],[0,0,1],270.degrees\n\t\t\tt = Geom::Transformation.new [-$lean_length,+$width-$lean_offset,0]\n\t\t\tbuild_lean(entities, r, t)\n\t\tend\n\t\tif($lean_side == \"EW2\")\n\t\t\tr = Geom::Transformation.rotation [0,0,0],[0,0,1],90.degrees\n\t\t\tt = Geom::Transformation.new [$length+$lean_length,$lean_offset,0]\n\t\t\tbuild_lean(entities, r, t)\n\t\tend\n\tend\nend", "def set_floors(floor_count, main_coridor_count, sub_coridor_count)\n floor_count.times do |count|\n floor = Floor.new(count + 1, @hotel)\n floor.main_coridors = set_main_coridors(floor, main_coridor_count, sub_coridor_count)\n @hotel.floors << floor\n end\n end", "def interior_steel(entities)\n#draw_rectangle(\"EW1\",70*12, 14*12+8, 20*12, entities)\n\n\tif($interior_steel != \"\")\n\t\n\t\tif($oh1 >= $oh2)\n\t\ta = entities.add_line([0,0,$height],[0,$width,$height])\n\t\tb = entities.add_line([0,0,$height],[0,0,$height1])\n\t\t\t\t\ta.faces[0].back_material = $interior_steel\n\t\t# if($oh1 <= $oh2)\n\n\t\t# else\n\t\t\t# a.faces[1].back_material = $interior_steel\n\t\t# end\n\t\t\n\t\t#entities.add_line([$length,0,$height],[$length,0,$height1])\n\n\n\t\tf = entities.add_line([$length,0,$height],[$length,0,$height1])\n\t\te = entities.add_line([$length,0,$height],[$length,$width,$height])\n\t\te.faces[1].back_material = $interior_steel\n\n\t\tentities.add_line([0,0,$height],[$length,0,$height])\n\t\td = entities.add_line([$corner,0,$height1],[$length-$corner, 0, $height1])\n\t\t\n\t\t\n\t\t\n\t\td.find_faces\n\t\td.faces[0].back_material = $interior_steel\n\t\td.faces[2].back_material = $interior_steel\n\t\tif($height1 == $height2)\n\t\t\td.faces[2].erase!\n\t\tend\n\n\t\tc = entities.add_line([$corner,$width,$height2],[$length-$corner,$width,$height2])\n\t\tc.faces[0].back_material = $interior_steel\n\t\tend\n\t\t\n\t\tif($oh1 < $oh2)\n\t\ta = entities.add_line([0,0,$height],[0,$width,$height])\n\t\tb = entities.add_line([0,$width,$height],[0,$width,$height2])\n\t\t\t\t\ta.faces[0].back_material = $interior_steel\n\t\t# if($oh1 <= $oh2)\n\n\t\t# else\n\t\t\t# a.faces[1].back_material = $interior_steel\n\t\t# end\n\t\t\n\t\t#entities.add_line([$length,0,$height],[$length,0,$height1])\n\n\n\t\tf = entities.add_line([$length,$width,$height],[$length,$width,$height2])\n\t\te = entities.add_line([$length,0,$height],[$length,$width,$height])\n\t\te.faces[1].back_material = $interior_steel\n\n\t\tentities.add_line([0,0,$height],[$length,0,$height])\n\t\td = entities.add_line([$corner,0,$height1],[$length-$corner, 0, $height1])\n\t\t\n\t\t\n\t\t\n\t\td.find_faces\n\t\td.faces[1].back_material = $interior_steel\n\t\t\t\td.faces[0].back_material = $interior_steel\n\t\t#d.faces[2].back_material = $interior_steel\n\t\tif($height1 == $height2)\n\t\t\td.faces[2].erase!\n\t\tend\n\n\t\tc = entities.add_line([$corner,$width,$height2],[$length-$corner,$width,$height2])\n\t\tc.faces[0].back_material = $interior_steel\n\t\tend\n\t\t\n\t\t\n\t\t\n\tend\nend", "def call_elevator elevator_number=0\n\t\t@elevators[elevator_number].add_to_floors_to_visit @floor_number\n\tend", "def create_gr(entities)\n\tif($gr_side == \"SW1\")\n\t\tr = Geom::Transformation.rotation [0, 0, 0], [0,0,1], 360.degrees\n\t\tt = Geom::Transformation.new [$gr_offset,0,$gr_height]\n\t\tbuild_gr(entities,r,t)\n\tend\n\tif($gr_side == \"SW2\")\n\t\tr = Geom::Transformation.rotation [0, 0, 0], [0,0,1], 180.degrees\n\t\tt = Geom::Transformation.new [$length-$gr_offset,$width,$gr_height]\n\t\tbuild_gr(entities,r,t)\n\tend\n\tif($gr_side == \"EW1\")\n\t\tr = Geom::Transformation.rotation [0, 0, 0], [0,0,1], 270.degrees\n\t\tt = Geom::Transformation.new [0,$width-$gr_offset,$gr_height]\n\t\tbuild_gr(entities,r,t)\n\tend\n\tif($gr_side == \"EW2\")\n\t\tr = Geom::Transformation.rotation [0, 0, 0], [0,0,1], 90.degrees\n\t\tt = Geom::Transformation.new [$length,$gr_offset,$gr_height]\n\t\tbuild_gr(entities,r,t)\n\tend\n\t\nend", "def create\n @tower = Tower.new(params[:tower])\n\t\n\t#Vergabe der Koordinaten. Die Karte ist in vier Teile gteilt. Mittelpunkt ist 50/50\n\t#Es wird immer erst eine y Reihe ausgefüllt wobei der x Abstand zufällig bestimmt wird.\n\t#Es gibt 4 Startpunkte und somit $ reihen die abwechselnd gefüllt werden.\n\ttnortheast = Tower.where(:position => 'northeast')\n\ttnorthwest = Tower.where(:position => 'northwest')\n\ttsouthwest = Tower.where(:position => 'southwest')\n\ttsoutheast = Tower.where(:position => 'southeast')\n\tif tnortheast.last.nil? \n\t \n\t @tower.position = 'northeast'\n\t @tower.x = '51'\n\t @tower.y = '51'\n\t \n\telsif tnorthwest.last.nil?\n\t @tower.position = 'northwest'\n\t @tower.x = '49'\n\t @tower.y = '51'\n\t \n\telsif tsouthwest.last.nil?\n\t @tower.position = 'southwest'\n\t @tower.x = '49'\n\t @tower.y = '49'\n\t\n\telsif tsoutheast.last.nil?\n\t @tower.position = 'southeast'\n\t @tower.x = '51'\n\t @tower.y = '49'\n\t\n\telse\n\t \n\t if tsoutheast.count < tsouthwest.count\n\t if tsoutheast.last.x < 95\n\t @tower.position = 'southeast'\n\t \t @tower.x = tsoutheast.last.x + 1 + rand(5)\n\t \t @tower.y = tsoutheast.last.y\n\t \n\t else\n\t @tower.position = 'southeast'\n\t \t @tower.x = 51 + rand(4)\n\t \t @tower.y = tsoutheast.last.y - 1\n\t \n\t end\n\t \n\t \n\t \n\t \n\t elsif tsouthwest.count < tnorthwest.count\n\t if tsouthwest.last.x > 5\n\t @tower.position = 'southwest'\n\t \t @tower.x = tsouthwest.last.x - 1 - rand(5)\n\t \t @tower.y = tsouthwest.last.y \n\t \n\t else\n\t @tower.position = 'southwest'\n\t \t @tower.x = 49 - rand(4)\n\t \t @tower.y = tsouthwest.last.y - 1\n\t \n\t end\n\t \n\t elsif tnorthwest.count < tnortheast.count\n\t if tnorthwest.last.x > 5\n\t @tower.position = 'northwest'\n\t \t @tower.x = tnorthwest.last.x - 1 - rand(5)\n\t \t @tower.y = tnorthwest.last.y \n\t \n\t else\n\t @tower.position = 'northwest'\n\t \t @tower.x = 49 - rand(4)\n\t \t @tower.y = tnorthwest.last.y + 1\n\t \n\t end\n\t else\n\t if tnortheast.last.x < 95\n\t @tower.position = 'northeast'\n\t \t @tower.x = tnortheast.last.x + 1 + rand(5)\n\t \t @tower.y = tnortheast.last.y \n\t \n\t else\n\t @tower.position = 'northeast'\n\t \t @tower.x = 51 + rand(4)\n\t \t @tower.y = tnortheast.last.y + 1\n\t \n\t end\n\t \n\t \n\t end\n\tend\n\t\n\t#User_id wird zugewiesen\n\t@tower.user_id = current_user.id\n\t@tower.down2 = 'store 1'\n\n\t\n\t\n\t\n\t\n respond_to do |format|\n if @tower.save\n format.html { redirect_to @tower, :notice => 'Tower was successfully created.' }\n format.json { render :json => @tower, :status => :created, :location => @tower }\n \n #Coordinates für die MAp anlegen\n @c = Coordinate.new(params[:coordinates])\n @c.x = @tower.x\n @c.y = @tower.y\n @c.user_id = @tower.user_id\n @c.save\n \n else\n format.html { render :action => \"new\" }\n format.json { render :json => @tower.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_floor_buttons\n for floor in 1..Elevator.num_floors do\n button = FloorButton.new(floor, self)\n @floor_buttons.append(button)\n end\n end", "def create_tower event\n if @money >= @tower_price\n ghost = GhostTower.new( Grid.screenp_to_elementp(event.pos) )\n if nice_place_for_tower?(ghost) \n @money -= @tower_price\n tower = Tower.new(@event_handler, Grid.screenp_to_elementp(event.pos), @enemies)\n @towers << tower\n end\n end\n end", "def level_up()\r\n # Incrementing the level\r\n @level += 1\r\n # Incrasing the number of aliens in each fleet \r\n if @alien_count <6\r\n @alien_count += 1\r\n end \r\n # Reducing the random number to that the events are more likely to occur \r\n @random -= 100\r\n @alien_fire_rand -= 100\r\n # Increasing the maximum number of Alien fleets \r\n @fleet_limit += 1\r\n end", "def tower_builder(n_floors)\n (1..n_floors).map do |i|\n spaces = ' ' * (n_floors - i)\n stars = '*' * ((i * 2) - 1)\n spaces + stars + spaces\n end\nend", "def createFloorButtonsList\n for x in 1..@numberOfFloors do\n @floorButtonsList.append(Button.new(x, ButtonStatus::ON, x))\n # puts \"elevator#{@id} button floor #{@floorButtonsList[x - 1].id} created\"\n end\n end", "def gear(inner_radius, outer_radius, width, teeth, tooth_depth)\n r0 = inner_radius\n r1 = outer_radius - tooth_depth / 2.0\n r2 = outer_radius + tooth_depth / 2.0\n\n da = 2.0 * PI / teeth / 4.0\n\n glShadeModel(GL_FLAT)\n\n glNormal3f(0.0, 0.0, 1.0)\n\n # Draw front face\n glBegin(GL_QUAD_STRIP)\n for i in 0..teeth\n angle = i * 2.0 * PI / teeth\n glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5)\n glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5)\n if i < teeth\n glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5)\n glVertex3f(r1 * cos(angle + 3 * da),\n r1 * sin(angle + 3 * da), width * 0.5)\n end\n end\n glEnd()\n \n # Draw front sides of teeth\n glBegin(GL_QUADS)\n for i in 0...teeth\n angle = i * 2.0 * PI / teeth\n glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5)\n glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5)\n glVertex3f(r2 * cos(angle + 2 * da),\n r2 * sin(angle + 2 * da), width * 0.5)\n glVertex3f(r1 * cos(angle + 3 * da),\n r1 * sin(angle + 3 * da), width * 0.5)\n end\n glEnd()\n \n glNormal3f(0.0, 0.0, -1.0)\n \n # Draw back face\n glBegin(GL_QUAD_STRIP)\n for i in 0..teeth\n angle = i * 2.0 * PI / teeth\n glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5)\n glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5)\n if i < teeth\n glVertex3f(r1 * cos(angle + 3 * da),\n r1 * sin(angle + 3 * da), -width * 0.5)\n glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5)\n end\n end\n glEnd()\n \n # Draw back sides of teeth\n glBegin(GL_QUADS)\n for i in 0...teeth\n angle = i * 2.0 * PI / teeth\n glVertex3f(r1 * cos(angle + 3 * da),\n r1 * sin(angle + 3 * da), -width * 0.5)\n glVertex3f(r2 * cos(angle + 2 * da),\n r2 * sin(angle + 2 * da), -width * 0.5)\n glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5)\n glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5)\n end\n glEnd()\n \n # Draw outward faces of teeth\n glBegin(GL_QUAD_STRIP)\n for i in 0...teeth\n angle = i * 2.0 * PI / teeth\n glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5)\n glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5)\n u = r2 * cos(angle + da) - r1 * cos(angle)\n v = r2 * sin(angle + da) - r1 * sin(angle)\n len = sqrt(u * u + v * v)\n u /= len\n v /= len\n glNormal3f(v, -u, 0.0)\n glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5)\n glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5)\n glNormal3f(cos(angle), sin(angle), 0.0)\n glVertex3f(r2 * cos(angle + 2 * da),\n r2 * sin(angle + 2 * da), width * 0.5)\n glVertex3f(r2 * cos(angle + 2 * da),\n r2 * sin(angle + 2 * da), -width * 0.5)\n u = r1 * cos(angle + 3 * da) - r2 * cos(angle + 2 * da)\n v = r1 * sin(angle + 3 * da) - r2 * sin(angle + 2 * da)\n glNormal3f(v, -u, 0.0)\n glVertex3f(r1 * cos(angle + 3 * da),\n r1 * sin(angle + 3 * da), width * 0.5)\n glVertex3f(r1 * cos(angle + 3 * da),\n r1 * sin(angle + 3 * da), -width * 0.5)\n glNormal3f(cos(angle), sin(angle), 0.0)\n end\n glVertex3f(r1 * cos(0), r1 * sin(0), width * 0.5)\n glVertex3f(r1 * cos(0), r1 * sin(0), -width * 0.5)\n glEnd()\n \n glShadeModel(GL_SMOOTH)\n \n # Draw inside radius cylinder\n glBegin(GL_QUAD_STRIP)\n for i in 0..teeth\n angle = i * 2.0 * PI / teeth\n glNormal3f(-cos(angle), -sin(angle), 0.0)\n glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5)\n glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5)\n end\n glEnd()\n end", "def move(above_floors, below_floors)\n\t\t#Normally, it will go in the direction determined by its status\n\t\tif status == \"up\" && current_floor < @floors - 1\n\t\t\tself.move_up\n\t\telsif status == \"down\" && current_floor > 0\n\t\t\tself.move_down\n\t\t#If stationary, movement is determined by whether buttons are pressed for the elevator\t\n\t\telsif above_floors.include?(true)\n\t\t\tself.move_up\n\t\telsif below_floors.include?(true)\n\t\t\tself.move_down\n\t\t#Returns to bottom floor if there is nobody to pick up\n\t\telsif current_floor != 0\n\t\t\tself.move_down\n\t\tend\n\tend", "def wander\n perturb_direction\n walk\n end", "def build_tower(number_floors)\n sym = \"*\"\n floors_array = []\n num_half_spaces = 0\n\n number_floors.downto(1).each do |floor_number|\n half_spaces = \" \" * num_half_spaces\n sym_string = sym * ((floor_number * 2) - 1)\n floor_string = half_spaces + sym_string + half_spaces\n floors_array.unshift(floor_string)\n num_half_spaces += 1\n end\n floors_array\nend", "def draw\n\tsuper\n\t\n\tif Game.scene.selected_tower\n\t position = grids_to_pixels(Game.scene.selected_tower.position)\n\t \n\t @surface.drawFilledCircle(position[0], position[1], Game.scene.selected_tower.range * Config.part_size[0], Screen.handle.format.mapRGB(0xbb, 0xbb, 0xbb))\n\tend\n\t\n\tposition = Config.monsters_start_at\n\tposition[0] += 1\n\tposition = grids_to_pixels(position)\n\tposition[0] -= 20\n\tposition[1] -= 20\n\tImage.draw(\"images/arrow.png\", @surface, *position)\n\t\n\tposition = Config.monsters_end_at\n\tposition[0] -= 1\n\tposition = grids_to_pixels(position)\n\tposition[0] -= 20\n\tposition[1] -= 20\n\tImage.draw(\"images/arrow.png\", @surface, *position)\n\t\n\tConfig.map_size[1].times do |y|\n Config.map_size[0].times do |x|\n @surface.draw_rect(Config.part_size[0]*x,Config.part_size[1]*y,Config.part_size[0],Config.part_size[1],Screen.handle.format.mapRGB(0x88, 0x88, 0x88))\n end\n end\n\t\n\tGame.scene.get_drawable_objects.each do |i|\n\t position = grids_to_pixels(i.position)\n\t if i.class <= Model::Monster # Drawing HP lines\n\t color = Screen.handle.format.mapRGB(0xaa, 0xaa, 0xaa)\n\t if i.poisoned\n\t color = Screen.handle.format.mapRGB(0xff, 0x00, 0xff)\n\t end\n\t @surface.draw_line(position[0]-12, position[1]-18, position[0]+12, position[1]-18, color)\n\t @surface.draw_line(position[0]-12, position[1]-17, position[0]+12, position[1]-17, color)\n\t \n\t line_len = i.hp * 24 / i.max_hp\n\t \n\t color = Screen.handle.format.mapRGB(0x00, 0xff, 0x00)\n\t if i.frozen\n\t color = Screen.handle.format.mapRGB(0x00, 0xff, 0xff)\n\t end\n\t @surface.draw_line(position[0]-12, position[1]-18, position[0]-12+line_len, position[1]-18, color)\n\t @surface.draw_line(position[0]-12, position[1]-17, position[0]-12+line_len, position[1]-17, color)\n\t end\n\t position[0] -= i.image_size[0]/2\n\t position[1] -= i.image_size[1]/2\n\t \n\t Image.draw(i.image, @surface, *position)\n\tend\n end", "def create_in_direction dir\n new_room = Room.create({:created_at=>Time.now, :x=>self.x, :y=>self.y, :z=>self.z})\n \n case dir\n when \"north\",:north, 0\n new_room.y += 1\n when \"east\", :east, 1\n new_room.x += 1\n when \"south\",:south, 2\n new_room.y -= 1\n when \"west\",:west, 3\n new_room.x -= 1\n when \"up\",:up, 4\n new_room.y += 1\n when \"down\",:down, 5\n new_room.y -= 1\n end\n \n create_exit(dir, new_room, true) # two way exit\n return new_room\n end", "def gear(inner_radius, outer_radius, width, teeth, tooth_depth)\n r0 = inner_radius\n r1 = outer_radius - tooth_depth / 2.0\n r2 = outer_radius + tooth_depth / 2.0\n\n da = 2.0 * PI / teeth / 4.0\n\n glShadeModel(GL_FLAT)\n\n glNormal3f(0.0, 0.0, 1.0)\n\n # Draw front face\n glBegin(GL_QUAD_STRIP)\n for i in 0..teeth\n angle = i * 2.0 * PI / teeth\n glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5)\n glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5)\n if i < teeth\n glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5)\n glVertex3f(r1 * cos(angle + 3 * da),\n r1 * sin(angle + 3 * da), width * 0.5)\n end\n end\n glEnd()\n\n # Draw front sides of teeth\n glBegin(GL_QUADS)\n for i in 0...teeth\n angle = i * 2.0 * PI / teeth\n glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5)\n glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5)\n glVertex3f(r2 * cos(angle + 2 * da),\n r2 * sin(angle + 2 * da), width * 0.5)\n glVertex3f(r1 * cos(angle + 3 * da),\n r1 * sin(angle + 3 * da), width * 0.5)\n end\n glEnd()\n\n glNormal3f(0.0, 0.0, -1.0)\n\n # Draw back face\n glBegin(GL_QUAD_STRIP)\n for i in 0..teeth\n angle = i * 2.0 * PI / teeth\n glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5)\n glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5)\n if i < teeth\n glVertex3f(r1 * cos(angle + 3 * da),\n r1 * sin(angle + 3 * da), -width * 0.5)\n glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5)\n end\n end\n glEnd()\n\n # Draw back sides of teeth\n glBegin(GL_QUADS)\n for i in 0...teeth\n angle = i * 2.0 * PI / teeth\n glVertex3f(r1 * cos(angle + 3 * da),\n r1 * sin(angle + 3 * da), -width * 0.5)\n glVertex3f(r2 * cos(angle + 2 * da),\n r2 * sin(angle + 2 * da), -width * 0.5)\n glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5)\n glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5)\n end\n glEnd()\n\n # Draw outward faces of teeth\n glBegin(GL_QUAD_STRIP)\n for i in 0...teeth\n angle = i * 2.0 * PI / teeth\n glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5)\n glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5)\n u = r2 * cos(angle + da) - r1 * cos(angle)\n v = r2 * sin(angle + da) - r1 * sin(angle)\n len = sqrt(u * u + v * v)\n u /= len\n v /= len\n glNormal3f(v, -u, 0.0)\n glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5)\n glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5)\n glNormal3f(cos(angle), sin(angle), 0.0)\n glVertex3f(r2 * cos(angle + 2 * da),\n r2 * sin(angle + 2 * da), width * 0.5)\n glVertex3f(r2 * cos(angle + 2 * da),\n r2 * sin(angle + 2 * da), -width * 0.5)\n u = r1 * cos(angle + 3 * da) - r2 * cos(angle + 2 * da)\n v = r1 * sin(angle + 3 * da) - r2 * sin(angle + 2 * da)\n glNormal3f(v, -u, 0.0)\n glVertex3f(r1 * cos(angle + 3 * da),\n r1 * sin(angle + 3 * da), width * 0.5)\n glVertex3f(r1 * cos(angle + 3 * da),\n r1 * sin(angle + 3 * da), -width * 0.5)\n glNormal3f(cos(angle), sin(angle), 0.0)\n end\n glVertex3f(r1 * cos(0), r1 * sin(0), width * 0.5)\n glVertex3f(r1 * cos(0), r1 * sin(0), -width * 0.5)\n glEnd()\n\n glShadeModel(GL_SMOOTH)\n\n # Draw inside radius cylinder\n glBegin(GL_QUAD_STRIP)\n for i in 0..teeth\n angle = i * 2.0 * PI / teeth\n glNormal3f(-cos(angle), -sin(angle), 0.0)\n glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5)\n glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5)\n end\n glEnd()\n end", "def add_tip\n put_beeper\n move\n move\n put_beeper\n turn_around\n move\n move\n turn_around\n end", "def tick\n\t\t@elevators.each{|elevator| elevator.tick}\n\t\t@floors.each{|floor| floor.tick}\n\tend", "def create_positions\n create_player_position\n create_target_position\n create_select_position\n create_object_position\n end", "def build_gr(entities,r,t)\n\ngr_group = entities.add_group\n\norigin = Geom::Point3d.new(0,0,0)\nv1 = Geom::Vector3d.new($gr_width/2,0,0)\nv2 = Geom::Vector3d.new(0,0,$gr_width*$gr_pitch/12)\nv3 = Geom::Vector3d.new(0, $gr_length,0)\n\nf1 = gr_group.entities.add_face(origin,origin-v3,origin-v3+v2+v1,origin+v2+v1)\nf1.material = $roofColor\nf2 = gr_group.entities.add_face(origin-v3+v2+v1,origin+v2+v1, origin+v1+v1, origin+v1+v1-v3)\nf2.material = $roofColor\n\nif($gr_wall[1] == 2)\n\tf5 = gr_group.entities.add_face([0,-$gr_length,0],[6, -$gr_length,0],[6, 6-$gr_length,0],[0,6-$gr_length,0])\n\tf5.pushpull $gr_height\n\tf6 = gr_group.entities.add_face([$gr_width,-$gr_length,0],[$gr_width-6, -$gr_length,0],[$gr_width-6, 6-$gr_length,0],[$gr_width,6-$gr_length,0])\n\tf6.pushpull $gr_height\nend\n\nif($gr_wall[0] == 1)\n\tf3 = gr_group.entities.add_face([0,0,0],[0,0,-$gr_height],[0,-$gr_length, -$gr_height],[0, -$gr_length,0])\n\tf3.material = $wallColor\nend\n\nif($gr_wall[2] == 1)\n\tf3 = gr_group.entities.add_face([$gr_width,0,0],[$gr_width,0,-$gr_height],[$gr_width,-$gr_length, -$gr_height],[$gr_width, -$gr_length,0])\n\tf3.material = $wallColor\nend\n\nentities.transform_entities r, gr_group\nentities.transform_entities t, gr_group\n\nend", "def scenario1()\n puts \"\"\n puts \"****************************** SCENARIO 1: ******************************\"\n columnScenario1 = Column.new(1, ColumnStatus::ACTIVE, 10, 2) #parameters (id, ColumnStatus.ACTIVE/INACTIVE, numberOfFloors, numberOfElevators)\n columnScenario1.display() \n columnScenario1.elevatorsList[0].floor = 2 #floor where the elevator 1 is\n columnScenario1.elevatorsList[1].floor = 6 #floor where the elevator 2 is\n \n puts \"\"\n puts \"Person 1: (elevator 1 is expected)\"\n columnScenario1.requestElevator(3, ButtonDirection::UP) #parameters (requestedFloor, buttonDirection.UP/DOWN)\n columnScenario1.elevatorsList[0].requestFloor(7, columnScenario1) #parameters (requestedFloor, requestedColumn)\n puts \"==================================\"\nend", "def build_blocks\n new_blocks = []\n current_rotated_blocks.each do |block|\n block_actor = @stage.create_actor :block,\n x: block[0] * BLOCK_SIZE + @falling_piece.x,\n y: block[1] * BLOCK_SIZE + @falling_piece.y,\n grid_offset_x: block[0],\n grid_offset_y: block[1],\n image: @falling_piece.image\n\n new_blocks << block_actor\n end\n # Destroy ourselves, leaving only the blocks behind\n @falling_piece.remove\n\n new_blocks\n end", "def garden_grow(points)\r\n end", "def create_enemy_window() end", "def position_for_next_harvest()\n turn_right()\n move()\n turn_right()\n end", "def mill_impeller_axel(pCent_x, pCent_y, mirrored=false, pBegZ=0, pEndZ=nil)\r\n # # # # # # # # # # # # # #\r\n if pEndZ == nil\r\n pEndZ = drill_through_depth\r\n end\r\n pEndZ = 0 - pEndZ.abs\r\n \r\n print \"(mill_impeller_axel pCent_x=\", pCent_x, \" pCent_y=\", pCent_y, \" pBegZ=\", pBegZ, \" pEndZ=\", pEndZ, \")\\n\"\r\n print \"(shaft_diam=\", shaft_diam, \")\\n\"\r\n \r\n # ensure that we do not exceed the bit flute length\r\n # for the 1/16 inch bit.\r\n if (mill.curr_bit.max_mill_depth.abs < pEndZ.abs)\r\n pEndZ = 0 - mill.curr_bit.max_mill_depth.abs\r\n end\r\n \r\n \r\n if (mill.curr_bit.flute_smaller_than_shaft == true) and (mill.curr_bit.flute_len.abs < pEndZ.abs)\r\n # If I have a bit with a flute that is smaller\r\n # than the shaft I can not mill any deeper than\r\n # the flute so automatically adjust the max\r\n # depth to match the flute\r\n print \"(bit flute is not long enough for axel hole and shaft is larger than flute so setting hole size to flute_len)\\n\"\r\n pEndZ = 0 - mill.curr_bit.flute_len.abs\r\n end\r\n \r\n \r\n if (shaft_type == \"D\")\r\n # Have to reset cutout_diam to reflect\r\n # the smaller bit. \r\n mill.retract()\r\n print \"(L445 - shaft_diam = \", shaft_diam, \")\\n\"\r\n mill_DDShaft(mill, x = pCent_x,y=pCent_y, diam=shaft_diam, beg_z=pBegZ, end_z= pEndZ, adjust_for_bit_radius=true, mirrored=mirrored)\r\n else # round axel \r\n if mirrored == true\r\n tcy = vmirror(pCent_y)\r\n else\r\n tcy = pCent_y\r\n end\r\n\r\n mill.retract() \r\n aCircle = CNCShapeCircle.new(mill) \r\n print \"(ZZZZZZZZZZZZ mill_impeller_axel pBegZ=\", pBegZ, \" pEndZ=\", pEndZ,\")\\n\"\r\n aCircle.beg_depth = pBegZ \r\n aCircle.mill_pocket(\r\n pCent_x, \r\n tcy, \r\n shaft_diam, \r\n pEndZ , \r\n island_diam=0)\r\n \r\n \r\n end # axel choice\r\n mill.retract()\r\n end", "def walk\n if @headed_left\n move_left\n else\n move_right\n end\n end", "def create_world\r\n count = 1\r\n @height.times do |j|\r\n @width.times do |i|\r\n\t #this creates half water and half earth positions\r\n\t create_position(\"water\", i + 1, j + 1) if (count <= ((@width*@height) / 2))\r\n\t\tcreate_position(\"earth\", i + 1, j + 1) if (count > ((@width*@height) / 2))\r\n\t\t#create_position(\"earth\", i + 1, j + 1)\r\n\t\tcount += 1\r\n end\r\n end\r\n\tif @log == true\r\n\t @logger.write \"created world\"\r\n\tend\r\n end", "def elevators_at_floor(floor)\n\t\televators.select{|elevator| elevator.floor.eql? floor}\n\tend", "def initialize(num_sides,modifier=0)\n @num_sides = num_sides\n @modifier = modifier\n end", "def create_child\n Walker.new(x, y, direction + 2*rand(2) - 1)\n end", "def setup_sides\n @left_panel = UIView.alloc.initWithFrame(CGRectMake(0, 0, 95, @bounds.size.height))\n @left_panel.setBackgroundColor(UIColor.grayColor)\n @left_top_button = setup_game_button([LEFT, TOP], @left_panel)\n @left_middle_button = setup_game_button([LEFT, MIDDLE], @left_panel)\n @left_bottom_button = setup_game_button([LEFT, BOTTOM], @left_panel,)\n view.addSubview(@left_panel)\n @right_panel = UIView.alloc.initWithFrame(CGRectMake(@bounds.size.width - 95, 0, 95, @bounds.size.height))\n @right_panel.setBackgroundColor(UIColor.grayColor)\n @right_top_button = setup_game_button([LEFT, TOP], @right_panel)\n @right_middle_button = setup_game_button([LEFT, MIDDLE], @right_panel)\n @right_bottom_button = setup_game_button([LEFT, BOTTOM], @right_panel)\n view.addSubview(@right_panel)\n hide_sides\n end", "def draw\n # Draw a white background\n background 255 \n \n \n\n # Draw Zoog's body\n stroke 0 \n fill 150 \n rect 100, 100, 20, 100 \n\n # Draw Zoog's head\n fill 255 \n ellipse 100, 70, 60, 60 \n\n # Draw Zoog's eyes\n fill 0 \n ellipse 81, 70, 16, 32 \n ellipse 119, 70, 16, 32 \n\n # Draw Zoog's legs\n stroke 0 \n line 90, 150, 80, 160 \n line 110, 150, 120, 160\nend", "def update_arrows\n return unless product\n return unless open?\n reduce if Input.repeat?(:LEFT) and can_sub?\n add if Input.repeat?(:RIGHT) and can_add?\n end", "def add_alien_fleet()\r\n # Only generate new fleet of aliens if the current count of fleets is less than @fleet_limit\r\n if rand(@random) == 0 and @fleet < @fleet_limit\r\n @fleet +=1\r\n position = rand(SCREEN_WIDTH/2)\r\n @height -= GAME_PRESET[\"space_fleet\"]\r\n # Calling the procedure to generate aliens\r\n generate_aliens(position, @height)\r\n end\r\n # If the aliens reach the top level of the screen bring then down\r\n if @height < 0.3\r\n @height = GAME_PRESET[\"initial_height\"]\r\n end \r\n end", "def newGame(tiers = 5, expLowerBound = 0.25, expUpperBound = 0.93, durability = 10, baseChance = 0.065, nextTierChance = 0.7)\r\n #All intermediate next tier percentages are interpolated from the two bounds.\r\n @expUpperBound = expLowerBound #Upper bound percentage for percentage of available experience required to reach the final tier.\r\n @expLowerBound = expUpperBound #Lower bound percentage for percentage of available experience required to reach the next tier from the first tier.\r\n @tiers = tiers #Number of different ore tiers that appear in the grid.\r\n @durabilityInt = durability #Starting durability.\r\n @baseChance = baseChance #Level 1 type ore chance of appearing\r\n @nextTierChance = nextTierChance #E.G Level N chance = BASE CHANCE * NEXTTIERCHANCE^N-1\r\n\r\n newGameSetup #Sets up the grid and game variables.\r\nend", "def newGameSetup\r\n @experienceInt = 0 #Starting experience.\r\n @experience.clear { para(\"EXP: \" + @experienceInt.to_s, @style_stats) }\r\n @tierInt = 1 #Starting tier.\r\n @tier.clear{ para(\"TIER: \" + @tierInt.to_s, @style_stats) }\r\n @durability.clear { para(\"DUR: \" + @durabilityInt.to_s, @style_stats) }\r\n\r\n @oreTotal = Array.new(@tiers, 0) #Total number of ores for each tier.\r\n @oreRemaining = Array.new(@tiers, 0) #Remaining number of ores for each tier.\r\n @tierExp = Array.new(@tiers) #Total experience available for each tier of ore.\r\n @tile = Array.new(@columns){Array.new(@rows)} #Declares the 2D array to represent the grid.\r\n @hiddenCount = @columns * @rows\r\n @endState.clear\r\n\r\n #Generates the grid of buttons\r\n @board.clear do\r\n stack(width: (@columns * @tile_size)) do\r\n background(\"#000000\") #Sets the background to black.\r\n border(\"#CE8\", strokewidth: 1)\r\n\r\n (0..@rows-1).each do |row|\r\n flow(width: 1.0) do\r\n (0..@columns-1).each do |col|\r\n @btn = button(width: @tile_size, height: @tile_size) {\r\n mineTile(col,row)\r\n }\r\n @tile[col][row] = Tile.new(@btn)\r\n end\r\n end\r\n end\r\n end\r\n end\r\n\r\n @endGame = false\r\n\r\n generateOres #Generates the ores into the grid.\r\n calculateAdjacent #Calculates all adjacent values of every tile.\r\n\r\nend", "def build\n\t\t@hills = []\n\t\tif @anthills.length == 10 && @field\n\t\t\tx = (0...@rows).to_a.shuffle.take(10)\n\t\t\ty = (0...@columns).to_a.shuffle.take(10)\n\t\t\t@anthills.each_with_index do |hill, i|\n\t\t\t\thill_type = rand(0..1)\n\t\t\t\tif hill_type == 0\n\t\t\t\t\t@hills << WarriorAnthill.new(hill,x[i],y[i])\n\t\t\t\telse\n\t\t\t\t\t@hills << ForagerAnthill.new(hill,x[i],y[i])\n\t\t\t\tend\n\t\t\t\t@field[x[i]][y[i]] = Cell.new(@hills[i])\n\t\t\tend\n\t\t\t@meadow = Meadow.instance.create(@field, @hills, @rows, @columns)\n\t\telse \n\t\t\tputs \"Not enough hills or field not created\"\n\t\tend\n\t\t@meadow\n\tend", "def setup_blueprint_outdoor_farms(want)\n @fort_entrance.maptile.spiral_search([df.world.map.x_count, df.world.map.y_count].max, 9, 3) { |_t|\n next unless sf = surface_tile_at(_t)\n sd = sf.designation\n if (-1..1).all? { |dx| (-1..1).all? { |dy|\n tt = sf.offset(dx, dy) and\n td = tt.designation and\n ((sd.subterranean and td.subterranean) or\n (not sd.subterranean and not td.subterranean and\n sd.biome == td.biome)) and\n tt.shape_basic == :Floor and\n tt.designation.flow_size == 0 and\n [:GRASS_DARK, :GRASS_LIGHT, :SOIL].include?(tt.tilemat)\n } }\n @rooms << Room.new(:farmplot, [:food, :cloth][want % 2], sf.x-1, sf.x+1, sf.y-1, sf.y+1, sf.z)\n @rooms.last.misc[:users] = []\n @rooms.last.misc[:outdoor] = true\n want -= 1\n true if want == 0\n end\n }\n end", "def entomb!(epitaph)\n self.visibility = Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE\n self.depositor = 'TOMBSTONE-' + depositor\n self.tombstone = [epitaph]\n\n file_sets.each do |file_set|\n file_set.visibility = Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE\n end\n\n save\n end", "def diamond_full(x)\n 4.times do\n add_tip\n x.times do #Change length of side\n move\n turn_right\n move\n put_beeper\n turn_left\n end\n adjust_for_tip\n end\n end", "def fiddle args\n args.state.gravity = -0.3\n args.state.enemy_jump_power = 10 # sets enemy values\n args.state.enemy_jump_interval = 60\n args.state.hammer_throw_interval = 40 # sets hammer values\n args.state.hammer_launch_power_default = 5\n args.state.hammer_launch_power_near = 2\n args.state.hammer_launch_power_far = 7\n args.state.hammer_upward_launch_power = 15\n args.state.max_hammers_per_volley = 10\n args.state.gap_between_hammers = 10\n args.state.player_jump_power = 10 # sets player values\n args.state.player_jump_power_duration = 10\n args.state.player_max_run_speed = 10\n args.state.player_speed_slowdown_rate = 0.9\n args.state.player_acceleration = 1\n args.state.hammer_size = 32\nend", "def create_graphics\n create_viewport\n create_background\n create_buttons\n init_entering\n end", "def create_tree_positions\n # Get the number of qualified participants from the tournament\n if tournament.rankings.empty?\n participants_number = tournament.max_participants\n else\n # Or from the number of qualified from last ranking\n participants_number = tournament.rankings[tournament.rankings.size - 1].qualified\n end\n\n special = false\n next_depth = participants_number\n special_falling = false\n (participants_number * 2 - 1).downto(1) do |pos|\n tree_positions.create(:position => pos, :special => special)\n if tree_type == DOUBLE\n if pos.even?\n tree_positions.create(:position => -pos, :special => false)\n tree_positions.create(:position => -pos, :special => true) if special_falling\n elsif special_falling and pos != 1\n tree_positions.create(:position => -pos, :special => true)\n end\n end\n if pos == next_depth\n special_falling = true\n special = !special\n next_depth /= 2\n end\n end\n end", "def setup_blueprint_rooms\n # hardcoded layout\n @corridors << @fort_entrance\n\n fx = @fort_entrance.x\n fy = @fort_entrance.y\n\n fz = @fort_entrance.z1\n setup_blueprint_workshops(fx, fy, fz, [@fort_entrance])\n \n fz = @fort_entrance.z1 -= 1\n setup_blueprint_utilities(fx, fy, fz, [@fort_entrance])\n \n fz = @fort_entrance.z1 -= 1\n setup_blueprint_stockpiles(fx, fy, fz, [@fort_entrance])\n \n 2.times {\n fz = @fort_entrance.z1 -= 1\n setup_blueprint_bedrooms(fx, fy, fz, [@fort_entrance])\n }\n end", "def setup_blueprint_rooms\n # hardcoded layout\n @corridors << @fort_entrance\n\n fx = @fort_entrance.x\n fy = @fort_entrance.y\n\n fz = @fort_entrance.z1\n setup_blueprint_workshops(fx, fy, fz, [@fort_entrance])\n \n fz = @fort_entrance.z1 -= 1\n setup_blueprint_utilities(fx, fy, fz, [@fort_entrance])\n \n fz = @fort_entrance.z1 -= 1\n setup_blueprint_stockpiles(fx, fy, fz, [@fort_entrance])\n \n 2.times {\n fz = @fort_entrance.z1 -= 1\n setup_blueprint_bedrooms(fx, fy, fz, [@fort_entrance])\n }\n end", "def place_room(w,h,room_id)\n \n max_tries = Dungeon::MAX_PLACEMENT_ITERATION\n c_try = 0\n while c_try < max_tries\n\n # Get the top left corner, must be even \n tli = (rand*@width).floor\n tli += 1 if tli.odd?\n tlj = (rand*@height).floor\n tlj += 1 if tlj.odd?\n\n # Check all the cells from this point are unallocated, \n # and an extra 1 width around for perimeter\n failed = false\n (tli..tli+w+1).each do |i|\n (tlj..tlj+h+1).each do |j|\n if !failed\n failed = true if @cells[i][j].type != Cell::UNALLOCATED\n end\n end\n end\n\n \n # if checks ok, build the room and the perimeter\n if !failed\n\t\t\t\t# Probability falls so there are an average of 2 doors per room\n\t\t\t\tper = 2*(w+h)\n\t\t\t\tdoor_chance = Dungeon::ROOM_DOORS/per\n\n\t\t\t\t# Prep for building a logical object ready for dead end removal\n\t\t\t\troom_cells = []\n\n (tli..tli+w+1).each do |i|\n (tlj..tlj+h+1).each do |j|\n @cells[i][j].type = Cell::ROOM\n @cells[i][j].room_id = room_id\n\t\t\t\t\t\t\t# If perimeter wall, assign door if random number is under the threshold\n \t\t\t\t\t\tif i == tli || i == tli+w+1 || j == tlj || j == tlj+h+1 \n @cells[i][j].type = Cell::PERIMETER \n\t\t\t\t\t\t\t\tif i.odd? || j.odd?\n\t\t @cells[i][j].type = Cell::ENTRANCE if rand < door_chance\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\t\t# Store the room cells read for assignment to logical structure\n\t\t\t\t\t\t\troom_cells << @cells[i][j];\n end\n end\n # Meet loop criterea\n c_try = Dungeon::MAX_PLACEMENT_ITERATION\n\n\t\t\t\t# Build logical object and map entrance cells to the room\n\t\t\t\troom_obj = RoomBranch.new(room_cells)\n\t\t\t\troom_cells.each { |c| room_map[c] = room_obj if c.type == Cell::ENTRANCE }\n\n end\n \n c_try += 1\n end\n \n end", "def initialize\n \t@grid_w = 50\n \t@grid_h = 40\n \t@grid = []\n\t\n\t\t@player_x = 0\n\t\t@player_y = 0\n\t\t@has_enviroment_rendered=false\n\t\t#setup and fill grid with walls\n \t@grid_w.times.with_index do |x|\n \t\t@grid[x] = []\n\t\t\t@grid_h.times.with_index do |y|\n \t\t\t@grid[x][y]= 1\n \t \tend\n \tend\n\t\tmin_rooms = 2\n\t\tmax_rooms = 10\n\t\t#setup number of rooms that will exist\n\t\t@n_rooms = rand(max_rooms - min_rooms) + min_rooms\n\t\tputs \"n rooms #{@n_rooms}\"\n\t\trooms = []\n\t\t#define the size of each room\n\t\t@n_rooms.times.with_index do |room|\n\t\t\trooms[room] = make_room 8,10\n\t\tend\n\t\n\t\t#clears the walls from where rooms will be \n\t\trooms.each_with_index do |r,i| \n\t\t\t(r[:x]..r[:x] + r[:w]).each do |x|\n\t\t\t\t(r[:y]..r[:y] + r[:h]).each do |y|\n\t\t\t\t\t@grid[x][y]= 0\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t#create pathways towards the next room\n\t\trooms.each_cons(2) do |(cur_room, next_room)|\n\t\t\t#find the center of each room \n\t\t\tcenter_x = cur_room[:x] + cur_room[:w].idiv(2)\n\t\t\tcenter_y = cur_room[:y] + cur_room[:h].idiv(2)\n\n\t\t\tnext_center_x = next_room[:x] + next_room[:w].idiv(2)\n\t\t\tnext_center_y = next_room[:y] + next_room[:h].idiv(2)\n\n\t\t\t#loops between each rooms X and Y positions \n\t\t\t#this can be approached differently\n\t\t\t(min(center_x,next_center_x)..max(center_x,next_center_x)).each do |x|\n\t\t\t\t(min(center_y,next_center_y)..max(center_y,next_center_y)).each do |y|\n\t\t\t\t\t#checking if this position is in-line with either rooms x or y centres\n\t\t\t\t\t@grid[x][y] = 0 if y == center_y || y == next_center_y || x == center_x || x == next_center_x\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t@new_grid = []\n\t\t#set new grid to prune unneeded walls to improve performance\n\t\t@grid_w.times.with_index do |x|\n\t \t@new_grid[x] = []\n\t \t@grid_h.times.with_index do |y|\n \t\t\t@new_grid[x][y]= @grid[x][y]\n\t\t\tend\n\t end\n\t\t#set up values\n\t\t@grid_w.times.with_index do |x|\n \t\t@grid_h.times.with_index do |y|\n\t\t\t\t#if surrounded it should not be filled in\n\t\t\t\tif check_surrounding_tiles x,y\n\t\t\t\t\t@grid[x][y] = 0\n\t\t\t\tend\n \t\tend\n \tend\n\t\t#this will set the players starting position to a known safe area\n\t\t@player_x = rooms[0][:x] + rooms[0][:w].idiv(2)\n\t\t@player_y = rooms[0][:y] + rooms[0][:h].idiv(2)\n\t\t@grid[@player_x][@player_y] = 2\n\tend", "def custom_tree\n\t\t#if they haven't made a shrink range/trunk yet, make one for them\n\t\tif $shrink_range.empty?\n\t\t\t$shrink_Range = (4..6).to_a\n\t\tend\n\t\tif $trunk.empty?\n\t\t\t$trunk = (175..250).to_a\n\t\tend\n\t\t\n\t\t@shrink = \"0.#{$shrink_range[0]}\".to_f\n\t\t#Height is 600, so y is in (0,600)\n\t\t$angle_of_separation = (@window.mouse_y / 10).to_i #this gives max of 60 degree angle, min of 0 (line)\n\t\t\n\t\t@branches = []\n\t\t@branches << [ [[@x, Height - @bot_margin], [@x, Height - $trunk[0]]] ]\n\t\t#Width is 800, so x is in (0,800)\n\t\t$num_splits = (((@window.mouse_x) / 100).to_i)+2 #this gives max of 8+2=10 splits, min of 2\n\t\t\n\t\tputs \"This output is from Custom Tree\"\n\t\tputs \"Number of splits: #{$num_splits}\"\t\n\t\tputs \"Angle of separation: #{$angle_of_separation}\"\n\t\tputs \"Shrink range: #{$shrink_range[0]} to #{$shrink_range[$shrink_range.length-1]}\"\n\t\tputs \"Split range: #{$split_range}\"\t\t\n\t\tputs \"Initial branch length: #{$trunk[0]} to #{$trunk[$trunk.length-1]}\"\n\t end", "def mkWins\n\t\tfreerows=4\n\t\t@apPanel=BoxedWin.new(nil,Ncurses.LINES-freerows,Ncurses.COLS/2,0,0,ATTR_NORMAL)\n\t\t@apListBox=ListBox.new(@apPanel)\n\t\t@entryPanel=BoxedWin.new(nil,Ncurses.LINES-freerows,Ncurses.COLS-Ncurses.COLS/2,0,Ncurses.COLS/2,ATTR_NORMAL)\n\t\t@entryListBox=ListBox.new(@entryPanel)\n\t\t@entryListBox.showSelected(false)\n\t\t@statusRow=WINDOW.new(1,Ncurses.COLS,Ncurses.LINES-freerows,0)\n\t\t@statusRow.bkgd(ATTR_NORMAL); @statusRow.refresh\n\t\t@commandWin=BoxedWin.new(nil,freerows-1,Ncurses.COLS,Ncurses.LINES-freerows+1,0,ATTR_NORMAL)\n\t\t@active=@apListBox\n\n\t\t@apPanel.title( \"Available Accesspoints\", :LEFT );\n\tend", "def do_mill\r\n # - - - - - - - - - - - - - - - - - - \r\n max_diam = 4.95\r\n max_radius = max_diam / 2\r\n shaft_support_diam = 0.55\r\n beg_diam = shaft_support_diam\r\n shaft_diameter = 1.0 / 4.0\r\n beg_corr_width = 0.2\r\n growth_factor = 0.09 # 0.12 #0.15 #0.25\r\n degree_increment = 30\r\n wall_thick = 0.015\r\n sweep = 45.0\r\n curr_radius = beg_diam / 2\r\n curr_degree = 0.0\r\n curr_corr_width = beg_corr_width\r\n degree_inc = 4.0\r\n inner_adj_factor = 1.2 #0.8 #0.7 #0.9 #1.2 #2.7 #2.1\r\n material_thickness = 1.0\r\n outer_radius_beg = curr_radius + curr_corr_width\r\n\r\n aCircle = CNCShapeCircle.new(mill,x,y)\r\n aCircle.mill_pocket(x, y, 1.0, depth,shaft_support_diam)\r\n mill.retract() # mill whole for entrance \r\n # of gases from prior chamber but leave\r\n # shaft support area\r\n\r\n aCircle.mill_pocket(x, y, shaft_diameter, 0 - material_thickness.abs)\r\n mill.retract() # mill hole for the shaft\r\n\r\n\r\n\r\n while true\r\n end_degree = curr_degree + sweep\r\n end_corr_width = curr_corr_width + (curr_corr_width * growth_factor)\r\n\r\n outer_radius_end = curr_radius + end_corr_width\r\n\r\n inner_rad_end = curr_radius + (curr_radius * growth_factor * inner_adj_factor)\r\n\r\n inner_adj_factor = inner_adj_factor * 0.97\r\n\r\n arc_segment_pocket_adv(mill, x,y,\r\n curr_radius, \r\n outer_radius_beg,\r\n curr_degree,\r\n inner_rad_end, \r\n outer_radius_end, \r\n end_degree, \r\n 0,\r\n depth,\r\n degree_inc)\r\n\r\n curr_degree += sweep\r\n curr_corr_width = end_corr_width\r\n\r\n curr_radius = inner_rad_end\r\n\r\n outer_radius_beg = outer_radius_end\r\n\r\n if (outer_radius_end > max_radius)\r\n break\r\n end #if\r\n\r\n\r\n\r\n\r\n end #while\r\n end", "def calc args\n add_new_enemies_if_needed args\n move_bullets args\n calculate_collisions args\n remove_bullets_of_screen args\nend", "def turn_around\n stop_totally\n @headed_left = !@headed_left\n walk\n end", "def initialize(elevators, request)\n @elevators = elevators\n @request = request\n end", "def create_call_buttons\n \n for floor in 1..Elevator.num_floors do\n \n up_btn = CallButton.new(floor, \"up\", self)\n @up_call_buttons.append(up_btn)\n\n down_btn = CallButton.new(floor, \"down\", self)\n @down_call_buttons.append(down_btn)\n end\n end", "def setup\n setup_major_pieces\n setup_pawns\n end", "def organize_data()\n set_envelope_hierarchy()\n # Associating the polygons with the FLoor and spaces.\n polygons = find_all_commands(\"POLYGON\")\n spaces = find_all_commands(\"SPACE\")\n floors = find_all_commands(\"FLOOR\")\n zones = find_all_commands(\"ZONE\")\n ext_walls = find_all_commands(\"EXTERIOR-WALL\")\n roof = find_all_commands(\"ROOF\")\n door = find_all_commands(\"DOOR\")\n int_walls = find_all_commands(\"INTERIOR-WALL\")\n underground_walls = find_all_commands(\"UNDERGROUND-WALL\")\n underground_floors = find_all_commands(\"UNDERGROUND-FLOOR\")\n constructions =find_all_commands(\"CONSTRUCTION\")\n surface_lists = [ ext_walls, roof, door, int_walls, underground_walls, underground_floors]\n\n\n #Organize surface data.\n surface_lists.each do |surfaces|\n surfaces.each do |surface|\n #Assign constructions to surface objects\n constructions.each do |construction|\n if ( construction.utype == surface.get_keyword_value(\"CONSTRUCTION\") )\n surface.construction = construction\n end\n end\n #Find Polygons associated with surface.\n polygons.each do |polygon|\n if ( surface.check_keyword?(\"POLYGON\") and polygon.utype == surface.get_keyword_value(\"POLYGON\") )\n surface.polygon = polygon\n end\n end\n end\n end\n\n\n\n #Organize polygon data for space and floors.\n polygons.each do |polygon|\n #set up point list in polygon objects\n polygon.create_point_list()\n #Find Polygons associated with floor and and reference to floor.\n floors.each do |floor|\n if ( polygon.utype == floor.get_keyword_value(\"POLYGON\") )\n floor.polygon = polygon\n end\n end\n #Find Polygons for space and add reference to the space.\n spaces.each do |space|\n if space.check_keyword?(\"POLYGON\")\n if ( polygon.utype == space.get_keyword_value(\"POLYGON\") )\n space.polygon = polygon\n end\n end\n end\n end\n\n\n\n # Find spaces that belong to the zone.\n zones.each do |zone|\n spaces.each do |space|\n if ( space.utype == zone.get_keyword_value(\"SPACE\") )\n space.zone = zone\n zone.space = space\n end\n end\n end\n end", "def setup\n @calculator = Calculator.new WIDTH, HEIGHT, DEPTH, DRAWER_THICKNESS, CARCASS_THICKNESS,\n SIDE_CLEARANCE, REAR_CLEARANCE, TOP_CLEARANCE, BOTTOM_CLEARANCE,\n FACE_CLEARANCE, DADO_WIDTH, DADO_DEPTH\n\n end", "def draw_left_rests\n if @left_rests > 0\n big_rests = @left_rests / 2\n small_rests = @left_rests % 2\n if (@index % 2) == 1\n big_rests.times{@left_hand << \"r4 \"}\n @left_hand << \"r#{(8.0/small_rests).to_i} \" if small_rests > 0\n else\n @left_hand << \"r#{(8.0/small_rests).to_i} \" if small_rests > 0\n big_rests.times{@left_hand << \"r4 \"}\n end\n @left_rests = 0\n end\n end", "def create_arrows\n bx, by = 80, 16\n bw, bh = 8, 16\n 2.times do |i|\n sprite = Sprite.new(@viewport2)\n sprite.bitmap = Bitmap.new(bw, bh)\n sx = (i == 0 ? bx : (bx + bw + bh)) # 0 for left, 1 for right arrow\n rect = Rect.new(sx, by + bw, bw, bh)\n sprite.bitmap.blt(0, 0, self.windowskin, rect)\n sprite.y = self.y + (window_height - bh) - spacing * 4 \n sprite.x = i == 0 ? self.x + 2 : self.x + window_width - bw\n @arrow_sprites.push(sprite.hide)\n end\n end", "def motor\n\t\tbase = outline.linear_extrude(height:(@motor_height/6)*4,center:true).color(\"DimGray\")\n\n\t\tbase+= outline.linear_extrude(height:(@motor_height/6),center:true).translate(z:(@motor_height/1.5+@motor_height/6-0.1)/2).color(\"LightGrey\") \t\t\n\t\tbase+= outline.linear_extrude(height:(@motor_height/6),center:true).translate(z:-(@motor_height/1.5+@motor_height/6-0.1)/2).color(\"LightGrey\") \t\t\n\t\t\n\t\tflange=cylinder(d:@motor_flange_dia,h:@motor_flange_height,center:true).translate(z:(@motor_height+@motor_flange_height-0.01)/2).color(\"LightGrey\")\n\t\t\t\t\n\t\tshaft = cylinder(d:@motor_shaft_OD,h:@motor_shaft_height,center:true).translate(z:(@motor_shaft_height+@motor_height+@motor_flange_height)/2).color(\"WhiteSmoke\")\n\n\t\t# screw holes\n\t\t[-1,1].each do |i|\t\n\t\t\t[-1,1].each do |f|\t\n\t\t\t\tbase-= cylinder(d:@motor_mounting_hole_diam,h:@motor_height+1,center:true).translate(x:i*@motor_mounting_hole_distance/2,y:f*@motor_mounting_hole_distance/2,z:@motor_height-8).color(\"DimGray\")\n\t\t\tend\n\t\tend\n\n\n\t\tmotor = base+flange+shaft\n\t\t# move motor that z is 0\n\t\tmotor.translate(z:@motor_height/2)\t\t\n\tend", "def spot_legs\n lines = []\n indent = 0\n spacer = @width - @padding\n\n draw_legs(lines, indent, spacer)\n lines\n end", "def print_employee_graphics_box(box)\n\n # Horizontal lines (top to bottom, left to right).\n x = box[:x].in\n y = box[:y].in\n self.line_width = 0.01.in\n stroke_line([x, y], [x + 3.75.in, y])\n y -= 0.25.in\n self.line_width = 0.02.in\n stroke_line([x, y], [x + 3.75.in, y])\n y -= 0.25.in\n stroke_line([x + 1.25.in, y], [x + 3.75.in, y])\n y -= 0.125.in\n stroke_line([x, y], [x + 1.25.in, y])\n y -= 0.125.in\n self.line_width = 0.01.in\n stroke_line([x + 1.25.in, y], [x + 3.75.in, y])\n y -= 0.25.in\n stroke_line([x, y], [x + 3.75.in, y])\n y -= 0.75.in\n stroke_line([x, y], [x + 3.75.in, y])\n y -= 0.25.in\n stroke_line([x, y], [x + 3.75.in, y])\n y -= 0.75.in\n stroke_line([x, y], [x + 3.75.in, y])\n y -= 0.25.in\n stroke_line([x, y], [x + 3.75.in, y])\n y -= 0.25.in\n stroke_line([x, y], [x + 3.75.in, y])\n y -= 0.25.in\n stroke_line([x, y], [x + 1.in, y])\n stroke_line([x + 2.5.in, y], [x + 3.75.in, y])\n y -= 0.25.in\n stroke_line([x, y], [x + 1.in, y])\n stroke_line([x + 2.5.in, y], [x + 3.75.in, y])\n y -= 0.25.in\n stroke_line([x, y], [x + 3.75.in, y])\n y -= 0.375.in\n stroke_line([x, y], [x + 3.75.in, y])\n y -= 0.375.in\n stroke_line([x, y], [x + 3.75.in, y])\n\n # Vertical lines (top to bottom, left to right).\n x = box[:x].in\n y = box[:y].in\n stroke_line([x, y], [x, y - 4.75.in])\n stroke_line([x + 2.6.in, y], [x + 2.6.in, y - 0.25.in])\n stroke_line([x + 3.75.in, y], [x + 3.75.in, y - 4.75.in])\n self.line_width = 0.02.in\n y -= 0.25.in\n stroke_line([x, y], [x, y - 0.375.in])\n stroke_line([x + 1.25.in, y], [x + 1.25.in, y - 0.375.in])\n stroke_line([x + 2.5.in, y], [x + 2.5.in, y - 0.25.in])\n stroke_line([x + 3.75.in, y], [x + 3.75.in, y - 0.25.in])\n y -= 0.25.in\n self.line_width = 0.01.in\n stroke_line([x + 2.5.in, y], [x + 2.5.in, y - 0.25.in])\n y -= 0.125.in\n stroke_line([x + 1.25.in, y], [x + 1.25.in, y - 0.375.in])\n y -= 0.125.in\n stroke_line([x + 2.5.in, y], [x + 2.5.in, y - 0.25.in])\n y -= 2.in\n stroke_line([x + 1.25.in, y], [x + 1.25.in, y - 0.5.in])\n stroke_line([x + 2.5.in, y], [x + 2.5.in, y - 1.25.in])\n y -= 0.5.in\n stroke_line([x + 1.in, y], [x + 1.in, y - 0.75.in])\n y -= 0.75.in\n stroke_line([x + 0.3.in, y], [x + 0.3.in, y - 0.25.in])\n stroke_line([x + 1.4.in, y], [x + 1.4.in, y - 0.375.in])\n stroke_line([x + 2.6.in, y], [x + 2.6.in, y - 0.375.in])\n y -= 0.375.in\n stroke_line([x + 1.25.in, y], [x + 1.25.in, y - 0.375.in])\n stroke_line([x + 2.5.in, y], [x + 2.5.in, y - 0.375.in])\n\n # Text (top to bottom, left to right).\n x = box[:x]\n y = box[:y]\n self.vms_text_box(box[:title], x + 0.1, y, 2.4, 0.25, 7, :bold, :left, :center, nil, 'ff0000')\n self.vms_text_box(\"41-0852411\\nOMB No. 1545-0008\", x + 2.6, y, 1.15, 0.25, 6, :normal, :center, :center)\n y -= 0.25\n self.vms_text_box(\"<strong>a</strong> Employee's soc. sec. no.\", x + 0.05, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"<strong>1</strong> Wages, tips, other comp.\", x + 1.3, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"<strong>2</strong> Federal income tax withheld\", x + 2.55, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n y -= 0.25\n self.vms_text_box(\"<strong>3</strong> Social security wages\", x + 1.3, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"<strong>4</strong> Social security tax withheld\", x + 2.55, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n y -= 0.125\n self.vms_text_box(\"<strong>b</strong> Employer ID number (EIN)\", x + 0.05, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n y -= 0.125\n self.vms_text_box(\"<strong>5</strong> Medicare wages and tips\", x + 1.3, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"<strong>6</strong> Medicare tax withheld\", x + 2.55, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n y -= 0.25\n self.vms_text_box(\"<strong>c</strong> Employer's name, address, and ZIP code\", x + 0.05, y - 0.02, 3.65, _p(6), 6, :normal, :left, :top)\n y -= 0.75\n self.vms_text_box(\"<strong>d</strong> Control number\", x + 0.05, y - 0.02, 3.65, _p(6), 6, :normal, :left, :top)\n y -= 0.25\n self.vms_text_box(\"<strong>e</strong> Employee's name, address, and ZIP code\", x + 0.05, y - 0.02, 3.65, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"Suff.\", x + 0.05, y - 0.02, 3.65, _p(6), 6, :normal, :right, :top)\n y -= 0.75\n self.vms_text_box(\"<strong>7</strong> Social security tips\", x + 0.05, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"<strong>8</strong> Allocated tips\", x + 1.3, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"<strong>9</strong> Verification code\", x + 2.55, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n y -= 0.25\n self.vms_text_box(\"<strong>10</strong> Dependent care benefits\", x + 0.05, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"<strong>11</strong> Nonqualified plans\", x + 1.3, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"<strong>12a</strong> Code (See inst. for box 12)\", x + 2.55, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n y -= 0.25\n self.vms_text_box(\"<strong>13</strong> Statutory employee\", x + 0.05, y - 0.02, 0.9, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"<strong>14</strong> Other\", x + 1.05, y - 0.02, 1.4, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"<strong>12b</strong> Code\", x + 2.55, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n y -= 0.25\n self.vms_text_box(\"Retirement plan\", x + 0.05, y - 0.02, 0.9, _p(6), 6, :normal, :center, :top)\n self.vms_text_box(\"<strong>12c</strong> Code\", x + 2.55, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n y -= 0.25\n self.vms_text_box(\"Third-party sick pay\", x + 0.05, y - 0.02, 0.9, _p(6), 6, :normal, :center, :top)\n self.vms_text_box(\"<strong>12d</strong> Code\", x + 2.55, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n y -= 0.5\n self.vms_text_box(\"<strong>15</strong> State Employer's ID Number\", x + 0.05, y - 0.02, 1.3, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"<strong>16</strong> State wages, tips, etc.\", x + 1.45, y - 0.02, 1.1, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"<strong>17</strong> State income tax\", x + 2.65, y - 0.02, 1.05, _p(6), 6, :normal, :left, :top)\n y -= 0.125\n self.vms_text_box(\"<strong>18</strong> Local wages, tips, etc.\", x + 0.05, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"<strong>19</strong> Local income tax\", x + 1.3, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"<strong>20</strong> Locality name\", x + 2.55, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n y -= 0.375\n self.vms_text_box(\"2018\", x, y - 0.02, 3.75, 0.25, 8, :bold, :center, :top, nil, 'ff0000')\n self.vms_text_box(\"Form W-2 Wage and Tax Statement\", x, y - 0.04, 3.75, 0.125, 6, :bold, :left, :top, nil, 'ff0000')\n self.vms_text_box(\"Dept. of the Treasury -- IRS\", x, y - 0.04, 3.75, 0.125, 6, :normal, :right, :top)\n y -= box[:bottom_left_offset]\n self.vms_text_box(box[:bottom_left], x, y - 0.04, 3.75, box[:bottom_left_height], 6, :normal, :left, :top)\n y -= box[:bottom_right_offset]\n self.vms_text_box(box[:bottom_right], x, y - 0.04, 3.75, 0.125, 6, :normal, :right, :top)\n\n end", "def draw\n # draw background first\n 0.upto(LEVEL_WIDTH - 1) do |x|\n (LEVEL_HEIGHT - 1).downto(0) do |y|\n if @tiles[x + @x_offset + LEVEL_WIDTH * (y + @y_offset)] == :background\n # choose background terrain\n image = @terrain[1]\n # actual top left coordinates\n px = x * 32 * SCALE\n py = y * 25 * SCALE - 25 * SCALE\n # draw to the screen scaled to size\n image.draw(px, py, 0, SCALE, SCALE)\n elsif @tiles[x + @x_offset + LEVEL_WIDTH * (y + @y_offset)] == :background2\n # choose background terrain\n image = @terrain[3]\n # actual top left coordinates\n px = x * 32 * SCALE\n py = y * 25 * SCALE - 25 * SCALE\n # draw to the screen scaled to size\n image.draw(px, py, 0, SCALE, SCALE)\n elsif @tiles[x + @x_offset + LEVEL_WIDTH * (y + @y_offset)] == :none\n image = @terrain[2]\n # actual top left coordinates\n px = x * 32 * SCALE\n py = y * 25 * SCALE - 25 * SCALE\n # draw to the screen scaled to size\n image.draw(px, py, 0, SCALE, SCALE)\n end\n end\n end\n\n # draw platforms on top of the background\n 0.upto(LEVEL_WIDTH - 1) do |x|\n (LEVEL_HEIGHT - 1).downto(0) do |y|\n if @tiles[x + @x_offset + LEVEL_WIDTH * (y + @y_offset)] == :platform\n # choose platform terrain\n image = @terrain[0]\n # actual top left coordinates\n px = x * 32 * SCALE\n py = y * 25 * SCALE - 25 * SCALE\n # draw to the screen scaled to size\n image.draw(px, py, 0, SCALE, SCALE)\n end\n end\n end\n\n for enemy in @enemies do\n enemy.draw SCALE, @x_offset * 32 * SCALE, @y_offset * 25 * SCALE\n end\n\n for candy in @candies do\n candy.draw SCALE, @x_offset * 32 * SCALE, @y_offset * 25 * SCALE\n end\n\n Gosu::Image.from_text(self, @current_selection.to_s, \"Times New Roman\", 24).draw(5, 5, 0, 1, 1, 0xffffffff)\n\n @player_image[0].draw(@player[0] * SCALE - @x_offset * 32 * SCALE, @player[1] * SCALE - @y_offset * 25 * SCALE, 1, SCALE, SCALE) unless @player.nil?\n @door_image[0].draw(@door[0] * SCALE - @x_offset * 32 * SCALE, @door[1] * SCALE - @y_offset * 25 * SCALE, 1, SCALE, SCALE) unless @door.nil?\n\n @target[0].draw(mouse_x, mouse_y, 2, SCALE, SCALE) if @current_type == :candies\n end", "def move_party_horn\n\t\tif face_left?\n\t\t\t@party_horn.x = @x + \n\t\t\t\t\t\t\t(TILE_WIDTH/4 - PartyHorn::PARTY_HORN_TILE_WIDTH)\n\t\telse\n\t\t\t@party_horn.x = @x + 3 * TILE_WIDTH/4\n\t\tend\n\t\t@party_horn.y = @y + 3 * TILE_HEIGHT/5\n\t\t@party_horn.angle = @angle\n\tend", "def build_in_floors\n\n\t\t\t\t_in_floors = []\n\n\t\t\t\tdef _parseFloors string\n\t\t\t\t\t# Format\n\t\t\t\t\tstring = string.gsub(/[^0-9\\-,]/, '')\n\n\t\t\t\t\tlist = []\n\t\t\t\t\tstring.split(',').each do |s|\n\t\t\t\t\t\t# remove redundancy\n\t\t\t\t\t\tvalue = s.gsub(/\\-.*\\-/, '-').split('-')\n\n\t\t\t\t\t\t# case: just a number\n\t\t\t\t\t\tif value.length == 1\n\t\t\t\t\t\t\tlist << value[0].to_i\n\t\t\t\t\t\t# case: in range\n\t\t\t\t\t\telse \n\t\t\t\t\t\t\t# case: full param\n\t\t\t\t\t\t\tif value[0].present? && value[1].present?\n\t\t\t\t\t\t\t\tvalue[0] = value[0].to_i\n\t\t\t\t\t\t\t\tvalue[1] = value[1].to_i\n\n\t\t\t\t\t\t\t\t# exchange for correct format (increase)\n\t\t\t\t\t\t\t\tif value[0] > value[1]\n\t\t\t\t\t\t\t\t\ttemp = value[0]\n\t\t\t\t\t\t\t\t\tvalue[0] = value[1]\n\t\t\t\t\t\t\t\t\tvalue[1] = temp\n\t\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\t\t\t(value[0]..value[1]).each do |v|\n\t\t\t\t\t\t\t\t\tlist << v\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t# case: one in => same a number\n\t\t\t\t\t\t\telsif value[0].present?\n\t\t\t\t\t\t\t\tlist << value[0].to_i\n\t\t\t\t\t\t\telsif value[1].present?\n\t\t\t\t\t\t\t\tlist << value[1].to_i\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\tlist.uniq.sort\n\t\t\t\tend\n\n\t\t\t\tfloor_infos_text.each do |_info|\n\t\t\t\t\t_parseFloors(_info['floors']).each do |_floor_number|\n\t\t\t\t\t\t_floor_info = FloorRealEstate.where(real_estate_id: id, floor: _floor_number).first_or_initialize(status: 'unavailable')\n\n\t\t\t\t\t\t_floor_info.label = label.gsub(/{f(:.*)*}/) do |match|\n\t\t\t\t\t\t\tmatch = match.split(':')\n\t\t\t\t\t\t\tnext _floor_number if (match.count == 1)\n\n\t\t\t\t\t\t\t_strFloor = _floor_number.to_s\n\t\t\t\t\t\t\tmatch[1] = match[1].to_i\n\t\t\t\t\t\t\tif match[1].present?\n\t\t\t\t\t\t\t\tnext _strFloor.rjust(match[1], '0')\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tnext _floor_number\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\t_floor_info.floor = _floor_number\n\n\t\t\t\t\t\tif _info['sell_price'].present?\n\n\t\t\t\t\t\t\tif _info['sell_floor_coefficient'].present?\n\t\t\t\t\t\t\t\t_coefficient = _info['sell_floor_coefficient']\n\n\t\t\t\t\t\t\t\t# Replace operator\n\t\t\t\t\t\t\t\t# x => *\n\t\t\t\t\t\t\t\t_coefficient = _coefficient.gsub(/x(?!(^{)*})/i, '*')\n\t\t\t\t\t\t\t\t# : => /\n\t\t\t\t\t\t\t\t_coefficient = _coefficient.gsub(/:(?!(^{)*})/, '/')\n\t\t\t\t\t\t\t\t# \\D & operator => ''\n\t\t\t\t\t\t\t\t_coefficient = _coefficient.gsub(/[^\\d\\+\\-\\*\\/\\(\\)\\{\\}](?!(^{)*})/, '')\n\t\t\t\t\t\t\t\t# ++ => +\n\t\t\t\t\t\t\t\t_coefficient = _coefficient.gsub(/\\+[\\+\\-\\*\\/](?!(^{)*})/, '+')\n\t\t\t\t\t\t\t\t_coefficient = _coefficient.gsub(/\\-[\\+\\-\\*\\/](?!(^{)*})/, '-')\n\t\t\t\t\t\t\t\t_coefficient = _coefficient.gsub(/\\*[\\+\\-\\*\\/](?!(^{)*})/, '*')\n\t\t\t\t\t\t\t\t_coefficient = _coefficient.gsub(/\\/[\\+\\-\\*\\/](?!(^{)*})/, '/')\n\n\t\t\t\t\t\t\t\t# Calc\n\t\t\t\t\t\t\t\t_floor_info.sell_price = eval(_coefficient.gsub('{f}', _floor_number.to_s).gsub('{p}', _info['sell_price'].to_s))\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t_floor_info.sell_price = _info['sell_price']\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\t\t\t_floor_info.sell_price_text = ApplicationHelper.read_money _floor_info.sell_price\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\tif _info['rent_price'].present?\n\n\t\t\t\t\t\t\tif _info['rent_floor_coefficient'].present?\n\t\t\t\t\t\t\t\t_coefficient = _info['rent_floor_coefficient']\n\n\t\t\t\t\t\t\t\t# Replace operator\n\t\t\t\t\t\t\t\t# x => *\n\t\t\t\t\t\t\t\t_coefficient = _coefficient.gsub(/x(?!(^{)*})/i, '*')\n\t\t\t\t\t\t\t\t# : => /\n\t\t\t\t\t\t\t\t_coefficient = _coefficient.gsub(/:(?!(^{)*})/, '/')\n\t\t\t\t\t\t\t\t# \\D & operator => ''\n\t\t\t\t\t\t\t\t_coefficient = _coefficient.gsub(/[^\\d\\+\\-\\*\\/\\(\\)\\{\\}](?!(^{)*})/, '')\n\t\t\t\t\t\t\t\t# ++ => +\n\t\t\t\t\t\t\t\t_coefficient = _coefficient.gsub(/\\+[\\+\\-\\*\\/](?!(^{)*})/, '+')\n\t\t\t\t\t\t\t\t_coefficient = _coefficient.gsub(/\\-[\\+\\-\\*\\/](?!(^{)*})/, '-')\n\t\t\t\t\t\t\t\t_coefficient = _coefficient.gsub(/\\*[\\+\\-\\*\\/](?!(^{)*})/, '*')\n\t\t\t\t\t\t\t\t_coefficient = _coefficient.gsub(/\\/[\\+\\-\\*\\/](?!(^{)*})/, '/')\n\n\t\t\t\t\t\t\t\t# Calc\n\t\t\t\t\t\t\t\t_floor_info.rent_price = eval(_coefficient.gsub('{f}', _floor_number.to_s).gsub('{p}', _info['rent_price'].to_s))\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t_floor_info.rent_price = _info['rent_price']\n\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\t\t_floor_info.rent_price_text = ApplicationHelper.read_money _floor_info.rent_price\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\t_floor_info.save\n\t\t\t\t\t\t_in_floors << _floor_info\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\tin_floor = _in_floors\n\t\t\t\tsave\n\t\t\t\tlabel\n\t\t\tend", "def create_graphics\n super()\n create_background\n create_type_background\n create_pokemon_battler_stack\n create_pokemon_text_boxes\n create_congratulation_text_boxes\n create_pokemon_stars_animation\n create_graveyard_anim\n create_turning_ball\n create_party_battler_stack\n create_league_champion_text_box\n create_trainer_infos_text_box\n create_end_stars\n end", "def bug # a light for the worm to follow?\n\t\tcolors = [80+rand(100),10+rand(10),100,50]\n\t\tbug_pts = @bug.walk(width,height)\n\t\trand_size = [rand(10)] * 2\n\t\tfill(*colors)\n\n\t\tellipse(*bug_pts,*rand_size)\n\tend", "def prepare_qiazol_chlfrm_etoh(num_ops)\n reagents = 'QIAzol, Chloroform, & Ethanol'\n \n # prepares fumehood for working with organics\n prepare_fumehood(reagents)\n \n # Calcs the required reagent volumes in mLs\n qia_vol = (num_ops * 0.7) + 0.2#mLs\n chlfrm_vol = (num_ops * 0.44) + 0.2#mLs\n etoh_vol = (num_ops * 0.5) + 0.2#mL\n \n show do\n title \"Aliquoting #{reagents} in the Fume Hood\"\n separator\n note \"Gather a <b>tube rack</b>\"\n note \"Gather <b>#{reagents.split(',').length}</b> falcon tubes that are able to hold the volumes below.\"\n reagents_tab = [\n [\"# of Samples\",\"QIAzol (ml)\", \"Chloroform (ml)\", \"100% Ethanol (ml)\"], \n [num_ops, qia_vol.round(3), chlfrm_vol.round(3), etoh_vol] \n ] \n table reagents_tab\n note \"Leave #{reagents} in fumehood until needed.\"\n note \"<b>Once finished, cap and store properly.</b>\"\n end\n end", "def random_tree\n\t\t#range of possible angle separations between branches\n\t\t#big range seems to be ok, 30 to 60 works nice\n\t\t$angle_of_separation = (30..60).to_a\n\t\t#range of possible shrinkage values, will have a decimal in front of it\n\t\t#shrink determines how short each branch is\n\t\t$shrink_range = (4..6).to_a\n\t\t#split determines how many levels of branches there are\n\t\t#below 5 makes a pretty weak tree\n\t\t#above 7 makes a big blob of black\n\t\t$split_range = (5..7).to_a\n\t\t\n\t\t#Determines how many branches the current one splits off into\n\t\t$num_splits = rand(4)+2\n\t\t\n\t\t#how long the \"trunk\" is, height is 600\n\t\t#this gets ugly above 250\n\t\t$trunk = (150..250).to_a\n\t\t\n\t\t#pick a random number from the split range to be used as the number of splits\n\t\t$split_range = $split_range[rand($split_range.length)]\n\t\t#as a decimal, find the factor we will multiply future branches by\n\t\t@shrink = \"0.#{$shrink_range[rand($shrink_range.length)]}\".to_f\n\t\t#pick a random value for the angle of separation from the range\n\t\t$angle_of_separation = $angle_of_separation[rand($angle_of_separation.length)]\n\t\t\n\t\t#make a multidimensional array for branches\n\t\t@branches = []\n\t\t#start at the bottom, but not all the way down\n\t\t#move @x to the top of the trunk, ready for next branches\n\t\t@branches << [ [[@x, Height - @bot_margin], [@x, Height - $trunk[rand($trunk.length)]]] ] \n\t\t\n\t\tputs \"This output is from Random Tree\"\n\t\tputs \"Number of splits: #{$num_splits}\"\n\t\tputs \"Angle of separation: #{$angle_of_separation}\"\n\t\tputs \"Shrink range: #{$shrink_range[0]} to #{$shrink_range[$shrink_range.length-1]}\"\n\t\tputs \"Split range: #{$split_range}\"\n\t\tputs \"Initial branch length: #{$trunk[0]} to #{$trunk[$trunk.length-1]}\"\n\t\t\n\t end", "def place_room(w, h, room_id)\n\n max_tries = Dungeon::MAX_PLACEMENT_ITERATION\n c_try = 0\n while c_try < max_tries\n\n # Get the top left corner, must be even \n tli = (rand*@width).floor\n tli += 1 if tli.odd?\n tlj = (rand*@height).floor\n tlj += 1 if tlj.odd?\n\n # Check all the cells from this point are unallocated, \n # and an extra 1 width around for perimeter\n failed = false\n (tli..tli+w+1).each do |i|\n (tlj..tlj+h+1).each do |j|\n if !failed\n failed = true if @cells[i][j].type != Cell::UNALLOCATED\n end\n end\n end\n\n\n # if checks ok, build the room and the perimeter\n if !failed\n # Probability falls so there are an average of 2 doors per room\n per = 2*(w+h)\n door_chance = Dungeon::ROOM_DOORS/per\n\n # Prep for building a logical object ready for dead end removal\n room_cells = []\n\n (tli..tli+w+1).each do |i|\n (tlj..tlj+h+1).each do |j|\n @cells[i][j].type = Cell::ROOM\n @cells[i][j].room_id = room_id\n # If perimeter wall, assign door if random number is under the threshold\n if i == tli || i == tli+w+1 || j == tlj || j == tlj+h+1\n @cells[i][j].type = Cell::PERIMETER\n if i.odd? || j.odd?\n @cells[i][j].type = Cell::ENTRANCE if rand < door_chance\n end\n end\n\n # Store the room cells read for assignment to logical structure\n room_cells << @cells[i][j];\n end\n end\n # Meet loop criterea\n c_try = Dungeon::MAX_PLACEMENT_ITERATION\n\n # Build logical object and map entrance cells to the room\n room_obj = RoomBranch.new(room_cells)\n room_cells.each { |c| room_map[c] = room_obj if c.type == Cell::ENTRANCE }\n\n end\n\n c_try += 1\n end\n\n end", "def createDisplaysList\n for x in 1..@numberOfFloors do\n @floorDisplaysList.append(Display.new(x, DisplayStatus::ON, x))\n # puts \"elevator#{@id} display floor #{@floorDisplaysList[x - 1].id} created\"\n end\n end", "def half_wind; end", "def create_geometry(pt1, pt2, view)\n model = view.model\n model.start_operation $exStrings.GetString(\"Create Cylinder\")\n entities = model.entities\n \n # First create a circle\n vec = pt2 - pt1\n length = vec.length\n if( length == 0.0 )\n UI.beep\n puts \"Cannot create a zero length cylinder\"\n return\n end\n circle = entities.add_circle pt1, vec, @radius, @numsegs\n\n # Now do a pushpull to create the cylinder\n face = entities.add_face circle\n normal = face.normal\n length = -length if( (normal % vec) < 0.0 )\n face.pushpull length\n\n model.commit_operation\nend", "def moveMan(oldX,oldY,newX,newY)\n @levelArr[newY][newX]='@'\n @levelArr[oldY][oldX]=' '\n #replace the box goals if they were overwritten by the above lines of code\n replenishBoxGoals\nend", "def automation(create_inspectors, inspectors, example_names, example_genders, example_ethnicities)\n\ta = (example_names.length - 1)# takes into account that user input will add length to various arrays\n\tb = (example_genders.length - 1)# takes into account that user input will add length to various arrays\n\tc = (example_ethnicities.length - 1)# takes into account that user input will add length to various arrays\n\t\n\tleftover_creations = create_inspectors - inspectors.length\n\t\n\tleftover_creations.times do \n\t\tl = rand(0..a) #creating 3 random numbers every loop\n\t\tm = rand(0..b)\n\t\tn = rand(0..c)\n\t\tinspectors << Inspector.new(example_names[l], example_genders[m], example_ethnicities[n])\n\tend\nend", "def render args\n if (args.state.player.dx < 0.01) && (args.state.player.dx > -0.01)\n args.state.player.dx = 0\n end\n\n #move list\n (args.layout.rect_group row: 0, col_from_right: 8, drow: 0.3,\n merge: { vertical_alignment_enum: 0, size_enum: -2 },\n group: [\n { text: \"move: WASD\" },\n { text: \"jump: Space\" },\n { text: \"attack forwards: J (while on ground\" },\n { text: \"attack upwards: K (while on groud)\" },\n { text: \"attack backwards: J (while on ground and holding A)\" },\n { text: \"attack downwards: K (while in air)\" },\n { text: \"dash attack: J, K in quick succession.\" },\n { text: \"shield: hold J, K at the same time.\" },\n { text: \"dash backwards: A, A in quick succession.\" },\n ]).into args.outputs.labels\n\n # registered moves\n args.outputs.labels << { x: 0.to_layout_col,\n y: 0.to_layout_row,\n text: \"input history\",\n size_enum: -2,\n vertical_alignment_enum: 0 }\n\n (args.state.inputlist.take(5)).map do |s|\n { text: s, size_enum: -2, vertical_alignment_enum: 0 }\n end.yield_self do |group|\n (args.layout.rect_group row: 0.3, col: 0, drow: 0.3, group: group).into args.outputs.labels\n end\n\n\n #sprites\n player = [args.state.player.x, args.state.player.y,\n args.state.player.w, args.state.player.h,\n \"sprites/square/white.png\",\n args.state.player.r]\n\n playershield = [args.state.player.x - 20, args.state.player.y - 10,\n args.state.player.w + 20, args.state.player.h + 20,\n \"sprites/square/blue.png\",\n args.state.player.r,\n 0]\n\n playerjab = [args.state.player.x + 32, args.state.player.y,\n args.state.player.w, args.state.player.h,\n \"sprites/isometric/indigo.png\",\n args.state.player.r,\n 0]\n\n playerupper = [args.state.player.x, args.state.player.y + 32,\n args.state.player.w, args.state.player.h,\n \"sprites/isometric/indigo.png\",\n args.state.player.r+90,\n 0]\n\n if ((args.state.tick_count - args.state.lastpush) <= 15)\n if (args.state.inputlist[0] == \"<<\")\n player = [args.state.player.x, args.state.player.y,\n args.state.player.w, args.state.player.h,\n \"sprites/square/yellow.png\", args.state.player.r]\n end\n\n if (args.state.inputlist[0] == \"shield\")\n player = [args.state.player.x, args.state.player.y,\n args.state.player.w, args.state.player.h,\n \"sprites/square/indigo.png\", args.state.player.r]\n\n playershield = [args.state.player.x - 10, args.state.player.y - 10,\n args.state.player.w + 20, args.state.player.h + 20,\n \"sprites/square/blue.png\", args.state.player.r, 50]\n end\n\n if (args.state.inputlist[0] == \"back-attack\")\n playerjab = [args.state.player.x - 20, args.state.player.y,\n args.state.player.w - 10, args.state.player.h,\n \"sprites/isometric/indigo.png\", args.state.player.r, 255]\n end\n\n if (args.state.inputlist[0] == \"forward-attack\")\n playerjab = [args.state.player.x + 32, args.state.player.y,\n args.state.player.w, args.state.player.h,\n \"sprites/isometric/indigo.png\", args.state.player.r, 255]\n end\n\n if (args.state.inputlist[0] == \"up-attack\")\n playerupper = [args.state.player.x, args.state.player.y + 32,\n args.state.player.w, args.state.player.h,\n \"sprites/isometric/indigo.png\", args.state.player.r + 90, 255]\n end\n\n if (args.state.inputlist[0] == \"dair\")\n playerupper = [args.state.player.x, args.state.player.y - 32,\n args.state.player.w, args.state.player.h,\n \"sprites/isometric/indigo.png\", args.state.player.r + 90, 255]\n end\n\n if (args.state.inputlist[0] == \"dash-attack\")\n playerupper = [args.state.player.x, args.state.player.y + 32,\n args.state.player.w, args.state.player.h,\n \"sprites/isometric/violet.png\", args.state.player.r + 90, 255]\n\n playerjab = [args.state.player.x + 32, args.state.player.y,\n args.state.player.w, args.state.player.h,\n \"sprites/isometric/violet.png\", args.state.player.r, 255]\n end\n end\n\n args.outputs.sprites << playerjab\n args.outputs.sprites << playerupper\n args.outputs.sprites << player\n args.outputs.sprites << playershield\n\n args.outputs.solids << 20.map_with_index do |i| # uses 20 squares to form bridge\n [i * 64, args.state.bridge_top - 64, 64, 64]\n end\nend", "def move (animal)\n dir = animal.dir\n x = animal.x\n y = animal.y\n if (dir >= 2 && dir < 5)\n animal.x = (x + 1) % WIDTH\n elsif (dir == 1 || dir == 5)\n animal.x = x % WIDTH\n else\n animal.x = (x - 1) % WIDTH\n end\n if (dir >= 0 && dir < 3)\n animal.y = (y - 1) % HEIGHT\n elsif (dir >= 4 || dir < 7)\n animal.y = (y + 1) % HEIGHT\n else\n animal.y = y % HEIGHT\n end\n animal.energy = animal.energy - 1\nend", "def levelUp\n @level += 1\n # every level requires a higher score threshhold score to advance\n @threshold += level * 150\n\n # after 9 planes, stop adding planes to make it possible to have\n # somewhere to go to dodge the planes if there is not laser\n game.add_plane if level < 9\n end", "def GenDamagedBox(x1, y1, x2, y2)\n thickness = GetDim('silkwidth')\n #d = [(x1-x2).abs, (y1-y2).abs].min / 10.0\n d = ((x1-x2).abs + (y1-y2).abs) / 20.0\n if x1 < x2 \n x = x1 + d\n else\n x = x1 - d\n end\n if y1 < y2 \n y = y1 + d\n else\n y = y1 - d\n end\n PcbElementLine(x1, y, x1, y2, thickness) +\n PcbElementLine(x, y1, x2, y1, thickness) +\n PcbElementLine(x1, y, x, y1, thickness) +\n PcbElementLine(x2, y2, x2, y1, thickness) +\n PcbElementLine(x2, y2, x1, y2, thickness)\nend", "def setup_events\n # When the left mouse button is clicked (as defined below in\n # setup_actors) call the teleport method in @lobo\n @cursor1.on(:click) do |x,y|\n @lobo.teleport(x,y)\n end\n # When the space bar is pressed (see below in setup_actors) call\n # the teleport method in @lobo\n @cursor2.on(:click) do |x,y|\n @lobo.teleport(x,y)\n end\n end", "def nebula; end", "def beast_mode(derp)\n largest_radius = [self.arena.width, self.arena.height].min / 2\n desired_dfd = largest_radius * self.health_factor\n dfd_delta = (desired_dfd - derp.distance).abs\n\n command.turret_heading = derp.heading\n command.radar_heading = derp.heading\n\n if (derp.heading.delta(sensors.turret_heading)).abs < TURRET_FIRE_RANGE\n command.fire(derp.distance > 200 ? MAX_FIRE_POWER : MIN_FIRE_POWER)\n end\n\n angle_from_derp = desired_dfd > derp.distance ? sensors.radar_heading : sensors.radar_heading + 180\n\n if dfd_delta <= 20 # we are at desired distance away\n command.heading = @clockwise ? angle_from_derp + 85 : angle_from_derp - 85\n command.speed = MAX_BOT_SPEED * (1 - (derp.distance / largest_radius))\n else\n command.heading = angle_from_derp\n command.speed = MAX_BOT_SPEED\n end\n\n end", "def enter(person)\n\t\tfloors.first.enter(person)\n\tend", "def horizontal_dirs\n moves = []\n # Add moves to the left...\n moves += grow_unblocked_moves_in_dir( 0, -1)\n # ...to the right...\n moves += grow_unblocked_moves_in_dir( 0, 1)\n # ...moves up...\n moves += grow_unblocked_moves_in_dir( 1, 0)\n # ...and moves down.\n moves += grow_unblocked_moves_in_dir(-1, 0) \n moves\n end", "def bewegen(key)\n \n # Bewegung nach Rechts \n if key == :right then \n\t\t\n\t\tif @feld[@position_y][@position_x +1] == 0 or \t\t\t# FALL: Gärtner fährt auf leeres Feld\n\t\t @feld[@position_y][@position_x +1] == 5 then \t\t# FALL: Gärtner fährt gegen Ecke\n\t\t\t\t@position_x = @position_x + 1\n\t\t\t\n\t\telsif @feld[@position_y][@position_x +1] == 1 then # FALL: Gartner fährt gegen Wand\n\t\t\t\t@position_x = @position_x\n\t\t\t\t\n\t\telsif @feld[@position_y][@position_x +1] == 3 then\t# FALL: Gärtner fährt gegen Gießkanne\t\t\n\t\t\n\t\t\tif\t@feld[@pos_g_y][@pos_g_x + 1] == 0 then \t# FALL: Ist Feld neben der Gießkanne frei??\n\t\t\t\t\t@position_x = @position_x + 1\t\t\t\t# Bewege den Gärtner\t\t\t\n\t\t\n\t\t\t\t\t@feld[@pos_g_y][@pos_g_x] = 0 \t\t\t\t# Alter Wert im Array wird auf 0 gesetzt -> leeres Feld \t\t \n\t\t\t\t\t@pos_g_x = @pos_g_x +1 \t\t\t\t\t\t# X-Position wird verändern -> bewegt sich ein Feld (im Array) nach rechts\n\t\t\t\t\t@giesskanne.remove\t\t\t\t\t\t\t# Gießkanne wird gelöscht\n\t\t\t\t\tgiesskanne_neu_setzen( ) \t\t\t\t\t# Gießkanne wird neu gesetzt\n\t\t\t\t\t@feld[@pos_g_y][@pos_g_x] = 3 \t\t\t\t# Neuer Wert wird im Array an neuer Position gesetzt\n\t\t\t\t\t\n\t\t\telsif @feld[@pos_g_y][@pos_g_x + 1] == 5 then\t\n\t\t\t\t\t@position_x = @position_x + 1\t\t\t\t\n\t\t\n\t\t\t\t\t@feld[@pos_g_y][@pos_g_x] = 0 \t\t\t\t \n\t\t\t\t\t@pos_g_x = @pos_g_x +1 \t\t\t\t\t\t\n\t\t\t\t\t@giesskanne.remove\t\t\t\t\t\t\t\n\t\t\t\t\tgiesskanne_neu_setzen( ) \t\t\t\t\t\n\t\t\t\t\t@feld[@pos_g_y][@pos_g_x] = 3 \n\t\t\t\t\talert \"GAME OVER!\"\n\t\t\t\t\tclear\n \t\t\t\tbutton \"Spiel neu starten\"\n \t\t\t\tbutton \"Spiel beenden\"\n\t\t\t\n\t\t\telsif @feld[@pos_g_y][@pos_g_x + 1] == 1 then\t\n\t\t\t\t\t@position_x = @position_x\n\t\t\t\t\t@pos_g_y = @pos_g_y\n\t\t\t\t\t\n\t\t\telsif @feld[@pos_g_y][@pos_g_x + 1] == 2 then\t\n\t\t\t\t\t@sonnenblume.remove\n\t\t\t\t\t@feld[@pos_s_y][@pos_s_x] = 3\n\t\t\t\t\t\n\t\t\t\t\t@position_x = @position_x + 1\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t@feld[@pos_g_y][@pos_g_x] = 0 \t\t\t\t \n\t\t\t\t\t@pos_g_x = @pos_g_x +1 \t\n\t\t\t\t\t@giesskanne.remove\t\t\t\t\t\t\t\n\t\t\t\t\tgiesskanne_neu_setzen( ) \t\t\t\t\t\n\t\t\t\t\t@feld[@pos_g_y][@pos_g_x] = 3 \n\t\t\t\t\talert \"Du hast gewonnen!\"\n\t\t\t\t\tclear\n \t\t\t\tbutton \"Spiel neu starten\"\n \t\t\t\tbutton \"Spiel beenden\"\n\t\t\tend\n\t\t\t\n\t\t\t\n\t\tend # Ende der if feld = 0 Verzweigung\n\t\t\n\t\t\n\t # Bewegung nach Links\n\t elsif key == :left then\n\t\t \n\t\tif @feld[@position_y][@position_x -1] == 0 or\n\t\t\t@feld[@position_y][@position_x -1] == 5 then\n\t\t\t\t@position_x = @position_x - 1\n\t\t\n\t\telsif @feld[@position_y][@position_x -1] == 1 then \n\t\t\t\t\t@position_x = @position_x\n\t\t\t\n\t\telsif @feld[@position_y][@position_x -1] == 3 then \n\t\t\t\t\t\n\t\t\tif\t@feld[@pos_g_y][@pos_g_x - 1] == 0 then \n\t\t\t\t\t@position_x = @position_x - 1\n\t\t\t\t\n\t\t\t\t\t@feld[@pos_g_y][@pos_g_x] = 0 \t\t\t\t \n\t\t\t\t\t@pos_g_x = @pos_g_x -1 \t\t\t\t\t\t\n\t\t\t\t\t@giesskanne.remove\t\t\t\t\t\t\t\n\t\t\t\t\tgiesskanne_neu_setzen( ) \t\t\t\t\t\n\t\t\t\t\t@feld[@pos_g_y][@pos_g_x] = 3 \t\n\t\t\t\t\n\t\t\telsif @feld[@pos_g_y][@pos_g_x - 1] == 5 then \n\t\t\t\t\t@position_x = @position_x - 1\n\t\t\t\t\t\n\t\t\t\t\t@feld[@pos_g_y][@pos_g_x] = 0 \t\t\t\t \n\t\t\t\t\t@pos_g_x = @pos_g_x -1 \t\t\t\t\t\t\n\t\t\t\t\t@giesskanne.remove\t\t\t\t\t\t\t\n\t\t\t\t\tgiesskanne_neu_setzen( ) \t\t\t\t\t\n\t\t\t\t\t@feld[@pos_g_y][@pos_g_x] = 3 \n\t\t\t\t\talert \"Game over!\"\n\t\t\t\t\tclear\n \t\t\t\tbutton \"Spiel neu starten\"\n \t\t\t\tbutton \"Spiel beenden\"\t\t\t\t\t\t\t\n\t\t\t\n\t\t\telsif @feld[@pos_g_y][@pos_g_x - 1] == 1 then\t\n\t\t\t\t\t@position_x = @position_x\n\t\t\t\t\t@pos_g_y = @pos_g_y\n\t\t\t\t\t\n\t\t\telsif @feld[@pos_g_y][@pos_g_x - 1] == 2 then\t\n\t\t\t\t\t@sonnenblume.remove\n\t\t\t\t\t@feld[@pos_s_y][@pos_s_x] = 3\n\t\t\t\t\t\n\t\t\t\t\t@position_x = @position_x - 1\t\n\t\t\t\t\t\n\t\t\t\t\t@feld[@pos_g_y][@pos_g_x] = 0 \t\t\t\t \n\t\t\t\t\t@pos_g_x = @pos_g_x - 1 \t\n\t\t\t\t\t@giesskanne.remove\t\t\t\t\t\t\t\n\t\t\t\t\tgiesskanne_neu_setzen() \t\t\t\t\t\n\t\t\t\t\t@feld[@pos_g_y][@pos_g_x] = 3 \n\t\t\t\t\talert \"Du hast gewonnen!\"\n\t\t\t\t\tclear\n \t\t\t\tbutton \"Spiel neu starten\"\n \t\t\t\tbutton \"Spiel beenden\"\n\t\t\tend\n\t\tend\n\t\t\n\t\t\n\t \n\t elsif key == :down then\n\t\t \n\t\tif @feld[@position_y+1][@position_x] == 0 or \n\t\t\t@feld[@position_y+1][@position_x] == 5 then\n\t\t\t\t@position_y = @position_y + 1\n\t\t\t\t\n\t\telsif @feld[@position_y+1][@position_x] == 1 then\n\t\t\t\t@position_y = @position_y\n\t\t\t\t\n\t\telsif @feld[@position_y+1][@position_x] == 3 then \n\t\t\t\t\n\t\t\tif\t@feld[@pos_g_y+1][@pos_g_x] == 0 then \n\t\t\t\t\t@position_y = @position_y + 1\n\t\t\t\t\t\n\t\t\t\t\t@feld[@pos_g_y][@pos_g_x] = 0 \t\t\t\t\n\t\t\t\t\t@pos_g_y = @pos_g_y + 1\t\t\t\t\t\t\n\t\t\t\t\t@giesskanne.remove\t\t\t\t\t\t\t\n\t\t\t\t\tgiesskanne_neu_setzen( ) \t\t\t\t\t\n\t\t\t\t\t@feld[@pos_g_y][@pos_g_x] = 3 \t\n\t\t\t\t\n\t\t\telsif\t@feld[@pos_g_y+1][@pos_g_x] == 5 then \n\t\t\t\t\t@position_y = @position_y + 1\n\t\t\t\t\n\t\t\t\t\t@feld[@pos_g_y][@pos_g_x] = 0 \t\t\t\t\n\t\t\t\t\t@pos_g_y = @pos_g_y + 1\t\t\t\t\t\t\n\t\t\t\t\t@giesskanne.remove\t\t\t\t\t\t\t\n\t\t\t\t\tgiesskanne_neu_setzen( ) \t\t\t\t\t\n\t\t\t\t\t@feld[@pos_g_y][@pos_g_x] = 3 \t\n\t\t\t\t\talert \"Game over!\"\t\n\t\t\t\t\tclear\n \t\t\t\tbutton \"Spiel neu starten\"\n \t\t\t\tbutton \"Spiel beenden\"\t\t\n\t\t\t\n\t\t\telsif @feld[@pos_g_y + 1][@pos_g_x] == 1 then\t\n\t\t\t\t\t@position_x = @position_x\n\t\t\t\t\t@pos_g_y = @pos_g_y\n\t\t\t\n\t\t\telsif @feld[@pos_g_y + 1][@pos_g_x] == 2 then\t\n\t\t\t\t\t@sonnenblume.remove\n\t\t\t\t\t@feld[@pos_s_y][@pos_s_x] = 3\n\t\t\t\t\t\n\t\t\t\t\t@position_y = @position_y + 1\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t@feld[@pos_g_y][@pos_g_x] = 0 \t\t\t\t \n\t\t\t\t\t@pos_g_y = @pos_g_y + 1 \t\n\t\t\t\t\t@giesskanne.remove\t\t\t\t\t\t\t\n\t\t\t\t\tgiesskanne_neu_setzen() \t\t\t\t\t\n\t\t\t\t\t@feld[@pos_g_y][@pos_g_x] = 3 \n\t\t\t\t\talert \"Du hast gewonnen!\"\n\t\t\t\t\tclear\n \t\t\t\tbutton \"Spiel neu starten\"\n \t\t\t\tbutton \"Spiel beenden\"\n\t\t\tend\n\t\t\n\t\tend\n\t\n\t \n\t elsif key == :up then\n\t\t \n\t\tif @feld[@position_y-1][@position_x] == 0 or\n\t\t\t@feld[@position_y-1][@position_x] == 5 then\n\t\t\t\t@position_y = @position_y - 1\n\t\t\n\t\telsif \t@feld[@position_y-1][@position_x] == 1 then\n\t\t\t\t\t@position_y = @position_y\n\t\t\t\t\n\t\telsif \t@feld[@position_y-1][@position_x] == 3 then \n\t\t\t\t\n\t\t\tif\t@feld[@pos_g_y-1][@pos_g_x] == 0 then \n\t\t\t\n\t\t\t\t\t@position_y = @position_y - 1\n\t\t\t\t\t\n\t\t\t\t\t@feld[@pos_g_y][@pos_g_x] = 0 \t\t\t\t\n\t\t\t\t\t@pos_g_y = @pos_g_y - 1\t\t\t\t\t\t\n\t\t\t\t\t@giesskanne.remove\t\t\t\t\t\t\t\n\t\t\t\t\tgiesskanne_neu_setzen( ) \t\t\t\t\t\n\t\t\t\t\t@feld[@pos_g_y][@pos_g_x] = 3 \t\t\n\t\t\t\t\n\t\t\telsif\t@feld[@pos_g_y-1][@pos_g_x] == 5 then \n\t\t\t\t\t@position_y = @position_y - 1\n\t\t\t\t\n\t\t\t\t\t@feld[@pos_g_y][@pos_g_x] = 0 \t\t\t\t\n\t\t\t\t\t@pos_g_y = @pos_g_y - 1\t\t\t\t\t\t\n\t\t\t\t\t@giesskanne.remove\t\t\t\t\t\t\t\n\t\t\t\t\tgiesskanne_neu_setzen( ) \t\t\t\t\t\n\t\t\t\t\t@feld[@pos_g_y][@pos_g_x] = 3 \n\t\t\t\t\talert \"Game over!\"\n\t\t\t\t\tclear\n \t\t\t\tbutton \"Spiel neu starten\"\n \t\t\t\tbutton \"Spiel beenden\"\t\t\t\t\n\t\t\t\n\t\t\telsif @feld[@pos_g_x][@pos_g_y - 1] == 1 then\t\n\t\t\t\t\t@position_x = @position_x\n\t\t\t\t\t@pos_g_y = @pos_g_y\n\t\t\t\t\t\n\t\t\telsif @feld[@pos_g_y - 1][@pos_g_x] == 2 then\t\n\t\t\t\t\t@sonnenblume.remove\n\t\t\t\t\t@feld[@pos_s_y][@pos_s_x] = 3\n\t\t\t\t\t\n\t\t\t\t\t@position_y = @position_y - 1\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t@feld[@pos_g_y][@pos_g_x] = 0 \t\t\t\t \n\t\t\t\t\t@pos_g_y = @pos_g_y - 1 \t\n\t\t\t\t\t@giesskanne.remove\t\t\t\t\t\t\t\n\t\t\t\t\tgiesskanne_neu_setzen() \t\t\t\t\t\n\t\t\t\t\t@feld[@pos_g_y][@pos_g_x] = 3 \n\t\t\t\t\talert \"Du hast gewonnen!\"\t\t\t\t\n \t\t\t\tclear\n \t\t\t\tbutton \"Spiel neu starten\"\n \t\t\t\tbutton \"Spiel beenden\"\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t\n end", "def makeArc\r\n @entities.add_arc @centre, @vector2, @normal, @toolRadius, 0, Math::PI, 6\r\n end", "def setup\n size 500, 756, OPENGL\n no_stroke\n color_mode RGB, 1\n fill 0.3\n frame_rate 24\n background 0\n \n control_panel do |c|\n c.slider :opacity, 0.01..1.0, 0.3\n c.slider :rotation_x, 0.01..1.0, 0.2\n c.slider :rotation_y, 0.01..1.0, 0.3\n c.slider :growth_factor, 0.01..2.0, 1.0\n \n c.checkbox :paused\n c.checkbox :trails\n end\n \n @boxes = [\n {:y => 4, :speed => 1, :size => 68, :opacity => 1.0},\n {:y => 1, :speed => 15, :size => 60, :opacity => 1.8},\n {:y => 3, :speed => 4, :size => 32, :opacity => 1.2},\n {:y => 41, :speed => 23, :size => 40, :opacity => 1.2}, \n {:y => 1, :speed => 6, :size => 47, :opacity => 1.5},\n {:y => 1, :speed => 2, :size => 30, :opacity => 1.5},\n {:y => 5, :speed => 16, :size => 14, :opacity => 2.0},\n {:y => 1, :speed => 17, :size => 42, :opacity => 1.0},\n {:y => 4, :speed => 25, :size => 90, :opacity => 1.2}, \n {:y => 6, :speed => 1, :size => 23, :opacity => 1.0},\n {:y => 42, :speed => 15, :size => 20, :opacity => 1.0},\n {:y => 1, :speed => 10, :size => 38, :opacity => 1.5},\n {:y => 11, :speed => 5, :size => 20, :opacity => 2.0},\n {:y => 24, :speed => 26, :size => 33, :opacity => 1.0},\n {:y => 1, :speed => 8, :size => 24, :opacity => 2.0},\n {:y => 24, :speed => 13, :size => 20, :opacity => 1.5},\n {:y => 38, :speed => 27, :size => 31, :opacity => 1.8},\n {:y => 11, :speed => 14, :size => 12, :opacity => 1.0},\n {:y => 1, :speed => 29, :size => 85, :opacity => 1.2},\n {:y => 21, :speed => 11, :size => 50, :opacity => 1.2},\n {:y => 1, :speed => 18, :size => 33, :opacity => 1.3},\n {:y => 5, :speed => 8, :size => 18, :opacity => 2.3},\n {:y => 17, :speed => 26, :size => 64, :opacity => 1.0},\n {:y => 3, :speed => 7, :size => 45, :opacity => 1.0},\n {:y => 65, :speed => 13, :size => 99, :opacity => 1.2},\n {:y => 8, :speed => 2, :size => 83, :opacity => 1.2}, \n {:y => 12, :speed => 20, :size => 47, :opacity => 1.6},\n {:y => 11, :speed => 3, :size => 32, :opacity => 1.3},\n {:y => 1, :speed => 15, :size => 47, :opacity => 0.9},\n {:y => 7, :speed => 19, :size => 60, :opacity => 1.8},\n ]\n\n @column_width = (width/@boxes.size)\nend" ]
[ "0.6622997", "0.595658", "0.583796", "0.5836687", "0.5803129", "0.58024037", "0.5646924", "0.5642245", "0.5579661", "0.55448186", "0.5510128", "0.54606414", "0.54572666", "0.5437396", "0.5376837", "0.536339", "0.53355783", "0.5248359", "0.52243024", "0.5214027", "0.5171316", "0.5135288", "0.51286423", "0.5109619", "0.5092645", "0.50650716", "0.50622743", "0.5046409", "0.50318205", "0.5022756", "0.49889636", "0.4985191", "0.49749666", "0.4969409", "0.49514297", "0.4944714", "0.49059215", "0.4903607", "0.48818344", "0.48665538", "0.48634335", "0.4862447", "0.48611227", "0.48548028", "0.48536783", "0.4852002", "0.48456064", "0.4843714", "0.483372", "0.48265022", "0.4823799", "0.4811773", "0.48077717", "0.48024437", "0.4799766", "0.47997203", "0.47958744", "0.47958744", "0.47630575", "0.47412083", "0.47357506", "0.47334197", "0.472641", "0.47248128", "0.4721002", "0.4713741", "0.46983546", "0.46963826", "0.4696091", "0.46953705", "0.46935853", "0.46886358", "0.4685467", "0.46683294", "0.46625856", "0.46618247", "0.46571988", "0.4651915", "0.46518385", "0.4651518", "0.4647483", "0.4645542", "0.4631328", "0.4621924", "0.46169192", "0.4597835", "0.4591926", "0.45884842", "0.458399", "0.457876", "0.45754546", "0.45738816", "0.45735088", "0.45709118", "0.45682988", "0.45673177", "0.45670772", "0.45647392", "0.4561148", "0.45609277" ]
0.62021774
1
Places random people in random places in the building
def populate(occupancy) puts "Placing #{occupancy} people in the building" Array.new(occupancy).map{ |person| Person.new(Faker::Name.first_name, floors.sample, floors.sample, self) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_random_world\n randomize_terrain\n randomize_entities\n end", "def test_possible_location_from_museum_if_rand_is_one\r\n\t\toakland = City::new\r\n\t\trand_val = 1\r\n\t\thillman = oakland.generate_museum_locs(oakland, rand_val)\r\n\r\n\t\tassert_equal hillman[0], \"Hillman\"\r\n\t\tassert_equal hillman[1][0], \"Fifth Ave.\"\r\n\tend", "def test_possible_location_from_cathedral_if_rand_is_one\r\n\t\toakland = City::new\r\n\t\trand_val = 1\r\n\t\tmuseum = oakland.generate_cathedral_locs(oakland, rand_val)\r\n\r\n\t\tassert_equal museum[0], \"Museum\"\r\n\t\tassert_equal museum[1][0], \"Bar St.\"\r\n\tend", "def place_oject_randomly(object)\n while is_wall?(object.location)\n object.location_x = 1 + rand(width - 1)\n\n object.location_y = 1 + rand(height - 1)\n end\n\n objects << object\n end", "def test_possible_location_from_museum_if_rand_is_zero\r\n\t\toakland = City::new\r\n\t\trand_val = 0\r\n\t\tcathedral = oakland.generate_museum_locs(oakland, rand_val)\r\n\r\n\t\tassert_equal cathedral[0], \"Cathedral\"\r\n\t\tassert_equal cathedral[1][0], \"Bar St.\"\r\n\tend", "def random\n redirect_to_random(Place)\n end", "def test_possible_location_from_hospital_if_rand_is_one\r\n\t\toakland = City::new\r\n\t\trand_val = 1\r\n\t\thillman = oakland.generate_hospital_locs(oakland, rand_val)\r\n\r\n\t\tassert_equal hillman[0], \"Hillman\"\r\n\t\tassert_equal hillman[1][0], \"Foo St.\"\r\n\tend", "def treasures_allot\r\n randomnums = Random.new\r\n for num in (1..4) do\r\n roomn = randomnums.rand(1...19)\r\n num += 1\r\n while roomn == 6 or roomn == 11 or roomn == 9 or get_some_room_stuff(roomn,6) != 0\r\n roomn = randomnums.rand(1...19)\r\n end\r\n num-=1\r\n set_at_room(roomn,6, randomnums.rand(10...109))\r\n #puts $ooms_map[roomn]\r\n #puts(\"----------------treasure\")\r\n end\r\nend", "def seed_grid\n @BOMBS.times do\n bomb_placed = false\n until bomb_placed\n pos = [rand(@Y_DIM), rand(@X_DIM)]\n unless self[pos].bomb\n self[pos].bomb = true\n bomb_placed = true\n end\n end\n end\n end", "def plant_mines\n row_count = @field.length\n cell_count = @field[0].length\n @mine_count.times do |plant|\n row_index = rand(row_count)\n cell_index = rand(cell_count)\n if @field[row_index][cell_index].mine = false\n @field[row_index][cell_index].place_mines\n else\n @field[rand(row_count)][rand(cell_count)].place_mines\n end\n end\n @field\n end", "def rand_location\n {lat: rand_in(40, 50), lon: rand_in(40, 80) * -1, ele: rand_in(200, 400)}\nend", "def choose_place(places)\n userPlaceIds=@user.histories.pluck(:place_id)\n selectPlace=places.select do |place|\n !userPlaceIds.include?(place[\"place_id\"])\n end\n randomPlace = rand(0..selectPlace.count-1)\n selectPlace.present? ? selectPlace[randomPlace] : nil\n end", "def get_people(floor_num)\n number_of_people = rand(0..MAX_PEOPLE_PER_FLOOR)\n people_arr = []\n number_of_people.times do\n destination_floor = rand(0...NUM_OF_FLOORS)\n # makes sure that no one wants to go to the floor they start on\n people_arr << Person.new(destination_floor) if destination_floor != floor_num\n end\n people_arr\nend", "def insert_mines\n @random_spots = []\n @num_of_mine.times do\n\n while @random_spots.length < @num_of_mine\n rand_num = Random.rand(@num_of_tiles**2)\n\n if !@random_spots.include?(rand_num)\n @random_spots << rand_num\n end\n\n end\n end\nend", "def randomize_entities\n valid_entities = @@data[:entities][:types].select { |e| e.random_spawn_chance > 0 }\n (0...@width).each do |x|\n (0...@height).each do |y|\n \n # Roll to see if any entities are created here\n chosen_entity = nil\n valid_entities.each do |e|\n roll = rand(100) / 100.0\n if roll < e.random_spawn_chance\n chosen_entity = e\n break\n end\n end\n\n # If an entity would be created here, add it to the world\n if chosen_entity\n @living_entities << chosen_entity.new(x, y)\n end\n\n end\n end\n end", "def populate_random(n)\n n.times do\n set(rand(0...@x_size), rand(0...@y_size), :alive)\n end\n end", "def test_possible_location_from_hospital_if_rand_is_zero\r\n\t\toakland = City::new\r\n\t\trand_val = 0\r\n\t\tcathedral = oakland.generate_hospital_locs(oakland, rand_val)\r\n\r\n\t\tassert_equal cathedral[0], \"Cathedral\"\r\n\t\tassert_equal cathedral[1][0], \"Fourth Ave.\"\r\n\tend", "def addrandomcars(lat0,lon0,lat1,lon1, count )\n Fiber.new do\n count.times do\n lat = (lat1-lat0) * rand() + lat0\n lon = (lon1-lon0) * rand() + lon0\n @pgconn.query(\"insert into cars(lat,lon,avail) values(#{lat},#{lon}, true)\")\n end\n end.resume\n end", "def setup_castle\r\n randomnums = Random.new\r\n zero_out\r\n treasures_allot\r\n terrors_allot\r\n set_at_room(4,6, 100 + randomnums.rand(1...100))\r\n set_at_room(16,6, 100 + randomnums.rand(1...100))\r\nend", "def load_people_to_building(building)\n\t\tbuilding.add_people(self.generate_people(11,Person.new(2,0)))\n\t\tbuilding.add_people(self.generate_people(3,Person.new(0,2)))\n\t\tbuilding.add_people(self.generate_people(2,Person.new(0,1)))\n\tend", "def generate_lands!\n\n resources = %w(wood brick metal stone)\n random_resource = resources.concat(resources.sample(2)).shuffle\n random_dice_points = %w(1 2 3 4 5 6).shuffle\n\n %w(0 1 2 3 4 5).shuffle.each.with_index do |position, index|\n game.lands.create(\n resource_type: random_resource[index],\n position: position,\n dice_point: random_dice_points[index]\n )\n end\n end", "def place_random_ship\n unless full?\n placement = []\n placement << (0...@grid.length).to_a.shuffle.first\n placement << (0...@grid[0].length).to_a.shuffle.first\n @grid[placement[0]][placement[1]] = :s\n else\n raise 'Board is full'\n end\n\n end", "def position_generator(pos1, pos2, length)\n # generate a position away from earth and moon\n position = rand(1..length - 1)\n if pos1.include? position or pos2.include? position\n position = position_generator(pos1, pos2, length)\n end\n return position\nend", "def fortress_random_point\n FortressCell.where(\"mini_map_id=? and symbol=?\", mini_map.id, :concrete.to_s).sample\n end", "def random_move probability = 1\n return if rand > probability\n\n room = get_object self.container\n area = room.area\n unless room.nil?\n exits = room.exits.select do |e|\n other_side = get_object e.exit_room\n not other_side.nil? and other_side.area == area\n end.map {|e| e.alt_names[0] }\n\n if exits.respond_to? :shuffle\n exits = exits.shuffle\n else\n exits = exits.sort_by { rand }\n end\n\n go exits[rand(exits.length)]\n end\n end", "def seedTeams\n addresses = Address.all\n 5.times do\n\n SportsTeam.create(name: Faker::Team.name,\n address_id: addresses.sample.id,\n sport: Faker::Team.sport,\n stadium_size: Faker::Number.between(3000, 75000),\n trophies: Faker::Number.between(1, 10))\n end\nend", "def make_random_map\n entire_map = []\n 20.times do\n single_row = []\n 20.times do \n if rand(2) == 1\n single_row << :room\n else\n single_row << :wall \n end \n end \n entire_map << single_row\n end\n entire_map\nend", "def place_randomly(width=@width, height=@height, nodeset=@nodes)\n nodeset.each_value do |node|\n node.location = Vector[rand(width), rand(height)] if !node.static\n end\n end", "def computer_place\n # Place each ship using random coordinates.\n count = 1\n ships.each do |ship|\n # Set the initial random coordinate into the ship_array.\n ship_array = [random_cell(empty_board_cells)]\n \n # Until the coordinates are valid, keep finding new coordinates.\n until board.valid_placement?(ship, ship_array) do\n # Find the adjecent cells, then select one to add to ship array.\n ship_array = adj_cell(ship_array)\n\n # Check if the array has valid coordinates.\n ship_array = valid_cells(ship_array)\n\n # If the array has no valid coordinates after culling re-choose intial coordinate. If the initial selection is bad, after four iterations reselect seed.\n if ship_array.length == 1 || count == 4\n ship_array = [random_cell(empty_board_cells)]\n count = 0\n end\n count += 1\n end\n board.place(ship, ship_array)\n end\n end", "def populate_map(map, n)\n ret = Array.new\n\n n.times do\n begin\n x, y = [rand(map.width), rand(map.height)]\n end while(not empty?(x,y,map)) \n \n creat = CreatureGenerator.create_random(self, x, y)\n ret << creat\n end\n \n return ret\n end", "def place_random_ships\n ship_count = size / 4\n while ship_count.positive?\n row = rand(@grid.size)\n col = rand(@grid.size)\n if self[[row, col]] == :N\n self[[row, col]] = :S\n ship_count -= 1\n end\n end\n end", "def plant_bombs\n while num_bombs < 15\n rand_col = rand(@grid.length)\n rand_row = rand(@grid.length)\n @grid[rand_col][rand_row] = :B\n end\n end", "def town_names amt=5, near_water=false\n starts = ['Bed', 'Brunn', 'Dun', 'Far', 'Glen', 'Tarn']\n middles = ['ding', 'fing', 'ly', 'ston']\n ends = ['borough', 'burg', 'ditch', 'hall', 'pool', 'ville', 'way', 'worth']\n waters = ['-on-sea', ' Falls']\n random_names = []\n i = 0\n while i < amt\n name = \"#{starts.sample}#{middles.sample}#{ends.sample}\"\n if near_water == 'near_water'\n name += waters.sample\n end\n random_names.push(name)\n i += 1\n end\n return random_names\nend", "def generate_bombs\n until @bomb_locations.length == 10\n coords = [rand(0..@NUM_OF_ROWS-1), rand(0..@NUM_OF_COLUMNS-1)]\n if !@bomb_locations.include?(coords) && (!self[coords] || self[coords].value != \"O\")\n @bomb_locations.add(coords)\n self[coords] = Square.new(\"O\")\n end\n end\n end", "def fill_randomly\n #find which positions to fill\n self.players.each{|p| self.remove_player(p) }\n positions = self.position_array\n pos_taken = self.rosters_players.collect(&:position)\n pos_taken.each do |pos|\n i = positions.index(pos)\n positions.delete_at(i) if not i.nil?\n end\n return if positions.length == 0\n #pick players that fill those positions\n for_sale = self.purchasable_players\n #organize players by position\n for_sale_by_pos = {}\n positions.each { |pos| for_sale_by_pos[pos] = []}\n for_sale.each do |player|\n for_sale_by_pos[player.position] << player if for_sale_by_pos.include?(player.position)\n end\n #sample players from each position and add to roster\n positions.each do |pos|\n players = for_sale_by_pos[pos]\n player = players.sample\n next if player.nil?\n players.delete(player)\n add_player(player, pos, false)\n end\n self.reload\n end", "def place_mines\n\t\t(0...@size).to_a.shuffle.slice(0,@total_mines).each do |rand|\n\t\t\tmine_row = rand / @width\n\t\t\tmine_col = rand % @width\n\t\t\t@cell_at[mine_row][mine_col].risk = :mine\n\t\t\t@cells_with_mines << [mine_row, mine_col]\n\t\tend\n\tend", "def next_location(rando)\n random = Random.new(rando.seed)\n @neighbors[random.rand(0...@neighbors.count)]\n end", "def test_possible_location_from_hillman_if_rand_is_zero\r\n\t\toakland = City::new\r\n\t\trand_val = 0\r\n\t\tdowntown = oakland.generate_hillman_locs(oakland, rand_val)\r\n\r\n\t\tassert_equal downtown[0], \"Downtown\"\r\n\t\tassert_equal downtown[1][0], \"Fifth Ave.\"\r\n\tend", "def generate_rooms\n\n allocated_cells = get_allocated_cells\n taken_cells = 0\n room_id = 1\n\n max_room_w = @width * Dungeon::ROOM_SIZE_WEIGHT - 1\n max_room_h = @height * Dungeon::ROOM_SIZE_WEIGHT - 1\n\n # Make rooms until all the allocation has dried out\n while taken_cells < allocated_cells\n \n r_w = (rand*max_room_w).ceil + 1\n r_h = (rand*max_room_h).ceil + 1\n if r_w.odd? && r_h.odd? \n place_room(r_w, r_h, room_id) \n taken_cells += r_w*r_h\n room_id += 1\n end\n end\n \n puts \"Alloc: #{allocated_cells} Placed:#{taken_cells}\"\n\n end", "def create_random_Ant\n\n myAnt = Ant.new\n\n myAnt.x = @x\n myAnt.y = @y\n myAnt.anthill = self\n rand_number = rand(3)\n if rand_number == 0\n myAnt = create_Forager(myAnt)\n elsif rand_number == 1\n myAnt = create_Builder(myAnt)\n else\n myAnt = create_Warrior(myAnt)\n \n end\n\n Meadow.instance.add_AntToCell(myAnt, @x, @y)\n @food -= 1 \n end", "def execute\n if Settings['zombie']['spawn']['chance'] > rand() * 100\n number_of_zombies = rand(1..5)\n puts \"spawning #{number_of_zombies} zombies\" unless Rails.env.test?\n number_of_zombies.times do\n spawn_point = random_spawn_coords(lat: character.lat, lon: character.lon)\n Zombie.create(lat: spawn_point[0], lon: spawn_point[1])\n end\n end\n end", "def pbRandomRoam(index)\n if $PokemonGlobal.roamPosition\n keys=pbRoamingAreas(index).keys\n $PokemonGlobal.roamPosition[index]=keys[rand(keys.length)]\n end\nend", "def random_neighbor\n if roomAdj\n # Choose neighboring adjacent room\n return roomAdj.to_a.sample \n end \n end", "def mutate\n i, j = rand(City.cities.size), rand(City.cities.size)\n if i > j\n @offspring_a.cities[i], @offspring_a.cities[j] = @offspring_a.cities[j], @offspring_a.cities[i]\n end\n\n i, j = rand(City.cities.size), rand(City.cities.size)\n if i > j\n @offspring_b.cities[i], @offspring_b.cities[j] = @offspring_b.cities[j], @offspring_b.cities[i]\n end\n end", "def city\n @@cities.rand\n end", "def first\n\t\trandom = get_rand(4)\n\t\tif random == 0\n\t\t\t@location = \"Museum\"\n\t\telsif random == 1\n\t\t\t@location = \"Cathedral\"\n\t\telsif random == 2\n\t\t\t@location = \"Hospital\"\n\t\telsif random == 3\n\t\t\t@location = \"Hillman\"\n\t\telse\n\t\t\traise \"Something bad has happened\"\n\t\tend\n\tend", "def generate_random_location\n location = Geocoder.search('-8.783195, -124.50852299999997').sample\n return nil unless location && location.address.present?\n create(address: location.address, latitude: location.latitude, longitude: location.longitude)\n end", "def hometown_generator\n city = @hometown_options.sample\n end", "def place_room(w,h,room_id)\n \n max_tries = Dungeon::MAX_PLACEMENT_ITERATION\n c_try = 0\n while c_try < max_tries\n\n # Get the top left corner, must be even \n tli = (rand*@width).floor\n tli += 1 if tli.odd?\n tlj = (rand*@height).floor\n tlj += 1 if tlj.odd?\n\n # Check all the cells from this point are unallocated, \n # and an extra 1 width around for perimeter\n failed = false\n (tli..tli+w+1).each do |i|\n (tlj..tlj+h+1).each do |j|\n if !failed\n failed = true if @cells[i][j].type != Cell::UNALLOCATED\n end\n end\n end\n\n \n # if checks ok, build the room and the perimeter\n if !failed\n\t\t\t\t# Probability falls so there are an average of 2 doors per room\n\t\t\t\tper = 2*(w+h)\n\t\t\t\tdoor_chance = Dungeon::ROOM_DOORS/per\n\n\t\t\t\t# Prep for building a logical object ready for dead end removal\n\t\t\t\troom_cells = []\n\n (tli..tli+w+1).each do |i|\n (tlj..tlj+h+1).each do |j|\n @cells[i][j].type = Cell::ROOM\n @cells[i][j].room_id = room_id\n\t\t\t\t\t\t\t# If perimeter wall, assign door if random number is under the threshold\n \t\t\t\t\t\tif i == tli || i == tli+w+1 || j == tlj || j == tlj+h+1 \n @cells[i][j].type = Cell::PERIMETER \n\t\t\t\t\t\t\t\tif i.odd? || j.odd?\n\t\t @cells[i][j].type = Cell::ENTRANCE if rand < door_chance\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\t\t# Store the room cells read for assignment to logical structure\n\t\t\t\t\t\t\troom_cells << @cells[i][j];\n end\n end\n # Meet loop criterea\n c_try = Dungeon::MAX_PLACEMENT_ITERATION\n\n\t\t\t\t# Build logical object and map entrance cells to the room\n\t\t\t\troom_obj = RoomBranch.new(room_cells)\n\t\t\t\troom_cells.each { |c| room_map[c] = room_obj if c.type == Cell::ENTRANCE }\n\n end\n \n c_try += 1\n end\n \n end", "def pick\n @gommis_count = Gommi.count\n @gommis = Gommi.offset(rand(Gommi.count)).first\nend", "def generateManySpheres numSpheres\n rnd = java.util.Random.new\n gameSurface = getGameSurface\n\n bubbles = []\n numSpheres.times do\n c = Color.rgb rnd.nextInt(255), rnd.nextInt(255), rnd.nextInt(255)\n b = Atom.new rnd.nextInt(15) + 5, c\n circle = b.getAsCircle\n # random 0 to 2 + (.0 to 1) * random (1 or -1)\n b.vX = (rnd.nextInt(2) + rnd.nextDouble) * (rnd.nextBoolean ? 1 : -1)\n b.vY = (rnd.nextInt(2) + rnd.nextDouble) * (rnd.nextBoolean ? 1 : -1)\n\n # random x between 0 to width of scene\n newX = rnd.nextInt gameSurface.getWidth\n\n # check for the right of the width newX is greater than width\n # minus radius times 2(width of sprite)\n if newX > gameSurface.get_width - (circle.getRadius * 2)\n newX = gameSurface.get_width - (circle.getRadius * 2)\n end\n\n # check for the bottom of screen the height newY is greater than height\n # minus radius times 2(height of sprite)\n newY = rnd.nextInt gameSurface.get_height\n if newY > gameSurface.get_height - (circle.getRadius * 2)\n newY = gameSurface.get_height - (circle.getRadius * 2)\n end\n\n circle.setTranslateX newX\n circle.setTranslateY newY\n circle.setVisible true\n circle.set_id \"atom-#{b.object_id}\"\n\n # add to actors in play (sprite objects)\n getSpriteManager.addSprites b\n\n # add sprites\n getSceneNodes.getChildren.add 0, b.node\n end\n end", "def next_location(random)\n raise 'Error: No location connections to current location' unless @neighbors.count != 0\n rand_position = random.rand(@neighbors.count)\n move_location = @neighbors[rand_position]\n move_location\n end", "def gen_location\n while true do\n position = rand(Avoid::SCREEN_W - height)\n return position if can_place(position)\n end\n end", "def test_monroeville_from_cathedral_if_rand_is_zero\r\n\t\toakland = City::new\r\n\t\trand_val = 0\r\n\t\tmonro = oakland.generate_cathedral_locs(oakland, rand_val)\r\n\r\n\t\tassert_equal monro[0], \"Monroeville\"\r\n\t\tassert_equal monro[1][0], \"Fourth Ave.\"\r\n\tend", "def add_hazard(hazard, numOfRooms)\n for roomToAdd in 0...numOfRooms\n generatedRandom =random_room\n #Check that the generated room has hazard or not \n while generatedRandom.has?(hazard)\n generatedRandom =random_room\n end\n #Call Room.add(haze)\n generatedRandom.add(hazard) \n end\n \n end", "def assign_mines\n randomizer.each do |num|\n crd = coordinator(num)\n cell = @board_a[crd[0]][crd[1]]\n cell.plant_mine\n end\n end", "def randomLatLng()\n max_north=18.8\n min_north=14\n max_east=122\n min_east=121.5\n puts \"#{rand(min_north..max_north)},#{rand(min_east..max_east)}\"\nend", "def random_coord(min, max)\n rand * (max-min) + min\nend", "def add_random_players\n\tplayer_number_array = [1,2,3,4,5,6,7,8,9,10,11].shuffle\n\tp player_number_array\n\tplayer_number_array.each do |each_number|\n\t\t\tfill_team_with_players(@team_name, Faker::Name.name, each_number)\n\t\tend\nend", "def random(tg,faulty,replacements,n)\n get_mappings(faulty,replacements).sample\nend", "def place_room(w, h, room_id)\n\n max_tries = Dungeon::MAX_PLACEMENT_ITERATION\n c_try = 0\n while c_try < max_tries\n\n # Get the top left corner, must be even \n tli = (rand*@width).floor\n tli += 1 if tli.odd?\n tlj = (rand*@height).floor\n tlj += 1 if tlj.odd?\n\n # Check all the cells from this point are unallocated, \n # and an extra 1 width around for perimeter\n failed = false\n (tli..tli+w+1).each do |i|\n (tlj..tlj+h+1).each do |j|\n if !failed\n failed = true if @cells[i][j].type != Cell::UNALLOCATED\n end\n end\n end\n\n\n # if checks ok, build the room and the perimeter\n if !failed\n # Probability falls so there are an average of 2 doors per room\n per = 2*(w+h)\n door_chance = Dungeon::ROOM_DOORS/per\n\n # Prep for building a logical object ready for dead end removal\n room_cells = []\n\n (tli..tli+w+1).each do |i|\n (tlj..tlj+h+1).each do |j|\n @cells[i][j].type = Cell::ROOM\n @cells[i][j].room_id = room_id\n # If perimeter wall, assign door if random number is under the threshold\n if i == tli || i == tli+w+1 || j == tlj || j == tlj+h+1\n @cells[i][j].type = Cell::PERIMETER\n if i.odd? || j.odd?\n @cells[i][j].type = Cell::ENTRANCE if rand < door_chance\n end\n end\n\n # Store the room cells read for assignment to logical structure\n room_cells << @cells[i][j];\n end\n end\n # Meet loop criterea\n c_try = Dungeon::MAX_PLACEMENT_ITERATION\n\n # Build logical object and map entrance cells to the room\n room_obj = RoomBranch.new(room_cells)\n room_cells.each { |c| room_map[c] = room_obj if c.type == Cell::ENTRANCE }\n\n end\n\n c_try += 1\n end\n\n end", "def set_place\n places_size = Place.count - 1\n place_index = Random.new.rand(0..places_size)\n current_place = Place.find(place_index)\n session[:current_place] = current_place.id\n return current_place\n end", "def randomize_cells!\n @life.height.times do |y|\n @life.width.times do |x|\n @life.set_cell_alive! x, y if rand > 0.5\n end\n end\n end", "def nearby(lat=37.332, lng=-122.031)\n [lat+rand(40)/1000.0-0.02, lng+rand(40)/1000.0-0.02]\n end", "def create_joiners(person)\n plants_number = rand(1..4)\n plants_number.times do \n PlantParenthood.create(\n plant_id: Plant.all.sample.id, \n person_id: person.id, \n affection: rand(101), \n favorite?: [true, false].sample\n )\n end\nend", "def next_location\r\n seed = Random.new @rng.rand\r\n loc = { 'Hospital' => %w[Cathedral Hillman].sample(random: seed),\\\r\n 'Cathedral' => %w[Monroeville Museum].sample(random: seed),\\\r\n 'Hillman' => %w[Downtown Hospital].sample(random: seed),\\\r\n 'Museum' => %w[Cathedral Hillman].sample }\r\n # get the next location\r\n next_loc = loc[@current_place]\r\n # print the direction message\r\n puts \"Driver #{@id} heading from #{@current_place} to #{next_loc}\"\\\r\n + \"via #{via(@current_place, next_loc)}.\"\r\n\r\n next_loc\r\n end", "def location_params(location)\n return rand(-location..location)\nend", "def put_random(object)\n while true\n random_row = rand(1...@height - 1)\n random_column = rand(1...@width - 1)\n\n if @map[random_row][random_column] == @FLOOR\n @map[random_row][random_column] = object\n return [random_column, random_row]\n end\n end\n end", "def randomly( word )\n send( [ :point, :delete, :insert ].random, word )\n end", "def random_coord\n letter = [\"A\", \"B\", \"C\", \"D\", \"E\", \"F\", \"G\", \"H\", \"I\", \"J\"].sample\n number = rand(1..10).to_s\n letter + number\n end", "def get_random_mines(num_mines)\n mine_list = []\n coord_list = get_coord_list.shuffle\n until num_mines == 0\n mine_list << coord_list.pop\n num_mines -= 1\n end\n mine_list\n end", "def rand_food\n rf = [rand(HEIGHT), rand(WIDTH)]\n while @snake.indices.include?(rf) && playing?\n rf = [rand(HEIGHT), rand(WIDTH)]\n end\n rf\n end", "def generate_rooms\n\n allocated_cells = get_allocated_cells\n taken_cells = 0\n room_id = 1\n\n max_room_w = @width * Dungeon::ROOM_SIZE_WEIGHT - 1\n max_room_h = @height * Dungeon::ROOM_SIZE_WEIGHT - 1\n\n # Make rooms until all the allocation has dried out\n while taken_cells < allocated_cells\n\n r_w = (rand*max_room_w).ceil + 1\n r_h = (rand*max_room_h).ceil + 1\n if r_w.odd? && r_h.odd?\n place_room(r_w, r_h, room_id)\n taken_cells += r_w*r_h\n room_id += 1\n end\n end\n end", "def populate!()\n\n tile_factory = TileFactory.new()\n livingbeing_factory = LivingBeingFactory.new()\n\n @m.times do |y|\n @n.times do |x|\n\n # Water vs Ground\n location = Location.new(@n, @m, x, y)\n wg = tile_factory.create(Utils.generate_random_percentage(), location)\n\n if wg\n\n @tiles[x][y] = wg\n else\n\n raise StandardError.new(\"Incorrect Percentages less than 100\")\n end\n\n # If tile is Ground type...\n if @tiles[x][y].is_a?(Ground)\n \n lb = livingbeing_factory.create(Utils.generate_random_percentage())\n\n @tiles[x][y].livingbeing = lb if lb\n end\n end\n end\n\n self\n end", "def santa_generator(num)\n\t@santas = []\n\texample_names = [\"Sarah\", \"Sting\", \"Sigmond\", \"Stella\", \"Stephen\", \"Sidney\", \"Singin\"]\n\texample_genders = [\"agender\", \"female\", \"bigender\", \"male\", \"female\", \"gender fluid\", \"N/A\"]\n\texample_ethnicities = [\"black\", \"Latino\", \"white\", \"Japanese-African\", \"prefer not to say\", \"Mystical Creature (unicorn)\", \"N/A\"]\n\t\n\tnum.times do |num|\n\n\tnew_santa = Santa.new(example_names.sample(example_names.length), example_genders.sample(example_genders.length), example_ethnicities.sample(example_ethnicities.length)) \n\t\t\t\t# name = example_names.rand(example_name.length)\n\t\t\t\t# gender = example_genders.rand(example_genders.length)\n\t\t\t\t# ethnicity = example_ethnicities.rand(example_ethnicities.length)\n\t\t\t\t\n\t\t\t\t\t new_santa.age = (1..140).to_a.sample\n\n\n# Emmanual said these sage words otherwise there is no variable to accept the random number\n\n# [11:21] \n# if you had another method that created age and called it before this that would work too\n\n# [11:21] \n# basically, initialize sets all of the basic information for the class. What needs to exist for this class to exist\n\t@santas << new_santa\n\t\t# index = 0 do |num|\n\t\t# \tuntil num == index \n\t\t# \t\tname = example_names.rand(example_name.length)\n\t\t# \t\tgender = example_genders.rand(example_genders.length)\n\t\t# \t\tethnicity = example_ethnicities.rand(example_ethnicities.length)\n\t\t# \t\tage = Random.rand(141)\n\t\t# \tsantas << Santa.new (name, gender,ethnicity)\n\t\t# \t# name = example_names(rand(example_name.length)\n\t\t# \t# gender = example_genders(rand(example_genders.length)\n\t\t# \t# ethnicity = example_ethnicities(rand(example_ethnicities.length)\n\t\t# \t# age = Random.rand(141)\n\n\t\t# index += 1\n\t\n\tend\nend", "def terrors_allot\r\n randomnums = Random.new\r\n for num in (1..6) do\r\n roomn = randomnums.rand(1...19)\r\n num += 1\r\n while roomn == 6 or roomn == 11 or roomn == 9 or get_some_room_stuff(roomn,6) != 0\r\n roomn = randomnums.rand(1...19)\r\n end\r\n num-=1\r\n set_at_room(roomn,6,num)\r\n #puts $ooms_map[roomn]\r\n #puts(\"----------------terror\")\r\n end\r\nend", "def robot_details_generator\n @robot.robot_name = Faker::Name.first_name\n quote = HTTParty.get('http://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=10')\n @quote = quote[0]['content']\n offset = rand(Suburb.count)\n Suburb.all.where(:id => offset).each do |suburb|\n @robot.suburb = suburb.suburb_name\n @robot.postcode = suburb.postcode\n @robot.state = suburb.state\n @robot.latitude = suburb.latitude\n @robot.longitude = suburb.longitude\n @robot.quote = @quote\n end\n end", "def seed_locations\n\t\t\tOrganization.find_each do |organization|\n\t\t\t\tadd_two_locations(organization)\n\t\t\tend\n\t\tend", "def set_coordinates\n [rand(-100..100), rand(-100..100)]\n end", "def createRoom()\n\t\twidth = rand(@areaWidth * 0.5 .. @areaWidth * 0.7).floor\n\t\theight = rand(@areaHeight * 0.5 .. @areaHeight * 0.7).floor\n\t\t@room = [\n\t\t\trand(@areaX + @areaWidth * 0.15 .. @areaX + @areaWidth - width * 1.15).ceil,\n\t\t\trand(@areaY + @areaHeight * 0.15 .. @areaY + @areaHeight - height * 1.15).ceil,\n\t\t\twidth,\n\t\t\theight,\n\t\t]\n\tend", "def board_setup\n create_boats.each do |boat|\n board.place_boat(boat, board.random_boat_location(boat.size))\n end\n end", "def rand_point()\n \n end", "def create_rand_spot\n spot_list = []\n 100.times {\n spot_list << @spot = Spot.new\n }\n spot_list\nend", "def santa_machine(number)\r\n\t\r\n\texample_genders = [\"male\", \"female\", \"agender\", \"bigender\", \"gender fluid\", \"other\" ]\r\n\texample_ethnicities = [\"black\", \"white\", \"Japanese\", \"lizzard\", \"merpeople\" , \"plant\"]\r\n\tnumber.times do\r\n \t\tsanta = Santa.new(example_genders.sample, example_ethnicities.sample, rand(0..140))\r\n \t\tsanta.reindeer_shuffle\r\n \t\tsanta.about\r\n \t\tend\r\n\r\nend", "def spawn_smulg\r\n smulg = spawn_monster(\"Smulg\", 30, 15, 65, 50, rand(3..5), (3..10))\r\nend", "def address_line_1\n \"#{rand(150)} #{@@streetnames.rand} #{@@street_types.rand}\"\n end", "def create_generation\n old_persons = Array.new(@all_persons)\n clear_world\n unless old_persons.empty?\n best_person = highest_fitness(old_persons)\n best_person.reset_energy_level\n @all_persons.push(best_person) unless best_person.nil?\n while @all_persons.size < @total_people and !old_persons.empty?\n if old_persons.size >= 10\n sample_size = 10\n elsif old_persons.size >= 5\n sample_size = 5\n else\n sample_size = 3\n end\n sample_one = old_persons.sample(sample_size)\n sample_two = old_persons.sample(sample_size)\n\n parent_one = highest_fitness(sample_one)\n parent_two = highest_fitness(sample_two)\n\n old_persons.delete_if { |x| x == parent_one or x == parent_two }\n (0..1).each do\n coords = get_empty_coords\n new_person = Person.new(coords[0], coords[1], @x_size, @y_size, parent_one.get_chromosome, parent_two.get_chromosome)\n @all_persons.push(new_person)\n end\n end\n end\n @generation += 1\n end", "def placing_mines\n @count = 0\n @board.each.with_index do |ele,idx1|\n ele.each.with_index do |postion,idx2|\n @count+= 1\n if @random_spots.include?(@count)\n @board[idx1][idx2] = 1\n end\n end\n\n end\n print_board\n end", "def random_plate\n [*('a'..'z'), *('A'..'Z')].sample(5).join\n end", "def initialize(position_variation = 1..100)\n @position = rand(position_variation)\n end", "def generate\n # Refill the population with children from the mating pool\n @population.each_index do |i|\n partner_a = @mating_pool[rand(0...@mating_pool.size)]\n partner_b = @mating_pool[rand(0...@mating_pool.size)]\n child = partner_a.crossover(partner_b)\n child.mutate(@mutation_rate)\n @population[i] = child\n end\n @generations += 1\n end", "def generate\n # Refill the population with children from the mating pool\n @population.each_index do |i|\n partner_a = @mating_pool[rand(0...@mating_pool.size)]\n partner_b = @mating_pool[rand(0...@mating_pool.size)]\n child = partner_a.crossover(partner_b)\n child.mutate(@mutation_rate)\n @population[i] = child\n end\n @generations += 1\n end", "def populate_items\n return if @items.size >= 15\n\n type = rand\n if type < 0.010\n @items.push(Goody.new(:apple))\n elsif type < 0.040\n @items.push(Goody.new(:merde))\n end\n end", "def random(teams)\n adjacent(teams.shuffle)\n end", "def get_place\n @spot = ((GooglePlaces::Client.new(ENV['GOOGLE_CLIENT_ID'])).spots_by_query(\"Food near #{@user.location}\"))\n @place = @spot[rand(20)]\n @url = @place.photos[0].fetch_url(800)\n end", "def create_person\n free = [\"mornings\", \"evenings\", \"always\", \"afternoons\", \"weekends\", \"none\"].sample\n\n person = Person.create(\n name: Faker::Movies::HitchhikersGuideToTheGalaxy.character,\n free_time: free,\n age: rand(11...70)\n )\nend", "def reproduction\n # Refill the population with children from the mating pool\n @population.each_index do |i|\n # Sping the wheel of fortune to pick two parents\n m = rand(@mating_pool.size).to_i\n d = rand(@mating_pool.size).to_i\n # Pick two parents\n mom = @mating_pool[m]\n dad = @mating_pool[d]\n # Get their genes\n momgenes = mom.dna\n dadgenes = dad.dna\n # Mate their genes\n child = momgenes.crossover(dadgenes)\n # Mutate their genes\n child.mutate(@mutation_rate)\n # Fill the new population with the new child\n location = Vec2D.new(width / 2, height + 20)\n @population[i] = Rocket.new(location, child)\n end\n @generations += 1\n end", "def test_random_neighbor_many_connections\n neighbor_list = [@loc2, @loc3, @loc4]\n\n @loc1.add_neighbor @loc2\n @loc1.add_neighbor @loc3\n @loc1.add_neighbor @loc4\n\n assert_includes neighbor_list, @loc1.random_neighbor\n end", "def random_megazord\n megazords_arr = [\"Ninja Falcon Megazord\", \"Galaxy Megazord\", \"Thundersaurus Megazord\", \"Lightspeed Megazord\",\"DriveMax Megazord\", \"Wild Force Megazord\"]\n megazord = megazords_arr[rand(megazords_arr.length)]\nend", "def random_animal\n\t animals.sample\n end" ]
[ "0.6863699", "0.68073535", "0.66112936", "0.6592516", "0.65543646", "0.6524836", "0.64940745", "0.6488234", "0.64735174", "0.64650893", "0.6452944", "0.6435995", "0.64334637", "0.6382596", "0.63572705", "0.6333637", "0.6314966", "0.6302931", "0.62892234", "0.62769496", "0.6264723", "0.6262301", "0.6255811", "0.625546", "0.62399155", "0.623975", "0.6237578", "0.6211099", "0.61931103", "0.6153698", "0.6114941", "0.6112746", "0.6108414", "0.6101726", "0.6073167", "0.60585886", "0.60493726", "0.6049185", "0.60454714", "0.60329163", "0.60309905", "0.60291994", "0.6026953", "0.60262215", "0.6013954", "0.6009489", "0.6008323", "0.6004726", "0.5996354", "0.59695256", "0.596359", "0.59624434", "0.59463215", "0.5937396", "0.5936346", "0.59357226", "0.59347636", "0.5922026", "0.5913235", "0.5913152", "0.59074247", "0.5899124", "0.5885731", "0.58833706", "0.5882835", "0.5881489", "0.5858224", "0.5827109", "0.5810379", "0.58091664", "0.58033764", "0.57936335", "0.5793437", "0.5792168", "0.579104", "0.5790554", "0.5790356", "0.5789703", "0.57771754", "0.5751831", "0.5751445", "0.5745096", "0.5739904", "0.57313997", "0.57281774", "0.5728033", "0.571804", "0.5713771", "0.570608", "0.57032484", "0.5677678", "0.5677678", "0.5673635", "0.5668903", "0.5668738", "0.5667377", "0.5665512", "0.5655353", "0.5655", "0.56500196" ]
0.6536267
5
Progresses the clock one tick froward
def tick @elevators.each{|elevator| elevator.tick} @floors.each{|floor| floor.tick} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tick_tock\n @hour += 1\n @minute = 0\n @second = 0\n end", "def tick\n @time = next_time(true)\n end", "def tick\n @second += 1\n need_tock?\n end", "def untick; end", "def tick; end", "def tick; end", "def tick; end", "def tick\n end", "def tick\n\t\tif @sec > 0\n\t\t\t@sec -= 1\n\t\telse\n\t\t\t@sec = 59\n\t\t\tif min > 0\n\t\t\t\t@min -= 1\n\t\t\telse\n\t\t\t\t@min = 59\n\t\t\t\tif @hr > 0\n\t\t\t\t\t@hr -= 1\n\t\t\t\telse\n\t\t\t\t\t@hr = 23\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def tick(seconds)\n\t\t@time += seconds\n\tend", "def update\n n = $seconds_per_tick\n @time += n\n\n @ticks_to_update_clock -= 1\n\n if @ticks_to_update_clock == 0\n @ticks_to_update_clock = (60 / $seconds_per_tick).to_i\n @text.text = to_s\n end\n\n if !@time.day? and @old_hour != @time.hour\n @sun_shining_mask.color.opacity = sun_mask_opacity\n @old_hour = @time.hour\n end\n end", "def advance_one_tick()\n queue_item_intentions\n flush_intentions\n send_notification({}, type: Demiurge::Notifications::TickFinished, location: \"\", zone: \"\", actor: nil)\n flush_notifications\n nil\n end", "def time_tick timestamp\n\t @now = timestamp\n\t super\n\tend", "def tock\n @minute += 1\n end", "def sync_2600_with(color_clock)\n riot.tick if color_clock % 3 == 0\n @graphics.each &:tick\n cpu.tick if color_clock % 3 == 2\n end", "def tick_clock\n tick = @event_system.clock.tick\n @event_system.queue << tick\n tick\n end", "def tick dt\n update_balance dt\n flush_output\n end", "def tick_tower(seconds)\n self.tower.remove_row(0)\n end", "def sync_2600_with(color_clock)\n @riot.tick if color_clock % 3 == 0\n @tia.tick\n @cpu.tick if color_clock % 3 == 2\n end", "def advance()\n @time = @time + 1\n end", "def start\n until clock.all? { |val| val == 0 }\n print_clock\n decrement_clock\n end\n end", "def step\t\n\t\t@tick += 1\n\t\t\n\t\tif @tick == @interval\n\t\t\t@block.call\n\t\t\treset\n\t\tend\n\tend", "def decrement_clock\n clock[-1] -= 1\n carry_over\n end", "def advance_1sec!\n\t\tTimecop.travel(Time.now + 1)\n\tend", "def timer; end", "def timer; end", "def timer; end", "def timer; end", "def periodic_flush\n true\n end", "def increment_time\n @time = @time + 1\n end", "def tick\n\t\t#method does what the superclass method does....\n\t\tsuper\n\t\t\n\t\t#...method also sounds the alarm\t\n\t\tif @hours == @alarm_hours && @mins == @alarm_mins && @secs == @alarm_secs\n\t\t\tthen\n\t\t\tputs \"Beep Beep Beep!\\nThe time is #{@hours}:#{@mins}:#{@secs}\"\n\t\t\t@alarmsound = :ALARM #return ALARM for unit testing\n\t\tend\n\tend", "def tick\n Kernel.sleep(length) if length > 0\n @count += 1\n end", "def mettrePause()\n @chrono.mettreEnPause()\n end", "def tick\n update(:last_checked => last_time)\n end", "def finish_round\n display(\"\\n\\n ---------------- TIME TO SETTLE ---------------- \\n\\n\")\n end", "def puttime\n return if gameover?\n\n setpos(TIMELINE, 0)\n addstr(\"#{Time.now.to_i - @start} sec\")\n end", "def step(time)\n warn %(Timer step must be >= 0, but #{time} was given!) unless time >= 0\n @now += time\n end", "def puttime\n if gameover?\n return\n end\n setpos(TIMELINE,0)\n addstr( (Time.now.to_i - @start).to_s + \" sec\")\n end", "def init_clock\r\n _emit \"\\tmovwf\\tOSCCAL\"\r\n _emit \"\\tmovlw\\tb'10011000'\"\r\n _emit \"\\toption\"\r\n _emit ''\r\n end", "def reset_timer; end", "def reset_timer; end", "def half_refresh\n contents.clear_rect(24, 0, contents_width - 24, line_height)\n draw_text(24, 0, contents_width - 24, line_height, $game_system.playtime_s, 2)\n end", "def start_clock\n condition = true\n while condition do\n puts \"current time : #{@hour.to_s.rjust(2, \"0\")}:#{@min.to_s.rjust(2, \"0\")}:#{@sec.to_s.rjust(2, \"0\")}\"\n sleep 1.0\n\n increment_sec\n\n check_alarm\n end\n end", "def succ!\n @next_run += @interval\n end", "def on_clock(&bloc)\n\t\t@clock = bloc\n\tend", "def setTime\n\t\t\t@time=0\n\tend", "def tick events\r\n turn_radar 35 if time ==0\r\n turn_gun 25 if time <3\r\n accelaterate 2\r\n turn 2\r\n fire 4 unless events ['robot_scanned'].empty?\r\n end", "def fire(time); end", "def fire(time); end", "def register_tick\r\n\t\t\t@accum_fps += 1\r\n @ticks += 1\r\n\t\t\tcurrent_second = Gosu::milliseconds / 1000\r\n\t\t\tif current_second != @current_second\r\n\t\t\t\t@current_second = current_second\r\n\t\t\t\t@fps = @accum_fps\r\n\t\t\t\t@accum_fps = 0\r\n\t\t\tend\r\n\r\n #\r\n # Calculate how many milliseconds passed since last game loop iteration.\r\n #\r\n\t\t\t@milliseconds_since_last_tick = Gosu::milliseconds - @last_value\r\n\t\t\t@last_value = Gosu::milliseconds\r\n\t\t\treturn @milliseconds_since_last_tick\r\n\t\tend", "def tick\n @life = @life.next_gen\n end", "def tick(events)\n end", "def correct_time(time, frequency)\n time -= frequency while time > Time.now\n time += frequency while time < Time.now\n time\nend", "def chronometer(seconds)\n last_tick = Time.now\n yield\n loop do\n sleep 0.1\n if Time.now - last_tick >= seconds\n last_tick += seconds\n yield\n end\n end\n end", "def spinright(num_times: 1)\n num_times.times do \n send_command 0x74, 0x72,0x24\n sleep 1\n end\n end", "def need_tick_tock?\n if @minute == 60\n @minute = 0\n tick_tock\n end\n end", "def run\n super\n @tick_actions ||= TickActions.new\n if @tick_actions.length > 0\n @tick_actions.dup.each_with_index do |e, i|\n if e[0] <= 0\n e[1].call\n if e[2]\n @tick_actions[i][0] = e[2]\n else\n @tick_actions.delete i\n end\n else\n e[0] -= 1\n end\n end\n end\n end", "def spinleft(num_times: 1)\n num_times.times do \n send_command 0x73, 0x72,0x24\n sleep 1\n end\n end", "def clock?\n true\n end", "def on_timer\n @radius+=@increment\n @increment*=-1 if @radius==100 or @radius==0\n #on_draw # NOK : disk drawn. Same context\n queue_draw # OK : growing circle drawn). New context\n end", "def tick flag\n return unless self.class.method_defined? :on_tick\n @is_ticking = self.class.method_defined?(:old_on_tick) unless instance_variable_defined?(:@is_ticking)\n \n return if @is_ticking == flag \n \n @is_ticking = flag\n if flag\n alias_method :on_tick, :old_on_tick\n engine.add_action_handler @action_handlers[:tick]\n else\n alias_method :old_on_tick, :on_tick\n def self.tick; event_terminate; end\n end\n end", "def tick\n Grid.tick\n head :ok\n end", "def kill\n explode(6) if @out == false\n @out = true\n if @stationary == false\n @emit_rate = 1\n else\n @emit_rate = 3\n end\n @emit, @wind_time = @emit_rate, 0\n end", "def now\n @clock\n end", "def start_clock\n @start_time = Time.now\n end", "def delay; end", "def delay; end", "def delay; end", "def wind_up(turns)\n \"Starting time: \" + current time\n turns.times do\n sleep(@interval)\n tick\n end\n \"Finsh Time: \" + current_time\n end", "def grandfather_clock &block\n time = Time.new.hour\n if time == 0\n time = 12\n elsif time > 12\n time = time - 12\n end\n\n time.times do\n block.call\n end\n\n # Work in progress for output once every hour while code running\n # while true\n # if (Time.new.hour - time) == 1\n # block.call\n # puts \"It is #{time}o'clock!\"\n # if time == 12\n # time = 1\n # else \n # time = time + 1\n # end\n # end\n # end\nend", "def run_asap( &block )\n ::EM.next_tick( &block )\n end", "def grandfather_clock(hour, sound, &block)\n hour.times do\n block.call(sound)\n end\nend", "def clock_tick\n\t\t@elevator_strategy.has_incoming_elevators?(self)\n\t\tif not @passengers.empty? && @make_new_request == false\n\t\t\t@elevator_strategy.request_elevator(self)\n\t\t\t@make_new_request = false\n\t\tend\n\tend", "def tick\n count = @uncounted.sum_then_reset# @uncounted = 0 # uncounted.sumThenReset();\n instantRate = count / FIVE_NANOS;\n if @initialized\n oldRate = @rate\n @rate = oldRate + (@alpha * (instantRate - oldRate))\n else \n @rate = instantRate\n @initialized = true\n end\n self\n end", "def advance_by(time)\n dt = @clock + time\n\n due_to_clock = dt<=>@clock\n raise 'Time is out of range' if due_to_clock < 0\n\n return if due_to_clock == 0\n raise 'Cannot advance while running' if @enabled\n\n self.advance_to dt\n end", "def sleep(time)\n dt = @clock + time\n\n due_to_clock = dt<=>@clock\n raise 'Time is out of range' if due_to_clock < 0\n\n @clock = dt\n end", "def schedule(&blk)\n @reactor.next_tick(blk)\n end", "def put_hold_notice\n @io.puts\n @io.puts 'Pausing here -- run Ruby again to ' \\\n 'measure the next benchmark...'\n end", "def advance(seconds:)\n @time += (seconds.to_i * 1_000)\n end", "def mon() end", "def ding &block\n tund = Time.new.hour\n tund.times do\n block.call \n end\nend", "def tick\n return if dead?\n @ticks += 1\n point.x += t(speed_x)\n point.y += t(speed_y)\n @rotation += t(angular_velocity)\n @opacity += t(opacity_delta)\n end", "def time_passing\n roll\n end", "def update\r\n return if $BTEST\r\n @time = $game_variables[LTS::TIME_VARIABLE_ID]\r\n if @time >= 1440\r\n @time %= 1440\r\n end\r\n @hour = @time/60\r\n @minute = @time%60\r\n $game_variables[LTS::HOUR_VARIABLE_ID] = @hour unless LTS::HOUR_VARIABLE_ID == nil\r\n $lts_time = sprintf(\"%02d:%02d\", @hour, @minute)\r\n if $lts_event_tone\r\n update_tone(0) if $lts_map_data[$game_map.map_id].part_outside?\r\n else\r\n $game_map.screen.start_tone_change(Tone.new(0,0,0,0),0)\r\n update_tone(0) if $lts_map_data[$game_map.map_id].outside?\r\n end\r\n end", "def run_alarm_fallback\n 50.times do\n puts \"\\a\"\n sleep 1.2\n end\n end", "def carry_over\n while clock.any? { |val| val < 0 }\n indx = clock.rindex(-1)\n clock[indx - 1] -= 1\n clock[indx] = n\n end\n end", "def increment_time\n @now += 1.minute\n end", "def setup_timestop\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n @acts[1].times { Graphics.update }\n end", "def send_tick\n msg = Erlang::Encoder.new\n msg.write_4 0\n msg.write ''\n send_data msg\n end", "def tick\n return false if !program?\n return false if @halt\n clock_cycle do |clock|\n break if @halt\n print \"cycle: \"\n if (inst = next_instruction)\n exec_inst(inst)\n else\n break\n end\n end\n return true\n end", "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 start\n @timer = every(1) { tick }\n super\n end", "def tick(date=nil)\n if date.blank?\n date = Time.now\n else\n date = date.to_time\n end\n date.tick\n end", "def redisplay_delay\r\n 20\r\n end", "def clock_tick\n instruction = @travel_instructions[@current_instruction]\n case instruction\n when 'L', 'R'\n @facing_direction = cardinal_direction_to_my(instruction)\n when 'M'\n @x_location, @y_location = coordinates_to_the(@facing_direction)\n else\n raise ArgumentError.new(\"illegal instruction #{@travel_instructions[@current_instruction]} at index #{@current_instruction}\")\n end\n @current_instruction += 1\n end", "def tick()\n\t\t\t\tpassed = Clock.runtime() - @last_tick # how long since the last tick?\n\t\t\t\tif @target_frametime\n\t\t\t\t\treturn Clock.delay(@target_frametime - passed) + passed\n\t\t\t\tend\n\t\t\t\treturn passed\n\t\t\tensure\n\t\t\t\t@last_tick = Clock.runtime()\n\t\t\t\t@ticks += 1\n\t\t\tend", "def update\r\n # タイマー作動中なら可視に設定\r\n self.visible = $game_system.timer_working\r\n # タイマーを再描画する必要がある場合\r\n if $game_system.timer / 60 != @total_sec # Graphics.frame_rate\r\n # トータル秒数を計算\r\n @total_sec = $game_system.timer / 60#Graphics.frame_rate\r\n # タイマー表示用の文字列を作成\r\n min = @total_sec / 60\r\n sec = @total_sec % 60\r\n # タイマーを描画\r\n self.text = sprintf(\"%02d:%02d\", min, sec)\r\n end\r\n end", "def main()\n puts \"Starting:\"+Time.new.inspect\n n=5\n loop {\n t=Time.new\n puts \"Tick #{n}:\"+Time.new.inspect\n n=n-1\n if (n==0) \n puts \"Boom!\" \n raise \n end \n sleep 2\n \n }\nend", "def tick\n toggleClass 'inactive', !TIMEFRAME.cover?(Time.now.hour)\n return if dead? || !TIMEFRAME.cover?(Time.now.hour)\n state, _ = next_state\n\n @messages[Date.today.to_s] ||= {}\n time = Time.now.strftime('%k:%M')\n messages = MESSAGES.select do |message, msg_time|\n msg_time == time\n end\n if !messages.empty? && !@messages[Date.today.to_s][messages.first[1]]\n message, msg_time = messages.first\n @messages[Date.today.to_s][msg_time] = true\n DesktopNotifications.notify message\n end\n\n if idle? && state\n @start_time = Time.now.to_i\n set_state state\n puts \"Next state: #{state}\"\n elsif @start_time\n diff = Time.now.to_i - @start_time.to_i\n end_state if diff.to_i > STATES[@state][:duration].to_i\n else\n if idle? && rand <= 0.001\n DesktopNotifications.notify RANDOM_MESSAGES.sample\n end\n end\n end", "def reset_times_after_display\n @@resets_after_display = true\n end", "def update\n loop do\n if (Time.now.to_f - @_ntime.to_f) >= @time.to_f\n Graphics.update \n terminate\n break \n return\n end\n Input.update\n if Input.trigger?(Input::C) && $game_temp.mskip\n terminate\n break \n return\n end\n if @refreshTime >= rtime\n Graphics.update \n @refreshTime = 0\n end\n @refreshTime += 1\n end\n end" ]
[ "0.7285771", "0.7246562", "0.69077283", "0.68607295", "0.68047565", "0.68047565", "0.68047565", "0.6779406", "0.6651528", "0.66509557", "0.6589029", "0.64297116", "0.6427584", "0.6173763", "0.6164983", "0.61336315", "0.6122825", "0.60808545", "0.6073708", "0.607238", "0.59997094", "0.59931767", "0.59795755", "0.59116477", "0.5878307", "0.5878307", "0.5878307", "0.5878307", "0.5864838", "0.5832211", "0.58221847", "0.5818087", "0.5801951", "0.5797103", "0.57326275", "0.57246184", "0.570004", "0.56824714", "0.56822497", "0.56800056", "0.56800056", "0.5679446", "0.5649393", "0.5646368", "0.56435525", "0.56312877", "0.56209177", "0.56164473", "0.56164473", "0.5614309", "0.5613339", "0.56072706", "0.5598604", "0.5593665", "0.5588127", "0.55725646", "0.5570574", "0.55680186", "0.5566514", "0.5561739", "0.5548164", "0.5543773", "0.55409396", "0.55395764", "0.55291027", "0.55285954", "0.55285954", "0.55285954", "0.5526342", "0.5519047", "0.5514966", "0.5509742", "0.55029714", "0.5498157", "0.5495885", "0.54873693", "0.5486865", "0.5482143", "0.5481073", "0.5478081", "0.5472306", "0.5468425", "0.54632413", "0.5461806", "0.54604405", "0.5455268", "0.5446187", "0.5434397", "0.54289573", "0.5419578", "0.5402654", "0.539914", "0.5395794", "0.5370142", "0.5365968", "0.53655356", "0.5359497", "0.5348958", "0.53381455", "0.53322244", "0.5326033" ]
0.0
-1
Height of a floor
def floor_height(floor) floors.index(floor) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_height\n return get_keyword_value(\"FLOOR-HEIGHT\").to_f\n end", "def height\n (self.width.to_f * (9.to_f/16.to_f)).to_i\n end", "def height\n\t\tfloors.size\n\tend", "def height\n bounds[:bottom] - bounds[:top]\n end", "def height\n bounds[:bottom] - bounds[:top]\n end", "def height\n TILE_BASE_HEIGHT\n end", "def terrain_height\n end", "def height; end", "def height; end", "def height; rect.height; end", "def height\n @bottom_edge - @top_edge\n end", "def height\n @dimensions.y\n end", "def height\n @y1 - @y0\n end", "def height\n dimensions()[:y]\n end", "def fullheight\n return self.bitmap.height.to_f * self.zoom_y\n end", "def pixel_height\n @sensor_height / @height_in_pixels\n end", "def height\n features.intersection(Features::HEIGHT)\n end", "def height\n @alive ? @height.round(1) : \"A dead tree is not very tall. :(\"\n end", "def height\r\n assert_exists\r\n return @o.invoke(\"height\").to_s\r\n end", "def height\n return height_helper(@root, 0, 1)\n end", "def height\n return height_helper(@root, 0, 1)\n end", "def height\n rmagick_image.rows\n end", "def height\n get_geometry if @height.nil?\n return @height\n end", "def height\n top - bottom\n end", "def pixelheight\n end", "def height\n a = self.orientation\n return 0.inch if not a\n a[0].z\nend", "def height\n top + bottom\n end", "def height\n end", "def height\n end", "def height\n image_ptr[:sy]\n end", "def display_height\n (display_width.to_f / width.to_f) * height\n end", "def display_height\n (display_width.to_f / width.to_f) * height\n end", "def display_height\n (display_width.to_f / width.to_f) * height\n end", "def height\n if clear_border?\n geometry.height\n\n else\n border.height\n\n end\n end", "def height\n defined?(@ht) ? @ht : nil\n end", "def base_height; 24; end", "def base_height; 24; end", "def height\n return 0 if @root.nil?\n return hegiht_helper(@root)\n end", "def height\n size_a[1]\n end", "def height\r\n return (@y2-@y1).abs\r\n end", "def height\n @ole.Height\n end", "def height\n @ole.Height\n end", "def image_height(image_handle)\n end", "def height()\n 0\n end", "def outer_height; rect.height + @border_thickness * 2; end", "def height\n return height_helper(@root, 0)\n end", "def height\n return height_helper(@root, 0)\n end", "def height\n return self.rect.height\n end", "def height\n size.first\n end", "def height\n size.first\n end", "def height\n height_helper(@root, 0)\n end", "def height\n heights = [left_height, right_height].sort\n\n heights.last\n end", "def height\n ['N', 'S'].include?(@orientation) ? @height : @width\n end", "def height\n dimensions.last\n end", "def height\n return height_helper(@root)\n end", "def height\n @image.height\n end", "def image_height\n end", "def height=(_); end", "def height=(_); end", "def height\n return @height\n end", "def height\n # raise NotImplementedError\n # return 0 if @root.nil?\n return height_helper(@root, 0, 1)\n end", "def height\n return 0 if @root.nil?\n return height_helper(@root, 0, 1)\n end", "def height\n @map.size\n end", "def height\n return @shadow_point.y - self.y\n end", "def height\n return @shadow_point.y - self.y\n end", "def height_calc\n lines = [@data.length, page_row_max].min rescue page_row_max\n return lines * line_height + standard_padding * 2\n end", "def height_calc\n lines = [@data.length, page_row_max].min rescue page_row_max\n return lines * line_height + standard_padding * 2\n end", "def height\n return @window_height # outer height\nend", "def height\n\t\treturn @height\n\tend", "def board_foot(board_length, board_width)\n # Calculates the height for a board foot\n 144 / (board_length * board_width)\nend", "def height\n @height\n end", "def height\n @rows * @block_size\n end", "def height\n @image.length\n end", "def height\n `#{clientRect}.height`\n end", "def height\n @height || 100\n end", "def height\n if @y_offset + @height > @source.height\n [@source.height - @y_offset, 0].max\n else\n @height\n end\n end", "def height\n return 0 if @root == nil\n\n current = @root\n\n return height_helper(current, 1, 1)\n end", "def size(rect)\n return rect.height\n end", "def height\n rows\n end", "def height\n return data.height\n end", "def height\n case target\n when :editable then height_for_editable_target\n when :cc, :kiddom, :qti, :schoology then image_height\n end\n end", "def height\n @height = @height + 1\n end", "def height\n Vips.vips_image_get_height self\n end", "def height\n @maps[:background].size\n end", "def height(unit: T.unsafe(nil)); end", "def height(value)\n fail InvalidHeight if y_out_of_bounds?(value)\n\n attributes[:geometry][:height] = value\n end", "def height\n lines.size\n end", "def height\n lines.size\n end", "def height\n self.resolution.last unless self.resolution.nil? || many?\n end", "def bottom_floor\n\t\t@flrs.first\n\tend", "def height\n metadata[:height] if valid?\n end", "def height\n @screenplay.line_height * @lines.size\n end", "def height(level = 1)\n if @children[LEFT] != nil\n return @children[LEFT].height(level + 1)\n elsif @children[RIGHT] != nil\n return @children[RIGHT].height(level + 1)\n end\n end", "def height\n @root and @root.height or 0\n end", "def g_height \n Config.ground_height\n end", "def height\n image.size\n end", "def height\n line_count = layout.line_count\n h = (line_count - 1) * layout.spacing\n line_count.times do |i|\n h += layout.get_line_bounds(i).height\n end\n h\n end", "def height(latitude, longitude)\n get_lookup(:height).search(latitude, longitude)\n end", "def levelsize\n w=@width-(2*@border)\n h=@height-(2*@border)\n return [w, w * gridwidth / gridheight ] if fit_width()\n return [h * gridheight / gridwidth, h]\n end", "def height\n return self.src_rect.height\n end" ]
[ "0.76016814", "0.7161729", "0.7128195", "0.7125616", "0.7125616", "0.71211076", "0.7023405", "0.6970987", "0.6970987", "0.69226235", "0.69115996", "0.68667585", "0.6844538", "0.6835952", "0.67957497", "0.67726105", "0.6755151", "0.67231405", "0.6720731", "0.67199576", "0.67199576", "0.6702847", "0.6688516", "0.66798717", "0.6673662", "0.66469413", "0.6638513", "0.66305137", "0.66305137", "0.6617552", "0.6598", "0.6598", "0.6598", "0.6595356", "0.6594929", "0.6581937", "0.6581937", "0.6568982", "0.6559788", "0.65577596", "0.6553127", "0.6553127", "0.6550313", "0.65486336", "0.6547718", "0.65387446", "0.65387446", "0.6537204", "0.6525314", "0.6525314", "0.6518758", "0.6509123", "0.6504949", "0.65016687", "0.64854795", "0.64853764", "0.64804894", "0.6450129", "0.6450129", "0.64237154", "0.63737607", "0.6373468", "0.63681513", "0.63641447", "0.63641447", "0.6342613", "0.6342613", "0.63179445", "0.6304417", "0.6301022", "0.6297785", "0.62953395", "0.6286919", "0.6284919", "0.62823987", "0.62813634", "0.62722725", "0.62682146", "0.6265244", "0.6258676", "0.62565094", "0.6255582", "0.6240153", "0.621922", "0.6215204", "0.6207583", "0.6184159", "0.6184159", "0.61836267", "0.6179613", "0.61779064", "0.61727726", "0.61672395", "0.61634743", "0.61487824", "0.6147976", "0.61457855", "0.61386263", "0.61356866", "0.6128309" ]
0.8416055
0
Size of the building
def height floors.size end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def size\n @size.size\n end", "def size\r\n @pack.size\r\n end", "def size\n @size \n end", "def size\n @size \n end", "def size\n\t\t7500\n\tend", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n end", "def size\n end", "def size\n @size\n end", "def size; @size end", "def size\n end", "def size\n end", "def size\n end", "def size\n @structure.size\n end", "def size\n end", "def size\n @size\n end", "def size #:nodoc:\n 1\n end", "def size #:nodoc:\n 1\n end", "def size; end", "def size; end", "def size; end", "def size; end", "def size; end", "def size; end", "def size; end", "def size; end", "def size; end", "def size; end", "def size; end", "def size; end", "def size; end", "def size; end", "def size; end", "def size; end", "def size; end", "def size; end", "def size; end", "def size; end", "def size; end", "def get_size\n\t\tend", "def size\n end", "def size\n end", "def size\n end", "def size\n end", "def size\n end", "def size\n end", "def size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n self[:size]\n end", "def get_size\n\t\treturn @size\n\tend", "def size\n\n self.to_h.size\n end", "def size\n\n end", "def size\n length\n end", "def size\n return @size\n end", "def size\n return @size\n end", "def size\n @info[:size]\n end", "def length\n size\n end", "def size\n @length / 4\n end", "def size\n return @size\n end", "def size\n return @size\n end", "def size\n self.length\n end", "def size\r\n\t\t@size\r\n\t\t#el tamaño\r\n\tend", "def size\n @_config.size\n end", "def size\n @info.size\n end", "def size\n @info.size\n end", "def size\n @info.size\n end", "def size\n self.attributes.length\n end", "def size\n SizableLocation.new(location).size\n end", "def size\n pad.size\n end", "def size\n \t@size\n end", "def length\n size\n end", "def size\n 4\n end", "def size\n target.size\n end", "def size\n\tend", "def size\n\t\t\treturn @m.capacity\n\t\tend", "def sz\n self.to_s.size\n end" ]
[ "0.7516599", "0.74902517", "0.748047", "0.748047", "0.74307084", "0.7371061", "0.7371061", "0.7371061", "0.73549044", "0.73549044", "0.73277473", "0.7326411", "0.72955745", "0.72955745", "0.72955745", "0.7265124", "0.7252175", "0.7203684", "0.7202485", "0.7202485", "0.7199706", "0.7199706", "0.7199706", "0.7199706", "0.7199706", "0.7199706", "0.7199706", "0.7199706", "0.7199706", "0.7199706", "0.7199706", "0.7199706", "0.7199706", "0.7199706", "0.7199706", "0.7199706", "0.7199706", "0.7199706", "0.7199706", "0.7199706", "0.7199706", "0.7197181", "0.71764916", "0.71764916", "0.71764916", "0.71764916", "0.71764916", "0.71764916", "0.71764916", "0.7175252", "0.7175252", "0.7175252", "0.7175252", "0.7175252", "0.7175252", "0.7175252", "0.7175252", "0.7175252", "0.7175252", "0.7175252", "0.7175252", "0.7175252", "0.7175252", "0.7175252", "0.7175252", "0.7175252", "0.7175252", "0.7175252", "0.7175252", "0.7175252", "0.7175252", "0.7175252", "0.7175252", "0.7171835", "0.7151954", "0.71400684", "0.7131596", "0.7130585", "0.71117264", "0.71117264", "0.7088169", "0.70703113", "0.70691407", "0.70550764", "0.70550764", "0.704413", "0.7038505", "0.7038377", "0.7034929", "0.7034929", "0.7034929", "0.7023621", "0.70189047", "0.70076585", "0.7000363", "0.69944364", "0.6994358", "0.6989949", "0.6987394", "0.6936856", "0.69334996" ]
0.0
-1
Lets a person enter on the first floor
def enter(person) floors.first.enter(person) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def go_to_next_floor\n puts \"Elevator #{@id}, currently at floor #{@current_floor}, is about to go to floor #{@next_floor}...\"\n puts \"=====================================================================\"\n \n while @current_floor != @next_floor\n if @movement == \"up\"\n @current_floor += 1\n elsif (@movement == \"down\")\n @current_floor -= 1\n end\n @floor_display.display_floor()\n end\n\n puts \"======================================================================\"\n puts \"Elevator #{@id} has reached its requested floor! It is now at floor #{@current_floor}.\"\n end", "def requestFloor(floor)\n puts \"The elevator is requested to move to floor #{floor}.\"\n @floorRequestList.push(floor)\n sortFloorList()\n puts \"Elevator is moving.\"\n moveElevator()\n puts \"Elevator is #{@status}.\"\n doorController()\n if @floorRequestList.length() == 0\n @direction = nil\n @status = 'idle'\n end\n puts \"Elevator is #{@status}.\"\n end", "def requestFloor(requestedFloor, requestedColumn)\n puts \"\" \n puts \">> Someone inside the elevator#{@id} wants to go to floor <#{requestedFloor}> <<\"\n checkWeight($maxWeight)\n checkObstruction()\n addFloorToFloorList(requestedFloor)\n moveElevator(requestedFloor, requestedColumn)\n end", "def final_floor\n floors.last\n end", "def current_floor\n\t\t@current_floor\n\tend", "def hit_floor\n return nil if rising?\n what_object_hit_me_on_the :side => :bottom, :restrict => Standable, :look_ahead => 10, :margin_of_error => 25\n end", "def set_floor\n @floor = Floor.find_by(id: params[:floor_id])\n end", "def set_floor\n @floor = Floor.find(params[:id])\n end", "def set_floor\n @floor = Floor.find(params[:id])\n end", "def step\n\t\t@elevators.each do |elevator|\n\t\t\tif elevator.current_floor == @floor_number\n\t\t\t\twhile !@persons_queue.empty?\n\t\t\t\t\tif elevator.number_of_occupants < elevator.max_capacity\n\t\t\t\t\t\televator.add_occupant @persons_queue.shift\n\t\t\t\t\telse\n\t\t\t\t\t\tbreak\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def request_floor(floor)\n if floor == self.current_floor\n print self.id 'floor button pushed, we are already on this floor, opening doors'\n elsif floor > self.current_floor\n self.a_floor_was_requested(floor)\n self.up_queue.append(floor)\n self.up_queue.sort\n self.set_direction\n self.request_this_elevator\n elsif floor < self.current_floor\n self.a_floor_was_requested(floor)\n self.down_queue.append(floor)\n self.up_queue.sort.reverse\n self.set_direction\n self.request_this_elevator\n end\n end", "def casino_floor\n puts\n puts \"Welcome back!\"\n @person_wallet.show_wallet\n choose_game\n end", "def display_floor\n sleep($sleep_time)\n puts \"... Elevator #{@elevator.id}'s current floor mid-travel #{@elevator.current_floor} ...\"\n end", "def go_to_origin\n @next_floor = @origin_floor\n puts \"Elevator #{@id} going back to origin...\"\n go_to_next_floor()\n end", "def request_floor(elevator, requested_floor)\n floor_btn_to_press = elevator.floor_buttons.find { |btn| btn.floor == requested_floor } \n \n floor_btn_to_press.press()\n elevator.do_requests()\n end", "def marked_floor?(floor = nil)\n floor ||= @current_floor\n marked_floors.include? floor\n end", "def create\n @floor = Floor.new(params[:floor])\n\n respond_to do |format|\n if @floor.save\n format.html { redirect_to @floor, notice: 'Floor was successfully created.' }\n format.json { render json: @floor, status: :created, location: @floor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @floor.errors, status: :unprocessable_entity }\n end\n end\n end", "def enter(room) \n # Obtain hazard for the room \n hazardsInRoom = room.hazardRoom\n #Check that hazard room is not nil and has pit\n if (hazardsInRoom and hazardsInRoom.include?(:pit))\n @@blockEncounters[2].call()\n end\n #Change room\n setCurrRoomNumber(room.number) \n #Check that hazard room is not nil and has guard\n if (hazardsInRoom and hazardsInRoom.include?(:guard))\n @@blockEncounters[0].call()\n end\n \n # Check for bats \n if (hazardsInRoom and hazardsInRoom.include?(:bats))\n @@blockEncounters[1].call()\n end\n end", "def first\n\t\trandom = get_rand(4)\n\t\tif random == 0\n\t\t\t@location = \"Museum\"\n\t\telsif random == 1\n\t\t\t@location = \"Cathedral\"\n\t\telsif random == 2\n\t\t\t@location = \"Hospital\"\n\t\telsif random == 3\n\t\t\t@location = \"Hillman\"\n\t\telse\n\t\t\traise \"Something bad has happened\"\n\t\tend\n\tend", "def travel_to!(floor)\n passengers.each {|passenger| passenger.current_floor = self.current_floor}\n\nend", "def initFloor\n floor_geo = Geometry.new('Floor', @@floor)\n floor_geo.setMaterial(@floor_mat)\n floor_geo.setLocalTranslation(0, -0.1, 0)\n self.rootNode.attachChild(floor_geo)\n #Make the floor physical with mass 0.0f! */\n @floor_phy = RigidBodyControl.new(0.0)\n floor_geo.addControl(@floor_phy)\n @bulletAppState.getPhysicsSpace().add(@floor_phy)\n end", "def addFloorToFloorList(floor)\n @floorList.append(floor)\n puts \"Elevator#{@id} - floor #{floor} added to floorList\"\n end", "def collision_floor\n return unless state.dy <= 0 # return unless player is going down or is as far down as possible\n player_rect = [state.x, next_y, state.tile_size, state.tile_size] # definition of player\n\n # Runs through all the sprites on the field and finds all intersections between player's\n # bottom and the top of a rect.\n floor_collisions = state.world_collision_rects\n .find_all { |r| r[:top].intersect_rect?(player_rect, state.collision_tolerance) }\n .first\n\n return unless floor_collisions # performs following changes if a collision has occurred\n state.y = floor_collisions[:top].top # y of player is set to the y of the colliding rect's top\n state.dy = 0 # no change in y because the player's path is blocked\n end", "def get_object\n next_x = @cur_x + DIRECTION[@hero_direction][0]\n next_y = @cur_y + DIRECTION[@hero_direction][1]\n return if next_x < 0 || next_x > 14 || next_y < 0 || next_y > 14\n #look at new square in room\n next_square = @room[next_x][next_y]\n if next_square == CHAR_POTION || next_square == CHAR_CHEST || next_square == CHAR_IDOL\n @room[next_x][next_y] = CHAR_FLOOR\n draw_map(next_x,next_y)\n @potions += 1 if next_square == CHAR_POTION\n @treasure += 1 if next_square == CHAR_CHEST\n @idol_found = true if next_square == CHAR_IDOL\n @stats[:experience] += 0.25\n end\n end", "def starting_room\r\n Game.instance.rooms.dig(@starting_room_id) || Game.instance.rooms.values.first\r\n end", "def load_first_turn\n \t\tself.players.last.turns.build(round: 1)\n \tend", "def floor(floor_number)\n\t\t@flrs[floor_number]\n\tend", "def single_user_should_only_have_one_entry_per_round\n\n\t\treturn self.is_first || self.get_side == self.get_debate.get_turn\n\tend", "def first_move\n computer.move if @first_player == COMPUTER_PLAYER\n @on_move = HUMAN_PLAYER\n end", "def get_floor()\n get_parent(\"FLOOR\")\n end", "def one_player\n\n if go_first? == true\n game = Game.new(Players::Human.new(\"X\"), Players::Computer.new(\"O\"))\n game.play\n\n else\n game = Game.new(Players::Computer.new(\"X\"), Players::Human.new(\"O\"))\n game.play\n end # inner if\n end", "def floor\n end", "def set_floor\n @floor = Floor.with_deleted.find(params[:id])\n end", "def min_one\n MinOne && !TactBattleManager.all_party_events_on_map\n end", "def get_start_floor(the_maze) \r\n the_maze.each_with_index do |floor, index| \r\n return index if get_start_position(floor) != nil \r\n end \r\nend", "def floor_number\n return @floor_number\n end", "def create\n @floor = Floor.new(floor_params)\n\n respond_to do |format|\n if @floor.save\n format.html { redirect_to floors_path, notice: I18n.t('floors.create') }\n format.json { render :show, status: :created, location: @floor }\n else\n format.html { render :new }\n format.json { render json: @floor.errors, status: :unprocessable_entity }\n end\n end\n end", "def top_floor\n\t\t@flrs.last\n\tend", "def first_player\n singles_player_of_team first_team\n end", "def get_floor()\n get_parent(\"FLOOR\")\n end", "def enter\n $movement = \"take path\"\n puts \"This room opens up into a somewhat large cavernous room that mostly contains \"\\\n \"a dark and foul looking body of... something. It most likely used to be water, but the lack \"\\\n \"of a current and the fact that the denezins of this place have used it as a latrine for \"\\\n \"what seems like centuries has turned the body into a foul smelling disease ridden pool.\"\\\n \"A path runs along side of the pool leading to other parts of the dungeon.\"\n if @monster\n puts \"An evil #{@monster.monster} is doing its business here.\"\n else\n puts \"Except for an occasional bubbling from the pool, the room is eerily quite.\"\n end\n end", "def get_people(floor_num)\n number_of_people = rand(0..MAX_PEOPLE_PER_FLOOR)\n people_arr = []\n number_of_people.times do\n destination_floor = rand(0...NUM_OF_FLOORS)\n # makes sure that no one wants to go to the floor they start on\n people_arr << Person.new(destination_floor) if destination_floor != floor_num\n end\n people_arr\nend", "def first_hole_number\n 1\n end", "def P\r\n if(get_room_stuff(6) > 0)\r\n if $light == 0\r\n puts(\"YOU CANNOT SEE WHERE IT IS\")\r\n else\r\n $wealth += get_room_stuff(6)\r\n puts(\"PICKED UP $#{get_room_stuff(6)}!\")\r\n set_at_room($roomnumber,6, 0)\r\n end\r\n else\r\n puts(\"THERE IS NO TREASURE TO PICK UP\")\r\n end\r\nend", "def floor_params\n params.require(:floor).permit(:building_id, :floor)\n end", "def get_next_floor(floor, direction)\n\t\tindex = floor.number\n\t\tif direction.eql? :UP\n\t\t\treturn floors[index+1]\n\t\tend\n\t\tif index-1 < 0\n\t\t\treturn nil\n\t\tend\n\t\tfloors[index-1]\n\tend", "def mark_floor(floor)\n floor_exists?(floor)\n return if current_floor == floor || marked_floors.include?(floor)\n @marked_floors << floor\n end", "def create\n @floor = Floor.new(params[:floor])\n\n respond_to do |format|\n if @floor.save\n flash[:notice] = 'Floor was successfully created.'\n format.html { redirect_to(@floor) }\n format.xml { render :xml => @floor, :status => :created, :location => @floor }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @floor.errors, :status => :unprocessable_entity }\n end\n end\n end", "def move()\n if @direction == \"up\"\n move_up()\n elsif @direction == \"down\"\n move_down()\n else\n #check if anyone is on current floor- which way do majority want to go from here?\n @direction = people_on_current_floor()\n if @direction == \"up\" #were more ppl on this floor wanting to go up\n move_up()\n elsif @direction == \"down\"\n move_down()\n else #no one on this floor, decide direction based on pending rqsts above and below...\n decide_direction()\n end\n end\n end", "def go_up\n self.current_floor += 1\n end", "def bottom_floor\n\t\t@flrs.first\n\tend", "def door_opened_by_monte\n @door_opened_by_monte ||= begin\n the_door = nil\n\n doors.each_with_index do |behind_door, door_number|\n next if door_number == contestant_first_guess\n next if behind_door == CAR\n the_door = door_number\n end\n\n the_door\n end\n end", "def enter_maze\n\t\t@player.location = @maze.rooms.sample.reference\n\t\tputs \"You go west.\"\n\tend", "def land! do\n\traise 'Airport at capacity, go round' if full? \n\traise 'Can\\'t you see it\\'s too stormy to land' if stormy? \n \tairplanes << airplane \n\tend", "def run_one_game\n # the car is actually in any of three doors:\n car_location = random.rand(1..3)\n\n revealed_goat_door = host_opens_door(car_location)\n other_choice = remaining_closed_door(revealed_goat_door)\n\n if (car_location == other_choice)\n @switcher_total_wins += 1\n end\n\n # Stayer will stay (Door 1)\n if (car_location == 1)\n @stayer_total_wins += 1\n end\n\n # Chaosmonkey will either stay (Door 1) or switch\n chaosmonkey_choice = (random.rand(0..1) == 0) ? other_choice : 1\n\n if (car_location == chaosmonkey_choice)\n @chaosmonkey_total_wins += 1\n end\n end", "def room_enter(player, value)\r\n self.synchronize do\r\n iroom = value\r\n if iroom < 0\r\n room = Room.new(player, @batch_game)\r\n @rooms << room\r\n iroom = @rooms.size - 1\r\n else\r\n room = @rooms[iroom]\r\n room.process(player, Server::CMD_ROOM_ENTER, nil)\r\n end\r\n @lobby.process(player, Server::CMD_ROOM_ENTER, iroom)\r\n end\r\n end", "def people_on_current_floor()\n floors = @building.floors\n curr_floor = floors[@current_floor]\n wanting_up = curr_floor.up_person_queue\n wanting_down = curr_floor.down_person_queue\n if wanting_up.size() == 0 && wanting_down.size() == 0\n return \"stationary\"\n elsif wanting_up.size() > wanting_down.size()\n return \"up\"\n else # there are more or as many ppl wanting to go down\n return \"down\"\n end\n end", "def move_to(new_target_floor)\n return if doors_open\n case direction\n when 1\n return unless new_target_floor > floor\n when -1\n return unless new_target_floor < floor\n end\n self.target_floor = new_target_floor\n run\n true\n end", "def floor\n self\n end", "def floor\n self\n end", "def landing_rovers(rovers)\n rovers.each do |rover|\n @rovers << Rover.new(rover.split(\" \")[0].to_i, rover.split(\" \")[1].to_i, rover.split(\" \")[2].upcase)\n end\n @map.rovers_initial_position(@rovers)\n end", "def collision_floor!\n return unless state.dy <= 0 # return unless player is going down or is as far down as possible\n player_rect = [state.x, state.y - 0.1, state.tile_size, state.tile_size] # definition of player\n\n # Goes through world_collision_rects to find all intersections between the bottom of player's rect and\n # the top of a world_collision_rect (hence the \"-0.1\" above)\n floor_collisions = state.world_collision_rects\n .find_all { |r| r[:top].intersect_rect?(player_rect, collision_tollerance) }\n .first\n\n return unless floor_collisions # return unless collision occurred\n state.y = floor_collisions[:top].top # player's y is set to the y of the top of the collided rect\n state.dy = 0 # if a collision occurred, the player's rect isn't moving because its path is blocked\n end", "def scan_fort_entrance\n # map center\n cx = df.world.map.x_count / 2\n cy = df.world.map.y_count / 2\n center = surface_tile_at(cx, cy, true)\n rangez = (0...df.world.map.z_count).to_a.reverse\n cz = rangez.find { |z| t = df.map_tile_at(cx, cy, z) and tsb = t.shape_basic and (tsb == :Floor or tsb == :Ramp) }\n center = df.map_tile_at(cx, cy, cz)\n\n ent0 = center.spiral_search { |t0|\n # test the whole map for 3x5 clear spots\n next unless t = surface_tile_at(t0)\n\n # make sure we're not too close to the edge of the map.\n next unless t.offset(MinX, MinY, MinZ) and t.offset(MaxX, MaxY, MaxZ)\n\n (-1..1).all? { |_x|\n (-2..2).all? { |_y|\n tt = t.offset(_x, _y, -1) and tt.shape == :WALL and tm = tt.tilemat and (tm == :STONE or tm == :MINERAL or tm == :SOIL or tm == :ROOT) and\n ttt = t.offset(_x, _y) and ttt.shape == :FLOOR and ttt.designation.flow_size == 0 and\n not ttt.designation.hidden and not df.building_find(ttt)\n }\n } and (-3..3).all? { |_x|\n (-4..4).all? { |_y|\n surface_tile_at(t.x + _x, t.y + _y, true)\n }\n }\n }\n\n raise 'Can\\'t find a fortress entrance spot. We need a 3x5 flat area with solid ground for at least 2 tiles on each side.' unless ent0\n ent = surface_tile_at(ent0)\n\n @fort_entrance = Corridor.new(ent.x, ent.x, ent.y-1, ent.y+1, ent.z, ent.z)\n 3.times { |i|\n @fort_entrance.layout << {:item => :trap, :subtype => :cage, :x => i-1, :y => -1, :ignore => true}\n @fort_entrance.layout << {:item => :trap, :subtype => :cage, :x => 1, :y => i, :ignore => true}\n @fort_entrance.layout << {:item => :trap, :subtype => :cage, :x => 1-i, :y => 3, :ignore => true}\n @fort_entrance.layout << {:item => :trap, :subtype => :cage, :x => -1, :y => 2-i, :ignore => true}\n }\n 5.times { |i|\n @fort_entrance.layout << {:item => :trap, :subtype => :cage, :x => i-2, :y => -2, :ignore => true}\n @fort_entrance.layout << {:item => :trap, :subtype => :cage, :x => 2, :y => i-1, :ignore => true}\n @fort_entrance.layout << {:item => :trap, :subtype => :cage, :x => 2-i, :y => 4, :ignore => true}\n @fort_entrance.layout << {:item => :trap, :subtype => :cage, :x => -2, :y => 3-i, :ignore => true}\n }\n\n end", "def touch_in(station)\n deduct(PENALTYFARE) if @in_joureny == true\n min_balance? ? (fail \"insufficent funds\") : @the_journey.start(station)\n @in_journey = true\n end", "def determine_starting_player\n @current_player_index = rand(0..num_players - 1)\n puts \"Looks like #{@players[@current_player_index].name} will be going first!\"\n @players[@current_player_index]\n end", "def client_entered(user_id, room)\n dump_round_vars \"Entering client_entered(#{room})\"\n if @@clientList[room].empty?\n prepare_round(room)\n end\n @@clientList[room].push(user_id); # => param[:id])\n \n if (@@round_in_progress == true)\n round_id = @@curr_round[room]\n else \n round_id = @@next_round[room]\n end\n if (Result.where(round_id: round_id).where(user_id: user_id).length > 0)\n puts 'Result for this client/round already exists - must be a REentry'\n else\n Result.new(round_id: round_id, user_id: user_id, round_complete: !@@round_in_progress).save\n end\n dump_round_vars '', 'Exiting client_entered()'\n end", "def scan_fort_entrance\n # map center\n cx = df.world.map.x_count / 2\n cy = df.world.map.y_count / 2\n center = surface_tile_at(cx, cy)\n rangez = (0...df.world.map.z_count).to_a.reverse\n cz = rangez.find { |z| t = df.map_tile_at(cx, cy, z) and tsb = t.shape_basic and (tsb == :Floor or tsb == :Ramp) }\n center = df.map_tile_at(cx, cy, cz)\n\n ent0 = center.spiral_search { |t0|\n # test the whole map for 3x5 clear spots\n next unless t = surface_tile_at(t0)\n (-1..1).all? { |_x|\n (-2..2).all? { |_y|\n tt = t.offset(_x, _y, -1) and tt.shape == :WALL and tm = tt.tilemat and (tm == :STONE or tm == :MINERAL or tm == :SOIL) and\n ttt = t.offset(_x, _y) and ttt.shape == :FLOOR and ttt.designation.flow_size == 0 and\n not ttt.designation.hidden and not df.building_find(ttt)\n }\n }\n }\n\n if not ent0\n puts 'AI: cant find fortress entrance spot'\n ent = center\n else\n ent = surface_tile_at(ent0)\n end\n\n @fort_entrance = Corridor.new(ent.x, ent.x, ent.y-1, ent.y+1, ent.z, ent.z)\n 3.times { |i|\n @fort_entrance.layout << {:item => :trap, :subtype => :cage, :x => i-1, :y => -1, :ignore => true}\n @fort_entrance.layout << {:item => :trap, :subtype => :cage, :x => 1, :y => i, :ignore => true}\n @fort_entrance.layout << {:item => :trap, :subtype => :cage, :x => 1-i, :y => 3, :ignore => true}\n @fort_entrance.layout << {:item => :trap, :subtype => :cage, :x => -1, :y => 2-i, :ignore => true}\n }\n 5.times { |i|\n @fort_entrance.layout << {:item => :trap, :subtype => :cage, :x => i-2, :y => -2, :ignore => true}\n @fort_entrance.layout << {:item => :trap, :subtype => :cage, :x => 2, :y => i-1, :ignore => true}\n @fort_entrance.layout << {:item => :trap, :subtype => :cage, :x => 2-i, :y => 4, :ignore => true}\n @fort_entrance.layout << {:item => :trap, :subtype => :cage, :x => -2, :y => 3-i, :ignore => true}\n }\n\n end", "def has_floor\n\t\t\t@has_floor ||= block_type.present? ?\n\t\t\t!['adjacent_house', 'land'].include?(block_type.options['parent'] || block_type.name)\n\t\t\t:\n\t\t\tfalse\n\t\tend", "def move_one begTile\n @maze.get_adjacent_tiles(begTile).each do |tile|\n if (tile.is_floor) && (!@tiles.include? tile)\n @tiles.push tile\n self.move_one tile\n end\n end\n end", "def initialize\n @rooms = { #defines the rooms available for use on each floor\n :upstairs => [\"Master Bedroom\", \"A Guest Room\", \"Tower\", \"Balcony\", \"Observatory\", \"The Hole Room\"],\n :main => [\"Kitchen\", \"Library\", \"Study\", \"Dining Room\", \"Living Room\", \"Vault\"],\n :downstairs => [\"Furnace Room\", \"Chapel\", \"Storage Room\", \"The Pit\"]\n }\n\n @used_rooms = []\n @omen_count = 0 #Omens are a game event that change the story line. Once the omen count reaches 10 the haunt starts\n @player = Character.new\n intro #script\n entry_hall(\"Main Hallway\")\n game\n end", "def floor\n ru_floor_value = property_hash.get(\"Floor\").to_i\n return -1 if ru_floor_value == -1000\n return ru_floor_value\n end", "def carry_one() # Facing north on 1st Street. -- Carrier class\n turn_left()\n move() # Note: Error shutoff here if we try to carry\n # from 1st Street.\n put_beeper() \n turn_around()\n move()\n turn_left()\n clear_all()\n end", "def create\n @tower = Tower.new(params[:tower])\n\t\n\t#Vergabe der Koordinaten. Die Karte ist in vier Teile gteilt. Mittelpunkt ist 50/50\n\t#Es wird immer erst eine y Reihe ausgefüllt wobei der x Abstand zufällig bestimmt wird.\n\t#Es gibt 4 Startpunkte und somit $ reihen die abwechselnd gefüllt werden.\n\ttnortheast = Tower.where(:position => 'northeast')\n\ttnorthwest = Tower.where(:position => 'northwest')\n\ttsouthwest = Tower.where(:position => 'southwest')\n\ttsoutheast = Tower.where(:position => 'southeast')\n\tif tnortheast.last.nil? \n\t \n\t @tower.position = 'northeast'\n\t @tower.x = '51'\n\t @tower.y = '51'\n\t \n\telsif tnorthwest.last.nil?\n\t @tower.position = 'northwest'\n\t @tower.x = '49'\n\t @tower.y = '51'\n\t \n\telsif tsouthwest.last.nil?\n\t @tower.position = 'southwest'\n\t @tower.x = '49'\n\t @tower.y = '49'\n\t\n\telsif tsoutheast.last.nil?\n\t @tower.position = 'southeast'\n\t @tower.x = '51'\n\t @tower.y = '49'\n\t\n\telse\n\t \n\t if tsoutheast.count < tsouthwest.count\n\t if tsoutheast.last.x < 95\n\t @tower.position = 'southeast'\n\t \t @tower.x = tsoutheast.last.x + 1 + rand(5)\n\t \t @tower.y = tsoutheast.last.y\n\t \n\t else\n\t @tower.position = 'southeast'\n\t \t @tower.x = 51 + rand(4)\n\t \t @tower.y = tsoutheast.last.y - 1\n\t \n\t end\n\t \n\t \n\t \n\t \n\t elsif tsouthwest.count < tnorthwest.count\n\t if tsouthwest.last.x > 5\n\t @tower.position = 'southwest'\n\t \t @tower.x = tsouthwest.last.x - 1 - rand(5)\n\t \t @tower.y = tsouthwest.last.y \n\t \n\t else\n\t @tower.position = 'southwest'\n\t \t @tower.x = 49 - rand(4)\n\t \t @tower.y = tsouthwest.last.y - 1\n\t \n\t end\n\t \n\t elsif tnorthwest.count < tnortheast.count\n\t if tnorthwest.last.x > 5\n\t @tower.position = 'northwest'\n\t \t @tower.x = tnorthwest.last.x - 1 - rand(5)\n\t \t @tower.y = tnorthwest.last.y \n\t \n\t else\n\t @tower.position = 'northwest'\n\t \t @tower.x = 49 - rand(4)\n\t \t @tower.y = tnorthwest.last.y + 1\n\t \n\t end\n\t else\n\t if tnortheast.last.x < 95\n\t @tower.position = 'northeast'\n\t \t @tower.x = tnortheast.last.x + 1 + rand(5)\n\t \t @tower.y = tnortheast.last.y \n\t \n\t else\n\t @tower.position = 'northeast'\n\t \t @tower.x = 51 + rand(4)\n\t \t @tower.y = tnortheast.last.y + 1\n\t \n\t end\n\t \n\t \n\t end\n\tend\n\t\n\t#User_id wird zugewiesen\n\t@tower.user_id = current_user.id\n\t@tower.down2 = 'store 1'\n\n\t\n\t\n\t\n\t\n respond_to do |format|\n if @tower.save\n format.html { redirect_to @tower, :notice => 'Tower was successfully created.' }\n format.json { render :json => @tower, :status => :created, :location => @tower }\n \n #Coordinates für die MAp anlegen\n @c = Coordinate.new(params[:coordinates])\n @c.x = @tower.x\n @c.y = @tower.y\n @c.user_id = @tower.user_id\n @c.save\n \n else\n format.html { render :action => \"new\" }\n format.json { render :json => @tower.errors, :status => :unprocessable_entity }\n end\n end\n end", "def host_opens_door(car_location)\n case car_location\n when 2\n 3 # the only unpicked door with a goat\n when 3\n 2 # the only unpicked door with a goat\n else\n random.rand(2..3)\n end\n end", "def party\n parties.first\n end", "def populate_room\n unless @dungeon.first_room\n @enemy = Zarta::Enemy.new(@dungeon) if enemy_spawned\n end\n @dungeon.first_room = false\n @weapon = Zarta::Weapon.new(@dungeon) if weapon_spawned\n @stairs = stairs_spawned\n end", "def call_elevator elevator_number=0\n\t\t@elevators[elevator_number].add_to_floors_to_visit @floor_number\n\tend", "def move_party_horn\n\t\tif face_left?\n\t\t\t@party_horn.x = @x + \n\t\t\t\t\t\t\t(TILE_WIDTH/4 - PartyHorn::PARTY_HORN_TILE_WIDTH)\n\t\telse\n\t\t\t@party_horn.x = @x + 3 * TILE_WIDTH/4\n\t\tend\n\t\t@party_horn.y = @y + 3 * TILE_HEIGHT/5\n\t\t@party_horn.angle = @angle\n\tend", "def chest_room\n\tif @key_present\n\t\tputs \"You are in a small, round room.\"\n\t\tputs \"An empty chest rests on the floor in front of you.\"\n\t\tputs \"what do you do?\"\n\n\telsif !@key_present\n\t\tputs \"You are in a small, round room.\"\n\t\tputs \"On the floor in front of you is a small wooden chest.\"\n\t\tputs \"It doesn't look locked\"\n\t\tputs \"what do you do?\"\n\t\t@chest_open = false\n\t\t@key_present = false\n\tend\n\twhile true\n\t\tprompt; next_move = gets.chomp\n\n\t\tif next_move.downcase == \"h\" || next_move.downcase == \"help\"\n\t\t\thelp; prompt; next_move = gets.chomp\n\t\tend\n\t\tif next_move.downcase == \"i\" || next_move.downcase == \"inventory\"\n\t\t\tinventory; prompt; next_move = gets.chomp\n\t\tend\n\t\tif next_move.downcase == \"q\" || next_move.downcase == \"quit\" \n\t\t\tquit\n\t\tend\n\n\t\tif next_move.downcase == \"l\" || next_move.downcase == \"look\"\n\t\t\tputs \"This room is small...\"\n\t\t\tputs \"You see a small chest in the center of the room.\"\n\t\t\tputs \"There is an exit to the southeast.\"\n\t\telsif !@chest_open and !@key_present and (next_move.downcase == \"o chest\" || next_move == \"open chest\")\n\t\t\tputs \"inside the chest, you see a small, brass key.\"\n\t\t\t@chest_open = true\n\t\telsif @chest_open and !@key_present and (next_move.downcase == \"take key\" ||next_move.downcase == \"t key\" )\n\t\t\tputs \"you grab the key\"\n\t\t\t@key_present = true\n\t\t\t@inventory << \"key\"\n\t\telsif next_move.downcase == \"go southeast\" || next_move.downcase == \"g se\"\n\t\t\ttorch_room\n\t\telse puts \"Does not compute...\"\n\t\tend\n\tend\n\nend", "def test_possible_location_from_hospital_if_rand_is_one\r\n\t\toakland = City::new\r\n\t\trand_val = 1\r\n\t\thillman = oakland.generate_hospital_locs(oakland, rand_val)\r\n\r\n\t\tassert_equal hillman[0], \"Hillman\"\r\n\t\tassert_equal hillman[1][0], \"Foo St.\"\r\n\tend", "def first_guest\n guests.first\n end", "def go_left(the_maze, floor, position, steps)\r\n if can_go_left?(the_maze, floor, position)\r\n the_maze = the_maze.set(floor, the_maze[floor].set(position, \"m\"))\r\n walk_maze(the_maze, floor, position - 1, steps.push([floor, position]))\r\n else\r\n return Hamster.vector\r\n end\r\nend", "def elevators_at_floor(floor)\n\t\televators.select{|elevator| elevator.floor.eql? floor}\n\tend", "def show_create_option\n clear_screen\n puts \"The program accepts any numbers of floors and apartments per floor but, for a better look please create with a max of 10 apartments per floor.\\nThe alignment will depends of the size of your screen :).\\n\\n\"\nputs \"Please type the name of the building:\"\nprint \":> \"\nname = gets.chomp\nputs \"How many floors the build have ? \"\nprint \":> \"\nfloors = gets.chomp.to_i\nputs \"How many apartments per floor the build have ?\"\nprint \":> \"\napts_per_floor = gets.chomp.to_i\nif name.length > 0 && floors && apts_per_floor\n building = @rental.create_building(nil,name,floors,apts_per_floor)\n show_success_message_return\nelse\n puts \"\\nPlease type valid numbers and/or valid name\\n\"\n return_to_main_Screen\nend\nend", "def first_turn\n\t\tputs \"Player 1 starts.\"\n\t\thelp\n\t\tturn(@player1)\n\tend", "def can_request_to?(floor)\n return false unless (building && elevator)\n constraints = self[:floor_constraints];\n general_keys = GENERAL_CONSTRAINTS.keys & constraints.keys\n keys = general_keys.select{ |k| GENERAL_CONSTRAINTS[k][self, floor] }\n keys.push(floor) if constraints[floor].present?\n return true if (keys.length == 0 && building.is_valid_floor?(floor))\n keys.any? do |k|\n needed_resolver = constraints[k];\n resolver = elevator.method(needed_resolver) && elevator.method(needed_resolver).call()\n resolver && resolver.accesToBuilding?(building) && resolver.have_access_to?(floor)\n end\n end", "def firstname_first\n person.fullname_unknown? ? login : person.firstname_first rescue login\n end", "def initialize_floor_rec(m, n)\n cell = read_pos(m, n)\n\n # Change of values to \"floor\" or \"visited\"\n if cell == ' '\n write_pos(m, n, 's') # floor\n elsif cell == '.'\n write_pos(m, n, 'p') # visited goal\n elsif cell == '$'\n write_pos(m, n, 'd') # visited box\n elsif cell == '*'\n write_pos(m, n, 'a') # visited box\n end\n\n # If non-visited cell, test neighbours cells\n if !['#', 's', 'p', 'd', 'a'].include? cell\n initialize_floor_rec(m+1, n)\n initialize_floor_rec(m-1, n)\n initialize_floor_rec(m, n+1)\n initialize_floor_rec(m, n-1)\n end\n end", "def move_to_new_floor(char)\n case char\n when '('\n \treturn 1\n when ')'\n\t return -1\n\t else\n\t \treturn 0\n\tend\nend", "def elevator_print(floor)\r\n\t\televator_list.each do |elevator|\r\n\t\t\tif(floor.get_position == elevator.get_floor)\r\n\t\t\t\televator.to_s\r\n\t\t\tend\r\n\t\tend\r\n\t\tputs\r\n\tend", "def landing() end", "def who_goes_first()\n\n if rand()>0.5\n return 'computer'\n else\n return 'player'\n end \nend", "def enter_100k(num_rosters=1)\n contest_type = self.contest_types.where(\"name = '100k'\").first\n raise \"no 100k contest\" if contest_type.nil?\n system_user = User.where(:name => 'SYSTEM USER').first\n raise \"could not find system user\" if system_user.nil?\n num_rosters.times { Roster.generate(system_user, contest_type).fill_randomly.submit! }\n end", "def iam_street_leader(drain)\n if my_street(drain)\n current_user.has_role(2)\n else\n false\n end\n end", "def choose_first\n num = 1 + rand(2)\n puts \"Player #{num} will start the game.\"\n if num == 1\n @current_player = @player1\n else\n @current_player = @player2\n end\n end", "def start()\n\tputs \"%s\\n%s\\n%s\\n\" % [\"You are in a dark room.\",\"There is a door to your right and left.\",\"Which one do you take?\"]\n\tprompt; next_move = gets.chomp\n\n\tif next_move.downcase.include? \"left\"\n\t\tbear_room()\n\telsif next_move == \"right\"\n\t\tcthulu_room()\n\telse\n\t\tdead(\"You stumble around the room until you starve\")\n\tend\n\t\nend", "def floor() end", "def default_values\n # always uses the same elevator system\n self.elevator_system ||= ElevatorSystem.first\n # always starts on the first floor\n self.floor ||= Floor.where(number: 1).first\n end", "def floor_number=(value)\n @floor_number = value\n end", "def first_issue?\n issue_number == 1 \n end" ]
[ "0.63562083", "0.635385", "0.6142657", "0.6062916", "0.5928961", "0.590953", "0.58937776", "0.58755696", "0.58755696", "0.587166", "0.5847908", "0.5754528", "0.5699268", "0.569354", "0.56916875", "0.56616217", "0.5657832", "0.56007516", "0.5596173", "0.55952674", "0.5581229", "0.55769134", "0.5565708", "0.55579835", "0.5539984", "0.5513381", "0.55108917", "0.5500183", "0.54989535", "0.54941624", "0.54885924", "0.54723924", "0.546508", "0.54624546", "0.54618937", "0.5446281", "0.54380095", "0.5434326", "0.5431316", "0.5415715", "0.53676796", "0.53668815", "0.5362712", "0.5358487", "0.5357519", "0.5355749", "0.5343975", "0.53301406", "0.53241277", "0.53072554", "0.5298034", "0.5291377", "0.52854", "0.5282353", "0.5277267", "0.5271933", "0.5263811", "0.52360046", "0.52284366", "0.52284366", "0.5221205", "0.5204667", "0.5200252", "0.5188694", "0.51879543", "0.51869535", "0.5167002", "0.51638365", "0.51595515", "0.51468694", "0.5146313", "0.5140087", "0.512503", "0.5120462", "0.5119139", "0.5114311", "0.5109925", "0.51070625", "0.51005614", "0.5096173", "0.509196", "0.50906014", "0.507862", "0.5052684", "0.5045059", "0.5040943", "0.50401485", "0.503468", "0.50156546", "0.50125504", "0.5011264", "0.50010604", "0.4995009", "0.49939355", "0.49920908", "0.4989338", "0.49862477", "0.49816325", "0.49727863", "0.49669126" ]
0.6651826
0
Gets the next floor in some direction. Null if none
def get_next_floor(floor, direction) index = floor.number if direction.eql? :UP return floors[index+1] end if index-1 < 0 return nil end floors[index-1] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def final_floor\n floors.last\n end", "def get_floor()\n get_parent(\"FLOOR\")\n end", "def bottom_floor\n\t\t@flrs.first\n\tend", "def get_floor()\n get_parent(\"FLOOR\")\n end", "def direction\n target_floor <=> floor\n end", "def top_floor\n\t\t@flrs.last\n\tend", "def floor\n self\n end", "def floor\n self\n end", "def current_floor\n\t\t@current_floor\n\tend", "def which_floor(directions)\n\tfloor = 0\n\tdirections.split('').each do |direction|\n\t\tcase direction\n\t\twhen \"(\" then floor += 1\n\t\twhen \")\" then floor -= 1\n\t\tend\n\tend\n\tfloor\nend", "def floor\n self.class.new(x.floor, y.floor)\n end", "def floor(floor_number)\n\t\t@flrs[floor_number]\n\tend", "def floor()\n #This is a stub, used for indexing\n end", "def floor(key)\n position = search(key)\n return key if key == @keys[position]\n return nil if position == 0\n return @keys[position-1]\n end", "def floor\n ru_floor_value = property_hash.get(\"Floor\").to_i\n return -1 if ru_floor_value == -1000\n return ru_floor_value\n end", "def floor_number\n return @floor_number\n end", "def nextp pos, dir\n #It does not allow to step off the edges, so we check them out:\n if (pos<@w && (3..5).include?(dir)) or\n (pos+@w >= @grid.size && [0,1,7].include?(dir)) or\n (pos%@w == 0 && (5..7).include?(dir)) or\n (pos%@w+1 == @w && (1..4).include?(dir))\n return nil\n end\n # Remember: Directions = [[1,0],[1,1],[0,1],[-1,1],[-1,0],[-1,-1],[0,-1],[1,-1]]\n # Directions[dir][0] represents the movement in y index. Directions[dir][1] represents the movement in x index\n pos+Directions[dir][0]*@w+Directions[dir][1]\n end", "def go_to_next_floor\n puts \"Elevator #{@id}, currently at floor #{@current_floor}, is about to go to floor #{@next_floor}...\"\n puts \"=====================================================================\"\n \n while @current_floor != @next_floor\n if @movement == \"up\"\n @current_floor += 1\n elsif (@movement == \"down\")\n @current_floor -= 1\n end\n @floor_display.display_floor()\n end\n\n puts \"======================================================================\"\n puts \"Elevator #{@id} has reached its requested floor! It is now at floor #{@current_floor}.\"\n end", "def floor() end", "def get_start_floor(the_maze) \r\n the_maze.each_with_index do |floor, index| \r\n return index if get_start_position(floor) != nil \r\n end \r\nend", "def next\n units_sorted = self.order.units.sort_by {|unit| unit.id}\n if units_sorted.find_index(self) < units_sorted.length\n return units_sorted[units_sorted.find_index(self)+1]\n else\n return nil\n end\n end", "def move\n return if next_stop.nil?\n return @destinations.shift if at_destination?\n\n if next_stop > @current_floor\n @current_floor += 1\n else\n @current_floor -= 1\n end\n\n @current_floor\n end", "def next_direction #:nodoc:\n loop do\n direction = @tries.pop\n nx, ny = @maze.move(@x, @y, direction)\n\n if @maze.valid?(nx, ny) && (@maze[@x, @y] & (direction | (direction << Maze::UNDER_SHIFT)) == 0)\n if @maze[nx, ny] == 0\n return direction\n elsif !@maze.dead?(@maze[nx, ny]) && @maze.weave > 0 && rand(100) < @maze.weave\n # see if we can weave over/under the cell at (nx,ny)\n return direction if @maze.weave_allowed?(@x, @y, nx, ny, direction)\n end\n end\n\n while @tries.empty?\n if @stack.empty?\n @pending = false\n return nil\n else\n @x, @y, @tries = @stack.pop\n end\n end\n end\n end", "def floor\n end", "def next_path map, h, w\n\n\tlow = map[h][w].to_i\n\tlh = h\n\tlw = w\n\n\tif h - 1 >= 0\n\t\tnh = h - 1\n\t\tnw = w\n\t\tnorth = map[nh][nw].to_i\n\t\tif north < low\n\t\t\tlow = north\n\t\t\tlh = nh\n\t\t\tlw = nw\n\t\tend\n\tend\n\n\tif w - 1 >= 0\n\t\twh = h\n\t\tww = w - 1\n\t\twest = map[wh][ww].to_i\n\t\tif west < low\n\t\t\tlow = west\n\t\t\tlh = wh\n\t\t\tlw = ww\n\t\tend\n\tend\n\t\n\tif w + 1 < map[0].size\n\t\teh = h\n\t\tew = w + 1\n\t\teast = map[eh][ew].to_i\n\t\tif east < low\n\t\t\tlow = east\n\t\t\tlh = eh\n\t\t\tlw = ew\n\t\tend\n\tend\n\n\tif h + 1 < map.size\n\t\tsh = h + 1\n\t\tsw = w\n\t\tsouth = map[sh][sw].to_i\n\t\tif south < low\n\t\t\tlow = south\n\t\t\tlh = sh\n\t\t\tlw = sw\n\t\tend\n\tend\n\n\treturn lh, lw\nend", "def next\n begin\n self.band.levels[band.levels.index(self) + 1]\n rescue\n return nil\n end\n end", "def closest_floor(x, y)\n # create mark table and pending array\n table, pending = Table.new($game_map.width, $game_map.height), [[x, y]]\n # as long as there are pending coordinates\n while pending.size > 0\n # current coordinates\n cx, cy = pending.shift\n # if floor beneath\n if !Config::NO_FLOOR_TAGS.include?($game_map.terrain_tag(cx, cy))\n # return found coordinates\n return [cx, cy]\n end\n # mark current coordinates as checked\n table[cx, cy] = 1\n # add tiles around current coordinates if they were not marked yet\n pending.push([cx, cy+1]) if table[cx, cy+1] == 0\n pending.push([cx-1, cy]) if table[cx-1, cy] == 0\n pending.push([cx+1, cy]) if table[cx+1, cy] == 0\n pending.push([cx, cy-1]) if table[cx, cy-1] == 0\n end\n return [x, y]\n end", "def get_real_floor(n)\n n <= 0 ? n : (n > 13 ? n - 2 : n - 1)\nend", "def findElevator(currentFloor, direction)\n activeElevatorList = []\n idleElevatorList = []\n sameDirectionElevatorList = []\n for x in @elevatorsList\n if x.status != ElevatorStatus::IDLE #verify if elevator is active and if the request is on the elevator way\n if x.status == ElevatorStatus::UP and x.floor <= currentFloor or x.status == ElevatorStatus::DOWN and x.floor >= currentFloor\n activeElevatorList.append(x)\n end\n else\n idleElevatorList.append(x)\n end\n end\n\n if activeElevatorList.length > 0 #Create new list for elevators with same direction that the request\n sameDirectionElevatorList = activeElevatorList.select {|elevator| elevator.status == direction}\n end\n \n if sameDirectionElevatorList.length > 0\n bestElevator = findNearestElevator(currentFloor, sameDirectionElevatorList)\n else\n bestElevator = findNearestElevator(currentFloor, idleElevatorList)\n end\n \n return bestElevator\n end", "def floor\n push pop.floor\n end", "def floor_number(f)\n\t\t@flrs.index(f)\n\tend", "def get_direction()\n\n floor_difference = @elevator.current_floor - @floor\n if floor_difference > 0\n @direction = \"down\"\n else\n @direction = \"up\"\n end\n end", "def get_adjacent_floors tile\n floors = Array.new\n @maze.get_adjacent_tiles(tile).each do |tile|\n floors.push tile if tile.is_floor\n end\n floors\n end", "def next_position\n\n # change the direction when the number of a half spin\n # has been walked. Also increase the number of steps\n # in the next turn accordingly.\n if @steps_of_half_spin == 0\n @max_steps_in_dir += 1\n @steps_of_half_spin = 2 * @max_steps_in_dir\n @move_right_or_up = !@move_right_or_up\n @steps = 0\n end\n @steps_of_half_spin -= 1\n\n if @move_right_or_up\n if @steps < @max_steps_in_dir\n @x += 1\n @steps += 1\n else\n # up\n @y += 1\n end\n Pos2.new(@x, @y)\n else\n if @steps < @max_steps_in_dir\n # left\n @x -= 1\n @steps += 1\n else\n # down\n @y -= 1\n end\n Pos2.new(@x, @y)\n end\n end", "def request_floor(floor)\n if floor == self.current_floor\n print self.id 'floor button pushed, we are already on this floor, opening doors'\n elsif floor > self.current_floor\n self.a_floor_was_requested(floor)\n self.up_queue.append(floor)\n self.up_queue.sort\n self.set_direction\n self.request_this_elevator\n elsif floor < self.current_floor\n self.a_floor_was_requested(floor)\n self.down_queue.append(floor)\n self.up_queue.sort.reverse\n self.set_direction\n self.request_this_elevator\n end\n end", "def collision_floor\n return unless state.dy <= 0 # return unless player is going down or is as far down as possible\n player_rect = [state.x, next_y, state.tile_size, state.tile_size] # definition of player\n\n # Runs through all the sprites on the field and finds all intersections between player's\n # bottom and the top of a rect.\n floor_collisions = state.world_collision_rects\n .find_all { |r| r[:top].intersect_rect?(player_rect, state.collision_tolerance) }\n .first\n\n return unless floor_collisions # performs following changes if a collision has occurred\n state.y = floor_collisions[:top].top # y of player is set to the y of the colliding rect's top\n state.dy = 0 # no change in y because the player's path is blocked\n end", "def next\n if self[:next_ptr] == FFI::Pointer::NULL\n nil\n else\n BigBedInterval.new(self[:next_ptr])\n end\n end", "def request_this_elevator()\n self.set_direction\n self.status_update\n case self.direction\n when 0\n self.set_direction\n when 1\n if self.current_floor == self.up_queue[0]\n self.up_queue.shift\n self.status_update\n if self.down_queue.length + self.up_queue.length == 0\n self.direction = 0\n self.status_update\n self.here\n end\n else\n self.current_floor = self.current_floor + 1\n\n if self.up_queue.length > 0\n return self.request_this_elevator\n else\n self.direction = 0\n end\n end\n when -1\n if self.current_floor == self.down_queue[0]\n self.down_queue.shift\n self.status_update\n if self.down_queue.length + self.up_queue.length == 0\n self.direction = 0\n self.status_update\n self.here\n end\n else\n self.current_floor = self.current_floor - 1\n if self.down_queue.length > 0\n return self.request_this_elevator\n else\n self.direction = 0\n end\n end\n end\n end", "def move()\n if @direction == \"up\"\n move_up()\n elsif @direction == \"down\"\n move_down()\n else\n #check if anyone is on current floor- which way do majority want to go from here?\n @direction = people_on_current_floor()\n if @direction == \"up\" #were more ppl on this floor wanting to go up\n move_up()\n elsif @direction == \"down\"\n move_down()\n else #no one on this floor, decide direction based on pending rqsts above and below...\n decide_direction()\n end\n end\n end", "def get_next_room(rooms)\n r = rooms.shift\n\n # count previous r's visited, todo fixme\n @history.reverse_each do |h|\n if h.class != r\n break\n end\n\n r = rooms.shift\n end\n\n if not r\n throw :quit\n end\n\n # todo modify methods\n\n r\n end", "def floor\n round :floor\n end", "def floor(key)\n node_floor(@root, key)\n end", "def get_movement\n floor_difference = @current_floor - @requests_queue[0].floor\n if floor_difference > 0\n @movement = \"down\"\n else\n @movement = \"up\"\n end\n end", "def next_direction(current_direction, turn_direction)\n case turn_direction\n when \"L\"\n (current_direction - 1) % 4\n when \"R\"\n (current_direction + 1) % 4\n end\nend", "def next_move\n case Direction::DIRECTIONS[direction.current]\n when Direction::DIRECTIONS[0] # NORTH\n {x: 0, y: 1}\n when Direction::DIRECTIONS[1] # EAST\n {x: 1, y: 0}\n when Direction::DIRECTIONS[2] # SOUTH\n {x: 0, y: -1}\n when Direction::DIRECTIONS[3] # WEST\n {x: -1, y: 0}\n end\n end", "def next_spot\n\t\tif @location.nil?\n\t\t\tfirst()\t\t\n\t\telse\n\t\t\tmoving()\n\t\tend\n\tend", "def getnext(oid)\n roid=[]\n roid=self.oid2roid(oid) if (oid<=>self.oid) >= 0\n roid_first = roid.first\n return nil if roid_first and roid_first > @nodes.size-1\n @nodes.each_index do\n |index|\n next if roid_first and roid_first > index\n node = @nodes[index]\n node = node.getnext(oid) if node\n # I have some nil elements, but not the last\n next if not node\n return node\n end\n # It is not expected to get here\n return nil\n end", "def next_step\n\t\t# choose the next step based on the lowest absolute delta\n\t\tnext_step = [ delta_right_top, delta_right_mid, delta_right_bot ].min_by { |i| i[1].abs }\n\n\t\t# increase tot_elavation with the delta between current and next step\n\t\t@tot_elavation += next_step[1].abs\n\n\t\treturn next_step[0]\n\tend", "def find_closest_eligible_elevator(requested_direction, requested_floor)\n closest_eligible_elevator = elevators_sorted_by_call_proximity(requested_floor).detect do |e|\n e.eligible_for_pickup?(requested_direction, requested_floor)\n end\n if closest_eligible_elevator\n closest_eligible_elevator\n else\n find_closest_eligible_elevator(requested_direction, requested_floor)\n end\n end", "def next(direction)\n return false unless @settled\n \n case direction.cardinal_point\n when \"NORTH\" \n {x: x, y: y+1}\n when \"EAST\"\n {x: x+1, y: y}\n when \"SOUTH\"\n {x: x, y: y-1}\n when \"WEST\"\n {x: x-1, y: y}\n end \n end", "def next_move\n\t\tif @next_move.nil?\n\t\t\t@next_move = determine_next_move\n\t\tend\n\n\t\t@next_move\n\tend", "def get_next_box\n (1..@max_value).to_a.each do |a|\n next if @pos_count[a].nil? || @pos_count[a].empty?\n coord = @pos_count[a][-1]\n return @pos_count[a].pop if @board[coord.x][coord.y] == 0\n end\n\n return nil\n end", "def next\n return @next if defined? @next\n\n @next = course.levels.offset(level_number + 1).first\n end", "def get_object\n next_x = @cur_x + DIRECTION[@hero_direction][0]\n next_y = @cur_y + DIRECTION[@hero_direction][1]\n return if next_x < 0 || next_x > 14 || next_y < 0 || next_y > 14\n #look at new square in room\n next_square = @room[next_x][next_y]\n if next_square == CHAR_POTION || next_square == CHAR_CHEST || next_square == CHAR_IDOL\n @room[next_x][next_y] = CHAR_FLOOR\n draw_map(next_x,next_y)\n @potions += 1 if next_square == CHAR_POTION\n @treasure += 1 if next_square == CHAR_CHEST\n @idol_found = true if next_square == CHAR_IDOL\n @stats[:experience] += 0.25\n end\n end", "def floor\n RDF::Literal::Integer.new(to_d.floor)\n end", "def next_tile_img\n next_tile_img = @current_tile_indx + 1\n case @current_move\n when Direction::Up\n next_tile_img = 9 if next_tile_img > 11\n when Direction::Down\n next_tile_img = 0 if next_tile_img > 2\n when Direction::Left\n next_tile_img = 3 if next_tile_img > 5\n when Direction::Right\n next_tile_img = 6 if next_tile_img > 8\n end\n @current_tile_indx = next_tile_img\n end", "def hit_floor\n return nil if rising?\n what_object_hit_me_on_the :side => :bottom, :restrict => Standable, :look_ahead => 10, :margin_of_error => 25\n end", "def request_elevator(requested_floor, direction)\n if direction == \"up\"\n call_btn_to_press = @up_call_buttons.find { |btn| btn.floor == requested_floor } \n elsif direction == \"down\"\n call_btn_to_press = @down_call_buttons.find { |btn| btn.floor == requested_floor } \n end\n\n chosen_elevator = call_btn_to_press.press()\n chosen_elevator.do_requests()\n\n return chosen_elevator\n end", "def next_round\n if not @wind\n @wind = \"E\"\n @number = 1\n elsif @number == @mode\n if @wind == \"W\"\n printf \"Already in last possible round (West %d)!\\n\", @number\n return []\n else\n @wind = (@wind == \"E\" ? \"S\" : \"W\")\n @number = 1\n end\n else\n @number += 1\n end\n end", "def next_element_in_direction(point, direction, element)\n dirs = {\n 'UP' => [0, -1],\n 'DOWN' => [0, +1],\n 'LEFT' => [-1, 0],\n 'RIGHT' => [+1, 0],\n }\n\n (1..size).each do |distance|\n el = get_at(\n Point.new(\n (point.x + distance * dirs[direction].first),\n (point.y + distance * dirs[direction].last)\n )\n )\n\n return size if element == Codenjoy::Client::Games::Tetris::Board::ELEMENTS[:WALL]\n return distance if element == el\n end\n\n size\n end", "def whose_turn\n return nil if complete?\n return Direction[(self.dealer + calls.size) % 4]\n end", "def get_next_coords(direction)\n x, y = get_head_coords[:x], get_head_coords[:y]\n case direction\n when 'S'\n y += 1\n when 'N'\n y -= 1\n when 'E'\n x += 1\n when 'W'\n x -= 1\n end\n return x, y\n end", "def find_next node\r\n return if node == nil\r\n\r\n if node.left != nil\r\n return node.left\r\n end\r\n\r\n node.right\r\nend", "def find_next_tunnel\n @position.mark(:minotaurus) \n @position.tunnels.reverse.each { |tunnel|\n if not tunnel.marks.include?(:minotaurus) # timto tunelem minotaur jeste nesel \n tunnel.mark(:minotaurus)\n return tunnel \n end\n }\n \n return @position.tunnels[rand(@position.tunnels.size)] \n end", "def marked_floor?(floor = nil)\n floor ||= @current_floor\n marked_floors.include? floor\n end", "def racquetLeft(racquet)\n if racquet - 2 != 1 #If the leftermost part of the racket isn't in the left wall\n return racquet - 1 #return the current position but 1 to the left \n else\n return racquet\n end\nend", "def int_if_whole\n whole? ? floor : self\n end", "def next_cell\n if has_adjacent_cell?(@current_x, @current_y)\n @current_x += 1\n get_cell(@current_x-1, @current_y)\n elsif has_adjacent_row?(@current_x, @current_y)\n @current_y +=1\n @current_x = 0\n get_cell(@current_x, @current_y-1)\n elsif get_cell(@current_x, @current_y)\n @current_x += 1\n get_cell(@current_x-1, @current_y)\n else\n nil\n end\n end", "def get_next_property()\n return if !@property_reader.has_next\n\n line = @property_reader.next\n prop = nil\n case line[4]\n when Property_Consts::RAILROAD\n prop = Railroad.new(line[0].to_i, line[1].to_i, line[3])\n when Property_Consts::UTIL\n prop = Utility.new(line[0].to_i, line[1].to_i, line[3])\n else\n prop = Real_Estate.new(line[0].to_i, line[1].to_i, \n line[2].to_i, line[3], line[4])\n end\n @property_groups[line[4]].add_property(prop)\n\n return prop \n end", "def next\n room.players.where(\"id > ?\", id).first || room.players.first\n end", "def next(field=nil)\n field = field || self.class.by_star_field\n self.class.future(self.send(field.to_s.split(\".\").last)) { { :order => \"#{field} ASC\" }}.first\n end", "def next\n last? ? nil : locate + 1\n end", "def move_to_new_floor(char)\n case char\n when '('\n \treturn 1\n when ')'\n\t return -1\n\t else\n\t \treturn 0\n\tend\nend", "def get_next_position(last_position, orientation)\n case orientation\n when ORIENTATION_WEST\n [last_position[0],last_position[1]-1]\n when ORIENTATION_SOUTH\n [last_position[0]+1,last_position[1]]\n when ORIENTATION_EAST\n [last_position[0],last_position[1]+1]\n when ORIENTATION_NORTH\n [last_position[0]-1,last_position[1]]\n else\n puts \"Invalid orientation\"\n end\n end", "def get_next_player(start)\n for i in 1..10\n to_check = (start + i)%10 + 10\n if self.players.where(:location => to_check).length == 1\n player = self.players.where(:location => to_check)[0]\n if player.in_hand\n return player.location\n end\n end\n end\n return -10\n end", "def next_infinity_puzzle\n if @user.present?\n infinity_puzzles_after(\n latest_difficulty,\n last_solved_infinity_puzzle_id(latest_difficulty)\n ).first\n else\n InfinityLevel.easy.first_puzzle\n end\n end", "def next_station\n return @current_station if @current_station == @route.last\n\n @route.stations[@route.stations.index(@current_station) + 1]\n end", "def get_next_free_projectile\n i = 0\n while i < $Projectiles.length \n if !$Projectiles[i].flying?\n return i\n break\n end\n i += 1 \n end\n \n ### default if all projectiles are up in the air\n p \"Too many projectiles, replacing #1\"\n return 1\n end", "def go_right(the_maze, floor, position, steps)\r\n if can_go_right?(the_maze, floor, position)\r\n the_maze = the_maze.set(floor, the_maze[floor].set(position, \"m\"))\r\n walk_maze(the_maze, floor, position + 1, steps.push([floor, position]))\r\n else\r\n return Hamster.vector\r\n end\r\nend", "def requestFloor(floor)\n puts \"The elevator is requested to move to floor #{floor}.\"\n @floorRequestList.push(floor)\n sortFloorList()\n puts \"Elevator is moving.\"\n moveElevator()\n puts \"Elevator is #{@status}.\"\n doorController()\n if @floorRequestList.length() == 0\n @direction = nil\n @status = 'idle'\n end\n puts \"Elevator is #{@status}.\"\n end", "def racquetRight(racquet)\n\tif racquet + 2 != SCREEN_X-1 #If the rightermost part of the racket isn't in the right wall\n return racquet + 1 #return the current position but 1 to the right\n else \n return racquet\n end\nend", "def get_next_player\n crnt_plyr_indx = @game.user.index(@game.whoseTurn)\n temp_usr_array = @game.user.rotate(crnt_plyr_indx)\n if(@game.clockwise) then\n return User.find(temp_usr_array[1])\n else\n return User.find(temp_usr_array[-1])\n end\n end", "def next\n Photo.find_by_id(next_id) if next?\n end", "def people_on_current_floor()\n floors = @building.floors\n curr_floor = floors[@current_floor]\n wanting_up = curr_floor.up_person_queue\n wanting_down = curr_floor.down_person_queue\n if wanting_up.size() == 0 && wanting_down.size() == 0\n return \"stationary\"\n elsif wanting_up.size() > wanting_down.size()\n return \"up\"\n else # there are more or as many ppl wanting to go down\n return \"down\"\n end\n end", "def floor_label\n return @floor_label\n end", "def whole?\n floor == self\n end", "def floor_height(floor)\n\t\tfloors.index(floor)\n\tend", "def requestElevator(floor, direction)\n puts \"A request for an elevator is made from floor #{floor}, going #{direction}.\"\n elevator = findBestElevator(floor, direction)\n puts \"Elevator #{elevator.elevatorId} is the best elevator, so it is sent.\"\n elevator.elevatorFloorRequestList.push(floor)\n elevator.sortFloorList()\n puts \"Elevator is moving.\"\n elevator.moveElevator()\n puts \"Elevator is #{elevator.elevatorStatus}.\"\n elevator.doorController()\n return elevator\n end", "def move_one begTile\n @maze.get_adjacent_tiles(begTile).each do |tile|\n if (tile.is_floor) && (!@tiles.include? tile)\n @tiles.push tile\n self.move_one tile\n end\n end\n end", "def next_objective\n next_obj = turn.listen.first\n return unless next_obj\n next_direction = turn.direction_of next_obj\n if turn.feel(next_direction).stairs?\n empty_directions = DIRECTIONS.select do |dir|\n turn.feel(dir).empty?\n end\n empty_directions.first\n else\n next_direction\n end\n end", "def findNearestElevator(currentFloor, selectedList)\n bestElevator = selectedList[0]\n bestDistance = (selectedList[0].floor - currentFloor).abs #abs() returns the absolute value of a number (always positive).\n \n for elevator in selectedList\n if (elevator.floor - currentFloor).abs < bestDistance\n bestElevator = elevator\n end\n end\n \n puts \"\"\n puts \" >> >>> ELEVATOR #{bestElevator.id} WAS CALLED <<< <<\"\n return bestElevator\n end", "def next_move\n moves.max{ |a, b| a.rank <=> b.rank }\n end", "def traverse room, direction\n case direction.to_sym\n when :right\n return @graph[room.coords[:y]][room.coords[:x] + 1] unless room.is_right?\n when :left\n return @graph[room.coords[:y]][room.coords[:x] - 1] unless room.is_left?\n when :up\n return @graph[room.coords[:y] - 1][room.coords[:x]] unless room.is_top?\n when :down\n return @graph[room.coords[:y] + 1][room.coords[:x]] unless room.is_bottom?\n end\n\n return false\n end", "def lower_right\n @lower_right ||= world.point(x_max, y_min)\n end", "def go_up\n self.current_floor += 1\n end", "def next_lesson\n lesson = section.lessons.where(\"row_order > ?\", self.row_order).rank(:row_order).first\n if lesson.blank? && section.next_section\n return section.next_section.lessons.rank(:row_order).first\n end\n return lesson\n end", "def next_position\n return unless placed?\n axis = case direction\n when 'east', 'west'; :x\n when 'north', 'south'; :y\n end\n amount = case direction\n when 'north', 'east'; +1\n when 'south', 'west'; -1\n end\n [@x + (axis == :x ? amount : 0), @y + (axis == :y ? amount : 0)]\n end", "def next_location(direction)\n @current_location + DIRECTION_VECTORS[direction]\n end", "def floor!(target: COMMON_SCALE_FACTORS)\n round!(target: target, direction: -1)\n end", "def add_floor\n @floor = @grid.collect { |v| v[1] }.max + 2\n\n (@min_width - 1000..@max_width + 1000).each do |x|\n @grid.add([x, @floor])\n end\n end" ]
[ "0.67037153", "0.6505092", "0.64765006", "0.6474116", "0.6282751", "0.611801", "0.60640556", "0.60640556", "0.60054207", "0.59677625", "0.5936604", "0.5917364", "0.58984685", "0.5876322", "0.587606", "0.58666646", "0.5860661", "0.5828403", "0.5820148", "0.5804088", "0.5693502", "0.569196", "0.56778735", "0.56725967", "0.5647378", "0.5606451", "0.56010294", "0.5594029", "0.558425", "0.5562653", "0.55333585", "0.5499823", "0.5470708", "0.5454318", "0.5447862", "0.5435968", "0.5432239", "0.543182", "0.54218316", "0.5391598", "0.5380636", "0.5368177", "0.53562635", "0.5353547", "0.5336827", "0.53258735", "0.53059477", "0.5290239", "0.52719086", "0.5268905", "0.5263401", "0.52473766", "0.5243805", "0.52188855", "0.5199025", "0.51776254", "0.51630944", "0.51565915", "0.5147145", "0.51418364", "0.5140363", "0.51313096", "0.512841", "0.51077664", "0.5090385", "0.5088276", "0.5075593", "0.5072572", "0.5056122", "0.5028132", "0.5018796", "0.50128996", "0.49946803", "0.49925426", "0.4982488", "0.49817297", "0.497623", "0.49439666", "0.49438897", "0.49434528", "0.49376413", "0.49363527", "0.4935097", "0.49305493", "0.4930125", "0.49217847", "0.49101722", "0.4909839", "0.49055126", "0.48925707", "0.4889072", "0.488363", "0.48774385", "0.48768502", "0.4876036", "0.4875747", "0.48753506", "0.48734415", "0.4867365", "0.48652375" ]
0.8604733
0
Gets the least recently used elevator
def lru_elevator elevator = elevators.shift elevators.push(elevator) elevator end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def elevator\n elevators.sort_by { |e| e.stop_count }.first\n end", "def findNearestElevator(currentFloor, selectedList)\n bestElevator = selectedList[0]\n bestDistance = (selectedList[0].floor - currentFloor).abs #abs() returns the absolute value of a number (always positive).\n \n for elevator in selectedList\n if (elevator.floor - currentFloor).abs < bestDistance\n bestElevator = elevator\n end\n end\n \n puts \"\"\n puts \" >> >>> ELEVATOR #{bestElevator.id} WAS CALLED <<< <<\"\n return bestElevator\n end", "def next_elevator\n strategies.map { |strategy| strategy.elevator(elevators, request) }.first\n end", "def findElevator(currentFloor, direction)\n activeElevatorList = []\n idleElevatorList = []\n sameDirectionElevatorList = []\n for x in @elevatorsList\n if x.status != ElevatorStatus::IDLE #verify if elevator is active and if the request is on the elevator way\n if x.status == ElevatorStatus::UP and x.floor <= currentFloor or x.status == ElevatorStatus::DOWN and x.floor >= currentFloor\n activeElevatorList.append(x)\n end\n else\n idleElevatorList.append(x)\n end\n end\n\n if activeElevatorList.length > 0 #Create new list for elevators with same direction that the request\n sameDirectionElevatorList = activeElevatorList.select {|elevator| elevator.status == direction}\n end\n \n if sameDirectionElevatorList.length > 0\n bestElevator = findNearestElevator(currentFloor, sameDirectionElevatorList)\n else\n bestElevator = findNearestElevator(currentFloor, idleElevatorList)\n end\n \n return bestElevator\n end", "def lowest\n @level_order.first\n end", "def get_min()\n # O(1) time\n @min.last\n end", "def choose_elevator\n elevator_scores = []\n\n for elevator in @column.elevator_list do\n \n # Initialize score to 0\n score = 0\n floor_difference = elevator.current_floor - @floor\n\n # Prevents use of any offline/under-maintenance elevators\n if elevator.status != \"online\"\n score = -1\n elevator_scores.append(score)\n else\n\n # Bonify score based on difference in floors\n if floor_difference == 0\n score += 5000\n else\n score += 5000/(floor_difference.abs() + 1)\n end\n \n # Bonify score based on direction (highest priority)\n if elevator.movement != \"idle\"\n if floor_difference >= 0 and @direction == \"down\" and elevator.movement == \"down\"\n \n # Paths are crossed going down, therefore favor this elevator\n score += 10000\n \n elsif floor_difference <= 0 and @direction == \"up\" and elevator.movement == \"up\"\n\n # Paths are crossed going down, therefore favor this elevator\n score += 10000\n \n else\n \n # Paths are not crossed, therefore try avoiding the use of this elevator\n score = 0\n \n # Give redemption points, in worst case scenario where all elevators never cross paths\n next_floor_difference = elevator.next_floor - @floor\n if next_floor_difference == 0\n score += 500\n else\n score += 500/(next_floor_difference.abs() + 1)\n end\n end\n end\n\n # Bonify score on request queue size (the smaller number of pre-existing requests, the faster therefore the better)\n if elevator.requests_queue.length() <= 3\n score += 1000\n elsif elevator.requests_queue.length() <= 7\n score += 250\n end\n \n # Send total score of elevator to the scores list\n elevator_scores.append(score)\n end\n end\n\n # Get value of highest score\n highest_score = -1\n for score in elevator_scores do\n if (score > highest_score)\n highest_score = score\n end\n end\n \n # Get elevator with the highest score (or nil if all elevators were offline\n chosen_elevator = nil\n if (highest_score > -1)\n chosen_elevator = @column.elevator_list[elevator_scores.find_index(highest_score)]\n puts \"Chosen elevator: Elevator #{chosen_elevator.id}\"\n end\n return chosen_elevator\n end", "def peekMin()\n @store[1]\n end", "def find_closest_eligible_elevator(requested_direction, requested_floor)\n closest_eligible_elevator = elevators_sorted_by_call_proximity(requested_floor).detect do |e|\n e.eligible_for_pickup?(requested_direction, requested_floor)\n end\n if closest_eligible_elevator\n closest_eligible_elevator\n else\n find_closest_eligible_elevator(requested_direction, requested_floor)\n end\n end", "def least\n nil\n end", "def find_nearest_elevator(elevator_direction, request_location)\n elevators = find_elevators_by_direction(elevator_direction)\n elevators.each { |elevator| elevator.distance_score = (request_location - elevator.current_floor).abs }\n return elevators.min { |a, b| a.distance_score <=> b.distance_score }\n end", "def find_min_locator\n return nil if empty?\n use_min\n mode_call(:find_min_loc)\n end", "def get_min\n minimum = @store.pop\n until @store.empty?\n element = @store.pop\n if minimum > element\n minimum = element\n end\n end\n minimum\n end", "def min\n @keys[0]\n end", "def latest_early_allocation\n early_allocations.last\n end", "def latest_early_allocation\n early_allocations.last\n end", "def top_floor\n\t\t@flrs.last\n\tend", "def min\n @store.peek[:min] unless empty?\n end", "def min_key\n min_k, min_time = nil, @time\n @store.each {|k, v|\n if v.time < min_time \n min_k, min_time = k, v.time\n end\n }\n return min_k\n end", "def smallest_task(tasks)\n tasks.min_by { |task| task.arrival_time }\n end", "def get_min()\n return self.min_stack[-1]\n end", "def get_min()\n @min_stack[-1]\n end", "def minimum_lead_time\n return @minimum_lead_time\n end", "def get_min()\n @min_stack[-1]\n end", "def min() time[1] end", "def earliest\n earliest_order.first\n end", "def earliest(key, min)\n _request_id, time = @store.zrangebyscore(key, \"(#{min}\", '+inf', withscores: true, limit: [0, 1]).first\n time\n end", "def get_min_key()\n \n end", "def find_min()\r\n self.min\r\n end", "def min\n return @t_min\n end", "def earliest!\n earliest_order!.first\n end", "def requestElevator(floor, direction)\n puts \"A request for an elevator is made from floor #{floor}, going #{direction}.\"\n elevator = findBestElevator(floor, direction)\n puts \"Elevator #{elevator.elevatorId} is the best elevator, so it is sent.\"\n elevator.elevatorFloorRequestList.push(floor)\n elevator.sortFloorList()\n puts \"Elevator is moving.\"\n elevator.moveElevator()\n puts \"Elevator is #{elevator.elevatorStatus}.\"\n elevator.doorController()\n return elevator\n end", "def earliest_interview_timeblock_start\n interview_timeblocks.find(:first, :order => 'start_time').start_time\n end", "def get_top_point\n return calculate_top_point_internal\n end", "def min()\n return stack.stack.last[:min]\n end", "def checkBestElevator(scoreToCheck, newElevator, bestElevatorInfo, floor)\n #If elevators situation is more favourable\n if scoreToCheck < bestElevatorInfo[1]\n bestElevatorInfo[1] = scoreToCheck\n bestElevatorInfo[0] = newElevator\n bestElevatorInfo[2] = (newElevator.elevatorCurrentFloor - floor).abs\n #If elevators are in a similar situation, set the closest one to the best elevator\n elsif bestElevatorInfo[1] == scoreToCheck\n gap = (newElevator.elevatorCurrentFloor - floor).abs\n if bestElevatorInfo[2] > gap\n bestElevatorInfo[1] = scoreToCheck\n bestElevatorInfo[0] = newElevator\n bestElevatorInfo[2] = gap\n end\n end\n return bestElevatorInfo \n end", "def cheapest_restaurant\n cheapest_price = menu_items.map {|item| item.price}.min\n restaurants.find do |restaurant| \n restaurant.menu_items.find {|item| item.price == cheapest_price}\n end\n end", "def find_elevators_by_direction(elevator_direction)\n same_direction = @elevator_list.select { |elevator| elevator.direction == elevator_direction }\n idle = @elevator_list.select { |elevator| elevator.direction.zero? }\n if same_direction.length > 0\n return same_direction\n else\n return idle\n end\n end", "def get_min()\n end", "def get_min()\n @array[-1][1]\n end", "def find_min_priority\n loc = find_min_locator and [loc.value, loc.priority]\n end", "def personal_best_split_time()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = TimeRef.new(Native.Segment_personal_best_split_time(@handle.ptr))\n result\n end", "def top()\n @store.last\n end", "def find_available_driver\n longest_ago_last_trip = Time.now\n longest_ago_last_trip_driver = nil\n @drivers.each do |driver|\n next if !driver.is_available?\n return driver if driver.trips.empty? # driver has never had a trip\n last_trip_end_time = get_last_trip_end_time(driver)\n if last_trip_end_time < longest_ago_last_trip\n longest_ago_last_trip = last_trip_end_time\n longest_ago_last_trip_driver = driver\n end\n end\n return longest_ago_last_trip_driver\n end", "def getSurroundingLowestElevations(parent)\n\t\tx = parent.x\n\t\ty = parent.y\n\t\tcost = 0\n\t\tmin = nil\n\t\twaterFound = false\n\t\twater = nil\n\t\tmin_list = Array.new\n\t\t\n\t\t#search nodes around parent node\n\t\tfor i in (x-1..x+1)\n\t\t\tfor j in (y-1..y+1)\n\t\t\t\t#if its not the parent node\n\t\t\t\tif (i != x or j != y)\n\t\t\t\t\ttemp = @map[check_xy(i)][check_xy(j)]\n\t\t\t\t\t\n\t\t\t\t\t#if we've managed to find the ocean or some other water\n\t\t\t\t\tif temp.type != \"Land\"\n\t\t\t\t\t\twaterFound = true\n\t\t\t\t\t\twater = @river_struct.new parent, check_xy(i), check_xy(j), find_angle(parent, check_xy(i), check_xy(j)), parent.ttd-1\n\t\t\t\t\telsif (temp.elevation != -1 and temp.type == \"Land\")\n\t\t\t\t\t\tif min == nil or temp.elevation < @map[min.x][min.y].elevation\n\t\t\t\t\t\t\tmin_list.clear\n\t\t\t\t\t\t\tmin = @river_struct.new parent, check_xy(i), check_xy(j), find_angle(parent, check_xy(i), check_xy(j)), parent.ttd-1\n\t\t\t\t\t\t\tmin_list.push(min)\n\t\t\t\t\t\telsif temp.elevation == @map[min.x][min.y].elevation\n\t\t\t\t\t\t\tmin_list.push(@river_struct.new parent, check_xy(i), check_xy(j), find_angle(parent, check_xy(i), check_xy(j)), parent.ttd-1)\n\t\t\t\t\t\tend\n\t\t\t\t\t\t\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t#if water has been found clear other options and use that node\n\t\tif waterFound\n\t\t\tmin_list.clear\n\t\t\tmin_list.push(water)\n\t\tend\n\t\t\n\t\treturn min_list\n\t\t\n\tend", "def load_elevator\n while(@elevator.has_room? && @floors[0].is_empty?)\n @elevator.enter(@floors[0].dequeue)\n end\n end", "def next_lowest_node\n ary = ordered_lock_children()\n my_idx = ary.index(lock_basename)\n\n raise WeAreTheLowestLockNumberException if my_idx == 0\n\n ary[(my_idx - 1)] \n end", "def youngest_person\n # ???\nend", "def get_min\n @min ||= calculate_min\n end", "def best_time(event)\n registrant_best_times.find_by(event: event) || registrant_choices.joins(:event_choice).merge(EventChoice.where(cell_type: \"best_time\", event: event)).first\n end", "def find_min\n loc = find_min_locator and loc.value\n end", "def select_driver_with_earliest_end_of_trip(only_available)\n earliest_end_time = Time.now\n right_driver = nil\n\n only_available.each do |sub_array|\n\n return right_driver = sub_array[0] if sub_array[1] == nil\n\n if\n sub_array[1].end_time < earliest_end_time\n earliest_end_time = sub_array[1].end_time\n right_driver = sub_array[0]\n end\n end\n return right_driver\n end", "def popular_starting_station\n Trip.popular_starting_station\n end", "def get_min()\n @min\n end", "def time_of_oldest_vote\n from_time = Time.now.utc\n if first=countings.find(:first, :order => 'created_at ASC')\n from_time=first.created_at if first.created_at<from_time\n end\n from_time\n end", "def earliest_restorable_time\n data[:earliest_restorable_time]\n end", "def higher_item\n return nil unless in_list?\n conditions = scope_condition.merge!( less_than_me )\n order_by_position(conditions).last\n end", "def earliest_mpost\n earliest = nil\n block = Proc.new {|cluster|\n mpost = cluster.earliest_mpost\n if mpost \n earliest = mpost if (earliest == nil ||\n earliest.trigger_time > mpost.trigger_time)\n end\n }\n raw_clusters.each(&block)\n processed_clusters.each(&block)\n return earliest\n end", "def find_guard_with_most_sleep\n @guard_map.max_by { |_k, v| v[:total_sleep] }[0]\n end", "def newest\n unless newest?\n return self.class.unscoped.where(_id: self.tll_top).first\n end\n\n self\n end", "def higher_item\n return nil unless in_list?\n higher_items(1).first\n end", "def getMin()\n element=@store[1]\n\n #copy last element to the first...\n @store[1]=@store[@store.length-1]\n @store.delete_at(@store.length-1) #delete the last element \n\n #We need to restore the Heap Structure if altered\n heapify(1)\n return element\n end", "def min\n @nodes.first\n end", "def min\n MSPhysics::Newton::Hinge.get_min(@address)\n end", "def currently_winning_offer\n offers.where('user_id IS NOT NULL').order(cents: :desc, created_at: :asc).first\n end", "def optimal_operating_level generator, time=nil\n operating_level = 0\n generators.ordered_by_marginal_cost(game, time).inject(0) do |level, gen|\n capacity_shortfall = demand(time) - level\n met_capacity = [gen.capacity, capacity_shortfall].min\n level += met_capacity\n\n if gen == generator\n operating_level = met_capacity\n break\n end\n break if capacity_shortfall <= 0\n level\n end\n operating_level\n end", "def top()\n @a.last\n end", "def better_my_min\n min = self.first\n self.each do |el|\n min = el if el < min\n end\n min\n end", "def minimum\n return @minimum\n end", "def take_worst\n roll_all.min\n end", "def get_start_node\n return @nodes.reduce{|sum, pair| pair[0] < sum[0] ? pair : sum}[1] \n end", "def best_segment_time()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = TimeRef.new(Native.Segment_best_segment_time(@handle.ptr))\n result\n end", "def get_most_frequent_client\n client, request_count = @client_counter.max_by{|k, v| v}\n return client\n end", "def first_location\n\t\t@first_location ||= sorted_locations.first\n\tend", "def get_ponderated_best\n # Maybe better trace if no results collected\n # @best_results.exists? ? Timing.new() : @ponderated_time\n @ponderated_time\n end", "def first()\n @tiers.each do |tier|\n unless tier.empty?()\n return tier[0]\n end\n end\n \n return nil\n end", "def higher_item\n return nil unless in_list?\n conditions = scope_condition.merge!(less_than_me)\n order_by_position(conditions).last\n end", "def oldest\n @messages.first\n end", "def topup_start\n nil\n end", "def top()\n @queue[0]\n end", "def min\n return nil if @root.nil?\n\n min_node(@root).key\n end", "def first\n check_corrupted\n cache_ele if @eles.empty?\n return @eles.first\n end", "def getLatest()\n return Gesellschafter.get(self.Mnr)\n end", "def first_used_on\n w = workouts.order(\"date ASC\").first\n if w.present?\n w.date\n else\n nil\n end\n end", "def left_most(points)\n (points.sort_by! {|x| x[0]}).first\nend", "def next_clean_time(addr) \n #Figure out side of the street\n side = self.get_side(addr) \n \n #Find all blocks that match Street Address \n all_blocks = self.blocks\n blocks = all_blocks.where(\"side = ? AND bottom <= ? AND top >= ?\", side, addr, addr)\n if blocks == []\n return nil\n else \n #Compute the next cleaning times for the block and pick the smallest(i.e. the soonest) time\n cts = Array.new\n blocks.each{|x|cts << x.ct.next_time}\n best = cts.min\n return best, blocks[0].id\n end\n end", "def request_this_elevator()\n self.set_direction\n self.status_update\n case self.direction\n when 0\n self.set_direction\n when 1\n if self.current_floor == self.up_queue[0]\n self.up_queue.shift\n self.status_update\n if self.down_queue.length + self.up_queue.length == 0\n self.direction = 0\n self.status_update\n self.here\n end\n else\n self.current_floor = self.current_floor + 1\n\n if self.up_queue.length > 0\n return self.request_this_elevator\n else\n self.direction = 0\n end\n end\n when -1\n if self.current_floor == self.down_queue[0]\n self.down_queue.shift\n self.status_update\n if self.down_queue.length + self.up_queue.length == 0\n self.direction = 0\n self.status_update\n self.here\n end\n else\n self.current_floor = self.current_floor - 1\n if self.down_queue.length > 0\n return self.request_this_elevator\n else\n self.direction = 0\n end\n end\n end\n end", "def top\n return @top\n end", "def top\n return @top\n end", "def lowest_scoring_visitor\n @teams.min_by { |team| team.average_away_goals }.team_name\n end", "def last_used_item(); $game_temp.last_used_item; end", "def trade_start(g)\n\treturn g.values.min\nend", "def getTripPlannedTime()\n return @tripPlannedTimeList.last() ;\n end", "def index\n @offers = Offer.newer_first\n end", "def get_key\n return nil if @available_keys.empty?\n key = -1\n @mutex.synchronize do\n key = @available_keys.shift[0]\n @keys[key][:ct] = Time.now.to_i\n end\n key\n end", "def find_min\r\n return nil if !@head\r\n cursor = @head\r\n min = cursor.data\r\n while cursor\r\n if cursor.data < min\r\n min = cursor.data\r\n end\r\n cursor = cursor.next\r\n end\r\n return min\r\n end", "def delete_min_locator\n return nil if empty?\n use_min\n loc = mode_call(:find_min_loc)\n @heapsize = mode_call(:delete_loc, loc)\n loc\n end", "def findLeastCostNode(costs, unvisitedNodes) \n leastNode = nil\n cheapest = Float::INFINITY\n unvisitedNodes.each do |node| \n if (costs[node][:cost] < cheapest)\n leastNode = node\n end\n end\n return leastNode\n end", "def get_best_timing_for_meeting(meeting, event_type, pool_type)\n best_mir = get_best_mir_for_meeting(meeting, event_type, pool_type)\n best_mir ? best_mir.get_timing_instance : nil\n end", "def min_key\n @root.nil? ? nil : min_recursive(@root)\n end" ]
[ "0.7771511", "0.6347878", "0.6231966", "0.6077467", "0.6055815", "0.60232586", "0.5946853", "0.5874243", "0.58694595", "0.585302", "0.583759", "0.5824085", "0.58099127", "0.57684267", "0.5753982", "0.5753982", "0.5745518", "0.57222766", "0.5704716", "0.5584582", "0.55843043", "0.5583594", "0.55697966", "0.5566599", "0.5555937", "0.5532634", "0.5532432", "0.5529919", "0.55197126", "0.55158293", "0.5452564", "0.5442869", "0.5414493", "0.5413256", "0.5407306", "0.5406672", "0.5382778", "0.5380031", "0.53762937", "0.5366788", "0.5356419", "0.53249156", "0.5324693", "0.531906", "0.53145987", "0.5312705", "0.5310429", "0.53037983", "0.529801", "0.5281494", "0.52780914", "0.5253163", "0.52500063", "0.52384907", "0.5236602", "0.5232357", "0.5223583", "0.5220945", "0.5217678", "0.52160096", "0.52101433", "0.520756", "0.52052456", "0.5204282", "0.520204", "0.5196441", "0.5191292", "0.5186635", "0.5185893", "0.5181153", "0.5172669", "0.51708484", "0.51606435", "0.51585877", "0.5153624", "0.5151082", "0.5148887", "0.51472855", "0.5146595", "0.5140339", "0.5137614", "0.5133344", "0.51266235", "0.51207393", "0.5115214", "0.5111925", "0.5107479", "0.51073134", "0.51073134", "0.5106407", "0.51030976", "0.50964373", "0.5094923", "0.5093415", "0.5092877", "0.50898504", "0.50830907", "0.50795954", "0.5069516", "0.5067233" ]
0.6084479
3
Gets all the elevators at a specific floor
def elevators_at_floor(floor) elevators.select{|elevator| elevator.floor.eql? floor} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def findElevator(currentFloor, direction)\n activeElevatorList = []\n idleElevatorList = []\n sameDirectionElevatorList = []\n for x in @elevatorsList\n if x.status != ElevatorStatus::IDLE #verify if elevator is active and if the request is on the elevator way\n if x.status == ElevatorStatus::UP and x.floor <= currentFloor or x.status == ElevatorStatus::DOWN and x.floor >= currentFloor\n activeElevatorList.append(x)\n end\n else\n idleElevatorList.append(x)\n end\n end\n\n if activeElevatorList.length > 0 #Create new list for elevators with same direction that the request\n sameDirectionElevatorList = activeElevatorList.select {|elevator| elevator.status == direction}\n end\n \n if sameDirectionElevatorList.length > 0\n bestElevator = findNearestElevator(currentFloor, sameDirectionElevatorList)\n else\n bestElevator = findNearestElevator(currentFloor, idleElevatorList)\n end\n \n return bestElevator\n end", "def itemsOnFloor(input, floor)\n input.select { |key, value| value == floor}.keys - [:elevator]\nend", "def create_elevators\n @elevator_number.times do |i|\n floor_gap = @building.floors / @elevator_number * i\n elevator_list.append(Elevator.new(i, 1 + floor_gap, 1 + floor_gap))\n end\n end", "def get_floor()\n get_parent(\"FLOOR\")\n end", "def get_floor()\n get_parent(\"FLOOR\")\n end", "def current_company_floors(company_id)\n current_company_floors_ar = []\n company_offices_in_this_building = self.offices.where(company_id: company_id)\n company_offices_in_this_building.each do |office|\n current_company_floors_ar << office.floor\n end\n current_company_floors_ar\n end", "def create_elevator_list\n \n for elevatorID in 1..Column.num_elevators do\n elevator = Elevator.new(elevatorID)\n elevator.create_floor_buttons()\n @elevator_list.append(elevator)\n end\n end", "def add_elevators(starting_floor, number_of_elevators)\n\t\tnumber_of_elevators.times do\n\t\t\te = Elevator.new(starting_floor, @elevator_strategy)\n\t\t\t@elevators << e\n\t\t\t@sim.register(e)\n\t\tend\n\tend", "def floor(floor_number)\n\t\t@flrs[floor_number]\n\tend", "def addFloorToFloorList(floor)\n @floorList.append(floor)\n puts \"Elevator#{@id} - floor #{floor} added to floorList\"\n end", "def get_adjacent_floors tile\n floors = Array.new\n @maze.get_adjacent_tiles(tile).each do |tile|\n floors.push tile if tile.is_floor\n end\n floors\n end", "def elevator_print(floor)\r\n\t\televator_list.each do |elevator|\r\n\t\t\tif(floor.get_position == elevator.get_floor)\r\n\t\t\t\televator.to_s\r\n\t\t\tend\r\n\t\tend\r\n\t\tputs\r\n\tend", "def getelevators\n puts params\n elid = params[\"columnid\"]\n\n elevators = Elevator.where(:column_id => elid)\n\n puts elevators.inspect\n \n respond_to do |format|\n format.json { render json: elevators }\n end\n end", "def requestElevator(floor, direction)\n puts \"A request for an elevator is made from floor #{floor}, going #{direction}.\"\n elevator = findBestElevator(floor, direction)\n puts \"Elevator #{elevator.elevatorId} is the best elevator, so it is sent.\"\n elevator.elevatorFloorRequestList.push(floor)\n elevator.sortFloorList()\n puts \"Elevator is moving.\"\n elevator.moveElevator()\n puts \"Elevator is #{elevator.elevatorStatus}.\"\n elevator.doorController()\n return elevator\n end", "def requestFloor(floor)\n puts \"The elevator is requested to move to floor #{floor}.\"\n @floorRequestList.push(floor)\n sortFloorList()\n puts \"Elevator is moving.\"\n moveElevator()\n puts \"Elevator is #{@status}.\"\n doorController()\n if @floorRequestList.length() == 0\n @direction = nil\n @status = 'idle'\n end\n puts \"Elevator is #{@status}.\"\n end", "def createFloorDoorsList\n for x in 1..@numberOfFloors do\n @floorDoorsList.append(Door.new(x, DoorStatus::CLOSED, x))\n # puts \"elevator#{@id} door floor #{@floorDoorsList[x - 1].id} created\"\n end\n end", "def list_all_rooms_in_hotel\n\n return @rooms.map { |room| room }\n end", "def elevator\n elevators.sort_by { |e| e.stop_count }.first\n end", "def makeElevator\n for elevatorID in 1..@amountOfElevators\n elevator = Elevator.new(elevatorID, 'idle', @amountOfFloors, 1)\n @elevatorsList.push(elevator)\n end\n end", "def call_elevator elevator_number=0\n\t\t@elevators[elevator_number].add_to_floors_to_visit @floor_number\n\tend", "def findNearestElevator(currentFloor, selectedList)\n bestElevator = selectedList[0]\n bestDistance = (selectedList[0].floor - currentFloor).abs #abs() returns the absolute value of a number (always positive).\n \n for elevator in selectedList\n if (elevator.floor - currentFloor).abs < bestDistance\n bestElevator = elevator\n end\n end\n \n puts \"\"\n puts \" >> >>> ELEVATOR #{bestElevator.id} WAS CALLED <<< <<\"\n return bestElevator\n end", "def current_floor\n\t\t@current_floor\n\tend", "def find_closest_eligible_elevator(requested_direction, requested_floor)\n closest_eligible_elevator = elevators_sorted_by_call_proximity(requested_floor).detect do |e|\n e.eligible_for_pickup?(requested_direction, requested_floor)\n end\n if closest_eligible_elevator\n closest_eligible_elevator\n else\n find_closest_eligible_elevator(requested_direction, requested_floor)\n end\n end", "def createElevatorsList\n for x in 1..@numberOfElevators do\n @elevatorsList.append(Elevator.new(x, @numberOfFloors, 1, ElevatorStatus::IDLE, SensorStatus::OFF, SensorStatus::OFF))\n # puts \"elevator#{@id} created\"\n end\n end", "def elevations\n if (elems = self.points.first.elems) && elems.has_key?('ele')\n self.points.map { |p| p.elems['ele'] }\n else\n nil\n end\n end", "def find_elevators_by_direction(elevator_direction)\n same_direction = @elevator_list.select { |elevator| elevator.direction == elevator_direction }\n idle = @elevator_list.select { |elevator| elevator.direction.zero? }\n if same_direction.length > 0\n return same_direction\n else\n return idle\n end\n end", "def request_elevator(requested_floor, direction)\n if direction == \"up\"\n call_btn_to_press = @up_call_buttons.find { |btn| btn.floor == requested_floor } \n elsif direction == \"down\"\n call_btn_to_press = @down_call_buttons.find { |btn| btn.floor == requested_floor } \n end\n\n chosen_elevator = call_btn_to_press.press()\n chosen_elevator.do_requests()\n\n return chosen_elevator\n end", "def bottom_floor\n\t\t@flrs.first\n\tend", "def get_next_floor(floor, direction)\n\t\tindex = floor.number\n\t\tif direction.eql? :UP\n\t\t\treturn floors[index+1]\n\t\tend\n\t\tif index-1 < 0\n\t\t\treturn nil\n\t\tend\n\t\tfloors[index-1]\n\tend", "def list_all_rooms\n return @rooms\n end", "def state\n\t\t@flrs.each do |f|\n\t\t\tputs \"Floor #{@flrs.index(f)} has #{f.passengers.length} passengers waiting.\"\n\t\tend\n\t\t@elevators.each do |e|\n\t\t\tputs \"Elevator #{@elevators.index(e)} is in floor #{@flrs.index(e.current_floor)}, #{e.direction} with #{e.passengers.length} passengers\"\n\t\tend\n\tend", "def final_floor\n floors.last\n end", "def requestElevator(requestedFloor, direction)\n if direction == ButtonDirection::UP\n @buttonsUpList[requestedFloor-1].status = ButtonStatus::ON\n else\n @buttonsDownList[requestedFloor-2].status = ButtonStatus::ON\n end\n\n puts \">> Someone request an elevator from floor <#{requestedFloor}> and direction <#{direction}> <<\"\n for x in @elevatorsList do\n puts \"Elevator#{x.id} | Floor: #{x.floor} | Status: #{x.status}\"\n end\n\n bestElevator = findElevator(requestedFloor, direction)\n bestElevator.addFloorToFloorList(requestedFloor) \n bestElevator.moveElevator(requestedFloor, self)\n end", "def floor\n ru_floor_value = property_hash.get(\"Floor\").to_i\n return -1 if ru_floor_value == -1000\n return ru_floor_value\n end", "def get_exterior_surfaces()\n surfaces = Array.new()\n @space.get_children().each do |child|\n\n if child.commandName == \"EXTERIOR-WALL\" ||\n child.commandName == \"ROOF\"\n surfaces.push(child)\n end\n end\n return surfaces\n end", "def floor\n self\n end", "def floor\n self\n end", "def floors_available\n available_floors_array = all_floors\n self.offices.each do |office|\n available_floors_array.delete(office.floor)\n end\n available_floors_array\n end", "def room_items(r)\n (r.z1..r.z2).each { |z|\n ((r.x1 & -16)..r.x2).step(16) { |x|\n ((r.y1 & -16)..r.y2).step(16) { |y|\n df.map_tile_at(x, y, z).mapblock.items_tg.each { |i|\n yield i if i.flags.on_ground and i.pos.x >= r.x1 and i.pos.x <= r.x2 and i.pos.y >= r.y1 and i.pos.y <= r.y2 and i.pos.z == z\n }\n }\n }\n }\n end", "def room_items(r)\n (r.z1..r.z2).each { |z|\n ((r.x1 & -16)..r.x2).step(16) { |x|\n ((r.y1 & -16)..r.y2).step(16) { |y|\n df.map_tile_at(x, y, z).mapblock.items_tg.each { |i|\n yield i if i.flags.on_ground and i.pos.x >= r.x1 and i.pos.x <= r.x2 and i.pos.y >= r.y1 and i.pos.y <= r.y2 and i.pos.z == z\n }\n }\n }\n }\n end", "def set_floor\n @floor = Floor.find(params[:id])\n end", "def set_floor\n @floor = Floor.find(params[:id])\n end", "def floor\n end", "def top_floor\n\t\t@flrs.last\n\tend", "def show\n @rooms = Room.all.where(floor_id: @floor.id)\n\n # преобразование массива точек в строку для SVG.js (для полигонов этажей):\n # @showPointsOfFloor = []\n # polygons_ids = Polygon.all.where(imageable_id: @floor.id).map{ |i| i.id }\n # polygons_ids.each do |i|\n # @showPointsOfFloor << Point.all.where(polygon_id: i)\n # .sort_by{ |j| j[:priority] }\n # .map{ |j| \"#{j.ox}, #{j.oy}\" }\n # .join(\" \")\n # end\n\n # преобразование массива точек в строку для SVG.js (для полигонов аудиторий):\n @showPointsOfRooms = []\n @showNamesOfRooms = []\n polygons_ids = Polygon.all.where(imageable_id: Room.all.where(floor_id: @floor.id))\n polygons_ids.each do |i|\n @showPointsOfRooms << Point.all.where(polygon_id: i.id )\n .sort_by{ |j| j[:priority] }\n .map{ |j| \"#{j.ox}, #{j.oy}\" }\n .join(\" \")\n @showNamesOfRooms << Room.all.where(id: i.imageable_id)[0].name\n end\n end", "def parse(num)\n yml_array = YAML.load_file(File.join(__dir__,\"floors/floor\"+num.to_s+\".yml\"))\n count = 1\n rooms = []\n yml_array.each do |table|\n rd = RoomData.new\n table[count].each do |key, val|\n case key\n when \"label\"\n rd.label = val\n if is_extra_room?(rd.label)\n @extra += 1\n end\n when \"enemies\"\n val.each do |enemy_type, locations|\n case enemy_type\n when \"caterpillars\"\n rd.caterpillars = locations\n when \"nymphs\"\n rd.nymphs = locations\n when \"cocoons\"\n rd.cocoons = locations\n when \"dragonflies\"\n rd.dragonflies = locations\n when \"butterflies\"\n rd.butterflies = locations\n end\n end\n when \"boss\"\n rd.boss = val\n when \"background\"\n rd.room_background = val\n else\n end\n end\n rooms << rd\n count+=1\n end\n return rooms\n end", "def build_in_floors\n\n\t\t\t\t_in_floors = []\n\n\t\t\t\tdef _parseFloors string\n\t\t\t\t\t# Format\n\t\t\t\t\tstring = string.gsub(/[^0-9\\-,]/, '')\n\n\t\t\t\t\tlist = []\n\t\t\t\t\tstring.split(',').each do |s|\n\t\t\t\t\t\t# remove redundancy\n\t\t\t\t\t\tvalue = s.gsub(/\\-.*\\-/, '-').split('-')\n\n\t\t\t\t\t\t# case: just a number\n\t\t\t\t\t\tif value.length == 1\n\t\t\t\t\t\t\tlist << value[0].to_i\n\t\t\t\t\t\t# case: in range\n\t\t\t\t\t\telse \n\t\t\t\t\t\t\t# case: full param\n\t\t\t\t\t\t\tif value[0].present? && value[1].present?\n\t\t\t\t\t\t\t\tvalue[0] = value[0].to_i\n\t\t\t\t\t\t\t\tvalue[1] = value[1].to_i\n\n\t\t\t\t\t\t\t\t# exchange for correct format (increase)\n\t\t\t\t\t\t\t\tif value[0] > value[1]\n\t\t\t\t\t\t\t\t\ttemp = value[0]\n\t\t\t\t\t\t\t\t\tvalue[0] = value[1]\n\t\t\t\t\t\t\t\t\tvalue[1] = temp\n\t\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\t\t\t(value[0]..value[1]).each do |v|\n\t\t\t\t\t\t\t\t\tlist << v\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t# case: one in => same a number\n\t\t\t\t\t\t\telsif value[0].present?\n\t\t\t\t\t\t\t\tlist << value[0].to_i\n\t\t\t\t\t\t\telsif value[1].present?\n\t\t\t\t\t\t\t\tlist << value[1].to_i\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\tlist.uniq.sort\n\t\t\t\tend\n\n\t\t\t\tfloor_infos_text.each do |_info|\n\t\t\t\t\t_parseFloors(_info['floors']).each do |_floor_number|\n\t\t\t\t\t\t_floor_info = FloorRealEstate.where(real_estate_id: id, floor: _floor_number).first_or_initialize(status: 'unavailable')\n\n\t\t\t\t\t\t_floor_info.label = label.gsub(/{f(:.*)*}/) do |match|\n\t\t\t\t\t\t\tmatch = match.split(':')\n\t\t\t\t\t\t\tnext _floor_number if (match.count == 1)\n\n\t\t\t\t\t\t\t_strFloor = _floor_number.to_s\n\t\t\t\t\t\t\tmatch[1] = match[1].to_i\n\t\t\t\t\t\t\tif match[1].present?\n\t\t\t\t\t\t\t\tnext _strFloor.rjust(match[1], '0')\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tnext _floor_number\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\t_floor_info.floor = _floor_number\n\n\t\t\t\t\t\tif _info['sell_price'].present?\n\n\t\t\t\t\t\t\tif _info['sell_floor_coefficient'].present?\n\t\t\t\t\t\t\t\t_coefficient = _info['sell_floor_coefficient']\n\n\t\t\t\t\t\t\t\t# Replace operator\n\t\t\t\t\t\t\t\t# x => *\n\t\t\t\t\t\t\t\t_coefficient = _coefficient.gsub(/x(?!(^{)*})/i, '*')\n\t\t\t\t\t\t\t\t# : => /\n\t\t\t\t\t\t\t\t_coefficient = _coefficient.gsub(/:(?!(^{)*})/, '/')\n\t\t\t\t\t\t\t\t# \\D & operator => ''\n\t\t\t\t\t\t\t\t_coefficient = _coefficient.gsub(/[^\\d\\+\\-\\*\\/\\(\\)\\{\\}](?!(^{)*})/, '')\n\t\t\t\t\t\t\t\t# ++ => +\n\t\t\t\t\t\t\t\t_coefficient = _coefficient.gsub(/\\+[\\+\\-\\*\\/](?!(^{)*})/, '+')\n\t\t\t\t\t\t\t\t_coefficient = _coefficient.gsub(/\\-[\\+\\-\\*\\/](?!(^{)*})/, '-')\n\t\t\t\t\t\t\t\t_coefficient = _coefficient.gsub(/\\*[\\+\\-\\*\\/](?!(^{)*})/, '*')\n\t\t\t\t\t\t\t\t_coefficient = _coefficient.gsub(/\\/[\\+\\-\\*\\/](?!(^{)*})/, '/')\n\n\t\t\t\t\t\t\t\t# Calc\n\t\t\t\t\t\t\t\t_floor_info.sell_price = eval(_coefficient.gsub('{f}', _floor_number.to_s).gsub('{p}', _info['sell_price'].to_s))\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t_floor_info.sell_price = _info['sell_price']\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\t\t\t_floor_info.sell_price_text = ApplicationHelper.read_money _floor_info.sell_price\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\tif _info['rent_price'].present?\n\n\t\t\t\t\t\t\tif _info['rent_floor_coefficient'].present?\n\t\t\t\t\t\t\t\t_coefficient = _info['rent_floor_coefficient']\n\n\t\t\t\t\t\t\t\t# Replace operator\n\t\t\t\t\t\t\t\t# x => *\n\t\t\t\t\t\t\t\t_coefficient = _coefficient.gsub(/x(?!(^{)*})/i, '*')\n\t\t\t\t\t\t\t\t# : => /\n\t\t\t\t\t\t\t\t_coefficient = _coefficient.gsub(/:(?!(^{)*})/, '/')\n\t\t\t\t\t\t\t\t# \\D & operator => ''\n\t\t\t\t\t\t\t\t_coefficient = _coefficient.gsub(/[^\\d\\+\\-\\*\\/\\(\\)\\{\\}](?!(^{)*})/, '')\n\t\t\t\t\t\t\t\t# ++ => +\n\t\t\t\t\t\t\t\t_coefficient = _coefficient.gsub(/\\+[\\+\\-\\*\\/](?!(^{)*})/, '+')\n\t\t\t\t\t\t\t\t_coefficient = _coefficient.gsub(/\\-[\\+\\-\\*\\/](?!(^{)*})/, '-')\n\t\t\t\t\t\t\t\t_coefficient = _coefficient.gsub(/\\*[\\+\\-\\*\\/](?!(^{)*})/, '*')\n\t\t\t\t\t\t\t\t_coefficient = _coefficient.gsub(/\\/[\\+\\-\\*\\/](?!(^{)*})/, '/')\n\n\t\t\t\t\t\t\t\t# Calc\n\t\t\t\t\t\t\t\t_floor_info.rent_price = eval(_coefficient.gsub('{f}', _floor_number.to_s).gsub('{p}', _info['rent_price'].to_s))\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t_floor_info.rent_price = _info['rent_price']\n\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\t\t_floor_info.rent_price_text = ApplicationHelper.read_money _floor_info.rent_price\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\t_floor_info.save\n\t\t\t\t\t\t_in_floors << _floor_info\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\tin_floor = _in_floors\n\t\t\t\tsave\n\t\t\t\tlabel\n\t\t\tend", "def index\n @floors = Floor.all\n end", "def display_floor\n sleep($sleep_time)\n puts \"... Elevator #{@elevator.id}'s current floor mid-travel #{@elevator.current_floor} ...\"\n end", "def floor_number\n return @floor_number\n end", "def moveElevator(requestedFloor, requestedColumn)\n while @floorList.length() != 0\n if @status == ElevatorStatus::IDLE\n if @floor < requestedFloor\n @status = ElevatorStatus::UP\n elsif @floor == requestedFloor\n openDoors($waitingTime)\n deleteFloorFromList(requestedFloor)\n requestedColumn.buttonsUpList[requestedFloor-1].status = ButtonStatus::OFF\n requestedColumn.buttonsDownList[requestedFloor-1].status = ButtonStatus::OFF\n @floorButtonsList[requestedFloor-1].status = ButtonStatus::OFF\n else\n @status = ElevatorStatus::DOWN\n end\n end\n\n if @status == ElevatorStatus::UP\n moveUp(requestedColumn)\n else\n moveDown(requestedColumn)\n end\n\n end\n end", "def floor_seat_map(floor)\n floor_seats(floor)\n .group_by(&:row)\n .sort_by(&:first)\n .map do |row, row_seats|\n # TODO: reverse order?\n row_seats.sort_by(&:col)\n end\n end", "def adjacent_rooms(map, y, x)\n \n north = map[y-1][x]\n south = map[y+1][x]\n west = map[y][x-1]\n east = map[y][x+1]\n\n [north, south, west, east]\nend", "def request_floor(elevator, requested_floor)\n floor_btn_to_press = elevator.floor_buttons.find { |btn| btn.floor == requested_floor } \n \n floor_btn_to_press.press()\n elevator.do_requests()\n end", "def which_floor(directions)\n\tfloor = 0\n\tdirections.split('').each do |direction|\n\t\tcase direction\n\t\twhen \"(\" then floor += 1\n\t\twhen \")\" then floor -= 1\n\t\tend\n\tend\n\tfloor\nend", "def index\n @params = params.permit(:building, :floor)\n \n @buildings = Place.distinct.pluck(:building)\n @floors = Place.where(building:params[:building]).distinct.order(:floor).pluck(:floor) if @params[:building]\n @current_user_place = current_user.place\n if @params[:building] && @params[:floor]\n @cells = Place.where(building: @params[:building], floor: @params[:floor]).order(:room, :id).includes(:user).group_by{|i| i.cell}\n end\n end", "def create_floor_buttons\n for floor in 1..Elevator.num_floors do\n button = FloorButton.new(floor, self)\n @floor_buttons.append(button)\n end\n end", "def set_floor\n @floor = Floor.with_deleted.find(params[:id])\n end", "def floor_height(floor)\n\t\tfloors.index(floor)\n\tend", "def hit_floor\n return nil if rising?\n what_object_hit_me_on_the :side => :bottom, :restrict => Standable, :look_ahead => 10, :margin_of_error => 25\n end", "def get_elevator\n if params[:column].present?\n @elevators = Column.find(params[:column]).elevators\n else\n @elevators = Column.all\n end\n if request.xhr?\n respond_to do |format|\n format.json {\n render json: {elevators: @elevators}\n }\n end\n end\n end", "def add_floor\n @floor = @grid.collect { |v| v[1] }.max + 2\n\n (@min_width - 1000..@max_width + 1000).each do |x|\n @grid.add([x, @floor])\n end\n end", "def index\n @floors = Floor.all.order('number ASC')\n authorize! :manage, Floor\n end", "def get_all_rooms(params = {})\n res = call_api(:method => :get, :uri => @api_base.merge(\"room\"), :query_params => params)\n return unless res.successful?\n Rooms.new(res.data)\n end", "def requestFloor(requestedFloor, requestedColumn)\n puts \"\" \n puts \">> Someone inside the elevator#{@id} wants to go to floor <#{requestedFloor}> <<\"\n checkWeight($maxWeight)\n checkObstruction()\n addFloorToFloorList(requestedFloor)\n moveElevator(requestedFloor, requestedColumn)\n end", "def index\n @workrooms = @floor ? @floor.workrooms : Workroom.all\n end", "def choose_elevator\n elevator_scores = []\n\n for elevator in @column.elevator_list do\n \n # Initialize score to 0\n score = 0\n floor_difference = elevator.current_floor - @floor\n\n # Prevents use of any offline/under-maintenance elevators\n if elevator.status != \"online\"\n score = -1\n elevator_scores.append(score)\n else\n\n # Bonify score based on difference in floors\n if floor_difference == 0\n score += 5000\n else\n score += 5000/(floor_difference.abs() + 1)\n end\n \n # Bonify score based on direction (highest priority)\n if elevator.movement != \"idle\"\n if floor_difference >= 0 and @direction == \"down\" and elevator.movement == \"down\"\n \n # Paths are crossed going down, therefore favor this elevator\n score += 10000\n \n elsif floor_difference <= 0 and @direction == \"up\" and elevator.movement == \"up\"\n\n # Paths are crossed going down, therefore favor this elevator\n score += 10000\n \n else\n \n # Paths are not crossed, therefore try avoiding the use of this elevator\n score = 0\n \n # Give redemption points, in worst case scenario where all elevators never cross paths\n next_floor_difference = elevator.next_floor - @floor\n if next_floor_difference == 0\n score += 500\n else\n score += 500/(next_floor_difference.abs() + 1)\n end\n end\n end\n\n # Bonify score on request queue size (the smaller number of pre-existing requests, the faster therefore the better)\n if elevator.requests_queue.length() <= 3\n score += 1000\n elsif elevator.requests_queue.length() <= 7\n score += 250\n end\n \n # Send total score of elevator to the scores list\n elevator_scores.append(score)\n end\n end\n\n # Get value of highest score\n highest_score = -1\n for score in elevator_scores do\n if (score > highest_score)\n highest_score = score\n end\n end\n \n # Get elevator with the highest score (or nil if all elevators were offline\n chosen_elevator = nil\n if (highest_score > -1)\n chosen_elevator = @column.elevator_list[elevator_scores.find_index(highest_score)]\n puts \"Chosen elevator: Elevator #{chosen_elevator.id}\"\n end\n return chosen_elevator\n end", "def power_levels\n client.api.get_power_levels(id)\n end", "def set_floor\n @floor = Floor.find_by(id: params[:floor_id])\n end", "def floor\n self.class.new(x.floor, y.floor)\n end", "def go_to_next_floor\n puts \"Elevator #{@id}, currently at floor #{@current_floor}, is about to go to floor #{@next_floor}...\"\n puts \"=====================================================================\"\n \n while @current_floor != @next_floor\n if @movement == \"up\"\n @current_floor += 1\n elsif (@movement == \"down\")\n @current_floor -= 1\n end\n @floor_display.display_floor()\n end\n\n puts \"======================================================================\"\n puts \"Elevator #{@id} has reached its requested floor! It is now at floor #{@current_floor}.\"\n end", "def index\n @floor_ammenities = Floor::Ammenity.all\n end", "def all_rooms\n @rooms.each do |room|\n puts \"Room Number: #{room.number} | Nightly Rate: #{room.cost}\"\n end \n end", "def index\n @floor_plans = @location.floor_plans\n end", "def createFloorButtonsList\n for x in 1..@numberOfFloors do\n @floorButtonsList.append(Button.new(x, ButtonStatus::ON, x))\n # puts \"elevator#{@id} button floor #{@floorButtonsList[x - 1].id} created\"\n end\n end", "def closest_floor(x, y)\n # create mark table and pending array\n table, pending = Table.new($game_map.width, $game_map.height), [[x, y]]\n # as long as there are pending coordinates\n while pending.size > 0\n # current coordinates\n cx, cy = pending.shift\n # if floor beneath\n if !Config::NO_FLOOR_TAGS.include?($game_map.terrain_tag(cx, cy))\n # return found coordinates\n return [cx, cy]\n end\n # mark current coordinates as checked\n table[cx, cy] = 1\n # add tiles around current coordinates if they were not marked yet\n pending.push([cx, cy+1]) if table[cx, cy+1] == 0\n pending.push([cx-1, cy]) if table[cx-1, cy] == 0\n pending.push([cx+1, cy]) if table[cx+1, cy] == 0\n pending.push([cx, cy-1]) if table[cx, cy-1] == 0\n end\n return [x, y]\n end", "def updateDisplays(elevatorFloor)\n for display in @floorDisplaysList\n display.floor = elevatorFloor\n end\n \n puts \"Displays show ##{elevatorFloor}\"\n end", "def step\n\t\t@elevators.each do |elevator|\n\t\t\tif elevator.current_floor == @floor_number\n\t\t\t\twhile !@persons_queue.empty?\n\t\t\t\t\tif elevator.number_of_occupants < elevator.max_capacity\n\t\t\t\t\t\televator.add_occupant @persons_queue.shift\n\t\t\t\t\telse\n\t\t\t\t\t\tbreak\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def compute_dungeon_corners\n @d_top_left_x = @d_top_left_y = @d_bottom_right_x = @d_bottom_right_y = 0\n @rooms.each do |room|\n top_left_x, top_left_y, bottom_right_x, bottom_right_y = room.room_corners\n\n @d_top_left_x = top_left_x if top_left_x < @d_top_left_x\n @d_top_left_y = top_left_y if top_left_y < @d_top_left_y\n\n @d_bottom_right_x = bottom_right_x if bottom_right_x > @d_bottom_right_x\n @d_bottom_right_y = bottom_right_y if bottom_right_y > @d_bottom_right_y\n end\n end", "def available_floorplans(search=nil)\n @available_floorplans ||= begin\n if search\n search.floorplans_for(self).joins(:units).where(\"units.rent_min > 0\")\n else\n self.floorplans.joins(:units).\n where(\"units.rent_min > 0\").\n order('name','bedrooms_count, bathrooms_count').\n group(\"floorplans.id\")\n end\n end\n end", "def get_area\n\n # Finds the floor and space parents and assigns them to @floor and @space\n # variables to be used later\n parent = get_parents\n parent.each do |findcommand|\n if ( findcommand.commandName == \"FLOOR\" )\n @floor = findcommand\n end\n if ( findcommand.commandName == \"SPACE\")\n @space = findcommand\n end\n end\n\n # Get the keyword value for location\n begin\n location = get_keyword_value(\"LOCATION\")\n rescue\n end\n\n # Get the keyword value for polygon\n begin\n polygon_id = get_keyword_value(\"POLYGON\")\n rescue\n end\n\n # if the polygon_id keyword value was nil and the location value was nil, then\n # the height and width are directly defined within the \"roof\" command\n\n\n if ( location == \"BOTTOM\" || location == \"TOP\") && (@space.get_shape != \"BOX\")\n return @space.polygon.get_area\n\n elsif ( location == nil && polygon_id == nil )\n height = get_keyword_value(\"HEIGHT\")\n width = get_keyword_value(\"WIDTH\")\n height = height.to_f\n width = width.to_f\n return height * width\n elsif ( location == nil && polygon_id != nil)\n return @space.polygon.get_area\n\n\n # if the location was defined as \"SPACE...\", it is immediately followed by a\n # vertex, upon which lies the width of the roof\n elsif location.match(/SPACE.*/)\n location = location.sub( /^(.{6})/, \"\")\n width = @space.polygon.get_length(location)\n height = @floor.get_space_height\n return width * height\n # if the shape was a box, the width and height would be taken from the\n # \"SPACE\" object\n elsif ( @space.get_shape == \"BOX\" )\n width = @space.get_width\n height = @space.get_height\n return width * height\n else\n raise \"The area could not be evaluated\"\n end\n end", "def get_door_area()\n get_children_area(\"DOOR\")\n end", "def deleteFloorFromList(stopFloor)\n index = @floorList.find_index(stopFloor)\n if index > -1\n @floorList.delete_at(index)\n end\n end", "def unit_idlers\n world.units.active.find_all { |u|\n unit_isidler(u)\n }\n end", "def floor()\n #This is a stub, used for indexing\n end", "def get_rooms(request_parameters)\r\n http_service.request_get(\"/json/bookings.getRooms\", request_parameters)\r\n # https://distribution-xml.booking.com/json/bookings.getRooms?rows=10&hotel_ids=121543\r\n end", "def rune_all(data_version = nil)\n rune_list = get(resource_path('rune'), @version, runeListData: 'all', version: data_version)\n RiotGamesApi::LOL::Model::StaticData::RuneList.new rune_list\n end", "def elevator_incidents\n @elevator_incidents ||= ElevatorIncident.get_by_station(self)\n end", "def floor\n round :floor\n end", "def index\n @rooms = Room.all.map do |rm|\n Room.cleanFetch(rm, current_user)\n end\n end", "def get_around_estates\n\n\t\t# center_x = 121.7155930000\n\t\t# center_y = 25.1215410000\n\t\t# delta_x = 0.00772495\n\t\t# delta_y = 0.01102129\n\n\t\tcenter_x = params[:center_x].to_f\n \tcenter_y = params[:center_y].to_f\n \tdelta_x = params[:delta_x].to_f\n \tdelta_y = params[:delta_y].to_f\n\n\n \tcritera = \"x_long IS NOT NULL and y_lat IS NOT NULL\"\n \tborder = \"and x_long > #{center_x - delta_x} and x_long < #{center_x + delta_x} and y_lat > #{center_y - delta_y} and y_lat < #{center_y + delta_y}\" \n\n \titems = Realestate.select(\"id, estate_group, x_long, y_lat\").where(\"#{critera} #{border}\").paginate(:page => 1, :per_page => 10)\n\n \trender :json => items\n\n\tend", "def list_reserved_rooms\n unless @rooms.empty?\n @rooms.each do |key, room|\n puts room.report_lister\n end\n end\n end", "def get_start_floor(the_maze) \r\n the_maze.each_with_index do |floor, index| \r\n return index if get_start_position(floor) != nil \r\n end \r\nend", "def build(level)\r\n # Build list of lines to draw\r\n # First level is base fractal, no offset rotation\r\n fractal_list = []\r\n rec_build(level, @base_fractal[0], 0, fractal_list)\r\n \r\n return fractal_list\r\n end", "def get_rooms(page)\n page.links.collect { |link| { :name => link.to_s, :uri => link.uri } if link.uri.to_s[\"#{uri.to_s}/room\"] }.reject { |room| room.nil? }\n end", "def get_door_area()\n get_children_area(\"DOOR\")\n end", "def tick\n\t\t@elevators.each{|elevator| elevator.tick}\n\t\t@floors.each{|floor| floor.tick}\n\tend", "def row(r)\n ranges = Ranges.new\n @sensors.sort.each{|loc, sen|\n range_at_r = sen.range - (loc.y - r).abs\n next if range_at_r.negative?\n\n ranges.union([loc.x - range_at_r, loc.x + range_at_r])\n }\n\n ranges\n end", "def show\n @companies = Company.where('floor_id = ?', @floor.id)\n @spaces = MeetingRoom.where('floor_id = ?', @floor.id)\n end", "def hotel_rooms\n \tobject.available_hotel_rooms @instance_options[:check_in], @instance_options[:check_out]\n end" ]
[ "0.61989945", "0.60879505", "0.60023636", "0.5924301", "0.59242284", "0.57799935", "0.5738687", "0.5737982", "0.5718558", "0.5714457", "0.56575537", "0.56496394", "0.5631189", "0.5606771", "0.5575505", "0.55027163", "0.5501694", "0.5490602", "0.547964", "0.546716", "0.5457457", "0.54317737", "0.5393005", "0.537608", "0.53596175", "0.53523403", "0.5287915", "0.5279967", "0.5243198", "0.5230267", "0.522425", "0.5219884", "0.52192587", "0.52089226", "0.5192791", "0.51914376", "0.51914376", "0.5184638", "0.51482975", "0.51482975", "0.5145526", "0.5145526", "0.5126012", "0.5122658", "0.51219326", "0.51053005", "0.509917", "0.50981236", "0.50898904", "0.5089339", "0.50770396", "0.50503606", "0.50383395", "0.5037513", "0.50339925", "0.5014112", "0.5010343", "0.501007", "0.49726886", "0.4967487", "0.49543592", "0.4947082", "0.49429706", "0.49324897", "0.4896472", "0.48765257", "0.48730683", "0.48594025", "0.485904", "0.48547533", "0.48329055", "0.48313928", "0.48212966", "0.48104668", "0.48086274", "0.48067832", "0.48028553", "0.47949675", "0.47924298", "0.47890988", "0.47829938", "0.47800723", "0.47688696", "0.47618604", "0.47588226", "0.4757548", "0.47541967", "0.47469786", "0.47421682", "0.47349465", "0.4731455", "0.47293222", "0.47259465", "0.47210306", "0.47178143", "0.4696738", "0.4694622", "0.4694537", "0.4677446", "0.4670287" ]
0.8494632
0
if the queue does not exist(due to sandbox not being in test mode), then the size of the queue will be 0
def queue_size(paypal_id) queue = @queue_map[paypal_id] if(queue.nil?) 0 else queue.size end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def size\n @queue.size\n end", "def queue_length\n if system.empty?\n 0\n else\n system.length - 1\n end\n end", "def size\n @queue.size\n end", "def size\n @queue.size\n end", "def check_queue_size_all\n queue = `#{config[:path]} | /bin/egrep '[0-9]+ Kbytes in [0-9]+ Request\\|Mail queue is empty'`\n queue == 'Mail queue is empty' ? 0 : queue.split(' ')[4].to_i\n end", "def size\n @queue.size\n end", "def size\n\n @queue.size\n end", "def queue_count()\n @queue.length\n end", "def queue_size\n @redis.llen(\"xque:queue:#{@queue_name}\")\n end", "def queue_length\n mutex.synchronize { running? ? @queue.length : 666 }\n end", "def size\n @mutex.synchronize { @queue.size }\n end", "def size?\n @queue.length\n end", "def length\n @queue.length\n end", "def test_isEmptyOnNonEmptyQueue\n @queue.enqueue(100)\n assert_equal( false , @queue.empty? )\n end", "def length\n @queue.length\n end", "def z_queue_size(queue)\n handle_pipeline(@redis.zcount(redis_key_for_queue(queue), 0, Float::INFINITY), &:to_i)\n end", "def pending_size\n @redis.zcard(\"xque:pending:#{@queue_name}\")\n end", "def check_queue_size_hold\n `#{config[:path]} | /bin/egrep -c '^[0-9A-F]+!'`.to_i\n end", "def queue_count\n @queues.length\n end", "def queue_length\n @executor.getQueue.size\n end", "def check_queue_size_active\n `#{config[:path]} | /bin/egrep -c '^[0-9A-F]+\\\\*'`.to_i\n end", "def count\n\t\t@queue.length\n\tend", "def is_empty()\n @queue.size == 0\n end", "def queue_size(queue)\n Resque.size(queue)\n end", "def empty?\n self.queue_size == 0\n end", "def is_full()\n @queue.size == @size\n end", "def queue_size\n _get(\"/system/queue-size\") { |json| json }\n end", "def queue_length\n @queues.inject(0) do |length, (_, queue)|\n length + queue.length\n end\n end", "def queue_size(queue)\n prioritized?(queue) ? z_queue_size(queue) : super\n end", "def check_queue_size_deferred\n `#{config[:path]} | /bin/grep -c '^ *(.*)$'`.to_i\n end", "def queue_length\n request_queue.length\n end", "def queue_length\n @job_queue.length\n end", "def empty()\n @queue.empty?\n end", "def test_isEmptyOnEmptyQueue\n assert_equal( true , @queue.empty? )\n end", "def check_queue_size_incoming\n `#{config[:path]} | /bin/egrep -c '^[0-9A-F]+ +'`.to_i - check_queue_size_deferred\n end", "def size\n # This is a a bit racy - we don't update these two queues atomically\n @queue.size + @active.size\n end", "def queue_full?\n free_slots == 0\n end", "def empty?\n @queue.empty?\n end", "def is_empty()\n @queue.count { _1 } == 0\n end", "def empty?\n @queue.empty?\n end", "def queued_messages\n @queue.length\n end", "def empty()\n @queue.size == 0\n end", "def size\n\t\t\t@sequence.size + @queue.size\n\t\tend", "def work_queue_size()\n @work_queue.size\n end", "def test_peekOnEmptyQueue\n assert_equal( nil, @queue.peek )\n end", "def sub_queue_count\n sub_queue_obj.count\n end", "def gevent_queue_size\r\n return @proc_queue.size\r\n end", "def waitlist_size\n @queue.size\n end", "def empty?\n @queue.empty?\n end", "def empty?\n @queue.empty?\n end", "def empty?\n @queue.empty?\n end", "def empty?\n\t\t@queue.empty?\n\tend", "def is_full()\n @queue.count { _1 } == @queue.size\n end", "def queued_messages\n @queue.length\n end", "def empty?\n @queue.empty?\n end", "def test_peekOnNonEmptyQueue\n @queue.enqueue(100)\n assert_equal( 100 , @queue.peek )\n end", "def test_dequeueOnEmptyStack\n assert_equal( nil , @queue.dequeue )\n end", "def sizeof(queue, statistics = nil)\n statistics ||= stats\n\n if queue == :all\n available_queues.inject({}){|h,q| h[q] = sizeof(queue, statistics)}\n else\n IO.popen(\"#{db_stat} -d /tmp/qache/#{queue}\").readlines.\n detect{|line| line =~ /(\\d+)\\tNumber of records in the database\\n/ }\n $1.to_i\n end\n end", "def queue\n @queue ||= SizedQueue.new @queue_size\n end", "def size\n self.queued.inject(0) { |result, data| result + data.last.size }\n end", "def queue_count()\n @work_queue.size + super()\n end", "def size\n @q.size\n end", "def remaining_capacity\n mutex.synchronize { @max_queue == 0 ? -1 : @max_queue - @queue.length }\n end", "def size(name = '.+')\n queues_matching(name).map(&:size).reduce(0, :+)\n end", "def remaining_capacity\n @max_queue == 0 ? -1 : @executor.getQueue.remainingCapacity\n end", "def take_msg(queue)\n msg = queue.reserve\n #by calling ybody we get the content of the message and convert it from yml\n count = msg.ybody.count\n msg.delete\n return count\n end", "def backlog\n @queue.size\n end", "def queue_count()\n cnt = 0\n @flows.each_value { |f| cnt += f.queue_count() }\n cnt\n end", "def get_queue_size\n if @number_of_processes\n @queueSize = @number_of_processes\n else\n @queueSize = DATSauce::PlatformUtils.processor_count * 2\n # get max threads from platform utils\n end\n @queueSize\n end", "def size\n @que.size\n end", "def test_two\n digest = EZQ.enqueue_message((1..40000).to_a.to_yaml,{'EZQ'=>nil},'test_queue')\n print \"Test two (enqueue an oversized message): \"\n q = EZQ.get_queue('test_queue')\n if !q\n puts \"failed to get test_queue\"\n return nil\n end\n q.receive_message do |msg|\n pre = YAML.load(msg.body)\n if pre.has_key?('get_s3_file_as_body')\n puts 'pass'\n else\n puts 'fail'\n end\n end\n return nil\nend", "def isEmpty()\n if @head == nil\n puts \"This Queue is empty.\"\n else\n puts \"This Queue has data.\"\n end\n end", "def test_dequeueOnNonEmptyStack\n @queue.enqueue(100)\n assert_equal( 100 , @queue.dequeue )\n end", "def empty?\n @queued.empty?\n end", "def exists?\n result = loaddata\n unless result[:result]\n Puppet.debug 'JMS Queue do not exists'\n return false\n end\n true\n end", "def size\n 0\n end", "def size\n 0\n end", "def exists?\n queue_exists?(@name)\n end", "def test_peek\n assert_equal(nil, @queue.peek, \"Diese Eissorte ist falsch!\")\nend", "def delayed_queue_schedule_size\n redis.zcard(:delayed_queue)\n end", "def message_count(queue)\n connect do |bunny|\n return bunny.queue(queue, :durable => true, :auto_delete => false).message_count\n end\n end", "def backed_up()\n cnt = @queue.size() + (@current_req.nil? ? 0 : 1)\n return 0 if 0 == cnt\n if @max_queue_count.nil? || 0 == @max_queue_count\n cnt = 80 if 80 < cnt\n cnt\n else\n cnt * 100 / @max_queue_count\n end\n end", "def message_count\n get_queue_message_count(address)\n end", "def size\n 0\n end", "def size\n 0\n end", "def size\n 0\n end", "def full?\n # absolute value of @tail is equal to the number of slots in the queue (@size)\n @tail.abs == (@size)\n end", "def busy?\n\n @queue.size > 0\n end", "def test_one\n digest = EZQ.enqueue_message( \"Test data\", {'EZQ'=>nil},'test_queue',true )\n print \"Test one (enqueue a single message): \"\n q = EZQ.get_queue('test_queue')\n if !q\n puts \"failed to get test_queue\"\n return nil\n end\n q.receive_message do |msg|\n if msg.md5 == digest\n puts \"pass\"\n else\n puts \"fail\"\n end\n end\n return nil\nend", "def mock_queue!(queue_name)\n mock_queue(queue_name) or raise NotFound.new\n end", "def max_queue_count()\n @max_queue_count\n end", "def verify_queue!\n raise 'queue.timeout' unless queue.timeout&.is_a? ActiveSupport::Duration\n end", "def _q\n @queue||=[]\n end", "def total_count(queue)\n collection.find(conditions(queue)).count\n end", "def should_flush?\n (!queue.blank? && count >= size)\n end", "def personal_queue\n unless (local_queues = self.queues).empty?\n local_queues[0]\n end\n end", "def test_get_submission_queue_status\n skip if @smoke_test # relies on assets that don't exist in staging Rawls\n status = @fire_cloud_client.get_submission_queue_status\n assert status.any?, 'Did not receive queue status object'\n assert status['workflowCountsByStatus'].any?, 'Did not receive queue count status'\n end", "def ready_count(queue)\n conditions = {:run_at.lte => Time.now.utc}\n conditions[:record_class_name] = queue.class_names unless queue.class_names.empty?\n count(conditions)\n end", "def num_waiting\n @waiting.size + @queue_wait.size\n end", "def num_waiting\n @waiting.size + @queue_wait.size\n end" ]
[ "0.7583397", "0.7563638", "0.75594443", "0.7552564", "0.7492274", "0.74467564", "0.74174625", "0.74162984", "0.74151266", "0.7373438", "0.7352809", "0.7328539", "0.7317168", "0.73089856", "0.7288918", "0.723229", "0.7230665", "0.721023", "0.7196738", "0.7157289", "0.71562475", "0.7153939", "0.70888907", "0.70843774", "0.7078604", "0.7067517", "0.7054608", "0.70156956", "0.7005958", "0.69973516", "0.698827", "0.6987718", "0.69866383", "0.69800186", "0.6972584", "0.696371", "0.69348276", "0.68814087", "0.68804854", "0.6801948", "0.6799077", "0.67922646", "0.67838156", "0.677861", "0.6746835", "0.67443824", "0.6743456", "0.67395914", "0.6731489", "0.6731489", "0.6731489", "0.67278147", "0.668136", "0.66337436", "0.6566939", "0.6562384", "0.6541159", "0.65268713", "0.65189236", "0.65125996", "0.6504293", "0.6504212", "0.64981586", "0.648159", "0.647705", "0.6455112", "0.6454934", "0.64483166", "0.6431349", "0.6424546", "0.63387996", "0.6318971", "0.6306874", "0.6306108", "0.6301897", "0.63006514", "0.63006514", "0.6292098", "0.62734884", "0.62729025", "0.6268097", "0.6249924", "0.6242183", "0.6218507", "0.6217597", "0.6217597", "0.62145245", "0.6213376", "0.62107587", "0.6210297", "0.6188213", "0.61609495", "0.6147161", "0.6146517", "0.613695", "0.60929143", "0.60825145", "0.60739285", "0.6065465", "0.6065465" ]
0.72928894
14
GET /grid_fs_files GET /grid_fs_files.json
def index @grid_fs_files = GridFsFile.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def server_get_file(server, path)\n request(\n :path => \"containers/#{server.id}/files\",\n :params => {\n :path => path\n },\n :disable_body_extraction => true\n ).get(:body)\n end", "def retrieve_cloud_files(files); end", "def get_file_listing\n execute!(drive.files.list).data\n end", "def list_files\n source_dir = Path.new(params[:source_dir])\n if params.has_key?(:show_catalogues)\n show_catalogues = params[:show_catalogues]\n else\n show_catalogues = false\n end\n if params[:ext].present?\n file_type = params[:ext]\n else\n file_type = nil\n end\n render json: source_dir.files(file_type: file_type, show_catalogues: show_catalogues)\n end", "def files(folder = 0)\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/files/list?parent_id=%i' % [folder]).files\n end", "def get_files_list_with_http_info(path, opts = {})\r\n if @api_client.config.debug\r\n @api_client.config.logger.debug 'Calling API: StorageApi.get_files_list ...'\r\n end\r\n # verify the required parameter 'path' is set\r\n if @api_client.config.client_side_validation && path.nil?\r\n fail ArgumentError, \"Missing the required parameter 'path' when calling StorageApi.get_files_list\"\r\n end\r\n # resource path\r\n local_var_path = '/html/folder'\r\n\r\n # query parameters\r\n query_params = {}\r\n query_params[:'path'] = path.to_s\r\n query_params[:'storageName'] = opts[:'storage_name'] if !opts[:'storage_name'].nil?\r\n\r\n # header parameters\r\n header_params = {}\r\n # HTTP header 'Accept' (if needed)\r\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\r\n # HTTP header 'Content-Type'\r\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\r\n\r\n # form parameters\r\n form_params = {}\r\n\r\n # http body (model)\r\n post_body = nil\r\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\r\n :header_params => header_params,\r\n :query_params => query_params,\r\n :form_params => form_params,\r\n :body => post_body,\r\n :return_type => 'FilesList')\r\n if @api_client.config.debug\r\n @api_client.config.logger.debug \"API called: StorageApi#get_files_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\r\n end\r\n return data, status_code, headers\r\n end", "def list_files\n User.sync_files!(@context)\n files = user_real_files(params, @context)\n\n if unsafe_params[:limit] && unsafe_params[:offset]\n files = files.limit(unsafe_params[:limit]).offset(unsafe_params[:offset])\n end\n\n search_string = params[:search_string].presence || \"\"\n\n result = files.eager_load(:license, user: :org).\n where(\"nodes.name LIKE ?\", \"%#{search_string}%\").\n order(id: :desc).map do |file|\n describe_for_api(file, unsafe_params[:describe])\n end.compact\n\n render json: unsafe_params[:offset]&.zero? ? { objects: result, count: result.length } : result\n end", "def files_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: FilesApi.files_get ...\"\n end\n # resource path\n local_var_path = \"/files\"\n\n # query parameters\n query_params = {}\n query_params[:'start'] = opts[:'start'] if !opts[:'start'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'include_deleted_files'] = opts[:'include_deleted_files'] if !opts[:'include_deleted_files'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?\n\n # header parameters\n header_params = {}\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = [ 'access_token' ]\n response = @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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FilesApi#files_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return response\n end", "def get_files_list_with_http_info(path, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: StorageApi.get_files_list ...\"\n end\n # verify the required parameter 'path' is set\n if @api_client.config.client_side_validation && path.nil?\n fail ArgumentError, \"Missing the required parameter 'path' when calling StorageApi.get_files_list\"\n end\n # resource path\n local_var_path = \"/diagram/storage/folder/{path}\".sub('{' + 'path' + '}', path.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'storageName'] = opts[:'storage_name'] if !opts[:'storage_name'].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 = ['JWT']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'FilesList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: StorageApi#get_files_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def list_files_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: NsxComponentAdministrationApi.list_files ...\"\n end\n # resource path\n local_var_path = \"/node/file-store\"\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 => 'FilePropertiesListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NsxComponentAdministrationApi#list_files\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def files\n db = Database.find(params[:id])\n @files = Dir.entries(db.path)\n @files.delete_if{|f| !f.include?'.dat'}\n @results = []\n @files.each do |entry|\n @results << {:name=>entry,:version=>db.version}\n end\n respond_to do |format|\n format.html\n format.json { render json: @results }\n end\n end", "def get_files_list(request)\n http_request = request.to_http_info(@api_client.config)\n make_request(http_request, :GET, 'FilesList')\n end", "def files_get(opts = {})\n files_get_with_http_info(opts)\n end", "def files\n results\n rescue ApiStruct::EntityError\n result\n end", "def files(params = {}, &block)\n params = convert_params(params)\n return execute_paged!(\n :api_method => self.drive.files.list,\n :parameters => params,\n :converter => proc(){ |af| wrap_api_file(af) },\n &block)\n end", "def files\n @files=get_endpoint('extra').keys\n end", "def get_files_list_with_http_info(path, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PdfApi.get_files_list ...\"\n end\n # verify the required parameter 'path' is set\n if @api_client.config.client_side_validation && path.nil?\n fail ArgumentError, \"Missing the required parameter 'path' when calling PdfApi.get_files_list\"\n end\n # resource path\n local_var_path = \"/pdf/storage/folder/{path}\".sub('{' + 'path' + '}', path.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'storageName'] = opts[:'storage_name'] if !opts[:'storage_name'].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 # Fix header in file\n post_body = nil\n\n # http body (model)\n # Fix header in file\n # post_body = nil\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'FilesList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PdfApi#get_files_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @title = \"User uploaded files\"\n get_files(params)\n end", "def get_files(remote_folder_path)\n str_url = @str_uri_folder + remote_folder_path\n\n signed_uri = Aspose::Cloud::Common::Utils.sign(str_url)\n response = RestClient.get(signed_uri, :accept => 'application/json')\n\n JSON.parse(response)['Files']\n\n # urlFolder = $product_uri + '/storage/folder'\n # urlFile = ''\n # urlExist = ''\n # urlDisc = ''\n # if not remoteFolderPath.empty?\n # urlFile = $product_uri + '/storage/folder/' + remoteFolderPath \n # end \n # signedURL = Aspose::Cloud::Common::Utils.sign(urlFolder)\n # response = RestClient.get(signedURL, :accept => 'application/json')\n # result = JSON.parse(response.body)\n # apps = Array.new(result['Files'].size)\n #\n # for i in 0..result['Files'].size - 1\n # apps[i] = AppFile.new\n # apps[i].Name = result['Files'][i]['Name']\n # apps[i].IsFolder = result['Files'][i]['IsFolder']\n # apps[i].Size = result['Files'][i]['Size']\n # apps[i].ModifiedDate = Aspose::Cloud::Common::Utils.parse_date(result['Files'][i]['ModifiedDate'])\n # end\n # return apps\t \n end", "def files\n return get_result('files')\n end", "def test_get_list_files()\n\n path = 'folder1'\n storage = 'First Storage'\n request = GetListFilesRequest.new(path, storage)\n\n result = @storage_api.get_list_files(request)\n assert result.code == 200, 'Error while getting list files'\n assert result.files != nil\n\n end", "def get_files_list(path, opts = {})\n @api_client.request_token_if_needed\n data, _status_code, _headers = get_files_list_with_http_info(path, opts)\n rescue ApiError => error\n if error.code == 401\n @api_client.request_token_if_needed\n data, _status_code, _headers = get_files_list_with_http_info(path, opts)\n else\n raise\n end\n return data\n end", "def index\n # Fetches space files.\n respond_with_space_files && return if params[:space_id]\n\n # Fetches all user 'private' files.\n filter_tags = params.dig(:filters, :tags)\n\n files = UserFile.\n real_files.\n editable_by(@context).\n accessible_by_private.\n where.not(parent_type: [\"Comparison\", nil]).\n includes(:taggings).\n eager_load(user: :org).\n search_by_tags(filter_tags)\n\n return render(plain: files.size) if show_count\n\n files = files.where(parent_folder_id: @parent_folder_id)\n files = FileService::FilesFilter.call(files, params[:filters])\n\n folders = private_folders(@parent_folder_id).includes(:taggings).\n eager_load(user: :org).search_by_tags(filter_tags)\n folders = FileService::FilesFilter.call(folders, params[:filters])\n\n user_files = Node.eager_load(user: :org).where(id: (files + folders).map(&:id)).\n order(order_params).page(page_from_params).per(page_size)\n page_dict = pagination_dict(user_files)\n\n render json: user_files, root: \"files\", adapter: :json,\n meta: files_meta.\n merge(count(UserFile.private_count(@context.user))).\n merge({ pagination: page_dict })\n end", "def storage_file_get(args = { }, options = { })\n process_request_using_class(Requests::StorageFileGet, args, options)\n end", "def get_files(query_obj=nil,with_nested_resources=false)\n uri = URI.parse(@uri + \"/Files\")\n results = get(uri,query_obj,with_nested_resources)\n end", "def get_file(uid, info = {}, range: nil)\n grid_info = files_collection.find(filename: uid).first\n\n filter = { files_id: grid_info[:_id] }\n\n if range\n chunk_start = range.begin / grid_info[:chunkSize]\n chunk_stop = range.end / grid_info[:chunkSize]\n\n filter[:n] = {\"$gte\" => chunk_start, \"$lte\" => chunk_stop}\n end\n\n # Query only the subset of chunks specified by the range query. We\n # cannot use Mongo::FsBucket#open_download_stream here because it\n # doesn't support changing the filter.\n chunks_view = chunks_collection.find(filter).sort(n: 1)\n\n # Create an Enumerator which will yield chunks of the requested file\n # content, allowing tus server to efficiently stream requested content\n # to the client.\n chunks = Enumerator.new do |yielder|\n chunks_view.each do |document|\n data = document[:data].data\n\n if document[:n] == chunk_start && document[:n] == chunk_stop\n byte_start = range.begin % grid_info[:chunkSize]\n byte_stop = range.end % grid_info[:chunkSize]\n elsif document[:n] == chunk_start\n byte_start = range.begin % grid_info[:chunkSize]\n byte_stop = grid_info[:chunkSize] - 1\n elsif document[:n] == chunk_stop\n byte_start = 0\n byte_stop = range.end % grid_info[:chunkSize]\n end\n\n # If we're on the first or last chunk, return a subset of the chunk\n # specified by the given range, otherwise return the full chunk.\n if byte_start && byte_stop\n yielder << data[byte_start..byte_stop]\n else\n yielder << data\n end\n end\n end\n\n Tus::Response.new(chunks: chunks, close: chunks_view.method(:close_query))\n end", "def list_all_files()\n\t\tfiles = Hash.new\n\t\trefresh_access_token()\n\t\trequest_url = \"https://www.googleapis.com/drive/v2/files?access_token=#{@access_token}\"\n\t\tresponse = RestClient.get request_url\n\t\tresponse_body = JSON.parse(response.body)\n\t\tresponse_body['items'].each do |item|\n\t\t\t\tfiles[item['id']] = item['title']\n\t\tend\n\t\treturn files\n\tend", "def discover_files\n authorize! :create, resource_class\n respond_to do |f|\n f.json do\n render json: file_locator.to_h\n end\n end\n end", "def get_firmware_files\n response = request(:get, \"/devmgr/v2/firmware/cfw-files/\")\n status(response, 200, 'Failed to get uploaded firmware file list')\n JSON.parse(response.body)\n end", "def contents\n\tRails.logger.debug {\"getting gridfs content #{@id}\"}\n f=self.class.mongo_client.database.fs.find_one(:_id=>BSON::ObjectId.from_string(@id))\n # read f into buffer, array of chunks is reduced to single buffer and returned to caller.\n # this is how file is broken apart and put together and assembled. Buffer is sent back to browser\n # to disaply on the screen\n if f \n buffer = \"\"\n f.chunks.reduce([]) do |x,chunk| \n buffer << chunk.data.data \n end\n return buffer\n end \n\nend", "def get_files\n return @files if @files.present?\n raise \"No user token present\" unless access[:user_token].present?\n @files ||= get(proviso_url + \"files\")\n @files.presence || raise(\"No files available\")\n end", "def fs(path)\n OodAppkit.files.url(path: path).to_s\n end", "def create\n @grid_fs_file = GridFsFile.new(grid_fs_file_params)\n\n respond_to do |format|\n if @grid_fs_file.save\n format.html { redirect_to @grid_fs_file, notice: 'Grid fs file was successfully created.' }\n format.json { render :show, status: :created, location: @grid_fs_file }\n else\n format.html { render :new }\n format.json { render json: @grid_fs_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def files; end", "def files; end", "def files; end", "def files; end", "def files; end", "def files; end", "def get_remote_files\n raise BucketNotFound.new(\"#{self.config.fog_provider} Bucket: #{self.config.fog_directory} not found.\") unless directory\n files = []\n directory.files.each { |f| files << f if File.extname(f.key).present? }\n return files\n end", "def get_files\n fields = \"next_page_token, files(id, name, owners, parents, mime_type, sharedWithMeTime, modifiedTime, createdTime)\"\n\n folders = []\n @files = []\n\n #Go through pages of files and save files and folders\n next_token = nil\n first_page = true\n while first_page || (!next_token.nil? && !next_token.empty?)\n results = @service.list_files(q: \"not trashed\", fields: fields, page_token: next_token)\n folders += results.files.select{|file| file.mime_type == DRIVE_FOLDER_TYPE and belongs_to_me?(file)}\n @files += results.files.select{|file| !file.mime_type.include?(DRIVE_FILES_TYPE) and belongs_to_me?(file)}\n next_token = results.next_page_token\n first_page = false\n end\n\n #Cache folders\n folders.each {|folder| @folder_cache[folder.id] = folder}\n\n #Resolve file paths and apply ignore list\n @files.each {|file| file.path = resolve_path file}\n @files.reject!{|file| Helper.file_ignored? file.path, @config}\n\n Log.log_notice \"Counted #{@files.count} remote files in #{folders.count} folders\"\n end", "def file_data\n @client.get_file @file_url\n end", "def parse_files_json(file)\n\n files_hash = convert_json(b2_list_file_names(file))\n files = {}\n\n files_hash[\"files\"].each do |file_hash|\n files[file_hash[\"fileName\"]] = file_hash[\"fileId\"]\n end\n\n return files\n\nend", "def get_template_files(opts)\n path = \"/template/files/#{opts[:template_id]}\"\n if opts[:file_type]\n path = path + \"?file_type=#{opts[:file_type]}\"\n end\n if opts[:get_url]\n separator = opts[:file_type].nil? ? '?' : '&'\n path = path + \"#{separator}get_url=#{opts[:get_url]}\"\n end\n\n get(path)\n end", "def download_list\n task = params[:task]\n files = []\n\n case task\n when DOWNLOAD_ACTION, OPEN_ACTION, COPY_ACTION, COPY_TO_PRIVATE_ACTION\n nodes = Node.accessible_by(@context).where(id: params[:ids])\n nodes.each { |node| files += node.is_a?(Folder) ? node.all_files : [node] }\n when PUBLISH_ACTION\n nodes = Node.editable_by(@context).\n where(id: params[:ids]).\n where.not(scope: UserFile::SCOPE_PUBLIC)\n nodes.each do |node|\n files += if node.is_a?(Folder)\n node.all_files(Node.where.not(scope: UserFile::SCOPE_PUBLIC))\n else\n [node]\n end\n end\n when DELETE_ACTION\n nodes = Node.editable_by(@context).where(id: params[:ids]).to_a\n files += nodes\n nodes.each { |node| files += node.all_children if node.is_a?(Folder) }\n files.filter! { |file| file.scope == params[:scope] }\n else\n raise ApiError, \"Parameter 'task' is not defined!\"\n end\n\n render json: files,\n each_serializer: FileActionsSerializer,\n scope_name: params[:scope] || SCOPE_PRIVATE,\n action_name: task\n end", "def files options = {}\n ensure_connection!\n resp = connection.list_files name, options\n if resp.success?\n File::List.from_resp resp, connection\n else\n fail ApiError.from_response(resp)\n end\n end", "def all\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n files(-1)\n end", "def get_files_list_with_http_info(path, storage_name = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.get_files_list ...'\n end\n\n # verify the required parameter 'path' is set\n if @api_client.config.client_side_validation && path.nil?\n fail ArgumentError, \"Missing the required parameter 'path' when calling SlidesApi.get_files_list\"\n end\n # resource path\n local_var_path = '/slides/storage/folder/{path}'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'path', path)\n\n # query parameters\n query_params = {}\n query_params[:'storageName'] = @api_client.prepare_for_query(storage_name) unless storage_name.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 # http body (model)\n post_body = nil\n\n # form parameters\n post_files = []\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'FilesList')\n return data, status_code, headers\n end", "def files_get(api_key, opts = {})\n files_get_with_http_info(api_key, opts)\n return nil\n end", "def files(catalog: nil, query: {}, size: MAX_RESULTS)\n base_path = \"#{api_root}/index/files\"\n query_string = format_hash_as_query_string(query)\n base_path += \"?filters=#{query_string}&size=#{size}\"\n path = append_catalog(base_path, catalog)\n # make API request, but fold in project information to each result so that this is preserved for later use\n raw_results = process_api_request(:get, path)['hits']\n results = []\n raw_results.each do |result|\n files = result['files']\n project = result['projects'].first\n project_info = {\n 'projectShortname' => project['projectShortname'].first,\n 'projectId' => project['projectId'].first\n }\n files.each do |file|\n results << file.merge(project_info)\n end\n end\n results\n end", "def file_all(bucket)\n result = request(\n :path => full_path(bucket),\n :expects => [200, 204],\n :params => {\n :format => :json\n }\n )\n [result[:body]].flatten.compact.map do |file|\n File.new(\n bucket,\n :id => ::File.join(bucket.name, file[:name]),\n :name => file[:name],\n :updated => file[:last_modified],\n :size => file[:bytes].to_i\n ).valid_state\n end\n end", "def get(path = '/files/', params = {})\n request :get, path, params\n end", "def documents_for(path, site_path = '')\n ethon = ethon_easy_json_requester\n ethon.url = \"#{computed_web_api_url(site_path)}GetFolderByServerRelativeUrl('#{uri_escape path}')/Files\"\n ethon.perform\n check_and_raise_failure(ethon)\n\n threads = []\n rv = []\n result = JSON.parse( ethon.response_body )\n result['d']['results'].each do |file|\n file_struct = OpenStruct.new(\n title: file['Title'],\n path: file['ServerRelativeUrl'],\n name: file['Name'],\n url: \"#{base_url}#{file['ServerRelativeUrl']}\",\n created_at: Time.parse(file['TimeCreated']),\n updated_at: Time.parse(file['TimeLastModified']),\n record_type: nil,\n date_of_issue: nil,\n )\n\n threads << Thread.new {\n ethon2 = ethon_easy_json_requester\n server_relative_url = \"#{site_path}#{path}/#{file['Name']}\"\n ethon2.url = \"#{computed_web_api_url(site_path)}GetFileByServerRelativeUrl('#{uri_escape server_relative_url}')/ListItemAllFields\"\n ethon2.perform\n rs = JSON.parse(ethon2.response_body)['d']\n file_struct.record_type = rs['Record_Type']\n file_struct.date_of_issue = rs['Date_of_issue']\n\n rv << file_struct\n }\n end\n threads.each { |t| t.join }\n rv\n end", "def test_get_files_list\n request = GetFilesListRequest.new(path: remote_data_folder)\n\n result = @words_api.get_files_list(request)\n assert_equal false, result.nil?\n end", "def file_get(id)\n response = get('FileService.getFile', id)\n end", "def signature_request_files(opts)\n path = \"/signature_request/files/#{opts[:signature_request_id]}\"\n if opts[:file_type]\n path = path + \"?file_type=#{opts[:file_type]}\"\n end\n\n if opts[:get_url]\n separator = opts[:file_type].nil? ? '?' : '&'\n path = path + \"#{separator}get_url=#{opts[:get_url]}\"\n elsif opts[:get_data_uri]\n separator = opts[:file_type].nil? ? '?' : '&'\n path = path + \"#{separator}get_data_uri=#{opts[:get_data_uri]}\"\n end\n\n get(path)[:body]\n end", "def show\n @treq = Treq.find(params[:id])\n @treq_files = @treq.treq_files.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @treq }\n end\n end", "def search(query, page = 0)\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/files/list?parent_id=%i' % [folder]).files\n end", "def get_files_list(request)\r\n begin\r\n data, _status_code, _headers = get_files_list_with_http_info(request)\r\n rescue ApiError => e\r\n if e.code == 401\r\n request_token\r\n data, _status_code, _headers = get_files_list_with_http_info(request)\r\n else\r\n raise\r\n end\r\n end\r\n data\r\n end", "def set_grid_fs_file\n @grid_fs_file = GridFsFile.find(params[:id])\n end", "def userfiles_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UserfilesApi.userfiles_get ...'\n end\n # resource path\n local_var_path = '/userfiles'\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'multipart/form-data'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BrainPortalSession']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Userfile>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UserfilesApi#userfiles_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def files_get_with_http_info(api_key, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: FilesApi.files_get ...\"\n end\n # verify the required parameter 'api_key' is set\n fail ArgumentError, \"Missing the required parameter 'api_key' when calling FilesApi.files_get\" if api_key.nil?\n # resource path\n local_var_path = \"/files\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'api_key'] = api_key\n\n # header parameters\n header_params = {}\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FilesApi#files_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def file_list\n end", "def get_file(file_id)\n\tputs \"Getting file: \" + file_id\n\tresponse = request_get('/api/partner/file/' + file_id)\n\tputs response.body\nend", "def read\n status = 200\n\n # File path\n fpath = filepathById params[:id]\n\n if nil == fpath\n # File description does not exists\n result = {status: 'error', message: 'Bad request'}\n status = 400\n elsif File.exists? fpath\n result = {content: File.read(fpath)}\n else\n result = {content: ''}\n end\n render json: result.to_json, status: status\n end", "def get_fileset\n\n filesets = batched_get( { id: params[:id] } )\n if filesets.empty?\n render_json_fileset_response(:not_found )\n else\n render_json_fileset_response(:ok, fileset_transform( filesets ) )\n end\n end", "def index\n @file_versions = FileVersion.all\n\n render json: @file_versions\n end", "def list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PublicationsFileApi.list ...'\n end\n # resource path\n local_var_path = '/pulp/api/v3/publications/file/file/'\n\n # query parameters\n query_params = {}\n query_params[:'ordering'] = opts[:'ordering'] if !opts[:'ordering'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil?\n query_params[:'exclude_fields'] = opts[:'exclude_fields'] if !opts[:'exclude_fields'].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 = ['Basic']\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 => 'InlineResponse20015')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PublicationsFileApi#list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def api(path)\n OodAppkit.files.api(path: path).to_s\n end", "def b2_list_file_names(file)\n\n auth_hash = convert_json(b2_authorize_account)\n api_url = auth_hash[\"apiUrl\"]\n account_authorization_token = auth_hash[\"authorizationToken\"]\n bucket_id = ENV['bucket_id']\n prefix = file\n\n uri = URI(\"#{api_url}/b2api/v1/b2_list_file_names\")\n req = Net::HTTP::Post.new(uri)\n req.add_field(\"Authorization\",\"#{account_authorization_token}\")\n req.body = \"{\\\"bucketId\\\":\\\"#{bucket_id}\\\", \\\"prefix\\\":\\\"#{prefix}\\\"}\"\n http = Net::HTTP.new(req.uri.host, req.uri.port)\n http.use_ssl = true\n res = http.start {|http| http.request(req)}\n\n case res\n when Net::HTTPSuccess then res.body\n when Net::HTTPRedirection then fetch(res['location'], limit - 1)\n else res.error!\n end\n\nend", "def json_files\n file_list '**/*.json'\n end", "def cl_request(fn, *_)\n get_file fn\n # No other action required\n end", "def get_files(params)\n if params[:sort] == 'name' then\n sort = \"upload_file_name ASC\"\n else\n sort = \"created_on DESC\"\n end\n\n # Set currently viewing by key\n if params[:key] then\n @viewing_by = params[:key]\n @title << \" - #{@viewing_by.pluralize}\" \n @files = UserUpload.paginate(\n :order => sort,\n :page => params[:page],\n :conditions => [\"#{UserUpload.connection.quote_column_name(\"type\")} = ?\", @viewing_by], # and thumbnail is NULL\n :per_page => 30\n )\n else\n @files = UserUpload.paginate(\n :order => sort,\n :page => params[:page],\n # :conditions => \"#{connection.quote_column_name(\"thumbnail\")} is NULL\",\n :per_page => 30\n )\n end\n end", "def index\n @file_folders = FileFolder.all\n end", "def files\n info[\"Files\"].to_a\n end", "def get_file\n rid = params[:rid]\n type = params[:type]\n aoid = params[:aoid] || ''\n ref_id = params[:ref_id] || ''\n resource = params[:resource]\n position = params[:position] || '1'\n return render_aspace_partial :partial => \"resources/bulk_file_form\", :locals => {:rid => rid, :aoid => aoid, :type => type, :ref_id => ref_id, :resource => resource, :position => position} \n end", "def files(trading_partner_id, filename)\n scope 'default'\n url = URI.parse(@api_url + '/files/')\n\n File.open(filename) do |f|\n req = Net::HTTP::Post::Multipart.new url.path,\n 'file' => UploadIO.new(f, 'application/EDI-X12', filename),\n 'trading_partner_id' => trading_partner_id\n req['Authorization'] = \"Bearer #{default_scope.token}\"\n req['User-Agent'] = user_agent\n\n @response = Net::HTTP.start(url.host, url.port) do |http|\n http.request(req)\n end\n end\n\n JSON.parse(@response.body)\n end", "def update\n respond_to do |format|\n if @grid_fs_file.update(grid_fs_file_params)\n format.html { redirect_to @grid_fs_file, notice: 'Grid fs file was successfully updated.' }\n format.json { render :show, status: :ok, location: @grid_fs_file }\n else\n format.html { render :edit }\n format.json { render json: @grid_fs_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def files\n list = []\n if @data['info'].key?('files')\n @data['info']['files'].each do |file|\n list << { 'name' => file['path'], 'length' => file['length'] }\n end\n return list\n end\n\n if @data['info'].key?('name') && @data['info'].key?('length')\n list << { 'name' => @data['info']['name'], 'length' => @data['info']['length'] }\n end\n list\n end", "def get_the_individual_file_to_be_processed\n # p \"individual file selection\"\n files = GetFiles.get_all_of_the_filenames(@project.freecen_files_directory, @project.file_range)\n files\n end", "def get_file(id)\n id = self.to_id(id)\n self.grid.get(id).read\n end", "def index\n fs = FileStore.by_hash(params[:hash])\n\n file_stores = fs.map do |item|\n {\n sha1_hash: item.sha1_hash,\n file_name: File.basename(item.file.path),\n user: {\n id: item.user_id,\n uname: item.user_uname\n }\n }\n end\n render json: file_stores\n end", "def files\n FileList.new(`#@native.files`)\n end", "def files_list(params = {})\n response = @session.do_post \"#{SCOPE}.list\", params\n Slack.parse_response(response)\n end", "def list\n client = get_dropbox_client\n unless client\n redirect_to(:action => 'auth_start') and return\n end\n @dropbox_docs = []\n path = \"/\"\n\n metadata = client.metadata(path, file_limit=25000, list=true, hash=nil, rev=nil, include_deleted=false)\n for dfile in metadata['contents']\n \tname = dfile['path']\n \t@dropbox_docs << name[1..-1]\n \tend\n \tgoogle_session = GoogleDrive.login_with_oauth(session[:google_token])\n \t@google_docs = []\n \tfor file in google_session.files\n \t\t@google_docs << file.title \n \tend\n #drivelist = get_dr.slice!(-)\n #render :inline => \"#{metadata['contents']} \\n\\n\\n\"\n #render json: metadata\n\n end", "def listFiles()\n #N Without this the files won't get listed\n contentHost.listFiles(baseDir)\n end", "def index\n @authorized = true\n begin\n authorize! :show, UploadFile\n rescue CanCan::AccessDenied\n @authorized = false\n end\n #added to avoid raise condition when initially uploading multiple files\n check_uploads_collection unless !@authorized\n\n respond_to do |format|\n format.json {\n #TODO find_by_solr could be faster \n @multiresimages = current_user.upload_files.map do |file|\n begin\n Multiresimage.find(file.pid)\n rescue ActiveFedora::ObjectNotFoundError\n end\n end.compact\n render :json=>@multiresimages.map(&:to_jq_upload)\n }\n format.html\n end\n end", "def index\n @inventory_files = InventoryFile.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @inventory_files }\n end\n end", "def files\n entries.map(&:filepath)\n end", "def file_list\n @file_list\n end", "def show\n @file_item = FileItem.cs(self.current_scope).find_by_path(params[:id])\n\n respond_to do |format|\n format.html do\n case @file_item.item_type\n when Saphira::FileItem::TYPE_FOLDER\n @file_items = @file_item.children\n render :action => 'index'\n else\n render\n end\n end\n format.json { render :json => @file_item }\n end\n end", "def list(client, current_path)\n\n\tfiles = Dir.glob(\"#{current_path}/files/*\")\n\tclient.puts \"\\nList of Files:\"\n\tfiles.each{ |file|\n\tfile.slice! \"#{current_path}/files/\"}\n\tclient.puts files\n\nend", "def files\n i = 0\n @@arr_path.each do |path|\n if path.include?(params[:fold])\n # Remove path from current path\n @@arr_path = @@arr_path[0..i]\n @path = ''\n\n @@arr_path.each do |e| # Put path from array to @path\n @path = @path + e + ' >> '\n end\n @@temp_path = @path\n\n # Get content: folders, file, count\n @content = BrowsingFile.bind_folder params[:fold]\n @file = BrowsingFile.bind_files params[:fold]\n\n render 'index' # Reload index page\n return\n end\n i += 1\n end\n end", "def show\n @spawner = Spawner.find(params[:id])\n\n @files = Dir.glob(\"/Users/jmadin/Dropbox/web/trimodal/spawned_thumbs/*\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @spawner }\n end\n end", "def index\n @gadget_files = GadgetFile.all\n end", "def files\n fail \"Fetcher #{self} does not implement `files()`. This is required.\"\n end", "def index\n @uploads = [].tap do |files|\n Upload.with_attached_files\n .where(user_id: current_or_guest_user.id)\n .each do |upload|\n upload.files.each do |file|\n files << { id: upload.id, file: file }\n end\n end\n end\n end", "def index\n @ftpfiles = Ftpfile.all\n end", "def show\n respond_to do |format|\n format.gltf do\n send_file EziiOsPath.new(@gltf_model.global_path).file_system_path\n end\n end\n end", "def grid_fs_file_params\n params.require(:grid_fs_file).permit(:filename, :contentType, :author, :topic, :uploadDate, :length, :chunkSize, :md5, :contents)\n end" ]
[ "0.678743", "0.6682282", "0.6661644", "0.6656341", "0.6565899", "0.6529946", "0.651921", "0.649803", "0.6491551", "0.64717746", "0.64634776", "0.6439559", "0.64311635", "0.64228505", "0.6392473", "0.6389882", "0.6360968", "0.6337395", "0.63345295", "0.6329733", "0.62461925", "0.6243824", "0.6223328", "0.6214099", "0.61482185", "0.6127453", "0.61133605", "0.6106036", "0.6099036", "0.60828817", "0.6065876", "0.6063226", "0.6057859", "0.60261977", "0.60261977", "0.60261977", "0.60261977", "0.60261977", "0.60261977", "0.59991133", "0.5995626", "0.59867173", "0.59697723", "0.5958559", "0.59425735", "0.5940354", "0.59220284", "0.5919086", "0.5916919", "0.5914824", "0.5909323", "0.5897664", "0.5872301", "0.58639616", "0.58602077", "0.5852708", "0.58510435", "0.5850812", "0.5846398", "0.5828819", "0.5826995", "0.5821942", "0.5821252", "0.5818217", "0.5813032", "0.58083475", "0.57976073", "0.578004", "0.57693446", "0.5769029", "0.5768065", "0.5762268", "0.57617384", "0.5760235", "0.57449234", "0.5724379", "0.5715089", "0.5694252", "0.5692892", "0.5690704", "0.56880766", "0.5679446", "0.56762373", "0.56713325", "0.5667652", "0.5659652", "0.56591743", "0.5657194", "0.565008", "0.56444484", "0.56439996", "0.56434274", "0.5641364", "0.5638713", "0.56358135", "0.5634054", "0.5632522", "0.5632509", "0.56319654", "0.5631919" ]
0.76164234
0
GET /grid_fs_files/1 GET /grid_fs_files/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @grid_fs_files = GridFsFile.all\n end", "def server_get_file(server, path)\n request(\n :path => \"containers/#{server.id}/files\",\n :params => {\n :path => path\n },\n :disable_body_extraction => true\n ).get(:body)\n end", "def files_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: FilesApi.files_get ...\"\n end\n # resource path\n local_var_path = \"/files\"\n\n # query parameters\n query_params = {}\n query_params[:'start'] = opts[:'start'] if !opts[:'start'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'include_deleted_files'] = opts[:'include_deleted_files'] if !opts[:'include_deleted_files'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?\n\n # header parameters\n header_params = {}\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = [ 'access_token' ]\n response = @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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FilesApi#files_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return response\n end", "def get_files_list_with_http_info(path, opts = {})\r\n if @api_client.config.debug\r\n @api_client.config.logger.debug 'Calling API: StorageApi.get_files_list ...'\r\n end\r\n # verify the required parameter 'path' is set\r\n if @api_client.config.client_side_validation && path.nil?\r\n fail ArgumentError, \"Missing the required parameter 'path' when calling StorageApi.get_files_list\"\r\n end\r\n # resource path\r\n local_var_path = '/html/folder'\r\n\r\n # query parameters\r\n query_params = {}\r\n query_params[:'path'] = path.to_s\r\n query_params[:'storageName'] = opts[:'storage_name'] if !opts[:'storage_name'].nil?\r\n\r\n # header parameters\r\n header_params = {}\r\n # HTTP header 'Accept' (if needed)\r\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\r\n # HTTP header 'Content-Type'\r\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\r\n\r\n # form parameters\r\n form_params = {}\r\n\r\n # http body (model)\r\n post_body = nil\r\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\r\n :header_params => header_params,\r\n :query_params => query_params,\r\n :form_params => form_params,\r\n :body => post_body,\r\n :return_type => 'FilesList')\r\n if @api_client.config.debug\r\n @api_client.config.logger.debug \"API called: StorageApi#get_files_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\r\n end\r\n return data, status_code, headers\r\n end", "def get_files_list_with_http_info(path, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: StorageApi.get_files_list ...\"\n end\n # verify the required parameter 'path' is set\n if @api_client.config.client_side_validation && path.nil?\n fail ArgumentError, \"Missing the required parameter 'path' when calling StorageApi.get_files_list\"\n end\n # resource path\n local_var_path = \"/diagram/storage/folder/{path}\".sub('{' + 'path' + '}', path.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'storageName'] = opts[:'storage_name'] if !opts[:'storage_name'].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 = ['JWT']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'FilesList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: StorageApi#get_files_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def files\n db = Database.find(params[:id])\n @files = Dir.entries(db.path)\n @files.delete_if{|f| !f.include?'.dat'}\n @results = []\n @files.each do |entry|\n @results << {:name=>entry,:version=>db.version}\n end\n respond_to do |format|\n format.html\n format.json { render json: @results }\n end\n end", "def retrieve_cloud_files(files); end", "def read\n status = 200\n\n # File path\n fpath = filepathById params[:id]\n\n if nil == fpath\n # File description does not exists\n result = {status: 'error', message: 'Bad request'}\n status = 400\n elsif File.exists? fpath\n result = {content: File.read(fpath)}\n else\n result = {content: ''}\n end\n render json: result.to_json, status: status\n end", "def get_files_list_with_http_info(path, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PdfApi.get_files_list ...\"\n end\n # verify the required parameter 'path' is set\n if @api_client.config.client_side_validation && path.nil?\n fail ArgumentError, \"Missing the required parameter 'path' when calling PdfApi.get_files_list\"\n end\n # resource path\n local_var_path = \"/pdf/storage/folder/{path}\".sub('{' + 'path' + '}', path.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'storageName'] = opts[:'storage_name'] if !opts[:'storage_name'].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 # Fix header in file\n post_body = nil\n\n # http body (model)\n # Fix header in file\n # post_body = nil\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'FilesList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PdfApi#get_files_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def storage_file_get(args = { }, options = { })\n process_request_using_class(Requests::StorageFileGet, args, options)\n end", "def get_file_listing\n execute!(drive.files.list).data\n end", "def get_file(file_id)\n\tputs \"Getting file: \" + file_id\n\tresponse = request_get('/api/partner/file/' + file_id)\n\tputs response.body\nend", "def list_files_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: NsxComponentAdministrationApi.list_files ...\"\n end\n # resource path\n local_var_path = \"/node/file-store\"\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 => 'FilePropertiesListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NsxComponentAdministrationApi#list_files\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def list_files\n source_dir = Path.new(params[:source_dir])\n if params.has_key?(:show_catalogues)\n show_catalogues = params[:show_catalogues]\n else\n show_catalogues = false\n end\n if params[:ext].present?\n file_type = params[:ext]\n else\n file_type = nil\n end\n render json: source_dir.files(file_type: file_type, show_catalogues: show_catalogues)\n end", "def files\n results\n rescue ApiStruct::EntityError\n result\n end", "def get_file(uid, info = {}, range: nil)\n grid_info = files_collection.find(filename: uid).first\n\n filter = { files_id: grid_info[:_id] }\n\n if range\n chunk_start = range.begin / grid_info[:chunkSize]\n chunk_stop = range.end / grid_info[:chunkSize]\n\n filter[:n] = {\"$gte\" => chunk_start, \"$lte\" => chunk_stop}\n end\n\n # Query only the subset of chunks specified by the range query. We\n # cannot use Mongo::FsBucket#open_download_stream here because it\n # doesn't support changing the filter.\n chunks_view = chunks_collection.find(filter).sort(n: 1)\n\n # Create an Enumerator which will yield chunks of the requested file\n # content, allowing tus server to efficiently stream requested content\n # to the client.\n chunks = Enumerator.new do |yielder|\n chunks_view.each do |document|\n data = document[:data].data\n\n if document[:n] == chunk_start && document[:n] == chunk_stop\n byte_start = range.begin % grid_info[:chunkSize]\n byte_stop = range.end % grid_info[:chunkSize]\n elsif document[:n] == chunk_start\n byte_start = range.begin % grid_info[:chunkSize]\n byte_stop = grid_info[:chunkSize] - 1\n elsif document[:n] == chunk_stop\n byte_start = 0\n byte_stop = range.end % grid_info[:chunkSize]\n end\n\n # If we're on the first or last chunk, return a subset of the chunk\n # specified by the given range, otherwise return the full chunk.\n if byte_start && byte_stop\n yielder << data[byte_start..byte_stop]\n else\n yielder << data\n end\n end\n end\n\n Tus::Response.new(chunks: chunks, close: chunks_view.method(:close_query))\n end", "def list_files\n User.sync_files!(@context)\n files = user_real_files(params, @context)\n\n if unsafe_params[:limit] && unsafe_params[:offset]\n files = files.limit(unsafe_params[:limit]).offset(unsafe_params[:offset])\n end\n\n search_string = params[:search_string].presence || \"\"\n\n result = files.eager_load(:license, user: :org).\n where(\"nodes.name LIKE ?\", \"%#{search_string}%\").\n order(id: :desc).map do |file|\n describe_for_api(file, unsafe_params[:describe])\n end.compact\n\n render json: unsafe_params[:offset]&.zero? ? { objects: result, count: result.length } : result\n end", "def index\n @title = \"User uploaded files\"\n get_files(params)\n end", "def show\n @treq = Treq.find(params[:id])\n @treq_files = @treq.treq_files.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @treq }\n end\n end", "def file_get(id)\n response = get('FileService.getFile', id)\n end", "def test_get_list_files()\n\n path = 'folder1'\n storage = 'First Storage'\n request = GetListFilesRequest.new(path, storage)\n\n result = @storage_api.get_list_files(request)\n assert result.code == 200, 'Error while getting list files'\n assert result.files != nil\n\n end", "def discover_files\n authorize! :create, resource_class\n respond_to do |f|\n f.json do\n render json: file_locator.to_h\n end\n end\n end", "def files\n @files=get_endpoint('extra').keys\n end", "def file_data\n @client.get_file @file_url\n end", "def parse_files_json(file)\n\n files_hash = convert_json(b2_list_file_names(file))\n files = {}\n\n files_hash[\"files\"].each do |file_hash|\n files[file_hash[\"fileName\"]] = file_hash[\"fileId\"]\n end\n\n return files\n\nend", "def contents\n\tRails.logger.debug {\"getting gridfs content #{@id}\"}\n f=self.class.mongo_client.database.fs.find_one(:_id=>BSON::ObjectId.from_string(@id))\n # read f into buffer, array of chunks is reduced to single buffer and returned to caller.\n # this is how file is broken apart and put together and assembled. Buffer is sent back to browser\n # to disaply on the screen\n if f \n buffer = \"\"\n f.chunks.reduce([]) do |x,chunk| \n buffer << chunk.data.data \n end\n return buffer\n end \n\nend", "def files(params = {}, &block)\n params = convert_params(params)\n return execute_paged!(\n :api_method => self.drive.files.list,\n :parameters => params,\n :converter => proc(){ |af| wrap_api_file(af) },\n &block)\n end", "def files_get(opts = {})\n files_get_with_http_info(opts)\n end", "def show\n @file_info = FileInfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @file_info }\n end\n end", "def get_fileset\n\n filesets = batched_get( { id: params[:id] } )\n if filesets.empty?\n render_json_fileset_response(:not_found )\n else\n render_json_fileset_response(:ok, fileset_transform( filesets ) )\n end\n end", "def get(path = '/files/', params = {})\n request :get, path, params\n end", "def create\n @grid_fs_file = GridFsFile.new(grid_fs_file_params)\n\n respond_to do |format|\n if @grid_fs_file.save\n format.html { redirect_to @grid_fs_file, notice: 'Grid fs file was successfully created.' }\n format.json { render :show, status: :created, location: @grid_fs_file }\n else\n format.html { render :new }\n format.json { render json: @grid_fs_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def api(path)\n OodAppkit.files.api(path: path).to_s\n end", "def index\n @file_versions = FileVersion.all\n\n render json: @file_versions\n end", "def files_get_with_http_info(api_key, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: FilesApi.files_get ...\"\n end\n # verify the required parameter 'api_key' is set\n fail ArgumentError, \"Missing the required parameter 'api_key' when calling FilesApi.files_get\" if api_key.nil?\n # resource path\n local_var_path = \"/files\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'api_key'] = api_key\n\n # header parameters\n header_params = {}\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FilesApi#files_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_files_list_with_http_info(path, storage_name = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.get_files_list ...'\n end\n\n # verify the required parameter 'path' is set\n if @api_client.config.client_side_validation && path.nil?\n fail ArgumentError, \"Missing the required parameter 'path' when calling SlidesApi.get_files_list\"\n end\n # resource path\n local_var_path = '/slides/storage/folder/{path}'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'path', path)\n\n # query parameters\n query_params = {}\n query_params[:'storageName'] = @api_client.prepare_for_query(storage_name) unless storage_name.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 # http body (model)\n post_body = nil\n\n # form parameters\n post_files = []\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'FilesList')\n return data, status_code, headers\n end", "def fa_request(fn, name, *_)\n ix = convert_integer(fn, \"!File number\")\n @files[ix] = {name: name.sub(/^\\*/,''), path: get_file_name(name), number: ix}\n end", "def get_files_list(request)\n http_request = request.to_http_info(@api_client.config)\n make_request(http_request, :GET, 'FilesList')\n end", "def index\n # Fetches space files.\n respond_with_space_files && return if params[:space_id]\n\n # Fetches all user 'private' files.\n filter_tags = params.dig(:filters, :tags)\n\n files = UserFile.\n real_files.\n editable_by(@context).\n accessible_by_private.\n where.not(parent_type: [\"Comparison\", nil]).\n includes(:taggings).\n eager_load(user: :org).\n search_by_tags(filter_tags)\n\n return render(plain: files.size) if show_count\n\n files = files.where(parent_folder_id: @parent_folder_id)\n files = FileService::FilesFilter.call(files, params[:filters])\n\n folders = private_folders(@parent_folder_id).includes(:taggings).\n eager_load(user: :org).search_by_tags(filter_tags)\n folders = FileService::FilesFilter.call(folders, params[:filters])\n\n user_files = Node.eager_load(user: :org).where(id: (files + folders).map(&:id)).\n order(order_params).page(page_from_params).per(page_size)\n page_dict = pagination_dict(user_files)\n\n render json: user_files, root: \"files\", adapter: :json,\n meta: files_meta.\n merge(count(UserFile.private_count(@context.user))).\n merge({ pagination: page_dict })\n end", "def get_file\n rid = params[:rid]\n type = params[:type]\n aoid = params[:aoid] || ''\n ref_id = params[:ref_id] || ''\n resource = params[:resource]\n position = params[:position] || '1'\n return render_aspace_partial :partial => \"resources/bulk_file_form\", :locals => {:rid => rid, :aoid => aoid, :type => type, :ref_id => ref_id, :resource => resource, :position => position} \n end", "def get_file_summary(file_path)\n response = HTTParty.get(\"https://#{accountName}.azuredatalakestore.net\" +\n \"/webhdfs/v1/#{file_path}?op=GETCONTENTSUMMARY\", {\n body: \"grant_type=client_credentials&client_id=#{clientId}\"+\n \"&client_secret=#{clientSecret}\"+\n \"&resource=https%3A%2F%2Fmanagement.azure.com%2F\",\n headers: {\n \"Authorization\" => \"Bearer #{bearerToken}\",\n \"Accept\" => \"*/*\",\n \"Cache-Control\" => 'no-cache',\n \"Host\" => \"#{accountName}.azuredatalakestore.net\",\n \"Connection\" => 'keep-alive',\n \"cache-control\" => 'no-cache'\n },\n verify: true,\n })\n \n return JSON.parse response.read_body\n end", "def show\n @super_file = SuperFile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @super_file }\n end\n end", "def show\n @file_item = FileItem.cs(self.current_scope).find_by_path(params[:id])\n\n respond_to do |format|\n format.html do\n case @file_item.item_type\n when Saphira::FileItem::TYPE_FOLDER\n @file_items = @file_item.children\n render :action => 'index'\n else\n render\n end\n end\n format.json { render :json => @file_item }\n end\n end", "def get_file(id)\n id = self.to_id(id)\n self.grid.get(id).read\n end", "def show\n @indexed_file = IndexedFile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @indexed_file }\n end\n end", "def cl_request(fn, *_)\n get_file fn\n # No other action required\n end", "def documents_for(path, site_path = '')\n ethon = ethon_easy_json_requester\n ethon.url = \"#{computed_web_api_url(site_path)}GetFolderByServerRelativeUrl('#{uri_escape path}')/Files\"\n ethon.perform\n check_and_raise_failure(ethon)\n\n threads = []\n rv = []\n result = JSON.parse( ethon.response_body )\n result['d']['results'].each do |file|\n file_struct = OpenStruct.new(\n title: file['Title'],\n path: file['ServerRelativeUrl'],\n name: file['Name'],\n url: \"#{base_url}#{file['ServerRelativeUrl']}\",\n created_at: Time.parse(file['TimeCreated']),\n updated_at: Time.parse(file['TimeLastModified']),\n record_type: nil,\n date_of_issue: nil,\n )\n\n threads << Thread.new {\n ethon2 = ethon_easy_json_requester\n server_relative_url = \"#{site_path}#{path}/#{file['Name']}\"\n ethon2.url = \"#{computed_web_api_url(site_path)}GetFileByServerRelativeUrl('#{uri_escape server_relative_url}')/ListItemAllFields\"\n ethon2.perform\n rs = JSON.parse(ethon2.response_body)['d']\n file_struct.record_type = rs['Record_Type']\n file_struct.date_of_issue = rs['Date_of_issue']\n\n rv << file_struct\n }\n end\n threads.each { |t| t.join }\n rv\n end", "def files(folder = 0)\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/files/list?parent_id=%i' % [folder]).files\n end", "def set_grid_fs_file\n @grid_fs_file = GridFsFile.find(params[:id])\n end", "def get_files(remote_folder_path)\n str_url = @str_uri_folder + remote_folder_path\n\n signed_uri = Aspose::Cloud::Common::Utils.sign(str_url)\n response = RestClient.get(signed_uri, :accept => 'application/json')\n\n JSON.parse(response)['Files']\n\n # urlFolder = $product_uri + '/storage/folder'\n # urlFile = ''\n # urlExist = ''\n # urlDisc = ''\n # if not remoteFolderPath.empty?\n # urlFile = $product_uri + '/storage/folder/' + remoteFolderPath \n # end \n # signedURL = Aspose::Cloud::Common::Utils.sign(urlFolder)\n # response = RestClient.get(signedURL, :accept => 'application/json')\n # result = JSON.parse(response.body)\n # apps = Array.new(result['Files'].size)\n #\n # for i in 0..result['Files'].size - 1\n # apps[i] = AppFile.new\n # apps[i].Name = result['Files'][i]['Name']\n # apps[i].IsFolder = result['Files'][i]['IsFolder']\n # apps[i].Size = result['Files'][i]['Size']\n # apps[i].ModifiedDate = Aspose::Cloud::Common::Utils.parse_date(result['Files'][i]['ModifiedDate'])\n # end\n # return apps\t \n end", "def b2_list_file_names(file)\n\n auth_hash = convert_json(b2_authorize_account)\n api_url = auth_hash[\"apiUrl\"]\n account_authorization_token = auth_hash[\"authorizationToken\"]\n bucket_id = ENV['bucket_id']\n prefix = file\n\n uri = URI(\"#{api_url}/b2api/v1/b2_list_file_names\")\n req = Net::HTTP::Post.new(uri)\n req.add_field(\"Authorization\",\"#{account_authorization_token}\")\n req.body = \"{\\\"bucketId\\\":\\\"#{bucket_id}\\\", \\\"prefix\\\":\\\"#{prefix}\\\"}\"\n http = Net::HTTP.new(req.uri.host, req.uri.port)\n http.use_ssl = true\n res = http.start {|http| http.request(req)}\n\n case res\n when Net::HTTPSuccess then res.body\n when Net::HTTPRedirection then fetch(res['location'], limit - 1)\n else res.error!\n end\n\nend", "def list_all_files()\n\t\tfiles = Hash.new\n\t\trefresh_access_token()\n\t\trequest_url = \"https://www.googleapis.com/drive/v2/files?access_token=#{@access_token}\"\n\t\tresponse = RestClient.get request_url\n\t\tresponse_body = JSON.parse(response.body)\n\t\tresponse_body['items'].each do |item|\n\t\t\t\tfiles[item['id']] = item['title']\n\t\tend\n\t\treturn files\n\tend", "def list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PublicationsFileApi.list ...'\n end\n # resource path\n local_var_path = '/pulp/api/v3/publications/file/file/'\n\n # query parameters\n query_params = {}\n query_params[:'ordering'] = opts[:'ordering'] if !opts[:'ordering'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil?\n query_params[:'exclude_fields'] = opts[:'exclude_fields'] if !opts[:'exclude_fields'].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 = ['Basic']\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 => 'InlineResponse20015')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PublicationsFileApi#list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def files\n return get_result('files')\n end", "def show\n puts params[:id]\n @file_versions = FileVersion.where(versioned_file_id: params[:id]) \n #@file_versions = FileVersion.find(:versioned_file_id => params[:versioned_file_id])\n render json: @file_versions\n end", "def fs(path)\n OodAppkit.files.url(path: path).to_s\n end", "def show\n @test_file = TestFile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_file }\n end\n end", "def show\n @resource_file = ResourceFile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @resource_file }\n end\n end", "def get\n file = XFile.get(params[:id])\n raise RequestError.new(:file_not_found, \"File not found\") unless file\n raise RequestError.new(:bad_access, \"No access\") unless file.users.include? session[:user]\n raise RequestError.new(:bad_param, \"Can't get a folder\") if file.folder\n raise RequestError.new(:file_not_uploaded, \"File not completely uploaded\") unless file.uploaded\n raise RequestError.new(:bad_part, \"Incorrect content\") if file.content.nil?\n\n @result = retrieve(file, params[:part].to_i) if (!params[:direct] || params[:direct] != \"true\")\n \tsend_data(full_retrieve(file), filename: file.name) if (params[:direct] == \"true\")\n end", "def get_files_list(path, opts = {})\n @api_client.request_token_if_needed\n data, _status_code, _headers = get_files_list_with_http_info(path, opts)\n rescue ApiError => error\n if error.code == 401\n @api_client.request_token_if_needed\n data, _status_code, _headers = get_files_list_with_http_info(path, opts)\n else\n raise\n end\n return data\n end", "def show\n @up_file = UpFile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @up_file }\n end\n end", "def index\n fs = FileStore.by_hash(params[:hash])\n\n file_stores = fs.map do |item|\n {\n sha1_hash: item.sha1_hash,\n file_name: File.basename(item.file.path),\n user: {\n id: item.user_id,\n uname: item.user_uname\n }\n }\n end\n render json: file_stores\n end", "def show\n @breadcrumb = 'read'\n @processed_file = ProcessedFile.find(params[:id])\n @processed_file_items = @processed_file.processed_file_items.paginate(:page => params[:page], :per_page => per_page)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @processed_file }\n end\n end", "def file\n if params[:version] && !params[:version].match?(/^[1-9]\\d*$/)\n render(plain: \"400 Bad Request: version parameter must be positive integer\", status: :bad_request)\n return\n end\n\n obj_version = params[:version].to_i if params[:version]&.match?(/^[1-9]\\d*$/)\n location = MoabStorageService.filepath(druid, params[:category], params[:filepath], obj_version)\n if location\n send_file location\n else\n render(plain: \"404 File Not Found: #{druid}, #{params[:category]}, #{params[:filepath]}, #{params[:version]}\", status: :not_found)\n end\n rescue ArgumentError => e\n render(plain: \"400 Bad Request: #{e}\", status: :bad_request)\n rescue Moab::MoabRuntimeError => e\n render(plain: \"404 Not Found: #{e}\", status: :not_found)\n end", "def userfiles_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UserfilesApi.userfiles_get ...'\n end\n # resource path\n local_var_path = '/userfiles'\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'multipart/form-data'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BrainPortalSession']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Userfile>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UserfilesApi#userfiles_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @inventory_files = InventoryFile.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @inventory_files }\n end\n end", "def update\n respond_to do |format|\n if @grid_fs_file.update(grid_fs_file_params)\n format.html { redirect_to @grid_fs_file, notice: 'Grid fs file was successfully updated.' }\n format.json { render :show, status: :ok, location: @grid_fs_file }\n else\n format.html { render :edit }\n format.json { render json: @grid_fs_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def file(file_type, id)\n query = \"/?client_id=#{@client_id}&#{id}\"\n path = \"#{file_type}/#{__method__}.to_s\"\n resp = http_get(path, query)\n end", "def show\n @spawner = Spawner.find(params[:id])\n\n @files = Dir.glob(\"/Users/jmadin/Dropbox/web/trimodal/spawned_thumbs/*\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @spawner }\n end\n end", "def show\n @uploaded_file = UploadedFile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @uploaded_file }\n end\n end", "def all\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n files(-1)\n end", "def find_file path, options = {}\n ensure_connection!\n resp = connection.get_file name, path, options\n if resp.success?\n File.from_gapi resp.data, connection\n else\n fail ApiError.from_response(resp)\n end\n end", "def show\n @userfile = Userfile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @userfile }\n end\n end", "def call(path, stat: false)\n endpoint = \"/api/rest/v1/files/#{ERB::Util.url_encode(path)}\"\n endpoint = \"#{endpoint}?action=stat\" if stat\n res = client.get(endpoint)\n return nil if !res || res.empty?\n\n BrickFTP::Types::File.new(**res.symbolize_keys)\n end", "def fetch_file(file_path)\n client.get_file(file_path)\n end", "def file_get(input={}, raw=false)\n response = post('mw/File.Get', input, raw)\n end", "def index\n @authorized = true\n begin\n authorize! :show, UploadFile\n rescue CanCan::AccessDenied\n @authorized = false\n end\n #added to avoid raise condition when initially uploading multiple files\n check_uploads_collection unless !@authorized\n\n respond_to do |format|\n format.json {\n #TODO find_by_solr could be faster \n @multiresimages = current_user.upload_files.map do |file|\n begin\n Multiresimage.find(file.pid)\n rescue ActiveFedora::ObjectNotFoundError\n end\n end.compact\n render :json=>@multiresimages.map(&:to_jq_upload)\n }\n format.html\n end\n end", "def file_info bucket_name, filename\n body_wrap = b2_list_file_names bucketId: (bucket_id bucket_name: bucket_name), maxFileCount: 1, startFileName: filename\n files_hash = body_wrap.files\n raise NotFound, \"#{filename} not found\" unless files_hash.size == 1\n files_hash.first\n end", "def file_get fnum\n\t\tds = Sdb[:file_info].filter(:fnum => fnum)\n\t\tunless ds.empty?\n\t\t\tsend_file Spath[:upload_dir] + ds.get(:path).to_s, :type => ds.get(:type).split('/').last.to_sym\n\t\telse\n\t\t\tmodule_name = \"view\"\n\t\t\tpath = \"#{Smods[module_name]}#{Spath[:assets]}images/default.jpg\"\n\t\t\tsend_file path, :type => :jpeg\n\t\tend\n\tend", "def get_firmware_files\n response = request(:get, \"/devmgr/v2/firmware/cfw-files/\")\n status(response, 200, 'Failed to get uploaded firmware file list')\n JSON.parse(response.body)\n end", "def get_template_files(opts)\n path = \"/template/files/#{opts[:template_id]}\"\n if opts[:file_type]\n path = path + \"?file_type=#{opts[:file_type]}\"\n end\n if opts[:get_url]\n separator = opts[:file_type].nil? ? '?' : '&'\n path = path + \"#{separator}get_url=#{opts[:get_url]}\"\n end\n\n get(path)\n end", "def file(name)\n begin\n @name=name\n @content=get_rest(\"extra/#{@name}\")\n rescue Stingray::NotFoundError \n nil\n end\n end", "def show\n render json: @file, serializer: FileSerializer, :root => \"file\"\n end", "def get\n text_file = TextFile.find_by(name: params['name'])\n response = {}\n if text_file\n response = create_response(text_file)\n end\n render json: response\n end", "def files_get(api_key, opts = {})\n files_get_with_http_info(api_key, opts)\n return nil\n end", "def files; end", "def files; end", "def files; end", "def files; end", "def files; end", "def files; end", "def do_file(req,res)\n path = req.path.gsub(/^(\\/|\\.)+/,\"\")\n return do_GET(req,res,path) if File.exists? path\n raise WEBrick::HTTPStatus::NotFound, \"`#{path}' not found.\"\n end", "def get_the_individual_file_to_be_processed\n # p \"individual file selection\"\n files = GetFiles.get_all_of_the_filenames(@project.freecen_files_directory, @project.file_range)\n files\n end", "def get_files(query_obj=nil,with_nested_resources=false)\n uri = URI.parse(@uri + \"/Files\")\n results = get(uri,query_obj,with_nested_resources)\n end", "def index\n raise ArgumentError, 'Missing file parameter' if filename.blank?\n\n @available_in_workspace = Dor::Services::Client.object(params[:item_id]).files.list.include?(filename)\n\n respond_to do |format|\n format.html { render layout: !request.xhr? }\n end\n end", "def test_get_list_file_versions\n\n path = 'folder1/FileTest.pdf'\n storage = 'First Storage'\n request = GetListFileVersionsRequest.new(path, storage)\n\n result = @storage_api.get_list_file_versions(request)\n assert result.code == 200, 'Error get list file versions'\n assert result.file_versions != nil\n\n end", "def path\n '/c/document_library/get_file?folderId=%i&name=%s' % [self.folderid, self.name]\n end", "def get_files\n return @files if @files.present?\n raise \"No user token present\" unless access[:user_token].present?\n @files ||= get(proviso_url + \"files\")\n @files.presence || raise(\"No files available\")\n end", "def show\n @mfile = Mfile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mfile }\n end\n end", "def show\n @action_file = ActionFile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @action_file }\n end\n end", "def index\n Dir[\"#{@base_path}/*.json\"].map{|p| File.basename(p)}\n end" ]
[ "0.7289484", "0.67869484", "0.66224265", "0.65236616", "0.6508666", "0.6484275", "0.6459051", "0.6373942", "0.6356309", "0.63549453", "0.63456386", "0.63422716", "0.633014", "0.6326434", "0.6282557", "0.6266039", "0.62487763", "0.6242013", "0.6230046", "0.6208255", "0.6157538", "0.61552787", "0.6155065", "0.6134169", "0.6130741", "0.6118959", "0.61020565", "0.61011493", "0.6091548", "0.6080738", "0.60775596", "0.6073308", "0.607105", "0.60692716", "0.6044495", "0.6033191", "0.6031728", "0.60305196", "0.60200673", "0.60036325", "0.5994702", "0.5994332", "0.5989538", "0.5977593", "0.5977124", "0.59697753", "0.59685856", "0.5968497", "0.5954095", "0.59343135", "0.59333664", "0.5924004", "0.59228396", "0.59055513", "0.5898224", "0.58938026", "0.5891095", "0.58867604", "0.58844554", "0.58836126", "0.58823234", "0.5881677", "0.5878197", "0.5871567", "0.5868147", "0.58660614", "0.5865545", "0.5862037", "0.5854824", "0.58523166", "0.5843341", "0.5843046", "0.5824584", "0.58104354", "0.5810017", "0.5809506", "0.58031166", "0.5799365", "0.57884884", "0.57846785", "0.5781278", "0.5770266", "0.5767428", "0.5766454", "0.57625115", "0.576197", "0.576197", "0.576197", "0.576197", "0.576197", "0.576197", "0.5754462", "0.57516676", "0.57337064", "0.5730133", "0.5727915", "0.5711908", "0.57035893", "0.57026356", "0.56992364", "0.56990963" ]
0.0
-1
POST /grid_fs_files POST /grid_fs_files.json
def create @grid_fs_file = GridFsFile.new(grid_fs_file_params) respond_to do |format| if @grid_fs_file.save format.html { redirect_to @grid_fs_file, notice: 'Grid fs file was successfully created.' } format.json { render :show, status: :created, location: @grid_fs_file } else format.html { render :new } format.json { render json: @grid_fs_file.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def grid_fs_file_params\n params.require(:grid_fs_file).permit(:filename, :contentType, :author, :topic, :uploadDate, :length, :chunkSize, :md5, :contents)\n end", "def upload_upload(directory:, files:)\n upload_files = {multipart: true}\n files.each {|f| upload_files[f] = File.open(f, 'rb')}\n r = aptly_request 'POST', \"api/files/#{directory}\", payload: upload_files\n JSON.parse(r.body)\n end", "def upload_file(folder_id, file_url) \n\tputs \"Uploading file: \" + file_url + \" to folder: \" + folder_id\n\tfile = {\n\t\t:url => file_url, \n\t\t:name => \"Ruby_File.pdf\", \n\t\t:notes => \"This was uploaded using Ruby\", \n\t\t:copies => 1, \n\t\t:folderId => folder_id,\n\t\t# :flow => \"Flow ezName\" # The flow value is either the easy submit name of the flow or the _id property from get_flows()\n\t}\n\tdata = JSON.generate(file)\n\tresponse = request_post('/api/partner/file', data)\n\tputs response.body\nend", "def create\n files = params[:files]\n\n files.each do |file|\n\n filename = file.original_filename\n\n # Rack uploads have `#tempfiles` and test uploads are Tempfile objects. More\n # investigation required.\n file = file.tempfile if file.respond_to?(:tempfile)\n\n UploadStore.create(\n :key => filename,\n :body => file,\n :public => true\n )\n end\n\n render json: {status: 'success'}\n end", "def save_file_batch(files, new_obj_id)\n url = \"#{@base_url}/api/v2/files/#{new_obj_id}/create_batch\"\n resp = api_post_json(url, files.to_json)\n if resp.code != '201'\n @log.write(\"Error saving #{files.count} files #{files[0]['identifier']}...\\n\")\n @log.write(files.inspect)\n @log.write(\"\\n\" + resp.body + \"\\n\")\n #exit(1)\n end\n end", "def post_file(filename,repo)\n curl_post(\"#{self.host}/api2/repos/#{repo}/file/?p=#{filename}\",{\"operation\"=> \"create\"}).body_str\n end", "def create\n\n params['file'].each{|f|\n doc = Community::File.new(community_file_params)\n doc.file = f\n community_file_params[:title].blank? ? doc.title = f.original_filename : doc.title = community_file_params[:title]\n doc.author = current_user.email unless current_user.nil?\n doc.save\n\n file = File.read('public/uploads/community/file/file/' + doc._id.to_s + '/' + doc.file.filename)\n\n doc.import JSON.parse(file)\n } unless params['file'].nil?\n\n respond_to do |format|\n format.js {}\n format.json { head :no_content, status: :created }\n end\n end", "def index\n @grid_fs_files = GridFsFile.all\n end", "def post_file_to_server id, content, size, page_count, extension = \".jpg\"\n\n @s.execute_file_post @s.url_for(\"system/pool/createfile.#{id}.page#{page_count}-#{size}\"), \"thumbnail\", \"thumbnail\", content, related_mimetype(extension)\n alt_url = @s.url_for(\"p/#{id}/page#{page_count}.#{size}\" + extension)\n @s.execute_post alt_url, {\"sakai:excludeSearch\" => true}\n log \"Uploaded image to curl #{alt_url}\"\nend", "def new_feature_request(folder_id, feature_content, file_name)\n url = URI(\"#{$base_url}/api/projects/#{$project_id}/folders/#{folder_id}/create_from_feature\")\n\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n request = Net::HTTP::Post.new(url)\n request[\"accept\"] = 'application/vnd.api+json; version=1'\n request[\"access-token\"] = $access_token\n request[\"uid\"] = $uid\n request[\"client\"] = $client\n request[\"Content-Type\"] = 'application/json'\n\n data = {\n data: {\n attributes: {\n \"feature\": feature_content\n }\n }\n }\n\n request.body = JSON.generate(data)\n response = http.request(request)\n\n if response.code == 200.to_s\n $created_count = $created_count + 1\n $success_uploaded_count = $success_uploaded_count + 1\n $uploaded_features_list.push(file_name)\n puts \"Feature '#{get_name_feature_from_file(feature_content)}' created.\"\n else\n $fail_uploaded_count = $fail_uploaded_count + 1\n $not_uploaded_features_list.push(file_name)\n end\n\n response.code\nend", "def upload_file\n #TODO\n end", "def create\n #@file_folder = FileFolder.new(file_folder_params)\n @folder = current_user.folders.where(\"id = ?\", params[:current_folder_id]).first\n @files = @folder.file_folders.build \n io_file = params[:file]\n respond_to do |format|\n if @files.store(io_file)\n @files = [] << @files\n format.js {render \"files_list\", status: 200}\n else\n format.js {render js: \"alert('Could not create file\", status: 400}\n end \n end \n end", "def create_folder_with_files(folder_name, recipient, sender) \n\tputs \"Creating folder with files.\"\n\tdata = {\n\t\t\"name\" => folder_name,\n\t\t\"from\" => sender,\n\t\t\"to\" => recipient,\n\t\t\"files\" => [{\n\t\t\t\"name\" => \"Ruby_File1.pdf\",\n\t\t\t\"copies\" => 1,\n\t\t\t\"notes\" => \"Ruby_File1 was uploaded using Ruby\",\n\t\t\t\"url\" => \"file_url1\"\n\t\t}, {\n\t\t\t\"name\" => \"Ruby_File2.pdf\",\n\t\t\t\"copies\" => 1,\n\t\t\t\"notes\" => \"Ruby_File2 was uploaded using Ruby\",\n\t\t\t\"url\" => \"file_url2\"\n\t\t}]\n\t}.to_json()\n\tputs data\n\tresponse = request_post('/api/partner/folder', data)\n\tputs response.body\nend", "def add_file(filename)\n step('I visit the new file page')\n fill_in(\"file_label\", with: filename)\n attach_file('file_file', filename)\n fill_in('file_description', with: sample_file_description(filename))\n click_link_or_button('Upload File')\n wait_for_ajax_complete\nend", "def upload_file\n file = google_session.upload_from_file(file_params[:file].tempfile,\n file_params[:file].original_filename)\n collection.add(file)\n google_session.root_collection.remove(file)\n render json: 'Upload Successful'\n end", "def post(path = '/files/', params = {})\n request :post, path, params\n end", "def upload(path)\n name = ::File.basename(path)\n data = ::File.read(path)\n _post_with_file(\"/files\", file: data, filename: name) { |json| json }\n end", "def perform_study_file_upload(filename, study_file_params, study_id)\n file_upload = Rack::Test::UploadedFile.new(Rails.root.join('test', 'test_data', filename))\n study_file_params[:study_file].merge!(upload: file_upload)\n patch \"/single_cell/studies/#{study_id}/upload\", params: study_file_params, headers: {'Content-Type' => 'multipart/form-data'}\nend", "def multipart_upload\n end", "def create\n data =params[:data]\n\n resource = ActiveSupport::JSON.decode(data)\n @repo = Repository.find(resource[\"repo_id\"])\n dir_path = resource[\"dirPath\"];\n post = DataFile.save(params['file'], @repo.path+dir_path)\n\n\t\t@git = GitHelper.init(@repo.path, current_user.email, current_user.name)\n\t\tGitHelper.commitAll(@git, resource[\"comment\"])\n\n\t\trender json: {success: \"file uploaded\"}\n end", "def files(trading_partner_id, filename)\n scope 'default'\n url = URI.parse(@api_url + '/files/')\n\n File.open(filename) do |f|\n req = Net::HTTP::Post::Multipart.new url.path,\n 'file' => UploadIO.new(f, 'application/EDI-X12', filename),\n 'trading_partner_id' => trading_partner_id\n req['Authorization'] = \"Bearer #{default_scope.token}\"\n req['User-Agent'] = user_agent\n\n @response = Net::HTTP.start(url.host, url.port) do |http|\n http.request(req)\n end\n end\n\n JSON.parse(@response.body)\n end", "def Upload file\n \n APICall(path: \"uploads.json?filename=#{file.split('/').last}\",method: 'POST',payload: File.read(file))\n \n end", "def uploadFolder(folder,foldersync,googlefolder)\n puts \"Feature Pending\"\n #Create the collection\n #uploadFile(file)\nend", "def create\n puts 'create happening'\n grid_fs = Mongoid::GridFS\n uploaded_io = params[:article][:filename]\n g = grid_fs.put(uploaded_io)\n puts \"uploaded file +++++++++ #{g.inspect} +++++++++++\"\n @article = Article.new(params[:article])\n puts 'created article'\n @article.filename = uploaded_io.original_filename\n @article.grid_fs_id = g.id\n puts 'set filename in article'\n \n\n respond_to do |format|\n if @article.save\n puts 'saving the article'\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_attachment(file_s)\n setup\n @req = Net::HTTP::Post.new(\"/uploads.json\")\n auth\n @req[\"Content-Type\"] = \"application/octet-stream\"\n @req[\"Content-Length\"] = file_s.length\n @req.body = file_s\n res = @http.request(@req)\n\n if res.code.to_i == 201\n return [true, JSON.load(res.body)[\"upload\"][\"token\"]]\n else\n return [false, JSON.load(res.body)[\"errors\"].first]\n end\n end", "def import\n @obj = Node.create_sub_tree JSON.parse(File.read(params[:file_to_upload].tempfile.path), symbolize_names: true)\n\n respond_to do |format|\n format.html { redirect_to @obj, notice: 'Node was successfully created.' }\n format.json { render json: @obj, status: :created, location: @obj }\n end\n end", "def create_file\n project = UserFile.publication_project!(current_user, @scope)\n\n api = DIContainer.resolve(\"api.user\")\n file_dxid = api.file_new(params[:name], project)[\"id\"]\n\n file = UserFile.create!(\n dxid: file_dxid,\n project: project,\n name: params[:name],\n state: \"open\",\n description: params[:description],\n user: current_user,\n parent: current_user,\n scope: @scope,\n UserFile.scope_column_name(@scope) => @folder&.id,\n )\n\n render json: { id: file.uid }\n end", "def update\n respond_to do |format|\n if @grid_fs_file.update(grid_fs_file_params)\n format.html { redirect_to @grid_fs_file, notice: 'Grid fs file was successfully updated.' }\n format.json { render :show, status: :ok, location: @grid_fs_file }\n else\n format.html { render :edit }\n format.json { render json: @grid_fs_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def new_files; end", "def post_job_content_sample(client)\n job_multipart = {\n :file => File.new($full_path),\n 'num copies' => 10\n }\n\n response = client['jobs'].post job_multipart\n\n p ''\n p 'Submit a new job'\n p response\nend", "def set_grid_fs_file\n @grid_fs_file = GridFsFile.find(params[:id])\n end", "def create\n hash = []\n params[:files].each do |i,file_io|\n path = File.join(Rails.root,'public','attach',file_io.original_filename)\n File.open(path, \"wb\") { |f| f.write(file_io.read)}\n attachment = Attachment.create do |attach|\n attach.name = file_io.original_filename\n attach.describe = params[:describe]\n end \n hash.push attachment\n end\n render json: hash\n end", "def create_file\n d \"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\"\n d \"create_file\"\n d \"vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv\"\n \n parent_dir = Directory.find_by_id( params[:sel_id] )\n if !parent_dir\n render json: 'The directory does not exist', :layout => false, \n status: :unprocessable_entity and return\n end\n d parent_dir\n d parent_dir.dfiles\n @dfile = parent_dir.dfiles.create(\n name: params[:name],\n ftype: params[:ftype]\n )\n d @dfile\n if !@dfile\n render json: @dfile.errors, :layout => false, \n status: :unprocessable_entity and return\n else\n reponse = { action_id: params[:action_id],\n new_id: @dfile.id,\n new_name: @dfile.name,\n parent_id: @dfile.directory_id,\n kind_name: @dfile.typeName()\n }\n render :json => reponse, :layout => false, :status => 200 and return\n end\n \n \n # @dfile = parent_dir.dfiles.build(\n # name: params[:name],\n # ftype: params[:ftype]\n # )\n # d @dfile\n # if !@dfile\n # render json: @dfile.errors, :layout => false, \n # status: :unprocessable_entity and return\n # end\n # if @dfile.save\n # reponse = { action_id: params[:action_id],\n # new_id: @dfile.id,\n # new_name: @dfile.name,\n # parent_id: @dfile.directory_id,\n # kind_name: @dfile.typeName()\n # }\n # render :json => reponse, :layout => false, :status => 200 and return\n # else\n # render json: @dfile.errors, :layout => false, \n # status: :unprocessable_entity and return\n # end\n\n end", "def upload\n @db=Database.find(params[:id])\n @files = params[:files]\n @files.each do |file|\n name = file.original_filename\n directory = @db.path\n path = File.join(directory, name)\n File.open(path, \"wb\") { |f| f.write(file.read) }\n end\n flash[:notice] = \"File uploaded\"\n respond_to do |format|\n format.html {redirect_to files_database_url(@db)}\n format.json { render json: @files }\n end\n end", "def upload\r\n \r\n end", "def upload_file(bucket_key,file_location,file_name,access_token)\n file_uploaded = File.new(file_location, 'rb')\n response = RestClient.put(\"#{API_URL}/oss/v2/buckets/#{bucket_key}/objects/#{file_name}\",\n file_uploaded,\n { Authorization: \"Bearer #{access_token}\", content_type:'application/octet-stream'})\n return response\nend", "def file_uploads; end", "def files_post(file, opts = {})\n files_post_with_http_info(file, opts)\n end", "def files_upload(params = {})\n response = @session.do_post \"#{SCOPE}.upload\", params\n Slack.parse_response(response)\n end", "def uploadFile(fileName)\n\n puts \"Uploading '#{fileName}' to TestFlight ... \"\n\n currentTime = Time.new\n \n payload = {\n :api_token => API_TOKEN,\n :team_token => TEAM_TOKEN,\n :file => File.new(fileName.to_s, 'rb'),\n :notes => NOTES + \" (\"+currentTime.inspect+\")\",\n :distribution_lists => DIST_LIST,\n :notify => NOTIFY\n }\n \n begin\n response = RestClient.post(END_POINT, payload, :accept => :json)\n rescue => e\n response = e.response\n end\n \n if (response.code == 201) || (response.code == 200)\n puts \"Upload complete.\"\n else\n puts \"Upload failed. (#{response})\"\n end\n \nend", "def file_operation_params\n params.require(:file_operation).permit(:file_path, :status, :job_class, :user_type, :user_id, :info)\n end", "def postIngest_file( job_id, filedata)\n params = Hash.new\n params['job_id'] = job_id\n params['filedata'] = filedata\n return doCurl(\"post\",\"/ingest_file\",params)\n end", "def upload_file(item_file)\n upload_response = @server.upload(item_file.file(item_file.metadata_full_path))\n json = JSON.parse(upload_response.body)\n json['files'].map { |f| f['id'] }\n end", "def files_json_seed(json, entry)\n Pageflow.config.file_types.each do |file_type|\n json.set!(file_type.collection_name) do\n json.array!(entry.find_files(file_type.model)) do |file|\n json.partial!('pageflow/files/file', file: file, file_type: file_type)\n end\n end\n end\n end", "def fa_request(fn, name, *_)\n ix = convert_integer(fn, \"!File number\")\n @files[ix] = {name: name.sub(/^\\*/,''), path: get_file_name(name), number: ix}\n end", "def files_post_with_http_info(file, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: FilesApi.files_post ...\"\n end\n # verify the required parameter 'file' is set\n if @api_client.config.client_side_validation && file.nil?\n fail ArgumentError, \"Missing the required parameter 'file' when calling FilesApi.files_post\"\n end\n # resource path\n local_var_path = \"/files\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # form parameters\n form_params = {}\n form_params[\"file\"] = file\n form_params[\"deal_id\"] = opts[:'deal_id'] if !opts[:'deal_id'].nil?\n form_params[\"person_id\"] = opts[:'person_id'] if !opts[:'person_id'].nil?\n form_params[\"org_id\"] = opts[:'org_id'] if !opts[:'org_id'].nil?\n form_params[\"product_id\"] = opts[:'product_id'] if !opts[:'product_id'].nil?\n form_params[\"activity_id\"] = opts[:'activity_id'] if !opts[:'activity_id'].nil?\n form_params[\"note_id\"] = opts[:'note_id'] if !opts[:'note_id'].nil?\n\n # http body (model)\n post_body = nil\n auth_names = [ 'access_token' ]\n response = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FilesApi#files_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return response\n end", "def new_by_mass_upload\n end", "def upload\n end", "def upload\n end", "def upload\n secure_silence_logs do\n return bad_request unless params[:file] && params[:title] && current_account\n is_file = params[:file].respond_to?(:path)\n if !is_file && !(URI.parse(params[:file]) rescue nil)\n return bad_request(:error => \"The 'file' parameter must be the contents of a file or a URL.\")\n end\n \n if params[:file_hash] && Document.accessible(current_account, current_organization).exists?(:file_hash=>params[:file_hash])\n return conflict(:error => \"This file is a duplicate of an existing one you have access to.\")\n end\n params[:url] = params[:file] unless is_file\n @response = Document.upload(params, current_account, current_organization).canonical\n render_cross_origin_json\n end\n end", "def create\n @file_path = params[:file]\n if params[:stored_file].blank?\n @stored_file = StoredFile.new(name: @file_path.original_filename, path: @file_path.original_filename)\n else\n @stored_file = StoredFile.new(stored_file_params)\n end\n upload_ftp_file\n\n respond_to do |format|\n if @stored_file.save\n format.html { redirect_to @stored_file, notice: 'Stored file was successfully created.' }\n content = {}\n content[\"storage\"] = @stored_file\n content[\"replace\"] = @ftp_data\n render json: content\n else\n format.html { render :new }\n format.json { render json: @stored_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_grid_attachment(name,file)\n data = case\n when file.is_a?(Hash)\n file[:tempfile].read\n else\n file.respond_to?(:read) ? file.read : file\n end\n grid.put(\n data,\n :filename => read_attribute(\"#{name}_name\"),\n :content_type => read_attribute(\"#{name}_type\"),\n :_id => read_attribute(\"#{name}_id\")\n )\n create_attachment_queue.delete(name)\n end", "def create_file(uid, info = {})\n content_type = Tus::Info.new(info).metadata[\"content_type\"]\n\n create_grid_file(\n filename: uid,\n content_type: content_type,\n )\n end", "def create_file\n dest_file = Item.new(Path.new(params[:dest_file]))\n content = params[:content]\n response = {}\n response[:dest_file] = dest_file\n permission = params[:force_permission]\n if dest_file.create(content, permission)\n response[:msg] = \"Success\"\n render json: response, status: 200\n else\n response[:msg] = \"Fail\"\n render json: response, status: 422\n end\n end", "def create_file(title, description, parent_id, mime_type, file_name)\n \tinsert_file(title, description, parent_id, 'application/vnd.google-apps.file', file_name)\n\tend", "def dropbox_upload_file(file, dest)\n url = \"https://content.dropboxapi.com/2/files/upload\"\n\n headers = {\n \"Content-Type\" => \"application/octet-stream\",\n \"Dropbox-API-Arg\" => JSON.generate(\n path: dest,\n mode: \"add\",\n autorename: false\n )\n }\n\n dropbox_post_json(url, headers: headers, payload: File.read(file)) do |json|\n json[\"path_display\"]\n end\n end", "def files_post_with_http_info(api_key, file, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: FilesApi.files_post ...\"\n end\n # verify the required parameter 'api_key' is set\n fail ArgumentError, \"Missing the required parameter 'api_key' when calling FilesApi.files_post\" if api_key.nil?\n # verify the required parameter 'file' is set\n fail ArgumentError, \"Missing the required parameter 'file' when calling FilesApi.files_post\" if file.nil?\n # resource path\n local_var_path = \"/files\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'api_key'] = api_key\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(['multipart/form-data'])\n\n # form parameters\n form_params = {}\n form_params[\"file\"] = file\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'File')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FilesApi#files_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def on_post(path)\n acct = I3.server.remote_account\n local_path = DocumentFile::DOC_FILE_PATH + path\n \n # Sanity checks\n unless File.directory?(local_path)\n send_uploaded_file_response I3::NotFoundException.new(\n :message => \"The path '#{path}' could not be found.\")\n return\n end #unless\n \n if DocumentPlatform.check_permission(:write, acct, local_path).empty?\n send_uploaded_file_response I3::SecurityException.new(\n :message => \"You do not have permission to write to folder '#{path}'\")\n return\n end #if\n \n # We are good to go so far, so let's grab the file\n file = I3.server.cgi[\"fileToUpload\"]\n filename = file.filename\n \n # Internet Explorer will sometimes send the whole path. We only want the filename.\n filename = filename.split(\"\\\\\").last if filename =~ /\\w:\\\\/\n \n begin\n response = UploadedFile.save_as(filename, file, local_path)\n send_uploaded_file_response response\n \n rescue I3::SecurityException\n log.warn \"User #{acct.account_name} tried to upload a file to '#{path}' and was denied.\"\n send_uploaded_file_response $!\n \n rescue FileAlreadyExistsException\n log.warn \"User #{acct.account_name} failed to save file '#{File.join(path, filename)}'\" + \n \" (#{$!.message})\"\n response = $!.to_shared\n response.temp_file = UploadedFile.save_as_temp(file)\n response.path = path\n response.original_filename = filename\n response.overwritable = (not DocumentPlatform.check_permission(\n :write, acct, File.join(local_path, filename)).empty?)\n send_uploaded_file_response response\n rescue\n log.warn \"User #{acct.account_name} failed to save file '#{File.join(path, filename)}'\" + \n \" (#{$!.message})\"\n send_uploaded_file_response I3::ServerException.new(\n :title => \"Could not save file\", \n :message => $!.message )\n end #begin\n \n end", "def server_put_file(server, io, remote_path, options={})\n request(\n :method => :post,\n :path => \"containers/#{server.id}/files\",\n :params => {\n :path => remote_path\n },\n :body => io,\n :headers => {\n 'Transfer-Encoding' => 'chunked',\n 'X-LXD-uid' => options.fetch(:uid, 0),\n 'X-LXD-gid' => options.fetch(:gid, 0),\n 'X-LXD-mode' => options.fetch(:mode, 0700)\n }\n )\n true\n end", "def create\n @treq = Treq.new(params[:treq])\n \n respond_to do |format|\n if @treq.save\n unless params[:treq_files].blank?\n params[:treq_files]['file'].each do |a|\n @treq_file = @treq.treq_files.create!(:file => a, :treq_id => @treq.id)\n end\n end\n TreqNotifier.submit_treq(@treq).deliver\n format.html { redirect_to @treq, notice: 'Treq was successfully created.' }\n format.json { render json: @treq, status: :created, location: @treq }\n else\n format.html { render action: \"new\", alert: \"Test Requset has been submitted.\"}\n format.json { render json: @treq.errors, status: :unprocessable_entity }\n end\n end\n end", "def _upload(api_key, file) \n url = Client.site + \"/upload.json\"\n params = { \"api_key\" => api_key, \"api_method\" => \"ruby\", \"id\" => id.to_s, \"file\" => file }\n resp = HTTPClient.post url, params \n JSON.parse(resp.content)\n end", "def test_send_multiple_files()\n # Parameters for the API call\n file = File::open(TestHelper.get_file('http://localhost:3000/response/image'))\n file1 = File::open(TestHelper.get_file('http://localhost:3000/response/image'))\n\n # Perform the API call through the SDK function\n result = @controller.send_multiple_files(file, file1)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n end", "def create_upload_files(record)\n return unless record.mapper.respond_to?(:files)\n files_to_attach = record.mapper.files\n return [] if files_to_attach.nil? || files_to_attach.empty?\n\n uploaded_file_ids = []\n files_to_attach.each do |filename|\n file = File.open(find_file_path(filename))\n uploaded_file = Hyrax::UploadedFile.create(user: depositor, file: file)\n uploaded_file_ids << uploaded_file.id\n file.close\n end\n uploaded_file_ids\n end", "def batch_file_params\n params.require(:batch_file).permit(:name, :file)\n end", "def test_attach_file\n# post :upload, \"note\"=>{\"title\"=>\"my note\"}, \"courseid\"=>\"806350272748085520\",\n# \"processor\"=>{\"id\"=>\"1000001\"}, \"success\"=>\"/course/806350272748085520/ACMA-320/share_notes\", \n# \"upload_id\"=>\"1169944954\", \n# \"failure\"=>\"/course/806350272748085520/ACMA-320/share_notes\"\n \n post :upload, \"noteid\"=>\"816717565610925385\", \"processor\"=>{\"id\"=>\"1000001\"}\n \n end", "def upload_item(item, file, parent = '0BxnZXCons72AYXZOTVVrdGk0bTg' )\n tmp_file = Tempfile.new('mendeley').tap do |f|\n f.binmode # must be in binary mode\n f.write file\n f.rewind\n end\n \n metadata = @drive.files.insert.request_schema.new({\n 'title' => item[:title],\n 'description' => item[:description],\n 'mimeType' => 'application/pdf',\n 'parents' => [{'id' => parent}]\n }) \n \n conn = Faraday.default_connection\n conn.options[:timeout] = 500 \n conn.options[:open_timeout] = 2 \n \n media = Google::APIClient::UploadIO.new(tmp_file, 'application/pdf') \n result = @client.execute(:api_method => @drive.files.insert,\n :parameters => { 'uploadType' => 'multipart', 'alt' => 'json' },\n :body_object => metadata,\n :media => media, \n :connection => conn\n )\n tmp_file.close!\n result.data\n end", "def create\n file = params[:file_store][:file]\n file_store = FileStore.new\n file_store.sha1_hash = Digest::SHA1.file(file.path).hexdigest\n file_store.file = file\n file_store.user_id, file_store.user_uname = user['id'], user['uname']\n\n if file_store.save\n File.delete file.path\n render json: { sha1_hash: file_store.sha1_hash }, status: :created\n else\n render json: file_store.errors, status: :unprocessable_entity\n end\n end", "def create_file(file)\n @generic_file = GenericFile.new\n @generic_file.batch_id = object.batch.pid\n @generic_file.add_file(file.read, 'content', file.name)\n @generic_file.apply_depositor_metadata(object.edit_users.first)\n @generic_file.date_uploaded = Time.now.ctime\n @generic_file.date_modified = Time.now.ctime\n @generic_file.save\n end", "def create\n @results = []\n\n unless params[:files].nil?\n params[:files].each do |data|\n img = Image.new\n img.filename = data.original_filename\n img.data = data.read\n img.upload_id = params[:uuid]\n img.visitation_form_id = params[:formId]\n img.image_type = params[:imageType]\n img.content_type = data.content_type\n #img.temp_index = params[:birdIndex]\n img.bird_id = params[:birdId]\n\n if !img.save\n render :json => { :errors => img.errors.full_messages }, :status => 400 and return\n else\n @results << { name: img.filename, imageType: img.image_type, id: img.id }\n end\n end\n end\n\n render json: { files: @results }\n end", "def upload(opts, files)\n request(\n :post,\n \"#{opts['a']}#{UPLOAD_URL}?key=#{opts['t']}\",\n 'files'.to_sym => files\n )\n end", "def add_fileset\n\n # grab the parameters\n work_id = params[:work]\n file_id = params[:file]\n label = params[:label]\n\n # validate them\n if work_id.blank? == false && file_id.blank? == false && label.blank? == false\n work = get_the_work( work_id )\n if work.nil? == false\n filename = APIV1FilesetsController.cache_contents( file_id )\n if filename.blank? == false\n fileset = ::FileSet.new\n fileset.title << label\n file_actor = ::CurationConcerns::Actors::FileSetActor.new( fileset, @api_user )\n file_actor.create_metadata( work )\n file_actor.create_content( File.open( filename ) )\n fileset.visibility = Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC\n fileset.save!\n\n # audit the information\n #audit_log( \"File #{label} for work id #{work_id} (#{work.identifier}) added by #{User.cid_from_email( @api_user.email)}\" )\n WorkAudit.audit( work_id, User.cid_from_email( @api_user.email), \"File #{File.basename( filename )}/#{label} added\" )\n\n render_standard_response( :ok )\n else\n render_standard_response( :not_found, 'File not found' )\n end\n else\n render_standard_response( :not_found, 'Work not found' )\n end\n else\n render_standard_response( :unauthorized, 'Missing work identifier or file identifier or file label' )\n end\n\n end", "def retrieve_cloud_files(files); end", "def httppostfile(url, corpNum, form, files, userID, isBinary = false)\n headers = {\n \"x-pb-version\" => BaseService::POPBILL_APIVersion,\n \"Content-Type\" => \"multipart/form-data;boundary=\" + BaseService::BOUNDARY,\n \"Accept-Encoding\" => \"gzip,deflate\",\n \"Connection\" => \"Keep-Alive\"\n }\n\n if corpNum.to_s != ''\n headers[\"Authorization\"] = \"Bearer \" + getSession_Token(corpNum)\n end\n\n if userID.to_s != ''\n headers[\"x-pb-userid\"] = userID\n end\n\n post_body = []\n\n if form.to_s != ''\n post_body << \"--#{BaseService::BOUNDARY}\\r\\n\"\n post_body << \"Content-Disposition: form-data; name=\\\"form\\\"\\r\\n\"\n post_body << \"Content-Type: Application/json;\\r\\n\\r\\n\"\n post_body << form.to_json + \"\\r\\n\"\n end\n if isBinary\n files.each do |fileData|\n fileName = fileData[\"fileName\"]\n post_body << \"\\r\\n--#{BaseService::BOUNDARY}\\r\\n\"\n post_body << \"Content-Disposition: form-data; name=\\\"file\\\"; filename=\\\"#{fileName}\\\"\\r\\n\"\n post_body << \"Content-Type: Application/octet-stream\\r\\n\\r\\n\"\n post_body << fileData[\"fileData\"].force_encoding(\"UTF-8\")\n end\n else\n files.each do |filePath|\n begin\n fileName = File.basename(filePath)\n post_body << \"\\r\\n--#{BaseService::BOUNDARY}\\r\\n\"\n post_body << \"Content-Disposition: form-data; name=\\\"file\\\"; filename=\\\"#{fileName}\\\"\\r\\n\"\n post_body << \"Content-Type: Application/octet-stream\\r\\n\\r\\n\"\n post_body << File.read(filePath)\n rescue\n raise PopbillException.new(-99999999, \"Failed to reading filedata from filepath\")\n end\n end\n end\n\n post_body << \"\\r\\n--#{BaseService::BOUNDARY}--\\r\\n\"\n # Add the file Data\n\n uri = URI(getServiceURL() + url)\n\n https = Net::HTTP.new(uri.host, 443)\n https.use_ssl = true\n Net::HTTP::Post.new(uri)\n\n res = https.post(uri.request_uri, post_body.join.encode(\"UTF-8\"), headers)\n\n if res.code == \"200\"\n if res.header['Content-Encoding'].eql?('gzip')\n JSON.parse(gzip_parse(res.body))\n else\n JSON.parse(res.body)\n end\n else\n raise PopbillException.new(JSON.parse(res.body)[\"code\"],\n JSON.parse(res.body)[\"message\"])\n end\n\n end", "def sendFilesToDrive(files_to_send_list, api_POST_to_camel_py, post_url)\n #loop through files to upload:\n api_result_errs = ''\n for file in files_to_send_list\n argstring = \"#{file} #{post_url}\"\n api_result = localRunPython(api_POST_to_camel_py, argstring, \"api_POST_to_camel--file:_#{file}\")\n if api_result.downcase != 'success'\n api_result_errs += \"- api_err: \\'#{api_result}\\', file: \\'#{file}\\'\\n\"\n end\n end\n if api_result_errs == ''\n api_POST_results = 'success'\n else\n api_POST_results = api_result_errs\n end\n return api_POST_results\nrescue => e\n p e\n return \"error with 'sendFilesToDrive': #{e}\"\nend", "def upload\n document = params[:document]\n service_request_id = params[:service_request_id]\n organization_id = params[:organization_id]\n document_type = params[:document_type]\n\n # let's see how many existing docs we have before we upload\n document_count_before_upload = Alfresco::Document.number_of_documents_for(service_request_id)\n\n ticket = Document.ticket(Alfresco::Document::ALFRESCO_USER, Alfresco::Document::ALFRESCO_PASSWORD)\n\n builder = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|\n xml.entry(:xmlns => \"http://www.w3.org/2005/Atom\",\n \"xmlns:cmisra\" => \"http://docs.oasis-open.org/ns/cmis/restatom/200908/\",\n \"xmlns:cmis\" => \"http://docs.oasis-open.org/ns/cmis/core/200908/\") {\n xml.title document.original_filename\n xml.summary document_type\n xml.content(:type => document.content_type) {\n xml.text Base64.encode64(document.read)\n }\n }\n end\n\n if !Document.service_request_folder_exists? service_request_id\n Document.create_service_request_folder service_request_id\n end\n\n sub_folders = Document.find_sub_folders_for_service_request service_request_id\n unless sub_folders.include? organization_id\n Document.create_service_request_organization_folder(service_request_id, organization_id)\n end\n\n url = Document::PATH + \"cmis/p/User%20Homes/service_requests/#{service_request_id}/#{organization_id}/children?alf_ticket=\" + ticket\n\n count = 0\n begin\n count = count + 1\n RestClient.post url, builder.to_xml, {:content_type => 'application/atom+xml;type=entry'}\n rescue => e\n Rails.logger.info \"#\"*50\n Rails.logger.info \"Error creating file\"\n Rails.logger.info e.message\n Rails.logger.info \"#\"*50\n end\n\n new_document_count = count + document_count_before_upload\n document_count_after_upload = Alfresco::Document.number_of_documents_for(service_request_id)\n\n while(document_count_after_upload != new_document_count) do\n sleep(0.5)\n document_count_after_upload = Alfresco::Document.number_of_documents_for(service_request_id)\n end\n\n redirect_to :controller => 'related_service_requests', :action => 'show', :anchor => 'documents', :service_request_id => params[:friendly_id], :id => params[:ssr_id]\n end", "def make_collection\n if(request.body.read.to_s == '')\n if(::File.directory?(file_path))\n MethodNotAllowed\n else\n if(::File.directory?(::File.dirname(file_path)) && !::File.exist?(file_path))\n Dir.mkdir(file_path)\n Created\n else\n Conflict\n end\n end\n else\n UnsupportedMediaType\n end\n end", "def rest_post_upload(uri,filepath)\n response = RestClient::Request.execute(method: :post, \n url: uri,\n user: @rest_user, \n password: @rest_passwd,\n payload: {:multipart => true, :file => File.new(filepath)}, \n headers: {content_type: @rest_cont_type, accept: @rest_accept_type}\n )\n @resp_headers=response.headers\n @resp_code=response.code\n @resp_body=response.body \n return response\n end", "def add_job_file(job_id, filename, data)\n request = Net::HTTP::Put.new(\"/jobs/#{job_id}/files/#{filename}\")\n request.body = JSON.generate(data)\n response = http.request(request)\n handle_response({ request_method: request.method, request_path: request.path, request_body: request.body }, response)\n end", "def upload_file(file, file_name, folder = '/cgi-bin/uploads')\n upload_url = 'https://mp.weixin.qq.com/cgi-bin/filetransfer'\\\n '?action=upload_material&f=json&writetype=doublewrite'\\\n \"&groupid=1&ticket_id=#{@ticket_id}\"\\\n \"&ticket=#{@ticket}&token=#{@token}&lang=zh_CN\"\n response = RestClient.post upload_url, file: file,\n Filename: file_name,\n folder: folder\n JSON.parse response.to_s\n end", "def create\n @g_file = GFile.new(g_file_params)\n\n respond_to do |format|\n if @g_file.save\n format.html { redirect_to @g_file, notice: 'G file was successfully created.' }\n format.json { render :show, status: :created, location: @g_file }\n else\n format.html { render :new }\n format.json { render json: @g_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_get_list_files()\n\n path = 'folder1'\n storage = 'First Storage'\n request = GetListFilesRequest.new(path, storage)\n\n result = @storage_api.get_list_files(request)\n assert result.code == 200, 'Error while getting list files'\n assert result.files != nil\n\n end", "def batch_import_params\n params.permit(:file)\n end", "def g_file_params\n params.require(:g_file).permit(:filename, :contents, :gist_id)\n end", "def file_custom_fields\n group_custom_fields 'file'\n end", "def file_custom_fields\n group_custom_fields 'file'\n end", "def upload(bucket, file); end", "def create\n if params[:local_file].present?\n # Ingest files already on disk\n filename = params[:local_file][0]\n file = File.open(File.join(current_user.directory, filename), 'rb')\n create_and_save_generic_file(file, '1', nil, params[:batch_id], filename)\n if @generic_file\n Sufia.queue.push(ContentDepositEventJob.new(@generic_file.pid, current_user.user_key))\n redirect_to sufia.batch_edit_path(params[:batch_id])\n else\n flash[:alert] = \"Error creating generic file.\"\n render :new\n end\n else\n # They are uploading files.\n super\n end\n end", "def parse_files_json(file)\n\n files_hash = convert_json(b2_list_file_names(file))\n files = {}\n\n files_hash[\"files\"].each do |file_hash|\n files[file_hash[\"fileName\"]] = file_hash[\"fileId\"]\n end\n\n return files\n\nend", "def handle_files(subdata)\n \t\t# single file in a folder\n \t\tif subdata.is_a? Hash\n \t\t\t@array_of_ltfsfiles.push(LTFSFile.new(subdata, @tapedata.volumeuuid, @path_components))\n \t\t# multiple files in a folder\n \t\telsif subdata.is_a? Array\n \t\t\tsubdata.each { |f| @array_of_ltfsfiles.push(LTFSFile.new(f, @tapedata.volumeuuid, @path_components)) }\n \t\tend\n end", "def create\n @file = DataSet.new(file_params)\n @file.project_id = session[:project_id]\n @file.directory_id = params[:id] if params[:id]\n respond_to do |format|\n if @file.save\n format.html { render text: 'created', layout: false, status: :created }\n format.json { render json: @file.errors, status: :created }\n else\n params[:id] = @file.directory_id\n format.html { render action: 'new_file', layout: false }\n format.json { render json: @file.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @grid_fs_file.destroy\n respond_to do |format|\n format.html { redirect_to grid_fs_files_url, notice: 'Grid fs file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create\n @project = Project.find params[:project_id]\n @file = @project.source_files.create :name=>params[:name], :code=>params[:code]\n\n respond_to do |format|\n if @file.save \n format.html {redirect_to @project}\n format.json {render json: @file}\n end\n end\n end", "def upload(params)\n self.class.post('/files.upload', body: params.merge({token: @token})).tap do |response|\n raise \"error uploading file: #{response.fetch('error', 'unknown error')}\" unless response['ok']\n end\n end", "def create\n @userfile = Userfile.new(params[:userfile])\n \n\n respond_to do |format|\n if @userfile.save\n format.html {\n render :json => [@userfile.to_jq_upload].to_json,\n :content_type => 'text/html',\n :layout => false\n }\n format.json { render json: {files: [@userfile.to_jq_upload] }, status: :created, location: @userfile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @userfile.errors, status: :unprocessable_entity }\n end\n end\n \n end", "def create_gists(file, options={})\n opts = {:files => {File.basename(file) => { 'content' => File.read(file) }}}\n options.merge!(opts)\n result = self.class.post(\"/gists\", :body => options.to_json, :headers => @headers)\n if result.code == 201\n puts \"You have successfully created a new gist!\"\n end\n end", "def upload\n create_document\n \n render_upload\n end", "def create\n params[:file_item][:parent_id] = nil if params[:file_item][:parent_id].blank?\n @file_item = FileItem.cs(self.current_scope).new(params[:file_item])\n\n respond_to do |format|\n if @file_item.save\n format.html { redirect_to @file_item, :notice => 'File item was successfully created.' }\n format.json { render :json => @file_item, :status => :created, :location => @file_item }\n else\n format.html { render :action => \"new_#{@file_item.item_type}\" }\n format.json { render :json => @file_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def client_side_multipart_upload\n end", "def add_dfs\n\n @parent = get_parent(params[:parent_id])\n\n #Images to Add\n if(!@parent.data_files.nil?)\n @parent.data_files.clear\n end\n if(!params[:DataFile_ids].nil?)\n for id in params[:DataFile_ids]\n @parent.data_files.push(DataFile.find(id))\n end\n end\n respond_to do |format|\n if @parent.save\n #Uses a session variable for reloading the current page assigned to the variable\n format.html { redirect_to session[:rq], notice: 'Data Files(s) successfully added.' }\n format.json { render json: @parent, status: :created, location: @parent }\n else\n format.html { render action: \"\" }\n format.json { render json: @parent.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_grid_file(**options)\n grid_file = Mongo::Grid::File.new(\"\", metadata: {}, chunk_size: chunk_size, **options)\n\n bucket.insert_one(grid_file)\n\n grid_file\n end" ]
[ "0.6636621", "0.63503385", "0.6302368", "0.6294408", "0.6288428", "0.6252721", "0.6214168", "0.60876644", "0.6077244", "0.60207516", "0.6014226", "0.6003097", "0.596628", "0.5958198", "0.59581864", "0.59304535", "0.59057724", "0.589728", "0.5889487", "0.58772016", "0.58749175", "0.5866692", "0.5858121", "0.5856277", "0.5832131", "0.5828098", "0.58123296", "0.5809381", "0.5809094", "0.57930744", "0.57866436", "0.57759356", "0.5766214", "0.5764395", "0.57438236", "0.57198286", "0.57165027", "0.57161707", "0.57152736", "0.5694757", "0.56909657", "0.56638634", "0.56460184", "0.5641468", "0.5640514", "0.56208426", "0.5617939", "0.5601037", "0.5601037", "0.5599906", "0.55889183", "0.5586318", "0.5583036", "0.5581566", "0.5580337", "0.55734193", "0.55720663", "0.5563977", "0.5557773", "0.55566293", "0.555561", "0.5543868", "0.5540498", "0.5528566", "0.55256253", "0.55112356", "0.55110294", "0.5507045", "0.5503878", "0.55031615", "0.55010927", "0.549374", "0.54870117", "0.548452", "0.5481529", "0.54758966", "0.54752475", "0.5474316", "0.5469772", "0.54662806", "0.5448102", "0.5447426", "0.5434524", "0.5425833", "0.5425833", "0.54198307", "0.5416514", "0.5404027", "0.53952444", "0.5388508", "0.53875345", "0.53803086", "0.53623843", "0.5356292", "0.53516227", "0.5351514", "0.5349022", "0.5345099", "0.53367287", "0.5335478" ]
0.72458696
0
PATCH/PUT /grid_fs_files/1 PATCH/PUT /grid_fs_files/1.json
def update respond_to do |format| if @grid_fs_file.update(grid_fs_file_params) format.html { redirect_to @grid_fs_file, notice: 'Grid fs file was successfully updated.' } format.json { render :show, status: :ok, location: @grid_fs_file } else format.html { render :edit } format.json { render json: @grid_fs_file.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @treq = Treq.find(params[:id])\n\n respond_to do |format|\n unless params[:treq_files].blank?\n params[:treq_files]['file'].each do |a|\n @treq_file = @treq.treq_files.create!(:file => a, :treq_id => @treq.id)\n end\n end\n if @treq.update_attributes(params[:treq])\n format.html { redirect_to @treq, notice: 'Treq was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @treq.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(path = '/files/', params = {})\n request :put, path, params\n end", "def update_feature_request(folder_id, feature_content, file_name)\n url = URI(\"#{$base_url}/api/projects/#{$project_id}/folders/#{folder_id}/update_from_feature\")\n\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n request = Net::HTTP::Patch.new(url)\n request[\"accept\"] = 'application/vnd.api+json; version=1'\n request[\"access-token\"] = $access_token\n request[\"uid\"] = $uid\n request[\"client\"] = $client\n request[\"Content-Type\"] = 'application/json'\n\n data = {\n data: {\n attributes: {\n \"feature\": feature_content\n }\n }\n }\n\n request.body = JSON.generate(data)\n response = http.request(request)\n\n if response.code == 200.to_s\n update_response = JSON.parse(response.read_body)['data']\n puts \"Feature '#{update_response['attributes']['name']}' with '#{update_response['attributes']['scenarios-count']} scenario(s)' updated.\"\n $success_uploaded_count = $success_uploaded_count + 1\n $uploaded_features_list.push(file_name)\n $updated_count = $updated_count + 1\n else\n $fail_uploaded_count = $fail_uploaded_count + 1\n $not_uploaded_features_list.push(file_name)\n end\n\n response.code\nend", "def update\n @event_subscription.update(event_subscription_params)\n @event_subscription.save\n\n file_params.each do |requirement|\n if(requirement[\"doc\"])\n requirement.symbolize_keys\n requirement[:doc].symbolize_keys\n path = \"data:#{requirement[:doc][:filetype]};base64, #{requirement[:doc][:base64]}\"\n Document.update(id: requirement[:doc][:id],\n user_id: @event_subscription.user_id,\n requirement_id: requirement[:id],\n state: \"pending_review\",\n path: path\n )\n end\n end\n render json: @event_subscription, status: :updated\n end", "def update\n description = file_params[:description] || @file.description\n\n raise ApiError, \"Can't rename a file.\" unless @file.rename(file_params[:name], description)\n\n render json: @file, adapter: :json\n end", "def set_grid_fs_file\n @grid_fs_file = GridFsFile.find(params[:id])\n end", "def update\n @super_file = SuperFile.find(params[:id])\n\n respond_to do |format|\n if @super_file.update_attributes(params[:super_file])\n format.html { redirect_to @super_file, notice: 'Super file was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @super_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "def update\n error_msg(ErrorCodes::OBJECT_ERROR, \"#{I18n.t \"endnote_files.errors.not_found\"}: #{params[:id]}\")\n render_json\n end", "def update\n respond_to do |format|\n if @g_file.update(g_file_params)\n format.html { redirect_to @g_file, notice: 'G file was successfully updated.' }\n format.json { render :show, status: :ok, location: @g_file }\n else\n format.html { render :edit }\n format.json { render json: @g_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @test_file = TestFile.find(params[:id])\n\n respond_to do |format|\n if @test_file.update_attributes(params[:test_file])\n format.html { redirect_to @test_file, notice: 'Test file was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @file_id = args[:file_id] if args.key?(:file_id)\n @file_name = args[:file_name] if args.key?(:file_name)\n @mime_type = args[:mime_type] if args.key?(:mime_type)\n end", "def update\n upload = params.require(:file)\n handler = setup_handler(upload)\n\n if handler.valid?\n handler.call\n render json: {}, status: 202\n else\n render json: { errors: handler.errors }, status: 422\n end\n end", "def update\n respond_to do |format|\n if @batch_file.update(batch_file_params)\n format.html { redirect_to @batch_file, notice: \"Batch file was successfully updated.\" }\n format.json { render :show, status: :ok, location: @batch_file }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @batch_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_file_with_http_info(file_name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: NsxComponentAdministrationApi.update_file ...\"\n end\n # verify the required parameter 'file_name' is set\n if @api_client.config.client_side_validation && file_name.nil?\n fail ArgumentError, \"Missing the required parameter 'file_name' when calling NsxComponentAdministrationApi.update_file\"\n end\n # resource path\n local_var_path = \"/node/file-store/{file-name}/data\".sub('{' + 'file-name' + '}', file_name.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/octet-stream'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'FileProperties')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NsxComponentAdministrationApi#update_file\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n @capa = Capa.find(params[:id])\n\n respond_to do |format|\n if @capa.update_attributes(params[:capa])\n unless params[:capa_files].blank?\n params[:capa_files]['file'].each do |a|\n @capa_file = @capa.capa_files.create!(:file => a, :capa_id => @capa.id)\n end\n end\n format.html { redirect_to @capa, notice: 'Capa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @capa.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @file_info = FileInfo.find(params[:id])\n\n respond_to do |format|\n if @file_info.update_attributes(params[:file_info])\n format.html { redirect_to @file_info, notice: 'File info was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @file_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @testfile.update(testfile_params)\n format.html { redirect_to @testfile, notice: 'Testfile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @testfile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @file.project_id = session[:project_id]\n respond_to do |format|\n if @file.update(file_params)\n format.html { render text: 'created', layout: false, status: :created }\n format.json { head :no_content }\n else\n params[:id] = @file.directory_id\n format.html { render action: 'edit', layout: false }\n format.json { render json: @file.errors, status: :unprocessable_entity }\n end\n end\n end", "def multi_update\n errors = false\n return_value = []\n file_infos_params = params.permit(file_infos: [:id, :review_done, :component_id]).require(:file_infos)\n file_infos_params.each do |key, file_info_entry|\n (return_value << nil) and (errors = true) and next unless file_info_entry[:id]\n file_info = FileInfo.find(file_info_entry[:id])\n (return_value << nil) and (errors = true) and next unless file_info\n if file_info.update(file_info_entry)\n return_value << file_info_entry\n else\n return_value << file_info.errors\n errors = true\n end\n end\n respond_to do |format|\n format.json { render json: return_value }\n if errors\n format.html { redirect_to :back, notice: 'Some entries have errors'}\n else\n format.html { redirect_to :back }\n end\n end\n end", "def patch(path, **args); end", "def update\n respond_to do |format|\n if @file_info.update(file_info_params)\n format.html { redirect_to @file_info, notice: 'File info was successfully updated.' }\n format.json { render :show, status: :ok, location: @file_info }\n else\n format.html { render :edit }\n format.json { render json: @file_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def perform_study_file_upload(filename, study_file_params, study_id)\n file_upload = Rack::Test::UploadedFile.new(Rails.root.join('test', 'test_data', filename))\n study_file_params[:study_file].merge!(upload: file_upload)\n patch \"/single_cell/studies/#{study_id}/upload\", params: study_file_params, headers: {'Content-Type' => 'multipart/form-data'}\nend", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def update!(**args)\n @drive_file_id = args[:drive_file_id] if args.key?(:drive_file_id)\n end", "def update!(**args)\n @drive_file_id = args[:drive_file_id] if args.key?(:drive_file_id)\n end", "def http_put(request, response)\n body = request.body_as_stream\n path = request.path\n\n # Intercepting Content-Range\n if request.header('Content-Range')\n # An origin server that allows PUT on a given target resource MUST send\n # a 400 (Bad Request) response to a PUT request that contains a\n # Content-Range header field.\n #\n # Reference: http://tools.ietf.org/html/rfc7231#section-4.3.4\n fail Exception::BadRequest, 'Content-Range on PUT requests are forbidden.'\n end\n\n # Intercepting the Finder problem\n expected = request.header('X-Expected-Entity-Length').to_i\n if expected > 0\n # Many webservers will not cooperate well with Finder PUT requests,\n # because it uses 'Chunked' transfer encoding for the request body.\n #\n # The symptom of this problem is that Finder sends files to the\n # server, but they arrive as 0-length files in PHP.\n #\n # If we don't do anything, the user might think they are uploading\n # files successfully, but they end up empty on the server. Instead,\n # we throw back an error if we detect this.\n #\n # The reason Finder uses Chunked, is because it thinks the files\n # might change as it's being uploaded, and therefore the\n # Content-Length can vary.\n #\n # Instead it sends the X-Expected-Entity-Length header with the size\n # of the file at the very start of the request. If this header is set,\n # but we don't get a request body we will fail the request to\n # protect the end-user.\n\n # Only reading first byte\n first_byte = body.read(1)\n unless first_byte\n fail Exception::Forbidden, 'This server is not compatible with OS/X finder. Consider using a different WebDAV client or webserver.'\n end\n\n # The body needs to stay intact, so we copy everything to a\n # temporary stream.\n\n new_body = StringIO.new\n new_body.write(first_byte)\n IO.copy_stream(body, new_body)\n new_body.rewind\n\n body = new_body\n end\n\n if @server.tree.node_exists(path)\n node = @server.tree.node_for_path(path)\n\n # If the node is a collection, we'll deny it\n unless node.is_a?(IFile)\n fail Exception::Conflict, 'PUT is not allowed on non-files.'\n end\n\n etag = Box.new\n return false unless @server.update_file(path, body, etag)\n etag = etag.value\n\n response.update_header('Content-Length', '0')\n response.update_header('ETag', etag) if etag\n response.status = 204\n else\n # If we got here, the resource didn't exist yet.\n etag = Box.new\n unless @server.create_file(path, body, etag)\n # For one reason or another the file was not created.\n return false\n end\n etag = etag.value\n\n response.update_header('Content-Length', '0')\n response.update_header('ETag', etag) if etag\n response.status = 201\n end\n\n # Sending back false will interupt the event chain and tell the server\n # we've handled this method.\n false\n end", "def update\n @file_version = FileVersion.find(params[:id])\n params[:versioned_file_id] = @file_version.versioned_file_id\n if update_versioned_files? \n if @file_version.update(:isActive => true)\n head :no_content\n else\n render json: @file_version.errors, status: :unprocessable_entity\n end \n else \n render json: @file_version.errors, status: :unprocessable_entity\n end\n end", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def update\n respond_to do |format|\n if @used_object.update(used_object_params)\n if params[:supporting_files]\n params[:supporting_files].each { |file| \n @used_object.supporting_files.create(file: file)\n }\n end\n format.html { redirect_to @used_object, notice: 'Used object was successfully updated.' }\n format.json { render :show, status: :ok, location: @used_object }\n else\n format.html { render :edit }\n format.json { render json: @used_object.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @file_example.update(file_example_params)\n format.html { redirect_to @file_example, notice: 'File example was successfully updated.' }\n format.json { render :show, status: :ok, location: @file_example }\n else\n format.html { render :edit }\n format.json { render json: @file_example.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @doc_file.update(doc_file_params)\n format.html { redirect_to @doc_file, notice: 'Doc file was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @doc_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @document_file.update(document_file_params)\n format.html { redirect_to edit_document_path(@document), notice: 'Document file was successfully updated.' }\n format.json { render json: 'ok', status: :ok, location: @document_file }\n else\n format.html { render :edit }\n format.json { render json: @folder.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_file_metadata(file_id, element, new_data)\n payload = { 'uploadType' => 'resumable', element => new_data }.to_json\n\n begin\n update = @drive_manager[file_id].patch(\n payload\n )\n rescue StandardError => error\n warn \"#{error}; METHOD #{__callee__}; RESOURCE #{file_path}\"\n return\n end\n\n update\n end", "def http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\n end", "def update\n unless admin_people_file_params[:title].blank?\n unless admin_people_file_params[:description].blank?\n unless admin_people_file_params[:file].blank?\n @admin_people_file.remove_file!\n end\n end\n end\n respond_to do |format|\n if @admin_people_file.update(admin_people_file_params)\n format.html { redirect_to @admin_people_file, notice: 'People file was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_people_file }\n else\n format.html { render :edit }\n format.json { render json: @admin_people_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @file_upload.update(file_upload_params)\n format.html { redirect_to @file_upload, notice: 'File upload was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @file_upload.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update_metadata(filename, metadata, path, site_path=nil)\n sanitized_filename = sanitize_filename(filename)\n url = computed_web_api_url(site_path)\n server_relative_url = \"#{site_path}#{path}/#{sanitized_filename}\"\n easy = ethon_easy_json_requester\n easy.url = uri_escape \"#{url}GetFileByServerRelativeUrl('#{server_relative_url}')/ListItemAllFields\"\n easy.perform\n\n __metadata = JSON.parse(easy.response_body)['d']['__metadata']\n update_metadata_url = __metadata['uri']\n prepared_metadata = prepare_metadata(metadata, __metadata['type'])\n\n easy = ethon_easy_json_requester\n easy.headers = { 'accept' => 'application/json;odata=verbose',\n 'content-type' => 'application/json;odata=verbose',\n 'X-RequestDigest' => xrequest_digest(site_path),\n 'X-Http-Method' => 'PATCH',\n 'If-Match' => \"*\" }\n easy.http_request(update_metadata_url,\n :post,\n { body: prepared_metadata })\n easy.perform\n check_and_raise_failure(easy)\n easy.response_code\n end", "def update\n authorize @task\n @task.updated_by = current_user\n\n files = @task.files\n files += task_params[:files] if task_params[:files]\n @task.assign_attributes(task_params)\n @task.files = files\n\n if params[:files_remove]\n\n remain_files = @task.files\n\n params[:files_remove].reverse_each do |file, state|\n if state.to_i == 1\n deleted_files = remain_files.delete_at(file.to_i)\n deleted_files.try(:remove!)\n end\n end\n\n @task.remove_files! if remain_files.empty?\n end\n respond_to do |format|\n if @task.save\n format.html { redirect_back_or_default tasks_url, t('Record has been saved') }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @resource_file = ResourceFile.find(params[:id])\n\n respond_to do |format|\n if @resource_file.update_attributes(params[:resource_file])\n format.html { redirect_to @resource_file, notice: 'Resource file was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @resource_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n parse_path\n validate_path!\n\n if params.include?(:dir)\n @path.mkdir\n elsif params.include?(:file)\n @path.mv_from(params[:file].tempfile)\n elsif params.include?(:touch)\n @path.touch\n else\n content = request.body.read\n\n # forcing utf-8 because File.write seems to require it. request bodies are\n # in ASCII-8BIT and need to be re encoded otherwise errors are thrown.\n # see test cases for plain text, utf-8 text, images and binary files\n content.force_encoding('UTF-8')\n\n @path.write(content)\n end\n\n render json: {}\n rescue => e\n render json: { error_message: e.message }\n end", "def update\n @item = @collection.items.get(params[:id])\n @collection.schema.each do |field|\n if params[:item][field.to_s].blank? && !field.is_file\n @item[field.name]=nil\n elsif field.is_file\n #do nothing\n unless params[:item][field.to_s].nil?\n new_file = @file_collection.items.new()\n new_file.file =params[:item][field.to_s]\n new_file.save\n @item[field.name]='{\"project\":{\"id\": \"'+@project.id+'\"}, \"collection\":{\"id\": \"'+@file_collection.id+'\"},\"item\":{\"id\": \"'+new_file.id.to_s+'\", \"display\": \"'+new_file.original_filename+'\"}}'\n end\n else\n @item[field.name] = params[:item][field.to_s]\n end\n end\n if @item.save\n update_associated_fields(@item, @collection, @project)\n respond_to do |format|\n format.html do\n flash[:notice] = \"Item Updated Successfully!\"\n end\n #format.json { render json: @item.to_json, status: :updated}\n format.js { render :js => '$(\"#message\").html(\"<h2>Item updated. Close window and refresh your page.</h2>\").attr(\"class\",\"message notice\"); $(\"html, body\").animate({scrollTop: \"0px\"})' }\n end\n else\n respond_to do |format|\n format.html do\n flash[:error] = [\"Item failed to save! Errors:\", @item.errors.full_messages].flatten.join(' ')\n end\n format.json { render json: @item.to_json, status: :error}\n format.js { render :js => '$(\"#message\").html(\"<h2>Item failed update.</h2>\").attr(\"class\",\"message error\").scrollTop(0); $(\"html, body\").animate({scrollTop: \"0px\"})' }\n end\n end\n redirect_to :back\n end", "def update\n respond_to do |format|\n if @nthfile.update(nthfile_params)\n format.html { redirect_to @nthfile, notice: 'Nthfile was successfully updated.' }\n format.json { render :show, status: :ok, location: @nthfile }\n else\n format.html { render :edit }\n format.json { render json: @nthfile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @body = args[:body] unless args[:body].nil?\n @filename = args[:filename] unless args[:filename].nil?\n @headers = args[:headers] unless args[:headers].nil?\n @mime_type = args[:mime_type] unless args[:mime_type].nil?\n @part_id = args[:part_id] unless args[:part_id].nil?\n @parts = args[:parts] unless args[:parts].nil?\n end", "def update\n respond_to do |format|\n if @file_folder.update(file_folder_params)\n format.html { redirect_to @file_folder, notice: 'File folder was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @file_folder.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @file_item = FileItem.cs(self.current_scope).find_by_path(params[:id])\n\n respond_to do |format|\n if @file_item.update_attributes(params[:file_item])\n format.html { redirect_to (params[:redirect_to] || @file_item), :notice => 'File item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit_#{@file_item.item_type}\" }\n format.json { render :json => @file_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def file_update(project, old_file, new_fie)\n file = ActionDispatch::Http::UploadedFile.new(\n tempfile: upload(new_fie),\n filename: new_fie,\n original_filename: old_file\n )\n post :file_update, user_id: project.user.username,\n id: project.name,\n branch: 'master',\n destination: new_fie,\n message: 'update image',\n file: file\n end", "def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end", "def update\n respond_to do |format|\n if @other_file.update(other_file_params)\n format.html { redirect_to @other_file, notice: 'Other file was successfully updated.' }\n format.json { render :show, status: :ok, location: @other_file }\n else\n format.html { render :edit }\n format.json { render json: @other_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @files = args[:files] if args.key?(:files)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end", "def put!\n request! :put\n end", "def update\n respond_to do |format|\n if @ticket_file.update(ticket_file_params)\n format.html { redirect_to @ticket_file, notice: 'Ticket file was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket_file }\n else\n format.html { render :edit }\n format.json { render json: @ticket_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @avro_file_format = args[:avro_file_format] if args.key?(:avro_file_format)\n @file_rotation_interval = args[:file_rotation_interval] if args.key?(:file_rotation_interval)\n @file_rotation_mb = args[:file_rotation_mb] if args.key?(:file_rotation_mb)\n @json_file_format = args[:json_file_format] if args.key?(:json_file_format)\n @path = args[:path] if args.key?(:path)\n end", "def update\n respond_to do |format|\n if @incidentfile.update(incidentfile_params)\n format.html { redirect_to @incidentfile, notice: 'Incidentfile was successfully updated.' }\n format.json { render :show, status: :ok, location: @incidentfile }\n else\n format.html { render :edit }\n format.json { render json: @incidentfile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @datafile.update(datafile_params)\n format.html { redirect_to @datafile, notice: 'Datafile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @datafile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @gadget_file.update(gadget_file_params)\n format.html { redirect_to @gadget_file, notice: 'Gadget file was successfully updated.' }\n format.json { render :show, status: :ok, location: @gadget_file }\n else\n format.html { render :edit }\n format.json { render json: @gadget_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @indexed_file = IndexedFile.find(params[:id])\n\n respond_to do |format|\n if @indexed_file.update_attributes(params[:indexed_file])\n format.html { redirect_to @indexed_file, notice: 'Indexed file was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @indexed_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @config_file = ConfigFile.find(params[:id])\n\n respond_to do |format|\n if @config_file.update_attributes(params[:config_file])\n format.html { redirect_to @config_file, notice: 'Config file was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @config_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def files_remote_update(options = {})\n post('files.remote.update', options)\n end", "def update # PATCH\n raise NotImplementedError\n end", "def update!(**args)\n @files = args[:files] if args.key?(:files)\n @script_id = args[:script_id] if args.key?(:script_id)\n end", "def update\n @up_file = UpFile.find(params[:id])\n\n respond_to do |format|\n if @up_file.update_attributes(params[:up_file])\n format.html { redirect_to @up_file, notice: 'Up file was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @up_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @f = F.find(params[:id])\n\n respond_to do |format|\n if @f.update_attributes(params[:f])\n format.html { redirect_to software_package_fs_path(@software, @package) }\n format.js\n format.json { head :ok }\n else\n format.html { redirect_to software_package_fs_path(@software, @package) }\n format.js\n format.json { render json: @package.errors, status: :unprocessable_entity }\n end\n end\n \n end", "def update_files(resource)\n updated = files.select { |file| file.is_a?(Hash) }.map do |file|\n node = resource.file_metadata.select { |x| x.id.to_s == file.keys.first.to_s }.first\n node.updated_at = Time.current\n # Uses the UploadDecorator to abstract the interface for the File Object during persistence by the storage_adapter\n file_wrapper = UploadDecorator.new(file.values.first, node.original_filename.first)\n\n # Ensure that errors for one file are logged but do not block updates for others\n begin\n storage_adapter.upload(file: file_wrapper, original_filename: file_wrapper.original_filename, resource: node)\n node.label = file.values.first.original_filename\n node.mime_type = file.values.first.content_type\n node\n rescue StandardError => error\n Valkyrie.logger.error \"#{self.class}: Failed to update the file #{file_wrapper.original_filename} for #{node.id}: #{error}\"\n # Ensure that this file is not created instead of updated\n @files.delete_if { |updated_file| updated_file.values.first.original_filename == file_wrapper.original_filename }\n nil\n end\n end\n\n updated.compact\n end", "def update!(**args)\n @request_file_scope = args[:request_file_scope] if args.key?(:request_file_scope)\n end", "def edit_gist(id, files={}, options={:public => true})\n options.merge!(files)\n patch \"/gists/#{id}\", :body => options\n end", "def update(attrs, path=nil)\n resp = api_client.put(path || url, JSON.dump(attrs))\n refresh(JSON.load(resp.body))\n end", "def rm_update path, data, msg\n\n re = rm_request path, data, 'PUT'\n puts re.body\n chk (re.code!='200'), msg + \"\\n#{re.code} #{re.msg}\\n\\n\"\n return true\n\nend", "def update\n @action_file = ActionFile.find(params[:id])\n\n respond_to do |format|\n if @action_file.update_attributes(params[:action_file])\n format.html { redirect_to @action_file, notice: 'Action file was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @action_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n upload = params.require(:file)\n handler = create_handler(params[:id], upload)\n\n if handler.valid?\n render json: attachment_json(handler.call)\n else\n render json: errors_json(handler), status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @file.update(community_file_params)\n format.js\n format.json { head :no_content, status: :updated }\n else\n format.js\n format.json { render json: @file.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_file_in_db(file_id, filename, public_status, folder_id)\n $db.execute(\"UPDATE files SET file_name = ?, public_status = ?, folder_id = ? WHERE file_id = ?\", filename, public_status, folder_id, file_id)\nend", "def update\n #Finds selected data file\n @data_file = DataFile.find(params[:id])\n\n #Components\n #Checks if the data file is attached to any components - if so clears them\n if(!@data_file.components.nil?)\n @data_file.components.clear\n end\n #Sets Data Files Components\n if(!params[:component_parent_ids].nil?)\n for id in params[:component_parent_ids]\n @data_file.components.push(Component.find(id))\n end\n end\n\n #Products\n #Checks if the data file is attached to any products - if so clears them\n if(!@data_file.products.nil?)\n @data_file.products.clear\n end\n #Sets Data Files Products\n if(!params[:product_ids].nil?)\n for id in params[:product_ids]\n @data_file.products.push(Product.find(id))\n end\n end\n\n #Valuefields\n #Checks if the data file is attached to any valuefields - if so clears them\n if(!@data_file.valuefields.nil?)\n @data_file.valuefields.clear\n end\n #Sets Data Files Valuefields\n if(!params[:valuefield_ids].nil?)\n for id in params[:valuefield_ids]\n @data_file.valuefields.push(Valuefield.find(id))\n end\n end\n\n respond_to do |format|\n if @data_file.update_attributes(params[:data_file])\n format.html { redirect_to @data_file, notice: 'Data file was successfully updated.' }\n format.json { head :ok }\n\n else\n format.html { render action: \"edit\" }\n format.json { render json: @data_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @drive_file = args[:drive_file] if args.key?(:drive_file)\n @drive_folder = args[:drive_folder] if args.key?(:drive_folder)\n @file = args[:file] if args.key?(:file)\n @folder = args[:folder] if args.key?(:folder)\n @mime_type = args[:mime_type] if args.key?(:mime_type)\n @name = args[:name] if args.key?(:name)\n @owner = args[:owner] if args.key?(:owner)\n @title = args[:title] if args.key?(:title)\n end", "def patch!\n request! :patch\n end", "def api_put(path, data = {})\n api_request(:put, path, :data => data)\n end", "def update\n respond_to do |format|\n if @upload_file_to_server.update(upload_file_to_server_params)\n format.html { redirect_to @upload_file_to_server, notice: 'Upload file to server was successfully updated.' }\n format.json { render :show, status: :ok, location: @upload_file_to_server }\n else\n format.html { render :edit }\n format.json { render json: @upload_file_to_server.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch_file(uid, input, info = {})\n grid_info = files_collection.find(filename: uid).first\n current_length = grid_info[:length]\n chunk_size = grid_info[:chunkSize]\n bytes_saved = 0\n\n # It's possible that the previous data append didn't fill in the last\n # GridFS chunk completely, so we fill in that gap now before creating\n # new GridFS chunks.\n bytes_saved += patch_last_chunk(input, grid_info) if current_length % chunk_size != 0\n\n # Create an Enumerator which yields chunks of input data which have the\n # size of the configured :chunkSize of the GridFS file.\n chunks_enumerator = Enumerator.new do |yielder|\n while (data = input.read(chunk_size))\n yielder << data\n end\n end\n\n chunks_in_batch = (BATCH_SIZE.to_f / chunk_size).ceil\n chunks_offset = chunks_collection.count(files_id: grid_info[:_id]) - 1\n\n # Iterate in batches of data chunks and bulk-insert new GridFS chunks.\n # This way we try to have a balance between bulking inserts and keeping\n # memory usage low.\n chunks_enumerator.each_slice(chunks_in_batch) do |chunks|\n grid_chunks = chunks.map do |data|\n Mongo::Grid::File::Chunk.new(\n data: BSON::Binary.new(data),\n files_id: grid_info[:_id],\n n: chunks_offset += 1,\n )\n end\n\n chunks_collection.insert_many(grid_chunks)\n\n # Update the total length and refresh the upload date on each update,\n # which are used in #get_file, #concatenate and #expire_files.\n files_collection.find(filename: uid).update_one(\n \"$inc\" => { length: chunks.map(&:bytesize).inject(0, :+) },\n \"$set\" => { uploadDate: Time.now.utc },\n )\n bytes_saved += chunks.map(&:bytesize).inject(0, :+)\n\n chunks.each(&:clear) # deallocate strings\n end\n\n bytes_saved\n end", "def update\n @pgn_file = PgnFile.find(params[:id])\n\n respond_to do |format|\n if @pgn_file.update_attributes(params[:pgn_file])\n format.html { redirect_to @pgn_file, notice: 'Pgn file was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pgn_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bug = Bug.find(params[:id])\n Bug.save_file(params,@bug) if params[:keepold].nil? or params[:keepold].empty?\n updateparams = params\n updateparams[:bug][:fileuploadpath] = @bug.fileuploadpath\n respond_to do |format|\n if @bug.update_attributes(updateparams[:bug])\n format.html { redirect_to bugs_path, notice: 'Bug was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bug.errors, status: :unprocessable_entity }\n end\n end\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def update\n respond_to do |format|\n if @file_package.update(file_package_params)\n format.html { redirect_to @file_package, notice: 'File package was successfully updated.' }\n format.json { render :show, status: :ok, location: @file_package }\n else\n format.html { render :edit }\n format.json { render json: @file_package.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @file_path = args[:file_path] if args.key?(:file_path)\n @gcs_timestamps = args[:gcs_timestamps] if args.key?(:gcs_timestamps)\n @size_bytes = args[:size_bytes] if args.key?(:size_bytes)\n end", "def update!(**args)\n @file_path = args[:file_path] if args.key?(:file_path)\n @gcs_timestamps = args[:gcs_timestamps] if args.key?(:gcs_timestamps)\n @size_bytes = args[:size_bytes] if args.key?(:size_bytes)\n end", "def update!(**args)\n @file_contents = args[:file_contents] if args.key?(:file_contents)\n end", "def update\n @hdfs_path = HdfsPath.find(params[:id])\n\n respond_to do |format|\n if @hdfs_path.update_attributes(params[:hdfs_path])\n format.html { redirect_to @hdfs_path, notice: 'Hdfs path was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hdfs_path.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @file_upload_attachment.update(file_upload_attachment_params)\n format.html { redirect_to @file_upload_attachment, notice: 'File upload attachment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @file_upload_attachment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n fn = params[:id].gsub('DOTDOT','.').gsub('SLASHSLASH','/')\n File.open(fn,'w+') { |f| \n f.puts params[:content]\n }\n respond_to do |format|\n format.json { render json: { success: true} }\n end\n end", "def update!(**args)\n @events = args[:events] if args.key?(:events)\n @file_path = args[:file_path] if args.key?(:file_path)\n @status = args[:status] if args.key?(:status)\n end", "def update\n cf = CoreFile.find(params[:id])\n cf.update(core_file_params)\n\n redirect_to cf\n end", "def update!(**args)\n @folder_id = args[:folder_id] if args.key?(:folder_id)\n @max_file_size = args[:max_file_size] if args.key?(:max_file_size)\n @max_files = args[:max_files] if args.key?(:max_files)\n @types = args[:types] if args.key?(:types)\n end", "def update\n @question_template = QuestionTemplate.find(params[:id])\n params[:files].each_pair do |field_name, file|\n unless file.original_filename.empty?\n @question_template.send \"#{field_name}=\", file.original_filename\n end\n end\n respond_to do |format|\n if @question_template.update_attributes(params[:question_template])\n @question_template.upload_files(params[:files].values)\n format.html { redirect_to [:admin,@question_template], notice: 'Question template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @commit_filepath.update(commit_filepath_params)\n format.html { redirect_to @commit_filepath, notice: 'Commit filepath was successfully updated.' }\n format.json { render :show, status: :ok, location: @commit_filepath }\n else\n format.html { render :edit }\n format.json { render json: @commit_filepath.errors, status: :unprocessable_entity }\n end\n end\n end", "def put_update\n response = self.class.put(\"/service/#{$service_id}/version/#{$service_version}/logging/sftp/#{$name}\", \n headers: { \"Fastly-Key\" => $key }, \n body: $put_form_data )\n end", "def upload_file(bucket_key,file_location,file_name,access_token)\n file_uploaded = File.new(file_location, 'rb')\n response = RestClient.put(\"#{API_URL}/oss/v2/buckets/#{bucket_key}/objects/#{file_name}\",\n file_uploaded,\n { Authorization: \"Bearer #{access_token}\", content_type:'application/octet-stream'})\n return response\nend", "def update\n @product_bulletin = ProductBulletin.find(params[:id])\n\n respond_to do |format|\n unless params[:bulletin_files].blank?\n params[:bulletin_files]['file'].each do |a|\n @bulletin_file = @product_bulletin.bulletin_files.create!(:file => a, :product_bulletin_id => @product_bulletin.id)\n end\n end\n if @product_bulletin.update_attributes(params[:product_bulletin])\n format.html { redirect_to @product_bulletin, notice: 'Product bulletin was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product_bulletin.errors, status: :unprocessable_entity }\n end\n end\n end", "def resync_input_files #:nodoc:\n params = self.params || {}\n file_args = params[:file_args] || {}\n\n cb_error(\"This CIVET task use the old multi-CIVET structure and cannot be restarted.\") if file_args.size != 1\n\n collection_id = params[:collection_id]\n if collection_id.present? # MODE A: collection\n addlog(\"Resyncing input FileCollection ##{collection_id}.\")\n collection = FileCollection.find(collection_id)\n collection.sync_to_cache\n else # MODE B: individual files\n file0 = file_args[\"0\"].presence || cb_error(\"Params structure error!\")\n t1_id = file0[:t1_id] # cannot be nil\n t2_id = file0[:t2_id] # can be nil\n pd_id = file0[:pd_id] # can be nil\n mk_id = file0[:mk_id] # can be nil\n\n addlog(\"Resyncing input T1 ##{t1_id}.\")\n SingleFile.find(t1_id).sync_to_cache\n\n if t2_id.present?\n addlog(\"Resyncing input T2 ##{t2_id}.\")\n SingleFile.find(t2_id).sync_to_cache\n end\n\n if pd_id.present?\n addlog(\"Resyncing input PD ##{pd_id}.\")\n SingleFile.find(pd_id).sync_to_cache\n end\n\n if mk_id.present?\n addlog(\"Resyncing input MASK ##{mk_id}.\")\n SingleFile.find(mk_id).sync_to_cache\n end\n end\n\n rescue ActiveRecord::RecordNotFound\n cberror \"Cannot find input file. Recovery impossible.\"\n end", "def rename_files\n source_dir = Item.new(Path.new(params[:source_dir]))\n format = params[:string_format]\n \n response = {}\n if source_dir.rename_files(format: format)\n render json: response, status: 200\n else\n render json: response, status: 422\n end\n end" ]
[ "0.65749663", "0.6398018", "0.6175175", "0.6155008", "0.61332405", "0.59439003", "0.5939058", "0.5904782", "0.5903614", "0.58958626", "0.5877881", "0.5863158", "0.5862751", "0.58484066", "0.58150965", "0.5811043", "0.5793143", "0.57927835", "0.5784949", "0.5783114", "0.57779884", "0.5776047", "0.5774225", "0.57725334", "0.5769246", "0.5761596", "0.5761596", "0.5760048", "0.57559764", "0.5748422", "0.5737802", "0.5730265", "0.5724102", "0.5715791", "0.5706881", "0.56970036", "0.5674322", "0.5671352", "0.5669244", "0.5664255", "0.5657663", "0.56575996", "0.5650178", "0.5638927", "0.56378436", "0.5634841", "0.56278604", "0.562432", "0.5614229", "0.5609128", "0.56059474", "0.5600688", "0.55989903", "0.5584201", "0.55820185", "0.55785614", "0.5577373", "0.5555351", "0.55548173", "0.5552836", "0.5548807", "0.55461943", "0.5538387", "0.55300134", "0.5528182", "0.5521454", "0.5521263", "0.55184627", "0.5511866", "0.5504326", "0.5503293", "0.549989", "0.5489663", "0.5482926", "0.54827553", "0.5478015", "0.54773325", "0.5468712", "0.54672325", "0.5466453", "0.546595", "0.54642123", "0.5456045", "0.54530984", "0.54524386", "0.54521096", "0.5447814", "0.5442436", "0.54409754", "0.5440215", "0.54391044", "0.5438203", "0.5436242", "0.54353064", "0.5426899", "0.5422994", "0.5418483", "0.54168975", "0.5406823", "0.54039204" ]
0.7241136
0
DELETE /grid_fs_files/1 DELETE /grid_fs_files/1.json
def destroy @grid_fs_file.destroy respond_to do |format| format.html { redirect_to grid_fs_files_url, notice: 'Grid fs file was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(path)\n path = relativize_path path\n\n Precog.connect self do |http|\n uri = Addressable::URI.new\n uri.query_values = { :apiKey => api_key }\n\n http.delete \"/ingest/v#{VERSION}/fs/#{path}?#{uri.query}\"\n end\n end", "def destroy\n Rails.logger.debug {\"destroying gridfs file #{@id}\"}\n if persisted?\n Photo.mongo_client.database.fs.find(:_id=>BSON::ObjectId.from_string(@id)).delete_one\n end\n end", "def b2_delete_file(file)\n\n if parse_files_json(file) == {}\n\n puts \"File not present\"\n\n else\n \n result_hash = convert_json(b2_delete_file_version(file))\n\n if result_hash[\"fileName\"] == file\n puts \"File deleted successfully\"\n else\n puts \"Error deleting file\"\n end\n\n end\n\nend", "def delete_file(filename,repo)\n curl_delete(\"#{self.host}/api2/repos/#{repo}/file/?p=#{filename}\").body_str\n end", "def delete(bucket, file); end", "def delete_file(uid, info = {})\n grid_info = files_collection.find(filename: uid).first\n bucket.delete(grid_info[:_id]) if grid_info\n end", "def delete(path, opts = {})\n input_json = {\n path: path,\n }\n response = @session.do_rpc_endpoint(\"/#{ @namespace }/delete\", input_json)\n Dropbox::API::File.from_json(Dropbox::API::HTTP.parse_rpc_response(response))\n end", "def file_delete(path)\n params = {\n \"root\" => @root,\n \"path\" => format_path(path, false),\n }\n response = @session.do_post build_url(\"/fileops/delete\", params)\n parse_response(response)\n end", "def delete_grid_file(grid_file)\n @@db.database.fs.delete_one(grid_file)\n end", "def test_delete_file()\n\n path = 'folder/FileTest.pdf'\n versionId = nil\n storage = 'First Storage'\n request = DeleteFileRequest.new(path, versionId, storage)\n\n result = @storage_api.delete_file(request)\n assert result.code == 200,'Error while deleting document'\n\n end", "def delete\n unless FileDescriptor.exists?(filename: params[:fname])\n fpath = filePath params[:fname]\n begin\n File.delete fpath\n result = {status: 'ok'}\n status = 200\n rescue Exception => e\n result = {status: 'error', message: e.message}\n status = 500\n end\n else\n result = {status: 'error', message: 'File is open'}\n status = 403 # Forbidden\n end\n render json: result.to_json, status: status\n end", "def destroy\n \tself.class.mongo_client.database.fs.find(:_id => BSON::ObjectId(@id)).delete_one\n end", "def delete(path = '/files/', params = {})\n request :delete, path, params\n end", "def deleteFile(bucket, file, client)\n\tfilename = File.basename(file)\n\tbegin\n\t \tresp = client.client.delete_objects({\n\t \t\tbucket: bucket,\n\t\t\tdelete: { objects: [\n\t\t\t\t{ key: filename }\n\t\t\t],\n\t\t\tquiet: false }\n\t\t})\n\trescue Exception => e\n\t\tputs \"Wrong file name\"\n\t\tputs e\n\t\texit\n\tend\n\treturn resp\nend", "def deleteFileFromServer(filepath)\n filepath = filepath[1, filepath.length - 1] \n address = @@host + \"/user/\" + @@conf[\"username\"] + \"/device/\" + @@conf[\"dev_name\"] + \"/files/\" + filepath\n \n res = HttpRequest.new(:delete, address).send(@@host) \n puts res\n puts \"CODE: \" + res.code\n\nend", "def delete(container_name, file_name)\n validate_path_elements(container_name, file_name)\n\n client.request(\n method: :delete,\n path: \"#{container_name}/#{file_name}\",\n expected: 204\n )\n end", "def delete_fs_item\n d \"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\"\n d \"Delete a file or folder\"\n d \"vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv\"\n \n err_str = ''\n begin # a one time loop to allow break\n \n generic_ty = Integer(params[:sel_kind]) rescue generic_ty = FSTYPE_INVALID\n elem_id = Integer(params[:sel_id]) rescue elem_id = -1\n if ( elem_id <= 0 )\n err_str = 'Invalid index'\n break\n end\n \n if ( generic_ty == FSTYPE_FILE )\n to_upd = Dfile.find_by_id( elem_id )\n if ( to_upd )\n kindname = to_upd.fileType()\n parent_id = to_upd.directory_id\n our_name = to_upd.name\n if to_upd.destroy\n reponse = { action_id: params[:action_id],\n new_id: elem_id,\n new_name: our_name,\n parent_id: parent_id,\n kind_name: kindname\n }\n render :json => reponse, :layout => false, :status => 200 and return\n else\n err_str = 'Failed to delete file'\n break\n end\n else\n err_str = 'File does not exist'\n break\n end\n elsif ( generic_ty == FSTYPE_DIR )\n to_upd = Directory.find_by_id( elem_id )\n if ( to_upd )\n parent_id = to_upd.parent_id\n our_name = to_upd.name\n if to_upd.destroy\n reponse = { action_id: params[:action_id],\n new_id: elem_id,\n new_name: our_name,\n parent_id: parent_id,\n kind_name: 'directory'\n }\n render :json => reponse, :layout => false, :status => 200 and return\n else\n err_str = 'Failed to delete directory'\n break\n end\n else\n err_str = 'Directory does not exist'\n break\n end\n else\n err_str = 'Invalid entry type'\n break\n end\n \n end until true # a one time loop to allow break\n render json: err_str, status: :unprocessable_entity and return\n end", "def destroy\n @file.destroy\n respond_to do |format|\n format.html { render text: 'created', layout: false, status: :created }\n format.json { head :no_content }\n end\n end", "def destroy\n @g_file.destroy\n respond_to do |format|\n format.html { redirect_to g_files_url, notice: 'G file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_file = TestFile.find(params[:id])\n @test_file.destroy\n\n respond_to do |format|\n format.html { redirect_to test_files_url }\n format.json { head :no_content }\n end\n end", "def delete_file(path)\n \n puts \"Sending path via MCollective Files client\"\n @mc.delete(:path => path)\n printrpcstats\n \n end", "def delete(cloud_file)\n\n payload = {\n root: \"auto\",\n path: cloud_file.path\n }\n\n connexion = Dropbox.start(:delete, access_token)\n response = connexion.post do |req|\n req.url \"fileops/delete\"\n req.body = payload\n end\n response = format_response(response)\n Filetree.new('dropbox').update([response[:path], nil])\n\n end", "def destroy\n self.class.mongo_client.database.fs.find(:_id=>BSON::ObjectId.from_string(@id)).delete_one\n end", "def destroy\n self.class.mongo_client.database.fs.find(:_id=>BSON::ObjectId.from_string(@id)).delete_one\n end", "def delete(path)\n path = format_path(path)\n bucket_path = get_bucket_path(path)\n date = gmtdate\n headers = {\n 'Host' => @aliyun_upload_host,\n 'Date' => date,\n 'Authorization' => sign('DELETE', bucket_path, '', '', date)\n }\n url = path_to_url(path)\n response = RestClient.delete(url, headers)\n response.code == 204 ? url : nil\n end", "def delete(path)\n repository = path.split(/\\//)[2]\n objectid = path.split(/\\//)[3]\n if storage_fetch(repository, objectid) && storage_delete(repository, objectid)\n ['200', {}, []]\n else\n ['404', {}, [\"Repository #{repository} or ObjectID #{objectid} not found: #{path}\"]]\n end\n end", "def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end", "def delete(id)\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n if id.is_a? Array then\n id = id.join(',')\n end\n\n make_post_call('/files/delete?file_ids=%s' % [id]).status == \"OK\"\n end", "def destroy\n @gadget_file.destroy\n respond_to do |format|\n format.html { redirect_to gadget_files_url, notice: 'Gadget file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_one(file)\n files_collection.find(:_id => file.id).delete_one\n chunks_collection.find(:files_id => file.id).delete_many\n end", "def delete_file(id)\n id = self.to_id(id)\n self.grid.get(id)\n grid.delete(id)\n rescue ::Mongo::GridFileNotFound\n false\n end", "def destroy\n #Finds selected data file\n @data_file = DataFile.find(params[:id])\n #destroys data file\n @data_file.destroy\n respond_to do |format|\n format.html { redirect_to '/admin' }\n format.json { head :ok }\n end\n end", "def delete(command)\n pp @client.files.delete(clean_up(command[1]))\n end", "def google_delete_file(client)\n files = []\n [@fields[:files],@fields[:folders]].each do |array|\n if array.is_a?(Array)\n files += array\n elsif !array.nil?\n files.push(array)\n end\n end\n targets = files.collect {|p| CGI::unescape(p)}\n client.delete_files_by_path(targets)\n end", "def delete_file_from_database(file_id)\n $db.execute(\"DELETE FROM files WHERE id = ?\", file_id)\n $db.execute(\"DELETE FROM file_share_table WHERE file_id = ?\", file_id)\nend", "def delete_file_from_db(file_id)\n $db.execute(\"DELETE FROM files WHERE file_id = ?\", file_id)\nend", "def destroy\n @datafile.destroy\n respond_to do |format|\n format.html { redirect_to datafiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @super_file = SuperFile.find(params[:id])\n @super_file.destroy\n\n respond_to do |format|\n format.html { redirect_to super_files_url }\n format.json { head :no_content }\n end\n end", "def delete_file(file_name)\n fail 'No Structure ID defined for structure. Can\\'t delete file' if @structure.id.nil?\n\n data = Hashie::Mash.new\n data.structure_id = @structure.id\n data.file_name = file_name\n\n push_file('api/remove_file', MultiJson.dump(data))\n end", "def b2_delete_file_version(file)\n\n auth_hash = convert_json(b2_authorize_account)\n api_url = auth_hash[\"apiUrl\"]\n account_authorization_token = auth_hash[\"authorizationToken\"]\n\n file_hash = parse_files_json(file)\n file_name = file\n file_id = file_hash[file]\n\n uri = URI(\"#{api_url}/b2api/v1/b2_delete_file_version\")\n req = Net::HTTP::Post.new(uri)\n req.add_field(\"Authorization\",\"#{account_authorization_token}\")\n req.body = \"{\\\"fileName\\\":\\\"#{file_name}\\\", \\\"fileId\\\":\\\"#{file_id}\\\"}\"\n http = Net::HTTP.new(req.uri.host, req.uri.port)\n http.use_ssl = true\n res = http.start {|http| http.request(req)}\n\n case res\n when Net::HTTPSuccess then res.body\n when Net::HTTPRedirection then fetch(res['location'], limit - 1)\n else res.error!\n end\n\nend", "def destroy\n @agent_import_file.destroy\n\n respond_to do |format|\n format.html { redirect_to(agent_import_files_url) }\n format.json { head :no_content }\n end\n end", "def delete(file_path)\n file_name = File.basename(file_path)\n object = @bucket.objects[file_name]\n object.delete\n end", "def destroy\n @indexed_file = IndexedFile.find(params[:id])\n @indexed_file.destroy\n\n respond_to do |format|\n format.html { redirect_to indexed_files_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @hdfs_path = HdfsPath.find(params[:id])\n @hdfs_path.destroy\n\n respond_to do |format|\n format.html { redirect_to hdfs_paths_url }\n format.json { head :ok }\n end\n end", "def destroy\n @action_file = ActionFile.find(params[:id])\n @action_file.destroy\n\n respond_to do |format|\n format.html { redirect_to action_files_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @inventory_file.destroy\n\n respond_to do |format|\n format.html { redirect_to inventory_files_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @inventory_file.destroy\n\n respond_to do |format|\n format.html { redirect_to inventory_files_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @pgn_file = PgnFile.find(params[:id])\n @pgn_file.destroy\n\n respond_to do |format|\n format.html { redirect_to pgn_files_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @up_file = UpFile.find(params[:id])\n @up_file.destroy\n\n respond_to do |format|\n format.html { redirect_to up_files_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @file_info = FileInfo.find(params[:id])\n @file_info.destroy\n\n respond_to do |format|\n format.html { redirect_to file_infos_url }\n format.json { head :no_content }\n end\n end", "def delete(filename); end", "def delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n @batch_file.destroy\n respond_to do |format|\n format.html { redirect_to batch_files_url, notice: \"Batch file was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @resource_file = ResourceFile.find(params[:id])\n @resource_file.destroy\n\n respond_to do |format|\n format.html { redirect_to resource_files_url }\n format.json { head :no_content }\n end\n end", "def delete_file storage_file_path\n @bucket.file(storage_file_path).delete if @bucket.file storage_file_path\n end", "def delete_file storage_file_path\n @bucket.file(storage_file_path).delete if @bucket.file storage_file_path\n end", "def destroy\n @file_folder.destroy\n respond_to do |format|\n format.html { redirect_to file_folders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @incidentfile.destroy\n respond_to do |format|\n format.html { redirect_to incidentfiles_url, notice: 'Incidentfile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @file_upload.destroy\n respond_to do |format|\n format.html { redirect_to file_uploads_url }\n format.json { head :no_content }\n end\n end", "def delete_files(files)\n not_found = []\n files.each do |file|\n file_stored = Files.where({ '_id' => file[:uuid]}).first\n if file_stored.nil?\n logger.error 'File not found ' + file.to_s\n not_found << file\n else\n if file_stored['pkg_ref'] == 1\n # Referenced only once. Delete in this case\n file_stored.destroy\n del_ent_dict(file_stored, :files)\n file_md5 = Files.where('md5' => file_stored['md5'])\n if file_md5.size.to_i.zero?\n # Remove files from grid\n grid_fs = Mongoid::GridFs\n grid_fs.delete(file_stored['grid_fs_id'])\n end\n else\n # Referenced above once. Decrease counter\n file_stored.update_attributes(pkg_ref: file_stored['pkg_ref'] - 1)\n end\n # file_stored.destroy\n # del_ent_dict(file_stored, :files)\n #\n # # Remove files from grid\n # grid_fs = Mongoid::GridFs\n # grid_fs.delete(file_stored['grid_fs_id'])\n end\n end\n not_found\n end", "def destroy\n Track.destroy(params[:id])\n delete_file BSON::ObjectId(params[:id])\n\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @feefile = Feefile.find(params[:id])\n directory= \"uploads\"\n path =File.join(directory,@feefile.feefilename)\n File.delete(path)\n @feefile.destroy\n \n\n respond_to do |format|\n format.html { redirect_to(feefiles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @testfile.destroy\n respond_to do |format|\n format.html { redirect_to materials_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @folder.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @nthfile.destroy\n respond_to do |format|\n format.html { redirect_to nthfiles_url, notice: 'Nthfile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @file_item = FileItem.cs(self.current_scope).find_by_path(params[:id])\n @file_item.destroy\n\n respond_to do |format|\n format.html { redirect_to file_items_url }\n format.json { head :ok }\n end\n end", "def file_delete(node, file)\n _out, _local, _remote, code = node.test_and_store_results_together(\"rm #{file}\", 'root', 500)\n code\nend", "def file_delete(node, file)\n _out, _local, _remote, code = node.test_and_store_results_together(\"rm #{file}\", 'root', 500)\n code\nend", "def destroy\n @event_import_file.destroy\n\n respond_to do |format|\n format.html { redirect_to(event_import_files_url) }\n format.json { head :no_content }\n end\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def destroy\n @history_file_delete.destroy\n respond_to do |format|\n format.html { redirect_to history_file_deletes_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @filename.destroy\n respond_to do |format|\n format.html { redirect_to filenames_url }\n format.json { head :no_content }\n end\n end", "def delete(path)\n request(:delete, path)\n end", "def remove_file\n\n @source_files_id = params[:source] + '_files'\n @source = TaliaCore::Source.find(N::URI.from_encoded(params[:source]))\n\n TaliaFile.find(params[:talia_file_uri]).destroy\n end", "def destroy\n @event_import_file.destroy\n\n respond_to do |format|\n format.html { redirect_to event_import_files_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @commit_filepath.destroy\n respond_to do |format|\n format.html { redirect_to commit_filepaths_url, notice: 'Commit filepath was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_file(uid, info = {})\n if info[\"multipart_id\"]\n multipart_upload = object(uid).multipart_upload(info[\"multipart_id\"])\n abort_multipart_upload(multipart_upload)\n\n delete [object(\"#{uid}.info\")]\n else\n delete [object(uid), object(\"#{uid}.info\")]\n end\n end", "def delete\n# if stat.directory?\n# FileUtils.rm_rf(file_path)\n# else\n# File.unlink(file_path)\n# end\n if collection?\n @collection.find({:filename => /^#{Regexp.escape(@bson['filename'])}/}).each do |bson|\n @collection.remove(bson)\n end\n else\n @collection.remove(@bson)\n end\n NoContent\n end", "def destroy\n #FIXME: Double check auth is working for deletion. Also, maybe should only delete if not associated with any experiments.\n @data_file.destroy\n \n respond_to do |format|\n format.html { redirect_to(data_files_path) }\n format.xml { head :ok }\n end\n end", "def delete_files(uuids)\n Uploadcare::FileList.batch_delete(uuids)\n end", "def deletef\n url = prefix + \"deletef\" + id_param\n return response(url)\n end", "def destroy\n @admin_people_file.destroy\n respond_to do |format|\n format.html { redirect_to admin_people_files_url, notice: 'People file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @expenses_file.destroy\n respond_to do |format|\n format.html { redirect_to expenses_files_url, notice: 'Expenses file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @file_version.destroy\n head :no_content\n end", "def destroy\n @genbank_file.destroy\n\n respond_to do |format|\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "def delete(path, headers = {})\n process :delete, path, headers\n end", "def delete(uuid, key)\n request(method: 'DELETE', uri: \"/files/#{uuid}/metadata/#{key}/\")\n end", "def delete(path)\n with_remote do |http|\n http.delete(path)\n end\n end", "def delete_service_files(resource)\n file get_service_script_name(resource) do\n action :delete\n only_if { get_service_script_name != nil }\n end\nend", "def destroy\n @agent_import_file.destroy\n\n respond_to do |format|\n format.html { redirect_to agent_import_files_url, notice: t('controller.successfully_deleted', model: t('activerecord.models.agent_import_file')) }\n format.json { head :no_content }\n end\n end", "def destroy\n @userfile = Userfile.find(params[:id])\n @userfile.destroy\n\n respond_to do |format|\n format.html { redirect_to uploads_url }\n format.json { head :no_content }\n end\n end", "def destroy\n begin\n File.delete( @doc_file.docOwner)\n rescue\n end\n @doc_file.destroy\n \n respond_to do |format|\n format.html { redirect_to doc_files_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @storage = @client.storages.find(params[:id])\n @storage.destroy\n\n respond_to do |format|\n format.html { redirect_to client_url(@client) }\n format.json { head :no_content }\n end\n end", "def delete(path_info)\n @file_store.delete path_info\n\n @bucket.objects[gem_object_name(path_info)].delete\n end", "def destroy\n \n @user_file = UserFile.find(params[:id])\n authorize! :destroy, @user_file\n name=@user_file.uploaded_file_file_name\n @user_file.destroy\n\n respond_to do |format|\n format.html { redirect_to :back,:notice=>\"Deleted file: \"+name }\n format.json { head :ok }\n end\n end", "def destroy\n @config_file = ConfigFile.find(params[:id])\n @config_file.destroy\n\n respond_to do |format|\n format.html { redirect_to config_files_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @file.destroy\n respond_to do |format|\n format.js\n format.json { head :no_content, status: :destroyed }\n end\n end", "def destroy\n @seo_file.destroy\n respond_to do |format|\n format.html { redirect_to seo_files_url, notice: 'Seo file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n \n end" ]
[ "0.7157098", "0.71361095", "0.7060626", "0.7055122", "0.7013899", "0.6991544", "0.6975205", "0.69202113", "0.690333", "0.68928653", "0.6870393", "0.6856543", "0.6844567", "0.68409395", "0.68379027", "0.6794251", "0.67801213", "0.67705613", "0.6766225", "0.6760091", "0.6759447", "0.67592466", "0.67518115", "0.67518115", "0.6734792", "0.6699947", "0.66870105", "0.66736466", "0.6664138", "0.6664003", "0.66604275", "0.6656522", "0.665455", "0.6643734", "0.66359365", "0.6598396", "0.6593717", "0.65772253", "0.657132", "0.65643984", "0.65608716", "0.65592206", "0.6553459", "0.6550992", "0.6545635", "0.6532164", "0.6532164", "0.6516741", "0.65097255", "0.6508755", "0.65085125", "0.6499341", "0.6497411", "0.64898247", "0.6489713", "0.6489713", "0.6485395", "0.64818627", "0.64644164", "0.64574844", "0.64457136", "0.644539", "0.6443811", "0.6443138", "0.64419204", "0.64387137", "0.64384663", "0.64384663", "0.6433617", "0.6431636", "0.6427103", "0.6423009", "0.64134306", "0.6411273", "0.64109313", "0.63989556", "0.6391948", "0.6389298", "0.6381406", "0.63799804", "0.6371119", "0.6369059", "0.6368756", "0.636611", "0.63654613", "0.6357815", "0.63462496", "0.63411885", "0.6340494", "0.63398516", "0.63395685", "0.6337229", "0.63347507", "0.6326634", "0.632363", "0.63229716", "0.6317141", "0.6314566", "0.63132477", "0.63117427" ]
0.76047885
0
Use callbacks to share common setup or constraints between actions.
def set_grid_fs_file @grid_fs_file = GridFsFile.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 grid_fs_file_params params.require(:grid_fs_file).permit(:filename, :contentType, :author, :topic, :uploadDate, :length, :chunkSize, :md5, :contents) 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
GET /colegios GET /colegios.json
def index @colegios = Colegio.all respond_to do |format| format.html # index.html.erb format.json { render json: @colegios } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @colegio = Colegio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colegio }\n end\n end", "def index\n @cofis = Cofi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cofis }\n end\n end", "def show\n @cofi = Cofi.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cofi }\n end\n end", "def index\n url = \"https://data.cityofchicago.org/resource/x2n5-8w5q.json\"\n options = { :body => {:status => text}, :basic_auth => @auth }\n @response = HTTParty.get(url, options)\n\n @crime = Hash.new\n\n #@crime['block'] = @response[0]['block']\n @crime = @response\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gittos }\n end\n end", "def new\n @colegio = Colegio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @colegio }\n end\n end", "def index\n @conseilles = Conseille.all\n respond_to do |format|\n format.html\n format.json { render json: @conseilles}\n end\n end", "def index\n @concursos = Concurso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @concursos }\n end\n end", "def index\n @ginasios = Ginasio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ginasios }\n end\n end", "def index\n @cfos = Cfo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cfos }\n end\n end", "def show\n @colegiatura = Colegiatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colegiatura }\n end\n end", "def index\n @socios = Socio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @socios }\n end\n end", "def index\n @cooperativas = Cooperativa.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cooperativas }\n end\n end", "def index\n @congressos = Congresso.all\n end", "def show\n @concurso = Concurso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @concurso }\n end\n end", "def index\n @coasters = Coaster.all\n\n render json: @coasters\n end", "def index\n @cocktails = Cocktail.where(\"oficial = ?\", false)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cocktails }\n end\n end", "def show\n @comic = Comic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comic }\n end\n end", "def show\n @comic = Comic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comic }\n end\n end", "def index\n @coocos = Cooco.all\n end", "def index\n @clues = Clue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clues }\n end\n end", "def show\n @corgi = Corgi.find(params[:id])\n respond_to do |format|\n format.html \n format.json { render json: @corgi }\n end \n end", "def index\n @copenometros = Copenometro.all\n end", "def corona_virus\n # endpoint = \"https://corona.lmao.ninja/all\"\n endpoint = 'https://corona.lmao.ninja/v2/all'\n response = HTTParty.get(endpoint)\n data = JSON.parse response.body\n res = data\n result = []\n result<<{\n country: \"world\",\n cases: res[\"cases\"],\n todayCases: res[\"todayCases\"],\n deaths: res[\"deaths\"],\n todayDeaths: res[\"todayDeaths\"],\n recovered: res[\"recovered\"],\n active: res[\"active\"],\n critical: res[\"critical\"],\n casesPerOneMillion: res[\"casesPerOneMillion\"],\n deathsPerOneMillion: res[\"deathsPerOneMillion\"],\n tests: res[\"tests\"],\n testsPerOneMillion: res[\"testsPerOneMillion\"],\n affectedCountries: res[\"affectedCountries\"]\n }\n render json: result\n end", "def show\n @coisa = Coisa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @coisa }\n end\n end", "def show\n @cso = Cso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cso }\n end\n end", "def index\n @simple_chores = SimpleChore.all\n respond_to do |format|\n format.html\n format.json { render :json => @simple_chores }\n end\n end", "def show\n @cuerpo = Cuerpo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cuerpo }\n end\n end", "def index\n @contas = Conta.all\n respond_to do |format|\n format.json { render json: @contas.to_json, status: :ok }\n end\n end", "def show\n @consumo = Consumo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @consumo }\n end\n end", "def index\n @ocats = Ocat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ocats }\n end\n end", "def index\n @cabines = Cabine.all\n render json: @cabines\n end", "def index\n @commemts = Commemt.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @commemts }\n end\n end", "def index\n @chores = Chore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @chores }\n end\n end", "def index\n @chores = Chore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @chores }\n end\n end", "def index\n @coches = Coche.all\n end", "def index\n @cursos = Curso.all_active\n @curso = Curso.new\n @programas = Programa.all_active\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cursos }\n end\n end", "def index\n require 'rest-client'\n response = RestClient::Request.execute(method: :get, url: 'localhost:3001/colores',\n headers: {page: params[:page], items: 9})\n if response.code == 200\n body = JSON.parse(response.body)\n @colors = body[\"data\"]\n @page = body[\"page\"]\n end\n end", "def index\n rol = Role.where(:id=>current_user.role).first\n if rol.nombre == \"DN\" or rol.nombre == \"ACRM\"\n @colegiaturas = Colegiatura.all\n else\n @colegiaturas = Colegiatura.where(:sede_id=>current_user.sede)\n end \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @colegiaturas }\n end\n end", "def index\n @given_circumstances = GivenCircumstance.all\n render json: @given_circumstances\n end", "def show\n @central_correio = CentralCorreio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @central_correio }\n end\n end", "def get_json(path)\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n #puts \"🤖 GET #{path}\"\n #puts \"HTTP #{response.code}\"\n #puts JSON.pretty_generate(result)\n result\nend", "def index\n @consorciots = Consorciot.all\n end", "def index\n @cousins = Cousin.all\n end", "def show\n @comedorue = Comedorue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comedorue }\n end\n end", "def index\n @consents = Consent.all\n render json: @consents\n end", "def new\n @cofi = Cofi.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cofi }\n end\n end", "def show\n @golf_cource = GolfCource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @golf_cource }\n end\n end", "def get_json()\n\n http = Net::HTTP.new(STATUS_URI.host, STATUS_URI.port)\n http.use_ssl = false\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Get.new(\"/api/services.json\")\n\n response = http.request(request)\n JSON.parse(response.body)\nend", "def show\n @cerc = Cerc.find(params[:id])\n\n render json: @cerc\n end", "def all_companies_information\n\t\tbegin\n\t url = URI.parse(Rails.application.secrets[:api_endpoints]['onething']['url_company_info'])\n\t\t url_params = {}\n\t\t path = \"#{url.path}?#{url_params.collect { |k,v| \"#{k}=#{CGI::escape(v.to_s)}\"}.join('&')}\"\n\t\t request = Net::HTTP::Get.new(path) \n\t\t response = Net::HTTP.start(url.host, url.port, :use_ssl => false, :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http| \n\t\t http.request(request)\n\t\t end \n\t\t json_data = JSON.parse(response.body) rescue nil\n\t\t if !json_data.present?\n\t\t \treturn {}\n\t\t else\n\t\t return json_data\n\t\t end\n\t rescue => e\n\t \treturn {:message => 'Error in fetchng API data. Please try again.'}\t\n\t end\n\tend", "def index\n @competencies = Competency.all\n respond_to do |format|\n format.json { render json: @competencies }\n end\n end", "def index\n @congties = Congty.all\n end", "def show\n @ocat = Ocat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ocat }\n end\n end", "def index\n @ciclos = Ciclo.all\n end", "def index\n @ciclos = Ciclo.all\n end", "def get\n @cine = Cine.find(params[:cine_id], :select => [\"nombre\",\"id\",\"direccion\",\"localidad\"])\n render :json => [ @cine, :peliculas => @cine.peliculas.select('titulo,horas,pelicula_id') ]\n end", "def index\n @cofs = Cof.all\n end", "def show\n @comentario = Comentario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comentario }\n end\n end", "def show\n @comentario = Comentario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comentario }\n end\n end", "def index\n @clientes = Cliente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clientes }\n end\n end", "def show\n @socio = Socio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @socio }\n end\n end", "def index\n @recipies = Recipy.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recipies }\n end\n end", "def api_request\n url = URI.parse(\"https://catfact.ninja/fact\")\n response = Net::HTTP.get_response(url)\n JSON.parse(response.body)[\"fact\"]\n end", "def list_tenants_for_circles(args = {}) \n get(\"/tenants.json/circles\", args)\nend", "def new\n @colegiatura = Colegiatura.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @colegiatura }\n end\n end", "def index\n @disciplines = Discipline.all\n\n render json: @disciplines\n end", "def index\n @campanhas = Campanha.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @campanhas }\n end\n end", "def show\n\n respond_to do |format|\n format.json { render json: @cage }\n end\n end", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n puts JSON.pretty_generate(result)\n result\nend", "def show\n @colaboration = Colaboration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colaboration }\n end\n end", "def show\n @competicao = Competicao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competicao }\n end\n end", "def index\n if params[:site_id].nil? or params[:site_id].empty?\n @comentarios = Comentario.all # path: /types\n else\n @comentarios = Site.find(params[:site_id]).comentarios # path: /sites/id/comentarios\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comentarios }\n end\n end", "def show\n @cocktail = Cocktail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cocktail }\n end\n end", "def show\n @correo = Correo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @correo }\n end\n end", "def show\n @correo = Correo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @correo }\n end\n end", "def destroy\n @colegio = Colegio.find(params[:id])\n @colegio.destroy\n\n respond_to do |format|\n format.html { redirect_to colegios_url }\n format.json { head :no_content }\n end\n end", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend", "def info\n CouchRest.get \"#{@uri}/\"\n end", "def show\n @socio = Socio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @socio }\n end\n end", "def show\n @cegonha = Cegonha.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cegonha }\n end\n end", "def index\n @clients = current_user.clients\n render json: @clients\n end", "def index\n @mycometer_cocs = MycometerCoc.all\n end", "def index\n @uchronias = Uchronia.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @uchronias }\n end\n end", "def show\n @cervejaria = Cervejaria.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cervejaria }\n end\n end", "def get_conversations_cobrowsesessions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ConversationsApi.get_conversations_cobrowsesessions ...\"\n end\n \n # resource path\n local_var_path = \"/api/v2/conversations/cobrowsesessions\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n 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 => 'CobrowseConversationEntityListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConversationsApi#get_conversations_cobrowsesessions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @usuarios = Usuario.por_colegio(colegio.id).order(\"nombre\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @usuarios }\n end\n end", "def index\n @cocoon_examples = CocoonExample.all\n end", "def index\n info = Aws.get_recipes_from_db\n render :json => info\n end", "def index\n @cicts = Cict.all\n end", "def index\n @corgis = Corgi.all\n end", "def show\n @areco = Areco.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @areco }\n end\n end", "def show\n @cocktail = Cocktail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @cocktail }\n end\n end", "def show\n @ginasio = Ginasio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @ginasio }\n end\n end", "def new\n @congreso = Congreso.new\n @campos = Campo.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @congreso }\n end\n end", "def index\n @cages = current_user.cages\n\n respond_to do |format|\n format.json { render json: @cages }\n end\n end", "def index\n @ctypes = Ctype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ctypes }\n end\n end", "def get(path='', filter=nil)\n # remove the leading slash\n path = path.gsub(/\\A\\//, '')\n\n response = if filter\n categories = filter.categories.collect { |category| category.to_text }.join(',')\n attributes = filter.entities.collect { |entity| entity.attributes.combine.collect { |k, v| k + '=' + v } }.join(',')\n\n headers = self.class.headers.clone\n headers['Content-Type'] = 'text/occi'\n headers['Category'] = categories unless categories.empty?\n headers['X-OCCI-Attributes'] = attributes unless attributes.empty?\n\n self.class.get(@endpoint + path, :headers => headers)\n else\n self.class.get(@endpoint + path)\n end\n\n response_msg = response_message response\n raise \"HTTP GET failed! #{response_msg}\" unless response.code.between? 200, 300\n\n Occi::Log.debug \"Response location: #{('/' + path).match(/\\/.*\\//).to_s}\"\n kind = @model.get_by_location(('/' + path).match(/\\/.*\\//).to_s) if @model\n\n Occi::Log.debug \"Response kind: #{kind}\"\n\n if kind\n kind.related_to? Occi::Core::Resource ? entity_type = Occi::Core::Resource : entity_type = nil\n entity_type = Occi::Core::Link if kind.related_to? Occi::Core::Link\n end\n\n entity_type = Occi::Core::Resource unless entity_type\n\n Occi::Log.debug \"Parser call: #{response.content_type} #{path.include?('-/')} #{entity_type} #{response.headers.inspect}\"\n collection = Occi::Parser.parse(response.content_type, response.body, path.include?('-/'), entity_type, response.headers)\n\n Occi::Log.debug \"Parsed collection: empty? #{collection.empty?}\"\n collection\n end", "def index\n colorizers = Colorizer.all\n\n render json: colorizers\n end", "def index\n @giro_comercials = GiroComercial.all\n end" ]
[ "0.7090613", "0.6498888", "0.63951826", "0.6394206", "0.6375297", "0.6312488", "0.62983924", "0.6287523", "0.62526613", "0.6245438", "0.6136158", "0.61013955", "0.60951555", "0.60916674", "0.6083664", "0.6080305", "0.60748327", "0.60748327", "0.6041572", "0.60068804", "0.60039943", "0.59484786", "0.5932743", "0.5929721", "0.5928898", "0.5899499", "0.58968383", "0.5848978", "0.58469063", "0.5832778", "0.5821412", "0.5811754", "0.57946175", "0.57946175", "0.57834876", "0.5780076", "0.5774835", "0.5770391", "0.5768828", "0.5764853", "0.5761784", "0.5745569", "0.5740374", "0.5734619", "0.5725006", "0.5723869", "0.57210845", "0.5719526", "0.5718419", "0.57121986", "0.5693634", "0.5691774", "0.5690805", "0.56901956", "0.56901956", "0.5686519", "0.5677854", "0.5676349", "0.5676349", "0.5676273", "0.5675779", "0.5675777", "0.5667058", "0.56626713", "0.56624794", "0.56600785", "0.56530696", "0.56522834", "0.5649908", "0.5647179", "0.56438094", "0.5643281", "0.5642177", "0.5637422", "0.5636727", "0.56257993", "0.56223583", "0.56223583", "0.56220955", "0.5611475", "0.56109095", "0.560849", "0.5606963", "0.56053853", "0.56045526", "0.56034356", "0.5601379", "0.55960083", "0.5593616", "0.55876106", "0.55862963", "0.5582362", "0.55798215", "0.55741435", "0.5571086", "0.5570672", "0.55686474", "0.5568068", "0.55676967", "0.55665845" ]
0.7311583
0
GET /colegios/1 GET /colegios/1.json
def show @colegio = Colegio.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @colegio } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @colegios = Colegio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @colegios }\n end\n end", "def show\n @cofi = Cofi.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cofi }\n end\n end", "def index\n @cofis = Cofi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cofis }\n end\n end", "def index\n url = \"https://data.cityofchicago.org/resource/x2n5-8w5q.json\"\n options = { :body => {:status => text}, :basic_auth => @auth }\n @response = HTTParty.get(url, options)\n\n @crime = Hash.new\n\n #@crime['block'] = @response[0]['block']\n @crime = @response\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gittos }\n end\n end", "def index\n @conseilles = Conseille.all\n respond_to do |format|\n format.html\n format.json { render json: @conseilles}\n end\n end", "def new\n @colegio = Colegio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @colegio }\n end\n end", "def show\n @comic = Comic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comic }\n end\n end", "def show\n @comic = Comic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comic }\n end\n end", "def index\n @concursos = Concurso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @concursos }\n end\n end", "def index\n @cooperativas = Cooperativa.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cooperativas }\n end\n end", "def show\n @colegiatura = Colegiatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colegiatura }\n end\n end", "def index\n @coasters = Coaster.all\n\n render json: @coasters\n end", "def index\n @ginasios = Ginasio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ginasios }\n end\n end", "def show\n @corgi = Corgi.find(params[:id])\n respond_to do |format|\n format.html \n format.json { render json: @corgi }\n end \n end", "def show\n @concurso = Concurso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @concurso }\n end\n end", "def index\n @cfos = Cfo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cfos }\n end\n end", "def index\n @socios = Socio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @socios }\n end\n end", "def index\n @cocktails = Cocktail.where(\"oficial = ?\", false)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cocktails }\n end\n end", "def show\n @cso = Cso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cso }\n end\n end", "def show\n @cuerpo = Cuerpo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cuerpo }\n end\n end", "def show\n @coisa = Coisa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @coisa }\n end\n end", "def show\n @consumo = Consumo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @consumo }\n end\n end", "def index\n @congressos = Congresso.all\n end", "def index\n @simple_chores = SimpleChore.all\n respond_to do |format|\n format.html\n format.json { render :json => @simple_chores }\n end\n end", "def show\n @central_correio = CentralCorreio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @central_correio }\n end\n end", "def index\n @clues = Clue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clues }\n end\n end", "def index\n @coocos = Cooco.all\n end", "def index\n @copenometros = Copenometro.all\n end", "def show\n @ocat = Ocat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ocat }\n end\n end", "def get\n @cine = Cine.find(params[:cine_id], :select => [\"nombre\",\"id\",\"direccion\",\"localidad\"])\n render :json => [ @cine, :peliculas => @cine.peliculas.select('titulo,horas,pelicula_id') ]\n end", "def index\n @cabines = Cabine.all\n render json: @cabines\n end", "def index\n @commemts = Commemt.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @commemts }\n end\n end", "def show\n @cerc = Cerc.find(params[:id])\n\n render json: @cerc\n end", "def index\n @cursos = Curso.all_active\n @curso = Curso.new\n @programas = Programa.all_active\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cursos }\n end\n end", "def index\n @contas = Conta.all\n respond_to do |format|\n format.json { render json: @contas.to_json, status: :ok }\n end\n end", "def index\n @ocats = Ocat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ocats }\n end\n end", "def new\n @cofi = Cofi.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cofi }\n end\n end", "def index\n @chores = Chore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @chores }\n end\n end", "def index\n @chores = Chore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @chores }\n end\n end", "def show\n @competicao = Competicao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competicao }\n end\n end", "def show\n @comentario = Comentario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comentario }\n end\n end", "def show\n @comentario = Comentario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comentario }\n end\n end", "def show\n @cocktail = Cocktail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cocktail }\n end\n end", "def show\n @colaboration = Colaboration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colaboration }\n end\n end", "def show\n @clonet = Clonet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clonet }\n end\n end", "def first\n @comic = Comic.order(\"created_at ASC\").first\n respond_to do |format|\n format.html { render 'show' }\n format.json { render json: @comic }\n end\n end", "def first\n @comic = Comic.order(\"created_at ASC\").first\n respond_to do |format|\n format.html { render 'show' }\n format.json { render json: @comic }\n end\n end", "def show\n @socio = Socio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @socio }\n end\n end", "def index\n @cousins = Cousin.all\n end", "def index\n @disciplines = Discipline.all\n\n render json: @disciplines\n end", "def show\n @comic_page = ComicPage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comic_page }\n end\n end", "def index\n @recipies = Recipy.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recipies }\n end\n end", "def show\n @comedorue = Comedorue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comedorue }\n end\n end", "def index\n @uchronias = Uchronia.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @uchronias }\n end\n end", "def index\n if params[:site_id].nil? or params[:site_id].empty?\n @comentarios = Comentario.all # path: /types\n else\n @comentarios = Site.find(params[:site_id]).comentarios # path: /sites/id/comentarios\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comentarios }\n end\n end", "def show\n @complaint = Complaint.find(params[:id])\n\n render json: @complaint\n end", "def index\n @clientes = Cliente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clientes }\n end\n end", "def show\n @cocktail = Cocktail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @cocktail }\n end\n end", "def show\n @commtent1 = Commtent1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @commtent1 }\n end\n end", "def index\n require 'rest-client'\n response = RestClient::Request.execute(method: :get, url: 'localhost:3001/colores',\n headers: {page: params[:page], items: 9})\n if response.code == 200\n body = JSON.parse(response.body)\n @colors = body[\"data\"]\n @page = body[\"page\"]\n end\n end", "def show\n @correo = Correo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @correo }\n end\n end", "def show\n @correo = Correo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @correo }\n end\n end", "def show\n @socio = Socio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @socio }\n end\n end", "def index\n @consorciots = Consorciot.all\n end", "def show\n @ginasio = Ginasio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @ginasio }\n end\n end", "def index\n @competencies = Competency.all\n respond_to do |format|\n format.json { render json: @competencies }\n end\n end", "def show\n @cec_complaint = CecComplaint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cec_complaint }\n end\n end", "def show\n @areco = Areco.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @areco }\n end\n end", "def index\n @ciclos = Ciclo.all\n end", "def index\n @ciclos = Ciclo.all\n end", "def show\n @cppic = Cppic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cppic }\n end\n end", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n puts JSON.pretty_generate(result)\n result\nend", "def get_json(path)\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n #puts \"🤖 GET #{path}\"\n #puts \"HTTP #{response.code}\"\n #puts JSON.pretty_generate(result)\n result\nend", "def show\n @golf_cource = GolfCource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @golf_cource }\n end\n end", "def show\n @cegonha = Cegonha.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cegonha }\n end\n end", "def index\n @consents = Consent.all\n render json: @consents\n end", "def show\n @cervejaria = Cervejaria.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cervejaria }\n end\n end", "def show\n @clue = Clue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clue }\n end\n end", "def show\n @clue = Clue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clue }\n end\n end", "def show\n @uchronia = Uchronia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @uchronia }\n end\n end", "def index\n @coches = Coche.all\n end", "def show\n @custo = Custo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @custo }\n end\n end", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend", "def index\n rol = Role.where(:id=>current_user.role).first\n if rol.nombre == \"DN\" or rol.nombre == \"ACRM\"\n @colegiaturas = Colegiatura.all\n else\n @colegiaturas = Colegiatura.where(:sede_id=>current_user.sede)\n end \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @colegiaturas }\n end\n end", "def get_json()\n\n http = Net::HTTP.new(STATUS_URI.host, STATUS_URI.port)\n http.use_ssl = false\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Get.new(\"/api/services.json\")\n\n response = http.request(request)\n JSON.parse(response.body)\nend", "def show\n @incucai = Incucai.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @incucai }\n end\n end", "def new\n @comic = Comic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comic }\n end\n end", "def show\n @condclima = Condclima.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @condclima }\n end\n end", "def index\n @ctypes = Ctype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ctypes }\n end\n end", "def index\n @given_circumstances = GivenCircumstance.all\n render json: @given_circumstances\n end", "def show\n @climate = Climate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @climate }\n end\n end", "def index\n @cofs = Cof.all\n end", "def index\n @clients = current_user.clients\n render json: @clients\n end", "def show\n @tipo_convenio = TipoConvenio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_convenio }\n end\n end", "def show\n if params[:id]\n @cooperativa = Cooperativa.find(params[:id])\n else\n @cooperativa = Cooperativa.find(params[:cooperativa_id])\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @cooperativa }\n end\n end", "def show\n\n respond_to do |format|\n format.json { render json: @cage }\n end\n end", "def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tecnico }\n end\n end", "def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tecnico }\n end\n end", "def index\n @usuarios = Usuario.por_colegio(colegio.id).order(\"nombre\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @usuarios }\n end\n end" ]
[ "0.7288804", "0.66916096", "0.6590156", "0.6460977", "0.6398999", "0.63967943", "0.6394224", "0.6394224", "0.63918185", "0.6380489", "0.6376027", "0.63126475", "0.6306827", "0.63048637", "0.63030905", "0.62984747", "0.6268256", "0.62515485", "0.6215043", "0.61878717", "0.6180843", "0.6128031", "0.6126406", "0.6124295", "0.60815287", "0.6078369", "0.6068847", "0.6045137", "0.6014026", "0.5990579", "0.5988474", "0.59785926", "0.5972232", "0.5969589", "0.5968894", "0.5961513", "0.5942214", "0.5938462", "0.5938462", "0.5933588", "0.5923223", "0.5923223", "0.5918718", "0.5916924", "0.5916312", "0.5915975", "0.5915975", "0.59020716", "0.5893042", "0.58852404", "0.58834964", "0.58792174", "0.58714336", "0.58710283", "0.58631414", "0.5862793", "0.5862336", "0.585938", "0.58579034", "0.5852973", "0.5843852", "0.5842776", "0.58394015", "0.58385783", "0.583743", "0.58369243", "0.5835443", "0.5826593", "0.58186144", "0.58186144", "0.5817322", "0.58170843", "0.5815575", "0.5814798", "0.5814196", "0.5805818", "0.58022076", "0.579564", "0.579564", "0.57941145", "0.57925063", "0.5789075", "0.57857174", "0.57857174", "0.5781244", "0.57784575", "0.5778344", "0.5773152", "0.5768309", "0.5768256", "0.5757079", "0.5752501", "0.57521766", "0.57514936", "0.5750755", "0.57503796", "0.5743556", "0.5736888", "0.5736888", "0.5736362" ]
0.721024
1
GET /colegios/new GET /colegios/new.json
def new @colegio = Colegio.new respond_to do |format| format.html # new.html.erb format.json { render json: @colegio } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @cofi = Cofi.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cofi }\n end\n end", "def new\n @concurso = Concurso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @concurso }\n end\n end", "def new\n @contacter = Contacter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contacter }\n end\n end", "def new\n @colegiatura = Colegiatura.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @colegiatura }\n end\n end", "def new\n @cso = Cso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cso }\n end\n end", "def new\n @coisa = Coisa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @coisa }\n end\n end", "def new\n @comic = Comic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comic }\n end\n end", "def new\n @socio = Socio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @socio }\n end\n end", "def new\n @ocat = Ocat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ocat }\n end\n end", "def new\n @ci = Ci.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ci }\n end\n end", "def new\n @recurso = Recurso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recurso }\n end\n end", "def new\n @cool = Cool.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cool }\n end\n end", "def new\n @socio = Socio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @socio }\n end\n end", "def new\n @cuerpo = Cuerpo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cuerpo }\n end\n end", "def new\n @clue = Clue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clue }\n end\n end", "def new\n @clue = Clue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clue }\n end\n end", "def new\n @clonet = Clonet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clonet }\n end\n end", "def new\n @cont = Cont.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cont }\n end\n end", "def new\n @cfo = Cfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cfo }\n end\n end", "def new\n @ctype = Ctype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ctype }\n end\n end", "def new\n @caixa = Caixa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @caixa }\n end\n end", "def new\n @areco = Areco.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @areco }\n end\n end", "def new\n @newapp = Newapp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newapp }\n end\n end", "def new\n @comisaria = Comisaria.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comisaria }\n end\n end", "def new\n @noto = Noto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @noto }\n end\n end", "def new\n @comentario = Comentario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comentario }\n end\n end", "def new\n @ginasio = Ginasio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @ginasio }\n end\n end", "def new\n @new_comm = NewComm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_comm }\n end\n end", "def new\n @tecnico = Tecnico.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tecnico }\n end\n end", "def new\n @colaboration = Colaboration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @colaboration }\n end\n end", "def new\n @cocktail = Cocktail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cocktail }\n end\n end", "def new\n @coordinador = Coordinador.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @coordinador }\n end\n end", "def new\n @contum = Contum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contum }\n end\n end", "def new\n @idiom = Idiom.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @idiom }\n end\n end", "def new\n @sitio = Sitio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sitio }\n end\n end", "def new\n @crime = Crime.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @crime }\n end\n end", "def new\n @what = What.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @what }\n end\n end", "def new\n @tipo_convenio = TipoConvenio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipo_convenio }\n end\n end", "def new\n @competicao = Competicao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @competicao }\n end\n end", "def new\n @po = Po.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @po }\n end\n end", "def new\n @distro = Distro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @distro }\n end\n end", "def new\n @distro = Distro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @distro }\n end\n end", "def new\n @cat = Cat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cat }\n end\n end", "def new\n @cat = Cat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cat }\n end\n end", "def new\n @cita = Cita.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cita }\n end\n end", "def new\n @contrato = Contrato.new\n\n respond_to do |format|\n format.html { render layout: nil } # new.html.erb\n format.json { render json: @contrato }\n end\n end", "def new\n @custo = Custo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @custo }\n end\n end", "def new\n @company = Company.new(:name => 'default')\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @company }\n end\n end", "def new\n @congreso = Congreso.new\n @campos = Campo.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @congreso }\n end\n end", "def new\n @ca = Ca.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ca }\n end\n end", "def new\n @core_nota = Core::Nota.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @core_nota }\n end\n end", "def new\n puts \"HAHAHAHAHHA\"\n @information_request = InformationRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @information_request }\n end\n end", "def create\n @colegio = Colegio.new(params[:colegio])\n\n respond_to do |format|\n if @colegio.save\n format.html { redirect_to @colegio, notice: 'El colegio fue creado satisfactoriamente.' }\n format.json { render json: @colegio, status: :created, location: @colegio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @colegio.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n # open data/default_ecosystems.json and parse\n # object returned is an array of hashes... Ex:\n # p @ecosystems[0] # will return a Hash\n # p @ecosystems[0][\"category\"] # => \"native\"\n #@ecosystems = JSON.parse( File.open( \"#{Rails.root}/public/data/default_ecosystems.json\" , \"r\" ).read )\n #@name_indexed_ecosystems = JSON.parse( File.open( \"#{Rails.root}/public/data/name_indexed_ecosystems.json\" , \"r\" ).read )\n #@ecosystem = @ecosystems[0]\n\n respond_to do |format|\n format.html\n end\n end", "def new\n @carrera = Carrera.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @carrera }\n end\n end", "def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request }\n end\n end", "def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request }\n end\n end", "def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request }\n end\n end", "def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request }\n end\n end", "def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request }\n end\n end", "def new\n @clinic = Clinic.new\n @packages = Package.all\n @pageType = \"new\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clinic }\n end\n end", "def new\n @correo = Correo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @correo }\n end\n end", "def new\n @tecnico = Tecnico.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @tecnico }\n end\n end", "def new\n @icome = Icome.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @icome }\n end\n end", "def new\n puts 'NEW METHOD'\n @pessoa = Pessoa.new\n @pessoa.enderecos.build\n 2.times { @pessoa.telefones.build }\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pessoa }\n end\n end", "def new\n @cocktail = Cocktail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @cocktail }\n end\n end", "def new\n @critic = Critic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @critic }\n end\n end", "def new\n @csosn = Csosn.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @csosn }\n end\n end", "def new\n @caballo = Caballo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @caballo }\n end\n end", "def new\n @relogio = Relogio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @relogio }\n end\n end", "def new\n @thing = Thing.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @thing }\n end\n end", "def new\n @indicativo = Indicativo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @indicativo }\n end\n end", "def new\n @goat = Goat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @goat }\n end\n end", "def new\n @pologeno = Pologeno.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pologeno }\n end\n end", "def new\n @cabinet = Cabinet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cabinet }\n end\n end", "def new\n @conductor = Conductor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @conductor }\n end\n end", "def new\n @conductor = Conductor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @conductor }\n end\n end", "def new\n @ongoing = Ongoing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ongoing }\n end\n end", "def new\n @central_correio = CentralCorreio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @central_correio }\n end\n end", "def new\n @climate = Climate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @climate }\n end\n end", "def new\n @servicio = Servicio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @servicio }\n end\n end", "def new\n @cancha = Cancha.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cancha }\n end\n end", "def new\n @gitto = Gitto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gitto }\n end\n end", "def new\n @cervejaria = Cervejaria.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cervejaria }\n end\n end", "def new\n @pot = Pot.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pot }\n end\n end", "def new\n @comic = Comic.find(params[:comic_id])\n @comic_page = @comic.comic_pages.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comic_page }\n end\n end", "def new\n @chaine = Chaine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @chaine }\n end\n end", "def new\n @veiculo = Veiculo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @veiculo }\n end\n end", "def new\n @indicacao = Indicacao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @indicacao }\n end\n end", "def new\n @comming_soon = CommingSoon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comming_soon }\n end\n end", "def new\n @plannegocio = Plannegocio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @plannegocio }\n end\n end", "def new\n @tipo_negocio = TipoNegocio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipo_negocio }\n end\n end", "def new\n @premio = Premio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @premio }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end" ]
[ "0.72199154", "0.72124135", "0.7162324", "0.71566844", "0.71397537", "0.7135712", "0.7070699", "0.70664847", "0.7018805", "0.7009224", "0.7007303", "0.69972026", "0.6995758", "0.69756794", "0.6968417", "0.6968417", "0.6958663", "0.69579816", "0.6957505", "0.69290185", "0.6903333", "0.68822247", "0.6880927", "0.687569", "0.68459046", "0.6842896", "0.6837428", "0.6837383", "0.6836043", "0.6834843", "0.68323505", "0.68285954", "0.68271923", "0.6826519", "0.6824652", "0.682451", "0.6824142", "0.68231803", "0.6818402", "0.68168813", "0.6812319", "0.6812319", "0.6812253", "0.6812253", "0.68079686", "0.6803088", "0.68016946", "0.67980814", "0.67973155", "0.6797199", "0.6794262", "0.6791972", "0.6790003", "0.6788706", "0.6786566", "0.6784825", "0.6784825", "0.6784825", "0.6784825", "0.6784825", "0.67837685", "0.6782143", "0.678207", "0.6780314", "0.6773848", "0.67727846", "0.6770682", "0.67706186", "0.67681324", "0.6749532", "0.6745687", "0.6745559", "0.6743171", "0.6740075", "0.67380613", "0.6737371", "0.6737371", "0.6735377", "0.673151", "0.6730399", "0.6727633", "0.67235756", "0.67218864", "0.67182636", "0.6716307", "0.6706461", "0.67016083", "0.67012197", "0.66929626", "0.66909", "0.66850835", "0.6679203", "0.66773176", "0.6676699", "0.6676699", "0.6676699", "0.6676699", "0.6676699", "0.6676699", "0.6676699" ]
0.7752958
0
POST /colegios POST /colegios.json
def create @colegio = Colegio.new(params[:colegio]) respond_to do |format| if @colegio.save format.html { redirect_to @colegio, notice: 'El colegio fue creado satisfactoriamente.' } format.json { render json: @colegio, status: :created, location: @colegio } else format.html { render action: "new" } format.json { render json: @colegio.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @cooco = Cooco.new(cooco_params)\n\n respond_to do |format|\n if @cooco.save\n format.html { redirect_to @cooco, notice: 'Cooco was successfully created.' }\n format.json { render :show, status: :created, location: @cooco }\n else\n format.html { render :new }\n format.json { render json: @cooco.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @congresso = Congresso.new(congresso_params)\n\n respond_to do |format|\n if @congresso.save\n format.html { redirect_to @congresso, notice: 'Congresso was successfully created.' }\n format.json { render :show, status: :created, location: @congresso }\n else\n format.html { render :new }\n format.json { render json: @congresso.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @colegiatura = Colegiatura.new(params[:colegiatura])\n\n respond_to do |format|\n if @colegiatura.save\n format.html { redirect_to @colegiatura, notice: 'Colegiatura was successfully created.' }\n format.json { render json: @colegiatura, status: :created, location: @colegiatura }\n else\n format.html { render action: \"new\" }\n format.json { render json: @colegiatura.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @consorciot = Consorciot.new(consorciot_params)\n\n respond_to do |format|\n if @consorciot.save\n format.html { redirect_to @consorciot, notice: 'Consorciot was successfully created.' }\n format.json { render :show, status: :created, location: @consorciot }\n else\n format.html { render :new }\n format.json { render json: @consorciot.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cio = Cio.new(cio_params)\n\n respond_to do |format|\n if @cio.save\n format.html { redirect_to @cio, notice: 'Cio cadastrado com sucesso.' }\n format.json { render :show, status: :created, location: @cio }\n else\n format.html { render :new }\n format.json { render json: @cio.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cocoon_example = CocoonExample.new(cocoon_example_params)\n\n respond_to do |format|\n if @cocoon_example.save\n format.html { redirect_to @cocoon_example, notice: 'Cocoon example was successfully created.' }\n format.json { render :show, status: :created, location: @cocoon_example }\n else\n format.html { render :new }\n format.json { render json: @cocoon_example.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cofi = Cofi.new(params[:cofi])\n\n respond_to do |format|\n if @cofi.save\n format.html { redirect_to cofis_url, notice: 'Cofi was successfully created.' }\n format.json { render json: @cofi, status: :created, location: @cofi }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cofi.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @coisa = Coisa.new(params[:coisa])\n\n respond_to do |format|\n if @coisa.save\n format.html { redirect_to @coisa, :notice => 'Coisa was successfully created.' }\n format.json { render :json => @coisa, :status => :created, :location => @coisa }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @coisa.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @ccosto = Ccosto.new(ccosto_params)\n\n respond_to do |format|\n if @ccosto.save\n format.html { redirect_to @ccosto, notice: 'Ccosto was successfully created.' }\n format.json { render :show, status: :created, location: @ccosto }\n else\n format.html { render :new }\n format.json { render json: @ccosto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @coin_ico = CoinIco.new(coin_ico_params)\n\n respond_to do |format|\n if @coin_ico.save\n format.html { redirect_to coin_icos_path, notice: 'Coin ico was successfully created.' }\n format.json { render :show, status: :created, location: @coin_ico }\n else\n format.html { render :new }\n format.json { render json: @coin_ico.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @coche = Coche.new(coche_params)\n\n respond_to do |format|\n if @coche.save\n format.html { redirect_to @coche, notice: 'Coche was successfully created.' }\n format.json { render action: 'show', status: :created, location: @coche }\n else\n format.html { render action: 'new' }\n format.json { render json: @coche.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @copropietario = Copropietario.new(copropietario_params)\n\n respond_to do |format|\n if @copropietario.save\n format.html { redirect_to @copropietario, notice: 'Copropietario was successfully created.' }\n format.json { render :show, status: :created, location: @copropietario }\n else\n format.html { render :new }\n format.json { render json: @copropietario.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cerc = Cerc.new(params[:cerc])\n\n if @cerc.save\n render json: @cerc, status: :created, location: @cerc\n else\n render json: @cerc.errors, status: :unprocessable_entity\n end\n end", "def post_check(excon, body)\n excon.request(\n method: :post,\n path: '/check',\n headers: { 'Content-Type' => 'application/json' },\n body: body\n )\nend", "def create\n\n client = Cliente.new\n\n client.nombre = params[:nombre]\n client.cedula = params[:cedula]\n client.pagina = params[:pagina]\n\n client.dirrecion = params[:dirrecion]\n client.telefono = params[:telefono]\n \n client.sector = params[:sector]\n \n\n if client.save\n \n\n render(json: client,status: 201 ,location: client)\n else\n\n render(json: client.errors,status: 422 )\n\n end\n end", "def create\n @cuisine = Cuisine.new(spice_params)\n\n if @cuisine.save\n render json: @cuisine, status: :created\n else\n render json: @cuisine.errors, status: :unprocessable_entity\n end\n end", "def create\n @ciclo = Ciclo.new(ciclo_params)\n\n respond_to do |format|\n if @ciclo.save\n format.html { redirect_to @ciclo, notice: 'Ciclo was successfully created.' }\n format.json { render :show, status: :created, location: @ciclo }\n else\n format.html { render :new }\n format.json { render json: @ciclo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ciclo = Ciclo.new(ciclo_params)\n\n respond_to do |format|\n if @ciclo.save\n format.html { redirect_to @ciclo, notice: 'Ciclo was successfully created.' }\n format.json { render :show, status: :created, location: @ciclo }\n else\n format.html { render :new }\n format.json { render json: @ciclo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ciclo = Ciclo.new(ciclo_params)\n\n respond_to do |format|\n if @ciclo.save\n format.html { redirect_to @ciclo, notice: 'Ciclo was successfully created.' }\n format.json { render :show, status: :created, location: @ciclo }\n else\n format.html { render :new }\n format.json { render json: @ciclo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @comic = Comic.new(comic_params)\n\n respond_to do |format|\n if @comic.save\n format.html { redirect_to root_path, notice: 'Comic was successfully created.' }\n format.json { redirect_to root_path, status: :created }\n else\n format.html { render :new }\n format.json { render json: @comic.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cegreso = Cegreso.new(cegreso_params)\n\n respond_to do |format|\n if @cegreso.save\n format.html { redirect_to @cegreso, notice: 'Cegreso was successfully created.' }\n format.json { render :show, status: :created, location: @cegreso }\n else\n format.html { render :new }\n format.json { render json: @cegreso.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cof = Cof.new(cof_params)\n\n respond_to do |format|\n if @cof.save\n format.html { redirect_to @cof, notice: 'Cof was successfully created.' }\n format.json { render action: 'show', status: :created, location: @cof }\n else\n format.html { render action: 'new' }\n format.json { render json: @cof.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @colegio = Colegio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @colegio }\n end\n end", "def create\n @cuerpo = Cuerpo.new(params[:cuerpo])\n\n respond_to do |format|\n if @cuerpo.save\n format.html { redirect_to @cuerpo, notice: 'Cuerpo was successfully created.' }\n format.json { render json: @cuerpo, status: :created, location: @cuerpo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cuerpo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @socio = Socio.new(params[:socio])\n\n respond_to do |format|\n if @socio.save\n format.html { redirect_to @socio, :notice => 'Socio cadastrado com sucesso.' }\n format.json { render :json => @socio, :status => :created, :location => @socio }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @socio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n client= Client.new\n client.cedula= params[:cedula]\n client.sector= params[:sector]\n client.nombre= params[:nombre]\n client.telefono= params[:telefono]\n client.pagina= params[:pagina]\n client.direccion= params[:direccion]\n if client.save\n render(json: client, status: 201 , location: client)\n else \n render(json: client.errors, status: 422)\n end\n end", "def create\n @usercondominio = Usercondominio.new(usercondominio_params)\n\n respond_to do |format|\n if @usercondominio.save\n format.html { redirect_to @usercondominio, notice: 'Usercondominio was successfully created.' }\n format.json { render :show, status: :created, location: @usercondominio }\n else\n format.html { render :new }\n format.json { render json: @usercondominio.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tobacco = Tobacco.new(tobacco_params)\n\n respond_to do |format|\n if @tobacco.save\n format.html { redirect_to @tobacco, notice: 'Tobacco was successfully created.' }\n format.json { render :show, status: :created, location: @tobacco }\n else\n format.html { render :new }\n format.json { render json: @tobacco.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cso = Cso.new(params[:cso])\n\n respond_to do |format|\n if @cso.save\n format.html { redirect_to @cso, notice: 'Cso was successfully created.' }\n format.json { render json: @cso, status: :created, location: @cso }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cso.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cto = Cto.new(cto_params)\n\n respond_to do |format|\n if @cto.save\n format.html { redirect_to @cto, notice: 'Cto was successfully created.' }\n format.json { render action: 'show', status: :created, location: @cto }\n else\n format.html { render action: 'new' }\n format.json { render json: @cto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n puts 'AQQQQQUUUUUUUIIIIII'\n json = ActiveSupport::JSON.decode(params[:pessoa])\n puts json\n @pessoa = Pessoa.new(json)\n # @address = Address.new(params[:address])\n\n # @client.addresses = @address\n\n respond_to do |format|\n if @pessoa.save\n format.html { redirect_to @pessoa, notice: 'Pessoa was successfully created.' }\n format.json { render json: @pessoa, status: :created, location: @pessoa }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pessoa.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cicada = Cicada.new(cicada_params)\n\n respond_to do |format|\n if @cicada.save\n format.html { redirect_to @cicada, notice: 'Cicada was successfully created.' }\n format.json { render :show, status: :created, location: @cicada }\n else\n format.html { render :new }\n format.json { render json: @cicada.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @oncokb = Oncokb.new(oncokb_params)\n\n respond_to do |format|\n if @oncokb.save\n format.html { redirect_to @oncokb, notice: 'Oncokb was successfully created.' }\n format.json { render :show, status: :created, location: @oncokb }\n else\n format.html { render :new }\n format.json { render json: @oncokb.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @daw_curso_comunicado = DawCursoComunicado.new(daw_curso_comunicado_params)\n\n respond_to do |format|\n if @daw_curso_comunicado.save\n format.html { redirect_to @daw_curso_comunicado, notice: 'Daw curso comunicado was successfully created.' }\n format.json { render :show, status: :created, location: @daw_curso_comunicado }\n else\n format.html { render :new }\n format.json { render json: @daw_curso_comunicado.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @comic = Comic.new(params[:comic])\n\n respond_to do |format|\n if @comic.save\n format.html { redirect_to @comic, notice: 'Comic was successfully created.' }\n format.json { render json: @comic, status: :created, location: @comic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @comic.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @prod_coti = ProdCoti.new(prod_coti_params)\n\n respond_to do |format|\n if @prod_coti.save\n format.html { redirect_to @prod_coti, notice: 'Prod coti was successfully created.' }\n format.json { render :show, status: :created, location: @prod_coti }\n else\n format.html { render :new }\n format.json { render json: @prod_coti.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @concurso = Concurso.new(params[:concurso])\n\n respond_to do |format|\n if @concurso.save\n format.html { redirect_to @concurso, notice: 'Concurso criado com sucesso.' }\n format.json { render json: @concurso, status: :created, location: @concurso }\n else\n format.html { render action: \"new\" }\n format.json { render json: @concurso.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tecnico = Tecnico.new(params[:tecnico])\n\n respond_to do |format|\n if @tecnico.save\n format.html { redirect_to @tecnico, :notice => 'Tecnico was successfully created.' }\n format.json { render :json => @tecnico, :status => :created, :location => @tecnico }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @tecnico.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @tipo_comunicacao = TipoComunicacao.new(tipo_comunicacao_params)\n\n respond_to do |format|\n if @tipo_comunicacao.save\n format.html { redirect_to @tipo_comunicacao, notice: 'Tipo comunicacao was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_comunicacao }\n else\n format.html { render :new }\n format.json { render json: @tipo_comunicacao.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @consumo = Consumo.new(consumo_params)\n\n respond_to do |format|\n if @consumo.save\n format.html { redirect_to @consumo, notice: 'Consumo was successfully created.' }\n format.json { render :show, status: :created, location: @consumo }\n else\n format.html { render :new }\n format.json { render json: @consumo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @address_cocoon = AddressCocoon.new(address_cocoon_params)\n\n respond_to do |format|\n if @address_cocoon.save\n format.html { redirect_to @address_cocoon, notice: 'Address cocoon was successfully created.' }\n format.json { render :show, status: :created, location: @address_cocoon }\n else\n format.html { render :new }\n format.json { render json: @address_cocoon.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @concurso = Concurso.new(concurso_params)\n\n respond_to do |format|\n if @concurso.save\n format.html { redirect_to @concurso, notice: 'Concurso ha sido creado correctamente.' }\n format.json { render :show, status: :created, location: @concurso }\n else\n format.html { render :new }\n format.json { render json: @concurso.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @contato = Contato.new(contato_params)\n\n respond_to do |format|\n if @contato.save\n format.html { redirect_to @contato, flash: { success: 'Contato was successfully created.' } }\n format.json { render :show, status: :created, location: @contato }\n else\n format.html { render :new }\n format.json { render json: @contato.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cargo = Cargo.new(cargo_params)\n if @cargo.save\n render json: @cargo\n else\n render json: @cargo.errors, status: :unprocessable_entity\n end\n end", "def create\n @consumo = Consumo.new(params[:consumo])\n\n respond_to do |format|\n if @consumo.save\n format.html { redirect_to @consumo.cliente, :notice => 'Consumo adicionado com sucesso.' }\n format.json { render :json => @consumo, :status => :created, :location => @consumo }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @consumo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @cog = Cog.new(cog_params)\n\n respond_to do |format|\n if @cog.save\n format.html { redirect_to @cog, notice: 'Cog was successfully created.' }\n format.json { render :show, status: :created, location: @cog }\n else\n format.html { render :new }\n format.json { render json: @cog.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ginasio = Ginasio.new(params[:ginasio])\n\n respond_to do |format|\n if @ginasio.save\n format.html { redirect_to @ginasio, :flash => { :success => 'Ginasio criado com sucesso!' } }\n format.json { render :json => @ginasio, :status => :created, :location => @ginasio }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @ginasio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @cfo = Cfo.new(params[:cfo])\n\n respond_to do |format|\n if @cfo.save\n format.html { redirect_to cfos_url, notice: 'ЦФО создан.' }\n format.json { render json: @cfo, status: :created, location: @cfo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cfo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @oferta_academica = OfertaAcademica.new(params[:oferta_academica])\n\n if @oferta_academica.save\n render json: @oferta_academica, status: :created, location: @oferta_academica\n else\n render json: @oferta_academica.errors, status: :unprocessable_entity\n end\n end", "def create\n @caso = Caso.new(caso_params)\n\n respond_to do |format|\n if @caso.save\n format.html { redirect_to @caso, notice: 'Caso was successfully created.' }\n format.json { render :show, status: :created, location: @caso }\n else\n format.html { render :new }\n format.json { render json: @caso.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cuicui = Cuicui.new(cuicui_params)\n\n respond_to do |format|\n if @cuicui.save\n format.html { redirect_to @cuicui, notice: 'Cuicui was successfully created.' }\n format.json { render :show, status: :created, location: @cuicui }\n else\n format.html { render :new }\n format.json { render json: @cuicui.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @accesorio = Accesorio.new(accesorio_params)\n\n respond_to do |format|\n if @accesorio.save\n format.html { redirect_to @accesorio, notice: 'Accesorio was successfully created.' }\n format.json { render :show, status: :created, location: @accesorio }\n else\n format.html { render :new }\n format.json { render json: @accesorio.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @curso = Curso.new(curso_params)\n\n respond_to do |format|\n if @curso.save\n format.json { render json: \"Curso Creado\", status: :created }\n else\n format.json { render json: @curso.errors}\n end\n end\n end", "def create\n @central_correio = CentralCorreio.new(params[:central_correio])\n\n respond_to do |format|\n if @central_correio.save\n format.html { redirect_to @central_correio, notice: 'Central correio was successfully created.' }\n format.json { render json: @central_correio, status: :created, location: @central_correio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @central_correio.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @trein_consul_comercial = TreinConsulComercial.new(trein_consul_comercial_params)\n\n respond_to do |format|\n if @trein_consul_comercial.save\n format.html { redirect_to @trein_consul_comercial, notice: 'Trein consul comercial was successfully created.' }\n format.json { render action: 'show', status: :created, location: @trein_consul_comercial }\n else\n format.html { render action: 'new' }\n format.json { render json: @trein_consul_comercial.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pessoacondominio = Pessoacondominio.new(pessoacondominio_params)\n\n respond_to do |format|\n if @pessoacondominio.save\n format.html { redirect_to @pessoacondominio, notice: 'Pessoa cadastrada com sucesso.' }\n format.json { render :show, status: :created, location: @pessoacondominio }\n else\n format.html { render :new }\n format.json { render json: @pessoacondominio.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @fact = @cat.facts.create!({ fact: api_request })\n if @fact.save\n render json: @fact\n else\n render error: { message: \"Não foi possível criar esse fato para este gatinho! :(\" }, status: 400\n end\n end", "def create\n @cict = Cict.new(cict_params)\n\n respond_to do |format|\n if @cict.save\n format.html { redirect_to @cict, notice: 'Cict was successfully created.' }\n format.json { render :show, status: :created, location: @cict }\n else\n format.html { render :new }\n format.json { render json: @cict.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @colaborador = Colaborador.new(colaborador_params)\n\n respond_to do |format|\n if @colaborador.save\n format.html { redirect_to @colaborador, notice: 'Colaborador was successfully created.' }\n format.json { render :show, status: :created, location: @colaborador }\n else\n format.html { render :new }\n format.json { render json: @colaborador.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @socio = Socio.new(socio_params)\n\n respond_to do |format|\n if @socio.save\n format.html { redirect_to @socio, notice: 'Socio criado com sucesso.' }\n format.json { render :show, status: :created, location: @socio }\n else\n format.html { render :new }\n format.json { render json: @socio.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @socio_cpf = SocioCpf.new(socio_cpf_params)\n\n respond_to do |format|\n if @socio_cpf.save\n format.html { redirect_to @socio_cpf, notice: 'Socio cpf was successfully created.' }\n format.json { render action: 'show', status: :created, location: @socio_cpf }\n else\n format.html { render action: 'new' }\n format.json { render json: @socio_cpf.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(path, json, params = {})\n if path.include?('covid19')\n request = Net::HTTP::Post.new(path, @headers)\n else\n request = Net::HTTP::Post.new('/v2' + path, @headers)\n end\n request.add_field('Content-Type', 'application/json')\n request.body = json\n params.each do |k, v|\n request[k] = v\n end\n send_request(request)\n end", "def create\n @inventario_cosa = InventarioCosa.new(inventario_cosa_params)\n\n respond_to do |format|\n if @inventario_cosa.save\n format.html { redirect_to @inventario_cosa, notice: 'Inventario cosa was successfully created.' }\n format.json { render :show, status: :created, location: @inventario_cosa }\n else\n format.html { render :new }\n format.json { render json: @inventario_cosa.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @colaborattor = Colaborattor.new(colaborattor_params)\n\n respond_to do |format|\n if @colaborattor.save\n format.html { redirect_to colaborattors_path, notice: I18n.t('messages.created_with', item: @colaborattor.colaborattorname) }\n format.json { render :show, status: :created, location: @colaborattor }\n else\n format.html { render :new }\n format.json { render json: @colaborattor.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @faleconosco = Faleconosco.new(faleconosco_params)\n\n respond_to do |format|\n if @faleconosco.save\n format.html { redirect_to @faleconosco, notice: 'Faleconosco was successfully created.' }\n format.json { render :show, status: :created, location: @faleconosco }\n else\n format.html { render :new }\n format.json { render json: @faleconosco.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @accesorio = Accesorio.new(params[:accesorio])\n\n respond_to do |format|\n if @accesorio.save\n format.html { redirect_to @accesorio, notice: 'Accesorio was successfully created.' }\n format.json { render json: @accesorio, status: :created, location: @accesorio }\n else\n format.html { render \"new\" }\n format.json { render json: @accesorio.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tecnico = Tecnico.new(params[:tecnico])\n\n respond_to do |format|\n if @tecnico.save\n format.html { redirect_to @tecnico, notice: 'Tecnico criado com sucesso.' }\n format.json { render json: @tecnico, status: :created, location: @tecnico }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tecnico.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dco_resource = DcoResource.new(dco_resource_params)\n\n respond_to do |format|\n if @dco_resource.save\n format.html { redirect_to @dco_resource, notice: 'Dco resource was successfully created.' }\n format.json { render action: 'show', status: :created, location: @dco_resource }\n else\n format.html { render action: 'new' }\n format.json { render json: @dco_resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cooperativa = Cooperativa.new(params[:cooperativa])\n\n respond_to do |format|\n if @cooperativa.save\n format.html { redirect_to [:admin, @cooperativa], :notice => 'Exemplo was successfully created.' }\n format.json { render :json => @cooperativa, :status => :created, :location => @cooperativa }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @cooperativa.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @cuota_curso = CuotaCurso.new(cuota_curso_params)\n\n respond_to do |format|\n if @cuota_curso.save\n format.html { redirect_to @cuota_curso, notice: 'La cuota del curso se creó correctamente.' }\n format.json { render :show, status: :created, location: @cuota_curso }\n else\n format.html { render :new }\n format.json { render json: @cuota_curso.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cotizacione = Cotizacione.new(cotizacione_params)\n\n respond_to do |format|\n if @cotizacione.save\n format.html { redirect_to @cotizacione, notice: 'Cotizacione was successfully created.' }\n format.json { render :show, status: :created, location: @cotizacione }\n else\n format.html { render :new }\n format.json { render json: @cotizacione.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend", "def create\n @comida = Comida.new(comida_params)\n\n respond_to do |format|\n if @comida.save\n format.html { redirect_to @comida, notice: 'Comida was successfully created.' }\n format.json { render :show, status: :created, location: @comida }\n else\n format.html { render :new }\n format.json { render json: @comida.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @information_cone = InformationCone.new(information_cone_params)\n\n respond_to do |format|\n if @information_cone.save\n format.html { redirect_to @information_cone, notice: 'Information cone was successfully created.' }\n format.json { render action: 'show', status: :created, location: @information_cone }\n else\n format.html { render action: 'new' }\n format.json { render json: @information_cone.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cargaplantilla = Cargaplantilla.new(cargaplantilla_params)\n\n respond_to do |format|\n if @cargaplantilla.save\n format.html { redirect_to @cargaplantilla, notice: 'Cargaplantilla was successfully created.' }\n format.json { render :show, status: :created, location: @cargaplantilla }\n else\n format.html { render :new }\n format.json { render json: @cargaplantilla.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @secco = @curso.seccos.build(secco_params)\n\n respond_to do |format|\n if @secco.save\n format.html { redirect_to curso_secco_path(@curso, @secco), notice: 'Seccao was successfully created.' }\n format.json { render :show, status: :created, location: @secco }\n else\n format.html { render :new }\n format.json { render json: @secco.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ocorrencia = Ocorrencia.new(ocorrencia_params)\n\n respond_to do |format|\n if @ocorrencia.save\n format.html { redirect_to @ocorrencia, notice: 'Ocorrencia was successfully created.' }\n format.json { render action: 'show', status: :created, location: @ocorrencia }\n else\n format.html { render action: 'new' }\n format.json { render json: @ocorrencia.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @taco = Taco.new(taco_params)\n\n respond_to do |format|\n if @taco.save\n format.html { redirect_to @taco, notice: 'Taco was successfully created.' }\n format.json { render :show, status: :created, location: @taco }\n else\n format.html { render :new }\n format.json { render json: @taco.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @competicao = Competicao.new(params[:competicao])\n\n respond_to do |format|\n if @competicao.save\n format.html { redirect_to @competicao, notice: 'Competicao was successfully created.' }\n format.json { render json: @competicao, status: :created, location: @competicao }\n else\n format.html { render action: \"new\" }\n format.json { render json: @competicao.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_spoonacular\n # %encode ingredients to url\n encoded_ingr = URI.escape(@translated_recipe[:ingredients_list])\n # post call block :\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/parseIngredients?includeNutrition=true\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(url)\n request[\"content-type\"] = \"application/x-www-form-urlencoded\"\n request[\"x-rapidapi-key\"] = ENV[\"X_RAPIDAPI_KEY\"]\n request[\"x-rapidapi-host\"] = \"spoonacular-recipe-food-nutrition-v1.p.rapidapi.com\"\n # body of the call with ingredients and servings\n request.body = \"ingredientList=#{encoded_ingr}&#{@recipe_hash[:servings]}\"\n # response\n response = http.request(request)\n end", "def create\n @fornecedor_custo = FornecedorCusto.new(params[:fornecedor_custo])\n\n respond_to do |format|\n if @fornecedor_custo.save\n format.html { redirect_to @fornecedor_custo, notice: 'Fornecedor custo was successfully created.' }\n format.json { render json: @fornecedor_custo, status: :created, location: @fornecedor_custo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @fornecedor_custo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @colaborador = Colaborador.new(colaborador_params)\n\n respond_to do |format|\n if @colaborador.save\n format.html { redirect_to @colaborador, notice: 'Colaborador criado com sucesso.' }\n format.json { render :show, status: :created, location: @colaborador }\n else\n format.html { render :new }\n format.json { render json: @colaborador.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @relogio = Relogio.new(params[:relogio])\n\n respond_to do |format|\n if @relogio.save\n format.html { redirect_to @relogio, notice: 'Relogio was successfully created.' }\n format.json { render json: @relogio, status: :created, location: @relogio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @relogio.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @caso = Caso.new(caso_params)\n\n respond_to do |format|\n if @caso.save\n format.html { redirect_to @caso, notice: 'Caso creado con éxito.' }\n format.json { render action: 'show', status: :created, location: @caso }\n else\n format.html { render action: 'new' }\n format.json { render json: @caso.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sacco = Sacco.new(sacco_params)\n\n respond_to do |format|\n if @sacco.save\n format.html { redirect_to @sacco, notice: 'Sacco was successfully created.' }\n format.json { render :show, status: :created, location: @sacco }\n else\n format.html { render :new }\n format.json { render json: @sacco.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @objeto = Cita.new(cita_params)\n\n respond_to do |format|\n if @objeto.save\n format.html { redirect_to @objeto, notice: \"Cita was successfully created.\" }\n format.json { render :show, status: :created, location: @objeto }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @coyote = Coyote.new(coyote_params)\n\n respond_to do |format|\n if @coyote.save\n format.html { redirect_to @coyote, notice: 'Coyote was successfully created.' }\n format.json { render action: 'show', status: :created, location: @coyote }\n else\n format.html { render action: 'new' }\n format.json { render json: @coyote.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @colaborador = Colaborador.new(colaborador_params)\n respond_to do |format|\n if @colaborador.save\n format.html { redirect_to @colaborador, notice: 'Colaborador criado com sucesso.' }\n format.json { render action: 'show', status: :created, location: @colaborador }\n else\n format.html { render action: 'new' }\n format.json { render json: @colaborador.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cb_ipo = CbIpo.new(cb_ipo_params)\n\n respond_to do |format|\n if @cb_ipo.save\n format.html { redirect_to @cb_ipo, notice: 'Cb ipo was successfully created.' }\n format.json { render :show, status: :created, location: @cb_ipo }\n else\n format.html { render :new }\n format.json { render json: @cb_ipo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n \n @cocktail = Cocktail.new(params[:cocktail])\n @cocktail.prise = 20000\n @cocktail.grade = 0\n @cocktail.oficial = false\n respond_to do |format|\n if @cocktail.save\n format.html { redirect_to @cocktail, :notice => 'Cocktail was successfully created.' }\n format.json { render :json => @cocktail, :status => :created, :location => @cocktail }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @cocktail.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @areco = Areco.new(params[:areco])\n\n respond_to do |format|\n if @areco.save\n format.html { redirect_to @areco, notice: 'Areco was successfully created.' }\n format.json { render json: @areco, status: :created, location: @areco }\n else\n format.html { render action: \"new\" }\n format.json { render json: @areco.errors, status: :unprocessable_entity }\n end\n end\n end", "def create \n pai = params[:pai] ? Conta.find_by_id(params[:pai]): nil\n @conta = Conta.new(nome: params[:nome], status: params[:status])\n @conta.pai = pai\n @conta.data_criacao = Time.now\n \n respond_to do |format|\n if @conta.save\n #format.html { redirect_to @conta, notice: 'Conta was successfully created.' }\n #format.json { render :show, status: :created, location: @conta }\n format.json { render json: @conta.to_json, status: :created }\n #@conta.to_json\n else\n #format.html { render :new }\n format.json { render json: @conta.errors, status: :unprocessable_entity } \n end\n end\n end", "def create\n @colaborator = Colaborator.new(colaborator_params)\n\n respond_to do |format|\n if @colaborator.save\n format.html { redirect_to @colaborator, notice: 'Colaborator was successfully created.' }\n format.json { render :show, status: :created, location: @colaborator }\n else\n format.html { render :new }\n format.json { render json: @colaborator.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @giro_comercial = GiroComercial.new(giro_comercial_params)\n\n respond_to do |format|\n if @giro_comercial.save\n format.html { redirect_to @giro_comercial, notice: 'Giro comercial fue exitosamente creado.' }\n format.json { render :show, status: :created, location: @giro_comercial }\n else\n format.html { render :new }\n format.json { render json: @giro_comercial.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @celulare = Celulare.new(celulare_params)\n\n respond_to do |format|\n if @celulare.save\n format.html { redirect_to @celulare, notice: 'Celulare was successfully created.' }\n format.json { render :show, status: :created, location: @celulare }\n else\n format.html { render :new }\n format.json { render json: @celulare.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ingresso = Ingresso.new(ingresso_params)\n\n respond_to do |format|\n if @ingresso.save\n format.html { redirect_to @ingresso, notice: 'Ingresso was successfully created.' }\n format.json { render :show, status: :created, location: @ingresso }\n else\n format.html { render :new }\n format.json { render json: @ingresso.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @c_depo = CDepo.new(c_depo_params)\n\n respond_to do |format|\n if @c_depo.save\n format.html { redirect_to @c_depo, notice: 'C depo was successfully created.' }\n format.json { render :show, status: :created, location: @c_depo }\n else\n format.html { render :new }\n format.json { render json: @c_depo.errors, status: :unprocessable_entity }\n end\n end\n end", "def do_coaps_posted_03\n # get the Base64 of the incoming signed request\n body = IO.read(\"spec/files/vr_00-D0-E5-F2-00-03.vrq\")\n\n env = Hash.new\n env[\"SSL_CLIENT_CERT\"] = cbor_clientcert_03\n env[\"HTTP_ACCEPT\"] = \"application/voucher-cose+cbor\"\n env[\"CONTENT_TYPE\"] = \"application/voucher-cose+cbor\"\n\n $FAKED_TEMPORARY_KEY = temporary_key\n post '/e/rv', :params => body, :headers => env\n end", "def create\n @usuario = Usuario.find(params[:usuario_id])\n @copenometro = Copenometro.new(copenometro_params)\n @copenometro.usuario = @usuario\n\n respond_to do |format|\n if @copenometro.save\n format.html { redirect_to @usuario, notice: 'Agregado con Exito' }\n format.json { render :show, status: :created, location: @copenometro }\n else\n format.html { render :new }\n format.json { render json: @copenometro.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @contacter = Contacter.new(params[:contacter])\n\n respond_to do |format|\n if @contacter.save\n format.html { redirect_to @contacter, notice: 'Contacter was successfully created.' }\n format.json { render json: @contacter, status: :created, location: @contacter }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contacter.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6581173", "0.63245475", "0.6281297", "0.62565166", "0.6216938", "0.61410326", "0.60923576", "0.6073309", "0.599955", "0.5910125", "0.58948326", "0.588624", "0.5880918", "0.58761275", "0.58743167", "0.5857936", "0.58545876", "0.58545876", "0.58545876", "0.5844243", "0.5840512", "0.5836028", "0.5830266", "0.58021975", "0.5801783", "0.58014315", "0.57996", "0.57940257", "0.57938623", "0.57856655", "0.57547593", "0.57451606", "0.5744936", "0.5742694", "0.5740424", "0.5740163", "0.5734394", "0.57304436", "0.5727064", "0.57188225", "0.5714433", "0.5707209", "0.570443", "0.5686585", "0.56840813", "0.56814504", "0.56799054", "0.5678939", "0.567296", "0.56718796", "0.5670519", "0.5670017", "0.5667695", "0.56570685", "0.5651622", "0.5650391", "0.5643542", "0.5638359", "0.5634989", "0.56301713", "0.56269395", "0.56257707", "0.5624653", "0.5623341", "0.5620948", "0.56173813", "0.56171745", "0.56156284", "0.56139696", "0.5608234", "0.5605546", "0.5599749", "0.5598551", "0.5594813", "0.55927455", "0.55897176", "0.5589697", "0.5588213", "0.5586559", "0.55771303", "0.557593", "0.55701524", "0.5569056", "0.5563843", "0.5560418", "0.555581", "0.55549294", "0.55503803", "0.55462664", "0.5545567", "0.55452347", "0.55430305", "0.5541931", "0.5540662", "0.5539217", "0.5538528", "0.5532855", "0.5532504", "0.5529545", "0.5528287" ]
0.66267854
0
PUT /colegios/1 PUT /colegios/1.json
def update @colegio = Colegio.find(params[:id]) respond_to do |format| if @colegio.update_attributes(params[:colegio]) format.html { redirect_to @colegio, notice: 'El Colegio fue actualizado satisfactoriamente.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @colegio.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @cooco.update(cooco_params)\n format.html { redirect_to @cooco, notice: 'Cooco was successfully updated.' }\n format.json { render :show, status: :ok, location: @cooco }\n else\n format.html { render :edit }\n format.json { render json: @cooco.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 respond_to do |format|\n if @copenometro.update(copenometro_params)\n format.html { redirect_to @copenometro, notice: 'Copenometro was successfully updated.' }\n format.json { render :show, status: :ok, location: @copenometro }\n else\n format.html { render :edit }\n format.json { render json: @copenometro.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # { clinic: {id: references, \"license_id\"=>nil, \"name\"=>string } }\n \n if @clinic.update_attributes(params[:clinic].except(:api_license_id))\n head :no_content\n else\n render json: clinic.errors.full_messages, status: :unprocessable_entity\n end\n end", "def put(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_put(@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(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def update\n respond_to do |format|\n if @cocoon_example.update(cocoon_example_params)\n format.html { redirect_to @cocoon_example, notice: 'Cocoon example was successfully updated.' }\n format.json { render :show, status: :ok, location: @cocoon_example }\n else\n format.html { render :edit }\n format.json { render json: @cocoon_example.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @cofi = Cofi.find(params[:id])\n\n respond_to do |format|\n if @cofi.update_attributes(params[:cofi])\n format.html { redirect_to cofis_url, notice: 'Cofi was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cofi.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @coisa = Coisa.find(params[:id])\n\n respond_to do |format|\n if @coisa.update_attributes(params[:coisa])\n format.html { redirect_to @coisa, :notice => 'Coisa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @coisa.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @socio = Socio.find(params[:id])\n\n respond_to do |format|\n if @socio.update_attributes(params[:socio])\n format.html { redirect_to @socio, notice: 'Socio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @socio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @socio = Socio.find(params[:id])\n\n respond_to do |format|\n if @socio.update_attributes(params[:socio])\n format.html { redirect_to @socio, :notice => 'Socio atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @socio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @ginasio = Ginasio.find(params[:id])\n\n respond_to do |format|\n if @ginasio.update_attributes(params[:ginasio])\n format.html { redirect_to @ginasio, :flash => { :success => 'Dados do ginasio alterados com successo!' } }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @ginasio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put!\n request! :put\n end", "def update\n @cso = Cso.find(params[:id])\n\n respond_to do |format|\n if @cso.update_attributes(params[:cso])\n format.html { redirect_to @cso, notice: 'Cso was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cso.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cio.update(cio_params)\n format.html { redirect_to @cio, notice: 'Cio editado com sucesso.' }\n format.json { render :show, status: :ok, location: @cio }\n else\n format.html { render :edit }\n format.json { render json: @cio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cog.update(cog_params)\n format.html { redirect_to @cog, notice: 'Cog was successfully updated.' }\n format.json { render :show, status: :ok, location: @cog }\n else\n format.html { render :edit }\n format.json { render json: @cog.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @consorciot.update(consorciot_params)\n format.html { redirect_to @consorciot, notice: 'Consorciot was successfully updated.' }\n format.json { render :show, status: :ok, location: @consorciot }\n else\n format.html { render :edit }\n format.json { render json: @consorciot.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @coche.update(coche_params)\n format.html { redirect_to @coche, notice: 'Coche was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @coche.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_initiative.update(api_v1_initiative_params)\n format.html { redirect_to @api_v1_initiative, notice: 'Initiative was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(path, body = nil, ctype = 'application/json')\n make_call(mk_conn(path, 'Content-Type': ctype,\n 'Accept': 'application/json'),\n :put, nil, body.to_json)\n end", "def update\n @colegiatura = Colegiatura.find(params[:id])\n\n respond_to do |format|\n if @colegiatura.update_attributes(params[:colegiatura])\n format.html { redirect_to @colegiatura, notice: 'Colegiatura was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @colegiatura.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @congresso.update(congresso_params)\n format.html { redirect_to @congresso, notice: 'Congresso was successfully updated.' }\n format.json { render :show, status: :ok, location: @congresso }\n else\n format.html { render :edit }\n format.json { render json: @congresso.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @coconut1.update(coconut1_params)\n format.html { redirect_to @coconut1, notice: 'Coconut1 was successfully updated.' }\n format.json { render :show, status: :ok, location: @coconut1 }\n else\n format.html { render :edit }\n format.json { render json: @coconut1.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @caso.update_attributes(caso_params)\n format.html { redirect_to @caso, notice: 'Caso was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @caso.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "def putFactura(oc)\n\n facturax= JSON.parse(HTTP.headers(:\"Content-Type\" => \"application/json\").put(\"http://\"+ $url +\"/facturas/\", :json => {:oc => oc}).to_s, :symbolize_names => true)\n return facturax\n end", "def update\n respond_to do |format|\n if @couch.update(couch_params)\n format.html { redirect_to @couch, notice: 'Couche was successfully updated.' }\n format.json { render :show, status: :ok, location: @couch }\n else\n format.html { render :edit }\n format.json { render json: @couch.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(path, data = {})\n request 'PUT', path, body: data.to_json\n end", "def update\n respond_to do |format|\n if @cosmetic.update(cosmetic_params)\n format.html { redirect_to @cosmetic, notice: 'Cosmetic was successfully updated.' }\n format.json { render :show, status: :ok, location: @cosmetic }\n else\n format.html { render :edit }\n format.json { render json: @cosmetic.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @apoio.update(apoio_params)\n format.html { redirect_to @apoio, notice: 'Apoio was successfully updated.' }\n format.json { render :show, status: :ok, location: @apoio }\n else\n format.html { render :edit }\n format.json { render json: @apoio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n client=Client.find_by_id params[:id]\n if client!= nil\n client.cedula=params[:cedula] ? params[:cedula]: client.cedula\n client.sector=params[:sector] ? params[:sector]: client.sector\n client.nombre=params[:nombre] ? params[:nombre]: client.nombre\n client.telefono=params[:telefono] ? params[:telefono]: client.telefono\n client.pagina=params[:pagina] ? params[:pagina]: client.pagina\n client.direccion=params[:direccion] ? params[:direccion]: client.direccion\n if client.save\n render(json: client, status: 201)\n end \n else\n render(json: client.errors, status: 404)\n end \n end", "def update\n @curso = Curso.find(params[:id])\n\n respond_to do |format|\n if @curso.update_attributes(params[:curso])\n format.html { redirect_to(:back) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @curso.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ocat = Ocat.find(params[:id])\n\n respond_to do |format|\n if @ocat.update_attributes(params[:ocat])\n format.html { redirect_to @ocat, notice: 'Ocat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ocat.errors, status: :unprocessable_entity }\n end\n end\n end", "def http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\n end", "def update\n respond_to do |format|\n if @socio.update(socio_params)\n format.html { redirect_to @socio, notice: 'Socio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @socio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @caso.update(caso_params)\n format.html { redirect_to @caso, notice: 'Caso was successfully updated.' }\n format.json { render :show, status: :ok, location: @caso }\n else\n format.html { render :edit }\n format.json { render json: @caso.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cto.update(cto_params)\n format.html { redirect_to @cto, notice: 'Cto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @comic = Comic.find(params[:id])\n\n respond_to do |format|\n if @comic.update_attributes(params[:comic])\n format.html { redirect_to @comic, notice: 'Comic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comic.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @curso.update(curso_params)\n format.html { redirect_to @curso, notice: 'Curso was successfully updated.' }\n format.json { render :show, status: :ok, location: @curso }\n else\n format.html { render :edit }\n format.json { render json: @curso.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @servicio = Servicio.find(params[:id])\n\n respond_to do |format|\n if @servicio.update_attributes(params[:servicio])\n format.html { redirect_to @servicio, :notice => 'Servicio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @servicio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end", "def update\n respond_to do |format|\n if @coyote.update(coyote_params)\n format.html { redirect_to @coyote, notice: 'Coyote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @coyote.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @capitol.update(capitol_params)\n format.html { redirect_to root_path, notice: 'Capitol was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @capitol.errors, status: :unprocessable_entity }\n end\n end\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def update_brokerage_client_using_put_with_http_info(client_co, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BrokerageApi.update_brokerage_client_using_put ...'\n end\n # verify the required parameter 'client_co' is set\n if @api_client.config.client_side_validation && client_co.nil?\n fail ArgumentError, \"Missing the required parameter 'client_co' when calling BrokerageApi.update_brokerage_client_using_put\"\n end\n # resource path\n local_var_path = '/brokerage/client'\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(['*/*'])\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(client_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 => 'BrokerageUpdateClientVO')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BrokerageApi#update_brokerage_client_using_put\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def put(id, json)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name, id].compact.join('/')\n url += \"/\" \n return HTTParty.put(url, :body => json, :timeout => 4, :headers => { 'Content-Type' => 'application/json' })\n end\n end", "def update\n @consumo = Consumo.find(params[:id])\n\n respond_to do |format|\n if @consumo.update_attributes(params[:consumo])\n format.html { redirect_to @consumo.cliente, :notice => 'Consumo alterado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @consumo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @complaint = Complaint.find(params[:id])\n\n if @complaint.update_attributes(params[:complaint])\n head :no_content\n else\n render json: @complaint.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @curso.update(curso_params)\n format.html { redirect_to cursos_path, notice: 'Curso atualizado com sucesso!' }\n format.json { render :show, status: :ok, location: @curso }\n else\n format.html { render :edit }\n format.json { render json: @curso.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ccosto.update(ccosto_params)\n format.html { redirect_to @ccosto, notice: 'Ccosto was successfully updated.' }\n format.json { render :show, status: :ok, location: @ccosto }\n else\n format.html { render :edit }\n format.json { render json: @ccosto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @occasion.update(occasion_params)\n format.html { redirect_to [:admin, @occasion], notice: 'Occasion was successfully updated.' }\n format.json { render :show, status: :ok, location: @occasion }\n else\n format.html { render :edit }\n format.json { render json: @occasion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @socio.update(socio_params)\n format.html { redirect_to @socio, notice: 'Socio modificado com sucesso.' }\n format.json { render :show, status: :ok, location: @socio }\n else\n format.html { render :edit }\n format.json { render json: @socio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @inventario_cosa.update(inventario_cosa_params)\n format.html { redirect_to @inventario_cosa, notice: 'Inventario cosa was successfully updated.' }\n format.json { render :show, status: :ok, location: @inventario_cosa }\n else\n format.html { render :edit }\n format.json { render json: @inventario_cosa.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cof.update(cof_params)\n format.html { redirect_to :back }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cof.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @curso.update(curso_params)\n format.html { redirect_to @curso, notice: 'Curso foi atualizado(a) com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @curso.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(*args)\n request :put, *args\n end", "def api_put(path, data = {})\n api_request(:put, path, :data => data)\n end", "def update\n respond_to do |format|\n if @coffer.update(coffer_params)\n format.html { redirect_to @coffer, notice: 'Coffer was successfully updated.' }\n format.json { render :show, status: :ok, location: @coffer }\n else\n format.html { render :edit }\n format.json { render json: @coffer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @coin_ico.update(coin_ico_params)\n format.html { redirect_to coin_icos_path, notice: 'Coin ico was successfully updated.' }\n format.json { render :show, status: :ok, location: @coin_ico }\n else\n format.html { render :edit }\n format.json { render json: @coin_ico.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @concurso = Concurso.find(params[:id])\n\n respond_to do |format|\n if @concurso.update_attributes(params[:concurso])\n format.html { redirect_to @concurso, notice: 'Concurso atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @concurso.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @curso.update(curso_params)\n format.json { render json: \"Curso Actualizado\", status: :ok, location: @curso }\n else\n format.json { render json: @curso.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @secco.update(secco_params)\n format.html { redirect_to curso_secco_path(@curso, @secco), notice: 'Seccao was successfully updated.' }\n format.json { render :show, status: :ok, location: @secco }\n else\n format.html { render :edit }\n format.json { render json: @secco.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @golf_cource = GolfCource.find(params[:id])\n\n respond_to do |format|\n if @golf_cource.update_attributes(params[:golf_cource])\n format.html { redirect_to scaffold_golf_cource_url(@golf_cource), notice: 'Golf cource was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @golf_cource.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n pai = params[:pai] ? Conta.find_by_id(params[:pai]): nil\n \n respond_to do |format|\n if @conta.update(nome: conta_params[:nome], status: conta_params[:status], pai: pai) \n #format.json { render :show, status: :ok, location: @conta }\n format.json { render json: @conta.to_json, status: :ok }\n else \n format.json { render json: @conta.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @veiculo = Veiculo.find(params[:id])\n\n respond_to do |format|\n if @veiculo.update_attributes(params[:veiculo])\n format.html { redirect_to @veiculo, :notice => 'Veiculo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @veiculo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @trein_consul_comercial.update(trein_consul_comercial_params)\n format.html { redirect_to @trein_consul_comercial, notice: 'Trein consul comercial was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @trein_consul_comercial.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cegreso.update(cegreso_params)\n format.html { redirect_to @cegreso, notice: 'Cegreso was successfully updated.' }\n format.json { render :show, status: :ok, location: @cegreso }\n else\n format.html { render :edit }\n format.json { render json: @cegreso.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @fale_conosco.update(fale_conosco_params)\n format.html { redirect_to @fale_conosco, notice: 'Fale conosco was successfully updated.' }\n format.json { render :show, status: :ok, location: @fale_conosco }\n else\n format.html { render :edit }\n format.json { render json: @fale_conosco.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @osoba = Osoba.find(params[:id])\n\n if @osoba.update(params[:osoba])\n head :no_content\n else\n render json: @osoba.errors, status: :unprocessable_entity\n end\n end", "def update\n @squishee_cup = SquisheeCup.find(params[:id])\n puts params.to_json\n respond_to do |format|\n if @squishee_cup.update_attributes(params[:squishee_cup])\n format.html { redirect_to @squishee_cup, notice: 'Squishee cup was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @squishee_cup.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @co_independent_trait.update(co_independent_trait_params)\n format.html { redirect_to @co_independent_trait, notice: 'Co independent trait was successfully updated.' }\n format.json { render :show, status: :ok, location: @co_independent_trait }\n else\n format.html { render :edit }\n format.json { render json: @co_independent_trait.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comic.update(comic_params)\n format.html { redirect_to comic_path(@comic), notice: 'Comic was successfully updated.' }\n format.json { render json: @comic }\n else\n format.html { render :edit }\n format.json { render json: @comic.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @central_correio = CentralCorreio.find(params[:id])\n\n respond_to do |format|\n if @central_correio.update_attributes(params[:central_correio])\n format.html { redirect_to @central_correio, notice: 'Central correio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @central_correio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sivic_discipulo.update(sivic_discipulo_params_netested)\n format.html { redirect_to @sivic_discipulo, notice: 'Registro alterado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sivic_discipulo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sacco.update(sacco_params)\n format.html { redirect_to @sacco, notice: 'Sacco was successfully updated.' }\n format.json { render :show, status: :ok, location: @sacco }\n else\n format.html { render :edit }\n format.json { render json: @sacco.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @accesorio = Accesorio.find(params[:id])\n\n respond_to do |format|\n if @accesorio.update_attributes(params[:accesorio])\n format.html { redirect_to @accesorio, notice: 'Accesorio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render \"edit\" }\n format.json { render json: @accesorio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @clue = Clue.find(params[:id])\n\n respond_to do |format|\n if @clue.update_attributes(params[:clue])\n format.html { redirect_to @clue, notice: 'Clue was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @clue = Clue.find(params[:id])\n\n respond_to do |format|\n if @clue.update_attributes(params[:clue])\n format.html { redirect_to @clue, notice: 'Clue was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @prod_coti.update(prod_coti_params)\n format.html { redirect_to @prod_coti, notice: 'Prod coti was successfully updated.' }\n format.json { render :show, status: :ok, location: @prod_coti }\n else\n format.html { render :edit }\n format.json { render json: @prod_coti.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_initiative_update.update(api_v1_initiative_update_params)\n format.html { redirect_to @api_v1_initiative_update, notice: 'Initiative update was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative_update }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative_update.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @clientes_servico.update(clientes_servico_params)\n format.html { redirect_to @clientes_servico, notice: 'Clientes servico was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @clientes_servico.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reqcargo.update(reqcargo_params)\n format.html { redirect_to @reqcargo, notice: 'Reqcargo was successfully updated.' }\n format.json { render :show, status: :ok, location: @reqcargo }\n else\n format.html { render :edit }\n format.json { render json: @reqcargo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @chronicle = Chronicle.find(params[:id])\n\n respond_to do |format|\n if @chronicle.update_attributes(params[:chronicle])\n format.html { redirect_to @chronicle, notice: 'Chronicle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @chronicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @couch.update(couch_params)\n format.html { redirect_to @couch, notice: 'Couch was successfully updated.' }\n format.json { render :show, status: :ok, location: @couch }\n else\n format.html { render :edit }\n format.json { render json: @couch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @negocio.update(negocio_params)\n format.html { redirect_to @negocio, notice: 'Negocio was successfully updated.' }\n format.json { render :show, status: :ok, location:@negocio}\n else\n format.html { render :edit }\n format.json { render json: @negocio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @mycometer_coc.update(mycometer_coc_params)\n format.html { redirect_to @mycometer_coc, notice: 'Mycometer coc was successfully updated.' }\n format.json { render :show, status: :ok, location: @mycometer_coc }\n else\n format.html { render :edit }\n format.json { render json: @mycometer_coc.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n respond_to do |format|\r\n if @sivic_contcelula.update(sivic_contcelula_params)\r\n format.html { redirect_to @sivic_contcelula, notice: 'Sivic contcelula 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: @sivic_contcelula.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n respond_to do |format|\n if @ciclo.update(ciclo_params)\n format.html { redirect_to @ciclo, notice: 'Ciclo was successfully updated.' }\n format.json { render :show, status: :ok, location: @ciclo }\n else\n format.html { render :edit }\n format.json { render json: @ciclo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ciclo.update(ciclo_params)\n format.html { redirect_to @ciclo, notice: 'Ciclo was successfully updated.' }\n format.json { render :show, status: :ok, location: @ciclo }\n else\n format.html { render :edit }\n format.json { render json: @ciclo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ciclo.update(ciclo_params)\n format.html { redirect_to @ciclo, notice: 'Ciclo was successfully updated.' }\n format.json { render :show, status: :ok, location: @ciclo }\n else\n format.html { render :edit }\n format.json { render json: @ciclo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @socio_cpf.update(socio_cpf_params)\n format.html { redirect_to @socio_cpf, notice: 'Socio cpf was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @socio_cpf.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @caixa = Caixa.find(params[:id])\n\n respond_to do |format|\n if @caixa.update_attributes(params[:caixa])\n format.html { redirect_to @caixa, notice: 'Caixa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @caixa.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tobacco.update(tobacco_params)\n format.html { redirect_to @tobacco, notice: 'Tobacco was successfully updated.' }\n format.json { render :show, status: :ok, location: @tobacco }\n else\n format.html { render :edit }\n format.json { render json: @tobacco.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @instituicao_curso.update(instituicao_curso_params)\n format.html { redirect_to @instituicao_curso, notice: 'Instituicao curso was successfully updated.' }\n format.json { render :show, status: :ok, location: @instituicao_curso }\n else\n format.html { render :edit }\n format.json { render json: @instituicao_curso.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_cooco\n @cooco = Cooco.find(params[:id])\n end", "def update\n respond_to do |format|\n require 'rest-client'\n response = RestClient.put('localhost:3001/colores/'+@color.id.to_s, color_params.as_json, {:Authorization => 'admin irizREhyoG6Ejwr4AcjsQME9'})\n if response.code == 200\n @color = JSON.parse(response.body)\n\n format.html { redirect_to @color, notice: \"Color was successfully updated.\" }\n format.json { render :show, status: :ok, location: @color }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @color.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @scool.update(scool_params)\n format.html { redirect_to @scool, notice: 'Scool was successfully updated.' }\n format.json { render :show, status: :ok, location: @scool }\n else\n format.html { render :edit }\n format.json { render json: @scool.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @csosn = Csosn.find(params[:id])\n\n respond_to do |format|\n if @csosn.update_attributes(params[:csosn])\n format.html { redirect_to @csosn, notice: 'Csosn was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @csosn.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @oferta_academica = OfertaAcademica.find(params[:id])\n\n if @oferta_academica.update(params[:oferta_academica])\n head :no_content\n else\n render json: @oferta_academica.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @apologetic.update(apologetic_params)\n format.html { redirect_to @apologetic, notice: 'Apologetic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @apologetic.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6384609", "0.6281765", "0.6131642", "0.610177", "0.6059203", "0.60435486", "0.602539", "0.5983885", "0.59786403", "0.59494424", "0.5922892", "0.59222364", "0.59169614", "0.5911498", "0.58818537", "0.587853", "0.5868615", "0.58615935", "0.58428544", "0.58326584", "0.5822571", "0.58111954", "0.5809003", "0.5800068", "0.5796538", "0.579126", "0.57892823", "0.5786458", "0.5780629", "0.57768416", "0.57759243", "0.5770954", "0.57673156", "0.57661873", "0.5762827", "0.5761347", "0.5755512", "0.57477075", "0.57400906", "0.57332677", "0.57293576", "0.57151604", "0.5700233", "0.56997305", "0.5687009", "0.5684201", "0.56838477", "0.5682086", "0.5675038", "0.56750184", "0.56745094", "0.56735283", "0.56731576", "0.56706744", "0.5664687", "0.566268", "0.566032", "0.56599665", "0.56569844", "0.5644716", "0.5639907", "0.5639812", "0.5623728", "0.56181943", "0.5616428", "0.5615426", "0.5608257", "0.5607772", "0.5607747", "0.5607217", "0.5595154", "0.5591105", "0.55904543", "0.55895454", "0.55877537", "0.55870414", "0.55809337", "0.55809337", "0.5579563", "0.5573948", "0.5572957", "0.557277", "0.5570984", "0.5564563", "0.55644804", "0.5563497", "0.55590224", "0.5554308", "0.5554308", "0.5554308", "0.5553974", "0.55512494", "0.5548082", "0.55414444", "0.55377215", "0.55347914", "0.5534067", "0.5531912", "0.5530689", "0.55195385" ]
0.6423569
0
DELETE /colegios/1 DELETE /colegios/1.json
def destroy @colegio = Colegio.find(params[:id]) @colegio.destroy respond_to do |format| format.html { redirect_to colegios_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n client.delete(\"/#{id}\")\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @relogio = Relogio.find(params[:id])\n @relogio.destroy\n\n respond_to do |format|\n format.html { redirect_to relogios_url }\n format.json { head :ok }\n end\n end", "def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end", "def destroy\n @cio.destroy\n respond_to do |format|\n format.html { redirect_to cios_url, notice: 'Cio excluido.' }\n format.json { head :no_content }\n end\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n @trein_consul_comercial.destroy\n respond_to do |format|\n format.html { redirect_to trein_consul_comercials_url }\n format.json { head :no_content }\n end\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end", "def destroy\n @couch.destroy\n respond_to do |format|\n format.html { redirect_to couches_url, notice: 'Couche was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @coche.destroy\n respond_to do |format|\n format.html { redirect_to coches_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @uchronia = Uchronia.find(params[:id])\n @uchronia.destroy\n\n respond_to do |format|\n format.html { redirect_to uchronias_url }\n format.json { head :no_content }\n end\n end", "def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end", "def destroy\n @curso.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def do_delete(uri = \"\")\n @connection.delete do |req|\n req.url uri\n req.headers['Content-Type'] = 'application/json'\n end\n end", "def destroy\n #@clinica.destroy\n @clinica.update(:status => 0)\n respond_to do |format|\n format.html { redirect_to clinicas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cooco.destroy\n respond_to do |format|\n format.html { redirect_to coocos_url, notice: 'Cooco was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @coisa = Coisa.find(params[:id])\n @coisa.destroy\n\n respond_to do |format|\n format.html { redirect_to coisas_url }\n format.json { head :no_content }\n end\n end", "def delete\n request(:delete)\n end", "def destroy\n @ginasio = Ginasio.find(params[:id])\n @ginasio.destroy\n\n respond_to do |format|\n format.html { redirect_to ginasios_url, :flash => { :notice => 'Ginasio apagado.' } }\n format.json { head :ok }\n end\n end", "def destroy\n @couch.destroy\n respond_to do |format|\n format.html { redirect_to couches_url, notice: 'Couch was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @cofi = Cofi.find(params[:id])\n @cofi.destroy\n\n respond_to do |format|\n format.html { redirect_to cofis_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @central_correio = CentralCorreio.find(params[:id])\n @central_correio.destroy\n\n respond_to do |format|\n format.html { redirect_to central_correios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @chaine = Chaine.find(params[:id])\n @chaine.destroy\n\n respond_to do |format|\n format.html { redirect_to chaines_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cict.destroy\n respond_to do |format|\n format.html { redirect_to cicts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @consumo = Consumo.find(params[:id])\n @consumo.destroy\n\n respond_to do |format|\n format.html { redirect_to consumos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @odontologia1 = Odontologia1.find(params[:id])\n @odontologia1.destroy\n\n respond_to do |format|\n format.html { redirect_to odontologia1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @consorciot.destroy\n respond_to do |format|\n format.html { redirect_to consorciots_url, notice: 'Consorciot was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def destroy\n @congresso.destroy\n respond_to do |format|\n format.html { redirect_to congressos_url, notice: 'Congresso was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @aucrecord.destroy\n respond_to do |format|\n format.html { redirect_to aucrecords_url }\n format.json { head :no_content }\n end\n end", "def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end", "def destroy\n @ocorrencia.destroy\n respond_to do |format|\n format.html { redirect_to ocorrencias_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cof.destroy\n respond_to do |format|\n format.html { redirect_to cofs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @aactio = Aactio.find(params[:id])\n @aactio.destroy\n\n respond_to do |format|\n format.html { redirect_to aactios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cephalopod.destroy\n respond_to do |format|\n format.html { redirect_to cephalopods_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @contacter = Contacter.find(params[:id])\n @contacter.destroy\n\n respond_to do |format|\n format.html { redirect_to contacters_url }\n format.json { head :no_content }\n end\n end", "def delete\n start { |connection| connection.request http :Delete }\n end", "def destroy\n @cargo_eleicao = CargoEleicao.find(params[:id])\n @cargo_eleicao.destroy\n\n respond_to do |format|\n format.html { redirect_to cargo_eleicaos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @areco = Areco.find(params[:id])\n @areco.destroy\n\n respond_to do |format|\n format.html { redirect_to arecos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @concurso = Concurso.find(params[:id])\n @concurso.destroy\n\n respond_to do |format|\n format.html { redirect_to concursos_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @sivic_celula.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_celulas_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @agronomiaquimica = Agronomiaquimica.find(params[:id])\n @agronomiaquimica.destroy\n\n respond_to do |format|\n format.html { redirect_to agronomiaquimicas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n client=Client.find_by_id(params[:id])\n if client != nil\n if client.destroy\n head 204\n end\n else\n head 404\n end\n end", "def destroy\n @comic = Comic.find(params[:id])\n @comic.destroy\n\n respond_to do |format|\n format.html { redirect_to comics_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @datoscontacto = Datoscontacto.find(params[:id])\n @datoscontacto.destroy\n\n respond_to do |format|\n format.html { redirect_to datoscontactos_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @sivic_contabanco.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_contabancos_url }\r\n format.json { head :no_content }\r\n end\r\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 @apologetic.destroy\n respond_to do |format|\n format.html { redirect_to apologetics_url }\n format.json { head :no_content }\n end\n end", "def delete(url, headers = {})\n http :delete, \"#{url}.json\", headers\n end", "def destroy\n @cage.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @comic.destroy\n respond_to do |format|\n format.html { redirect_to '/', notice: \"Comic \\\"#{@comic.name}\\\" was successfully deleted.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @cocoon_example.destroy\n respond_to do |format|\n format.html { redirect_to cocoon_examples_url, notice: 'Cocoon example was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @cso = Cso.find(params[:id])\n @cso.destroy\n\n respond_to do |format|\n format.html { redirect_to csos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @copenometro.destroy\n respond_to do |format|\n format.html { redirect_to new_copenometro_path, notice: 'Copenometro was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def destroy\n @humanidades1 = Humanidades1.find(params[:id])\n @humanidades1.destroy\n\n respond_to do |format|\n format.html { redirect_to humanidades1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cegonha = Cegonha.find(params[:id])\n @cegonha.destroy\n\n respond_to do |format|\n format.html { redirect_to cegonhas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dco_resource.destroy\n respond_to do |format|\n format.html { redirect_to dco_resources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @servicio = Servicio.find(params[:id])\n @servicio.destroy\n\n respond_to do |format|\n format.html { redirect_to servicios_url }\n format.json { head :no_content }\n end\n end", "def delete(path)\n request(:delete, path)\n end", "def delete!\n request! :delete\n end", "def destroy\n @ccosto.destroy\n respond_to do |format|\n format.html { redirect_to ccostos_url, notice: 'Ccosto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Company.delete(params[\"id\"])\n end", "def destroy\r\n @sivic_contcelula.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_contcelulas_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n api(\"Delete\")\n end", "def destroy\n @prueba_json.destroy\n respond_to do |format|\n format.html { redirect_to prueba_jsons_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ocat = Ocat.find(params[:id])\n @ocat.destroy\n\n respond_to do |format|\n format.html { redirect_to ocats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @accesorio = Accesorio.find(params[:id])\n @accesorio.destroy\n\n respond_to do |format|\n format.html { redirect_to accesorios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cafeterium.destroy\n respond_to do |format|\n format.html { redirect_to cafeteria_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @apoio.destroy\n respond_to do |format|\n format.html { redirect_to apoios_url, notice: 'Apoio was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @small_concert.destroy\n respond_to do |format|\n format.html { redirect_to '/admin/small_concerts' }\n format.json { head :no_content }\n end\n end", "def destroy\n @convo = Convo.find(params[:id])\n @convo.destroy\n\n respond_to do |format|\n format.html { redirect_to convos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sabio = Sabio.find(params[:id])\n @sabio.destroy\n\n respond_to do |format|\n format.html { redirect_to sabios_url }\n format.json { head :ok }\n end\n end", "def destroy\n \n respond_to do |format|\n RestClient.delete 'localhost:3001/colores/'+@color.id.to_s, {:Authorization => 'admin irizREhyoG6Ejwr4AcjsQME9'}\n format.html { redirect_to colors_url, notice: \"Color was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @reqcargo.destroy\n respond_to do |format|\n format.html { redirect_to reqcargos_url, notice: 'Reqcargo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(path)\n request 'DELETE', path\n end", "def destroy\n @ciclo.destroy\n respond_to do |format|\n format.html { redirect_to ciclos_url, notice: 'Ciclo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ciclo.destroy\n respond_to do |format|\n format.html { redirect_to ciclos_url, notice: 'Ciclo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ciclo.destroy\n respond_to do |format|\n format.html { redirect_to ciclos_url, notice: 'Ciclo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @clientes_servico.destroy\n respond_to do |format|\n format.html { redirect_to clientes_servicos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @contum = Contum.find(params[:id])\n @contum.destroy\n\n respond_to do |format|\n format.html { redirect_to conta_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @commtent1 = Commtent1.find(params[:id])\n @commtent1.destroy\n\n respond_to do |format|\n format.html { redirect_to commtent1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @fale_conosco.destroy\n respond_to do |format|\n format.html { redirect_to fale_conoscos_url, notice: 'Fale conosco was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def destroy\n @information_cone.destroy\n respond_to do |format|\n format.html { redirect_to information_cones_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cliente = Cliente.find(params[:id])\n @cliente.destroy\n\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cliente = Cliente.find(params[:id])\n @cliente.destroy\n\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cliente = Cliente.find(params[:id])\n @cliente.destroy\n\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reconocimiento = Reconocimiento.find(params[:id])\n @reconocimiento.destroy\n\n respond_to do |format|\n format.html { redirect_to reconocimientos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @fulcliente = Fulcliente.find(params[:id])\n @fulcliente.destroy\n\n respond_to do |format|\n format.html { redirect_to fulclientes_url }\n format.json { head :ok }\n end\n end", "def destroy\n @escola = Escola.find(params[:id])\n @escola.destroy\n\n respond_to do |format|\n format.html { redirect_to escolas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cfo.destroy\n respond_to do |format|\n format.html { redirect_to cfos_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.71117705", "0.69486105", "0.69289356", "0.6891989", "0.68611777", "0.6832602", "0.6814225", "0.6810221", "0.6798149", "0.6798149", "0.6798149", "0.6798149", "0.67897356", "0.6765597", "0.67337847", "0.6727496", "0.67198116", "0.6714012", "0.6702707", "0.67006767", "0.6695478", "0.66897196", "0.6683467", "0.6645273", "0.6636712", "0.663264", "0.6631788", "0.6630188", "0.6621929", "0.6621416", "0.6611932", "0.66079414", "0.660195", "0.65983605", "0.6593799", "0.659101", "0.6587846", "0.657963", "0.6577739", "0.6574608", "0.6572235", "0.6570428", "0.65656585", "0.6560052", "0.65578836", "0.6554954", "0.6554409", "0.65527123", "0.6545216", "0.65438235", "0.6543261", "0.6541548", "0.65413207", "0.6538835", "0.6538052", "0.65371317", "0.65359825", "0.6535327", "0.6532151", "0.652847", "0.65248346", "0.65229815", "0.6520691", "0.65205467", "0.6519972", "0.65198344", "0.65196097", "0.65181404", "0.65180993", "0.6517328", "0.65116227", "0.65116227", "0.6509333", "0.65020126", "0.6500976", "0.6498779", "0.6497141", "0.64956146", "0.64915246", "0.648947", "0.64893645", "0.64885074", "0.64873105", "0.64865583", "0.64843684", "0.64843684", "0.64843684", "0.64816296", "0.64807117", "0.64801806", "0.64777803", "0.6477338", "0.64770865", "0.6476884", "0.6476884", "0.6476884", "0.647442", "0.64740974", "0.64720345", "0.6471873" ]
0.7389021
0
click on a template and open for information about specific template
def show @template = Template.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_template template\n\t\tpage_div = $browser.div(:xpath => \"//div[@class='template-categories_category-name'][contains(text(), '\"+template+\"')]\")\n\t\tpage_div.click\n\tend", "def show\n @template = Template.find(params[:template_id])\n end", "def show_template\n self.template\n end", "def show_template\n self.template\n end", "def details(type, template_uuid)\n response = @client.get(\"editor/#{type}/templates/#{template_uuid}\")\n verify response,\n forbidden: 'You do not have permission to open the template',\n not_found: 'Template does not exist',\n internal_server_error: 'Internal server error occurred.'\n end", "def template_details(template_id)\n @api.get(\"#{@api.path}/List/#{@id}/Templates/#{template_id}\")\n end", "def show\n @_template = @site.templates.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @_template }\n end\n end", "def show\n\t\t#will have template\n\tend", "def show\n template = Template.find(params[:id])\n authorize template\n # Load the info needed for the overview section if the authorization check passes!\n phases = template.phases\n .includes(sections: { questions: :question_options })\n .order('phases.number', 'sections.number', 'questions.number',\n 'question_options.number')\n .select('phases.title', 'phases.description', 'phases.modifiable',\n 'sections.title', 'questions.text', 'question_options.text')\n unless template.latest?\n # rubocop:disable Layout/LineLength\n flash.now[:notice] = _('You are viewing a historical version of this template. You will not be able to make changes.')\n # rubocop:enable Layout/LineLength\n end\n render 'container', locals: {\n partial_path: 'show',\n template: template,\n phases: phases,\n referrer: get_referrer(template, request.referer)\n }\n end", "def template_page(site); end", "def get_template(template); end", "def show\n @survey_template = SurveyTemplate.find(params[:id])\n end", "def details\n data = Storm::Base::SODServer.remote_call '/Storm/Template/details',\n :id => @id\n self.from_hash data\n end", "def edit\n template = Template.includes(:org, :phases).find(params[:id])\n authorize template\n # Load the info needed for the overview section if the authorization check passes!\n phases = template.phases.includes(sections: { questions: :question_options })\n .order('phases.number',\n 'sections.number',\n 'questions.number',\n 'question_options.number')\n .select('phases.title',\n 'phases.description',\n 'phases.modifiable',\n 'sections.title',\n 'questions.text',\n 'question_options.text')\n if template.latest?\n render 'container', locals: {\n partial_path: 'edit',\n template: template,\n phases: phases,\n referrer: get_referrer(template, request.referer)\n }\n else\n redirect_to org_admin_template_path(id: template.id)\n end\n end", "def preview_doc\n @tpl = Template.find(params[\"template_id\"]) \n output = @tpl.render_by_model_id(params[:id], 'print', 'www.freightoperations.com:8080')\n render(:text => output, :layout => false) \n end", "def show\n render inline: current_site.grid_templates.find(params[:id]).description\n end", "def show\n begin\n @template = current_user.templates.find(params[:id])\n rescue Exception => e\n flash[:notice] = \"You are not authorized to access that Template\"\n Services::Slog.exception e\n redirect_to :root\n end\n end", "def templates\n\n add_breadcrumb \"Download Template\"\n\n @message = \"Creating inventory template. This process might take a while.\"\n\n end", "def show\n @template = Template.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @template }\n end\n end", "def find_template(state)\n view.find_template expanded_view_templates_for(state)\n end", "def show\n\t\t@template = Template.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.xml { render :xml => @template }\n\t\tend\n\tend", "def template\n 'show'\n end", "def show\n @user_template = UserTemplate.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user_template }\n end\n add_audit_trail(:details => \"Viewed a template with alias: #{@user_template.alias}\")\n end", "def show\n @template = Template.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @template }\n end\n end", "def show_template\n :show\n end", "def show_template\n :show\n end", "def link_to_edit_entry_template(page)\n url = admin_page_path page, entries: 1\n link_to 'Edit Entry Template', url, class: 'button'\n end", "def show\n @menu = \"mytemplate\"\n @board = \"mytemplate\"\n @section = \"show\"\n \n @categories = Category.all(:order => :priority) \n @mytemplate = Mytemplate.get(params[:id])\n \n @category_name = @mytemplate.category\n @subcategory_name = @mytemplate.subcategory\n render 'mytemplate' \n end", "def show\n @project_template = ProjectTemplate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project_template }\n end\n end", "def show\n render @current_template\n end", "def show\n @script_template = ScriptTemplate.find params[:id]\n end", "def template(name); end", "def template; end", "def template; end", "def template; end", "def template; end", "def template; end", "def template; end", "def template; end", "def link_to_edit_index_template(page)\n url = admin_page_path page\n link_to 'Edit Index Tempate', url, class: 'button'\n end", "def show\n respond_ok \"template\", @templates\n end", "def template_file(file)\n File.join(\n MiGA::MiGA.root_path,\n 'lib', 'miga', 'cli', 'action', 'browse', file\n )\n end", "def template\n @template.content\n end", "def set_template_detail\n @template_detail = TemplateDetail.find(params[:id])\n end", "def template\n @template\n end", "def show\n @template = Template.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @template }\n end\n end", "def show\n @template = CustomTemplate.find(params[:id])\n\t@baseline_characteristic_fields = BaselineCharacteristicField.where(:template_id => @template.id).all\n\t@quality_dimension_fields = QualityDimensionField.where(:template_id => @template.id).all\n\t@template_categorical_columns = OutcomeColumn.where(:template_id => @template.id, :outcome_type => \"Categorical\").all\n\t@template_continuous_columns = OutcomeColumn.where(:template_id => @template.id, :outcome_type => \"Continuous\").all\t\t\n \trender :layout => \"templates\"\t\n end", "def stencile(sender)\n @template = Template.new(sender)\n @template_selected = true\n end", "def get_template\n @template\n end", "def show\n render sti_template(@type, action_name)\n end", "def show\n @template2 = Template.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @template2 }\n end\n end", "def template\n\t\t\t@signature[:templates][@action_name]\n\t\tend", "def template_path_from view, options\n template = view.find_template tentative_template_path(options)\n \n template && template.path\n end", "def template\n @mail_template = MailTasks::Template.find_or_new( params[:id] )\n\n # For GET\n (render && return) if request.get?\n \n # For Preview\n if params[:commit].downcase == \"preview\"\n @mail_template.attributes = params[:mail_template]\n render :text => @mail_template.content_for_preview( mail_layout_options )\n return\n end\n \n # For Create / Update\n @mail_template.attributes = params[:mail_template]\n @mail_template.variables = params[:variables]\n if @mail_template.save\n flash[:notice] = \"Template \\\"#{@mail_template.name}\\\" has been saved successfully!\"\n redirect_to :back\n else\n flash.now[:notice] = @mail_template.errors.full_messages.join(\"<br />\")\n render\n end\n end", "def open_in_browser\n selection = @list_view.selection\n if iter = selection.selected\n selected_category = iter.parent[0]\n task_index = iter[3]\n url = todo_data.get_trac_url(task_index)\n Launchy.open(url)\n end\n end", "def t\n @template\n end", "def template_for(file); end", "def details\n response = get \"/templates/#{template_id}.json\", {}\n Hashie::Mash.new(response)\n end", "def set_template\n @template = ::Template.find(params[:id])\n end", "def show\n @content_template = ContentTemplate.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @content_template }\n end\n end", "def set_template\n end", "def find_template(opts={})\n if template = opts[:template]\n path = _template_root / template\n elsif action = opts[:action]\n segment = self.class.name.snake_case.split('::').join('/')\n path = _template_root / segment / action\n elsif _layout = opts[:layout]\n path = _template_root / 'layout' / _layout\n else\n raise \"called find_template without an :action or :layout\" \n end \n glob_template(path, opts)\n end", "def show\n @admin_template = Template.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_template }\n end\n end", "def show\n @view_template = ViewTemplate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @view_template }\n end\n end", "def setup_template_details\n template_extension = @template_path.scan(/\\.(\\w+)\\.?(.*)?/)[0][0]\n get_extension_and_name_from_file(@template_path).merge(\n template_extension: template_extension\n )\n end", "def show\n @mailee_template = Mailee::Template.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @mailee_template }\n end\n end", "def get_template(template)\n xapi.VM.get_by_name_label(template).first\n end", "def get_template(template)\n xapi.VM.get_by_name_label(template).first\n end", "def template(*path); end", "def template\n possible_templates.find {|t| File.exists? \"#{t}.html\"}\n end", "def set_template\n @template = Template.find(params[:id])\n end", "def set_template\n @template = Template.find(params[:id])\n end", "def set_template\n @template = Template.find(params[:id])\n end", "def set_template\n @template = Template.find(params[:id])\n end", "def set_template\n @template = Template.find(params[:id])\n end", "def set_template\n @template = Template.find(params[:id])\n end", "def set_template\n @template = Template.find(params[:id])\n end", "def set_template\n @template = Template.find(params[:id])\n end", "def template_name; end", "def template_name; end", "def get_content_template(id)\n @client.raw('get', \"/content/templates/#{id}\")\n end", "def set_template\n begin\n @template = Template.find(params[:id])\n rescue Exception => e\n Services::Slog.exception e\n flash[:notice] = \"Sorry, <i class=\\\"icon-shuffle\\\"></i> couldn't find the template identified by <em>#{params[:id]}</em>.\"\n redirect_to :controller => \"templates\", :action => \"index\"\n end\n end", "def set_template\n @template = PrintTemplate.find(params[:id])\n end", "def show\n @goaltemplate = Goaltemplate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @goaltemplate }\n end\n end", "def select_template\n templatelist = []\n templatelist\n end", "def new\n @_template = @site.templates.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @_template }\n end\n end", "def templates; end", "def template\n template_name = params[:template_name]\n\n render \"templates/#{template_name}\", locals: { }, :layout => nil\n end", "def main_content\n do_include(@template)\n end", "def template\n with_template_factory do |template_factory|\n template = template_factory.build('Test', {})\n puts Graphics::Debugger.new(template).debug\n end\n end", "def template_guide\n @title = \"Template Guide\"\n end", "def otu_page\n @content_template = ContentTemplate.find(params[:content_template_id])\n if @otu = Otu.find(params[:otu_id])\n render :template => \"/content_template/_page\", :locals => {:content => @content_template.content_by_otu(@otu, true)}, :layout => 'otu_page_public_preview'\n else\n\n end\n end", "def template\n lookup_context = ActionView::LookupContext.new(ActionController::Base.view_paths)\n ActionView::Base.new(lookup_context, {}, ApplicationController.new)\n end", "def template(name)\n @conn.templates.get(name)\n end", "def template\n raise \"Template was not loaded: #{@template}\" if !@loadOK\n @template\n end", "def open_page(name)\n name_link(name).click \n wait_for_ajax\n self.window(:title=>\"rSmart | Content Profile\").use\n ContentDetailsPage.new @browser\n end", "def notemplate\n @title = 'Welcome to Viziframe!'\n \n return 'There is no template associated with this action.'\n end", "def set_my_template\n @my_template = MyTemplate.find(params[:id])\n end", "def show\n\t\trender :template => \"ng_templates/\" + params[:path]\n\tend", "def open_page(name)\n name_link(name).click\n self.wait_for_ajax\n self.window(:title=>\"rSmart | Content Profile\").use\n ContentDetailsPage.new @browser\n end" ]
[ "0.6878653", "0.65506744", "0.6543559", "0.6543559", "0.64302385", "0.61869097", "0.6127067", "0.603013", "0.59997255", "0.5975012", "0.59694237", "0.5918888", "0.5916008", "0.5884519", "0.5879556", "0.5871393", "0.5870329", "0.5864126", "0.58616626", "0.58429235", "0.58337474", "0.58103615", "0.580558", "0.58027136", "0.5796394", "0.5796394", "0.57513386", "0.5732468", "0.57289803", "0.57266384", "0.57158965", "0.5702912", "0.5698846", "0.5698846", "0.5698846", "0.5698846", "0.5698846", "0.5698846", "0.5698846", "0.56922925", "0.5684675", "0.5673313", "0.5653729", "0.563853", "0.56353956", "0.5629259", "0.5628095", "0.56019807", "0.55990887", "0.5577222", "0.55735624", "0.5567446", "0.55622554", "0.55542344", "0.5539791", "0.55393946", "0.5534872", "0.55336404", "0.55321825", "0.5530228", "0.5522733", "0.55053425", "0.54916614", "0.5491205", "0.5489337", "0.54869515", "0.5485321", "0.5485321", "0.54801244", "0.5479357", "0.5477373", "0.5477373", "0.5477373", "0.5477373", "0.5477373", "0.5477373", "0.5477373", "0.5477373", "0.54735565", "0.54735565", "0.5464674", "0.5464268", "0.54630446", "0.545994", "0.54579455", "0.5457021", "0.5441104", "0.5428799", "0.5428222", "0.5427021", "0.5398065", "0.53930223", "0.53872186", "0.53864497", "0.5380686", "0.5380669", "0.53801656", "0.53772336", "0.53753614", "0.5372027" ]
0.6469958
4
GET /occasions GET /occasions.json
def index if params[:search] @occasions_search_result = Occasion.where("name like ?", "%#{params[:search]}%").limit(5) if params[:search] < "" else @occasions = Occasion.all.order(sort_column + " " + sort_direction).paginate(:page => params[:page], :per_page => 25) end render @occasions_search_result, layout: false if request.xhr? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @occasions = current_user.occasions.sorteddesc.all.paginate(page: params[:page], :per_page => 10)\n @products = Product.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @occasions }\n end\n end", "def index\n \t @user = current_user\n \t @occasions = @user.occasions\n end", "def index\n @ocats = Ocat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ocats }\n end\n end", "def index\n #@portfolio = Portfolio.find(params[:portfolio_id])\n\n @opinionable = find_opinionable\n\n @opinion = @opinionable.opinions.all\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @opinions }\n end\n end", "def index\n @socios = Socio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @socios }\n end\n end", "def index\n @concursos = Concurso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @concursos }\n end\n end", "def index\n @ocupacions = Ocupacion.all\n end", "def index\n @ocupations = Ocupation.all\n end", "def index\n @has_ocupations = HasOcupation.all\n end", "def index\n @colegios = Colegio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @colegios }\n end\n end", "def index\n @objectives = current_user.objectives.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @objectives }\n end\n end", "def index\n @ores = Ore.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ores }\n end\n end", "def index\n @socioeconomic_studies = SocioeconomicStudy.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @socioeconomic_studies }\n end\n end", "def get_current_occasions\n\n \tcurrent_occasions = Array.new\n recipients = current_user.recipients.live # only get the live recipients!\n\n recipients.each do |recipient|\n \tcurrent_occasions << recipient.recipient_occasions.live\n end\n\n respond_to do |format|\n format.json { render json: current_occasions }\n end\n end", "def index\n init_oco if !session[:organization]\n if session[:organization] != '0'\n @insurances = Insurance.where(organization_id: session[:organization]).paginate(:page => params[:page], :per_page => per_page).order(sort_column + ' ' + sort_direction)\n else\n @insurances = Insurance.paginate(:page => params[:page], :per_page => per_page).order(sort_column + ' ' + sort_direction)\n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @insurances }\n end\n end", "def index\n @competition_interaction_observations = CompetitionInteractionObservation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @competition_interaction_observations }\n end\n end", "def index\n @cooperativas = Cooperativa.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cooperativas }\n end\n end", "def index\n @conseilles = Conseille.all\n respond_to do |format|\n format.html\n format.json { render json: @conseilles}\n end\n end", "def index\n @ideas = Idea.current_ideas_for(current_user).entries\n respond_with(@ideas) do |format|\n format.json { render json: @ideas }\n end\n end", "def index\n @civilizations = Civilization.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @civilizations }\n end\n end", "def index\n authorize! :read, Organisation\n\n if params[:q]\n @items = Organisation.like(params[:q]).alpha\n respond_to do |format|\n format.json {\n @data = { captions: @items.map { |org| org.abbreviation } }\n render json: @data\n }\n end\n else\n respond_to do |format|\n format.html\n format.js\n format.json { render json: OrganisationsDatatable.new(view_context) }\n end\n end\n end", "def index\n @omises = Omise.all\n end", "def index\n @asociados = Asociado.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @asociados }\n end\n end", "def index\n @competencies = Competency.all\n respond_to do |format|\n format.json { render json: @competencies }\n end\n end", "def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @life_insurances }\n end\n end", "def index\n @opnions = Opnion.all\n end", "def index\n confessions = Confession.all.order(\"created_at DESC\")\n\n render json: confessions\n end", "def index\n login_required\n @opinion = Opinion.new\n timeline_opinions\n end", "def index\n if params[:q]\n @occasions = Occasion.where(\"name like ?\", \"%#{params[:q]}%\")\n else\n @occasions = Occasion.all\n end\n end", "def index\n # To restrict so only views you occupations, see omrails, Add Associations . . ., 33:00\n @occupations = Occupation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @occupations }\n end\n end", "def index\n @occasion = Occasion.find params[:occasion_id]\n \t @gifts = Gift.all\n end", "def index\n @clues = Clue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clues }\n end\n end", "def show\n @opinion = Opinion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @opinion }\n end\n end", "def index\n @citations = Citation.all\n\n render json: @citations\n end", "def index\n @consorciots = Consorciot.all\n end", "def index\n @socio_doc_fiscais_corings = SocioDocFiscaisCoring.all\n end", "def show\n @ocat = Ocat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ocat }\n end\n end", "def index\n @content_explores = ContentExplore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @content_explores }\n end\n end", "def index\n @operations_centers = if params[:neighborhood_id]\n Neighborhood.find(params[:neighborhood_id]).operations_centers.alphabetical\n else\n OperationsCenter.alphabetical\n end.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @operations_centers }\n end\n end", "def index\n @ativo_outros = AtivoOutro.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ativo_outros }\n end\n end", "def index\n @consents = Consent.all\n render json: @consents\n end", "def index\n @cofis = Cofi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cofis }\n end\n end", "def index\n @special_occasions = current_user.special_occasions\n end", "def index\n @objectives = @goal.objectives.all \n render json: @objectives \n end", "def index\n @occupants = Occupant.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @occupants }\n end\n end", "def index\n @curriculums = Curriculum.all\n respond_to do |format|\n\t\t\tformat.html { render :index }\n\t\t\tformat.json { render json: Oj.dump(@curriculums) }\n\t\tend\n end", "def index\n @cfos = Cfo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cfos }\n end\n end", "def index\n organizations = if params[:q]\n CclaSignature.search(params[:q])\n else\n Organization.includes(:ccla_signatures)\n end\n\n respond_to do |format|\n format.json do\n render json: organizations.to_json(only: [:id], methods: [:company])\n end\n end\n end", "def index\n @expenses = find_expenses.all\n render json: @expenses\n end", "def index\n @given_circumstances = GivenCircumstance.all\n render json: @given_circumstances\n end", "def index\n find_organismos\n respond_to do |format|\n format.html # index.html.erb\n format.json {render json: @organismos }\n end\n end", "def index\n @operations = Operation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @operations }\n end\n end", "def index\n #@csosns = Csosn.all\n @csosns = Csosn.paginate(:page => params[:page], :per_page => 10)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @csosns }\n end\n end", "def index\n @circle = current_user.circle\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @circle }\n end\n end", "def index\n @chores = Chore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @chores }\n end\n end", "def index\n @chores = Chore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @chores }\n end\n end", "def index\n @casos = Caso.all\n end", "def index\n @cursos = Curso.all_active\n @curso = Curso.new\n @programas = Programa.all_active\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cursos }\n end\n end", "def index\n @opcaos = Opcao.all\n end", "def index\n @organizations = Organization.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @organizations }\n end\n end", "def index\n @lophs = Loph.all\n respond_to do |format|\n format.html\n format.json { render json: @lophs}\n end\n end", "def index\n @coasters = Coaster.all\n\n render json: @coasters\n end", "def index\n @inciting_incidents = IncitingIncident.all\n render json: @inciting_incidents\n end", "def index\n @ginasios = Ginasio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ginasios }\n end\n end", "def index\n @ecologies = Ecology.all\n end", "def listCon\n @opportunities = Opportunity.where(\"status = ?\", \"Publish\")\n render json: @opportunities\n end", "def index\n @anuncios = Anuncio.all\n render json: @anuncios, status: :ok\n end", "def index\n @modalities = Modality.all\n json_response(@modalities)\n end", "def index\n @competences = Competence.all\n end", "def index\n @curator_of_exhibitions = CuratorOfExhibition.all\n end", "def index\n render json: @chapter.reposoitories, status: :ok\n end", "def index\n @disponibles = Disponible.take(50)\n\n render json: @disponibles, include: '**'\n end", "def index\n @fiction = Fiction.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fiction }\n end\n end", "def index\n @interviews = Interview.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @interviews }\n end\n end", "def index\n @evac_centers = EvacCenter.all\n render json: @evac_centers\n end", "def accessories\n render json: { collections: Collection.published_accessories }\n end", "def index\n @cages = current_user.cages\n\n respond_to do |format|\n format.json { render json: @cages }\n end\n end", "def index\n if request.xhr?\n respond_to do |format|\n format.json { render :nothing => true }\n end\n end\n\n if params[:search]\n @comics = Comic.search(params[:search]).arrange\n elsif params[:annual]\n @comics = Comic.where(annual: true).arrange\n else\n @comics = Comic.where(annual: false).where(volume: params[\"volume\"]).arrange\n end\n\n @percentage_owned = @comics.where(owned: true).count.to_f/@comics.count.to_f*100\n\n # if request.xhr?\n # @comics = Comic.where(volume: params[\"volume\"]).arrange.limit(1)\n # render json: @comics\n # end\n end", "def index\n @genotypes = Genotype.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @genotypes }\n end\n end", "def index\n @cocktails = Cocktail.where(\"oficial = ?\", false)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cocktails }\n end\n end", "def index\n @contas = Conta.all\n respond_to do |format|\n format.json { render json: @contas.to_json, status: :ok }\n end\n end", "def index\n @oceans = Ocean.all\n end", "def index\n @conflict_illnesses = ConflictIllness.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @conflict_illnesses }\n end\n end", "def index\n @congties = Congty.all\n end", "def index\n @offices = Office.all\n json_response(@offices)\n end", "def index\n @poms = Pom.all\n\n respond_to do |format|\n # just poms\n format.json { render json: @poms, :except => [:created_at, :updated_at]}\n end\n end", "def index\n @disciplines = Discipline.all\n\n render json: @disciplines\n end", "def index\n @oc_members = OcMember.find(:all, :order => \"created_at ASC\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @oc_members }\n end\n end", "def index\n @content_condos = ContentCondo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @content_condos }\n end\n end", "def show\n @opinions = CriticOpinion.where({ :critic_id => @critic.id })\n end", "def index\n @ordens = Orden.all\n render json: @ordens\n end", "def index\n @competitions = Competition.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @competitions }\n end\n end", "def index\n @opponent = Opponent.all\n render json: @opponent\n end", "def set_occasion\n @occasion = Occasion.find(params[:id])\n end", "def set_occasion\n @occasion = Occasion.find(params[:id])\n end", "def set_occasion\n @occasion = Occasion.find(params[:id])\n end", "def index\r\n @orgs = Org.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @orgs }\r\n end\r\n end", "def index\n @acoes = Acao.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @acoes }\n end\n end", "def index\n @educations = Education.all\n render json: @educations\n end", "def index\n @ordenes = Orden.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ordenes }\n end\n end" ]
[ "0.71376836", "0.69805527", "0.6899527", "0.6672591", "0.6493061", "0.6464204", "0.6429896", "0.64184165", "0.6410785", "0.6382207", "0.6276754", "0.627036", "0.6268284", "0.6240022", "0.6212397", "0.621055", "0.6167536", "0.616684", "0.61637956", "0.6157562", "0.61548686", "0.6152149", "0.61456126", "0.6145231", "0.6141702", "0.6117167", "0.6104447", "0.6103366", "0.60926884", "0.60848594", "0.60310847", "0.60286605", "0.6025459", "0.6014506", "0.601209", "0.601123", "0.5999803", "0.599797", "0.59966075", "0.5981413", "0.59737116", "0.59702605", "0.59681344", "0.5963271", "0.5962961", "0.59582794", "0.5949292", "0.5943813", "0.59422565", "0.59376884", "0.59200186", "0.5915805", "0.5915229", "0.59150785", "0.59048843", "0.59048843", "0.58992225", "0.5896757", "0.5891288", "0.58849144", "0.58801025", "0.587732", "0.5868212", "0.58667797", "0.5865943", "0.58649075", "0.5862416", "0.5856069", "0.58536065", "0.5852131", "0.58476233", "0.5845626", "0.5845062", "0.58424824", "0.58350563", "0.58336836", "0.582923", "0.5826994", "0.58252966", "0.5824266", "0.58240366", "0.5823663", "0.5823383", "0.5822903", "0.58140624", "0.58129984", "0.5812526", "0.58070064", "0.5806815", "0.5806617", "0.5805961", "0.5805707", "0.5803764", "0.58014745", "0.58014745", "0.58014745", "0.5801091", "0.5799336", "0.5787586", "0.57856965" ]
0.6182818
16
GET /occasions/1 GET /occasions/1.json
def show @memories = @occasion.memories.paginate(:page => params[:page], :per_page => 5) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @ocats = Ocat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ocats }\n end\n end", "def index\n @occasions = current_user.occasions.sorteddesc.all.paginate(page: params[:page], :per_page => 10)\n @products = Product.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @occasions }\n end\n end", "def index\n @socios = Socio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @socios }\n end\n end", "def index\n \t @user = current_user\n \t @occasions = @user.occasions\n end", "def index\n @concursos = Concurso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @concursos }\n end\n end", "def index\n @colegios = Colegio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @colegios }\n end\n end", "def show\n @ocat = Ocat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ocat }\n end\n end", "def index\n @cooperativas = Cooperativa.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cooperativas }\n end\n end", "def index\n #@portfolio = Portfolio.find(params[:portfolio_id])\n\n @opinionable = find_opinionable\n\n @opinion = @opinionable.opinions.all\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @opinions }\n end\n end", "def show\n @colaboration = Colaboration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colaboration }\n end\n end", "def show\n @opinion = Opinion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @opinion }\n end\n end", "def index\n @socioeconomic_studies = SocioeconomicStudy.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @socioeconomic_studies }\n end\n end", "def show\n @socio = Socio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @socio }\n end\n end", "def index\n @ores = Ore.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ores }\n end\n end", "def show\n @colegio = Colegio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colegio }\n end\n end", "def set_occasion\n @occasion = Occasion.find(params[:id])\n end", "def set_occasion\n @occasion = Occasion.find(params[:id])\n end", "def set_occasion\n @occasion = Occasion.find(params[:id])\n end", "def show\n @socio = Socio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @socio }\n end\n end", "def index\n @competencies = Competency.all\n respond_to do |format|\n format.json { render json: @competencies }\n end\n end", "def index\n @conseilles = Conseille.all\n respond_to do |format|\n format.html\n format.json { render json: @conseilles}\n end\n end", "def index\n @ocupacions = Ocupacion.all\n end", "def show\n @cso = Cso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cso }\n end\n end", "def index\n @disciplines = Discipline.all\n\n render json: @disciplines\n end", "def index\n @competition_interaction_observations = CompetitionInteractionObservation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @competition_interaction_observations }\n end\n end", "def index\n @citations = Citation.all\n\n render json: @citations\n end", "def index\n @objectives = current_user.objectives.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @objectives }\n end\n end", "def show\n @voc = Voc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @voc }\n end\n end", "def index\n @civilizations = Civilization.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @civilizations }\n end\n end", "def index\n @asociados = Asociado.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @asociados }\n end\n end", "def index\n confessions = Confession.all.order(\"created_at DESC\")\n\n render json: confessions\n end", "def index\n @cocktails = Cocktail.where(\"oficial = ?\", false)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cocktails }\n end\n end", "def index\n @coasters = Coaster.all\n\n render json: @coasters\n end", "def index\n @clues = Clue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clues }\n end\n end", "def index\n @ocupations = Ocupation.all\n end", "def show\n @oase = Oasis.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @oase }\n end\n end", "def show\n @concurso = Concurso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @concurso }\n end\n end", "def show\n @condolence = Condolence.find(params[:id])\n @orbituarysite = current_user.orbituarysites.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @condolence }\n end\n end", "def index\n @cofis = Cofi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cofis }\n end\n end", "def index\n # To restrict so only views you occupations, see omrails, Add Associations . . ., 33:00\n @occupations = Occupation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @occupations }\n end\n end", "def index\n @has_ocupations = HasOcupation.all\n end", "def show\n @comic = Comic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comic }\n end\n end", "def show\n @comic = Comic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comic }\n end\n end", "def index\n @cfos = Cfo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cfos }\n end\n end", "def show\n @consumo = Consumo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @consumo }\n end\n end", "def index\n @occasion = Occasion.find params[:occasion_id]\n \t @gifts = Gift.all\n end", "def index\n @occupants = Occupant.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @occupants }\n end\n end", "def index\n @consents = Consent.all\n render json: @consents\n end", "def show\n @ongoing = Ongoing.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ongoing }\n end\n end", "def index\n @given_circumstances = GivenCircumstance.all\n render json: @given_circumstances\n end", "def index\n @chores = Chore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @chores }\n end\n end", "def index\n @chores = Chore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @chores }\n end\n end", "def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @life_insurances }\n end\n end", "def show\n @socioeconomic_study = SocioeconomicStudy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n\n\n format.json { render json: @socioeconomic_study }\n end\n end", "def index\n @fiction = Fiction.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fiction }\n end\n end", "def index\n find_organismos\n respond_to do |format|\n format.html # index.html.erb\n format.json {render json: @organismos }\n end\n end", "def index\n @simple_chores = SimpleChore.all\n respond_to do |format|\n format.html\n format.json { render :json => @simple_chores }\n end\n end", "def index\n @consorciots = Consorciot.all\n end", "def index\n @ofertas = Oferta.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ofertas }\n end\n end", "def index\n @poms = Pom.all\n\n respond_to do |format|\n # just poms\n format.json { render json: @poms, :except => [:created_at, :updated_at]}\n end\n end", "def show\n @observacao_vocacionada = ObservacaoVocacionada.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @observacao_vocacionada }\n end\n end", "def index\n @cursos = Curso.all_active\n @curso = Curso.new\n @programas = Programa.all_active\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cursos }\n end\n end", "def index\n @objectives = @goal.objectives.all \n render json: @objectives \n end", "def index\n @omises = Omise.all\n end", "def index\n @curriculums = Curriculum.all\n respond_to do |format|\n\t\t\tformat.html { render :index }\n\t\t\tformat.json { render json: Oj.dump(@curriculums) }\n\t\tend\n end", "def index\n #@csosns = Csosn.all\n @csosns = Csosn.paginate(:page => params[:page], :per_page => 10)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @csosns }\n end\n end", "def index\n @casos = Caso.all\n end", "def index\n @contas = Conta.all\n respond_to do |format|\n format.json { render json: @contas.to_json, status: :ok }\n end\n end", "def index\n @ideas = Idea.current_ideas_for(current_user).entries\n respond_with(@ideas) do |format|\n format.json { render json: @ideas }\n end\n end", "def index\n @recipies = Recipy.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recipies }\n end\n end", "def index\n @interviews = Interview.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @interviews }\n end\n end", "def index\n @operations = Operation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @operations }\n end\n end", "def index\n url = \"https://data.cityofchicago.org/resource/x2n5-8w5q.json\"\n options = { :body => {:status => text}, :basic_auth => @auth }\n @response = HTTParty.get(url, options)\n\n @crime = Hash.new\n\n #@crime['block'] = @response[0]['block']\n @crime = @response\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gittos }\n end\n end", "def index\n @inciting_incidents = IncitingIncident.all\n render json: @inciting_incidents\n end", "def index\n @courts = Court.by_name\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courts }\n end\n end", "def index\n @ativo_outros = AtivoOutro.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ativo_outros }\n end\n end", "def index\n @content_condos = ContentCondo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @content_condos }\n end\n end", "def show\n @corgi = Corgi.find(params[:id])\n respond_to do |format|\n format.html \n format.json { render json: @corgi }\n end \n end", "def index\n @competitions = Competition.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @competitions }\n end\n end", "def index\n @categorias = Categoria.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @categorias }\n end\n end", "def show\n @competition_interaction_observation = CompetitionInteractionObservation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competition_interaction_observation }\n end\n end", "def index\n render json: @chapter.reposoitories, status: :ok\n end", "def index\n @acoes = Acao.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @acoes }\n end\n end", "def index\n init_oco if !session[:organization]\n if session[:organization] != '0'\n @insurances = Insurance.where(organization_id: session[:organization]).paginate(:page => params[:page], :per_page => per_page).order(sort_column + ' ' + sort_direction)\n else\n @insurances = Insurance.paginate(:page => params[:page], :per_page => per_page).order(sort_column + ' ' + sort_direction)\n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @insurances }\n end\n end", "def index\n if params[:q]\n @occasions = Occasion.where(\"name like ?\", \"%#{params[:q]}%\")\n else\n @occasions = Occasion.all\n end\n end", "def show\n @competicao = Competicao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competicao }\n end\n end", "def index\n render json: @owner.cats\n end", "def index\n @disciplines = Discipline.all\n #respond_to do |format|\n # format.json { render json: @disciplines, status: :ok }\n #end\n #render json: @disciplines, status: :ok\n respond_with @disciplines\n end", "def index\n @circle = current_user.circle\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @circle }\n end\n end", "def index\n @genotypes = Genotype.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @genotypes }\n end\n end", "def index\n organizations = if params[:q]\n CclaSignature.search(params[:q])\n else\n Organization.includes(:ccla_signatures)\n end\n\n respond_to do |format|\n format.json do\n render json: organizations.to_json(only: [:id], methods: [:company])\n end\n end\n end", "def index\n if params[:search]\n @occasions_search_result = Occasion.where(\"name like ?\", \"%#{params[:search]}%\").limit(5) if params[:search] < \"\"\n else\n @occasions = Occasion.all.order(sort_column + \" \" + sort_direction).paginate(:page => params[:page], :per_page => 25)\n end\n render @occasions_search_result, layout: false if request.xhr?\n\n end", "def index\n @anuncios = Anuncio.all\n render json: @anuncios, status: :ok\n end", "def show\n @opinions = CriticOpinion.where({ :critic_id => @critic.id })\n end", "def index\n @organizations = Organization.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @organizations }\n end\n end", "def index\n @content_explores = ContentExplore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @content_explores }\n end\n end", "def index\n @ginasios = Ginasio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ginasios }\n end\n end", "def index\n @socio_doc_fiscais_corings = SocioDocFiscaisCoring.all\n end", "def index\n @disciplines = Discipline.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @disciplines }\n end\n end", "def show\n @orc = Orc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @orc }\n end\n end", "def index\n @operations_centers = if params[:neighborhood_id]\n Neighborhood.find(params[:neighborhood_id]).operations_centers.alphabetical\n else\n OperationsCenter.alphabetical\n end.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @operations_centers }\n end\n end" ]
[ "0.66657513", "0.66384125", "0.6512077", "0.65024394", "0.64854777", "0.6438431", "0.63848907", "0.6321203", "0.6300629", "0.62605506", "0.6235078", "0.6216798", "0.619967", "0.61820227", "0.6172944", "0.6172616", "0.6172616", "0.6172616", "0.61418664", "0.6129584", "0.61161435", "0.60993123", "0.609486", "0.6081786", "0.6080318", "0.60725933", "0.6062993", "0.6062188", "0.6052901", "0.6048444", "0.60462844", "0.6027282", "0.6026781", "0.602269", "0.6021431", "0.6020579", "0.601", "0.6009588", "0.5988664", "0.59879315", "0.5976911", "0.59697026", "0.59697026", "0.59690714", "0.59659386", "0.59634477", "0.5949792", "0.5939921", "0.5939356", "0.5932339", "0.5928429", "0.5928429", "0.59264475", "0.59253263", "0.5920747", "0.59193444", "0.5917627", "0.5910104", "0.5902702", "0.5900992", "0.5897183", "0.58878195", "0.587913", "0.58623284", "0.5860694", "0.5855466", "0.5854702", "0.5844244", "0.5833829", "0.582603", "0.5825971", "0.5822635", "0.5821529", "0.5817525", "0.5815581", "0.5813205", "0.5809937", "0.58095855", "0.58093715", "0.58067954", "0.580424", "0.58036155", "0.580147", "0.5800675", "0.579696", "0.57960236", "0.579386", "0.5791167", "0.5789915", "0.5779957", "0.5773769", "0.57689464", "0.57685304", "0.5758665", "0.5757292", "0.5753599", "0.5750154", "0.574158", "0.5733059", "0.57318366", "0.5727961" ]
0.0
-1
POST /occasions POST /occasions.json
def create @occasion = Occasion.new(occasion_params) @occasion.administrators << current_user respond_to do |format| if @occasion.save format.html { redirect_to @occasion, notice: 'Occasion was successfully created.' } format.json { render :show, status: :created, location: @occasion } else format.html { render :new } format.json { render json: @occasion.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @occasion = Occasion.new(occasion_params)\n\n respond_to do |format|\n if @occasion.save\n format.html { redirect_to [:admin, @occasion], notice: 'Occasion was successfully created.' }\n format.json { render :show, status: :created, location: @occasion }\n else\n format.html { render :new }\n format.json { render json: @occasion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @opinion = Opinion.new(params[:opinion])\n\n respond_to do |format|\n if @opinion.save\n format.html { redirect_to @opinion, notice: 'Opinion was successfully created.' }\n format.json { render json: @opinion, status: :created, location: @opinion }\n else\n format.html { render action: \"new\" }\n format.json { render json: @opinion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @special_occasion = SpecialOccasion.new(special_occasion_params)\n\n @special_occasion.user = current_user\n\n respond_to do |format|\n if @special_occasion.save\n format.html { redirect_to @special_occasion, notice: 'Special occasion was successfully created.' }\n format.json { render :show, status: :created, location: @special_occasion }\n else\n format.html { render :new }\n format.json { render json: @special_occasion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @opinion = Opinion.new(opinion_params)\n\n respond_to do |format|\n if @opinion.save\n format.html { redirect_to @opinion, notice: 'Opinion was successfully created.' }\n format.json { render action: 'show', status: :created, location: @opinion }\n else\n format.html { render action: 'new' }\n format.json { render json: @opinion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @opinion = current_user.opinions.build(opinion_params)\n\n respond_to do |format|\n if @opinion.save\n format.html { redirect_to index, notice: 'Opinion was successfully created.' }\n format.json { render :index, status: :created, location: @opinion }\n else\n format.html { render :new }\n format.json { render json: @opinion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @opinion = Opinion.new(opinion_params)\n @opinion.authorId = current_user.id\n\n respond_to do |format|\n if @opinion.save\n format.html { redirect_to opinions_path, notice: 'Opinion was successfully created.' }\n format.json { render :show, status: :created, location: @opinion }\n else\n format.html { render :new }\n format.json { render json: @opinion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @opinion = current_user.opinions.build(opinion_params)\n\n respond_to do |format|\n if @opinion.save\n format.html { redirect_to root_path, notice: 'Opinion was successfully created.' }\n format.json { render :show, status: :created, location: @opinion }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @opinion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n params[:occasion][:price_min] = params[:occasion][:price_min].to_d * 100\n params[:occasion][:price_max] = params[:occasion][:price_max].to_d * 100\n\n @occasion = current_user.occasions.build(params[:occasion])\n @gift_types = GiftType.all\n \n # if you pass recipient_name in before the @occasion-object is initialized,\n # it won't be initialized correctly because there is no user_id\n @occasion.recipient_name = params[:occasion][:recipient_name]\n \n @ocats = Ocat.all\n\n\n\n \n respond_to do |format|\n if @occasion.save\n format.html {\n flash[:success] = 'Occasion was successfully created.'\n redirect_to @occasion \n }\n format.json { render json: @occasion, status: :created, location: @occasion }\n else\n format.html { render action: \"new\" }\n format.json { render json: @occasion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @opnion = Opnion.new(opnion_params)\n\n respond_to do |format|\n if @opnion.save\n format.html { redirect_to @opnion, notice: 'Opnion was successfully created.' }\n format.json { render :show, status: :created, location: @opnion }\n else\n format.html { render :new }\n format.json { render json: @opnion.errors, status: :unprocessable_entity }\n end\n end\n end", "def occasion_params\n params.require(:occasion).permit(:name)\n end", "def set_occasion\n @occasion = Occasion.find(params[:id])\n end", "def set_occasion\n @occasion = Occasion.find(params[:id])\n end", "def set_occasion\n @occasion = Occasion.find(params[:id])\n end", "def new\n @occasion = Occasion.new\n @ocats = Ocat.all\n @products = Product.all\n @productcats = ProductCat.all\n @category_product_link = CategoryProductLink.all\n @gift_types = GiftType.all\n @occasion.date ||= params[:date]\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @occasion }\n end\n end", "def create\n @socio = Socio.new(params[:socio])\n\n respond_to do |format|\n if @socio.save\n format.html { redirect_to @socio, :notice => 'Socio cadastrado com sucesso.' }\n format.json { render :json => @socio, :status => :created, :location => @socio }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @socio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_opinion\n PaperTrail.request(enabled: false) do\n @opinion = Decidim.traceability.perform_action!(\n :create,\n Decidim::Opinions::Opinion,\n @current_user,\n visibility: \"public-only\"\n ) do\n opinion = Opinion.new(\n title: title_with_hashtags,\n body: body_with_hashtags,\n component: form.component\n )\n opinion.add_coauthor(@current_user, user_group: user_group)\n opinion.save!\n opinion\n end\n end\n end", "def index\n @occasions = current_user.occasions.sorteddesc.all.paginate(page: params[:page], :per_page => 10)\n @products = Product.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @occasions }\n end\n end", "def create\n @expense = Expense.new(expense_params)\n @gastos = Gasto.all \n @documents = Document.all\n \n respond_to do |format|\n if @expense.save\n @expense.correlativo\n \n format.html { redirect_to @expense, notice: 'Expense was successfully created.' }\n format.json { render :show, status: :created, location: @expense }\n else\n format.html { render :new }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @opinion = Opinion.new(params[:opinion])\n\n respond_to do |format|\n if @opinion.save\n format.html { redirect_to(opinions_path, :notice => 'Opinion was successfully created.') }\n format.xml { render :xml => @opinion, :status => :created, :location => @opinion }\n else\n format.html { render :action => \"opinions_path\" }\n format.xml { render :xml => @opinion.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n \t @user = current_user\n \t @occasions = @user.occasions\n end", "def create\n @caso = Caso.new(caso_params)\n\n respond_to do |format|\n if @caso.save\n format.html { redirect_to @caso, notice: 'Caso was successfully created.' }\n format.json { render :show, status: :created, location: @caso }\n else\n format.html { render :new }\n format.json { render json: @caso.errors, status: :unprocessable_entity }\n end\n end\n end", "def enter_occasions(test_data)\n occasions = test_data[UseOfCollections::OCCASION_LIST.name] || [{ UseOfCollections::OCCASION.name => ''}]\n prep_fieldsets_for_test_data([fieldset(UseOfCollections::OCCASION_LIST.name)], occasions)\n occasions.each_with_index do |occasion, index|\n enter_auto_complete(occasion_input(index), occasion_options(index), occasion[UseOfCollections::OCCASION.name], 'Occasion Concepts')\n end\n end", "def create\n @ocat = Ocat.new(params[:ocat])\n\n respond_to do |format|\n if @ocat.save\n format.html { redirect_to @ocat, notice: 'Ocat was successfully created.' }\n format.json { render json: @ocat, status: :created, location: @ocat }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ocat.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ocupacion = Ocupacion.new(ocupacion_params)\n\n respond_to do |format|\n if @ocupacion.save\n format.html { redirect_to @ocupacion, notice: 'Ocupacion was successfully created.' }\n format.json { render :show, status: :created, location: @ocupacion }\n else\n format.html { render :new }\n format.json { render json: @ocupacion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ocupation = Ocupation.new(ocupation_params)\n\n respond_to do |format|\n if @ocupation.save\n format.html { redirect_to @ocupation, notice: 'Ocupation was successfully created.' }\n format.json { render :show, status: :created, location: @ocupation }\n else\n format.html { render :new }\n format.json { render json: @ocupation.errors, status: :unprocessable_entity }\n end\n end\n end", "def occasion_params\n params.require(:occasion).permit(:name, :date, :time)\n end", "def new\n @opinion = Opinion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @opinion }\n end\n end", "def new\n @opinion = Opinion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @opinion }\n end\n end", "def create\n #@incident = @quote.incidents.new(incident_params)\n logger.info params[:incident]\n params[:incident].each do |incident|\n @incident = @quote.incidents.new(incident)\n @incident.save\n end\n respond_to do |format|\n format.json { render :json => { :code => \"201\", :description => \"Created incidents\"} }\n end\n end", "def socio_economico_submit\n\n # responding for the first time\n if not session[:current_response_id]\n current_response = nil\n # preparing the object to store the surveys and requests data\n json_response = { 'surveys' => [], 'requests' => [] }\n else\n current_response = FormResponse.find(session[:current_response_id])\n json_response = JSON.parse current_response.json_response\n end\n\n # appending the new response to the array of surveys\n surveys_number = json_response['surveys'].size\n json_response['surveys'] = [] if surveys_number == 0\n json_response['surveys'].push(\n params.merge({\n :attempt => (surveys_number + 1),\n :sent_at => Time.zone.now\n })\n )\n\n if current_response\n current_response.update({\n json_response: json_response.to_json\n })\n else\n # the response must be created only in this form\n # and not in the request form!\n current_response = FormResponse.create({\n form_id: Form.where(reference_model: 'FormVagasRemanescentes').first.id,\n user: current_user.email,\n json_response: json_response.to_json\n })\n\n # storing the response id in session to access it\n # from the other form, the request form\n session[:current_response_id] = current_response.id\n end\n\n redirect_to action: 'pedido'\n end", "def index\n #@portfolio = Portfolio.find(params[:portfolio_id])\n\n @opinionable = find_opinionable\n\n @opinion = @opinionable.opinions.all\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @opinions }\n end\n end", "def enter_occasions(test_data)\n occasions = test_data[CoreUseOfCollectionsData::OCCASION_LIST.name] || [{CoreUseOfCollectionsData::OCCASION.name => ''}]\n hide_notifications_bar\n prep_fieldsets_for_test_data([fieldset(CoreUseOfCollectionsData::OCCASION_LIST.name)], occasions)\n occasions.each_with_index do |occasion, index|\n logger.info \"Entering occasion data set at index #{index}: #{occasion}\"\n enter_auto_complete(occasion_input(index), occasion_options(index), occasion[CoreUseOfCollectionsData::OCCASION.name], 'Occasion Concepts')\n end\n end", "def create\n @socio_doc_fiscais_coring = SocioDocFiscaisCoring.new(socio_doc_fiscais_coring_params)\n\n respond_to do |format|\n if @socio_doc_fiscais_coring.save\n format.html { redirect_to @socio_doc_fiscais_coring, notice: 'Socio doc fiscais coring was successfully created.' }\n format.json { render action: 'show', status: :created, location: @socio_doc_fiscais_coring }\n else\n format.html { render action: 'new' }\n format.json { render json: @socio_doc_fiscais_coring.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @caso = Caso.new(caso_params)\n\n respond_to do |format|\n if @caso.save\n format.html { redirect_to @caso, notice: 'Caso creado con éxito.' }\n format.json { render action: 'show', status: :created, location: @caso }\n else\n format.html { render action: 'new' }\n format.json { render json: @caso.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @occasion = Occasion.find(params[:id])\n @occasion.destroy\n\n respond_to do |format|\n format.html { redirect_to occasions_url }\n format.json { head :no_content }\n end\n end", "def enter_pahma_occasions(test_data)\n occasions = test_data[UseOfCollections::OCCASION_LIST.name] || [{ UseOfCollections::OCCASION.name => ''}]\n prep_fieldsets_for_test_data([fieldset(UseOfCollections::OCCASION_LIST.name)], occasions)\n occasions.each_with_index do |occasion, index|\n enter_auto_complete(occasion_input(index), occasion_options(index), occasion[UseOfCollections::OCCASION.name], 'Occasion Concepts')\n end\n end", "def create\n @pedagogy_innovation = @_current_user.pedagogy_innovations.new(pedagogy_innovation_params)\n\n respond_to do |format|\n if not @pedagogy_innovation.save\n format.html { redirect_to @pedagogy_innovation, notice: 'Pedagogy innovation was successfully created.' }\n format.json { render :show, status: :created, location: @pedagogy_innovation }\n else\n format.html { render :new }\n format.json { render json: @pedagogy_innovation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @socio = Socio.new(params[:socio])\n\n respond_to do |format|\n @socio.save\n format.html { redirect_to socios_url}\n end\n end", "def create\n @consorciot = Consorciot.new(consorciot_params)\n\n respond_to do |format|\n if @consorciot.save\n format.html { redirect_to @consorciot, notice: 'Consorciot was successfully created.' }\n format.json { render :show, status: :created, location: @consorciot }\n else\n format.html { render :new }\n format.json { render json: @consorciot.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @occasion.destroy\n respond_to do |format|\n format.html { redirect_to admin_occasions_url, notice: 'Occasion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create\n @socioeconomic = Socioeconomic.new(socioeconomic_params)\n\n respond_to do |format|\n if @socioeconomic.save\n format.html { redirect_to socioeconomics_url, notice: 'Socioeconomic was successfully created.' }\n # format.json { render :show, status: :created, location: @socioeconomic }\n else\n format.html { render :new }\n format.json { render json: @socioeconomic.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @mood_datum = MoodDatum.new(mood_datum_params)\n \n respond_to do |format|\n if @mood_datum.save \n params['significant_events'].each do |key,value| \n PatientSignificantEvent.create(:patient_id =>@mood_datum.user_id ,:doctor_id => @mood_datum.doctor_id ,:mood_data_id =>@mood_datum.id ,:comments => value )\n end \n format.html { redirect_to new_mood_datum_path(:patient => current_user.id), notice: 'Mood datum was successfully created.' }\n format.json { render action: 'show', status: :created, location: @mood_datum }\n else\n format.html { render action: 'new' }\n format.json { render json: @mood_datum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @observation = Observation.new(observation_params)\n\n \n\n respond_to do |format|\n if @observation.save\n format.html { redirect_to @observation, notice: 'Observation was successfully created.' }\n format.json { render :show, status: :created, location: @observation }\n else\n @services_of_dependence = current_user.dependence.service_of_dependences\n agents_of_service = AgentOfService.where(service_of_dependence: @services_of_dependence)\n @agents = Agent.where(id: agents_of_service.pluck(:agent_id))\n format.html { render :new }\n format.json { render json: @observation.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @occasion.destroy\n respond_to do |format|\n format.html { redirect_to occasions_url, notice: 'Occasion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def opinion_params\n params.require(:opinion).permit(:content)\n end", "def create\n @empresa = Empresa.find(params[:empresa_id]) \n @producto = @empresa.productos.find(params[:producto_id])\n @item_producto = @producto.item_productos.find(params[:item_producto_id])\n @opinion = @item_producto.opinions.build(opinion_params)\n respond_to do |format|\n if @opinion.save\n format.html { redirect_to empresa_producto_item_producto_opinions_path, notice: 'Item producto was successfully created.' }\n format.json { render :show, status: :created, location: @opinion }\n else\n format.html { render :new }\n format.json { render json: @opinion.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n login_required\n @opinion = Opinion.new\n timeline_opinions\n end", "def create\n @opinionable = find_opinionable\n #@portfolio = Portfolio.find(params[:portfolio_id])\n @opinion = @opinionable.opinions.build(params[:opinion])\n\n @opinion.user = current_user\n\n# @opinion = Opinion.new(params[:opinion])\n\n respond_to do |format|\n if @opinion.save\n format.html { redirect_to [@opinionable,@opinion], notice: 'Opinion was successfully created.' }\n format.json { render json: @opinion, status: :created, location: [@opinionable,@opinion] }\n else\n format.html { render action: \"new\" }\n format.json { render json: @opinion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cog = Cog.new(cog_params)\n\n respond_to do |format|\n if @cog.save\n format.html { redirect_to @cog, notice: 'Cog was successfully created.' }\n format.json { render :show, status: :created, location: @cog }\n else\n format.html { render :new }\n format.json { render json: @cog.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @opinion = current_user.opinions.build(opinion_params)\n if @opinion.save\n redirect_to root_path\n else\n render 'new'\n end\n end", "def create\n @thuoc = Thuoc.new(thuoc_params)\n\n respond_to do |format|\n if @thuoc.save\n format.html { redirect_to @thuoc, notice: \"Thuoc was successfully created.\" }\n format.json { render :show, status: :created, location: @thuoc }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @thuoc.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @opcao = Opcao.new(opcao_params)\n\n respond_to do |format|\n if @opcao.save\n format.html { redirect_to @opcao, notice: 'Opção criada com sucesso!' }\n format.json { render :show, status: :created, location: @opcao }\n else\n format.html { render :new }\n format.json { render json: @opcao.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @holiday = Holiday.find(params[:holiday_id])\n @occurrence = Occurrence.new(occurrence_params)\n\n respond_to do |format|\n if @occurrence.save\n format.html { redirect_to :back, notice: 'Occurrence was successfully created.' }\n format.json { render :show, status: :created, location: @occurrence }\n else\n format.html { render :new }\n format.json { render json: @occurrence.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @recommendation = current_user.recommendations.build(params[:recommendation])\n @users=User.all\n @products=Product.all\n @occasions=Occasion.all\n\n respond_to do |format|\n if @recommendation.save\n format.html { redirect_to occasion_path(@recommendation.occasion_id)}\n format.json { render json: @recommendation, status: :created, location: @recommendation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recommendation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cocoon_example = CocoonExample.new(cocoon_example_params)\n\n respond_to do |format|\n if @cocoon_example.save\n format.html { redirect_to @cocoon_example, notice: 'Cocoon example was successfully created.' }\n format.json { render :show, status: :created, location: @cocoon_example }\n else\n format.html { render :new }\n format.json { render json: @cocoon_example.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @ocats = Ocat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ocats }\n end\n end", "def update\n respond_to do |format|\n if @occasion.update(occasion_params)\n format.html { redirect_to [:admin, @occasion], notice: 'Occasion was successfully updated.' }\n format.json { render :show, status: :ok, location: @occasion }\n else\n format.html { render :edit }\n format.json { render json: @occasion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @competence = Competence.new(competence_params)\n respond_to do |format|\n if @competence.save\n format.json { render :show, status: :created, object: @competence }\n else\n format.json { render json: @competence.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @observation = Observation.new(params[:observation])\n\n respond_to do |format|\n if @observation.save\n format.html { redirect_to @observation, notice: 'Observation was successfully created.' }\n format.json { render json: @observation, status: :created, location: @observation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @observation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @omise = Omise.new(omise_params)\n\n respond_to do |format|\n if @omise.save\n format.html { redirect_to @omise, notice: 'Omise was successfully created.' }\n format.json { render :show, status: :created, location: @omise }\n else\n format.html { render :new }\n format.json { render json: @omise.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n\n respond_to do |format|\n if @evolucion.save\n format.html { redirect_to @evolucion, notice: 'Evolucion was successfully created.' }\n format.json { render :show, status: :created, location: @evolucion }\n else\n format.html { render :new }\n format.json { render json: @evolucion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @occurence = Occurence.new(occurence_params)\n\n respond_to do |format|\n if @occurence.save\n format.html { redirect_to @occurence, notice: 'Occurence was successfully created.' }\n format.json { render :show, status: :created, location: @occurence }\n else\n format.html { render :new }\n format.json { render json: @occurence.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @socio = Socio.new(socio_params)\n\n respond_to do |format|\n if @socio.save\n format.html { redirect_to @socio, notice: 'Socio criado com sucesso.' }\n format.json { render :show, status: :created, location: @socio }\n else\n format.html { render :new }\n format.json { render json: @socio.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @socioeconomic_ocupation = SocioeconomicOcupation.new(params[:socioeconomic_ocupation])\n\n respond_to do |format|\n if @socioeconomic_ocupation.save\n format.html { redirect_to(@socioeconomic_ocupation, :notice => 'SocioeconomicOcupation was successfully created.') }\n format.xml { render :xml => @socioeconomic_ocupation, :status => :created, :location => @socioeconomic_ocupation }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @socioeconomic_ocupation.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @occasion = Occasion.find params[:occasion_id]\n \t @gifts = Gift.all\n end", "def create\n @voc = Voc.new(params[:voc])\n @voc.user_id = current_user.id\n\n respond_to do |format|\n if @voc.save\n format.html { redirect_to @voc, notice: 'Voc was successfully created.' }\n format.json { render json: @voc, status: :created, location: @voc }\n else\n format.html { render action: \"new\" }\n format.json { render json: @voc.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @respuesta = Respuesta.new(params[:respuesta])\n\n if @respuesta.save\n render json: @respuesta, status: :created, location: @respuesta\n else\n render json: @respuesta.errors, status: :unprocessable_entity\n end\n end", "def create\n @osoba = Osoba.new(params[:osoba])\n\n if @osoba.save\n render json: @osoba, status: :created, location: @osoba\n else\n render json: @osoba.errors, status: :unprocessable_entity\n end\n end", "def create\n @idea = current_member.ideas.new(idea_params) \n respond_to do |format|\n sectors_params.delete(\"\")\n if @idea.save\n sectors_params.each do |k|\n @idea.sectors << Sector.find_by(id:k)\n end\n format.json { head :no_content }\n format.js\n else\n\n format.json { render :json => { :error => @idea.errors.full_messages }, :status => 422 }\n end\n \n end\n end", "def test_post_request_collection\n params = {\n size: 3,\n employmentTypeUris: ['/dk/atira/pure/person/employmenttypes/academic'],\n employmentStatus: 'ACTIVE'\n }\n response = client.persons.all_complex params: params\n assert_equal response.code, 200\n assert_instance_of HTTP::Response, response\n end", "def index\n @competition_interaction_observations = CompetitionInteractionObservation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @competition_interaction_observations }\n end\n end", "def opinion_params\n params.require(:opinion).permit(:nombre, :nacionalidad, :pais, :ciudad, :comentario)\n end", "def create\n @ocupations = Ocupation.all\n @has_ocupation = HasOcupation.new(has_ocupation_params)\n @selected_ocupations = has_ocupation_params[:ocupation_id]\n @ok = false\n\n @selected_ocupations.each do |ocupation_id|\n @ok = true if HasOcupation.create(worker_id: has_ocupation_params[:worker_id], ocupation_id: ocupation_id)\n end if !@selected_ocupations.nil?\n\n\n respond_to do |format|\n if @ok\n format.html { redirect_to @has_ocupation, notice: 'Has ocupation was successfully created.' }\n format.json { render :show, status: :created, location: @has_ocupation }\n else\n format.html { render :new }\n format.json { render json: @has_ocupation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @congresso = Congresso.new(congresso_params)\n\n respond_to do |format|\n if @congresso.save\n format.html { redirect_to @congresso, notice: 'Congresso was successfully created.' }\n format.json { render :show, status: :created, location: @congresso }\n else\n format.html { render :new }\n format.json { render json: @congresso.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @life_insurances }\n end\n end", "def create\n @inspection = Inspection.new(inspection_params)\n @clients = @inspection.try(:appointment).try(:insp_request).try(:property).try(:clients)\n create_documents\n respond_to do |format|\n if @inspection.save\n format.html { redirect_to @inspection, notice: 'Inspection was successfully created.' }\n format.json { render json: @inspection }\n else\n format.html { render :new }\n format.json { render json: @inspection.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @socio = Socio.new(socio_params)\n respond_to do |format|\n if @socio.save\n format.html { redirect_to new_socio_path, notice: 'El socio fue creado correctamente.' }\n format.json { render action: 'show', status: :created, location: @socio }\n else\n format.html { render action: 'new' }\n format.json { render json: @socio.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cooco = Cooco.new(cooco_params)\n\n respond_to do |format|\n if @cooco.save\n format.html { redirect_to @cooco, notice: 'Cooco was successfully created.' }\n format.json { render :show, status: :created, location: @cooco }\n else\n format.html { render :new }\n format.json { render json: @cooco.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @consumo = Consumo.new(consumo_params)\n\n respond_to do |format|\n if @consumo.save\n format.html { redirect_to @consumo, notice: 'Consumo was successfully created.' }\n format.json { render :show, status: :created, location: @consumo }\n else\n format.html { render :new }\n format.json { render json: @consumo.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @socios = Socio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @socios }\n end\n end", "def create\n @discipline = Discipline.new(discipline_params)\n @discipline.users_id = current_user.id\n\n respond_to do |format|\n if @discipline.save\n @discipline.codigo = \"DISC-%04d\" % [@discipline.id]\n @discipline.save\n if params[:anexos]\n\n params[:anexos].each { |anx|\n @discanexo = Discanexo.new\n @discanexo.anexo = anx\n @discanexo.Discipline_id = @discipline.id\n @discanexo.save\n }\n end\n flash[:success] = \"Disciplina cadastrada com sucesso.\"\n format.html { redirect_to @discipline}\n format.json { render :show, status: :created, location: @discipline }\n else\n format.html { render :new }\n format.json { render json: @discipline.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @society_recuritment = SocietyRecuritment.new(society_recuritment_params)\n\n respond_to do |format|\n if @society_recuritment.save\n format.html { redirect_to @society_recuritment, notice: 'Society recuritment was successfully created.' }\n format.json { render :show, status: :created, location: @society_recuritment }\n else\n format.html { render :new }\n format.json { render json: @society_recuritment.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @ocupacions = Ocupacion.all\n end", "def create\n @asociacion = Asociacion.new(asociacion_params)\n\n respond_to do |format|\n if @asociacion.save\n format.html { redirect_to @asociacion, notice: 'Asociacion was successfully created.' }\n format.json { render :show, status: :created, location: @asociacion }\n else\n format.html { render :new }\n format.json { render json: @asociacion.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @socioeconomic_studies = SocioeconomicStudy.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @socioeconomic_studies }\n end\n end", "def create\n #return render json: params[:recursos]\n @area = Area.new(area_params)\n @count = 0\n save_multiples_recursos if params[:recursos][:status] == '1'\n respond_to do |format|\n if @area.save\n format.html { redirect_to areas_path, notice: 'El Área fue creada éxitosamente.' }\n format.json { render :show, status: :created, location: @area }\n else\n format.html { render :new }\n format.json { render json: @area.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @criterion = Criterion.new(params[:criterion])\n\n if @criterion.save\n render json: @criterion, status: :created, location: @criterion\n else\n render json: @criterion.errors, status: :unprocessable_entity\n end\n end", "def new\n @page_id = \"opinions\"\n @opinion = Opinion.new\n @agents = Agent.all.collect {|item| [ item.name, item.id ]}\n @services = Service.find(:all).collect {|item| [ item.name, item.id ]}\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @opinion }\n end\n end", "def create\n @ecology = Ecology.new(ecology_params)\n\n respond_to do |format|\n if @ecology.save\n format.html { redirect_to @ecology, notice: 'Ecology was successfully created.' }\n format.json { render :show, status: :created, location: @ecology }\n else\n format.html { render :new }\n format.json { render json: @ecology.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @agronomiaquimica = Agronomiaquimica.new(params[:agronomiaquimica])\n\n respond_to do |format|\n if @agronomiaquimica.save\n format.html { redirect_to @agronomiaquimica, notice: 'Agronomiaquimica was successfully created.' }\n format.json { render json: @agronomiaquimica, status: :created, location: @agronomiaquimica }\n else\n format.html { render action: \"new\" }\n format.json { render json: @agronomiaquimica.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @observance = Observance.new(observance_params)\n\n respond_to do |format|\n if @observance.save\n format.html { redirect_to @observance, notice: 'Observance was successfully created.' }\n format.json { render action: 'show', status: :created, location: @observance }\n else\n format.html { render action: 'new' }\n format.json { render json: @observance.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n @expense = Expense.new(expense_params)\n\n b_id = Building.search(@expense.buildinginfo)\n Building.find_by(id: b_id).expenses << @expense\n \n respond_to do |format|\n if @expense.save\n format.html { redirect_to @expense, notice: 'Expense was successfully created.' }\n format.json { render :show, status: :created, location: @expense }\n else\n format.html { render :new }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n params.permit(:intitule, :estObligatoire, :nombreDeCaractere, :ordre, :sondage_id)\n ajout = QuestionOuverteService.instance.creerQuestionOuverte(params[:intitule], params[:estObligatoire], params[:nombreDeCaractere], params[:ordre], params[:sondage_id])\n (ajout != nil) ? (render json: ajout, status: :ok) : (render json: nil, status: :not_found)\n end", "def create\n \n @coference = Coference.new(coference_params)\n\n @user = User.find(session[:user_id]) \n respond_to do |format|\n if @coference.save\n @user.coferences << @coference\n format.html { redirect_to @coference, notice: 'La actividad se registro con exito.' }\n format.json { render :show, status: :created, location: @coference }\n else\n format.html { render :new }\n format.json { render json: @coference.errors, status: :unprocessable_entity }\n end\n end\n \n end", "def create\n @society = Society.new(society_params)\n\n respond_to do |format|\n if @society.save\n format.html { redirect_to @society, notice: 'Se ha creado exitosamente.' }\n format.json { render :show, status: :created, location: @society }\n else\n format.html { render :new }\n format.json { render json: @society.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # Handle the case of a single obs\n params[:observations] = [['0', params[:observation]]] if params[:observation]\n \n if params[:observations].blank? && params[:observation].blank?\n respond_to do |format|\n format.html do\n flash[:error] = t(:no_observations_submitted)\n redirect_to new_observation_path\n end\n format.json { render :status => :unprocessable_entity, :json => \"No observations submitted!\" }\n end\n return\n end\n \n @observations = params[:observations].to_h.map do |fieldset_index, observation|\n next if observation.blank?\n observation.delete('fieldset_index') if observation[:fieldset_index]\n unless observation.is_a?( ActionController::Parameters )\n observation = ActionController::Parameters.new( observation )\n end\n\n # If the client is trying to create an observation that already exists,\n # update that observation instead of returning an error. This is meant to\n # handle cases where the client submits a create request, the server\n # receives it, but the client loses its connection before receiving a\n # response. The client then thinks the request was not successful and\n # tries to submit a create request again when it has network. We are not\n # simply returning the existing state of the observation here because the\n # client might have changed its copy of the observation in the interim.\n o = unless observation[:uuid].blank?\n current_user.observations.where( uuid: observation[:uuid] ).first\n end\n # when we add UUIDs to everything and either stop using strings or\n # ensure that everything is lowercase, we can stop doing this\n if o.blank? && !observation[:uuid].blank?\n o = current_user.observations.where( uuid: observation[:uuid].downcase ).first\n end\n\n o ||= Observation.new\n o.assign_attributes(observation_params(observation))\n o.user = current_user\n o.editing_user_id = current_user.id\n o.user_agent = request.user_agent\n unless o.site_id\n o.site = @site || current_user.site\n o.site = o.site.becomes(Site) if o.site\n end\n if doorkeeper_token && (a = doorkeeper_token.application)\n o.oauth_application = a.becomes(OauthApplication)\n elsif ( auth_header = request.headers[\"Authorization\"] ) && ( token = auth_header.split(\" \").last )\n jwt_claims = begin\n ::JsonWebToken.decode(token)\n rescue JWT::DecodeError => e\n nil\n end\n if jwt_claims && ( oauth_application_id = jwt_claims[\"oauth_application_id\"] )\n o.oauth_application_id = oauth_application_id\n end\n end\n\n # We will process the photos if this is really a new observation or if the\n # client actually specified some photos. Without this, there's a\n # significant risk clients will resubmit photos without the local_photos\n # param and we'll assume its absence means the client wants to remove\n # existing photos\n if o.new_record? || !params[:local_photos].blank?\n # Get photos\n # This is kind of double-protection against deleting existing photos\n photos = o.photos\n Photo.subclasses.each do |klass|\n klass_key = klass.to_s.underscore.pluralize.to_sym\n if params[klass_key] && params[klass_key][fieldset_index]\n photos += retrieve_photos(params[klass_key][fieldset_index],\n :user => current_user, :photo_class => klass)\n end\n if params[\"#{klass_key}_to_sync\"] && params[\"#{klass_key}_to_sync\"][fieldset_index]\n if photo = photos.to_a.compact.last\n photo_o = photo.to_observation\n PHOTO_SYNC_ATTRS.each do |a|\n o.send(\"#{a}=\", photo_o.send(a)) if o.send(a).blank?\n end\n end\n end\n end\n photo = photos.compact.last\n if o.new_record? && photo && photo.respond_to?(:to_observation) && !params[:uploader] &&\n (o.observed_on_string.blank? || o.latitude.blank? || o.taxon.blank?)\n photo_o = photo.to_observation\n if o.observed_on_string.blank?\n o.observed_on_string = photo_o.observed_on_string\n o.observed_on = photo_o.observed_on\n o.time_observed_at = photo_o.time_observed_at\n end\n if o.latitude.blank?\n o.latitude = photo_o.latitude\n o.longitude = photo_o.longitude\n end\n o.taxon = photo_o.taxon if o.taxon.blank?\n o.species_guess = photo_o.species_guess if o.species_guess.blank?\n end\n o.photos = ensure_photos_are_local_photos( photos )\n o.will_be_saved_with_photos = true\n end\n\n # Same logic we use for photos: try to avoid deleting sounds if they\n # weren't specified, but make sure we add them for new reocrds\n if o.new_record? || !params[:local_sounds].blank?\n new_sounds = Sound.from_observation_params(params, fieldset_index, current_user)\n o.sounds << ensure_sounds_are_local_sounds( new_sounds )\n end\n\n # make sure the obs get a valid observed_on, needed to determine research grade\n o.munge_observed_on_with_chronic\n o.set_quality_grade\n o\n end\n \n @observations.compact.each do |o|\n o.user = current_user\n # all observations will be indexed later, after all associated records\n # have been created, just before responding\n o.skip_indexing = true\n o.save\n end\n create_project_observations\n update_user_account\n\n # check for errors\n errors = false\n if params[:uploader]\n @observations.compact.each { |obs|\n obs.errors.delete(:project_observations)\n errors = true if obs.errors.any?\n }\n else\n @observations.compact.each { |obs| errors = true unless obs.valid? }\n end\n Observation.elastic_index!(\n ids: @observations.compact.map( &:id ),\n wait_for_index_refresh: params[:force_refresh]\n )\n respond_to do |format|\n format.html do\n unless errors\n flash[:notice] = params[:success_msg] || t(:observations_saved)\n if params[:commit] == t(:save_and_add_another)\n o = @observations.first\n redirect_to :action => 'new', \n :latitude => o.coordinates_obscured? ? o.private_latitude : o.latitude, \n :longitude => o.coordinates_obscured? ? o.private_longitude : o.longitude, \n :place_guess => o.place_guess, \n :observed_on_string => o.observed_on_string,\n :location_is_exact => o.location_is_exact,\n :map_scale => o.map_scale,\n :positional_accuracy => o.positional_accuracy,\n :positioning_method => o.positioning_method,\n :positioning_device => o.positioning_device,\n :project_id => params[:project_id]\n elsif @observations.size == 1\n redirect_to observation_path(@observations.first)\n else\n redirect_to observations_by_login_path( self.current_user.login )\n end\n else\n if @observations.size == 1\n if @project\n @place = @project.place\n @project_curators = @project.project_users.where(\"role IN (?)\", [ProjectUser::MANAGER, ProjectUser::CURATOR])\n @tracking_code = params[:tracking_code] if @project.tracking_code_allowed?(params[:tracking_code])\n @kml_assets = @project.project_assets.select{|pa| pa.asset_file_name =~ /\\.km[lz]$/}\n end\n render :action => 'new'\n else\n render :action => 'edit_batch'\n end\n end\n end\n format.json do\n if errors\n json = if @observations.size == 1 && is_iphone_app_2?\n {:error => @observations.map{|o| o.errors.full_messages}.flatten.uniq.compact.to_sentence}\n else\n {:errors => @observations.map{|o| o.errors.full_messages}}\n end\n render :json => json, :status => :unprocessable_entity\n else\n if @observations.size == 1 && is_iphone_app_2?\n render :json => @observations[0].to_json(\n :viewer => current_user,\n :methods => [:user_login, :iconic_taxon_name],\n :include => {\n :taxon => Taxon.default_json_options\n }\n )\n else\n render :json => @observations.to_json(viewer: current_user,\n methods: [ :user_login, :iconic_taxon_name, :project_observations ])\n end\n end\n end\n end\n end", "def create\n @ocorrencia = Ocorrencia.new(ocorrencia_params)\n\n respond_to do |format|\n if @ocorrencia.save\n format.html { redirect_to @ocorrencia, notice: 'Ocorrencia was successfully created.' }\n format.json { render action: 'show', status: :created, location: @ocorrencia }\n else\n format.html { render action: 'new' }\n format.json { render json: @ocorrencia.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # uri = session[:original_uri]\n # session[:original_uri] = nil\n @association = Association.new(params[:association])\n if params[:association][:date_creation] = Date.today\n @association.date_creation = nil\n end\n @cis = []\n params[:champ_interventions].each_value do |ci|\n ci.each_value do |c|\n @ci = ChampIntervention.find(c)\n @cis << @ci\n end\n end\n if (params[:association][:convention_id] == \"\" && !params[:conv_co].blank?)\n @association.create_convention(:nom => params[:conv_co])\n end\n \n respond_to do |format|\n if @association.save\n @association.champ_interventions << @cis\n flash[:notice] = \"Enregistrement de l'association réussi.\"\n # if uri == inscription_associations_path\n # format.html { redirect_to uri }\n # else\n format.html { redirect_to association_url(@association) }\n format.xml { head :created, :location => association_url(@association) }\n # end\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @association.errors.to_xml }\n end\n end\n end", "def create\n @inventario_cosa = InventarioCosa.new(inventario_cosa_params)\n\n respond_to do |format|\n if @inventario_cosa.save\n format.html { redirect_to @inventario_cosa, notice: 'Inventario cosa was successfully created.' }\n format.json { render :show, status: :created, location: @inventario_cosa }\n else\n format.html { render :new }\n format.json { render json: @inventario_cosa.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cio = Cio.new(cio_params)\n\n respond_to do |format|\n if @cio.save\n format.html { redirect_to @cio, notice: 'Cio cadastrado com sucesso.' }\n format.json { render :show, status: :created, location: @cio }\n else\n format.html { render :new }\n format.json { render json: @cio.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6580022", "0.59739643", "0.5933124", "0.5897493", "0.58806145", "0.5822347", "0.58212626", "0.57831347", "0.5736181", "0.57309073", "0.56444377", "0.56444377", "0.56444377", "0.56296945", "0.5616832", "0.56151754", "0.5592407", "0.55753875", "0.5573222", "0.5563943", "0.555879", "0.55238515", "0.5515861", "0.5515746", "0.55056953", "0.5499667", "0.547133", "0.547133", "0.5425285", "0.5421651", "0.54061097", "0.5394818", "0.5394744", "0.53925914", "0.53921145", "0.53805584", "0.53781635", "0.53755337", "0.5363512", "0.53615147", "0.5359709", "0.53495455", "0.5344158", "0.534127", "0.52794605", "0.52774805", "0.52693504", "0.5263695", "0.5260128", "0.52551436", "0.5233417", "0.5225489", "0.52216506", "0.5219628", "0.5215517", "0.51994795", "0.5198529", "0.519452", "0.5188109", "0.51783264", "0.51780885", "0.5177782", "0.5169456", "0.5168485", "0.51642156", "0.5162877", "0.51555663", "0.5150624", "0.51438886", "0.5141983", "0.51371765", "0.5127334", "0.51258343", "0.5123262", "0.5122786", "0.5122711", "0.5113415", "0.5102972", "0.51012075", "0.5098347", "0.50974065", "0.5094133", "0.50918055", "0.5087281", "0.50829715", "0.50784796", "0.507157", "0.5070264", "0.5069005", "0.50647104", "0.5054697", "0.50546116", "0.5049", "0.5048452", "0.50484174", "0.50463086", "0.5044644", "0.504098", "0.5039628", "0.50375944" ]
0.63343847
1
PATCH/PUT /occasions/1 PATCH/PUT /occasions/1.json
def update # binding.pry;'' @occasion.administrators << User.find(params[:adminstrator]) if params[:adminstrator] respond_to do |format| if @occasion.update(occasion_params) format.html { redirect_to @occasion, notice: 'Occasion was successfully updated.' } format.json { render :show, status: :ok, location: @occasion } else format.html { render :edit } format.json { render json: @occasion.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @occasion.update(occasion_params)\n format.html { redirect_to [:admin, @occasion], notice: 'Occasion was successfully updated.' }\n format.json { render :show, status: :ok, location: @occasion }\n else\n format.html { render :edit }\n format.json { render json: @occasion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @caso.update_attributes(caso_params)\n format.html { redirect_to @caso, notice: 'Caso was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @caso.errors, status: :unprocessable_entity }\n end\n end\n end", "def put!\n request! :put\n end", "def update\n respond_to do |format|\n if @cocoon_example.update(cocoon_example_params)\n format.html { redirect_to @cocoon_example, notice: 'Cocoon example was successfully updated.' }\n format.json { render :show, status: :ok, location: @cocoon_example }\n else\n format.html { render :edit }\n format.json { render json: @cocoon_example.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @caso.update(caso_params)\n format.html { redirect_to @caso, notice: 'Caso was successfully updated.' }\n format.json { render :show, status: :ok, location: @caso }\n else\n format.html { render :edit }\n format.json { render json: @caso.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 respond_to do |format|\n if @special_occasion.update(special_occasion_params)\n format.html { redirect_to @special_occasion, notice: 'Special occasion was successfully updated.' }\n format.json { render :show, status: :ok, location: @special_occasion }\n else\n format.html { render :edit }\n format.json { render json: @special_occasion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # { clinic: {id: references, \"license_id\"=>nil, \"name\"=>string } }\n \n if @clinic.update_attributes(params[:clinic].except(:api_license_id))\n head :no_content\n else\n render json: clinic.errors.full_messages, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @api_v1_initiative.update(api_v1_initiative_params)\n format.html { redirect_to @api_v1_initiative, notice: 'Initiative was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ocat = Ocat.find(params[:id])\n\n respond_to do |format|\n if @ocat.update_attributes(params[:ocat])\n format.html { redirect_to @ocat, notice: 'Ocat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ocat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @socio = Socio.find(params[:id])\n\n respond_to do |format|\n if @socio.update_attributes(params[:socio])\n format.html { redirect_to @socio, :notice => 'Socio atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @socio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_concern.update(api_v1_concern_params)\n format.html { redirect_to @api_v1_concern, notice: 'Concern was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_concern }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_concern.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @colaboration = Colaboration.find(params[:id])\n @colaboration.user_id=current_user.id\n\n respond_to do |format|\n if @colaboration.update_attributes(params[:colaboration])\n format.html { redirect_to @colaboration, notice: 'Colaboracion actualizada exitosamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @colaboration.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @socio_doc_fiscais_coring.update(socio_doc_fiscais_coring_params)\n format.html { redirect_to @socio_doc_fiscais_coring, notice: 'Socio doc fiscais coring was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @socio_doc_fiscais_coring.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end", "def update\n @socio = Socio.find(params[:id])\n\n respond_to do |format|\n if @socio.update_attributes(params[:socio])\n format.html { redirect_to @socio, notice: 'Socio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @socio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @observation = Observation.find(params[:id])\n\n respond_to do |format|\n if @observation.update_attributes(observation_params)\n format.html { redirect_to coral_path(@observation.coral), flash: {success: 'Observation was successfully updated.' } }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @observation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_initiative_update.update(api_v1_initiative_update_params)\n format.html { redirect_to @api_v1_initiative_update, notice: 'Initiative update was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative_update }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative_update.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @socio.update(socio_params)\n format.html { redirect_to @socio, notice: 'Socio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @socio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @complaint = Complaint.find(params[:id])\n\n if @complaint.update_attributes(params[:complaint])\n head :no_content\n else\n render json: @complaint.errors, status: :unprocessable_entity\n end\n end", "def update\n @chronicle = Chronicle.find(params[:id])\n\n respond_to do |format|\n if @chronicle.update_attributes(params[:chronicle])\n format.html { redirect_to @chronicle, notice: 'Chronicle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @chronicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @docs_ponto.update(docs_ponto_params)\n format.html { redirect_to :back }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @docs_ponto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @collaboration.update(collaboration_params)\n format.html { redirect_to @collaboration, notice: 'Collaboration was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @collaboration.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def update\n @voc = Voc.find(params[:id])\n @voc.user_id = current_user.id\n respond_to do |format|\n if @voc.update_attributes(params[:voc])\n format.html { redirect_to @voc, notice: 'Voc was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @voc.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cooco.update(cooco_params)\n format.html { redirect_to @cooco, notice: 'Cooco was successfully updated.' }\n format.json { render :show, status: :ok, location: @cooco }\n else\n format.html { render :edit }\n format.json { render json: @cooco.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @opinion = Opinion.find(params[:id])\n\n respond_to do |format|\n if @opinion.update_attributes(params[:opinion])\n format.html { redirect_to @opinion, notice: 'Opinion was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @opinion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @has_ocupation.update(has_ocupation_params)\n format.html { redirect_to @has_ocupation, notice: 'Has ocupation was successfully updated.' }\n format.json { render :show, status: :ok, location: @has_ocupation }\n else\n format.html { render :edit }\n format.json { render json: @has_ocupation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @consorciot.update(consorciot_params)\n format.html { redirect_to @consorciot, notice: 'Consorciot was successfully updated.' }\n format.json { render :show, status: :ok, location: @consorciot }\n else\n format.html { render :edit }\n format.json { render json: @consorciot.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sivic_discipulo.update(sivic_discipulo_params_netested)\n format.html { redirect_to @sivic_discipulo, notice: 'Registro alterado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sivic_discipulo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @fascicle.update(fascicle_params)\n format.html { redirect_to @fascicle, notice: 'Fascicle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @fascicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def update\n @cso = Cso.find(params[:id])\n\n respond_to do |format|\n if @cso.update_attributes(params[:cso])\n format.html { redirect_to @cso, notice: 'Cso was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cso.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @apologetic.update(apologetic_params)\n format.html { redirect_to @apologetic, notice: 'Apologetic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @apologetic.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @jogo.update(jogo_params)\n format.html { redirect_to @jogo, notice: 'Jogo was successfully updated.' }\n format.json { render :show, status: :ok, location: @jogo }\n else\n format.html { render :edit }\n format.json { render json: @jogo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @initiative = Initiative.find(params[:id])\n \n respond_to do |format|\n if @initiative.update_attributes(params[:initiative])\n \n format.html { redirect_to @initiative, notice: 'Initiative was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @initiative.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @callout.update(callout_params)\n format.html { redirect_to @callout, notice: 'Callout was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @callout.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @orderable_concept = OrderableConcept.find(params[:id])\n\n respond_to do |format|\n if @orderable_concept.update_attributes(params[:orderable_concept])\n format.html { redirect_to @orderable_concept, notice: 'Orderable concept was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @orderable_concept.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch!\n request! :patch\n end", "def update\n respond_to do |format|\n if @cof.update(cof_params)\n format.html { redirect_to :back }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cof.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @opcao.update(opcao_params)\n format.html { redirect_to @opcao, notice: 'Opcao atualizada com sucesso!' }\n format.json { render :show, status: :ok, location: @opcao }\n else\n format.html { render :edit }\n format.json { render json: @opcao.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @occasion = Occasion.find(params[:id])\n @ocats = Ocat.all\n @gift_types = GiftType.all\n\n params[:occasion][:price_min] = params[:occasion][:price_min].gsub('$','').to_d * 100\n params[:occasion][:price_max] = params[:occasion][:price_max].gsub('$','').to_d * 100\n respond_to do |format|\n if @occasion.update_attributes(params[:occasion])\n format.html {\n flash[:success] = 'Occasion was successfully updated.'\n redirect_to @occasion \n }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @occasion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @opinion.update(opinion_params)\n format.html { redirect_to @opinion, notice: 'Opinion was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @opinion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @capitol.update(capitol_params)\n format.html { redirect_to root_path, notice: 'Capitol was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @capitol.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @observance.update(observance_params)\n format.html { redirect_to @observance, notice: 'Observance was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @observance.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @coche.update(coche_params)\n format.html { redirect_to @coche, notice: 'Coche was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @coche.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @opnion.update(opnion_params)\n format.html { redirect_to @opnion, notice: 'Opnion was successfully updated.' }\n format.json { render :show, status: :ok, location: @opnion }\n else\n format.html { render :edit }\n format.json { render json: @opnion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "def update\n @veiculo = Veiculo.find(params[:id])\n\n respond_to do |format|\n if @veiculo.update_attributes(params[:veiculo])\n format.html { redirect_to @veiculo, :notice => 'Veiculo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @veiculo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cog.update(cog_params)\n format.html { redirect_to @cog, notice: 'Cog was successfully updated.' }\n format.json { render :show, status: :ok, location: @cog }\n else\n format.html { render :edit }\n format.json { render json: @cog.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @colegio = Colegio.find(params[:id])\n\n respond_to do |format|\n if @colegio.update_attributes(params[:colegio])\n format.html { redirect_to @colegio, notice: 'El Colegio fue actualizado satisfactoriamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @colegio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @socio.update(socio_params)\n format.html { redirect_to @socio, notice: 'Socio modificado com sucesso.' }\n format.json { render :show, status: :ok, location: @socio }\n else\n format.html { render :edit }\n format.json { render json: @socio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ocorrencia.update(ocorrencia_params)\n format.html { redirect_to @ocorrencia, notice: 'Ocorrencia was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ocorrencia.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #Finding the specific chore where the id matches the one we pass in with the body\n @v1_chore = Chore.where(id: params[:id]).first\n #Here we're checking if we have user_id in our body, and if we do, we'll change the selected chore's properties\n #with the parameters of the body, we go through the specific group to our specific chore with the path\n if v1_chore_params[:user_id]\n @v1_chore.user_id = params[:user_id]\n @v1_chore.assigned = true\n if @v1_chore.save\n render :show, status: :ok\n end\n else\n render json: @v1_chore.errors, status: :unprocessable_entity\n end\n end", "def update\n @curso = Curso.find(params[:id])\n\n respond_to do |format|\n if @curso.update_attributes(params[:curso])\n format.html { redirect_to(:back) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @curso.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @couch.update(couch_params)\n format.html { redirect_to @couch, notice: 'Couche was successfully updated.' }\n format.json { render :show, status: :ok, location: @couch }\n else\n format.html { render :edit }\n format.json { render json: @couch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @oase = Oasis.find(params[:id])\n\n respond_to do |format|\n if @oase.update_attributes(params[:oase])\n format.html { redirect_to @oase, notice: 'Oasis was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @oase.errors, status: :unprocessable_entity }\n end\n end\n end", "def http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\n end", "def update\n @consumo = Consumo.find(params[:id])\n\n respond_to do |format|\n if @consumo.update_attributes(params[:consumo])\n format.html { redirect_to @consumo.cliente, :notice => 'Consumo alterado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @consumo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @opinion.update(opinion_params)\n format.html { redirect_to opinions_path, notice: 'Opinion was successfully updated.' }\n format.json { render :show, status: :ok, location: @opinion }\n else\n format.html { render :edit }\n format.json { render json: @opinion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @assessment_info.update(assessment_info_params)\n format.html { redirect_to edit_concept_url(@assessment_info.concept_id), notice: 'assessment_info was successfully updated.' }\n format.json { render :show, status: :ok, location: @assessment_info }\n else\n format.html { render :edit }\n format.json { render json: @assessment_info.errors, status: :unprocessable_entity }\n end\n end\nend", "def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end", "def update\n respond_to do |format|\n if @operation.update(operation_params)\n format.html { redirect_to @operation, notice: 'Operation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @operation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t respond_to do |format|\n\t\t if @convention.update(convention_params)\n\t\t\t format.html { redirect_to @convention, notice: 'Convention was successfully updated.' }\n\t\t\t format.json { head :no_content }\n\t\t else\n\t\t\t format.html { render action: 'edit' }\n\t\t\t format.json { render json: @convention.errors, status: :unprocessable_entity }\n\t\t end\n\t end\n end", "def update\n @osoba = Osoba.find(params[:id])\n\n if @osoba.update(params[:osoba])\n head :no_content\n else\n render json: @osoba.errors, status: :unprocessable_entity\n end\n end", "def update\n @opinionable = find_opinionable\n #@portfolio = Portfolio.find(params[:portfolio_id])\n @opinion = @opinionable.opinions.find(params[:id])\n\n\n\n respond_to do |format|\n if @opinion.update_attributes(params[:opinion])\n format.html { redirect_to [@opinionable,@opinion], notice: 'Opinion was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @opinion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @circle = Circle.find(params[:id])\n\n respond_to do |format|\n if @circle.update_attributes(params[:circle])\n format.html { redirect_to @circle, :notice => 'Circle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @circle.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @operation = Operation.find(params[:id])\n\n respond_to do |format|\n if @operation.update_attributes(operation_params)\n format.html { redirect_to @operation, notice: 'Operation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @operation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cephalopod.update(cephalopod_params)\n format.html { redirect_to @cephalopod, notice: 'Cephalopod was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cephalopod.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @coyote.update(coyote_params)\n format.html { redirect_to @coyote, notice: 'Coyote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @coyote.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @circle = Circle.find(params[:id])\n\n respond_to do |format|\n if @circle.update_attributes(params[:circle])\n format.html { redirect_to @circle, notice: 'Circle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @circle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @circle = Circle.find(params[:id])\n\n respond_to do |format|\n if @circle.update_attributes(params[:circle])\n format.html { redirect_to @circle, notice: 'Circle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @circle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @interesting = Interesting.find(params[:id])\n\n respond_to do |format|\n if @interesting.update_attributes(params[:interesting])\n format.html { redirect_to @interesting, notice: 'Interesting was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interesting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cto.update(cto_params)\n format.html { redirect_to @cto, notice: 'Cto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :update, Concepto\n if params[:concepto][:tipo_ids]\n params[:concepto][:tipo_ids] = params[:concepto][:tipo_ids].map { |k, _v| k }\n else\n params[:concepto][:tipo_ids] = []\n end\n\n respond_to do |format|\n if @concepto.update(concepto_params)\n\n\n format.html { redirect_to @concepto, notice: '<i class=\"fa fa-check-square fa-lg\"></i> Los datos del concepto fueron actualizados exitosamente.' }\n format.json { render :show, status: :ok, location: @concepto }\n else\n format.html { render :edit } if params[:concepto][:tipo_ids]\n format.json { render json: @concepto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @colaborador.update(colaborador_params)\n format.html { redirect_to @colaborador, notice: 'Colaborador atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @colaborador.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @factoid = Factoid.find(params[:id])\n\n respond_to do |format|\n if @factoid.update_attributes(params[:factoid])\n format.html { redirect_to @factoid, notice: 'Factoid was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @factoid.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @golf_cource = GolfCource.find(params[:id])\n\n respond_to do |format|\n if @golf_cource.update_attributes(params[:golf_cource])\n format.html { redirect_to scaffold_golf_cource_url(@golf_cource), notice: 'Golf cource was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @golf_cource.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @inventario_cosa.update(inventario_cosa_params)\n format.html { redirect_to @inventario_cosa, notice: 'Inventario cosa was successfully updated.' }\n format.json { render :show, status: :ok, location: @inventario_cosa }\n else\n format.html { render :edit }\n format.json { render json: @inventario_cosa.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(*args)\n request :put, *args\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def update\n @concept = Concept.find(params[:id])\n\n respond_to do |format|\n if @concept.update_attributes(params[:concept])\n format.html { redirect_to @concept, notice: 'Concept was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @concept.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @concept = Concept.find(params[:id])\n\n respond_to do |format|\n if @concept.update_attributes(params[:concept])\n format.html { redirect_to @concept, notice: 'Concept was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @concept.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @coconut1.update(coconut1_params)\n format.html { redirect_to @coconut1, notice: 'Coconut1 was successfully updated.' }\n format.json { render :show, status: :ok, location: @coconut1 }\n else\n format.html { render :edit }\n format.json { render json: @coconut1.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @contract_document.update(contract_document_params)\n format.html { redirect_to @contract_document, notice: 'Contract document was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @contract_document.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 respond_with []\n end", "def update\n @icome = Icome.find(params[:id])\n\n respond_to do |format|\n if @icome.update_attributes(params[:icome])\n format.html { redirect_to @icome, notice: 'Icome was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @icome.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @selecao = Selecao.find(params[:id])\n\n respond_to do |format|\n if @selecao.update_attributes(params[:selecao])\n format.html { redirect_to @selecao, notice: 'Selecao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @selecao.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @scoop.update(scoop_params)\n format.html { redirect_to scoops_path, notice: 'Scoop was successfully updated!' }\n format.json { render :show, status: :ok, location: @scoop }\n else\n format.html { render :edit }\n format.json { render json: @scoop.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @curso.update(curso_params)\n format.html { redirect_to @curso, notice: 'Curso foi atualizado(a) com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @curso.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @coisa = Coisa.find(params[:id])\n\n respond_to do |format|\n if @coisa.update_attributes(params[:coisa])\n format.html { redirect_to @coisa, :notice => 'Coisa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @coisa.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update # PATCH\n raise NotImplementedError\n end", "def update\n respond_to do |format|\n if @concept.update(concept_params)\n format.html { redirect_to @concept, notice: 'Concept was successfully updated.' }\n format.json { render :show, status: :ok, location: @concept }\n else\n format.html { render :edit }\n format.json { render json: @concept.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @competence.update(competence_params)\n format.html { redirect_to '/profile#addMoreCompetences', notice: t('competences_controller.competences_update_success') }\n format.json { render :show, status: :ok, location: @competence }\n else\n format.html { render :edit }\n format.json { render json: @competence.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @caixa = Caixa.find(params[:id])\n\n respond_to do |format|\n if @caixa.update_attributes(params[:caixa])\n format.html { redirect_to @caixa, notice: 'Caixa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @caixa.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @octopus.update(octopus_params)\n format.html { redirect_to octopi_path, notice: 'Octopus was successfully updated.' }\n format.json { render :show, status: :ok, location: @octopus }\n else\n format.html { render :edit }\n format.json { render json: @octopus.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @copenometro.update(copenometro_params)\n format.html { redirect_to @copenometro, notice: 'Copenometro was successfully updated.' }\n format.json { render :show, status: :ok, location: @copenometro }\n else\n format.html { render :edit }\n format.json { render json: @copenometro.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @container = Container.find(params[:id])\n\n respond_to do |format|\n if @container.update_attributes(params[:container])\n format.html { redirect_to @container, notice: 'Container was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @container.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.64334255", "0.6287415", "0.6089985", "0.6081071", "0.60672766", "0.6057375", "0.604669", "0.60274106", "0.5962633", "0.5942738", "0.59233224", "0.5907099", "0.5882173", "0.5873645", "0.58598685", "0.58566904", "0.58442634", "0.5839892", "0.58156776", "0.5813197", "0.5803813", "0.5801272", "0.579942", "0.57990825", "0.57982695", "0.57966864", "0.57876724", "0.578562", "0.5773112", "0.57715064", "0.5766923", "0.5766451", "0.5760926", "0.5755997", "0.5755967", "0.5755206", "0.57505107", "0.57504225", "0.5743255", "0.5738972", "0.5738308", "0.5737773", "0.57362187", "0.5730511", "0.57287294", "0.5726071", "0.57197076", "0.571922", "0.57170093", "0.571377", "0.5713524", "0.57031685", "0.5685051", "0.56819814", "0.56755835", "0.5671386", "0.5668183", "0.5665567", "0.56618464", "0.5658645", "0.5655619", "0.56537867", "0.56537867", "0.5652491", "0.56519496", "0.564648", "0.56460947", "0.5641726", "0.5636983", "0.56353635", "0.5635051", "0.5629021", "0.562819", "0.562819", "0.562803", "0.5627095", "0.56206423", "0.56193554", "0.5615497", "0.5609376", "0.5607301", "0.56063926", "0.56011194", "0.55982155", "0.55982155", "0.5597913", "0.55954015", "0.55944926", "0.5592096", "0.5590478", "0.55823404", "0.55809385", "0.5579405", "0.55793846", "0.55762714", "0.5574593", "0.5573482", "0.5573394", "0.5572479", "0.55722356", "0.55707" ]
0.0
-1
DELETE /occasions/1 DELETE /occasions/1.json
def destroy @occasion.destroy respond_to do |format| format.html { redirect_to occasions_url, notice: 'Occasion was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @occasion = Occasion.find(params[:id])\n @occasion.destroy\n\n respond_to do |format|\n format.html { redirect_to occasions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @occasion.destroy\n respond_to do |format|\n format.html { redirect_to admin_occasions_url, notice: 'Occasion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @caso.destroy\n respond_to do |format|\n format.html { redirect_to casos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @socio = Socio.find(params[:id])\n @socio.destroy\n\n respond_to do |format|\n format.html { redirect_to socios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @socio = Socio.find(params[:id])\n @socio.destroy\n\n respond_to do |format|\n format.html { redirect_to socios_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @socio_doc_fiscais_coring.destroy\n respond_to do |format|\n format.html { redirect_to socio_doc_fiscais_corings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @colegio = Colegio.find(params[:id])\n @colegio.destroy\n\n respond_to do |format|\n format.html { redirect_to colegios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @special_occasion.destroy\n respond_to do |format|\n format.html { redirect_to special_occasions_url, notice: 'Special occasion was successfully destroyed.' }\n format.json { head :no_content }\n end\n\n end", "def destroy\n @has_ocupation.destroy\n respond_to do |format|\n format.html { redirect_to has_ocupations_url, notice: 'Has ocupation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ocat = Ocat.find(params[:id])\n @ocat.destroy\n\n respond_to do |format|\n format.html { redirect_to ocats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @voc = Voc.find(params[:id])\n @voc.destroy\n\n respond_to do |format|\n format.html { redirect_to vocs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @socio.destroy\n respond_to do |format|\n format.html { redirect_to socios_url }\n format.json { head :no_content }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @curso.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @caso.destroy\n respond_to do |format|\n format.html { redirect_to casos_url, notice: 'Caso was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @cocoon_example.destroy\n respond_to do |format|\n format.html { redirect_to cocoon_examples_url, notice: 'Cocoon example was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @colaboration = Colaboration.find(params[:id])\n @colaboration.destroy\n\n respond_to do |format|\n format.html { redirect_to colaborations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @docs_ponto.destroy\n respond_to do |format|\n format.html { redirect_to docs_pontos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @consorciot.destroy\n respond_to do |format|\n format.html { redirect_to consorciots_url, notice: 'Consorciot was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @v1_chore = Chore.where(id: params[:id])\n if @v1_chore.destroy\n head(:ok)\n else\n head(:unprocessable_entity)\n end\n end", "def destroy\n @opinion = Opinion.find(params[:id])\n @opinion.destroy\n\n respond_to do |format|\n format.html { redirect_to opinions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @opinion = Opinion.find(params[:id])\n @opinion.destroy\n\n respond_to do |format|\n format.html { redirect_to opinions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ocupacion.destroy\n respond_to do |format|\n format.html { redirect_to ocupacions_url, notice: 'Ocupacion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @couch.destroy\n respond_to do |format|\n format.html { redirect_to couches_url, notice: 'Couche was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end", "def destroy\n @cso = Cso.find(params[:id])\n @cso.destroy\n\n respond_to do |format|\n format.html { redirect_to csos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @consumo = Consumo.find(params[:id])\n @consumo.destroy\n\n respond_to do |format|\n format.html { redirect_to consumos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @retroaspecto = Retroaspecto.find(params[:id])\n @retroaspecto.destroy\n\n respond_to do |format|\n format.html { redirect_to retroaspectos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @oase = Oasis.find(params[:id])\n @oase.destroy\n\n respond_to do |format|\n format.html { redirect_to oases_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @observance.destroy\n respond_to do |format|\n format.html { redirect_to observances_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cephalopod.destroy\n respond_to do |format|\n format.html { redirect_to cephalopods_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @coche.destroy\n respond_to do |format|\n format.html { redirect_to coches_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @explaination = Explaination.find(params[:id])\n @explaination.destroy\n\n respond_to do |format|\n format.html { redirect_to explainations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @couch.destroy\n respond_to do |format|\n format.html { redirect_to couches_url, notice: 'Couch was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @socio.destroy\n respond_to do |format|\n format.html { redirect_to socios_url, notice: 'Socio removido com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @observacao_vocacionada = ObservacaoVocacionada.find(params[:id])\n @observacao_vocacionada.destroy\n\n respond_to do |format|\n format.html { redirect_to observacao_vocacionadas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @socioeconomic.destroy\n respond_to do |format|\n format.html { redirect_to socioeconomics_url, notice: 'Socioeconomic was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @opinion.destroy\n respond_to do |format|\n format.html { redirect_to opinions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @apologetic.destroy\n respond_to do |format|\n format.html { redirect_to apologetics_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @story.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @fascicle.destroy\n respond_to do |format|\n format.html { redirect_to fascicles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @agronomiaquimica = Agronomiaquimica.find(params[:id])\n @agronomiaquimica.destroy\n\n respond_to do |format|\n format.html { redirect_to agronomiaquimicas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sivic_discipulo.destroy\n respond_to do |format|\n format.html { redirect_to sivic_discipulos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @odontologia1 = Odontologia1.find(params[:id])\n @odontologia1.destroy\n\n respond_to do |format|\n format.html { redirect_to odontologia1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cict.destroy\n respond_to do |format|\n format.html { redirect_to cicts_url }\n format.json { head :no_content }\n end\n end", "def delete\n request(:delete)\n end", "def destroy\n @contraindication.destroy\n respond_to do |format|\n format.html { redirect_to contraindications_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @trein_consul_comercial.destroy\n respond_to do |format|\n format.html { redirect_to trein_consul_comercials_url }\n format.json { head :no_content }\n end\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def destroy\n @ocorrencia.destroy\n respond_to do |format|\n format.html { redirect_to ocorrencias_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @confection.destroy\n respond_to do |format|\n format.html { redirect_to confections_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @asociado = Asociado.find(params[:id])\n @asociado.destroy\n\n respond_to do |format|\n format.html { redirect_to asociados_url }\n format.json { head :ok }\n end\n end", "def destroy\n @aucrecord.destroy\n respond_to do |format|\n format.html { redirect_to aucrecords_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @chronicle.destroy\n respond_to do |format|\n format.html { redirect_to chronicles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @areco = Areco.find(params[:id])\n @areco.destroy\n\n respond_to do |format|\n format.html { redirect_to arecos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @occurence.destroy\n respond_to do |format|\n format.html { redirect_to occurences_url, notice: 'Occurence was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @example.destroy\n respond_to do |format|\n format.html { redirect_to examples_url, notice: 'Operação realizada com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @convention.destroy\n respond_to do |format|\n format.html { redirect_to conventions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @occasion.destroy\n end", "def destroy\n @cage.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def destroy\n @socioeconomic_study = SocioeconomicStudy.find(params[:id])\n @socioeconomic_study.destroy\n\n respond_to do |format|\n format.html { redirect_to socioeconomic_studies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ca = Ca.find(params[:id])\n @ca.destroy\n\n respond_to do |format|\n format.html { redirect_to cas_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @sivic_contabanco.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_contabancos_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @respuesta = Respuesta.find(params[:id])\n @respuesta.destroy\n\n respond_to do |format|\n format.html { redirect_to respuestas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @anything.destroy\n respond_to do |format|\n format.html { redirect_to anythings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @coconut1.destroy\n respond_to do |format|\n format.html { redirect_to coconut1s_url, notice: 'Coconut1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @content_condo = ContentCondo.find(params[:id])\n @content_condo.destroy\n\n respond_to do |format|\n format.html { redirect_to content_condos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n # @observation = Observation.find(params[:id])\n # @observation.destroy\n\n @coral = Coral.find(params[:coral_id])\n @observation = @coral.observations.find(params[:id])\n @observation.destroy\n # redirect_to coral_path(@coral)\n \n respond_to do |format|\n format.html { redirect_to coral_path(@coral) }\n format.json { head :no_content }\n end\n end", "def destroy\n @orphan.destroy\n respond_to do |format|\n format.html { redirect_to orphans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @observations.destroy\n respond_to do |format|\n format.html { redirect_to observations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @competency.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @ca.destroy\n respond_to do |format|\n format.html { redirect_to cas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @datoscontacto = Datoscontacto.find(params[:id])\n @datoscontacto.destroy\n\n respond_to do |format|\n format.html { redirect_to datoscontactos_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Company.delete(params[\"id\"])\n end", "def destroy\n @consensu = Consensu.find(params[:id])\n @consensu.destroy\n\n respond_to do |format|\n format.html { redirect_to consensus_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cio.destroy\n respond_to do |format|\n format.html { redirect_to cios_url, notice: 'Cio excluido.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @concurso = Concurso.find(params[:id])\n @concurso.destroy\n\n respond_to do |format|\n format.html { redirect_to concursos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @curso.destroy\n respond_to do |format|\n format.html { redirect_to cursos_url }\n format.json { head :no_content }\n end\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def destroy\n @section.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @idiom = Idiom.find(params[:id])\n @idiom.destroy\n\n respond_to do |format|\n format.html { redirect_to idioms_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @callout.destroy\n respond_to do |format|\n format.html { redirect_to callouts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ocupation.destroy\n respond_to do |format|\n format.html { redirect_to ocupations_url, notice: 'Ocupation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @occurrence.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Occurrence was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @chemical_substance.destroy\n respond_to do |format|\n format.html { redirect_to chemical_substances_url, notice: 'Sustancia Quimica fue eliminada de forma exitosa.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @cto.destroy\n respond_to do |format|\n format.html { redirect_to ctos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mystic.destroy\n respond_to do |format|\n format.html { redirect_to mystics_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cosmetic.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Cosmetic was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @one = One.find(params[:id])\n @one.destroy\n\n respond_to do |format|\n format.html { redirect_to ones_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @relogio = Relogio.find(params[:id])\n @relogio.destroy\n\n respond_to do |format|\n format.html { redirect_to relogios_url }\n format.json { head :ok }\n end\n end", "def destroy\n @cooco.destroy\n respond_to do |format|\n format.html { redirect_to coocos_url, notice: 'Cooco was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @exprience = Exprience.find(params[:id])\n @exprience.destroy\n\n respond_to do |format|\n format.html { redirect_to expriences_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.74619406", "0.717632", "0.6953965", "0.6805877", "0.6805877", "0.67915905", "0.6772811", "0.6764485", "0.6761373", "0.67551094", "0.67510015", "0.6746758", "0.67355454", "0.6722409", "0.6721993", "0.6720928", "0.67192477", "0.67051435", "0.66965383", "0.6686966", "0.668549", "0.6682881", "0.6682881", "0.667579", "0.6672867", "0.6655924", "0.66548955", "0.6645462", "0.6644132", "0.66433954", "0.6641775", "0.66415435", "0.6638493", "0.66342187", "0.6630741", "0.6630706", "0.6628407", "0.662585", "0.6625689", "0.66216916", "0.6618435", "0.66116345", "0.6607931", "0.6604303", "0.66025215", "0.6601939", "0.66016215", "0.6600106", "0.65998334", "0.6598319", "0.65973014", "0.65973014", "0.6588733", "0.65881336", "0.6584269", "0.6579816", "0.65760326", "0.65725636", "0.65717906", "0.65710366", "0.6570684", "0.65679854", "0.656781", "0.6566063", "0.6564749", "0.6564654", "0.65643513", "0.6562111", "0.6562108", "0.655795", "0.6551335", "0.6548622", "0.6548188", "0.65446395", "0.65437126", "0.6542996", "0.65396357", "0.6538763", "0.6538725", "0.65335107", "0.653269", "0.65319306", "0.65311855", "0.6528199", "0.6528199", "0.6528199", "0.6528199", "0.6527734", "0.6526661", "0.6526215", "0.6526106", "0.6525216", "0.6518997", "0.6517082", "0.65147424", "0.65093356", "0.6509076", "0.6505237", "0.65024805", "0.6502065" ]
0.7194895
1
Use callbacks to share common setup or constraints between actions.
def set_occasion @occasion = Occasion.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 occasion_params params.require(:occasion).permit(:name, :date, :time) 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
seleccionar los bloques del doctor
def block @bloques = AttentionBlock.find_by_sql("select * from attention_blocks ab where ab.doctor_id = '#{params[:doctor_id]}' and ab.AB_AVAILABLE = true") @specs = Specialty.find_by_sql("select * from specialties") @doc_id = params[:doctor_id] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_list; end", "def cb_charged\n if combo_main.active==0 then\n cb_newPark\n else\n #Vidage des frames\n framePan.each{|child| framePan.remove(child)}\n framePar.each{|child| framePar.remove(child)}\n\n #Recuperation des vues panneau et parking utile\n nomPark =self.combo_main.active_text\n builder.get_object(\"label_nomPark1\").text=nomPark\n vues=self.ctrl.get_park_views nomPark #Recup des \n\n #Ajout des vues\n framePar.add_child(builder,vues[0],nil)\n framePan.add_child(builder,vues[1],nil)\n\n #Mise a jour des info du parking affichés\n _change_park_property(self.ctrl.get_park_info nomPark)\n end\n #Show all\n @window.show_all\n end", "def select_tiporelacion\n [ \n [\"BENEFICIARIO\",\"BENEFICIARIO\"],\n [\"INTEGRANTE\",\"INTEGRANTE\"],\n [\"PROPIETARIO\",\"PROPIETARIO\"],\n [\"APODERADO\",\"APODERADO\"]\n ] \n end", "def select_hobby_option\n ran_num = rand(2)\n hobby = @chrome_driver.find_elements(:name, \"checkbox_5[]\")\n hobby.each do |hob|\n if hob['value'] == HOBBY_STATUS[ran_num]\n hob.click\n end\n end\n end", "def selecione(ator) \n\t\t\t\t\tfind('.select2-selection--multiple').click #Nesse caso os elementos estão sendo encapsulados dentro do método!\n\t\t\t\t\tfind('.select2-search__field').set ator\n\t\t\t\t\tfind('.select2-results__option').click\n\t\t\t\tend", "def index\n @cuarteles = Cuartel.select(:id, :nombre).order(:nombre)\n\n # Control de los botones activos\n @gu_active = ''\n @rm_active = ''\n @cuarteles_active = 'active'\n end", "def index\n @coleccionables = Coleccionable.all\n end", "def select_accounts\n @accounts = Account.find(:all, :order => \"hizuke DESC\")\n if params[:boy]\n @accounts = Account.find(:all, :conditions=>['boy_id=?',params[:boy]], :order => \"hizuke DESC\")\n end\n end", "def seleccionarCromosomas()\n #p \"--- Empieza el torneo:\"\n seleccion = []\n @tamMatingPool.times do\n competidor1 = @poblacion[Random.rand(@tamPoblacion)]\n competidor2 = @poblacion[Random.rand(@tamPoblacion)]\n evaluarCromosoma(competidor1)\n evaluarCromosoma(competidor2)\n ganador = competidor1.aptitud > competidor2.aptitud ? \n competidor1 : competidor2\n #p \"--- Ganador: #{ganador.genes}\"\n seleccion.push(ganador)\n end\n return seleccion\n end", "def mostrar_candidatos\n \n puts \" \"\n puts \"Quantidade de votos por candidato\"\n #Buca o candidato em seu array\n for candidato in @candidato\n candidato.mostrar_dados \n end \n end", "def select_list\n require 'pashua'\n include Pashua\n\n config = \"\n *.title = personal time tracker\n cb.type = combobox\n cb.completion = 2\n cb.width = 400\n cb.default = surfing\n cb.tooltip = Choose from the list\n db.type = cancelbutton\n db.label = Cancel\n db.tooltip = Closes this window without taking action\" + \"\\n\"\n\n # insert list of all choices\n cust = get_custom_cats || []\n cat = (cust ? cust + Categories : Categories)\n cat.each { |c| config << \"cb.option = #{c}\\n\" }\n pagetmp = pashua_run config\n exit if pagetmp['cancel'] == 1 || pagetmp['cb'] == nil\n\n choice = pagetmp['cb'].strip\n notify_change(choice)\n log(choice)\n\n unless cat.index(choice)\n cust << choice\n write_custom_cats(cust)\n end\nend", "def metodos_con(letras,*clase) # puede ser metodos de una clase, una lista de clases, o una lista de metodos\n if not clase.none? # si no hay parametros busca en los metodos_observados\n self.get_metodos_de(clase) # aca los setea en @metodos_observados\n end\n @metodos_observados.select{|metodo| metodo[0..letras.size].include? letras}\n end", "def index\n @coleccion = DetallePedido.all\n end", "def show\n @daicho = Daicho.find(params[:id])\n\n\n b01 = Daicho.find(:all).map{ |i| i.boy } #boys in daichos\n b02 = current_user.staff.boys #boys cared by current_user\n b03 = b02 & b01 #union of arrey b01 and b02\n @options_for_boy = b03.map{|k| [k.name, k.id] } #used in selection dropdown\n \n #\n @guardians = @daicho.boy.guardians\n @guardian_ids = @guardians.map{|i| i.id}\n @guardians = Guardian.find(:all).select {|i| @guardian_ids.include?(i.id) } \n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @daicho }\n end\n end", "def choose_from_list(question, list)\n ui.choose_from_list question, list\n end", "def envia_taxones_seleccionados\n end", "def select_hobby_option(hobby)\n # Consider something like a case statement and check the selenium selected? method\n case hobby.downcase\n when 'dance'\n @chrome_driver.find_elements(:name, HOBBY_STATUS)[0].click\n when 'reading'\n @chrome_driver.find_elements(:name, HOBBY_STATUS)[1].click\n when 'cricket'\n @chrome_driver.find_elements(:name, HOBBY_STATUS)[2].click\n end\n end", "def datat_select\n \n #Global variable to contain selected data from the csv file\n $blueberry=[]\n \n #This loop selects specific information from the data\n #Specifically we select the Box Code, Box ID and product description\n @@datat_array.each do |fruit|\n rasberry =[]\n #Select Box ID\n strawberry = fruit[0]\n \n #Convert Box ID into a barcode by inserting zeros on the front\n until strawberry.length > 11 do\n strawberry.insert(0,'0')\n end\n #Add the barcode generated from the id to the database\n rasberry.push(strawberry)\n #Add the box code to the database\n rasberry.push(fruit[1])\n #Add the box description to the database\n rasberry.push(fruit[4])\n \n #Push to the global database\n $blueberry.push(rasberry)\n end\n \n ################\n #puts $blueberry\n ################\n \n end", "def select_list\n @browser.div(:class => \"select-list\")\n end", "def set_bloqueo\n @bloqueo = Bloqueo.find(params[:id])\n end", "def selecionar_documentos_obrigatorios\n @indice = 0\n\n sleep(0.1)\n\n if (wait_until_tipo_de_ducumentos_checkbox_visible)\n @tamanho_documentos = tipo_de_ducumentos_checkbox.size\n puts \"Quantidade de documentos presentes: #{@tamanho_documentos}\"\n\n while (@indice < @tamanho_documentos)\n sleep(2)\n puts \"Selecionando tipo de documentacao\"\n tipo_de_ducumentos_checkbox[@indice].click\n @indice += 1\n end\n end\n\n if (wait_until_outros_documentos_input_visible)\n @outros_documentos_texto = \"Outra documentacao\"\n puts \"Preenchendo #{@outros_documentos_texto}\"\n sleep(0.2)\n outros_documentos_input.click.set(@outros_documentos_texto)\n adicionar_documento_btn.click\n wait_until_remover_doc_recebidos_img_visible\n sleep(0.1)\n end\n end", "def contact_select_all\n $testCaseID = \"VT229-0015\"\n con_remove\n createContact 20\n puts @contact = Rho::RhoContact.find(:all, :per_page => 5, :offset => 5, :select => [\"id\", \"display_name\", \"first_name\", \"last_name\", \"mobile_number\"])\n puts @contact\n redirect :action => :index\n end", "def set_unidade_bloco_dormitorio\n @unidade_bloco_dormitorio = UnidadeBlocoDormitorio.find(params[:id])\n end", "def select_all\n self.frame(:id=>\"elm1_ifr\").send_keys( [:command, 'a'] )\n end", "def select_bookmarks\n # added changes in both select_current and select_hint\n # However, the age mark that is show is still for the earlier shown forum based on outdated full_data\n # So we need to show age mark based on file datw which means a change in display program !!! At least\n # clear the array full_data\n $mode = \"forum\"\n $title = \"Bookmarks\"\n $files = $bookmarks.values\n\nend", "def list_characters\n puts \"\"\n puts \"-----------------------------------------------\"\n puts \"\"\n puts \"Please select a character number:\"\n puts \"\"\n Api.all_character_data_list_of_names\n list_characters_options\n end", "def select_hobby_option\n # Consider something like a case statement and check the selenium selected? method\n ran_num = rand(2)\n status = @chrome_driver.find_elements(:name, \"checkbox_5[]\")\n status.each do |stat|\n if stat['value'] == HOBBY_STATUS[ran_num]\n stat.click\n return stat.selected?\n end\n end\n end", "def select(aid)\n\t\t\tsend_apdu(\"\\x00\\xA4\\x04\\x00#{aid.size.chr}#{aid}\")\n end", "def choose_club\n require \"tty-prompt\"\n prompt = TTY::Prompt.new\n\n puts \"\\n \\n\"\n\n prompt.select(\"For which club?\", filter: true) do |menu|\n all_clubs.each do |club|\n menu.choice club.name\n end\n end\nend", "def show\n combo_producto\n combo_platillo\n end", "def mostrar_palabras_clave_grupos \n \n puts \"Esta operación puede tardar un poco, le rogamos tenga paciencia por favor.\"\n puts\n puts\n coleccion = @hemeroteca.palabras_clave_grupos \n coleccion.each_index do |i|\n puts \"Grupo #{i+1}:\" \n puts \"---------\"\n puts coleccion[i].join(\", \")\n puts \n puts \n end\n if coleccion.empty? then\n puts \"Lo sentimos, no se han encontrado noticias.\" \n puts\n puts\n end \n \n end", "def set_controles\n @controles= Control.where(area_id: @consulta.ficha_nutricional_adulto.area_id, paciente_id: @consulta.ficha_nutricional_adulto.paciente_id).limit(9).order(id: :desc)\n end", "def select_category\n #Parbauda vai ekrans ir redzams\n @screens.screen_create_filter.visible?\n #Pievieno kategoriju no filtra datiem\n @screens.screen_create_filter.select_row(@filter_data.category)\n end", "def for_dropdown\n ActiveRecord::Base.connection.select_all(\n select('brands.name, brands.id').group('1, 2').order('1').to_sql\n ).map { |r| [r['name'], r['id']] }\n end", "def get_listbox_data\n @countries = current_user.company.countries.dropdown_list\n @sectors = current_user.company.sectors.order(:sector)\n @rel_types = current_user.company.rel_types.dropdown_list\n @relationgroups = current_user.company.relations.dropdown_list\n end", "def select(aid)\n\t\t\tsend_apdu!(\"\\x00\\xA4\\x04\\x00#{aid.size.chr}#{aid}\")\n end", "def select_board_case\n\t\tvalide_choice = 0 # on cree une variable qui vas nous servir de flag pour la boucle, on fera une boucle infini jusqu'a ce que cette variable soit egale a 1\n\n\t\twhile valide_choice == 0\n\t\t\tputs \"Choisisez la case sur laquel vous voulez jouer.\\n Si par exemple vous voulez jouer sur la premiere case ecrivez \\\"A1\\\"\"\n\t\t\tcase_choosed = gets.chomp.upcase # on recupere ca case que l'utilisateur a choisi de jouer et on la met en majuscule (sa permet au joueur de pouvoir selectionner une lettre minuscule)\n\t\t\tif (case_choosed[0] =~ /[A-C]/) != 0 # si le premier caractere n'es pas une lettre entre A et C (regex) on rentre dans la condition\n\t\t\t\tcase_choosed.reverse! # et on inverse la chaine de caractere (comme sa si l'utilisateur a mis 1A alor le programme ici transforme en A1)\n\t\t\tend\n\n\t\t\t# on fait une condition qui test si la case selectionner par l'utilisateur est vide ou pas, si elle a deja ete prise ou que l'utilisateur rentre n'importe quoi alor il vas boucler temp qu'il ne choisi pas une case vide\n\t\t\tif ((case_choosed[0] == 'A' || case_choosed[0] == 'B' || case_choosed[0] == 'C') && (case_choosed[1] == '1' || case_choosed[1] == '2' || case_choosed[1] == '3')) && case_choosed.length == 2 && @board_case.fetch(case_choosed) == \" \"\n\t\t\t\tvalide_choice = 1 # si l'utilisateur remplis toutes les conditions ca veut dire qu'il a selectionner une case valide on lui permet de sortir de la boucle\n\t\t\tend\n\n\t\t\tif !(@board_case.has_value?(\" \")) # si aucune case de notre hash board_case n'es vide alor toute les cases on ete remplie, on permet a l'utilisateur de sortir de la boucle\n\t\t\t\tvalide_choice = 1\n\t\t\tend\n\t\tend\n\t\tmodif_board_case(case_choosed) # on appel la class qui modifie le hash Board_case\n\tend", "def set_coleccionable\n @coleccionable = Coleccionable.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n logger.error \"Intento de accesar a un carro no válido\"\n redirect_to root_url, notice: 'Coleccionable no válido'\n rescue ActiveRecord::StatementInvalid\n logger.error \"Intento de accesar a un carro no válido\"\n redirect_to root_url, notice: 'Coleccionable no válido'\n end", "def competitor_select_box(form, competition, options = {})\n options[:autofocus] = true\n options[:class] = \"chosen-select #{options[:class]}\"\n disabled_ids = options[:disabled_ids]\n form.select :competitor_id, competition.competitors.active.ordered.map { |comp| [\"##{comp.bib_number}-#{comp}\", comp.id] }, { include_blank: true, disabled: disabled_ids }, options\n end", "def select; end", "def select; end", "def set_selecionado\n @selecionado = Selecionado.find(params[:id])\n end", "def select_fan_from_list(my_fans)\n require \"tty-prompt\"\n prompt = TTY::Prompt.new\n\n puts \"\\n \\n\"\n\n prompt.select(\"Here's a list of the players: (you can type the name of the player to filter through the players)\", filter: true) do |menu|\n my_fans.each do |fan|\n menu.choice fan.name\n end\n end\n \nend", "def index\n @coleccion = Caracteristica.all\n end", "def set_leccion_kanji\n @leccion_kanji = LeccionKanji.find(params[:id])\n end", "def selected; end", "def sub_select _value=0\n send_cmd(\"sub_select #{_value}\")\n end", "def select_cards(event)\n for i in 0..11 do\n if event.x>=CARD_POSITION_X[i] && event.x<=CARD_POSITION_X[i]+CARD_WIDTH && event.y>=CARD_POSITION_Y[i] && event.y<=CARD_POSITION_Y[i]+CARD_HEIGHT\n @card_selected[@card_selected.length] = @card_on_table[i] \n if @card_selected == @card_selected.uniq \n @card_selected[@card_selected.length-1].draw_bottom(@card_selected.length-1)\n end\n @card_selected = @card_selected.uniq\n end \n end\n end", "def select\n new_list = TodoList.new(\"Selected Items\")\n\n each do |todo|\n new_list.add(todo) if yield(todo)\n end\n new_list\n end", "def set_recoleccion\n @recoleccion = Recoleccion.find(params[:id])\n end", "def select\n # new_list = TodoList.new(\"Selected Todos\")\n new_list = TodoList.new(title) # should probably keep the original title\n self.each do |todo| # don't need to use 'self.each' here (just use 'each')\n new_list.add(todo) if yield(todo)\n end\n new_list # rtn a TodoList obj\n end", "def select\r\n assert_exists\r\n if(@how == :text)\r\n @select_list.select(@what)\r\n elsif(@how == :value)\r\n @select_list.select_value(@what)\r\n end \r\n end", "def menu\n ([[0, 'Choisir l’icarien…']] + User.values_select(type_icarien => true)).in_my_select(id: 'opuser_user_id', name: 'opuser[user_id]', selected: param_opuser[:user_id])\n end", "def cards(addressbook_id)\n end", "def select_tiposdocumemto\n [\n [\"CARTAS DE PROPIETARIOS SOLICITANDO LA VIVIENDA\",\"CARTAS DE PROPIETARIOS SOLICITANDO LA VIVIENDA\"],\n [\"CARTAS PARA CAMBIO DE VIVIENDA\",\"CARTAS PARA CAMBIO DE VIVIENDA\"],\n [\"CARTAS RECIBIDAS PARA SOLICITUD DE AUMENTO DE CANON\",\"CARTAS RECIBIDAS PARA SOLICITUD DE AUMENTO DE CANON\"],\n [\"DOCUMENTACION DE TENENCIA DE VIVIENDA EVACUADA\",\"DOCUMENTACION DE TENENCIA DE VIVIENDA EVACUADA\"],\n [\"DOCUMENTACION DE VIVIENDA PARA ARRENDAR POR PRIMERA VEZ\",\"DOCUMENTACION DE VIVIENDA PARA ARRENDAR POR PRIMERA VEZ\"],\n [\"DOCUMENTACION DE VIVIENDAS DISPONIBLES\",\"DOCUMENTACION DE VIVIENDAS DISPONIBLES\"],\n [\"DOCUMENTACION PARA CAMBIO DE VIVIENDA\",\"DOCUMENTACION PARA CAMBIO DE VIVIENDA\"],\n [\"DOCUMENTOS SOPORTES DE INGRESOS FAMILIARES\",\"DOCUMENTOS SOPORTES DE INGRESOS FAMILIARES\"],\n [\"DOCUMENTOS DE IDENTIDAD DEL GRUPO FAMILIAR\",\"DOCUMENTOS DE IDENTIDAD DEL GRUPO FAMILIAR\"],\n [\"OTROS DOCUMENTOS\",\"OTROS DOCUMENTOS\"],\n [\"PAZ Y SALVOS RECIBIDOS\",\"PAZ Y SALVOS RECIBIDOS\"]\n ]\n end", "def selection(params)\n\n\t self.log << \"Starting selection\"\n\n\t\tsql = \"select distinct subjectid,scan_procedure_id,status_flag from cg_adrc_upload where sent_flag ='N' and status_flag in ('Y','R') \"\n \tresults = @connection.execute(sql)\n\n\t results.each do |row|\n\n\t \tadrc_case = {:subject_id => row[0], :scan_procedure => ScanProcedure.where(:id => row[1]).first}\n\t \tadrc_case[:enumber] = (row[0]).gsub('_v2','').gsub('_v3','').gsub('_v4','').gsub('_v5','').gsub('_v6','').gsub('_v7','')\n\t \tadrc_case[:status_flag] = row[2]\n\n\t \t@selected << adrc_case\n\t end\n\n\t self.log << \"Selection complete\"\n\tend", "def choose_hero\n prompt = TTY::Prompt.new\n names = Cards.all.map {|cards| cards[\"name\"]}\n selected_name = prompt.select('Choose a character', names, filter: true, cycle: true, help: \"(Start typing to filter results)\",help_color: :green, active_color: :yellow)\n hero = Cards.find_by(name: selected_name)\n display_card_details(hero)\n hero\nend", "def index\n @coleccion = Requisito.all\n end", "def abrir_filtro\n wait_until_btn_selecione_visible\n btn_selecione.click\n end", "def select(description, amt)\n hand = Clutch.new() # this new Clutch will store the selection\n\n # iterate over @items in Bag. if item matches the description, add to clutch\n items.each do |item|\n # stop if items added to hand reaches the max amount \n break if hand.items.length == amt\n\n next if description[:item] != nil && description[:item] != item.type\n next if description[:sides] != nil && description[:sides] != item.sides\n next if description[:colour] != nil && description[:colour] != item.colour\n next if description[:denomination] != nil && description[:denomination] != item.denomination\n\n hand.store(item)\n end\n\n # remove all the items we took out the bag from the Bag's @items list\n self.items = self.items - hand.items\n hand\n end", "def index\n @bonificacions = Bonificacion.order(\"@bonificacions.categorium_id\")\n end", "def participants_list_permissions\n @browser.select(:id=>\"addarea_participants_permissions\")\n end", "def index\n @coleccion = Cita.all\n end", "def set_socio_dados_banco\n @socio_dados_banco = SocioDadosBanco.find(params[:id])\n end", "def select_hint view, ch\n # a to y is direct\n # if x or z take a key IF there are those many\n #\n ix = get_index(ch, view.size)\n if ix\n f = view[ix]\n return unless f\n $cursor = $sta + ix\n\n if $mode == 'SEL'\n toggle_select f\n elsif $mode == 'COM'\n run_command f\n elsif $mode == \"forum\"\n display_forum f\n else\n on_enter f\n end\n #selectedix=ix\n end\nend", "def load_Obj\n @grupos = Grupo.all\n @nivels = Nivel.select(:id, :nombre).where(\"nombre != ?\", \"CAPITULO\" )\n# @papa = Catalogo.select(:id, :codigo, :nombre).where(\"estransaccional = ? AND activo = ? \", false, true) \n @ajuste = Catalogo.select(:id, :codigo, :nombre).where(\"estransaccional = ? AND activo = ?\", true, true )\n @laux = Libroauxiliar.select(:id, :descripcion).where(\"activo = ?\", true)\n end", "def anulacion \n @solicitud=Solicitud.find(params[:id])\n @causal_select=CausalesAnulacionRevocatoria.find(:all,:conditions=>\"anulacion=true\",:order=>\"causa asc\")\n @width_layout = '660'\n end", "def form_escolher\n lst_from.select 'London'\n lst_on.select 'December'\n lst_month.select '20'\n lst_arriving.select 'Acapulco'\n lst_returning.select 'October'\n lst_month_returning.select '21'\n check_port.click\n lst_airline.select 'Blue Skies Airlines'\n end", "def dodaj_do_listy(*jid)\n\tkontakty(*jid) do |kontakt|\n\t\tnext if subskryp?(kontakt)\n\t\tkontakt.autoryzacja\n\tend\n end", "def dob_month_list_select\n months = @chrome_driver.find_element(:id, DOB_MONTH_DROPDOWN_LIST)\n options = months.find_elements(:tag_name => 'option')\n options.each do |option|\n if option.text == \"7\"\n option.click\n end\n end\n end", "def index\n @selecionados = Selecionado.all\n end", "def get_button_cans(buid, add_params = nil)\n params = {\n uid: uid,\n buid: buid,\n }\n api_call('/stores/:uid/buttons/:buid/cans(.:format)',:get,params,add_params)\n end", "def set_collection_select\n @facultades = Facultad.all\n @programas = Programa.all\n @grupos = Grupo.all\n @semilleros = Semillero.all\n @investigadores = Investigador.all\n end", "def content_list_permissions\n @browser.select(:id=>\"addarea_contentlist_permissions\")\n end", "def camposDescarga(tipo_descarga=nil)\n checkbox = ''\n campos = { x_tipo_distribucion: 'Tipo de distribución', x_cat_riesgo: 'Categorías de riesgo y comercio internacional', x_ambiente: 'Ambiente', x_nombres_comunes: 'Nombres comunes', x_bibliografia: 'Bibliografía' }\n \n case tipo_descarga\n when 'basica'\n when 'avanzada'\n campos.merge!({ x_col_basicas: 'Columnas basicas', x_taxa_sup: 'Taxonomía superior', x_url_ev: 'URL de la especie en enciclovida' })\n when 'region'\n campos = { x_num_reg: 'Número de registros' }.merge(campos.merge!({ x_col_basicas: 'Columnas basicas', x_taxa_sup: 'Taxonomía superior', x_url_ev: 'URL de la especie en enciclovida' }))\n when 'checklist'\n campos.merge!({ x_estatus: 'Solo válidos/aceptados', x_distribucion: 'Distribución (reportada en literatura)', x_residencia: 'Categoría de residencia (aves)', x_formas: 'Formas de crecimiento (plantas)', x_interaccion: 'Interacciones biológicas' }) \n end\n \n campos.each do |valor, label|\n if valor.to_s == 'x_col_basicas'\n checkbox << check_box_tag('f_desc[]', valor, true, style: 'display: none;', id: \"f_#{tipo_descarga}_#{valor}\")\n else\n checkbox << \"<div class='custom-control custom-switch'>\"\n checkbox << check_box_tag('f_desc[]', valor, false, class: \"custom-control-input\", id: \"f_#{tipo_descarga}_#{valor}\")\n checkbox << \"<label class='custom-control-label' for='f_#{tipo_descarga}_#{valor}'>#{label}</label>\"\n checkbox << \"</div>\"\n end\n\n \n end\n\n checkbox.html_safe\n end", "def index\n @can_bos = CanBo.all\n end", "def select(&block)\n @_componentable_container.select(&block)\n end", "def robo\n #@bicicleta = Bicicletum.find_by ciclista_id: current_user.id\n @bicicleta = Bicicletum.where ([\"bic_estado_robo = 'V'\"])\n #@bicicleta =Bicicletum.all \n end", "def find_contacts_menu\n if session[SELECTED_CONTACTS] == nil\n session[SELECTED_CONTACTS] = []\n end\n @contacts = session[SELECTED_CONTACTS] \n end", "def select_by_id(id_name)\n @browser.select_list(:id, id_name)\nend", "def coleccionable_params\n params.require(:coleccionable).permit(:nombre, :marca, :precio)\n end", "def select_choice_patron\n\tputs \"\\n1 Add a Patron\\n2 Information on a Patron\\n3 Edit a Patron\\n4 Remove a Patron\\n5 View All Patrons\\n6 View All Books a Patron has Checked Out\\n0 Return to Main Menu\"\n\tselect = make_selection\n\n\twhile select != \"1\" && select != \"2\" && select != \"3\" && select != \"4\" && select != \"5\" && select != \"6\" && select != \"0\"\n\t\tputs \"\\nInvalid choice selected\\n\"\t\t \t\t\n\t\tselect = make_selection\n\tend\n\n\tif select == \"1\"\n\t\tadd_patron\n\n\telsif select == \"2\"\n\t\tputs \"\\nTo get information about a patron please enter their ID #\\n\"\n\t\tshow_all_patrons\n\t\tselect = make_selection.to_i\n\t\tselect = verify_patron_exists(select)\n\t\tdisplay_patron(select)\n\n\telsif select == \"3\"\n\t\tputs \"\\nTo edit a patron please enter their ID #\\n\"\n\t\tshow_all_patrons\n\t\tselect = make_selection.to_i\n\t\tselect = verify_patron_exists(select)\n\t\tedit_patron(select)\n\n\telsif select == \"4\"\n\t\tputs \"\\nTo remove a patron please enter their ID #\\n\"\n\t\tshow_all_patrons\n\t\tselect = make_selection.to_i\n\t\tselect = verify_patron_exists(select)\n\t\tremove_patron(select)\n\n\telsif select == \"5\"\n\t\tshow_all_patrons\n\n\telsif select == \"6\"\n\t\tputs \"\\nTo see what books a patron has checked out please enter their ID #\\n\"\n\t\tshow_all_patrons\n\t\tselect = make_selection.to_i\n\t\tselect = verify_patron_exists(select)\n\t\tshow_books_checked_by_patron(select)\n\n\telsif select == \"0\"\n\t\tputs \"\\nNow entering main menu\\n\"\n\n\tend\n\tselect\t\t\nend", "def select_by_name(input)\r\n begin\r\n expand_combo\r\n my_item = list_items.find {|item| item.name == input}\r\n raise Bewildr::NoSuchItemInComboBox if my_item.nil?\r\n my_item.select\r\n ensure\r\n collapse_combo\r\n end\r\n end", "def set_selections( action )\n @sir_groups = Group.active_only.participants_only.collect{ |g| [ g.code_and_label, g.id ]}\n @sir_phases = PhaseCode.all.order( :code ).collect{ |p| [ p.code_and_label, p.id ]}\n end", "def selected_options; end", "def selected_options; end", "def selectors\n find_related_frbr_objects( :is_selected_by, :which_roles?) \n end", "def blood_oaths #<-- blood oath selects all cult members in bloodOath Class file\n BloodOath.all.select { |blood_oath| blood_oath.cult == self}\n end", "def request_select\n end", "def select\n counter = 0\n new_list = TodoList.new(title)\n\n while counter < @todos.length do\n if yield(@todos[counter])\n new_list << @todos[counter]\n end\n counter += 1\n end\n\n new_list\n end", "def seleccion\n case @selection\n when 1\n push_game_state(EnterName.new(callback: method(:enter_name)))\n when 2\n if @token_difficulty.zero?\n @difficulty_message.text = \"Dificultad: #{@difficulty[1]}\"\n @token_difficulty = 1\n @select_sound = 0\n elsif @token_difficulty == 1\n @difficulty_message.text = \"Dificultad: #{@difficulty[2]}\"\n @token_difficulty = 2\n @select_sound = 1\n @sound_tracks_list[@select_sound].play if @music_playing\n else\n @difficulty_message.text = \"Dificultad: #{@difficulty[0]}\"\n @token_difficulty = 0\n @select_sound = 0\n @sound_tracks_list[@select_sound].play if @music_playing\n end\n when 3\n if @music_playing\n @music_message.text = 'Musica: OFF'\n @music_playing = false\n @sound_tracks_list[@select_sound].pause\n else\n @music_message.text = 'Musica: ON'\n @music_playing = true\n @sound_tracks_list[@select_sound].play\n end\n when 4\n push_game_state(Acerca)\n when 5\n exit\n end\n\n end", "def select_all\n buffer_current.select_all\n end", "def set_lista_desejo\n @lista_desejo = ListaDesejo.find(params[:id])\n end", "def set_coleccion_imagene\n @coleccion_imagene = ColeccionImagene.find(params[:id])\n end", "def select_group_loan_for_loan_disbursement \n @office = current_user.active_job_attachment.office\n @disbursable_group_loans = @office.disbursable_group_loans\n end", "def select_by_index(input)\r\n raise \"Index must be 0 or greater\" if input < 0\r\n begin\r\n expand_combo\r\n list_items[input].select\r\n ensure\r\n collapse_combo\r\n end\r\n end", "def setBidireccionalBuddys(userAJid,userBJid,userANick,userBNick,groupForA,groupForB)\n\taddBuddyToRoster(userAJid,userBJid,userBNick,groupForB,\"both\")\n\taddBuddyToRoster(userBJid,userAJid,userANick,groupForA,\"both\")\n\treturn \"Done\"\nend", "def show_books_checked_by_patron(selected)\n\tp = Patron.find_by_id(selected).books\n\tif p == []\n\t\tputs \"\\nNo books currently checked out to #{Patron.find_by_id(selected).name}\\n\"\n\telse\n\t\tputs \"\\n\"\n\t\tp.each do |book|\n\t\t\tputs \"#{Patron.find_by_id(selected).name} currently has #{book.title} checked out.\"\n\t\tend\n\tend\nend", "def doctors\n doctor_list = []\n appointments.select do |doctor|\n doctor_list << doctor.doctor\n end\ndoctor_list\nend", "def dob_month_list_select(month_value)\n mon = @chrome_driver.find_element(:id, DOB_MONTH_DROPDOWN_LIST)\n all_months = mon.find_elements(:tag_name, \"option\")\n all_months.each do |month|\n if month.text == month_value\n month.click\n end\n end\n end" ]
[ "0.57478523", "0.55063057", "0.5487644", "0.542657", "0.53513026", "0.53465444", "0.530209", "0.52631825", "0.5227906", "0.52274173", "0.52016425", "0.51773447", "0.51274294", "0.51186323", "0.5077384", "0.5046778", "0.50313747", "0.5022377", "0.5011475", "0.50044876", "0.49798375", "0.49618542", "0.49451354", "0.4942749", "0.49389133", "0.49310875", "0.4928858", "0.49272346", "0.49228957", "0.4906605", "0.4895492", "0.48929876", "0.4891805", "0.48917764", "0.48915696", "0.48896423", "0.48871592", "0.4881061", "0.4880156", "0.485412", "0.485412", "0.48492876", "0.48459205", "0.48418382", "0.48408517", "0.48367405", "0.483387", "0.48330694", "0.48242387", "0.48232886", "0.48189282", "0.48046646", "0.47927257", "0.47792485", "0.47783604", "0.47760504", "0.4775557", "0.47744074", "0.47719198", "0.47694626", "0.476896", "0.47688603", "0.47643098", "0.47542796", "0.47524887", "0.4747713", "0.47418478", "0.47228602", "0.47145605", "0.47121984", "0.4708582", "0.47005174", "0.4691332", "0.46901968", "0.4681448", "0.46798128", "0.4675354", "0.46703243", "0.46613082", "0.4659923", "0.46578604", "0.4657233", "0.46495494", "0.46485734", "0.46480155", "0.46480155", "0.46452186", "0.46446705", "0.46444577", "0.46430275", "0.46384704", "0.4636852", "0.46349424", "0.46341962", "0.4632092", "0.46300867", "0.46268925", "0.4625814", "0.4617166", "0.46163595" ]
0.5365028
4
omg what have tado done with their apis
def enable_manual_mode(temperature_request) serialized_auth_params = parameterize(auth_params) raw_response = connection.put "/api/v2/homes/#{home_id}/zones/1/overlay?#{serialized_auth_params}", manual_mode_request_params(temperature_request) if raw_response.success? SuccessResponse.new(raw_response.body) else ErrorResponse.new(raw_response.body) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apis; end", "def api; end", "def api; end", "def private; end", "def hidden_apis; end", "def weber; end", "def http; end", "def from_api?; false end", "def api_error; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def preflight; end", "def who_we_are\r\n end", "def parent_api; end", "def parent_api; end", "def get; end", "def api_only; end", "def api_only; end", "def api_only; end", "def hidden_apis=(_arg0); end", "def api_mode; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def apis=(_arg0); end", "def methods; end", "def methods; end", "def methods; end", "def methods; end", "def respond(); end", "def fetch; end", "def fetch; end", "def suivre; end", "def probers; end", "def methods() end", "def refutal()\n end", "def romeo_and_juliet; end", "def endpoint; end", "def endpoint; end", "def endpoint; end", "def endpoint; end", "def villian; end", "def robots; end", "def robots; end", "def operations; end", "def operations; end", "def endpoints; end", "def calls; end", "def calls; end", "def yoda; end", "def service; end", "def wagner; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def internal; end", "def relatorios\n end", "def gounod; end", "def coming_soon\n end", "def coming_soon\n end", "def net_http_res; end", "def prapor_quest; end", "def get()\n \n end", "def zuruecksetzen()\n end", "def api_only=(_); end", "def api_only=(_arg0); end", "def fetch\n end", "def request(*args); end", "def client; end", "def client; end", "def proxies; end", "def strategy; end", "def response_from_service\n\n end", "def get_info\n end", "def get_info\n end", "def get_info\n end", "def request_data; end", "def extra; end", "def get\n end", "def proxy; end", "def proxy; end" ]
[ "0.75494504", "0.69483864", "0.69483864", "0.6594627", "0.6585477", "0.65253437", "0.652246", "0.62826276", "0.62743825", "0.6271566", "0.6271566", "0.6271566", "0.6271566", "0.6271566", "0.6271566", "0.6271566", "0.6271566", "0.6271566", "0.6271566", "0.6271566", "0.6235665", "0.6198362", "0.6166627", "0.6166627", "0.61390895", "0.6133076", "0.6133076", "0.6133076", "0.61091393", "0.60989976", "0.60493314", "0.60493314", "0.60493314", "0.60493314", "0.60314864", "0.6008574", "0.6008574", "0.6008574", "0.6008574", "0.59984964", "0.59938186", "0.59938186", "0.5951867", "0.592579", "0.5914642", "0.5909412", "0.5899185", "0.58961457", "0.58961457", "0.58961457", "0.58961457", "0.58927566", "0.5879251", "0.5879251", "0.5875726", "0.5875726", "0.58485717", "0.58332044", "0.58332044", "0.58274925", "0.58229667", "0.57984257", "0.578846", "0.578846", "0.578846", "0.578846", "0.578846", "0.578846", "0.578846", "0.578846", "0.578846", "0.578846", "0.578846", "0.578846", "0.578846", "0.5788263", "0.5767832", "0.57406574", "0.5735572", "0.5735572", "0.57239896", "0.572298", "0.57037026", "0.5692949", "0.5678037", "0.5662239", "0.564774", "0.5644089", "0.5636639", "0.5636639", "0.56302625", "0.5628883", "0.5617727", "0.5615186", "0.5615186", "0.5615186", "0.56068075", "0.5603529", "0.5597178", "0.5597152", "0.5597152" ]
0.0
-1
getredisproto method mostly taken from redis documentation, with no license noted there.
def getredisproto(*args) proto = [] proto.push("*"+args.length.to_s+"\r\n") args.each{|arg| proto.push("$"+arg.to_s.bytesize.to_s+"\r\n") proto.push(arg.to_s+"\r\n") } proto end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_redis_proto(*cmd)\n proto = \"\"\n proto << \"*\" + cmd.length.to_s + \"\\r\\n\"\n cmd.each do |arg|\n proto << \"$\" + arg.to_s.bytesize.to_s + \"\\r\\n\"\n proto << arg.to_s + \"\\r\\n\"\n end\n proto\n end", "def gen_redis_proto *cmd\n proto = \"*#{cmd.length}\\r\\n\"\n cmd.each { |arg|\n proto << \"$#{arg.bytesize}\\r\\n#{arg}\\r\\n\"\n }\n proto\nend", "def gen_redis_proto(*cmd)\n proto = \"\"\n proto << \"*\"+cmd.length.to_s+\"\\r\\n\"\n cmd.each{|arg|\n proto << \"$\"+arg.to_s.bytesize.to_s+\"\\r\\n\"\n proto << arg.to_s+\"\\r\\n\"\n }\n proto\nend", "def get\n self.class.cast_from_redis redis.get(self.key), @options\n end", "def redis\n RedisRecord::Backend::redis_server\n end", "def redis\n @myredis || ::Redis::Objects.redis\n end", "def protocol\n @protocol ||= @raw_protocol[0..-4]\n end", "def redis\n Redis.current\nend", "def protocol; protocols.first; end", "def protocol; protocols.first; end", "def proto_info\n Mysql::Protocol::VERSION\n end", "def redis_info\n @redis_info ||= redis.info\n end", "def redis_on_base\n on_base\n end", "def get key\n @redis.get key\n end", "def redis_prefix\n @redis_prefix ||= name.underscore\n end", "def redis\n $redis\n end", "def redis\n @redis ||= if @redis_config.nil? || @redis_config.kind_of?(String)\n url = URI(@redis_config || \"redis://127.0.0.1:6379/0\")\n\n Updater.check_schema(Redis.new({\n :host => url.host,\n :port => url.port,\n :db => url.path[1..-1],\n :password => url.password\n }))\n else\n Updater.check_schema(@redis_config)\n end\n end", "def redis_version\n redis_info[\"redis_version\"]\n end", "def redis\n self.class.redis\n end", "def redis\n self.class.redis\n end", "def protocol\n raise TypeError, 'no type on this reply' unless\n instance_variable_defined? :@type\n\n @type.split('.').last.sub '_', ''\n end", "def get_instance\n @redis\n end", "def get(msg_id, suffix)\n with_failover { redis.get(key(msg_id, suffix)) }\n end", "def redis\n Resque.redis\n end", "def redis_token\n $redis_token\n end", "def redis\n return @redis if @redis\n self.redis = Redis.respond_to?(:connect) ? Redis.connect : \"localhost:6379\"\n self.redis\n end", "def redis\n return @redis if @redis\n self.redis = Redis.respond_to?(:connect) ? Redis.connect : \"localhost:6379\"\n self.redis\n end", "def redis\n return @redis if @redis\n self.redis = Redis.respond_to?(:connect) ? Redis.connect : \"localhost:6379\"\n self.redis\n end", "def client\n @redis\n end", "def redis\n return @redis if @redis\n self.redis = 'localhost:6379'\n self.redis\n end", "def redis\n @redis ||= Redis.connect\n end", "def redis_pool; end", "def redis\n @redis ||= (self['redis'] || {}).symbolize_keys\n end", "def redis\n return @redis if @redis\n self.redis = Redis.respond_to?(:connect) ? Redis.connect : \"localhost:6379\"\n end", "def get\n @cached_value ||= RedisModel::Base.connection.get(key_label)\n end", "def phoneme_byte_trie\n phoneme_byte_trie_for(Phonetics.phonemes)\n end", "def read\n return irc_to_kcode(@recvmsg.pop)\n end", "def redis\n @redis ||= Redis.new\n end", "def redis\n @redis ||= Redis.new\n end", "def redis\n @redis ||= Redis.new\n end", "def get\n self.class.client.get REDIS_KEY\n end", "def get_old_redis_cfg\n raw = redis.get(old_redis_cfg_key)\n raw ? Jsonable.load_hash(raw) : nil\n end", "def protocol_name\n rc, name = Cproton.pn_ssl_get_protocol_name(@impl, 128)\n name if rc\n end", "def redis\n @redis ||= EM::Protocols::Redis.connect(@config)\n end", "def redis\n return @redis if @redis\n self.redis = config.redis.host('localhost:6379')\n self.redis\n end", "def get_by_redis_key(redis_key)\n if redis_key.is_a?(String)\n klass = self.name.constantize\n klass.new_by_key(redis_key)\n else\n nil\n end\n end", "def redis\n Resque.respond_to?(:redis) ? Resque.redis : Resque.backend.store\n end", "def redis\n @redis ||= Redis.new url: LcEnv.redis_url\n end", "def get_data(type)\n data = redis.get(redis_key(type))\n data ? JSON.parse(data) : nil\n end", "def connection\n RedisModel::Base.connection\n end", "def protocol\n @connection.protocol\n end", "def protocol\n if @protocol.nil?\n @protocol = RbSync::Protocol::new(self.io, self.logger)\n else\n @protocol\n end\n end", "def protocol_name\n PROTOCOLS[protocol.to_s]\n end", "def redis_options\n Findable.config.redis_options.presence\n end", "def redis\n @redis || init\n end", "def protocol_type\n self[:p_type].to_endian(:big)\n end", "def redis_command\n if redis.empty?\n # Default to old method of connecting to redis\n # for users that haven't updated their configuration\n %W(env -i redis-cli)\n else\n redis['database'] ||= 0\n redis['host'] ||= '127.0.0.1'\n redis['port'] ||= '6379'\n if redis.has_key?(\"socket\")\n %W(#{redis['bin']} -s #{redis['socket']} -n #{redis['database']})\n else\n if redis.has_key?(\"pass\")\n %W(#{redis['bin']} -h #{redis['host']} -p #{redis['port']} -n #{redis['database']} -a #{redis['pass']})\n else\n %W(#{redis['bin']} -h #{redis['host']} -p #{redis['port']} -n #{redis['database']})\n end\n end\n end\n end", "def redis_server(server)\n case server\n when String\n host, port = server.split(':')\n ::Redis.new host: host, port: port\n when Hash\n ::Redis.new server\n else\n server\n end\n end", "def redis\n @@redis ||= Redis.new\n end", "def protocol\n v = @head.fetch[1]\n raise \"Invalid protocol version name '#{v}'\" unless v =~ /^[0-9]+$/\n v.to_i\n end", "def redis_key\n self.class.redis_key(@name)\n end", "def protocol; end", "def protocol; end", "def protocol; end", "def protocol; end", "def [](field)\n EasyRedis.redis.hget(key_name,field)\n end", "def get_value (key)\r\n @redis.get key\r\n end", "def length\n @redis.llen @redis_name\n end", "def retrieve_hook\n json = ActiveHook.redis.with { |c| c.brpop('ah:queue') }\n json.last if json\n end", "def _protocolelement\n\n _save = self.pos\n while true # choice\n _tmp = apply(:_typedef)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_messagedef)\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_protocolelement unless _tmp\n return _tmp\n end", "def redis\n return @redis if @redis\n\n @redis = if @options[:redis]\n @options[:redis]\n elsif @options[:url]\n uri = URI.parse(@options[:url])\n Redis.new(:host => uri.host, :port => uri.port, :password => uri.password)\n else\n Redis.new(:host => @options[:host], :port => @options[:port], :password => @options[:password])\n end\n end", "def _protocol\n @_protocol ||= self.__send__(:_protocol=, RemoteConnection)\n end", "def module_version()\n redis_version = @connection.info[\"redis_version\"]\n major_version = redis_version.split('.').first.to_i\n raise ServerError, \"Redis 4.0 or greater required for RedisGraph support.\" unless major_version >= 4\n modules = @connection.call(\"MODULE\", \"LIST\")\n module_graph = modules.detect { |_name_key, name, _ver_key, _ver| name == 'graph' }\n module_graph[3] if module_graph\n end", "def redis\n redis_master_source = @config.redis_server =~ /^\\S+\\:\\d+$/ ? \"server_string\" : \"master_file\"\n _eigenclass_.class_eval <<-EVALS, __FILE__, __LINE__\n def redis\n redis_master_from_#{redis_master_source}\n end\n EVALS\n redis\n end", "def protocol_names(data)\n # 3 0 00 00000 00 00000 00 00000 000\n playercount = data[0].to_i\n @flags[:gamestate] = data[1]\n data = data[2..-1]\n p_strs = protocol_names_to_player_strs(playercount, data)\n protocol_names_strs_to_objs(p_strs)\n end", "def protocol_name\n self.class.protocol_name\n end", "def get_key_value_\n @redis.hget @url, 'key'\n end", "def get(key)\n code = @backend.get(key)\n return nil unless code\n parser.decode(code)\n rescue ::Memcached::Error\n nil\n end", "def redis(uri=nil)\n if Integer === uri\n tmp = Familia.uri\n tmp.db = uri\n uri = tmp\n elsif String === uri\n uri &&= URI.parse uri\n end\n uri ||= Familia.uri\n connect(uri) unless @clients[uri.serverid] \n @clients[uri.serverid]\n end", "def arp_proto_readable\n\t\t\"0x%04x\" % arp_proto\n\tend", "def type\n @grpc.type\n end", "def get(key)\n ensure_connected\n json_to_value(redis_handler.get key.to_s)\n end", "def proto\n \"def\"\n end", "def load(key)\n redis_key = prefix(key)\n value = @redis.get(redis_key)\n Marshal.load(value) if value\n end", "def get(key, attr, vtype = :string)\n value = @redis.hmget(key, attr).first\n if value\n case vtype\n when :array\n value = Oj.load(value)\n end\n end\n\n value\n end", "def get_command(command)\n ensure_cache_up_to_date\n namespace = \"bluster:objects:command:#{command}\"\n keys = self.redis.keys(\"#{namespace}:*\")\n data = {}\n keys.each { |key|\n short_key = key.split(\":\")[4]\n data[short_key] = self.redis.get(\"#{namespace}:#{short_key}\")\n }\n data\n end", "def redis\n @redis ||= Redis.new(\n url: Pantry.configuration.redis_uri,\n driver: :hiredis)\n end", "def protocol\n self[:ip_p]\n end", "def get_data(header,buff)\n server = TCPSocket.open('localhost', 2020)\n server.write buff\n resp = server.read(6)\n method = resp.unpack('v')[0]\n size = resp.unpack('V')[0].to_i\n protobuf = server.read(size)\n return method, protobuf\nend", "def redis\n return @redis if @redis\n self.redis = ENV['RELATED_REDIS_URL'] || ENV['REDIS_URL'] || 'localhost:6379'\n self.redis\n end", "def redis\n @redis ||= begin\n redis = Redis.new(config.redis)\n Redis::Namespace.new(REDIS_NAMESPACE, redis: redis).tap do |client|\n begin\n client.ping\n rescue Redis::BaseError => e\n if Lita.test_mode?\n raise RedisError, I18n.t(\"lita.redis.test_mode_exception\", message: e.message)\n else\n Lita.logger.fatal I18n.t(\n \"lita.redis.exception\",\n message: e.message,\n backtrace: e.backtrace.join(\"\\n\")\n )\n abort\n end\n end\n end\n end\n end", "def get key\n deserialize backend.get key.to_s rescue nil\n end", "def redis_set_options\n {}\n end", "def fetch_getsin\r\n connect\r\n idtype_msg = sock.get_once(12)\r\n\r\n if idtype_msg.length != 12\r\n disconnect\r\n return nil\r\n end\r\n\r\n keystream = get_keystream(idtype_msg, 'IDTYPE')\r\n server_msg = use_keystream('SERVER', keystream)\r\n sock.put(server_msg)\r\n\r\n getsin_msg = sock.get_once(1024)\r\n disconnect\r\n getsin_msg\r\n end", "def generate_redis_connection!\n redis_options ? Redis.new(**redis_options) : Redis.current\n end", "def backupexec_regread(hive, subkey, subval, type = REG_SZ)\n\t\tstub = backupexec_regrpc_read(\n\t\t\t:hive => registry_hive_lookup(hive),\n\t\t\t:subkey => subkey,\n\t\t\t:subval => subval,\n\t\t\t:type => type\n\t\t)\n\t\tresp = backupexec_regrpc_call(4, stub)\n\n\t\treturn nil if resp.length == 0\n\t\tret, len = resp[0,8].unpack('VV')\n\t\treturn nil if ret == 0\n\t\treturn nil if len == 0\n\t\treturn resp[8, len]\n\tend", "def client\n Exchange::GemLoader.new('redis').try_load unless defined?(::Redis)\n @client ||= ::Redis.new(:host => config.host, :port => config.port)\n end", "def get_model(redis_id)\n model = JSON.parse($redis.get(redis_id))\n model[\"id\"] = redis_id\n model\n end", "def initialize\n @redis = Redis.new(host: 'redis', port: 6379)\n end", "def c_generate_proto(tables)\n tables.each{|k,v|\n puts \"static void decode_#{k}(#{$cargs_proto});\"\n }\nend" ]
[ "0.68973935", "0.6895657", "0.68576854", "0.55794096", "0.5522293", "0.5379072", "0.5369867", "0.531917", "0.5317122", "0.5317122", "0.5270904", "0.51870227", "0.5186309", "0.51819515", "0.5172141", "0.5155367", "0.5116555", "0.5109411", "0.51070595", "0.51070595", "0.510531", "0.5076484", "0.5064368", "0.50582564", "0.50523114", "0.5048704", "0.5048704", "0.5048704", "0.5013336", "0.49985397", "0.49978438", "0.498635", "0.49796268", "0.4975298", "0.49739066", "0.49294335", "0.49251935", "0.49211082", "0.49211082", "0.49211082", "0.49200866", "0.49176848", "0.49098837", "0.49013346", "0.48956484", "0.48803687", "0.4871859", "0.482778", "0.4822335", "0.48213005", "0.48211548", "0.48194236", "0.48182857", "0.47719583", "0.476823", "0.47677505", "0.47519964", "0.47519627", "0.47516918", "0.47459993", "0.47418156", "0.47319737", "0.47319737", "0.47319737", "0.47319737", "0.47156587", "0.47152066", "0.47141004", "0.4697637", "0.46915174", "0.46780258", "0.46764383", "0.46563202", "0.46508232", "0.46410078", "0.46365494", "0.4630854", "0.4625886", "0.46105206", "0.45940796", "0.45913187", "0.45767173", "0.45729762", "0.45682356", "0.45637524", "0.4563388", "0.45609024", "0.45451415", "0.4531196", "0.45234588", "0.4512535", "0.450397", "0.45024166", "0.45017678", "0.45012635", "0.45008093", "0.45003623", "0.4498169", "0.4491276", "0.44869652" ]
0.74751437
0
safe cache! won't die if the bot dies
def getcached(url) _cached = instance_variable_get "@cached_#{hashed(url)}" return _cached unless _cached.nil? path = CACHE_FILE + "#{hashed(url)}.json" if File.exists?(path) f = File.open(path) _cached = JSON.parse(f.read) instance_variable_set("@cached_#{hashed(url)}", _cached) return _cached end return nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cached?; end", "def cache_on?; end", "def cache_on?; end", "def _cache_control; end", "def disable_caching; end", "def disable_cache; end", "def flush_cache; end", "def disable_caching=(_arg0); end", "def cache!\n @@cache\n end", "def without_cache(&block); end", "def without_cache(&block); end", "def cache?\n false\n end", "def clear_cache; end", "def http_cache_forever(public: T.unsafe(nil)); end", "def cache_value?; end", "def using_cache\n\t\t(@modcache_invalidated != true)\n\tend", "def cache_get(key)\n nil\n end", "def move_to_cache\r\n true\r\n end", "def invalidate_cache! now\n end", "def cache_store; end", "def cache_store; end", "def move_to_cache\n true\n end", "def cache(data); end", "def escribe_cache\n Rails.cache.write(\"cache_service_#{id}\", true, :expires_in => 1.week)\n end", "def move_to_cache\n true\n end", "def move_to_cache\n true\n end", "def move_to_cache\n true\n end", "def configure_cache; end", "def update_cache\n # Does nothing...up to subclasses to implement.\n end", "def set_cache(value); end", "def set_cache(value); end", "def update\n download_page if cache_expired?\n read_cache\n end", "def singleton_cache; end", "def clear_cache() @cache = {}; end", "def clean_cache\n node.normal['cloudflare']['threat_control']['status_cache'].reject! { |ip, data| is_stale? data['datetime'] }\nend", "def blockly_cache_bust\n if ::CACHE_BUST.blank?\n false\n else\n ::CACHE_BUST\n end\n end", "def refresh_cache\n return unless @p.user.is_admin\n return unless request.delete?\n expire_fragment('app_flickr_pics')\n flash[:notice] = \"Cache Cleared!\"\n redirect_back_or_default('/admin')\n end", "def should_cache?\n false\n end", "def cache_message(msg)\r\n # @conn.prepare(\"insert_quote\", \"INSERT INTO quotes (nickname, message, date_added) VALUES ($1, $2)\")\r\n # @conn.exec_prepared(\"insert_quote\", [msg.nickname, msg.text, Time.now])\r\n return if msg.text == $bot.nick\r\n $log.info(\"Caching #{msg}: #{msg.text}\")\r\n if @msg_cache.length >= 500\r\n @msg_cache.shift\r\n @msg_cache << msg\r\n else\r\n @msg_cache << msg\r\n end\r\n end", "def cache_or_fetch(url)\n cache_key = \"badge_host_urls/#{url}\"\n if (cache = $redis.get cache_key)\n cache\n else\n body = Curl.get(url).body_str\n $redis.set cache_key, body\n body\n end\n end", "def evict\n return if @cache.empty?\n @semaphor.synchronize(){|| \n keys = @cache.keys\n least_recently_used = keys.first\n @cache.each_pair do |url, response|\n least_recently_used = url if @cache[least_recently_used].timestamp > @cache[url].timestamp\n end\n @current_load = @current_load - @cache[least_recently_used].response.bytesize()\n @cache.delete(least_recently_used)\n }\n end", "def cache_timeout\n super\n end", "def add_cache_control; end", "def no_cache!\n @cacheable = false\n end", "def cache_request\n cache\n end", "def invalidate!\n @cache = MiniCache::Store.new\n return nil\n end", "def instance_cache; end", "def filter_cache; end", "def leaked_request?\n !CacheUpdater.executing?\n end", "def cache time: 3600, &block\n return yield if 'development' == ENV['RACK_ENV']\n\n key = \"url:#{I18n.locale}:#{request.path}\"\n cached = $redis.get(key)\n page = cached || yield\n etag Digest::SHA1.hexdigest(page)\n\n if cached\n ttl = $redis.ttl(key)\n response.header['redis-ttl'] = ttl.to_s\n response.header['redis'] = 'HIT'\n else\n response.header['redis'] = 'MISS'\n $redis.setex(key, time, page)\n end\n page\n end", "def expire_cache(key)\n end", "def test_ttl_eviction_on_access\n @cache.store(:a, 1)\n @cache.store(:b, 2)\n\n Timecop.freeze(Time.now + 330)\n\n @cache.store(:c, 3)\n\n assert_equal({ c: 3 }, @cache.raw[:cache])\n end", "def serve_from_cache!\n puts \"\\nServed from cache '#{request.uri}'\\n\\n\" if ::SETTINGS['debug']\n TinyProxy::Cache.get(request.uri)\n end", "def use_cache?\n super && !against_head?\n end", "def use_cache?\n super && !against_head?\n end", "def cache\n yield\n end", "def hijacked; end", "def singleton0_cache; end", "def cache=(_arg0); end", "def cache=(_arg0); end", "def cache=(_arg0); end", "def cache=(_arg0); end", "def simulate_expire; end", "def no_cache\n expires_now\n end", "def fetch_cache(file, url)\n @path = \"tmp/\" + file + \".html\";\n @temp = @path + \".fetch\"\n @doFetch = !(FileTest.exists?(@path) && (Time.new - File.mtime(@path) < (5 * 60)))\n\n if @doFetch and download_page(@temp,url) then\n File.delete(@path) if File.exists?(@path)\n File.rename(@temp, @path)\n end\n\n if File.exists?(@path) then\n return @path\n else\n @useOnce = @path + \".\" + rand(100000).to_s + \".once\"\n download_page(@useOnce, url)\n return @useOnce\n end\n end", "def http_cache_forever(public: false)\n expires_in 100.years, public: public\n\n yield if stale?(etag: request.fullpath,\n last_modified: Time.new(2011, 1, 1).utc,\n public: public)\n end", "def http_cache_forever(public: false)\n expires_in 100.years, public: public\n\n yield if stale?(etag: request.fullpath,\n last_modified: Time.new(2011, 1, 1).utc,\n public: public)\n end", "def disable_disk_cache!; end", "def cached?(key)\n false\n end", "def cache\n DataCache\n end", "def check_cache_validity(client)\n msg = @lookupserver.gets.chomp\n while msg.empty? do\n msg = @lookupserver.gets.chomp\n end\n accessTimeServer = Time.parse(msg)\n compare = accessTimeServer <=> @accessTimeCache\n if (compare <= 0) #Cache copy is valid\n cache_read(client)\n else\n puts @client_msg\n @lookupserver.puts(@client_msg)\n listen_fserver_read(client)\n end\n end", "def cacheable?\n true\n end", "def cached\n raise NotImplementedError\n end", "def cache\n @cache ||= {}\n end", "def cache\n @cache ||= {}\n end", "def read(key)\n return if @expires[key] && @expires[key] < Faulty.current_time\n\n @cache[key]\n end", "def cache\n @cache ||= {}\n end", "def cache_key\n end", "def cache(key)\n @cache ||= {}\n timestamp, data = @cache[key]\n if timestamp && data && Time.now - timestamp < 1\n puts 'CACHE HIT'\n data\n else\n data = yield\n @cache[key] = [Time.now, data]\n data\n end\n end", "def write_cache?\n if site.front_page_cached and c = cache_url\n #Rails.logger.info(\"request.path:::: #{request.path}\")\n cache_page(response.body, File.join(site.cache_path, c).to_s)\n end\n end", "def flush!\n @_cache = {}\n end", "def get\n raise StandardError, \"Implement '.get' in your Cache!\"\n end", "def fetch_followed\n cache(:expire_in => 2.hours).followed\n end", "def move_to_cache\n false\n end", "def infinite?\n !expires?\n end", "def after_update(resume) \n expire_cache_for(resume) \n end", "def discovery_cache; end", "def check_cache(type, id)\n end", "def check_cache(type, id)\n end", "def force_get(key)\n # Return nothing if not in the cache or it has expired.\n return if key.nil?\n\n entry = @cache[key]\n return unless entry\n entry.object\n end", "def expire_covercache\n self.class.send :expire_covercache\n end", "def test_cached\n cached = TestCache.new\n \n # force = false\n assert !cached.cached?(:m1)\n cached.m1\n assert cached.cached?(:m1)\n sleep 4\n assert cached.cached?(:m1)\n \n # force = true\n assert !cached.cached?(:m2)\n cached.m2\n sleep 1\n assert cached.cached?(:m2)\n sleep 3\n assert !cached.cached?(:m2)\n end", "def instagram_rate_limit_warning(rate_limit_remaining, url)\n # Key-based expiration\n @rate_limit_remaining = rate_limit_remaining\n @url = url\n cache_key = [\"instagram_rate_limit_warning\", Time.now.hour]\n return nil if Rails.cache.fetch cache_key\n Rails.cache.write cache_key, true\n mail subject: \"[#{AppConfig.app_name}] WARNING: Instagram rate limit low\"\n end", "def do_cached( key, &block )\n \n # have a look in the cache\n value = fetch( key )\n\n # Cache HIT?\n return value unless value.nil?\n\n # Cache MISS : execute the block\n value = block.call( key )\n\n # Store value in the cache\n return store( key, value )\n end" ]
[ "0.7106423", "0.7106423", "0.7106423", "0.7106423", "0.7106423", "0.7106423", "0.7106423", "0.7076536", "0.68736356", "0.68736356", "0.68701714", "0.68273985", "0.6770543", "0.6752345", "0.6573087", "0.6498376", "0.64947414", "0.64947414", "0.6493994", "0.6449347", "0.64253384", "0.64084506", "0.6405316", "0.6357163", "0.63554424", "0.63476926", "0.6335315", "0.6335315", "0.6317063", "0.62884384", "0.62861234", "0.62457347", "0.62457347", "0.62457347", "0.6242386", "0.623443", "0.6223736", "0.6223736", "0.6218566", "0.6148635", "0.60936177", "0.60822207", "0.6073191", "0.606386", "0.6030555", "0.60236245", "0.6022957", "0.60146433", "0.60113305", "0.5991819", "0.5979059", "0.5972265", "0.59685284", "0.5959723", "0.5942702", "0.5939071", "0.5936789", "0.592488", "0.5911068", "0.5896867", "0.58958805", "0.58958805", "0.58867884", "0.58800656", "0.5874492", "0.5871837", "0.5871837", "0.5871837", "0.5871837", "0.5859326", "0.58422387", "0.5837767", "0.5831922", "0.5831922", "0.5816134", "0.58159477", "0.5810398", "0.58060867", "0.5805662", "0.58037597", "0.5800789", "0.5800789", "0.578115", "0.5780597", "0.5778187", "0.5776503", "0.5776125", "0.5772131", "0.57708675", "0.57687193", "0.5768308", "0.57611114", "0.57575047", "0.57467407", "0.57425433", "0.57425433", "0.57306355", "0.5727364", "0.57229674", "0.5715751", "0.5714336" ]
0.0
-1
GET /comments GET /comments.json
def index if params[:id].nil? redirect_to root_path end @comments = Comment.where("project_id" => params[:id]) @project = Project.find(params[:id]) add_breadcrumb @project.name.to_s, '/projects/' + @project.id.to_s add_breadcrumb I18n.t("breadcrumbs.comments"), '/projects/comments/' + @project.id.to_s @permiso = check_propiety(@project) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def comments\n client.get(\"/#{id}/comments\")\n end", "def comments\n @list.client.get(\"#{url}/comments\")\n end", "def comments\n @list.client.get(\"#{url}/comments\")\n end", "def comments\n render json: @post.comments\n end", "def list\n comments = Comment.where(post: @post)\n render json: comments, status: 200\n end", "def comments; rest_query(:comment); 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 render json: @comments\n end", "def show\n user = User.find_by({token: env['HTTP_TOKEN']})\n render json: user.comments.find(params[:id])\n end", "def show\n # comment = Comment.find_comment\n render json: @comment\n end", "def index\n comments = @project.comments\n render json: comments\n end", "def show\n @comments = @post.comments\n respond_to do |format|\n format.html\n format.json\n end\n end", "def comments(options={})\n parse_comments(request(singular(id) + \"comments\", options))\n end", "def index\n @comments = DiscussionComment.all\n render json: @comments\n end", "def show\n comment = Comment.find(params[:id])\n render json: comment, status: 200\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 all_comments\n render :json => User.find(params[:user_id]).comments\n end", "def index\n #@comments = Comment.all\n comments = @blog.comments\n render json: comments, status: :ok\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 @comment = Comment.find(params[:id])\n render json:@comment\n end", "def show\n render json: @comment\n end", "def show\n comment = Comment.find_by(id: params[:id])\n render json: comment\n end", "def show\n render json: comment\n end", "def GetComments id,params = {}\n\n params = params.merge(path: \"tickets/#{id}/comments.json\")\n APICall(params)\n\n end", "def index\n @post = Post.find(params[:post_id])\n @comments = @post.comments\n\n render json: @comments, include: ['user']\n end", "def show\n comment = Comment.find(params[:id])\n render json: comment, status: :ok\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 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 comments(options = {})\n comments_resource(options)\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 index\n logger.info(\"comments got index! #{params}\");\n @comments = Comment.find_by_post_id(params[:post_id])\n respond_with @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 comments(options = {})\n urn = options.delete(:urn)\n path = \"/socialActions/#{urn}/comments\"\n get(path, options)\n end", "def get_comments(user_name)\n uri = create_api_uri(@@base_uri, user_name, 'getComments')\n return get(uri)\n end", "def comments(options={})\n self.class.parse_comments(request(singular(user_id) + \"/comments\", options))\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 @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 index\n if params[:_post_id]\n post_comments = PostComment.where(post_id: params[:_post_id])\n render json: post_comments.as_json(\n include: { user: { only: [:name, :id] } },\n except: [:post_id, :user_id]),\n status: :ok\n else\n render json: @current_user.post_comments.as_json(\n include: { post: { only: [:title, :id, :excerpt] } },\n except: [:user_id, :post_id]),\n status: :ok\n end\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 get_comment(comment_id)\n get(\"comments/#{comment_id}\")\n end", "def show\n @post = Post.find(params[:id])\n @comments = @post.comments.order('created_at DESC')\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end", "def comments\n Birdman::ApiPaginatedCollection.new(\"movies/#{id}/comments\")\n end", "def get_comments(parameters = {})\n if @answer_comments_url\n hash,url =request(@answer_comments_url, parameters)\n Comments.new hash, url\n else\n nil\n end\n end", "def show\n render json: { comment: @comment, replaies: @comment.replaies }, status: :ok\n end", "def show\n @comment = Comment.find(params[:id])\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comment }\n end\n end", "def index\n @comments = @post.comments.order(created_at: :desc)\n render json: @comments, status: :ok\n\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 event = Event.find(params[:event_id])\n render json: event.comments, status: :ok\n end", "def index\n @comments = @entry.comments\n respond_with(@comments)\n end", "def show\n logger.info(\"comments got show! #{params}\");\n @comments = Comment.find_by_post_id(params[:post_id])\n respond_with @comments\n end", "def show\n @comment = Comment.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 @comment = Comment.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 @comment = Comment.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 @comment = Comment.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 @comment = Comment.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 @comment = Comment.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 @comment = Comment.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 @comment = Comment.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 @comment = Comment.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 @comment = Comment.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 @comment = Comment.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 @comment = Comment.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 @comment = Comment.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 @comment = Comment.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 @comment = Comment.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 @comment = Comment.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 @comment = Comment.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 @comment = Comment.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 @comment = Comment.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 @comment = Comment.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 @comment = Comment.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 @comment = Comment.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 render json: @comment, status: :ok\n\n end", "def comments\n expose Challenge.comments(@oauth_token, params[:challenge_id].strip)\n end", "def show\n @comment = Comment.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comment }\n \tend\n end", "def comments_for(url)\n get_data(\"comments/show/#{FORMAT}?url=#{url}\")\n end", "def index\n @comments = Comment.order(\"created_at DESC\")\n render json: @comments, status: :ok\n end", "def show\n @comment = Comment.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 @comment = Comment.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 @comment = Comment.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 comments(options={})\n parse_comments(request(singular(answer_id) + \"/comments\", options))\n end", "def show\n @comment = Comment.new\n @comments = Comment.get_post_comments @post\n if session[:comment_errors]\n session[:comment_errors].each {|error, error_message| @comment.errors.add error, error_message}\n session.delete :comment_errors\n end\n respond_to do |format|\n format.html\n format.json { render :json => {:post => @post, :comments => @comments, :status => 200} }\n end\n end", "def show\n if @comment.nil?\n render json: {error: \"Not Found\"}, status: :not_found\n else\n render json: @comment, status: :ok\n end\n end", "def comment(options)\n get(\"/content/items/#{options.delete(:item)}/comments/#{options[:id]}\",options)\n end", "def index\n post = Post.find(params[:post_id])\n comments = post.comments.order(updated_at: :desc)\n @comment = Comment.new\n\n @comments = comments.map do |comment|\n {\n content: comment.content,\n created_at: comment.created_at.strftime('%Y-%m-%d %H:%M:%S')\n }\n end\n\n render json: {\n data: {\n comments: @comments,\n new_comment: @comment,\n }\n }\n end", "def comments\n @data['comments']\n end", "def comments\n @data['comments']\n end", "def comments\n @data['comments']\n end", "def details(id, params = {})\n wrike.execute(:get, api_url(\"comments/#{id}\"), params)\n end", "def show\n render json: { blog: @blog, comments: @blog.comments }\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 gist_comments(id)\n get \"/gists/#{id}/comments\"\n end", "def show\n @comments = @servidor.comments.order(\"id DESC\").page(params[:page]).per(3)\n end", "def get_comments_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: NotesApi#get_comments ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling get_comments\" if id.nil?\n \n # resource path\n path = \"/Notes/{id}/Comments\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'updated_after_utc'] = opts[:'updated_after_utc'] if opts[:'updated_after_utc']\n query_params[:'skip'] = opts[:'skip'] if opts[:'skip']\n query_params[:'top'] = opts[:'top'] if opts[:'top']\n query_params[:'count_total'] = opts[:'count_total'] if opts[:'count_total']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<APIComment>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NotesApi#get_comments\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def comments(options = {})\n options = { query: options } if options.any?\n @party.get(\"forms/#{@id}/comments\", options)['Comments']\n end", "def comments(options={})\n @comments ||= self.class.parse_comments(request(singular(question_id) + \"/comments\", options))\n end", "def moment_comments(moment_id)\n get(\"/v1/moments/#{moment_id}/comments\")\n end", "def show\n @comment = @song.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 @post = Post.find(params[:id], include: :comments, order: 'comments.id')\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" ]
[ "0.8573163", "0.7836431", "0.7836431", "0.7556213", "0.7529708", "0.7521586", "0.74967605", "0.73969424", "0.73019254", "0.7295428", "0.7285267", "0.72738194", "0.7270676", "0.7248517", "0.7243218", "0.7208613", "0.72051287", "0.7185529", "0.717827", "0.7158628", "0.7157112", "0.71531415", "0.71524775", "0.7122445", "0.7120646", "0.7083295", "0.7068365", "0.7063734", "0.70443255", "0.70437", "0.7007497", "0.70074147", "0.70074147", "0.70074147", "0.69731474", "0.6969337", "0.6953208", "0.69496316", "0.69071984", "0.6902998", "0.68847305", "0.6880642", "0.6865719", "0.68503654", "0.68472373", "0.6833314", "0.68284905", "0.68283564", "0.6824054", "0.68173546", "0.6814579", "0.6810757", "0.6797797", "0.67976886", "0.67976886", "0.67976886", "0.67976886", "0.67976886", "0.67976886", "0.67976886", "0.67976886", "0.67976886", "0.67976886", "0.67976886", "0.67976886", "0.67976886", "0.67976886", "0.67976886", "0.67976886", "0.67976886", "0.67976886", "0.67976886", "0.67976886", "0.67976886", "0.6792322", "0.67889166", "0.67862314", "0.67547524", "0.6751654", "0.6745774", "0.6745774", "0.6745774", "0.67367417", "0.6728051", "0.6711901", "0.66973495", "0.6685848", "0.66726583", "0.66726583", "0.66726583", "0.666909", "0.66670156", "0.66640216", "0.6662991", "0.66419524", "0.66347563", "0.66332114", "0.6619834", "0.6613514", "0.66133356", "0.66064465" ]
0.0
-1
GET /comments/1 GET /comments/1.json
def show @project = Project.find(@comment.project_id) add_breadcrumb @project.name.to_s, '/projects/' + @project.id.to_s add_breadcrumb I18n.t("breadcrumbs.comments"), '/comments/' + @comment.id.to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def comments\n client.get(\"/#{id}/comments\")\n end", "def comments\n @list.client.get(\"#{url}/comments\")\n end", "def comments\n @list.client.get(\"#{url}/comments\")\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 show\n comment = Comment.find(params[:id])\n render json: comment, status: 200\n end", "def comments; rest_query(:comment); end", "def comments\n render json: @post.comments\n end", "def show\n @comment = Comment.find(params[:id])\n render json:@comment\n end", "def show\n user = User.find_by({token: env['HTTP_TOKEN']})\n render json: user.comments.find(params[:id])\n end", "def show\n # comment = Comment.find_comment\n render json: @comment\n end", "def show\n comment = Comment.find_by(id: params[:id])\n render json: comment\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 comment = Comment.find(params[:id])\n render json: comment, status: :ok\n end", "def show\n @comments = @post.comments\n respond_to do |format|\n format.html\n format.json\n end\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 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 = @project.comments\n render json: comments\n end", "def index\n @comments = DiscussionComment.all\n render json: @comments\n end", "def show\n @comment1 = Comment1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comment1 }\n end\n end", "def index\n @comments = Comment.all\n render json: @comments\n end", "def get_comment(comment_id)\n get(\"comments/#{comment_id}\")\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 list\n comments = Comment.where(post: @post)\n render json: comments, status: 200\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 index\n #@comments = Comment.all\n comments = @blog.comments\n render json: comments, status: :ok\n end", "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 show\n render json: comment\n end", "def show\n render json: @comment\n end", "def GetComments id,params = {}\n\n params = params.merge(path: \"tickets/#{id}/comments.json\")\n APICall(params)\n\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 @comment = Comment.find(params[:id])\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comment }\n end\n end", "def all_comments\n render :json => User.find(params[:user_id]).comments\n end", "def get_comment\n @comment = Comment.find(params[:id])\n end", "def comment\n Comment.find(params[:id])\n end", "def show\n @comment = Comment.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comment }\n \tend\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 show\n @comment = Comment.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 @comment = Comment.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 @comment = Comment.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 @comment = Comment.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 @comment = Comment.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 @comment = Comment.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 @comment = Comment.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 @comment = Comment.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 @comment = Comment.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 @comment = Comment.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 @comment = Comment.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 @comment = Comment.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 @comment = Comment.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 @comment = Comment.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 @comment = Comment.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 @comment = Comment.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 @comment = Comment.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 @comment = Comment.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 @comment = Comment.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 @comment = Comment.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 @comment = Comment.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 @comment = Comment.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 comments_for(url)\n get_data(\"comments/show/#{FORMAT}?url=#{url}\")\n end", "def comments(options={})\n parse_comments(request(singular(id) + \"comments\", options))\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: { comment: @comment, replaies: @comment.replaies }, status: :ok\n end", "def show\n @comment = Comment.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 @comment = Comment.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 @comment = Comment.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 index\n logger.info(\"comments got index! #{params}\");\n @comments = Comment.find_by_post_id(params[:post_id])\n respond_with @comments\n end", "def details(id, params = {})\n wrike.execute(:get, api_url(\"comments/#{id}\"), params)\n end", "def comments\n Birdman::ApiPaginatedCollection.new(\"movies/#{id}/comments\")\n end", "def show\n @post = Post.find(params[:id])\n @comments = @post.comments.order('created_at DESC')\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\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 @comments = @servidor.comments.order(\"id DESC\").page(params[:page]).per(3)\n end", "def index\n @post = Post.find(params[:post_id])\n @comments = @post.comments\n\n render json: @comments, include: ['user']\n end", "def comment(options)\n get(\"/content/items/#{options.delete(:item)}/comments/#{options[:id]}\",options)\n end", "def show\n @comment = @song.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 @comment = Comment.find_by_permalink(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 index\n @comments = @entry.comments\n respond_with(@comments)\n end", "def index\n @comments = @post.comments.order(created_at: :desc)\n render json: @comments, status: :ok\n\n end", "def show\n @post = Post.find(params[:id], include: :comments, order: 'comments.id')\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 show\n render json: @comment, status: :ok\n\n end", "def show\n @new_comment = Comment.build_from(@post, \"\")\n\n render json: @post, status: 200\n\n\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 @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 comments = list.comments.desc(:created_at)\n comments = comments[5, (comments.length-1)]\n\n render json: comments\n end", "def show\n @comments = Comment.where(post_id: params[:id])\n end", "def gist_comments(id)\n get \"/gists/#{id}/comments\"\n end", "def show\n logger.info(\"comments got show! #{params}\");\n @comments = Comment.find_by_post_id(params[:post_id])\n respond_with @comments\n end", "def index\n event = Event.find(params[:event_id])\n render json: event.comments, status: :ok\n end", "def show\n if @comment.nil?\n render json: {error: \"Not Found\"}, status: :not_found\n else\n render json: @comment, status: :ok\n end\n end", "def comments\n expose Challenge.comments(@oauth_token, params[:challenge_id].strip)\n end", "def index\n @comments = Comment.order(\"created_at DESC\")\n render json: @comments, status: :ok\n end", "def get_comments(user_name)\n uri = create_api_uri(@@base_uri, user_name, 'getComments')\n return get(uri)\n end", "def index\n if params[:_post_id]\n post_comments = PostComment.where(post_id: params[:_post_id])\n render json: post_comments.as_json(\n include: { user: { only: [:name, :id] } },\n except: [:post_id, :user_id]),\n status: :ok\n else\n render json: @current_user.post_comments.as_json(\n include: { post: { only: [:title, :id, :excerpt] } },\n except: [:user_id, :post_id]),\n status: :ok\n end\n end", "def view_comment\n @comment = Comment.find(params[:id])\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 # @post = Post.find(params[:post_id])\n @comments = @post.comments\n end", "def index\n @comments = @commentable.comments\n end", "def show\n @messages_comment = MessagesComment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @messages_comment }\n end\n end", "def show\n @comment = @complaint.comments.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @comment }\n format.js\n end\n end", "def show\n #@post = Post.find(params[:id])\n @comment = Comment.new\n @comment_container_id_prefix = COMMENT_CONTAINER_ID_PREFIX\n respond_to do |format|\n format.html\n format.json { render json: @post, except: :updated_at, :include => {:user => {:only => [:name]}}}\n end\n end" ]
[ "0.82821167", "0.74428797", "0.74428797", "0.7435283", "0.74061906", "0.7305913", "0.7283544", "0.7258592", "0.72560287", "0.72484696", "0.7243203", "0.7219824", "0.7219523", "0.7218877", "0.7174389", "0.7158426", "0.71583927", "0.71185815", "0.711669", "0.710114", "0.71007395", "0.70947987", "0.70777875", "0.7061423", "0.70478845", "0.70425916", "0.702815", "0.70109457", "0.6991476", "0.69748074", "0.69611824", "0.6952931", "0.6952265", "0.6913634", "0.6913084", "0.6906848", "0.68979174", "0.68979174", "0.68979174", "0.68979174", "0.68979174", "0.68979174", "0.68979174", "0.68979174", "0.68979174", "0.68979174", "0.68979174", "0.68979174", "0.68979174", "0.68979174", "0.68979174", "0.68979174", "0.68979174", "0.68979174", "0.68979174", "0.68979174", "0.68979174", "0.68976206", "0.68811107", "0.6878177", "0.6866972", "0.6866972", "0.6866972", "0.6865512", "0.6861285", "0.6861285", "0.6861285", "0.68585694", "0.68560964", "0.6851094", "0.6829041", "0.682315", "0.68061686", "0.6804166", "0.6793837", "0.6787325", "0.67831755", "0.67663115", "0.6765632", "0.6759219", "0.6746523", "0.6740265", "0.67244303", "0.6720426", "0.67131984", "0.6705833", "0.66964877", "0.66928446", "0.66880786", "0.6683499", "0.6683431", "0.66689175", "0.6668772", "0.66339755", "0.66250896", "0.6619791", "0.6619633", "0.66194606", "0.6619031", "0.6618492", "0.6614356" ]
0.0
-1
POST /comments POST /comments.json
def create add_breadcrumb I18n.t("breadcrumbs.amends"), '/comments/#{params[:comment][:id]/amends/#{params[:comment][:project_id]}' @comment = Comment.new(comment_params) puts "-------parametros---------" puts params.inspect puts "--------------------------" respond_to do |format| if secure_save(@comment) format.html { redirect_to "/projects/" + params[:comment][:project_id].to_s, notice: 'Comment was successfully created.' } format.json { render :show, status: :created, location: @comment } else format.html { render "/projects/" + params[:comment][:project_id].to_s } format.json { render json: @comment.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 comment options={}\n client.post(\"/#{id}/comments\", options)\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 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 comment = Comment.new(comment_params)\n\n post = Post.find(params[:comment][:post_id])\n post.data[\"comments\"] = post.data[\"comments\"] + 1\n\n if comment.save && post.save\n render json: {\n status: \"success\",\n data: {\n comment: comment.as_json(include: {\n user: {\n only: [:id, :name, :avatar]\n }\n }),\n comments: post.data[\"comments\"]\n }\n }, status: :ok\n else\n render json: comment.errors, status: 404\n end\n end", "def create\n @comment = Comment.new(params[:comment])\n @comment.save\n respond_with(@post, @comment)\n end", "def create\n json_create_and_sanitize(comment_params, Comment)\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 # get the post\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 # create post to comment\n @comment = @post.comments.create(body: params[:body])\n # associate comment before save(comment cannot be saved without user_id)\n @comment.user = @current_user\n # save comment\n if @comment.save\n render json: @comment, status: :ok\n else\n render json: { errors: { status: \"400\",\n title: \"Bad request\",\n details: @comment.errors\n }\n }, status: :bad_request\n end\n end", "def create\n @new_comment = post.comments.new(comment_params)\n @new_comment.user = current_user\n\n respond_to do |format|\n if @new_comment.save\n format.html { redirect_to post, notice: I18n.t('controllers.comments.created') }\n format.json { render :show, status: :created, location: post }\n else\n format.html { redirect_to post, alert: I18n.t('controllers.comments.error') }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\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 @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 #if @user && @user.posts.include(@post)\n @comment = @post.comments.create!(comment_params)\n json_response(@comment, :created)\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 @comment = current_user.comments.new(comment_params)\n @comment.user_id = current_user.id\n if @comment.save\n render json: @comment\n else\n render :json => @comment.errors\n end\n end", "def create\n comment = @project.comments.build(comment_params)\n\n if comment.save\n render json: comment \n else\n render json: { message: 'Error: Failed to add comment.'}\n end\n end", "def create\n @comment = @user.comments.build(@json['comment'])\n update_values :@comment, @json['comment']\n end", "def create\n @post = Post.where(id: params[:post_id]).first\n @comment = @post.comments.new(params[:comment])\n\n respond_to do |format|\n if @comment.save\n format.html { redirect_to @post, notice: 'Comment was successfully created.' }\n format.json { render json: @comment, 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 comments\n render json: @post.comments\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 @comment = Comment.new(comment_params)\n respond_to do |format|\n if @comment.save\n format.json {\n render json: {status:0, msg:\"success\"} \n }\n else\n \tformat.json { \n render json: {status:-1, msg:\"failed\"} \n }\n end\n end\n end", "def create\n @radio = Radio.find(params[:radio_id])\n comment = @radio.comments.create({:body => params[:comment], :user_id => current_user.id});\n respond_to do |format|\n format.json { render :json => to_commentDTO(comment), :status => :ok }\n end\n end", "def create\n @comment = Comment.new(params[:comment])\n\n respond_to do |format|\n if @comment.save\n format.html { redirect_to comments_url, notice: 'Comment was successfully created.' }\n format.json { render json: @comment, 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 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 @comment = Comment.new(post_params)\n\n respond_to do |format|\n if @comment.save\n format.html { redirect_to root_path, notice: 'Post was successfully created.' }\n format.json { render root_path, status: :created, location: @comment }\n else\n format.html { render :new }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.find(params[:post_id])\n @comment = @post.comments.build(params[:comment])\n respond_to do |format|\n if @comment.save\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.create(params[:comment]))\n end", "def comments\n client.get(\"/#{id}/comments\")\n end", "def create\n \tnew_comment = params.require(:comment).permit(:body)\n \tpost = Post.find(params[:post_id])\n \tcomment = post.comments.create(new_comment)\n\n \tredirect_to post_comment_path(post, comment)\n end", "def create\n @comment = @secret.comments.build(comment_params)\n @comment.user_id = current_user.id.to_s\n if @comment.save\n comment = CommentModel.new(@comment, current_user)\n render json: comment\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n end", "def create\n @comment = Comment.new(comment_params)\n @comment.user_id = @current_user.json_hash[:id]\n @comment.dinner_id = params[:id]\n if @comment.valid?\n @comment.save\n render json: @comment.comment_info\n else\n puts @comment.errors.messages.inspect\n render status: :bad_request, json: {\n errors: @comment.errors.messages\n }\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 @comment = Comment.new(comment_params)\n\n respond_to do |format|\n if @comment.save\n format.html { redirect_to @comment, notice: 'Comment was successfully created.' }\n format.json { render :show, status: :created, location: @comment }\n else\n format.html { render :new }\n format.json { render json: @comment.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.html { redirect_to @comment, notice: 'Comment was successfully created.' }\n format.json { render :show, status: :created, location: @comment }\n else\n format.html { render :new }\n format.json { render json: @comment.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.html { redirect_to @comment, notice: 'Comment was successfully created.' }\n format.json { render :show, status: :created, location: @comment }\n else\n format.html { render :new }\n format.json { render json: @comment.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.html { redirect_to @comment, notice: 'Comment was successfully created.' }\n format.json { render :show, status: :created, location: @comment }\n else\n format.html { render :new }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @comment = Comment.create(content: params[:content])\n current_user.comments << @comment\n current_user.save\n\n idea = Idea.find(params[:ideaId])\n idea.comments << @comment\n idea.comments.order(\"created_at DESC\")\n idea.save\n respond_to do |format|\n format.json {render json: @comment}\n end\n end", "def create\n @comment = Comment.new(params[:comment])\n\n respond_to do |format|\n if @comment.save\n format.html { redirect_to admin_comments_url, notice: 'Comment was successfully created.' }\n format.json { render json: @comment, 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 create\n @comment = current_user.comments.build(comment_params)\n\n respond_to do |format|\n if @comment.save\n format.html { redirect_to \"/posts/#{@comment.post_id}\" }\n format.json { render :show, status: :created, location: @comment }\n else\n errors = @comment.errors.full_messages.join('! ')\n format.html { redirect_to \"/posts/#{@comment.post_id}\", alert: \"Comment was failly created!\\n#{errors}!\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n\n\n end", "def create\n @comment = @parent.comments.new(params[:comment])\n @comment.user_id = session[:user_id]\n\n respond_to do |format|\n if @comment.save\n @comment.update_post\n format.html { redirect_to post_path(@comment.post), notice: 'Comment was successfully created.' }\n format.json { render json: @comment, 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 create\n @comment = Comment.new(comment_params)\n\n respond_to do |format|\n if @comment.save\n post_comment(@comment)\n format.html { redirect_to @comment.article, notice: 'Comment was successfully created.' }\n format.json { render action: 'show', 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 create\n @comment = Comment.new(\n name: params[:name],\n content: params[:content],\n post: Post.find(params[:post_id])\n )\n # @comment = Comment.new(comment_params)\n respond_to do |format|\n if @comment.save\n format.html { redirect_to @comment.post, notice: \"comment was created.\" }\n else\n puts @comment.errors\n format.html { redirect_to post_path(params[:post_id]) }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "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 @comment = @post.comments.build(comment_params)\n @comment.user_id = current_user.id\n @comment.post_id = @post.id\n\n respond_to do |format|\n if @comment.save\n format.html { redirect_to @post, notice: 'Comment was successfully created.' }\n format.json { render :show, status: :created, location: @comment }\n else\n format.html { render :new }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_comments\n end", "def create_comments\n end", "def create_comments\n end", "def create\n @comment = Comment.new(comment_params)\n @post = Post.find(@comment.post_id)\n respond_to do |format|\n if @comment.save\n format.html { redirect_to @post, notice: 'Comment was successfully created.' }\n format.json { render :show, status: :created, location: @comment }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @comment = Comment.new\n @comment.content = params[:content]\n @comment.post_id = params[:post_id]\n @comment.user_id = current_user.id\n\n respond_to do |format|\n if @comment.save\n format.html { redirect_to root_path, notice: \"Comment was successfully created.\" }\n format.json { render :show, status: :created, location: @comment }\n else\n format.html { redirect_to root_path, notice: \"Por favor añada contenido a su comentario.\" }\n end\n end\n end", "def create\n comment = Comment.new(params[:comment])\n @entry.comments << comment if comment.valid?\n respond_with(comment, location: redirect_to_index)\n end", "def create\n\n \t\t\t@comment = Comment.new comment_params\n\n @comment.user_id = current_user.id\n\n \t\t\tif @comment.save\n\n \t\t\t\trender json: @comment,status: :created\n\n \t\t\telse\n\n \t\t\t\trender json: {error: true,errors: @comment.errors},status: :unprocessable_entity\n\n \t\t\tend\n\n \t\tend", "def show\n @new_comment = Comment.build_from(@post, \"\")\n\n render json: @post, status: 200\n\n\n end", "def create\n if params.present?\n Comment.create(name: params[:author], description: params[:text], rating: params[:rating])\n end\n render json: {success: \"Sucessfully Commented\"}\n end", "def create_comment\n unless user_signed_in?\n render status: 403, json: { message: 'Please sign in to add a comment.' }\n end\n\n comment_params = params.permit(:content, :id)\n new_comment = Comment.create!(\n content: comment_params.require(:content),\n post_id: comment_params.require(:id),\n user_id: current_user.id\n )\n render status: :created, json: new_comment\n end", "def create\n @comment = Comment.new(params[:comment])\n\n respond_to do |format|\n if @comment.save\n format.html { redirect_to @comment.generic_item, :notice => t('notice.successfully_created') }\n format.json { render :json => @comment, :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 create\r\n\t\t#create new comment\r\n\t\t@comment = Comment.new(comment_params)\r\n\t\tif @comment.save\r\n\t\t\t#if save success send js handles the rest\r\n\t\t\t@post = @comment.post\r\n\t\t\trespond_to :js\r\n\t\telse\r\n\t\t\t# if fails alert user\r\n\t\t\tflash[:alert] = \"Something went wrong\"\r\n\t\tend\r\n\tend", "def create\n @comment = Comment.new(params[:comment])\n @posts = Post.find_all_by_id(@comment.post_id)\n @comment.user_id = session[:user_logged_in]\n respond_to do |format|\n if @comment.save\n format.html { redirect_to @posts, notice: 'Comment was successfully created.' }\n format.json { render json: @comment, 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 create\n @comment = Comment.new(params[:comment]) #has a hash called comment, passes initial values\n\n respond_to do |format|\n if @comment.save # Goes in here and saves it to the DB\n format.html { redirect_to @comment, notice: 'Comment was successfully created.' }\n format.json { render json: @comment, 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 create\n :authenticate_user!\n @comment = Comment.create!(comment_params)\n respond_with @comment\n end", "def create\n @comment = current_user.comments.build(params[:comment])\n\n respond_to do |format|\n if @comment.save\n format.html { redirect_to @comment, notice: 'Comment was successfully created.' }\n format.json { render json: @comment, 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 create\n @comment = @repository.comments.new(params.require(:comment).permit(:body))\n @comment.author = current_user\n authorize @comment\n\n if @comment.save\n respond_with(@comment)\n else\n respond_with @comment.errors, status: :unprocessable_entity\n end\n end", "def create\n @comment = @idea.comments.build(comment_params)\n @comment.user = current_user\n\n respond_to do |format|\n if @comment.save\n format.html { redirect_to @idea, notice: 'Your comment has been recorded' }\n format.json { render action: 'show', status: :created, comment: @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 comment_params\n if request.format.json?\n return params.permit(:post_id, :body)\n end\n params.require(:comment).permit(:user_id, :post_id, :body)\n end", "def create_comment(comment)\n post_params = {\n :body => comment.post_json,\n :headers => Logan::Client.headers.merge({'Content-Type' => 'application/json'})\n }\n\n response = Logan::Client.post \"/projects/#{@project_id}/todos/#{@id}/comments.json\", post_params\n Logan::Comment.new response\n end", "def create\n @post = Post.find(params[:post_id])\n @comment = @post.comments.create(params[:comment])\n @comment.researcher = logged_in_researcher\n\n if @comment.save\n respond_to do |format|\n format.html { redirect_to post_path(@post), :notice => \"Comment was successfully added.\" }\n format.xml { render :xml => @comment, :status => :created, :location => @comment}\n format.json { render :json=> @comment, :status => :created, :location => @comment}\n end\n else\n respond_to do |format|\n format.html { redirect_to post_path(@post), :alert => \"Failed to add comment: #{@comment.errors.full_messages.join(', ')}\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n format.json { render :json=> @comment.errors, :status => :unprocessable_entity }\n end \n end\n end", "def create\n @comment = @question.comments.create(comment_params)\n redirect_to question_path(@question)\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 @comment = Comment.new(params[:comment])\n\t\t@comment.user_id = session[:userid]\n @comment.save\n\t\trespond_with @comment, :location => @comment.post\n end", "def create\n @comment = @issue.comments.new(comment_params)\n\n respond_to do |format|\n if @comment.save\n format.html { redirect_to @issue_path, notice: 'Comment is succesfully created.' }\n format.json { render :show, status: :created, location: @comment }\n else\n format.html { render :new }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@comment = Comment.new()\n\t\t@comment.comment = params[:comment] \n\t\t@comment.user = current_user\n\t\t@comment.save\n\t\t\n\t\t@resource_comment = ResourceComment.new()\n\t\t@resource_comment.resource_path = params[:path]\n\t\t@resource_comment.comment_id = @comment.id\n\t\t@resource_comment.save\n\t\tif(@resource_comment)\n\t\t\trespond_with(@comment)\n\t\telse\n\t\t\trender json: {error: \"something went wrong while creating resource comment\"}\n\t\tend\n end", "def create\n comment = Comment.new(params[:comment])\n @articles_comments_service.create_comment(comment)\n end", "def create\n @user = User.find(params[:user_id])\n @comment = @user.comments.build(params[:comment])\n\n respond_to do |format|\n if @comment.save\n format.html { redirect_to user_path(@user.id), notice: 'Your comment has been submitted' }\n format.json { render json: @comment, 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 create\n @comment_node = CommentNode.new(params[:comment_node])\n\n respond_to do |format|\n if @comment_node.save\n format.html { redirect_to @comment_node, :notice => 'Comment node was successfully created.' }\n format.json { render :json => @comment_node, :status => :created, :location => @comment_node }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @comment_node.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @comment = current_user.comments.new(comment_params)\n @comment.post_id = params['post_id']\n # @comment.parent_id = params[:parent_id]\n\n respond_to do |format|\n if @comment.save\n flash[:notice] = t('comment.create_success_mesg')\n @post = Post.find(params['post_id'])\n @all_comments = @post.comments.paginate(page: params[:page])\n format.html\n format.json { render :show, status: :created, location: @comment }\n format.js\n else\n flash[:notice] = t('comment.create_unsuccessful_msg')\n format.html\n format.json {\n render json: @comment.errors, status: :unprocessable_entity\n }\n format.js \n end\n end\n end", "def create\n @post = Post.find(params[:post_id])\n @comment = @post.comments.create(comment_params)\n redirect_to post_path(@post)\n end", "def post_comment(request)\n data, _status_code, _headers = post_comment_with_http_info(request)\n request_token if _status_code == 401\n data\n end", "def comment #create comment\n comment = Comment.new\n if comment.create_comment(params[:body], params[:video_id])#calling create_comment method of Comment model\n respond_with do |format|\n format.json {render :json => {:success => true, :message => \"comment successfully posted\"}}\n end\n else\n respond_with do |format|\n format.json {render :json => {:success => false}}\n end\n end\n end", "def index\n post = Post.find(params[:post_id])\n comments = post.comments.order(updated_at: :desc)\n @comment = Comment.new\n\n @comments = comments.map do |comment|\n {\n content: comment.content,\n created_at: comment.created_at.strftime('%Y-%m-%d %H:%M:%S')\n }\n end\n\n render json: {\n data: {\n comments: @comments,\n new_comment: @comment,\n }\n }\n end", "def new_comment(name, discussion_id)\n response = self.class.post(\n @@base_uri + @@comments_uri,\n body: {\"comment\":{\"body\":name,\"discussion_id\":discussion_id,\"document_ids\":[]}}.to_json,\n headers: @headers\n )\n return response\n end", "def create\n @comment = Comment.new :body => params[:comment][:body],\n :issue => false\n @comment.polycomment_type = params[:polycomment_type]\n @comment.polycomment_id = params[:polycomment_id]\n @comment.user_id = current_user.id \n if @comment.save\n #flash[:notice] = 'Your comment was posted!'\n redirect_to :back\n else\n flash[:alert] = 'Something went wrong, try reposting your comment.'\n end\n end", "def create\n @post = Post.find(params[:post_id])\n @comment = @post.comments.create!(comment_params)\n\n redirect_to post_path(@post)\n end", "def create\n @comment = Comment.new(comment_params)\n @comment.save\n end", "def create\n @comment = @post.comments.build(params[:comment])\n \n respond_to do |format|\n if @comment.save\n flash[:notice] = 'Post was successfully created.'\n format.html { redirect_to(posts_url) }\n format.xml { render :xml => @comment, :status => :created, :location => @comment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n user = User.find_by({token: env['HTTP_TOKEN']})\n comment = user.comments.find(params[:id])\n comment.update(comment_params)\n render json: comment\n end", "def 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 add\n @comment = Comment.new(params[:comment])\n\n respond_to do |format|\n if @comment.save\n # format.html { redirect_to comments_url, notice: 'Comment was successfully created.' }\n format.json { render json: @comment, 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 create\n @task_comment = Task::Comment.new(task_comment_params)\n\n respond_to do |format|\n if @task_comment.save\n format.html { redirect_to @task_comment, notice: \"Comment was successfully created.\" }\n format.json { render :show, status: :created, location: @task_comment }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @task_comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.find(params[:post_id])\n @comment = @post.comments.new(comment_params)\n @comment.user_id = current_user.id\n @comment.save\n\n respond_to do |format|\n format.js\n end\n end", "def create\n @comment = Comment.new(comment_params)\n\n respond_to do |format|\n if @comment.save\n format.html { redirect_to @comment.article, notice: 'Comment was successfully created.' }\n format.json { render :show, status: :created, location: @comment }\n else\n format.html { render :new }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article.comments << Comment.new(comment_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to article_show_path(@article), notice: 'Comment was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def comment_creation_params\n params.require(:comment).permit(:cardset_id, :card_id, :user_id, :user_name, :posttime, :body, :status)\n end", "def create\n \t# collects nested attributes, for post & comment, from params\n new_post = params.require(:post).permit(:body, :link, comments_attributes: [:body])\n\n \tpost = Post.create(new_post)\n \tredirect_to post_path(post.id)\n end", "def create\n @commentable = find_commentable\n @comment = @commentable.comments.build(params[:comment]) do |comment|\n comment.access = current_access\n end\n if @comment.save\n flash.now[:notice] = t('comment.added')\n Rails.logger.info @comment.inspect\n @counter = @commentable.comments.count\n respond_with @comment\n else\n Rails.logger.info @comment.errors.messages\n flash.now[:error] = t('comment.added.error')\n end\n end", "def new\n @comment = @commentable.comments.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end", "def create_comment\n @user = User.find(params[:user_id])\n @message = Message.find(params[:message_id])\n @comment = @message.comments.create(params.permit(:content))\n @comment.user = @user\n @comment.user_name = @user.id\n @comment.user_avatar = @user.id\n\n if @comment.save\n response = { \"code\" => 1, \"msg\" => \"Comment Created Successfully\" }\n else\n response = { \"code\" => 0, \"msg\" => \"Comment Can't be created\" }\n end\n\n render json: response\n end", "def create \n @comment = @post.comments.new(params[:comment])\n @comment.user_id = current_user.id\n respond_to do |format|\n if @comment.save\n format.js { \n flash[:notice] = 'Comment was successfully created.' \n }\n else\n format.js { \n flash[:error] = @comment.errors.full_messages.join('<br/>')\n }\n end\n end\n @comments = @post.comments.created_at_order\n end", "def add_new_comment\n\t# Get the object that you want to comment\n\tcommentable = Post.find(params[:id])\n\n\t# Create a comment with the user submitted content\n\tcomment = Comment.new(comment_params)\n\t# Add the comment\n\tcommentable.comments << comment\n\t@comments = commentable.comments\n respond_to do |format|\n\t format.html { redirect_to root_path }\n\t format.js\n\tend\n end", "def create\n @post = Post.find params[:id]\n @comment = @post.comments.create comment_params\n @comment.user_id = current_user.id\n\n if @comment.save\n redirect_to \"/post/\" + params[:id]\n else\n flash[:danger] = \"No success\"\n redirect_to \"/\"\n end\n end", "def create\n @comment = @parent.comments.build(comment_params_with_user)\n authorize @comment\n\n if @comment.save\n CommentCreatedMailJob.perform_later(@comment)\n render json: @comment, serializer: CommentSerializer, status: :created\n else\n render_error :unprocessable_entity, @comment.errors\n end\n end", "def comment_params\n params.require(:comment).permit(:body, :request_id)\n end", "def create\n @comment = @secret.comments.build(comment_params)\n @comment.user_id = @user.id\n respond_to do |format|\n if @comment.save\n format.html { redirect_to [@user, @secret], notice: 'Secret was successfully created.' }\n format.json { render action: 'show', 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 create\n @submission = Submission.find(params[:submission_id])\n @scomment = @submission.comments.build(comment_params)\n if @scomment.save\n render json: @scomment.as_json(except: [:updated_at]), status: :created\n else\n render json: @scomment.errors, status: :unprocessable_entity\n end\n #@comment.user = current_user\n\n #respond_to do |format|\n # if comment_params[:title].present? && comment_params[:body].present?\n # if @comment.save\n # format.html { redirect_to @submission, notice: 'Comment was successfully created.' }\n # #format.json { render :show, status: :created, location: @comment }\n # else\n # format.html { render :new }\n # #format.json { render json: @comment.errors, status: :unprocessable_entity }\n # end\n # else\n # format.html { redirect_to @submission, notice: 'Debe llenar los campos.' }\n # end\n #end\n end" ]
[ "0.75120175", "0.74212646", "0.7374645", "0.72364116", "0.7205224", "0.7086658", "0.7069151", "0.70549524", "0.7049054", "0.6989455", "0.69825", "0.69657713", "0.69578165", "0.6910411", "0.6909373", "0.68731725", "0.6871654", "0.6822542", "0.6810818", "0.6787486", "0.6785412", "0.6761798", "0.67223775", "0.6717274", "0.6712879", "0.6703357", "0.66780496", "0.66693354", "0.6666063", "0.66510963", "0.6646797", "0.66438144", "0.66438144", "0.66438144", "0.66438144", "0.6618947", "0.66069686", "0.6589945", "0.6582926", "0.6580036", "0.6575621", "0.65625244", "0.6551164", "0.65488863", "0.65488863", "0.65488863", "0.65371865", "0.6536091", "0.6533879", "0.6513311", "0.64948153", "0.64924634", "0.6489975", "0.64784837", "0.6471345", "0.64571255", "0.64314175", "0.6424426", "0.641567", "0.6397403", "0.63957936", "0.63860476", "0.63849616", "0.6383141", "0.63804007", "0.6373539", "0.63700426", "0.6368417", "0.6364637", "0.6360786", "0.6327905", "0.63212544", "0.6320553", "0.6298183", "0.629413", "0.629149", "0.62839085", "0.6282247", "0.6277586", "0.6272559", "0.62677294", "0.62629545", "0.6259366", "0.62515587", "0.6248281", "0.6246175", "0.6245974", "0.62448645", "0.6240034", "0.62330633", "0.6232268", "0.62317383", "0.6227576", "0.62232935", "0.62225336", "0.62210953", "0.62100106", "0.62075067", "0.62066275", "0.61986846", "0.61980444" ]
0.0
-1
PATCH/PUT /comments/1 PATCH/PUT /comments/1.json
def update respond_to do |format| if @comment.update(comment_params) format.html { redirect_to "/projects/" + params[:comment][:project_id].to_s, notice: 'Comment was successfully updated.' } format.json { render :show, status: :ok, location: @comment } else format.html { render "/projects/" + params[:comment][:project_id].to_s } format.json { render json: @comment.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n json_update_and_sanitize(comment, comment_params, Comment)\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 user = User.find_by({token: env['HTTP_TOKEN']})\n comment = user.comments.find(params[:id])\n comment.update(comment_params)\n render json: comment\n end", "def 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 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\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 if @comment.update(comment_params)\n render json: @comment, status: :ok\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n end", "def update\n @comment = Comment.find(params[:id])\n authorize @comment\n if @comment.update(comment_params)\n render 'api/v1/comments/show', status: :success\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n end", "def update\n if @comment.update(comment_params)\n head :no_content\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n end", "def update\n if @comment.update(comment_params)\n head :no_content\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n end", "def update\n #respond_to do |format|\n if @comment.update(comment_params)\n render json: @comment.as_json(except: [:updated_at]), status: :ok\n else\n # format.html { render :edit }\n render json: @comment.errors, status: :unprocessable_entity\n # end\n end\n end", "def update\n @comment1 = Comment1.find(params[:id])\n\n respond_to do |format|\n if @comment1.update_attributes(params[:comment1])\n format.html { redirect_to @comment1, notice: 'Comment1 was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment1.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @comment.update(comment_params)\n render json: @comment, serializer: CommentSerializer\n else\n render_error :unprocessable_entity, @comment.errors\n end\n end", "def update\n @comment = Comment.find(params[:id])\n @comment.user_id = params[:user_id]\n @comment.announcement_id = params[:announcement_id]\n @comment.description = params[:description]\n @comment.save\n render json:@comment\n end", "def update\n authorize [:api, :v1, @requesting_object]\n ticket = ServiceTicket.where(\n client_key: params['avatar_key'],\n id: params['id']\n ).first\n if params['comment_text']\n ticket.comments << Comment.new(author: params['avatar_name'],\n text: params['comment_text'])\n end\n ticket.update(status: params['status']) if params['status']\n render json: { message: 'OK' }, status: :ok\n end", "def update\n if @comment.update_attributes(comment_params)\n render json: @comment, status: :ok\n else\n render json: {error: \"Not found\"}, status: :not_found\n end\n end", "def update\n #if @user && @user.posts.include(@post)\n @comment.update(comment_params)\n json_response(@comment)\n end", "def update\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, :notice => 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, :notice => 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @comment = Comment.find(params[:id])\n if @comment.update(comment_params)\n render json: {status: \"success\", data: {comment: @comment}}, status: :ok\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment.generic_item, :notice => t('notice.successfully_updated') }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.xml { head :ok }\n format.json { head :ok } \n else\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n format.json { render :json => @comment.errors, :status => :unprocessable_entity } \n end\n end\n end", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: 'comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, :notice => 'Comment was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, :notice => 'Comment was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_pull_request_comment(repo, comment_id, body, options = {})\n options.merge! :body => body\n patch(\"#{Repository.path repo}/pulls/comments/#{comment_id}\", options)\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { render :json => {:comment => @comment, :status => 200} }\n else\n format.html { render :edit }\n format.json { render :json => {:comment => @comment, :status => 400 } }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment1.update(comment1_params)\n format.html { redirect_to @comment1, notice: 'Comment1 was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment1 }\n else\n format.html { render :edit }\n format.json { render json: @comment1.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @comment.update(comment_params)\n render json: {status: 'Comment was successfully updated.'}, status: :201\n else\n render json: { message: \"Error. Error. Please try again.\"}, status: 400\n end\n end", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to project_sprint_user_story_comments_path, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @comment = current_user.comments.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to post_path(@comment.post), notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t respond_to do |format|\n\t if @comment.update(comment_params)\n\t format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n\t format.json { head :no_content }\n\t else\n\t format.html { render action: 'comment' }\n\t format.json { render json: @comment.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @comment = Comment.find(params[:id])\n @posts = Post.find_by_id(@comment.post_id)\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @posts, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to admin_comments_url, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_answer_comment.update(api_v1_answer_comment_params)\n format.html { redirect_to @api_v1_answer_comment, notice: 'Answer comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_answer_comment }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_answer_comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n if @comment.update(comment_params)\n\n render json: @comment,status: :ok\n\n else\n\n render json: {error: true,errors: @comment.errors},status: :unprocessable_entity\n\n end\n\n \t\tend", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_back(fallback_location: root_path, notice: t('comment.update_msg')) }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json {\n render json: @comment.errors, status: :unprocessable_entity\n }\n end\n end\n end", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: 'Note was successfully updated.' }\n format.js { head :ok }\n else\n format.html { render action: \"edit\" }\n format.js { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch!\n request! :patch\n end", "def update\n # @comment = Comment.find(params[:id])\n end", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: t(\"actions.updated\", model: t(\"activerecord.models.#{controller_name.singularize.gsub(\" \", \"\")}\"))}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, \tºlocation: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n isadmin\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n# @comment.delete_empty_notes\n @comment.set_flag(params[:flag])\n format.html { redirect_to homework_comments_url(), notice: 'Comment was successfully updated.' }\n format.js {render :index}\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to [@section, @commentable, :comments], notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @comment.update(comment_params)\n end", "def edit\n respond_with @comment\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @issue_path, notice: 'Comment is sucesfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n redirect_to \"/home/index\"\n #@comment = Comment.find(params[:id])\n #respond_to do |format|\n #if @comment.update_attributes(params[:comment])\n #format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n #format.json { head :ok }\n #else\n #format.html { render action: \"edit\" }\n #format.json { render json: @comment.errors, status: :unprocessable_entity }\n #end\n #end\n end", "def update\n @comment = Comment.find(params[:id])\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to post_comment_path(@post, @comment), notice: \"Comment was successfully updated.\" }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to post_path(@comment.post, :anchor => \"comment_#{@comment.id}\"), :notice => t(\"messages.comments.updated\") }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment.submission }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @comment = @posting.comments.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n #@comment.create_activity :update, owner: current_user\n format.html { redirect_to postings_path, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def comments_put(resource, comment)\n merged_options = options.merge({ resource: resource, comment: comment })\n response = RestClient.post endpoint(\"/comments/put\"), merged_options\n parse_response(response)\n end", "def update \n commentable = find_commentable_object\n @comment = Comment.find(params[:id])\n \n respond_with do |format|\n if @comment.update_attributes(params[:comment])\n @comment.pending_for_moderation\n @comment_updated = @comment\n @comment = Comment.new\n \n flash.now[:notice] = 'Comment was successfully updated.'\n else\n flash.now[:alert] = 'Comment was not successfully updated.'\n end\n end\n \n # respond_to do |format|\n # if @comment.update_attributes(params[:comment])\n # format.html { redirect_to(@post, :notice => 'Comment was successfully updated.') }\n # format.xml { head :ok }\n # else\n # format.html { render :action => \"edit\" }\n # format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n # end\n # end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was fail updated.' }\n format.json { render :show, status: :ok, location: @comment }\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize(comment)\n if comment.update(comment_params)\n render json: { message: \"Feedback successfully updated!\", error: false}\n else\n render json: { message: \"Sorry, feedback could was not updated. Please try again.\", error: true }\n end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment.snippet, notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render @comment.snippet }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def update\n @comment = @complaint.comments.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to([@comment.complaint, @comment], :notice => 'Su comentario ha sido actualizado.') }\n format.json { head :ok }\n format.js\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n return forbidden unless user_owns_comment\n return bad_request(@comment.errors.full_messages) unless @comment.update_attributes(text: comment_params[:text])\n\n render json: {data: {message: 'The comment has been updated'}}, status: :ok\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Zmodyfikowano komentarz.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment.blog}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @comment.update_attributes(params[:comment])\n respond_with(@comment, location: redirect_to_index)\n end", "def update\n respond_to do |format|\n if @recipe_comment.update(recipe_comment_params)\n format.html { redirect_to @recipe_comment, notice: 'Recipe comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe_comment }\n else\n format.html { render :edit }\n format.json { render json: @recipe_comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_review_comment(repo, comment_id, body, options = {})\n opts = options.dup\n opts[:body] = body\n patch \"#{Repository.path repo}/pulls/comments/#{comment_id}\", opts\n end", "def update\r\n\t\t@comment = Comment.find(obfuscate_decrypt(params[:id], session))\r\n\t\t@commentable = @comment.commentable\r\n\r\n bOK = false\r\n if params[:commit] == \"Cancel\"\r\n # if user clicks \"Cancel\", reload the page with original data\r\n bOK = true\r\n else\r\n # make database updates before reloading the page\r\n bOK = update_options\r\n if bOK\r\n bOK = @comment.update_attributes(params[:comment])\r\n end\r\n end\r\n\r\n\t\trespond_to do |format|\r\n\t\t\tif bOK\r\n flash[:edit_comment_errors] = nil\r\n @comment = Comment.find(obfuscate_decrypt(params[:id], session))\r\n @option_ids = @comment.comment_options.pluck('option_id')\r\n @comment_option_lookups = CommentOptionLookup.order\r\n @this_comment = @comment.comment\r\n format.html { redirect_to flowsheet_user_patient_path(obfuscate_encrypt(@comment.commentable.patient_id, session)), notice: 'Comment was successfully updated.' }\r\n\t\t\t\tformat.json { head :ok }\r\n\t\t\t\tformat.js\r\n else\r\n flash[:edit_comment_errors] = @comment.errors.full_messages\r\n\t\t\t\tformat.html { redirect_to flowsheet_user_patient_path(obfuscate_encrypt(@comment.commentable.patient_id, session)), notice: \"There were problems updating your comment. Please try again:\" }\r\n\t\t\t\tformat.json { render json: @comment.errors, status: :unprocessable_entity }\r\n\t\t\t\tformat.js { render action: 'edit' }\r\n\t\t\tend\r\n\t\tend\r\n\tend" ]
[ "0.7226496", "0.7066668", "0.7064678", "0.7026576", "0.688447", "0.67779386", "0.6736587", "0.6731807", "0.6723913", "0.6723913", "0.66942424", "0.66683316", "0.66611844", "0.6640123", "0.66345304", "0.6628578", "0.66055954", "0.6598923", "0.65973103", "0.65973103", "0.65964705", "0.65922165", "0.6588796", "0.657848", "0.6576413", "0.6576413", "0.6573602", "0.6571038", "0.65675884", "0.65675884", "0.65675884", "0.65488845", "0.65420866", "0.6540671", "0.6540671", "0.6540671", "0.6540671", "0.6540671", "0.6540671", "0.6540671", "0.6540671", "0.6540671", "0.6539042", "0.6530136", "0.6523162", "0.6517348", "0.65006053", "0.65006053", "0.64896125", "0.6488811", "0.6470157", "0.64671147", "0.6455625", "0.6452388", "0.6432825", "0.6430793", "0.6427926", "0.6422453", "0.6415638", "0.6415638", "0.6415638", "0.6415638", "0.6415638", "0.6415638", "0.6415638", "0.6415638", "0.6415638", "0.6415638", "0.6415638", "0.6415638", "0.6415638", "0.6415638", "0.6415638", "0.6415638", "0.6415638", "0.6410301", "0.64030826", "0.6401469", "0.63755697", "0.6367444", "0.63553405", "0.6354705", "0.63347197", "0.6333336", "0.6329812", "0.6322215", "0.6320614", "0.6314272", "0.6309185", "0.6306593", "0.62944615", "0.62940884", "0.6285582", "0.6281417", "0.62751496", "0.6264324", "0.62606823", "0.62554526", "0.62436545", "0.6236081", "0.6229017" ]
0.0
-1
DELETE /comments/1 DELETE /comments/1.json
def destroy @comment.destroy respond_to do |format| format.html { redirect_to root_url, notice: 'Comment was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @comment.destroy\n respond_to do |format|\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 @comment1 = Comment1.find(params[:id])\n @comment1.destroy\n\n respond_to do |format|\n format.html { redirect_to comment1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = @commentable.comments.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n render json:@comment\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n \n respond_to do |format|\n format.xml { head :ok }\n format.json { head :ok } \n end\n end", "def destroy\n @comment.destroy\n head :no_content\n end", "def destroy\n @comment.destroy\n head :no_content\n end", "def destroy\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def delete_comments\n end", "def destroy\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :ok }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :ok }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :ok }\n end\n end", "def destroy\n @comment.destroy!\n head :no_content\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:comment_id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def delete_comment(id)\n record \"/msg/delete_comment/#{id}\"\n end", "def destroy\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to project_sprint_user_story_comments_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to post_path(@comment.post) }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to post_url(@comment.post_id) }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment1.destroy\n respond_to do |format|\n format.html { redirect_to comment1s_url, notice: 'Comment1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n if @comment.nil?\n render json: {error: \"Not found\"}, status: :not_found\n else\n @comment.destroy\n render json: @comment, status: :ok\n\n end\n end", "def destroy\n comment = Comment.find(params[:id])\n if current_user.id == comment.user_id\n post = comment.post\n post.data['comments'] = post.data['comments'] - 1\n if comment.destroy && post.save\n render json: {status: \"success\", data: {id: Integer(params[:id]), comments: post.data['comments']}}, status: :ok\n else\n render json: {status: \"failure\", data: nil}, status: 404\n end\n\n else\n render json: {status: \"failure\", data: nil}, status: 404\n end\n end", "def destroy\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to :back, :notice => t('successfully_deleted')}\n format.json { head :no_content }\n end\n end", "def destroy\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to comments_url, notice: 'Comentario eliminado.' }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n comment = Comment.find(params[:id])\n if comment.destroy\n render json: {destroyed: true}\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { head :ok }\n format.xml { head :ok }\n end\n end", "def destroy\n @comment = Comment.destroy(params[:id])\n end", "def destroy\n @comment = Comment.destroy(params[:id])\n end", "def destroy\n if @commentable.comments.find(params[:id]).destroy\n render json: { success: true }\n end\n end", "def destroy\n @dish_comment = @dish.dish_comments.find(params[:id])\n @dish_comment.destroy\n\n respond_to do |format|\n format.html { redirect_to dish_comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n puts \"Inside destroy. Comment id is \"+params[:id].to_s\n #puts \"Post id is \"+params[:postid].to_s\n @comment = Comment.find(params[:id])\n @comment.destroy\n @posts = Post.find_by_id(params[:postid])\n\n respond_to do |format|\n format.html { redirect_to @posts }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n respond_with(@post, @comment)\n end", "def destroy\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(post_url(@post), :notice => \"Comment was removed\") }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n end", "def destroy\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to user_secret_comments_path(@user, @secret) }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_path }\n format.xml { head :ok }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @visit_comment.destroy\n respond_to do |format|\n format.html { redirect_to visit_comments_url, notice: 'Comentario eliminado con exito' }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to post_comments_url, notice: \"Comment was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n\n if @comment.destroy\n\n render json: {comment: {id: params[:id].to_i}},status: :ok\n\n else\n\n render json: {error: true,errors: @comment.errors},status: :unprocessable_entity\n\n end\n\n \t\tend", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n\t\trespond_with @comment, :location => @comment.post\n end", "def destroy\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to_commentable(@comment, false) }\n format.xml { head :ok }\n end\n end", "def destroy\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to \"index\", notice: 'Comment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to comments_url, notice: 'Usunięto komentarz.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = @repository.comments.find(params[:id])\n authorize @comment\n @comment.destroy\n respond_with @comment\n end", "def destroy\n @story_comment = StoryComment.find(params[:id])\n @story_comment.destroy\n\n respond_to do |format|\n format.html { redirect_to story_comments_url }\n format.json { head :ok }\n end\n end", "def destroy\n redirect_to \"/home/index\"\n #@comment = Comment.find(params[:id])\n #respond_to do |format|\n #format.html { redirect_to comments_url }\n #format.json { head :ok }\n #end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to comments_url, notice: 'Comment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comment_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n unless @comment.present?\n @comment.destroy\n end\n\n respond_to do |format|\n format.html { redirect_to admin_comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(\"/\") }\n format.xml { head :ok }\n end\n end", "def destroy\n @comments = Comment.where(question_id: @question.id)\n @comments.each do |comment|\n comment.destroy\n end\n @question.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_comments_url) }\n format.xml { head :ok }\n end\n end", "def delete_comment1\n params[:comment].each { |key, value|\n comment=Comment.find(key)\n if !comment.nil?\n k comment.destroy\n end\n }\n redirect_to requirements_path\n end", "def destroy\n @comment14.destroy\n respond_to do |format|\n format.html { redirect_to comment14s_url, notice: 'Comment14 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment.destroy\n respond_with(@comment, location: redirect_to_index)\n end", "def destroy\n @comment = @posting.comments.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n #@comment.create_activity :destroy, owner: current_user\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to post_path(@comment.post), notice: 'Comment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect }\n format.xml { head :ok }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { render :nothing => true }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to comments_url, notice: 'Comment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to comments_url, notice: 'Comment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to comments_url, notice: 'Comment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to comments_url, notice: 'Comment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to comments_url, notice: 'Comment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.75611866", "0.74358994", "0.73740494", "0.73681736", "0.7359092", "0.7355231", "0.7294599", "0.7294599", "0.727844", "0.7270565", "0.72603524", "0.72603524", "0.72603524", "0.72558737", "0.72558737", "0.72558737", "0.7241665", "0.7240772", "0.7240202", "0.7240202", "0.7240202", "0.7240202", "0.7240202", "0.7240202", "0.7240202", "0.7240202", "0.7240202", "0.7240202", "0.7240202", "0.7240202", "0.7240202", "0.7240202", "0.7240202", "0.72330916", "0.71895593", "0.71842074", "0.7148797", "0.7145958", "0.71336055", "0.7118882", "0.7109058", "0.7107792", "0.7096745", "0.70846456", "0.7066005", "0.706142", "0.70578074", "0.7055439", "0.7055439", "0.7045216", "0.70448714", "0.70214885", "0.69965047", "0.699612", "0.6995898", "0.69942296", "0.6987752", "0.69874734", "0.69862664", "0.69862664", "0.69862664", "0.69862664", "0.69862664", "0.69862664", "0.69862664", "0.69862664", "0.69862664", "0.69862664", "0.69862664", "0.69862664", "0.69862664", "0.69837487", "0.69778985", "0.69695616", "0.6967985", "0.6963756", "0.6957364", "0.69565195", "0.6949777", "0.6944117", "0.69425315", "0.69377595", "0.69340885", "0.69339085", "0.6932644", "0.69324696", "0.69287264", "0.69269526", "0.6926282", "0.6912814", "0.69039416", "0.6896876", "0.6896408", "0.68823725", "0.68808764", "0.6877498", "0.6877498", "0.6877498", "0.6877498", "0.6877498" ]
0.6906828
90
Use callbacks to share common setup or constraints between actions.
def set_comment @comment = Comment.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def comment_params params.require(:comment).permit(:user_id, :project_id, :comments) 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 valid_params_request?; 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 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 model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "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 valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\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 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 valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\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 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 maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\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 url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\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 droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\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.6980957", "0.6783065", "0.6747844", "0.6741468", "0.67356336", "0.6592548", "0.65036845", "0.64978707", "0.64825076", "0.64795035", "0.64560914", "0.64397955", "0.6379666", "0.6376688", "0.6366702", "0.6319728", "0.6300833", "0.6300629", "0.6294277", "0.6293905", "0.6291174", "0.62905735", "0.6283171", "0.6242344", "0.62403613", "0.6218049", "0.62143815", "0.62104696", "0.61949855", "0.6178671", "0.6176147", "0.6173327", "0.6163395", "0.6153005", "0.6151833", "0.6147288", "0.61224324", "0.6118827", "0.61075264", "0.61054534", "0.6092497", "0.6080082", "0.60710967", "0.60627776", "0.60219413", "0.60175914", "0.60153484", "0.60107356", "0.60081726", "0.60081726", "0.60013986", "0.6000165", "0.59978646", "0.59936947", "0.59925723", "0.5992084", "0.59796256", "0.5967569", "0.5960056", "0.59589803", "0.5958441", "0.5958401", "0.5952607", "0.5952406", "0.5944409", "0.59391016", "0.593842", "0.593842", "0.5933845", "0.59312123", "0.5926475", "0.59248453", "0.59179676", "0.59109294", "0.59101623", "0.5908172", "0.59058356", "0.5899052", "0.5897749", "0.5896101", "0.58942914", "0.58939576", "0.5892063", "0.5887407", "0.588292", "0.58797663", "0.587367", "0.58681566", "0.5868038", "0.5866578", "0.58665025", "0.58655846", "0.58640826", "0.5863465", "0.5862226", "0.586065", "0.58581287", "0.5854443", "0.5854172", "0.58507544", "0.5849934" ]
0.0
-1
utility method for base64 encode on subject. taken from
def base64(text, charset="iso-2022-jp", convert=true) if convert if charset == "iso-2022-jp" text = NKF.nkf('-j -m0', text) end end text = [text].pack('m').delete("\r\n") "=?#{charset}?B?#{text}?=" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encode_base64(text)\n Base64.strict_encode64(text).strip\n end", "def base64_encode\n [self].pack('m').chop\n end", "def encode\n ::Base64.encode64(@string)\n end", "def encode_base64\n [self].pack(\"m*\")\n end", "def encode_str(str)\n require \"base64\"\n encoded_str=Base64.encode64(str)\n return encoded_str\nend", "def base64_encode value\n encoded_str = Base64.urlsafe_encode64 value, padding: false\nend", "def encode(str)\n @base64 = Base64.encode64(str)\n end", "def base64_encode(string)\n SSL.base64_encode(string)\n end", "def base64_encode(string)\n SSL.base64_encode(string)\n end", "def encode_base64!\n self.replace(self.encode_base64)\n end", "def base64(stuff)\n Base64.encode64(stuff).delete(\"\\n\")\n end", "def encode_string; end", "def to_base64\n Base64.strict_encode64 to_escp\n end", "def encode(value)\n Base64.encode64 value\n end", "def b64_encode(string)\n Base64.encode64(string).tr(\"\\n=\",'')\n end", "def urlsafe_encode64(bin)\n strict_encode64(bin).tr(\"+/\", \"-_\")\n end", "def get_mms_message_encode64\n #encoded=Base64.encode64(s)\n return Base64.encode64(self.get_mms_message)\n end", "def to_base64\n base64 = [to_s].pack('m').delete(\"\\n\")\n base64.gsub!('/', '~')\n base64.gsub!('+', '-')\n base64\n end", "def to_base64\n\t\treturn Base64.encode64(self)\n\tend", "def base64_encode\n Base64.encode64(file_contents)\n end", "def encode(string)\n Base64.encode64(string).gsub(/\\n/, \"\")\n end", "def encode(string); end", "def encode64\n Base64.strict_encode64(compress)\n end", "def b64encode_it(contents = nil)\r\n\t\t\tunless contents.nil?\r\n\t\t\t\tx = Base64.encode64(contents)\r\n\t\t\t\treturn x\r\n\t\t\tend\r\n\t\tend", "def create_base64_subject(artifact)\n return Base64.urlsafe_encode64(\"urn:maven/artifact##{artifact.group_id}:#{artifact.artifact_id}:#{artifact.version}::#{artifact.extension}\")\n end", "def strict_encode64(bin)\n return Base64.strict_encode64(bin) if Base64.respond_to? :strict_encode64\n Base64.encode64(bin).tr(\"\\n\",'')\n end", "def encode!; end", "def encode64( png )\n return Base64.encode64(png)\n end", "def to_base64\n [self].pack(\"m\")\n end", "def base64digest\n DigestUtils.pack_base64digest(digest)\n end", "def fake_base_64\n Base64.urlsafe_encode64(words(20).join)\nend", "def encode_string_ex; end", "def convert_to_base64(csv)\n Base64.encode64(csv)\n end", "def e64(s)\n return unless s\n CGI.escape Base64.encode64(s)\n end", "def encode_params_base64(params)\n query = params.map { |(k, v)| \"#{uri_escape(k.to_s)}=#{uri_escape(v.to_s)}\" }.join('&')\n s = Base64.encode64(query)\n s.gsub!(/(\\s|==$)/, '')\n s\n end", "def strict_encode64(key)\n value = self[key]\n encoded = if Base64.respond_to?(:strict_encode64)\n Base64.strict_encode64(value)\n else\n [value].pack('m0')\n end\n self[key] = encoded.delete(\"\\n\\r\")\n end", "def base64\n binary = open { |io| io.read }\n result = Base64.strict_encode64(binary)\n binary.clear # deallocate string\n result\n end", "def encode_mail(id)\n enc = OpenSSL::Cipher.new('AES-256-CBC')\n enc.encrypt\n enc.pkcs5_keyivgen(KEY)\n crypted = enc.update(@emails[id])\n crypted << enc.final\n crypted.unpack('H*')[0]\n end", "def encode()\n \"data:#{self.filetype};base64,\" + self.raw_encode\n end", "def jwt_encode(payload)\n JWT.encode(payload, Config.jwt_encode_key, Config.jwt_algorithm)\n end", "def base64(digits)\n string(BASE64_DIGITS, digits)\n end", "def auth_encoder(authentication)\n Base64.urlsafe_encode64(authentication.to_json.to_s).chomp\n end", "def encode64(bin)\n [bin].pack(\"m\")\n end", "def encode64(bin)\n [bin].pack(\"m\")\n end", "def base64(value)\n {\"Fn::Base64\" => value}\n end", "def strict_encode64(string)\n [string].pack('m0')\n end", "def strict_encode64(bin)\n [bin].pack(\"m0\")\n end", "def encode\n transform :encode \n end", "def b64_e(data)\n Base64.encode64(data).chomp\n end", "def encode(text); end", "def encode(text); end", "def encode(payload)\n JWT.encode(payload, secret_key, 'HS512')\n end", "def b64encode(bin, len = 60)\n encode64(bin).scan(/.{1,#{len}}/o) do\n print $&, \"\\n\"\n end\n end", "def encoding(id, secret)\n #chercher a quoi correspond la methode .strict\n #.strict_encode64 sert a crypter les données dans un type particulier\n #appelé Base64\n #mettre un 'Basic espace' a l'interieur de la string\n return \"Basic \" + (Base64.strict_encode64(\"#{id}:#{secret}\"))\nend", "def base64\n binary = open { |io| io.read }\n result = Base64.encode64(binary).chomp\n binary.clear # deallocate string\n result\n end", "def jwt_encode(payload)\n JWT.encode(payload, private_key, ALGORITHM, kid: jwk_kid)\n end", "def encode\n \"#{global_id}|#{message_id}|#{channel.gsub(\"|\", \"$$123$$\")}|#{data}\"\n end", "def encript(text_to_encript)\n require 'base64'\n Base64.encode64(text_to_encript)\n\nend", "def meta_encode(meta)\n Base64.encode64(Marshal.dump(meta))\n end", "def to_smtp_plain\n Base64.encode64(\"\\0XX\\0#{self.key}\").strip\n end", "def to_encoded_str\n string_io = StringIO.new\n self.encode string_io\n string_io.string\n end", "def encode(payload)\n JWT.encode(payload, secret_key, 'HS256')\n end", "def encode(payload)\n JWT.encode(payload, secret_key, 'HS256')\n end", "def encode\n # no op\n end", "def encode(plain_pass)\n md5 salt + plain_pass + salt\n end", "def encode(*); self; end", "def bin_to_base64(bin)\nreturn bin.scan(/....../).map { |x| $BASE64[x.to_i(2)] }.join\nend", "def encode_bytes(raw_bytes)\n Base64.urlsafe_encode64(raw_bytes)\n end", "def encoder; end", "def encoder; end", "def raw_encode()\n return Base64.encode64(File.read @file_path).delete(\"\\n\") if RUBY_VERSION < \"1.9.0\"\n Base64.strict_encode64(File.read @file_path)\n end", "def encode\n raise NotImplementedError\n end", "def sha1_base64\n str = Base64.encode64(Digest::SHA1.digest(salted_name)).strip\n str.tr('+/', '-_').gsub(/=/,'')\n end", "def encode\n type_byte + encode_data\n end", "def make_base64_file(fname)\n b64 = Base64.strict_encode64(File.read(fname))\n File.write(B64NAME, b64)\n B64NAME\nend", "def encode(_)\n raise NotImplementedError\n end", "def encode(string)\n Base32.encode(string).downcase.sub(/=+$/, '')\n end", "def encoded_body\n @encoded_body ||= should_encode? ? encode(body) : body.to_s\n end", "def encode(message)\n char_array = [*'a'..'z'].rotate(-1)\n message.downcase.chars.map! { |x| char_array.include?(x) ? x = char_array[(char_array.index(x)+3)%26] : x }.join\nend", "def encrypt(text_to_encrypt, base64_encode=true)\n encrytped = public_key.public_encrypt(text_to_encrypt)\n base64_encode ? Base64UrlSafe.encode(encrytped) : encrytped\n end", "def reencode_string(input); end", "def shorten\n encode\n end", "def encode!(*); self; end", "def encode(payload)\n #return token\n JWT.encode(payload, secret_key, 'HS256')\n end", "def encode(immune, input)\n return nil if input.nil?\n encoded_string = ''\n encoded_string.encode!(Encoding::UTF_8)\n input.encode(Encoding::UTF_8).chars do |c|\n encoded_string << encode_char(immune,c)\n end\n encoded_string\n end", "def raw_to_base_64(byte_array)\n return \"\" if byte_array == []\n ((3 - (byte_array.length % 3)) % 3).times { byte_array << 0 }\n c1 = BASE_64_CHARS[byte_array[0] >> 2]\n c2 = BASE_64_CHARS[(byte_array[0] % 4) * 16 + (byte_array[1] >> 4)]\n c3 = BASE_64_CHARS[(byte_array[1] % 16) * 4 + (byte_array[2] >> 6)]\n c4 = BASE_64_CHARS[byte_array[2] % 64]\n c1 + c2 + c3 + c4 + raw_to_base_64(byte_array[3..-1])\nend", "def base64(length: T.unsafe(nil), padding: T.unsafe(nil), urlsafe: T.unsafe(nil)); end", "def encode_body\n body = ''\n if @topic.nil? || @topic.to_s.empty?\n raise 'Invalid topic name when serialising packet'\n end\n body += encode_string(@topic)\n body += encode_short(@id) unless qos.zero?\n body += payload.to_s.dup.force_encoding('ASCII-8BIT')\n body\n end", "def encode(data)\n case @encoding\n when nil, :none, :raw\n data\n when :base64\n Base64.encode64(data)\n else\n raise Cryptic::UnsupportedEncoding, @encoding\n end\n end", "def hex_to_base64(s)\n [[s].pack(\"H*\")].pack('m*')\nend", "def base64\n content = storage.read(id)\n base64 = Base64.encode64(content)\n base64.chomp\n end", "def urlsafe_base64_asymmetric_encrypt(data, public_key)\n # Load key\n pkey = OpenSSL::PKey::RSA.new(public_key, nil)\n raise 'Invalid public key.' unless pkey.public?\n\n # Encrypt data\n encrypted_data = pkey.public_encrypt(data)\n # Encode encrypted data with custom Encoder\n custom_base64_urlsafe_encode(encrypted_data)\n end", "def generate_context(context)\n Base64.encode64(super)\n end", "def bijective_encode\n \t# from http://refactormycode.com/codes/124-base-62-encoding\n \t# with only minor modification\n \t# return ALPHABET[0] if i == 0\n \t# s = ''\n \t# base = ALPHABET.length\n \t# while i > 0\n \t# \ts << ALPHABET[i.modulo(base)]\n \t# \ti /= base\n \t# end\n \t# s.reverse + SecureRandom.hex(5 - s.length)\n \tSecureRandom.hex(4)\n end", "def encode( msg )\r\n msg = msg.gsub(/[^A-Za-z]/, '').upcase\r\n msg += \"X\"*(5 - (msg.length % 5)) unless msg.length % 5 == 0\r\n\r\n msgNumbers = to_numbers( msg )\r\n cipherNumbers = to_numbers( generate_keystream( msg.length ) )\r\n\r\n resultNumbers = []\r\n msgNumbers.each_with_index do |item, index|\r\n temp = item + cipherNumbers[index]\r\n temp = temp - 26 if temp > 26\r\n resultNumbers << temp\r\n end\r\n\r\n return to_chars( resultNumbers )\r\n end", "def encode(value)\n value.to_s(BASE)\n end", "def encode_chunk(chunk); end", "def encrypt64(str)\n enc = ''\n while str.length > self.encrypt_block_size\n enc += self.public_encrypt(str[0..self.encrypt_block_size])\n str = str[self.encrypt_block_size+1..-1] if str.length > self.encrypt_block_size\n end\n if str.length != 0 then\n enc += self.public_encrypt(str[0..self.encrypt_block_size])\n end\n Base64.encode64(enc)\n end", "def encode_attachment(file_path:, file_type: nil)\n # try to find file_type\n if file_type.nil?\n content_types = MIME::Types.type_for(file_path)\n file_type = content_types.first.content_type if content_types.any?\n end\n\n # if file_type not found in previous step\n if file_type.nil?\n raise('File type not found. Specify a file_type argument.')\n end\n\n file_contents = open(file_path) { |f| f.read }\n encoded = Base64.encode64(file_contents)\n mime_padding = \"data:#{file_type};base64,\"\n mime_padding + encoded\n end", "def encoded\n if @stream\n if @str.respond_to?(:rewind)\n @str.rewind\n end\n Base64.encode(@str.read)\n else\n Base64.encode(@str)\n end\n end" ]
[ "0.77284324", "0.7627105", "0.76223755", "0.7536275", "0.7465532", "0.7446022", "0.73618704", "0.7345858", "0.7345858", "0.7275204", "0.7172558", "0.71377504", "0.7133715", "0.71039647", "0.7054674", "0.7008913", "0.6991219", "0.69897175", "0.6958079", "0.6949216", "0.6942564", "0.69392174", "0.6917575", "0.6896754", "0.67927635", "0.6735547", "0.6696207", "0.6616212", "0.6596093", "0.6580389", "0.65783334", "0.6542908", "0.6523988", "0.6505138", "0.64986765", "0.6487955", "0.64697474", "0.6461921", "0.6425874", "0.6417894", "0.6408684", "0.6402838", "0.63393325", "0.63393325", "0.63310105", "0.630029", "0.6282734", "0.6273235", "0.6249428", "0.62371224", "0.62371224", "0.62340957", "0.6213172", "0.61982924", "0.6178573", "0.6177459", "0.6167196", "0.6147504", "0.6145182", "0.61077404", "0.60976326", "0.609645", "0.609645", "0.6073503", "0.60718775", "0.6067232", "0.60637677", "0.6042239", "0.60307866", "0.60307866", "0.6028258", "0.60195684", "0.60156274", "0.6014814", "0.60111785", "0.60023755", "0.6000504", "0.5986439", "0.59703135", "0.5969564", "0.5969331", "0.5959309", "0.5949167", "0.59478396", "0.5942418", "0.5941554", "0.594039", "0.5940201", "0.5926579", "0.5925971", "0.5925223", "0.5922643", "0.59168434", "0.5882093", "0.5868827", "0.5856143", "0.58544534", "0.5828668", "0.5820109", "0.58183527" ]
0.61170024
59
get every test to pass before coding runner below
def runner welcome card_total = initial_round until card_total > 21 do card_total = hit?(card_total) display_card_total(card_total) end end_game(card_total) 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 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 scenarios\n @runner.done_scenarios\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 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 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 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 passes; end", "def passes; end", "def run_all\n run_suite(@suite)\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 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 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 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\n checks.each(&:run)\n end", "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 run_all\n UI.info \"Running all tests...\"\n _really_run(Util.xcodebuild_command(options))\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 process_test_cases\n raise NotImplementedError, 'You must implement this'\n end", "def run_fe_tests\n end", "def test_run_completed(test_run)\n report_results test_run\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.7275367", "0.72012377", "0.7191292", "0.71326625", "0.7128869", "0.7035493", "0.68615764", "0.6822212", "0.6807081", "0.6791164", "0.6791164", "0.67651623", "0.6570472", "0.6553684", "0.65485567", "0.65461046", "0.6529981", "0.6459336", "0.64472514", "0.64472514", "0.64417815", "0.643361", "0.643361", "0.6429336", "0.6392527", "0.63646454", "0.63446635", "0.6338221", "0.6321568", "0.63006586", "0.6284046", "0.6276136", "0.62625813", "0.6260206", "0.6248236", "0.6236704", "0.62156725", "0.620084", "0.6200228", "0.61979204", "0.6197219", "0.619563", "0.6194052", "0.6193285", "0.6190417", "0.6190417", "0.6190417", "0.61895543", "0.6186312", "0.6171443", "0.6161009", "0.61582875", "0.61428964", "0.6136149", "0.6135334", "0.6135334", "0.6132495", "0.6132405", "0.61202425", "0.61126524", "0.6106808", "0.60882175", "0.6087337", "0.608716", "0.60843146", "0.60804", "0.60804", "0.60763645", "0.6076022", "0.6075976", "0.6072652", "0.6064899", "0.60518396", "0.6050178", "0.60422915", "0.6024515", "0.60225564", "0.60209924", "0.60179764", "0.6014065", "0.60128546", "0.60051364", "0.6002728", "0.6002728", "0.60017437", "0.5991716", "0.5991716", "0.5991716", "0.59846663", "0.5970318", "0.59693795", "0.5968506", "0.5966465", "0.5954567", "0.59536093", "0.5944166", "0.594219", "0.5941986", "0.594174", "0.5934003", "0.59288836" ]
0.0
-1
clean up dangling content blobs that are older than BLOB_GRACE_PERIOD and not associated with an asset
def clean_content_blobs ContentBlob.where(asset: nil).where('created_at < ?', BLOB_GRACE_PERIOD.ago).select do |blob| Rails.logger.info("Cleaning up content blob #{blob.id}") blob.reload blob.destroy if blob.asset.nil? end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def purge_blobs\n photos_attachments.each do |photo_attachment|\n if photo_attachment.marked_for_destruction?\n photo_attachment.blob.purge_later\n end\n end\n end", "def cleanup_temporary_image\n self.transaction do\n self.where('keep_till < ?', Time.now).all.each do |record|\n if record.refcount > 0\n record.keep_till = nil\n record.save\n else\n record.purge_image_data\n record.delete\n end\n end\n end\n end", "def cleanup_derivatives\n deleted_files = []\n image_derivatives = resource.file_metadata.select { |file| (file.derivative? || file.thumbnail_file?) && file.mime_type.include?(image_mime_type) }\n image_derivatives.each do |file|\n storage_adapter.delete(id: file.id)\n deleted_files << file.id\n end\n cleanup_derivative_metadata(derivatives: deleted_files)\n end", "def cleanup_old_files\n # make a local copy of to_delete while simultaneously clearing the original (atomicity)\n # local_to_delete = $to_delete.slice!(0..-1).to_a\n local_to_delete = []\n $to_delete.delete_if { |v| local_to_delete << v; true }\n\n $files.each_pair do |uuid, file|\n if file.nil?\n $files.delete uuid\n elsif local_to_delete.include?(uuid) || (Time.now - 60*60) > file.ctime\n file.close # Close it\n file.unlink if file.respond_to? :unlink # Unlink it if we can\n $files.delete uuid\n end\n end\n GC.start\nend", "def clean_snapshot snapshot\n snapshot_dt_clean = false\n until snapshot_dt_clean do\n snapshot_dt_clean, snapshot = replace_complex_datatypes snapshot\n end\n snapshot\n end", "def cleanup_derivatives\n deleted_files = []\n pyramidal_derivatives = resource.file_metadata.select { |file| file.derivative? && file.mime_type.include?(\"image/tiff\") }\n pyramidal_derivatives.each do |file|\n storage_adapter.delete(id: file.file_identifiers.first)\n deleted_files << file.id\n end\n cleanup_derivative_metadata(derivatives: deleted_files)\n end", "def clean(blob)\n blob[:isbn].gsub!(/[=\"]/,'')\n blob[:isbn13].gsub!(/[=\"]/,'')\n blob[:date_read] = Time.parse(blob[:date_read]).strftime(\"%F\") if blob[:date_read]\n blob[:date_added] = Time.parse(blob[:date_added]).strftime(\"%F\") if blob[:date_added]\n return blob\nend", "def cleanup_derivatives\n deleted_files = []\n raster_derivatives = resource.file_metadata.select { |file| file.derivative? || file.thumbnail_file? || file.cloud_derivative? }\n raster_derivatives.each do |file|\n storage_adapter.delete(id: file.file_identifiers.first)\n deleted_files << file.id\n end\n cleanup_derivative_metadata(derivatives: deleted_files)\n generate_mosaic unless deleted_files.empty?\n end", "def clean_cache!(seconds)\n File.grid.namespace.\n where(filename: /\\d+-\\d+-\\d+(?:-\\d+)?\\/.+/).\n and(:filename.lt => (Time.now.utc - seconds).to_i.to_s).\n delete\n end", "def delete_convention_data\n if self.metadata_file.present? && self.metadata_file.use_metadata_convention\n Rails.logger.info \"Removing convention data for #{self.accession} from BQ\"\n bq_dataset = ApplicationController.big_query_client.dataset CellMetadatum::BIGQUERY_DATASET\n bq_dataset.query \"DELETE FROM #{CellMetadatum::BIGQUERY_TABLE} WHERE study_accession = '#{self.accession}' AND file_id = '#{self.metadata_file.id}'\"\n Rails.logger.info \"BQ cleanup for #{self.accession} completed\"\n SearchFacet.delay.update_all_facet_filters\n end\n end", "def unsafe_forget_past!\n slices.values.map(&:history).each{|h| h.recent(memory_size)}\n\n if multi_slices?\n to_delete = slices.values.reject{|s| keep_slice?(s)}\n to_delete.map(&:rack_id).map do |rack_id| \n slices.delete(rack_id)\n end\n end\n end", "def cleanup_expired_snapshots(pool, datasets, interval, keep, should_destroy_zero_sized_snapshots)\n ### Find all snapshots matching this interval\n snapshots = Zfs::Snapshot.list(pool, {'recursive' => true}).select { |snapshot| snapshot.name.include?(snapshot_prefix_interval(interval)) }\n dataset_snapshots = group_snapshots_into_datasets(snapshots, datasets['included'] + datasets['excluded'])\n ### Filter out datasets not included\n dataset_snapshots.select! { |dataset, snapshots| datasets['included'].include?(dataset) }\n\n if should_destroy_zero_sized_snapshots\n dataset_snapshots = datasets_destroy_zero_sized_snapshots(dataset_snapshots)\n end\n\n ### Now that zero-sized are removed, remove expired snapshots\n dataset_snapshots.each do |dataset, snapshots|\n # Want to keep the first 'keep' entries, so slice them off ...\n dataset_snapshots[dataset].shift(keep)\n # ... Now the list only contains snapshots eligible to be destroyed.\n end\n threads = []\n dataset_snapshots.values.flatten.each do |snapshot|\n threads << Thread.new do\n snapshot.destroy\n end\n threads.last.join unless $use_threads\n end\n threads.each { |th| th.join }\nend", "def clear_expired_embargoes(regenerate_thumbnails: false)\n ::Hyrax::EmbargoService.assets_with_expired_embargoes.each do |presenter|\n item = ActiveFedora::Base.find(presenter.id)\n\n next if item.under_embargo?\n\n ::Hyrax::Actors::EmbargoActor.new(item).destroy\n\n next if item.is_a? FileSet\n\n item.copy_visibility_to_files\n item.save!\n\n RegenerateThumbnailJob.perform_later(item) if regenerate_thumbnails == true\n end\n end", "def clean_references\n s3_file_processor.clean_local_file if s3_file_processor.file_path\n end", "def cleanup_derivative_metadata(derivatives:)\n resource.file_metadata = resource.file_metadata.reject { |file| derivatives.include?(file.id) }\n updated_change_set = ChangeSet.for(resource)\n change_set_persister.buffer_into_index do |buffered_persister|\n buffered_persister.save(change_set: updated_change_set)\n end\n end", "def invalidate(blob_access, delete_single=false)\n if delete_single\n FileSystemMetaData.new(cache_file_path(blob_access)).delete\n else\n cache_path(blob_access).entries.each {|cache_file|\n unless cache_file.to_s.match(/\\.meta$/) || cache_file.directory?\n base_name = cache_file.to_s\n FileSystemMetaData.new(cache_path(blob_access).join(cache_file)).delete if base_name.match(cache_file_base(blob_access))\n end\n } if Dir.exist?(cache_path(blob_access))\n end\n end", "def clean_up\n #Delete every thing but the most recent config[:screenshot_max_keep] screenshots\n max_screenshots = self.config[:screenshot_max_keep] || 5\n #Delete the last created one while they count is more then the max\n while self.admo_screenshots.count > max_screenshots\n self.admo_screenshots.order_by('created_at asc').first.destroy\n end\n end", "def wipe_snapshots_data; end", "def wipe_snapshots_data; end", "def delete_unmarked_objects(&block)\n deleted_ids = []\n each_blob { |blob| deleted_ids += blob.delete_unmarked_entries(&block) }\n deleted_ids\n end", "def purge_old_backups!\n\n return if @config.retention_days == 0\n\n today = Date.today\n\n # Iterate through all objects in the container. When backups are stored,\n # they are stored with the filename [<backup date>]_<original filename>,\n # so we based our purging on the dates parsed from the filename.\n objects = container.objects\n objects.each do |object_name|\n if object_name =~ OBJECT_DATE_REGEXP\n\n object_date = Date.parse($1)\n object_age = (today - object_date).to_i\n\n if object_age > @config.retention_days\n\n container.delete_object(object_name)\n puts \" -> Purged old backup #{object_name}\"\n\n end\n\n end\n end\n\n end", "def cleanup_derivative_metadata(derivatives:)\n resource.file_metadata = resource.file_metadata.reject { |file| derivatives.include?(file.id) }\n resource.file_metadata.map { |fm| fm.error_message = [] }\n updated_change_set = ChangeSet.for(resource)\n change_set_persister.buffer_into_index do |buffered_persister|\n buffered_persister.save(change_set: updated_change_set)\n end\n end", "def cleanup_derivative_metadata(derivatives:)\n resource.file_metadata = resource.file_metadata.reject { |file| derivatives.include?(file.id) }\n resource.file_metadata.map { |fm| fm.error_message = [] }\n updated_change_set = ChangeSet.for(resource)\n change_set_persister.buffer_into_index do |buffered_persister|\n buffered_persister.save(change_set: updated_change_set)\n end\n end", "def expire_files(expiration_date)\n grid_infos = files_collection.find(uploadDate: {\"$lte\" => expiration_date}).to_a\n grid_info_ids = grid_infos.map { |info| info[:_id] }\n\n files_collection.delete_many(_id: {\"$in\" => grid_info_ids})\n chunks_collection.delete_many(files_id: {\"$in\" => grid_info_ids})\n end", "def clean_refill dirty_atts\n # TODO\n end", "def purge_later\n if attached?\n attachments.each(&:purge_later)\n @attachments = nil\n end\n end", "def collect_garbage!\n find_including_new_records(:all, :conditions => ['as_new = ? AND created_at < ?', true, Time.now - 1.week]).each(&:destroy)\n end", "def cleanup_derivative_metadata(derivatives:)\n resource.file_metadata = resource.file_metadata.reject { |file| derivatives.include?(file.id) }\n updated_change_set = DynamicChangeSet.new(resource)\n change_set_persister.buffer_into_index do |buffered_persister|\n buffered_persister.save(change_set: updated_change_set)\n end\n end", "def expire_files(expiration_date)\n old_objects = bucket.objects(prefix: @prefix).select do |object|\n object.last_modified <= expiration_date\n end\n\n delete(old_objects)\n\n bucket.multipart_uploads.each do |multipart_upload|\n next if @prefix && !multipart_upload.key.start_with?(@prefix)\n # no need to check multipart uploads initiated before expiration date\n next if multipart_upload.initiated > expiration_date\n\n most_recent_part = multipart_upload.parts.sort_by(&:last_modified).last\n if most_recent_part.nil? || most_recent_part.last_modified <= expiration_date\n abort_multipart_upload(multipart_upload)\n end\n end\n end", "def cleanup_derivatives\n change_set_persister.buffer_into_index do |buffered_changeset_persister|\n hocr_derivative_service(buffered_changeset_persister).cleanup_derivatives if parent.try(:ocr_language).present? && hocr_derivative_service(buffered_changeset_persister).valid?\n vips_derivative_service(buffered_changeset_persister).cleanup_derivatives if vips_derivative_service(buffered_changeset_persister).valid?\n end\n end", "def delete_fragments\n glob_cache_expire( 'C:/tmp/cache/views/user_type_id/*/browse/category_id/' + self.id.to_s )\n\n glob_cache_expire( 'C:/tmp/cache/views/user_type_id/*/shared_symbiont/symbiote_wrapper_container/symbiote_item_category_id/' + self.id.to_s )\n\n glob_cache_expire( 'C:/tmp/cache/views/user_type_id/*/shared_menu/menu_organized_category/category_id/' + self.id.to_s )\nend", "def cleanup(uploaded_file, file_path)\n File.delete(file_path) if uploaded_file.is_file_upload\n\n # clean up old uploads\n cutoff = Time.now - 1.hour\n lst = UploadedFile.where(status: 'I').all\n lst.each do |u|\n u.update_attribute(:status, 'F') if u.updated_at < cutoff\n end\n end", "def clean_cache\n node.normal['cloudflare']['threat_control']['status_cache'].reject! { |ip, data| is_stale? data['datetime'] }\nend", "def clear_expired_leases(regenerate_thumbnails: false)\n ::Hyrax::LeaseService.assets_with_expired_leases.each do |presenter|\n item = ActiveFedora::Base.find(presenter.id)\n\n next if item.active_lease?\n\n ::Hyrax::Actors::LeaseActor.new(item).destroy\n\n item.copy_visibility_to_files unless item.is_a? FileSet\n\n RegenerateThumbnailJob.perform_later(item) if regenerate_thumbnails == true\n end\n end", "def cleanup_derivatives\n change_set_persister.buffer_into_index do |buffered_changeset_persister|\n hocr_derivative_service(buffered_changeset_persister).cleanup_derivatives if parent.try(:ocr_language).present? && hocr_derivative_service(buffered_changeset_persister).valid?\n jp2_derivative_service(buffered_changeset_persister).cleanup_derivatives if jp2_derivative_service(buffered_changeset_persister).valid?\n end\n end", "def break_blob_lease(container, blob, options={})\n break_lease container, blob, options\n end", "def delete_small!\n @contents.delete_if do |c|\n# ((c[1] - c[0]) < @image.min_content_size*0.6) or\n ((c[1] - c[0]) < @image.min_obj_size) or\n ((c[0] - @image.min_obj_size <= 0) and (c[2]<@image.min_content_size)) or\n ((c[1] + @image.min_obj_size >= @projection.size) and (c[2]<@image.min_content_size))\n end\n end", "def redis_trace_chunks_cleanup!\n Gitlab::Redis::TraceChunks.with(&:flushdb)\n end", "def truncate_all\n Content::Version.all.map(&:destroy)\n ContentKey::Version.all.map(&:destroy)\n Content.all.map(&:destroy)\n ContentKey.all.map(&:destroy)\n end", "def ensure_compressed\n return if is_compressed?\n\n original_timestamp = blob_created_at\n content_upload(file_download)\n blob.update_column(:created_at, original_timestamp)\n end", "def clean\n nonces = Dir[@nonce_dir.join(\"*\")]\n now = Time.now\n \n nonces.each do |nonce|\n filename = nonce_dir.join(nonce)\n begin\n st = File.stat(filename)\n rescue Errno::ENOENT\n next\n else\n nonce_age = now - st.mtime\n self.remove_if_present(filename) if nonce_age > @max_nonce_age\n end\n end\n\n association_filenames = Dir[@association_dir.join(\"*\")]\n association_filenames.each do |af|\n begin\n f = File.open(af, 'r')\n rescue Errno::ENOENT\n next\n else\n begin\n assoc_s = f.read\n ensure\n f.close\n end\n begin\n association = OpenID::Association.deserialize(assoc_s)\n rescue \"VersionError\"\n self.remove_if_present(af)\n next\n else\n self.remove_if_present(af) if association.expires_in == 0 \n end\n end\n end\n end", "def purged_xml_for_clone\n local_structs_regex = []\n shape.local_structs.each do | struct |\n local_structs_regex << struct.name.underscore.downcase.dasherize\n end\n xml_doc.search('*[@resource-type=\"ActiveRecord\"]', *local_structs_regex.uniq).unlink\n xml_doc.search('file[@resource-type=\"Primitive\"]').each do |file|\n file['value'] = ''\n file['width'] = ''\n file['height'] = ''\n file['content_type'] = ''\n end\n xml_doc\n end", "def purge\n self.files.each do |f|\n f.destroy\n end\n self.commits.each do |c|\n c.destroy\n end\n end", "def delete_orphan_files_in_api(start)\n Find.find(api_output) do |path|\n if path.end_with?('.html') || path.end_with?('.html.gz')\n FileUtils.rm_f(path) if File.mtime(path) < start\n end\n end\n end", "def clean_environment\n `rm -rf /tmp/#{@upload_id}` # all sliced pages of the source file\n end", "def clean_bad_data\n self.character_achievements.select{|ca| ca.achievement }.group_by{|ca| ca.achievement.armory_id }.each{|aid, cas|\n if cas.size > 1\n cas[1,1000].each{|c| c.destroy }\n end\n }\n end", "def fix_scheduled_actions\n @db.transaction do\n # Removing hanging Scheduled Actions\n @to_delete.each do |o|\n @db[:schedaction_pool].where(:oid => o.id, :type => o.type).delete\n end\n end\n end", "def update_or_remove\n Event.transaction do\n clear_before_time = 1.second.ago\n yield\n remove_old_attachments(clear_before_time)\n end\n end", "def cleanup\n self.image = nil\n GC.start\n end", "def cleanup\n self.image = nil\n GC.start\n end", "def cleanup; end", "def cleanup; end", "def cleanup; end", "def cleanup; end", "def wipe_snapshots_data\n @snapshots_cycle = 0\n @snapshot_groups = {}\n end", "def expire!\n self.expired.each do |x|\n expired_type, set = x.shift\n\n new_type = (set[:types].select{|i| i != expired_type})\n if new_type.count == 0\n puts \"Deleting snapshot set created at #{set[:created_at]}\" if @verbose\n set[:ids].each{|id| @fog.delete_snapshot(id)}\n else\n puts \"Retagging snapshot set created at #{set[:created_at]}\" if @verbose\n set[:ids].each{|id| @fog.tags.create(:resource_id => id, :key => \"Type\", :value => new_type.join(\",\"))}\n end\n end\n end", "def transfer_and_cleanup\n transfer_and_cleanup_with_block do |type|\n if type == :cover_concept\n self.update_column(:cover_concept_image_processed, true)\n end\n\n if type == :stock_cover_image\n self.update_column(:stock_cover_image_processed, true)\n end\n end\n end", "def delete_cache_and_img_and_fingerprint\n self.delete_cache_and_img\n\n # why do we bother clearing our fingerprint if the AssetOutput itself\n # is about to get deleted? If we don't, the after_commit handler will\n # rewrite the same cache we just deleted.\n self.fingerprint = ''\n end", "def add(is_full_flush)\n content_data = $local_content_data\n return if content_data.empty?\n\n # for the latest content data added to the DB\n latest_snapshot = nil\n # for instances that were added regarding latest_snapshot\n added_cd = nil\n # for insrances that were removed regarding latest_snapshot\n removed_cd = nil\n\n latest_index_time = nil\n content_data.each_instance do |_,_,_,_,_,_,index_time|\n if latest_index_time.nil? || latest_index_time < index_time.to_i\n latest_index_time = index_time.to_i\n end\n end\n\n # Checking time consistency\n content_data_timestamp = DateTime.from_epoch(latest_index_time)\n if !@latest_timestamp.nil? && (content_data_timestamp <= @latest_timestamp)\n # It is possible when instances added at @latest_timestamp\n # were removed and any new instances addded,\n # then latest indexed time in the new content data\n # is earlier then @latest_timestamp\n # Example:\n # ContentData for Date1 (noted as latest_snapshot):\n # Content1\n # location1\n # location2\n # Between Date1 and Date2 location2 was removed\n # and no other file operations were done.\n # ContentData for Date2 (noted as content_data):\n # Content1\n # location1\n # Then:\n # content_data.remove_instances(latest_snapshot) is empty.\n latest_snapshot = get(@latest_timestamp)\n added_cd = content_data.remove_instances(latest_snapshot)\n msg = \"latest index time of the content data: #{content_data_timestamp}\" +\n \"must be later then latest timestamp: #{latest_timestamp}\"\n if added_cd.empty?\n # In this case we do not know exactly when the indexation was\n # then the timestamp is fake\n # TODO better solution?\n latest_timestamp_epoch = @latest_timestamp.strftime('%s')\n content_data_timestamp = DateTime.from_epoch(latest_timestamp_epoch.to_i + 1)\n Log.warning msg\n else\n fail msg\n end\n end\n\n if is_full_flush\n save(content_data,\n DiffFile::SNAPSHOT_TYPE,\n nil, # 'from' param is not relevant for full flush\n content_data_timestamp)\n end\n\n # If it is not the first content data that we store,\n # i.e there are already stored content data,\n # then a diff files are relevant.\n # NOTE we save diff (added/removed) files even in the case of full flush\n # cause of data consistency. It is crucial for the diff operation.\n # Example (simple, without removed):\n # When:\n # date1-date2.added\n # date2-date3.added (added along with a snapshot)\n # date3.snapshot\n # date3-date4.added\n # Then:\n # ContentDataDb.diff(date2, date4) = date2-date3.added + date3-date4.added\n if @latest_timestamp.nil?\n earliest_index_time = nil\n content_data.each_instance do |_,_,_,_,_,_,index_time|\n if earliest_index_time.nil? || earliest_index_time > index_time\n earliest_index_time = index_time\n end\n end\n content_data_from = DateTime.from_epoch(earliest_index_time)\n save(content_data,\n DiffFile::ADDED_TYPE,\n content_data_from,\n content_data_timestamp)\n else\n latest_snapshot ||= get(@latest_timestamp)\n\n added_cd ||= content_data.remove_instances(latest_snapshot)\n unless added_cd.empty?\n save(added_cd,\n DiffFile::ADDED_TYPE,\n @latest_timestamp,\n content_data_timestamp)\n end\n\n removed_cd = latest_snapshot.remove_instances(content_data)\n unless removed_cd.empty?\n save(removed_cd,\n DiffFile::REMOVED_TYPE,\n @latest_timestamp,\n content_data_timestamp)\n end\n end\n\n @latest_timestamp = content_data_timestamp\n end", "def cleanup_abandoned\n Reservation.all(:conditions => [ \"CONFIRM = ? and updated_at < ? and archived = ?\", false, 30.minutes.ago, false]).each do |r|\n debug \"cleanup_abandoned: deleting #{r.id}\"\n Reason.close_reason_is \"abandoned\"\n begin\n\tr.archive\n rescue RuntimeError => err\n\terror 'Cleanup: ' + err.to_s\n rescue ActiveRecord::StaleObjectError => err\n\terror 'Cleanup: ' + err.to_s\n\tlocking_error(r)\n end\n end\n end", "def cleanup!(content)\n content.each do |key, value| \n cleanup!(value) if value.is_a? Hash\n content.delete(key) if value.blank?\n end\n end", "def map_cleanup\n if !identity_count.zero?\n nowi = Time.now.to_i\n # delete_if is atomic\n # contents should not mutate during this call\n identity_map.delete_if do |identity, compo|\n if (flag = compo.eviction_timeout <= nowi)\n evict_flush(compo.codec)\n end\n flag\n end\n end\n current_size_and_limit\n end", "def cleanup\n begin\n File.delete(full_filename, full_filename + \".meta\")\n rescue\n logger.warn \"Unable to delete recordings files: #{full_filename}*\"\n end\n end", "def cleanup_cached_images()\n\n # swap_dir = \"../public/swap\" # use when running locally from /lib/b2_bucket.rb\n swap_dir = \"./public/swap\" # use when running via app.rb\n swap_contents = \"#{swap_dir}/*\"\n gitkeep = \"#{swap_dir}/.gitkeep\"\n\n if File.directory?(swap_dir)\n FileUtils.rm_rf(Dir.glob(swap_contents)) # delete contents of /public/swap \n file = File.new(gitkeep, 'w') # recreate .gitkeep file\n file.close if file\n else\n puts \"Directory does not exist!\"\n end\n\nend", "def db_cleaner\n JSON.parse(params[:mongified_data][:data]).each do |data|\n data[\"lob\"] = params[:mongified_data][:lob]\n @client.destroy(data)\n end\n end", "def cleanup_feeds()\n status = Status.get_status('feed_item_cleanup')\n last_update = Time.at(status.value.to_i).to_i\n now = Time.now.to_i\n if (last_update + (24*60*60) < now)\n # Save the new status time first, since this could be a long cleanup.\n status.value = now.to_s\n status.save\n\n puts \"Running garbage collection on feeds_items table.\"\n delete_count = 0;\n FeedsItems.find_each(:batch_size => 2000) do |feed_item|\n unless feed_item.feed.user_id.nil? \n user = feed_item.feed.user rescue user = nil\n item = feed_item.item rescue item = nil\n if user.nil? || item.nil? || !item.acl_check?(user)\n puts \"Destroying: #{feed_item.inspect}\"\n feed_item.destroy\n delete_count = delete_count + 1\n end\n end\n end\n puts \"Done. Delete #{delete_count} feeds_items.\"\n else\n puts \"Skipping GC of feeds_items table.\"\n end\n end", "def maybe_remove(asset)\n # don't need it if we already don't have hocr or textonly_pdf\n return if !asset.hocr && !asset.file_derivatives[:textonly_pdf]\n\n asset.hocr = nil\n # this kithe command will save record to, persisting the hocr=nil,\n # atomically concurrently safely making the change.\n asset.remove_derivatives(:textonly_pdf, allow_other_changes: true)\n end", "def remove_excess_backups\n glob_path = File.join(@new_path, \"#{File.basename(@original_file_path)}*\")\n\n backups = Dir.glob(glob_path).sort_by do |f|\n File.mtime(f)\n end\n\n if @limit > 0\n if backups.length > @limit\n #FileUtils.rm backups[0..(backups.length - (limit + 1))] # Same thing.\n backups[0..(backups.length - (@limit + 1))].each do |extra_file|\n FileUtils.rm extra_file\n end\n end\n end\n end", "def delete_expired_tempfiles\n return if !self.config.clean_up? || !self.config.enabled?\n log \"CloudTempfile.delete_expired_tempfiles is running...\"\n # Delete expired temp files\n fog_files = (self.config.local?)? local_root.files : get_remote_files\n fog_files.each do |file|\n if file.last_modified <= Time.now.utc.ago(self.config.clean_up_older_than)\n delete_file(file)\n end\n end\n log \"CloudTempfile.delete_expired_tempfiles is complete!\"\n end", "def delete_remaining_s3_assets\n # This gets up to 1000 objects.\n # If the user has over 1000 objects that were not in the database then there may be some assets remaining.\n keys = S3_BUCKET.objects(prefix: user.unique_id).map(&:key)\n\n s3_deletion_service.bulk_delete(keys)\n end", "def cleanup\n redis.zremrangebyscore(key, '-inf', time - timespan)\n end", "def limit_amazon_bucket\n if !self.is_master\n while Build.where(:is_master => [nil, false]).count > 30\n @exclude_build = Build.where(:is_master => [nil, false]).first\n @file = @exclude_build.file_object\n\n @file.destroy\n @exclude_build.destroy\n end\n end\n end", "def cleanup\n Feed.processing.update_all(processing: false)\n FeedItem.processing.update_all(processing: false)\n end", "def cleanup\n @period = :monthly\n @ranged = nil\n @range_start_date = nil\n @range_end_date = nil\n @one_time_date = nil\n @increment = nil\n end", "def cleanup!; end", "def cleanup!; end", "def gc!\n delete_if { |key, s| s.expired? }\n end", "def purge_image\n image.purge_later\n end", "def cleanup\n @agent_file_history.each { |af| FileUtils.rm_f(af) }\n @key_file_history.each { |kf| FileUtils.rm_f(kf) }\n end", "def clean_content(content)\n @content = content\n unless content.nil?\n correct_image_paths\n remove_typepad_links\n end\n end", "def remove_stale_files() = stale_files.each { |file| remove_file(file) }", "def cleanup\n cleanup_nonces\n cleanup_associations\n end", "def delete_uncompressed_backups\n end", "def expire_auth_related_fragments\n expire_download_activity\n expire_create_activity\n expire_resource_list_item_action_partial\n end", "def delete_older_files_from_cloud(story, story_revision, directory)\r\n if Rails.env == 'production'\r\n directory.files.all(:prefix=> \"stories/#{story.id}/pdf\").each do |file|\r\n file.destroy if (File.basename(file.key, File.extname(file.key)) != story.to_param + story_revision)\r\n end\r\n directory.files.all(:prefix=> \"stories/#{story.id}/epub\").each do |file|\r\n file.destroy if (File.basename(file.key, File.extname(file.key)) != story.to_param + story_revision)\r\n end\r\n end\r\n end", "def migrate_files_to_external_storage!\n return if stored_externally? || !use_external_diff? || merge_request_diff_files.count == 0\n\n rows = build_merge_request_diff_files(merge_request_diff_files)\n\n transaction do\n MergeRequestDiffFile.where(merge_request_diff_id: id).delete_all\n create_merge_request_diff_files(rows)\n save!\n end\n\n merge_request_diff_files.reset\n end", "def gc!(age)\n @timestamps.each do |job_key, timestamp|\n if timestamp[timestamp[:expire_type]] < age\n delete_worker(job_key)\n end\n end \n GC.start\n end", "def delete_expired_snapshots(region = AWSCONFIG[:default_region])\n #find snapshots with tags of expiring and less than today's date\n ec2 = AWS::EC2.new(:region => region).client\n snapshots = ec2.describe_snapshots(:owner_ids => [\"self\"], :filters => [:name => 'tag-key', :values => ['expiring']])\n deleted_snapshots = []\n\n #loop thru to see if they are in the past\n if snapshots\n snapshots.data[:snapshot_set].each do |s|\n expdate = get_tagvalue(s, \"expiring\")\n if expdate.length > 0\n begin\n expdate = Time.parse(expdate)\n if expdate < Time.now\n #expired in the past so delete\n deleted_snapshots << s\n ec2.delete_snapshot(:snapshot_id => s[:snapshot_id])\n end\n rescue => e\n #error parsing - do something or nothing\n end\n end\n end\n end\n\n return deleted_snapshots\n end", "def clear_marks\n each_blob { |blob| blob.clear_marks }\n end", "def delete_redactors\n RedactorUpload.delete_after_create(self.content)\n end", "def delete_expired_images(region = AWSCONFIG[:default_region])\n #find images with tags of expiring and less than today's date\n ec2 = AWS::EC2.new(:region => region).client\n images = ec2.describe_images(:owners => [\"self\"], :filters => [:name => 'tag-key', :values => ['expiring']])\n deleted_images = []\n\n #loop thru to see if they are in the past\n if images\n images.data[:images_set].each do |i|\n expdate = get_tagvalue(i, \"expiring\")\n if expdate.length > 0\n begin\n expdate = Time.parse(tags.value)\n if expdate < Time.now\n #expired in the past so delete\n deleted_images << i\n #delete associated snapshots first\n i[:block_device_mapping].each do |dev|\n ec2.delete_snapshot(:snapshot_id => dev[:ebs][:snapshot_id])\n end\n ec2.deregister_image(:image_id => i[:image_id])\n end\n rescue => e\n #error parsing - do something or nothing\n end\n end\n end\n end\n\n return deleted_images\n end", "def ensure_deletion_fixes \n # TO DO\n end", "def trimBlob(blob)\n if !blob.nil?\n return blob[4..-1]\n else\n return nil\n end\n end", "def rm_cddts_outof_blk\n axes = [@ref_rows, @ref_cols]\n axes.each{|axis|\n axis.each{|ref|\n intrsct_cddts = []\n (self.to_a.flatten & ref).each{|elm|\n intrsct_cddts.push(elm.cddts).flatten!.uniq!\n }\n six_cells_cddts = []\n (self.to_a.flatten - ref).each{|elm|\n six_cells_cddts.push(elm.cddts).flatten!.uniq!\n }\n intrsct_cddts.each{|cddt|\n unless six_cells_cddts.include?(cddt)\n (ref - self.to_a.flatten).each{|elm|\n elm.cddts.delete(cddt)\n# if ProgramConfig[:debug]\n# if elm.fixed == false and elm.cddts.length == 1\n# print \"DEBUG: [#{elm.i}, #{elm.j}] = #{elm.cddts.first}\\n\"\n# end\n# end\n elm.fixed = true if(elm.cddts.length == 1)\n }\n end\n }\n }\n }\n end", "def cleanup(ticker,env)\r\n ticker.cancel\r\n clear_buffer\r\n\r\n @upload.complete(@received).save\r\n \r\n env.chunked_stream_close\r\n env.logger.info 'received: ' + @received.to_s\r\n env.logger.info 'completed upload: ' + @upload.id.to_s\r\n end", "def clean_db(prev_versions)\nputs \"CLEAN DB CALLED\"\n if Version.count > prev_versions\n to_remove = Version.count - prev_versions\n puts \"Removing #{to_remove} old versions from database\"\n Version.all(:limit => to_remove, :order => [ :processed.asc ]).each do |old_version|\n old_version.units.all.each do |old_unit|\n #old_unit.images.all.each do |old_image|\n # old_image.destroy\n #end\n old_unit.destroy\n end\n old_version.destroy\n end\n end\n end", "def invalidate_content_conversions!\n if @invalidate_content_conversions\n @invalidate_content_conversions = false\n # $stderr.puts \"Invalidating ContentConversions for :src_uuid => #{self.uuid.inspect}\"\n ContentConversion.invalidate_src!(:src_uuid => self.uuid)\n end\n end", "def clear_blob_pages(container, blob, start_range, end_range, options={})\n query = { 'comp' => 'page'}\n query['timeout'] = options[:timeout].to_s if options[:timeout]\n\n uri = blob_uri(container, blob, query)\n\n headers = service_properties_headers\n headers['x-ms-range'] = \"bytes=#{start_range}-#{end_range}\"\n headers['x-ms-page-write'] = 'clear'\n\n # clear default content type\n headers['Content-Type'] = ''\n\n response = call(:put, uri, nil, headers)\n\n result = Serialization.blob_from_headers(response.headers)\n result.name = blob\n\n result\n end", "def destroy_old_commits_which_errored_during_import\n log(\"[destroy_old_commits_which_errored_during_import]\")\n Commit.errored_during_import.where(\"created_at < ?\", 2.days.ago).each do |commit|\n log(\"import errors for #{commit.revision}: #{commit.import_errors}\")\n destroy_and_notify_stash(commit)\n end\n end", "def purge obj, msg\n Dir.chdir(working_dir) do\n if File.file?(obj.blob.name)\n FileUtils.rm(obj.blob.name)\n end\n remove(obj.blob.name)\n end\n commit_index(msg)\n end" ]
[ "0.660854", "0.644825", "0.60443336", "0.59394455", "0.57942045", "0.5724272", "0.57048047", "0.5686879", "0.56603986", "0.56121755", "0.5596388", "0.55824083", "0.55557215", "0.55536395", "0.55338305", "0.55080605", "0.55010486", "0.55003375", "0.55003375", "0.54932195", "0.5468278", "0.54493976", "0.54493976", "0.5440814", "0.5439822", "0.5401729", "0.5391885", "0.5378855", "0.5373987", "0.5359406", "0.5342716", "0.53417677", "0.5340143", "0.5339253", "0.5322704", "0.52973527", "0.528091", "0.5276831", "0.52628237", "0.52512985", "0.5210481", "0.52095205", "0.5199049", "0.51966757", "0.518897", "0.5171902", "0.51691735", "0.5163239", "0.51448584", "0.51448584", "0.5142384", "0.5142384", "0.5142384", "0.5142384", "0.5140136", "0.51380014", "0.5137737", "0.5131352", "0.5126957", "0.51209843", "0.5113188", "0.51039326", "0.5099362", "0.509753", "0.5092498", "0.50871044", "0.5077781", "0.507335", "0.50693464", "0.5066808", "0.50467354", "0.5045789", "0.50390327", "0.5038646", "0.50383806", "0.50383806", "0.50369656", "0.5034896", "0.5033602", "0.5031954", "0.5029207", "0.5028897", "0.5024927", "0.50239164", "0.5021729", "0.50172937", "0.501647", "0.5016217", "0.5003551", "0.50033385", "0.500129", "0.50001496", "0.4998468", "0.49938643", "0.49931288", "0.49928173", "0.49887338", "0.49785835", "0.49771658", "0.49684295" ]
0.8183501
0
removes any users accounts that have not fully registered by creating an associated profile, and that were created longer ago than the USER_GRACE_PERIOD
def remove_unregistered_users User.where(person: nil).where('created_at < ?', USER_GRACE_PERIOD.ago).destroy_all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def perform\n inactive_users = User.inactive_for_more_than(2.days)\n inactive_users.destroy_all\n end", "def clean_up\n User.where(\"confirmed IS NULL AND created_at < ?\", Time.now-1.day).destroy_all\n end", "def destroy_old_admin_applicants\n old_applicants = User.where(role: \"admin_applicant\")\n old_applicants.each do |applicant|\n if Time.now - applicant.created_at > 604800 # destroyed after one week (7 days)... 604800 seconds\n applicant.destroy\n end \n end\n end", "def expired_users_with_accounts\n @expired_users_with_accounts ||= User.expired\n .joins(:accounts)\n .having('count(accounts) > 0')\n .group('users.id')\n end", "def remove_future_registrations\n self.registrations.select{|r| r.camp.start_date >= Date.current}.each{|r| r.destroy}\n end", "def remove_distribution_hours_for_user(project_job)\n puts \"coming to remove_distribution_hours_for_user ..........................\"\n past_dates = project_job.job_time_logs.where(\"user_id = ? and log_start_time < ?\",project_job.assigned_to, Date.today).all.map(&:log_start_time).map(&:to_date)\n p past_dates\n if(past_dates.present?)\n ResourceDistribution.where(:project_job_id=>project_job.id, :user_id=>project_job.assigned_to).where(\"allotted_date not in (?)\",past_dates).delete_all\n else\n ResourceDistribution.where(:project_job_id=>project_job.id, :user_id=>project_job.assigned_to).delete_all\n end\n end", "def disable_expired_users()\n confluence_user_names.each do |name|\n next if name == \"conflusa\" \n ldap_person = find_in_ldap(name)\n \n if ldap_person.nil? || !eligible_for_confluence?(ldap_person)\n user = find_in_confluence(name)\n user.disable()\n @disabled_users << user \n end\n end\n end", "def refresh_existing_user_accounts\n check_all_user_accounts\n handle_changed_sis_user_ids\n if Settings.canvas_proxy.delete_bad_emails.present?\n handle_email_deletions @user_email_deletions\n else\n logger.warn \"EMAIL DELETION BLOCKED: Would delete email addresses for #{@user_email_deletions.length} inactive users: #{@user_email_deletions}\"\n end\n end", "def deleted_users\n params = {\n finish: finish,\n }.transform_values { |v| quote(v) }\n\n sql = format(<<-SQL, params)\n SELECT\n COUNT(*) AS deleted_users\n , deleted_at::date AS date\n FROM deleted_users\n WHERE\n deleted_at <= %{finish}\n AND deleted_users.user_created_at <= %{finish}\n GROUP BY\n deleted_at::date\n SQL\n\n transaction_with_timeout do\n ActiveRecord::Base.connection.execute(sql)\n end\n end", "def pay_users\n ::User.where(\"upper(account_type) != 'FREE'\").count\n end", "def delete_old_accounts_and_owners(model:, user_data:, **)\n accounts_data = user_data.fetch('accounts')\n owner_names = accounts_data.map { |acc| acc.fetch('owner') }\n account_ids = accounts_data.map { |acc| acc.fetch('account_id') }\n\n model.award_wallet_owners.where.not(name: owner_names).destroy_all\n model.award_wallet_accounts.where.not(aw_id: account_ids).destroy_all\n end", "def prune!\n inactive_approvers.each do |user|\n CurrentUser.scoped(User.system) do\n user.update!(level: User::Levels::CONTRIBUTOR)\n user.feedback.create!(category: \"neutral\", body: \"Lost approval privileges\", creator: User.system, disable_dmail_notification: true)\n\n Dmail.create_automated(\n to_id: user.id,\n title: \"Approver inactivity\",\n body: \"You've approved fewer than #{MINIMUM_APPROVALS} posts in the past #{APPROVAL_PERIOD.inspect}. In order to make sure the list of active approvers is up-to-date, you have lost your approval privileges. If you wish to dispute this, you can message an admin to have your permission reinstated.\"\n )\n end\n end\n end", "def deactivated_users\n @users=User.find_with_deleted(:all,:conditions=>['company_id=? AND deleted_at IS NOT NULL',current_user.company_id])\n end", "def remove_expired_keys\n self.user_key.each do |user_key|\n if user_key.expired?\n self.remove_user_key(user_key)\n user_key.delete\n end\n end\n end", "def purge_old_tokens\n auth_tokens.desc(:last_used_at).offset(20).destroy_all\n end", "def check_past_camp_registration\n return if self.registrations.empty?\n if !self.registrations.select{|r| r.camp.start_date < Date.current}.empty? # registed for past camps\n @destroy = false\n errors.add(:base, \"Student cannot be deleted! This student will be deactivated instead!\")\n throw(:abort)\n end\n else\n remove_upcoming_registrations\n end", "def remove_inscriptions\n next_fixed_shift_users.destroy_all\n end", "def deactivate_account!\n time_since_sign_in = Time.now - self.last_sign_in_at\n inactive_days = Time.now - 60.days\n if last_signed_in_at.where(inactive_days > time_since_sign_in)\n update_attribute :is_active, false\n end\n end", "def researchers_without_xaccount()\n last_month = Time.now - 1.month\n #People.\n end", "def transient_registrations_to_remove\n WasteCarriersEngine::TransientRegistration.where(\n \"created_at\" => { \"$lt\" => oldest_possible_date },\n \"workflow_state\" => { \"$nin\" => WasteCarriersEngine::RenewingRegistration::SUBMITTED_STATES }\n )\n end", "def delete_other_bids(assignment_id, user_id)\n entries = SignedUpUser.find_by_sql([\"SELECT su.* FROM signed_up_users su , sign_up_topics st WHERE su.topic_id = st.id AND st.assignment_id = ? AND su.creator_id = ? AND su.is_waitlisted = 1\",assignment_id,user_id] )\n entries.each { |o| o.destroy }\nend", "def remove_registrations_if_inactive\n remove_upcoming_registrations if !self.active \n end", "def index\n \tif signed_in? && current_user.sk.root?\n \t\toneweekago = Date.today - 7\n \t\tUser.where(\"email_confirm = ? AND created_at < ?\", false, oneweekago).each do |u|\n \t\t\tu.destroy\n \t\tend\n \tend\n end", "def candidates_applied\n users.where('users.status <> :s', s: USER_STATUS_DELETED)\n end", "def overquota(delta = 0)\n service = Carto::OverquotaUsersService.new\n $users_metadata.del(service.send(:date_key))\n service.store_overquota_users(delta)\n users = service.get_stored_overquota_users.map { |u| u['id'] }.select { |uid| [@user.id, @user2.id].include?(uid) }\n\n users\n end", "def remove_upcoming_registrations_if_inactive\n remove_upcoming_registrations if !self.active \n end", "def remove_removed_user\n begin\n followers = get_followers\n followings = get_followings\n need_to_remove = followings - followers\n rescue\n error_log 'error in remove_removed_user'\n end\n\n log 'need to remove: '\n for id in need_to_remove do\n log \" #{id}\"\n end\n\n for id in need_to_remove do\n remove_user id\n end\n\n return followings.size - need_to_remove.size\n end", "def users_with_pending_input\n users_with_pending_days = []\n self.users.each do |user|\n users_with_pending_days << user if user.pending_input?\n end\n users_with_pending_days\n end", "def clean_tokens\n @db.execute(\"DELETE FROM request_tokens WHERE strftime('%s','now') - strftime('%s',time) > 900\")\n end", "def active_users_retention\n \n end", "def remove_everything_about_testuser\n list_of_activerecords = [\n Follow.find_by(leader_id: TESTUSER_ID),\n Follow.find_by(user_id: TESTUSER_ID),\n Mention.find_by(username: TESTUSER_NAME),\n Tweet.find_by(user_id: TESTUSER_ID),\n User.find_by(username: TESTUSER_NAME)\n ]\n list_of_activerecords.each { |ar| destroy_and_save(ar) }\nend", "def prune\n if Event.count > 60\n cutoff = Event.limit(60).last.created_at\n Event.where([\"created_at < ?\", cutoff]).delete_all\n end\n end", "def delete_profile\n if Feedbunch::Application.config.demo_enabled\n demo_email = Feedbunch::Application.config.demo_email\n return nil if self.email == demo_email\n end\n\n self.lock_access! send_instructions: false\n DestroyUserWorker.perform_async self.id\n end", "def filter_old_retweets\n\t@tweet_db.each do |tweet_id, tweet_data|\n\t\ttweet_data[:retweets].delete_if do |id, retweet| \n\t\t\t#if the time now in minutes is greater than or equal to the user defined\n\t\t\t#window, then remove that retweet.\n\t\t\t(Time.now - retweet.created_at).to_i / 60 >= @user_defined_window\n\t\tend\n\tend\nend", "def will_expire_on\n cfm = AWS::CloudFormation.new # calling aws cloudformation api\n if self.users.length > 0 # users length is more then 0\n self.users.each do |user| \n if user.stacks.length > 0\n user.stacks.each do |stack|\n stackaws = cfm.stacks[\"#{stack.stack_name}\"] # get that stack from aws \n if stackaws.exists? \n stackaws.delete # delete that aws stack\n sleep (1) # delay or sleep for 1 second\n end\n stack.destroy # delete that stack now from database\n end\n end\n end\n end\t\n end", "def destroy_booking?\n if user_signed_in? && current_user.bookings.last != nil\n current_user.bookings.where(paid: false).destroy_all if (Time.now - current_user.bookings.last.created_at ) / 60 >= 5\n end\n end", "def ensure_an_admin_remains\n if User.count.zero?\n raise \"Can't delete last user\"\n end\n end", "def remove_grace_period_deduction(membership)\n deductions = membership.role.grace_period_deductions\n deductions.each do |deduction|\n if deduction.membership.grouping.assignment.id == assignment.id\n membership.grace_period_deductions.delete(deduction)\n deduction.destroy\n end\n end\n end", "def membership_expired_in_grace_period?(this_date = Date.current)\n memberships_manager.membership_in_grace_period?(self, this_date)\n end", "def destroy\n if @user.authority == '2'\n flash[:danger] = 'Pre-configured Admin Cannot Be Deleted'\n redirect_to users_path\n elsif @user.email == current_user.email\n flash[:danger] = 'Oops. Don\\'t Delete Yourself'\n redirect_to users_path\n else\n sql = \"delete from histories where email = '#{@user.email}' and (date > '#{Time.now.to_date}' or (date = '#{Time.now.to_date}' and begintime > '#{Time.now.hour}' ))\"\n h = History.find_by_sql(sql)\n @user.destroy\n redirect_to users_path\n flash[:success] = 'User Was Successfully Deleted'\n end\n end", "def no_created_at_transient_registrations_to_remove\n WasteCarriersEngine::TransientRegistration.where(\n \"created_at\" => nil,\n \"metaData.lastModified\" => { \"$lt\" => oldest_possible_date },\n \"workflow_state\" => { \"$nin\" => WasteCarriersEngine::RenewingRegistration::SUBMITTED_STATES }\n )\n end", "def remove_accounts_below_disk_free_percentage\n return @remove_accounts_below_disk_free_percentage\n end", "def working\n @users=User.where.not(timer_activity: 0)\n end", "def collect_garbage!\n find_including_new_records(:all, :conditions => ['as_new = ? AND created_at < ?', true, Time.now - 1.week]).each(&:destroy)\n end", "def removeWorkingUser user\n @workingUsers.delete user\n end", "def empty_users\n user_list = Array.new(self.users)\n user_list.each { |id| remove_user User.find_by_id(id) }\n end", "def clean_trash\n return unless self.active? == false and self.rank === MemberRank.find_by_name('Declined Applicant')\n\n # Don't care about what they want\n self.wishlists.destroy_all\n\n # Don't care about the achievements they mooched from us\n self.completed_achievements.destroy_all\n end", "def safe_delete\n transaction do\n destroy\n if Users.count.zero?\n raise \"The application has to have at least one account.\"\n end\n end\n end", "def ensure_an_admin_remains\n if User.count.zero?\n raise \"Can't delete last user\"\n end\n end", "def purge_expired_schedules\n _schedules = Schedule.where('student_id = ? AND end_date < ?', @student.id, Date.today)\n _schedules.each {|s| s.destroy}\n\n redirect_to @student, notice: 'Expired schedules have been deleted'\n end", "def remove_account\n if request.get? then\n render :remove_account and return\n end\n\n if request.delete? then\n if logged_user.admin? then\n render_403 and return\n end\n if logged_user.student? then\n if params[:remove_comments] then\n Comment.destroy_all(user_id: logged_user.id)\n end\n if params[:remove_feedbacks] then\n Feedback.destroy_all(student_id: logged_user.student.id)\n end\n end\n logged_user.update_attributes({ removed: true, account_type: nil })\n # Выход из системы\n clear_user_session\n redirect_to :login, alert: t('settings.account_removed')\n end\n end", "def expire\n touch :expires_at\n\n user.subscriptions.facebook.each do |subscription|\n subscription.deactivate\n end\n\n UserMailer.access_token_expired_email(user).deliver\n end", "def ageoff\n messages.reject! { |m| m.expired? }\n\n claims.keys.dup.each do |id|\n claim = claims[id]\n if claim.expired? || claim.messages.empty?\n claim.messages.each { |m| m.claim = nil }\n claims.delete(id)\n end\n end\n end", "def create_users()\n del_rec = []\n @good_user_records.each do |rec|\n existing_user = @users[rec.fields[\"email\"]]\n # check if the user doesn't exist already\n if (existing_user.nil?)\n\t# check to see if business already exists\n\texisting_business = @businesses[rec.fields[\"businessname\"]]\n\tif (!existing_business.nil?)\n\t new_user = User.new\n\t new_user.create(rec)\n\t existing_business.add_user(new_user)\n\t @users[new_user.email] = new_user\n\telse\n\t rec.is_malformed = true\n\t rec.add_malformed_message(\"ERROR: COMPANY NAME DOESN'T EXIST\")\n\t @bad_user_records << rec\n\t del_rec << rec\n\tend\n #User Already Exists treat it as malformed\n else \n\trec.is_malformed = true\n\trec.add_malformed_message(\"ERROR: USER EMAIL ALREADY EXISTS\")\n\t@bad_user_records << rec\n\tdel_rec << rec\n end\n end\n\n del_rec.each do |rec|\n @good_user_records.delete(rec)\n end\n \n end", "def members_not_paid_tithe\n members.where.not(id: payments.completed.where(goal: 'tithe', payment_at: Time.current.beginning_of_month..Time.current).pluck(:user_id))\n end", "def delete_old_requests\n Request.where('created_at < ?', Time.now - 15.minutes).delete_all\n end", "def clean_and_keep_recent(to_keep = 5)\n users = User.includes(:quizzes)\n users.each do |user|\n ids = user.quizzes.order(created_at: :desc).offset(to_keep).pluck(:id)\n Quiz.where(id: ids).delete_all\n end\nend", "def expire_auth_related_fragments\n expire_download_activity\n expire_create_activity\n expire_resource_list_item_action_partial\n end", "def destroy_less_emails_sent_than_defined_in_user_profile?\n notifications_delivered < notifications_for_destroy\n end", "def delete_group_memberships_for_end_users\n self.group_memberships.delete_all if self.end_user?\n end", "def cleanStats\n if Setting.default.keep_stats\n cleaned_stats = Stat.destroy_all([\"created_at <= ?\", Setting.default.keep_stats.days.ago.localtime])\n if cleaned_stats\n Rails.logger.info \"Zackup::Scheduler - #{cleaned_stats.count} Stats Pruned\"\n end\n end\n end", "def super_active_users_retention\n \n end", "def ensure_user_plan_limit_not_reached\n if @current_user.is_employee? || @person.is_employee?\n return\n end\n\n userplanservice = UserPlanService::Api.new\n @current_user_max_trusted_users = userplanservice.get_plan_feature_level(@current_user, :company_trusted_users)[:value]\n @other_company_max_trusted_users = userplanservice.get_plan_feature_level(@person, :company_trusted_users)[:value]\n current_user_followed_count = @current_user.followed_people.count\n other_company_followers_count = @person.followers.count\n\n # current user has reached followed limit\n if current_user_followed_count >= @current_user_max_trusted_users\n #@max_followed_reached = true\n flash[:error] = t('people.show.followed_limit_reached2', :link => get_wp_url('pricing')).html_safe\n respond_to do |format|\n format.html { redirect_to :back }\n format.js { render :partial => \"people/max_followers_reached\" }\n end\n return\n end\n\n # other company has reached followers limit\n if other_company_followers_count >= @other_company_max_trusted_users\n #@max_follower_reached = true\n flash[:error] = t('people.show.followers_limit_reached').html_safe\n respond_to do |format|\n format.html { redirect_to :back }\n format.js { render :partial => \"people/max_followers_reached\" }\n end\n end\n return\n end", "def delete_user_account\n # delete their favorites before deleting user\n User.all.destroy(current_user.id)\n puts \"\n Your account have been removed! I will never tell, xoxo\n \"\n \n end", "def remove_users\r\n @userAdmin.destroy\r\n @user2.destroy\r\n @user3.destroy\r\n end", "def delete_user_account\n # delete their favorites before deleting user\n # list_to_delete = Favorite.where(user_id:current_user.id)\n binding.pry\n User.all.destroy(current_user.id)\n puts \"Your account have been removed! I will never tell, xoxo\"\n end", "def clean_for_period(future_period, notification_times)\n future_period.notifications.all.each do |existing_notification|\n unless notification_times.include?(existing_notification.time.utc)\n existing_notification.delete\n end\n end\n end", "def kill_zombie_users(users)\n @mutex.synchronize do\n (@users - users - Set.new([@thaum_user])).each do |user|\n @users.delete(user)\n end\n end\n end", "def users_for_new_issue_watchers(issue)\n users = issue.watcher_users.select{|u| u.status == User::STATUS_ACTIVE}\n project = issue.project\n scope_users = project.users\n scope_groups = project.principals.merge(Group.givable)\n if scope_users.count + scope_groups.count <= 20\n users = (users + scope_users.sort + scope_groups.sort).uniq\n end\n users\n end", "def nice_destroy\n today = Time.zone.today\n hour = Time.zone.now.hour\n Inscription.where(user_id:current_user.id).each do |inscription|\n cour = inscription.cour \n cour.nombre_eleves = cour.nombre_eleves - 1\n cour.save\n #On supprime aussi sa presence non payée si delai respecté\n lesson = Cour.find(inscription.cour_id).lessons.last\n if cour.horaire_ex.present?\n heure = cour.horaire_ex.to_i\n else\n heure = cour.heure.to_i\n end\n presence = Presence.where(lesson_id:lesson.id, user_id:current_user.id, perf:false).last\n if (lesson.date.to_date - today > 0 and heure - hour >= 0 )\n presence.destroy\n elsif lesson.date.to_date - today > 1\n presence.destroy\n end\n inscription.destroy\n end\n\n end", "def additional_users_for_destroy\n []\n end", "def unscored_less_awarded(user_id)\n awarded_applicants = applicants_awarded\n if awarded_applicants.count > 0\n applicants_unscored_by(user_id) - awarded_applicants\n else\n applicants_unscored_by(user_id)\n end\n end", "def check_expired \n\t\t@current_epoch_time = DateTime.now.strftime('%s').to_i\n\t\texpired_required_trips = []\n\t\texpired_listed_trips = []\n\n\t\t# Find the expired trips and add them to the expired arrays\n\t\tcurrent_user.trips_requested.each do |trip_index|\n\t\t\t@trip = Trip.find_by(_id: trip_index) \n\t\t\tif @trip.date < @current_epoch_time\n\t\t\t\texpired_required_trips << trip_index\n\t\t\tend\n\t\tend\n\t\tcurrent_user.trips_driving.each do |trip_index|\n\t\t\t@trip = Trip.find_by(_id: trip_index)\n\t\t\tif @trip.date < @current_epoch_time\n\t\t\t\texpired_listed_trips << trip_index\n\t\t\tend\n\t\tend\n\n\t\tcurrent_user.trips_requested = current_user.trips_requested - expired_required_trips\n\t\tcurrent_user.trips_driving = current_user.trips_driving - expired_listed_trips\n\n\t\tcurrent_user.past_trips_requested = current_user.past_trips_driven + expired_required_trips\n\t\tcurrent_user.past_trips_driven = current_user.past_trips_driven + expired_listed_trips\n\n\t\tcurrent_user.save!\n\n\t\trender json: {\n\t\t\tstatus: 'success',\n\t\t\tuser: current_user\n\t\t}\n\n\tend", "def deleted_user_personal_site_retention_period_in_days\n return @deleted_user_personal_site_retention_period_in_days\n end", "def after_destroy\n #after the user has been deleted, check how many are left - if zero, raise an error\n #this will cause the transaction to roll back\n if User.count.zero?\n raise \"Can't delete the last user!\"\n end\n end", "def delete_creator\n # somehow search for creator based on params\n # creator = Creator.where(\"provider = ? AND p_id = ?\", params[\"provider\"], params[\"p_id\"])\n # remove creator from user's list\n # self.creators.delete(creator)\n # if the creator is no longer followed, delete it\n # creator.delete if creator.users.nil?\n end", "def remove_expired_set_members\n client.zremrangebyscore(cache_key, '-inf', \"(#{current_timestamp}\")\n end", "def cleanup\n self.profile.destroy if self.profile\n end", "def delete_assignments_for_user_before_creating_new_one\n Assignment.where(['user_id = ? AND bay_id <> ?', self.user_id, self.bay_id]).destroy_all\n end", "def remove_no_longer_following(friendings, user,cursor=-1)\n # get all the people this user is following\n begin\n friends = user.twitter.get(\"/friends/ids.json\", 'cursor'=>cursor.to_s)\n puts \"people #{user.login} is following\\n#{friends.size()}\"\n\n friends = friends.to_set\n\n ret_friendings = []\n friendings.each do |friending|\n if friends.include?(friending.follow_id)\n ret_friendings << friending\n end\n end\n\n ret_friendings\n rescue => e\n Rails.logger.error e.message\n end\n\n end", "def clean_subscriptions\n\t if @subscription = self.subscription\n\t \tunless @subscription.active?\n\t \t recatch_time = ((Time.now - @subscription.deactivated_at) / 1.hour).round\n\t \t if recatch_time > 24 \n\t \t \t@subscription.remove\n\t \t end\n\t \tend\n\t end\n\tend", "def remove_approver_from_contracts(user)\n\n self.connection.execute(\"delete users from users \\\n inner join contracts on contracts.id = users.contract_id \\\n where contracts.client_id = #{id.to_s} and users.id = #{user.id.to_s}\")\n\n end", "def mark_for_cleanup\n add_accounts_from_activities\n end", "def before_destroy\n self.user.entry_states.where(entry_id: self.feed.entries).delete_all\n self.feed.refresh_feed_job_states.where(user_id: self.user.id).destroy_all\n self.feed.subscribe_job_states.where(user_id: self.user.id).destroy_all\n\n folder = self.feed.user_folder self.user\n folder.feeds.delete self.feed if folder.present?\n\n # If triggered by the destruction of user or feed, do not update timestamps, there's no need\n unless destroyed_by_association\n touch_subscriptions\n touch_user_data\n end\n end", "def unique_users(days=30)\n latest_executions(days).select(:user_id).distinct.count\n end", "def remove_depricated\n self.articles.each do |a|\n unless ((a.created_at + 3.days) > Date.today) \n self.articles.delete(a)\n end\n end\n\tend", "def expired_users_with_email\n @expired_users_with_email ||= User.expired.where.not(email: nil)\n end", "def remove_all_profiles\n super\n end", "def clear_user_and_mark_purged\n random_suffix = (('0'..'9').to_a + ('a'..'z').to_a).sample(8).join\n\n self.studio_person_id = nil\n self.name = nil\n self.username = \"#{SYSTEM_DELETED_USERNAME}_#{random_suffix}\"\n self.current_sign_in_ip = nil\n self.last_sign_in_ip = nil\n self.email = ''\n self.hashed_email = ''\n self.parent_email = nil\n self.encrypted_password = nil\n self.uid = nil\n self.reset_password_token = nil\n self.full_address = nil\n self.properties = {}\n\n self.purged_at = Time.zone.now\n\n save!\n end", "def remove_dead_actors\n for battler in tactics_all\n if (battler.actor? && battler.death_state? &&\n $game_party.all_members.include?(battler) &&\n !GTBS::Prevent_Actor_Leave_List.include?(battler.id))\n $game_party.remove_actor(battler.id) \n end\n end\n end", "def remove_users\n if @project.user_id == current_user.id\n success = []\n errors = []\n @users.each do |user|\n extract_user = extract_user_id(user)\n if extract_user.nil?\n errors << { error: 'User does not exist' }\n else\n project_user = ProjectUser.find_user_in_project(extract_user, @project)\n project_user.exists? ? success << project_user[0] : errors << { error: 'User does not have an assigned role in the project' }\n end\n end\n if errors.empty?\n success.each do |user| \n user.destroy\n end\n render json: @project.project_users, status: 204\n else\n render json: { errors: errors }, status: :unprocessable_entity\n end\n else\n render json: { error: 'Only the project owner can edit project users' }, status: :unauthorized\n end\n end", "def invalidate_account\n @users = Customer.all.order(name: :asc).where(two_fa: nil )\n render layout: \"layouts/dashboard/application\"\n end", "def unique_users_with_failures(days=30)\n latest_executions(days).where(success: false).select(:user_id).distinct.count\n end", "def before_create\n limit = 19\n # logger.debug2 \"notification.before_create: to_user_id = #{to_user_id}\"\n count = Notification.where(\"to_user_id = ? and internal = ?\", to_user_id, 'Y').length\n return if count <= limit\n # keep newest 19 notifications (0..18).\n ns = Notification.where(\"to_user_id = ? and internal = ?\", to_user_id, 'Y').order(\"updated_at desc\")\n ns = ns[limit..-1]\n ns.each { |n| n.destroy }\n # one new notification will be created just in a moment\n end", "def remove\n if created_at > 1.hour.ago && item_claims.empty?\n destroy\n else\n touch(:deleted_at)\n end\n end", "def delete_history_older_than_30_days\n HistoryOlderThan30Days.delete_all; nil\nend", "def cleanup\n cleanup_accounts\n end", "def clean_user_profile(profile)\n keys = %w(jobTitle gender aboutMe phoneNumber mobile street city email\n state familyName country givenName postalCode)\n\n profile.delete_if { |k, _v| !keys.include?(k) }\n end", "def invalidated_accounts\n self.accounts.find(:all, :conditions => ['validated = false'])\n end", "def pending_approval_grace_period_transactions\n active_member_id_list = self.active_group_loan_memberships.map{|x| x.member_id }\n \n TransactionActivity.where(:member_id => active_member_id_list, \n :loan_id => self.id, \n :loan_type => LOAN_TYPE[:group_loan],\n :transaction_case => (GRACE_PERIOD_PAYMENT_START..GRACE_PERIOD_PAYMENT_END),\n :is_approved => false ,\n :is_deleted => false ,\n :is_canceled => false )\n \n \n \n end" ]
[ "0.6712928", "0.62407935", "0.6160999", "0.6159996", "0.614098", "0.59418", "0.58645093", "0.5833298", "0.5744255", "0.5725912", "0.5702757", "0.5682002", "0.5676569", "0.5655934", "0.5610859", "0.56041414", "0.55320877", "0.5494167", "0.54889226", "0.54574656", "0.54445475", "0.5444073", "0.5400384", "0.53962606", "0.5391661", "0.53901225", "0.53798074", "0.53792083", "0.53614587", "0.53424543", "0.53269446", "0.5320156", "0.53191304", "0.5266406", "0.52321136", "0.5226636", "0.5224762", "0.5222037", "0.51996106", "0.51995134", "0.51920706", "0.51874506", "0.518563", "0.5175454", "0.5174093", "0.5170087", "0.5167641", "0.5155203", "0.51516837", "0.5151108", "0.51352763", "0.5134067", "0.5128682", "0.5119529", "0.51186204", "0.5118067", "0.51062155", "0.5105003", "0.51030374", "0.5098865", "0.50937736", "0.50924337", "0.5084101", "0.50798887", "0.50789064", "0.50729024", "0.5072268", "0.50696814", "0.5067859", "0.50602883", "0.5056224", "0.50527", "0.503895", "0.5036807", "0.5034715", "0.50317913", "0.50287634", "0.50282925", "0.50276136", "0.5026574", "0.5024088", "0.5019586", "0.5017258", "0.5014846", "0.5010473", "0.50082743", "0.50016856", "0.4996053", "0.49936956", "0.49902144", "0.49800545", "0.4975482", "0.49743554", "0.49698585", "0.4968632", "0.4961945", "0.49606943", "0.49606788", "0.49581367", "0.49528682" ]
0.7399721
0
trims old sessions, using the db:sessions:trim task
def trim_session Rails.application.load_tasks Rake::Task['db:sessions:trim'].invoke end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cleanup\n\t\tcurrent_time = current_date_time\n\n\t\tputs current_time\n\n\t\t# delete all sessions that are older than 30 minutes\n\t\tActiveRecord::Base.connection.execute(\"DELETE FROM sessions WHERE updated_at < '#{current_time}'\")\n\tend", "def clean_sessions\n self.log_puts(\"Cleaning sessions on appserver.\") if @debug\n \n #Clean up various inactive sessions.\n session_not_ids = []\n time_check = Time.now.to_i - 300\n @sessions.delete_if do |session_hash, session_data|\n session_data[:dbobj].flush\n \n if session_data[:dbobj].date_lastused.to_i > time_check\n session_not_ids << session_data[:dbobj].id\n false\n else\n true\n end\n end\n \n self.log_puts(\"Delete sessions...\") if @debug\n @ob.list(:Session, {\"id_not\" => session_not_ids, \"date_lastused_below\" => (Time.now - 5356800)}) do |session|\n idhash = session[:idhash]\n self.log_puts(\"Deleting session: '#{session.id}'.\") if @debug\n @ob.delete(session)\n @sessions.delete(idhash)\n end\n \n #Clean database weak references from the tables-module.\n @db.clean\n \n #Clean the object-handler.\n @ob.clean_all\n \n #Call various user-connected methods.\n @events.call(:on_clean) if @events\n end", "def remove_old_sessions\n candidates = find_old_sessions\n candidates.destroy_all\nend", "def eliminate_unwanted_sessions(config, last_key = nil)\n scan_result = scan(config, last_key)\n batch_delete(config, scan_result[:items])\n scan_result[:last_evaluated_key] || {}\n end", "def reap_expired_sessions\n @timestamps.each do |session_id,stamp|\n delete_session(session_id) if (stamp + @session_ttl) < Time.now \n end\n GC.start\n end", "def remove_empty_sessions!( season_id )\n sql_diff_text_log << \"\\r\\n-- Processing season #{ season_id } for empty sessions...\\r\\n\"\n # Build up a list of meeting sessions that are completely empty and deletable:\n deletable_season_sessions = Meeting.includes(:meeting_sessions).joins(:meeting_sessions)\n .where( season_id: season_id )\n .map{ |m| m.meeting_sessions }\n .flatten\n .reject{ |ms| ms.meeting_events.count > 0 }\n\n if deletable_season_sessions.count > 0\n sql_diff_text_log << \"-- Found #{ deletable_season_sessions.count } deletable (empty) sessions in season #{ season_id }. Cleaning-up...\\r\\n\\r\\n\"\n end\n\n # Delete each row individually, with validations:\n deletable_season_sessions.each do |dest_row|\n if dest_row.destroy\n sql_diff_text_log << \"-- MeetingSession empty in meeting #{ dest_row.meeting_id }\\r\\n\"\n sql_diff_text_log << to_sql_delete( dest_row, false, \"\\r\\n\" )\n @destroyed_rows_codes << \"#{ dest_row.meeting_id }/#{ dest_row.id }\"\n else\n sql_diff_text_log << \"-- DELETE FAILURE: #{ $! }\\r\\n\" if $!\n @error_rows_codes << \"#{ dest_row.meeting_id }/#{ dest_row.id }\"\n end\n end\n end", "def no_idle_trim!; end", "def remove_duplicate_app_sessions(app_sessions)\n duplicates = app_sessions.group_by{|model| [model.timestamp_start,model.timestamp_end] }\n removed_usages = 0\n removed_sessions = 0\n duplicates.values.each do |duplicate|\n first_one = duplicate.shift\n # puts first_one.inspect\n # puts \"Behalte #{first_one.id}\"\n duplicate.each do|double|\n # puts double.inspect\n removed_sessions += 1\n apps = AppUsage.where(app_session_id: double.id)\n # puts \"Lösche #{double.id}\"\n removed_usages += apps.count\n double.destroy\n end\n end\n # puts \"#{removed_sessions} Sessions gelöscht\"\n # puts \"#{removed_usages} Apps gelöscht\"\n end", "def clear_upstream_sessions\n upstream_sessions.delete_all\n end", "def purge_old\n @db.execute \"DELETE FROM requests WHERE first_seen < ?\", $config.periodic['purge'].minutes.ago.to_i\n end", "def trim_queue!(user)\n $redis.ltrim(self.class.redis_key_for_user(user), 0, KEEP_ACTIVITY_ITEMS)\n end", "def idle_trim!(timeout); end", "def records_session_maintenance\n if (current_user and session[:tmp_user])\n # Find all the tmp_users records\n tmp_user.records.each do |record|\n # Don't duplicate them if the current user already saved these records\n unless current_user.records.where(external_system: record.external_system, external_id: record.external_id).present?\n # But reassign them to this current user from the tmp user\n existing_record = Record.find(record.id)\n existing_record.tmp_user = nil\n existing_record.user = current_user\n existing_record.save!\n end\n end\n # Get rid of the tmp user for the session\n session.delete(:tmp_user)\n # Reload from the DB, so we don't destroy the\n # records we just saved.\n tmp_user.records.reload\n # Sweep the leg\n tmp_user.destroy\n end\n end", "def remove_old_sessions_in_group\n candidates = find_old_sessions\n candidates.where(group: @group).destroy_all\nend", "def idle_trim?; end", "def clean_activity!\n $redis.zremrangebyscore(activity_key, '-inf', Time.now.to_i - 1.minute)\n end", "def clean_expired!\n sessions.remove( { :expire => { '$lt' => Time.now } } )\n end", "def clear_sessions\n session.keys.each do |key|\n session.delete(key) if key =~ /ranmemory_/\n end\n end", "def trim\n repeat_until_unchanged(&:trim_once)\n end", "def reset_session_counts\n self.session_count = 0\n end", "def purge_old_tokens\n auth_tokens.desc(:last_used_at).offset(20).destroy_all\n end", "def sessions_reset\n self.sessions_flush\n @sessions = {}\n end", "def delete_session\n request.method = :get\n request.uri = '_session'\n Couchdbtools.execute(request)\n end", "def trim\n if User.update_user(params[:id], 'trim')\n redirect_to root_url\n end\n end", "def delete_sessions(node)\n @sessions.delete_all(node)\n end", "def destroy_session_records_if_any\n item_ids = $redis.smembers(\"#{remote_ip}.#{session}.ids\")\n\n return true if item_ids.empty?\n\n item_ids.each do |id|\n $redis.del(\"#{remote_ip}.#{session}.pieces.#{id}\")\n end\n \n $redis.del(\"#{remote_ip}.#{session}.ids\")\n $redis.del(\"#{remote_ip}.#{session}.image_reference\")\n end", "def trim_requested; end", "def clean_tokens\n @db.execute(\"DELETE FROM request_tokens WHERE strftime('%s','now') - strftime('%s',time) > 900\")\n end", "def trim\n return if skip_step?(@names.get('trim'), 'trimming')\n run_cmd(\\\n 'fastx_trimmer -Q33 -f 2' \\\n \" -i #{@names.get('clip')}\" \\\n \" -o #{@names.get('trim')}\"\n )\n end", "def clean_db(prev_versions)\nputs \"CLEAN DB CALLED\"\n if Version.count > prev_versions\n to_remove = Version.count - prev_versions\n puts \"Removing #{to_remove} old versions from database\"\n Version.all(:limit => to_remove, :order => [ :processed.asc ]).each do |old_version|\n old_version.units.all.each do |old_unit|\n #old_unit.images.all.each do |old_image|\n # old_image.destroy\n #end\n old_unit.destroy\n end\n old_version.destroy\n end\n end\n end", "def xtrim(key, len_or_id, strategy: T.unsafe(nil), approximate: T.unsafe(nil), limit: T.unsafe(nil)); end", "def sessionsbutthis(ses)\n\t\t@sessionmutex.synchronize{ \n\t\t\tcopy=Array.new @sessions\n\t\t\tcopy.delete ses\n\t\t\tcopy\n\t\t}\n\tend", "def delete_session\n session[:userid] = nil\n session[:attributes] = nil\n end", "def trim(timestamp)\n dropped = lines.take_while do |ts, _|\n timestamp - ts > expiry\n end\n dropped.length.tap do |numdropped|\n # actually drop the lines\n lines.slice!(0, numdropped)\n # keep running statistics of methods\n dropped.each do |_, logline|\n stats[logline.method] -= 1\n end\n stats[:requests] -= numdropped\n end\n end", "def kill_session\n session[:session] = false\n session[:sessionToken] = \"\"\n session[:sessionMember] = \"\"\n session[:sessionMV] = \"\"\n session[:sessionOffer] = \"\"\n end", "def cleanup\n redis.zremrangebyscore(key, '-inf', time - timespan)\n end", "def cleanup\n @session_id = nil\n end", "def clear_session_keys\n ActiveRecord::Base.clear_session_keys\n end", "def remove_last_alive_log\n AmqpAuditLog.where(routing_key: '-.-.-.alive.-.-.-.-').order(id: :desc)\n .offset(20).destroy_all\n end", "def garbage_collect\n $redis.keys(\"#{remote_ip}.*\").each do |key|\n $redis.del(key) unless key =~ /#{session}/ || key =~ /hidden/\n end\n end", "def cleanup\n if @logfile #make sure there is a log file meaning keylog started and migration was successful, if used.\n finish_up if session_good?\n time_stamp(\"exited\")\n end\n end", "def list_trim(key, start, ending)\n timeout_retry(3, 3){\n write \"LTRIM #{key} #{start} #{ending}\\r\\n\"\n status_code_reply\n }\n end", "def destroy\n self.class.delete_all(\"session_id='#{session_id}'\")\n end", "def remove\n if empty?\n @session.delete(SESSION_KEY)\n @session.delete(KEPT_KEY)\n end\n end", "def flush_spaces\n Server.redis { |c| c.del(\"#{QPush::Base::KEY}:namespaces\") }\n end", "def cleanup\n logger.info(\"Cleaning up expired sessions...\", :cleanup, { state: :starting })\n begin\n count = CacheStore.cleanup(ttl: SESSION_TTL)\n logger.info(\"Deleted #{count} expired sessions.\", :cleanup, { state: :success, count: count })\n rescue StandardError => e\n logger.info(\"Failed to clean up expired sessions.\", :cleanup, { state: :error, message: e.message })\n\n # Reraise (calling `raise` without arguments will reraise last error)\n raise\n end\n end", "def reset_sessions\n reset_session_expired_at\n @application_session.update_attributes(\n :expired_at=>session_expired_at\n )\n end", "def purge\n limit = Time.now.to_i - (@conf[:obsolete] * 60) # conf in minutes\n\n @db.execute(\"DELETE FROM #{@dataset} WHERE timestamp < #{limit}\")\n end", "def delete_old_requests\n Request.where('created_at < ?', Time.now - 15.minutes).delete_all\n end", "def clear_session\n Mack::SessionStore.expire_all\n end", "def log_out\n session.delete(:user_id)\n session.delete(:destination)\n @current_user = nil\n @current_dest = nil\n end", "def cleanup\n Authie.notify(:cleanup) do\n # Invalidate transient sessions that haven't been used\n active.where('expires_at IS NULL AND last_activity_at < ?',\n Authie.config.session_inactivity_timeout.ago).each(&:invalidate!)\n # Invalidate persistent sessions that have expired\n active.where('expires_at IS NOT NULL AND expires_at < ?', Time.now).each(&:invalidate!)\n end\n true\n end", "def log_out_now\n\tsession[:user_id] = nil\nend", "def xtrim(key, len_or_id, strategy: 'MAXLEN', approximate: false, limit: nil)\n strategy = strategy.to_s.upcase\n\n args = [:xtrim, key, strategy]\n args << '~' if approximate\n args << len_or_id\n args.concat(['LIMIT', limit]) if limit\n send_command(args)\n end", "def remove_in_progress_task\n $redis.del(\"#{studio.studio_id}:#{ip}\")\n end", "def delete_session(env, sid, options); end", "def clean_update_log\n \t\tif ::Update.count > 50\n\t \tbatch = ::Update.limit(25).order('created_at ASC')\n\t \tbatch.destroy_all\n\t end\n \tend", "def stopSession\n @test.update(session_expired_at: Time.now - 24*60*60)\n\n # consolidate drafts into steps\n helpers.parseDraft(@test.session_id)\n\n render json: 1\n end", "def remove_inscriptions\n next_fixed_shift_users.destroy_all\n end", "def cleanup_sessions\n @mutex.synchronize { @sessions.garbage_collect }\n end", "def prune\n if Event.count > 60\n cutoff = Event.limit(60).last.created_at\n Event.where([\"created_at < ?\", cutoff]).delete_all\n end\n end", "def extend_session!\n @session_object.expire(Session.redis_namespace_ttl)\n @current_user&.identity&.expire(UserIdentity.redis_namespace_ttl)\n @current_user&.expire(User.redis_namespace_ttl)\n end", "def purge_old_requests(seconds = 60)\n @requests.delete_if {|request_time| request_time < Time.now - seconds}\n end", "def clean_db\n Mongoid::Sessions.default.collections.select {|c| c.name !~ /system/}.each {|c| c.find.remove_all}\n end", "def clear_session\n\t\tsession[:email] = nil \n\t\tsession[:player_id] = nil\n\t\tsession[:admin] = nil\n\t\tsession[:login_time] = nil \n\tend", "def trim_logs!(threshold = 1000)\n m = [last_analyzed_log_entry, last_broadcasted_log_entry].min\n l = last_trimmed_log_entry\n entries = []\n\n if m - last_trimmed_log_entry >= threshold\n entries = redis.zrangebyscore(log_key, l, m, :with_scores => true)\n redis.zremrangebyscore(log_key, l, m)\n redis.hset(ident, 'last_trimmed_log_entry', m)\n end\n\n entries\n end", "def purge_old_backups(base)\n count = fetch(:sync_backups, 5).to_i\n backup_files = capture(\"ls -xt #{shared_path}/sync/#{base}*\").split.reverse\n\n if count >= backup_files.length\n logger.info \"no old backups to clean up\"\n else\n logger.info \"keeping #{count} of #{backup_files.length} sync backups\"\n delete_backups = (backup_files - backup_files.last(count)).join(\" \")\n execute \"rm -rf #{delete_backups}\"\n end\n end", "def clear_session\n session[:timeout] = nil\n session[:uid] = nil\n end", "def clear_session\n session[:timeout] = nil\n session[:uid] = nil\n end", "def invalidate_all_sessions!\n update(session_token: SecureRandom.hex)\n end", "def reset_session\n # Cancels all scans if any\n @dir_scanner.cancel_all_scans\n # Delete all dirlines\n @main_widget.remove_all_dirlines\n end", "def remove!\n @session.delete(SESSION_KEY) if empty?\n end", "def sessions\n\n key = \"000000:#{TransamController::ACTIVE_SESSION_LIST_CACHE_VAR}\"\n @sessions = Rails.cache.fetch(key)\n @sessions.delete_if { |key, value| value[:expire_time] < Time.now }\n @sessions ||= {}\n\n end", "def ltrim(key, start, stop)\n send_command([:ltrim, key, Integer(start), Integer(stop)])\n end", "def collect_garbage(options = {})\n config = load_config(options)\n last_key = eliminate_unwanted_sessions(config)\n while !last_key.empty?\n last_key = eliminate_unwanted_sessions(config, last_key)\n end\n end", "def sessions\n SockJS.debug \"Refreshing sessions\"\n\n if @sessions\n @sessions.delete_if do |_, session|\n unless session.alive?\n SockJS.debug \"Removing closed session #{_}\"\n end\n\n !session.alive?\n end\n else\n @sessions = {}\n end\n end", "def remove_old_stored_csvs\n end", "def destroy\n @session.clear\n end", "def destroy\n system \"ruby streaming_script.rb stop\"\n \tsession[:username] = nil\n User.all.each do |user|\n user.destroy\n end\n User.reset_pk_sequence\n Tweet.all.each do |tweet|\n tweet.destroy\n end\n Tweet.reset_pk_sequence\n \treset_session\n \tredirect_to root_path\n end", "def kill_session\n# DEBUG\n# logger.debug \"\\r\\n!! ------ in kill_session -----\"\n# logger.debug params\n if params[:id]\n logger.debug \"\\r\\n!! Killing session #{params[:id]}...\"\n Session.where( :id => params[:id] ).delete_all\n flash[:notice] = I18n.t(:session_deleted)\n else\n flash[:error] = I18n.t(:unable_to_delete_session)\n end\n redirect_to( whos_online_path() )\n end", "def remove_session(session)\n found = nil\n @model.each do |model,path,iter|\n if (iter[ID_SESSION] == session.sid.to_s)\n found = iter\n break\n end\n end\n\n @model.remove(found) if found\n end", "def logout\n $redis.del \"userhash:#{session['userhash']}\"\n session['userhash']=nil\n session['user']=nil\n end", "def clear_session\n session.clear\n end", "def kill_session\n @authenticator.kill_session\n @session = ''\n end", "def reset\n @redis_sessions = nil\n end", "def exec_query_truncate_table\n execute_remote(query_truncate_table)\n end", "def trim_whitespace; end", "def truncate(stream)\n stream = stream_name(stream)\n connection.xtrim(stream, 0)\n end", "def trim! desired_row_length = nil\n max_length = collect { |a| a.trim.length }.max\n self_count = count - 1\n count.times do |index|\n index = self_count - index\n if self[index].trim.empty?\n delete_at(index)\n else\n break\n end\n end\n each { |a| a.trim!(max_length) }\n self\n end", "def clean_up\n #Delete every thing but the most recent config[:screenshot_max_keep] screenshots\n max_screenshots = self.config[:screenshot_max_keep] || 5\n #Delete the last created one while they count is more then the max\n while self.admo_screenshots.count > max_screenshots\n self.admo_screenshots.order_by('created_at asc').first.destroy\n end\n end", "def start\n destroy_session_customer\n end", "def erase_old_data()\n Djinn.log_run(\"rm -rf /tmp/h*\")\n Djinn.log_run(\"rm -f ~/.appscale_cookies\")\n Djinn.log_run(\"rm -f #{APPSCALE_HOME}/.appscale/status-*\")\n Djinn.log_run(\"rm -f #{APPSCALE_HOME}/.appscale/database_info\")\n\n Nginx.clear_sites_enabled\n HAProxy.clear_sites_enabled\n Djinn.log_run(\"echo '' > /root/.ssh/known_hosts\") # empty it out but leave the file there\n CronHelper.clear_crontab\n end", "def cleanup(session = false)\n # if session\n # select { |cookie| cookie.session? || cookie.expired? }\n # else\n # select(&:expired?)\n # end.each { |cookie|\n # delete(cookie)\n # }\n # # subclasses can optionally remove over-the-limit cookies.\n # self\n end", "def cleanup\n @sessions.each_value do |session|\n session.close if session.expired?\n end\n rescue => e\n log.error(\"Expired session cleanup failed: #{e}\")\n end", "def clear_more_then_10_steps\n session[:back_link_history].shift if history && history.size > 10\n end", "def cleanRoom\n session[:room] = nil\n end", "def logout\n session.delete(:subscription_id)\n session.delete(:customer_id)\n redirect_to \"/ssp/index\"\n end", "def delete\n GLOBAL_HASH_TABLE.delete(@session_id)\n end", "def invalidate_session\n @sequence = 0\n @session_id = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end" ]
[ "0.6645038", "0.6458709", "0.63670707", "0.58837026", "0.5831319", "0.57956046", "0.5744739", "0.5724672", "0.56819606", "0.56790954", "0.5668713", "0.5583643", "0.5544497", "0.54910743", "0.54902", "0.5477252", "0.5449822", "0.5423184", "0.5398256", "0.5395869", "0.52884156", "0.52332115", "0.5232923", "0.5228574", "0.5201329", "0.51722413", "0.51654935", "0.51585263", "0.51395935", "0.5129972", "0.5123849", "0.5089305", "0.50864714", "0.5072285", "0.50711393", "0.5063589", "0.5062771", "0.5043153", "0.50405383", "0.5001598", "0.4992192", "0.4980043", "0.49795145", "0.495693", "0.49412212", "0.49311116", "0.49282485", "0.49270537", "0.49178338", "0.49049267", "0.48926485", "0.48815593", "0.48802695", "0.48787206", "0.48760805", "0.48714963", "0.4866225", "0.48654452", "0.4863197", "0.48619848", "0.48592526", "0.4855306", "0.48517126", "0.4847012", "0.4845986", "0.484469", "0.48395297", "0.4815365", "0.4815365", "0.48040518", "0.48036128", "0.4794307", "0.47898528", "0.47875297", "0.47771326", "0.4774918", "0.47606882", "0.47518742", "0.4747917", "0.4743439", "0.47281224", "0.4723236", "0.47188848", "0.4712466", "0.47088382", "0.47049862", "0.47013122", "0.4698482", "0.469829", "0.46938598", "0.4688236", "0.46862304", "0.46800807", "0.46792197", "0.46790656", "0.4661961", "0.46610084", "0.46549895", "0.46516123", "0.46496192" ]
0.7720065
0
resends an activation email, for unactivated users that haven't received an email since RESEND_ACTIVATION_EMAIL_DELAY and a total maximum of MAX_ACTIVATION_EMAILS (which will include the first one)
def resend_activation_emails User.where.not(person: nil).where.not(activation_code: nil).each do |user| if user.person logs = user.person.activation_email_logs if logs.count < MAX_ACTIVATION_EMAILS && (logs.empty? || logs.last.created_at < RESEND_ACTIVATION_EMAIL_DELAY.ago) Mailer.activation_request(user).deliver_later MessageLog.log_activation_email(user.person) end else Rails.logger.info("User with invalid person - #{user.id}") end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_activation_email\n ensure_activation_token_set\n UserMailer.account_activation(self, activation_token).deliver_later unless activated?\n end", "def resend_activation_email\n create_activation_digest\n save\n send_activation_email\n end", "def send_activation_email\n UserMailer.account_activation(self, activation_token).deliver_later\n end", "def send_activation_email\n unless notified?\n Notifier.email_activation(self).deliver\n self.update_attribute(:notified, true)\n end\n end", "def send_activation_email\n\t\tUserMailer.account_activation(self).deliver_now\n\tend", "def send_activation_email\n\t\tUserMailer.user_activation(self).deliver_now\n\tend", "def send_activation\n if email_changed? and enable_mailer\n activated = false\n UserMailer.welcome_email(self, host).deliver\n end\n end", "def resend_activation\n current_user.send_activation!\n\n flash[:notice] = \"Activation email delivered successfully.\"\n redirect_to user_url\n end", "def send_activation_email\n UserMailer.account_activation(self).deliver_now\n end", "def send_activation_or_reset_mail\n end", "def send_self_eval_invitations\n users = User.all.select{|u| \n u.has_current_registration && \n u.current_registration.participant && \n !u.faculty && \n !u.test && \n !u.current_registration.has_complete_eval\n }\n users.each do |u| \n if u.bounced_at \n Rails.logger.error(\"Found bounced email #{u.email} in sending self eval_reminder\")\n else\n begin\n RegistrationMailer.self_eval_invitation(u)\n puts(\"Succeed on #{u.email}\")\n rescue => e\n puts(\"Failed on #{u.email}\")\n Rails.logger.error(\"Send eval throws #{e}, skipping #{u.email}\")\n end\n end\n end\n end", "def send_activation_email\n UserMailer.account_activation(self).deliver_now\n end", "def send_activation_email\n UserMailer.account_activation(self).deliver_now\n end", "def send_activation_email\n UserMailer.account_activation(self).deliver_now\n end", "def send_activation_email\n UserMailer.account_activation(self).deliver_now\n end", "def send_activation_email\n UserMailer.account_activation(self).deliver_now\n end", "def send_activation_email\n UserMailer.account_activation(self).deliver_now\n end", "def send_activation_email\n UserMailer.account_activation(self).deliver_now\n end", "def send_activation_email\n UserMailer.account_activation(self).deliver_now\n end", "def send_activation_email\n UserMailer.account_activation(self).deliver_now\n end", "def send_activation_email\n UserMailer.account_activation(self).deliver_now\n end", "def send_activation_email\n @user = User.find(params[:id])\n\n if @user.activated?\n flash[:fail] = \"Account already activated\"\n\n else\n begin\n @user.reset_activation_token!\n UserMailer.activation_email(@user).deliver!\n\n flash[:success] = \"Activation email sent\"\n rescue StandardError => e\n flash[:errors] = [\"Unable to send activation email\", e.message]\n end\n end\n\n if params[:flash]\n flash[:success] = params[:flash] + \". \" + flash[:success]\n end\n\n redirect_to user_url(@user)\n end", "def send_activation_email\n UserMailer.account_activation(self).deliver_now\n update_attribute(:activation_sent_at, Time.zone.now)\n end", "def send_activation_mail\n UserMailer.account_activation(self).deliver_now\n end", "def send_activation_mail\n UserMailer.account_activation(self).deliver_now\n end", "def account_activation\n user = User.first\n user.activation_sent_at = Time.current\n UserMailer.account_activation(user)\n end", "def send_self_eval_reminders\n users = User.all.select{|u| u.has_current_registration && u.current_registration.participant && !u.current_registration.has_complete_eval}\n @sent = []\n users.each do |u| \n if u.bounced_at \n Rails.logger.error(\"Found bounced email #{u.email} in sending self eval_reminder\")\n else\n begin\n RegistrationMailer.self_eval_reminder(u)\n puts(\"Succeed on #{u.email}\")\n @sent << u.email\n rescue => e\n puts(\"Failed on #{u.email}\")\n Rails.logger.error(\"Send eval throws #{e}, skipping #{u.email}\")\n end\n end\n end\n end", "def send_activation_email\n UserMailer.account_activation(self).deliver\n end", "def activation_needed_email(user)\n @user = user\n @activation_url = activate_url(token: user.activation_token)\n mail to: user.email\n end", "def resend_invitation_emails(invitations)\n invitations.each do |invitation|\n Course::Mailer.user_invitation_email(@current_course, invitation).deliver_later\n end\n ids = invitations.select(&:id)\n Course::UserInvitation.where(id: ids).update_all(sent_at: Time.zone.now)\n true\n end", "def send_activation_notification\n deliver_activation_email(:activation, :subject => (MaSA[:welcome_subject] || \"Welcome\" ))\n end", "def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save\n\n # send mail for activation\n UserMailer.dispatch_and_deliver( :activation_notification,\n { :from => User::EMAIL_FROM,\n :to => self.email,\n :subject => User::ACTIVATE_MAIL_SUBJECT },\n\n :user => self )\n\n end", "def send_email_verification_email\n update_attribute(:activated, false)\n update_attribute(:activation_token, User.new_token)\n update_attribute(:activation_digest, User.digest(activation_token))\n save\n UserMailer.email_verification(self).deliver_now\n end", "def send_activation_email\n DoctorMailer.account_activation(self).deliver_now\n end", "def do_pending\n make_activation_code\n # send the user an email with an activation code\n UserMailer.deliver_signup_notification(self)\n end", "def activation_needed_email(user)\n @user = user\n @account_activation_url = activate_user_url(user.activation_token)\n mail to: user.email, subject: \"ACTION NEEDED: Activate your VCDelta.org account\"\n end", "def email_activation_confirmation(email)\n setup_email(email.user, email.address)\n @subject += 'A new email address has been activated'\n @body[:url] = \"#{SITE_URL}/\"\n end", "def activation_needed_email(user)\n @user = user\n @url = users_activate_path(id: user.activation_token)\n mail(to: user.email, subject: \"#{User.model_name.human}登録を完了しましょう!\")\n end", "def send_account_notification\n @user = User.find_by_id(params[:id]) \n begin \n url = \"http://www.uncharted.net/account/activation/#{@user.activation_code}\" \n Emailer.deliver_admin_accountactivation(@user.email,url)\t\n end\n flash[:notice] = \"Email has been sent to #{@user.email} to active his account.\"\n redirect_to :action => 'index'\n end", "def send_active_needs_approval_email\n Users::SendNeedsApprovalEmailJob.perform_later(user_id: self.id, active: true)\n end", "def send_invitation_emails(registered_users, invited_users)\n registered_users.each do |user|\n Course::Mailer.user_added_email(@current_course, user).deliver_later\n end\n resend_invitation_emails(invited_users)\n end", "def do_pending \n make_activation_code\n ClaimingMailer.deliver_confirmation_request(self) if self.email && self.activation_code\n end", "def deliver_activation_instructions!\n if Settings.uses_resque_for_background_emails\n Resque.enqueue(Jobs::SendSignUpNotification, self.id)\n else\n Notifier.signup_notification(self.id).deliver_later\n end\n end", "def send_admin_activation_email\n MemberMailer.admin_account_activation(self).deliver_now\n end", "def email_activation(email)\n setup_email(email.user, email.address)\n @subject += 'Please verify your email address'\n @body[:url] = \"#{SITE_URL}/activate/#{email.activation_code}\"\n end", "def account_activation(user)\n @user = user\n mail to: user.email # => mail object\n # => app/views/user_mailer/account_activation.text.erb\n # => app/views/user_mailer/account_activation.html.erb \n # https://hogehoge.com/account_activations/:id/edit\n # :id <= @user.activation_token\n end", "def deliver_activation_confirmation!\n reset_perishable_token!\n Mailer.deliver_activation_confirmation(self)\n end", "def activation_success_email\n UserMailer.activation_success_email(User.first)\n end", "def account_activation_request(user, new_user)\n @new_user = new_user\n @url = url_for(:controller => 'users', :action => 'index',\n :status => User::STATUS_REGISTERED,\n :sort_key => 'created_on', :sort_order => 'desc')\n mail :to => user,\n :subject => l(:mail_subject_account_activation_request, Setting.app_title)\n end", "def activate_new_email\n flash.clear\n return if params[:id] == nil && params[:email_activation_code] == nil\n\n activator = params[:id] || params[:email_activation_code]\n @user = User.find_by_email_activation_code(activator)\n if @user && @user.activate_new_email\n notice = \"The email address for your account has been updated\"\n if @user.is_same_user?(current_user)\n redirect_back_or_default(edit_user_path(@user))\n else\n redirect_back_or_default(:controller => :sessions, :action => :logout, :notice => notice )\n end\n flash[:notice] = notice\n else\n flash[:notice] = \"Unable to update the email address\"\n end\n end", "def send_activation_email(client_ip = '0.0.0.0')\n Incline::UserMailer.account_activation(user: self, client_ip: client_ip).deliver_now\n end", "def send_signup_notification\n deliver_activation_email(:signup, :subject => (MaSA[:activation_subject] || \"Please Activate Your Account\") )\n end", "def reactivate\n @user = User.find(params[:id])\n @user.create_activation_digest\n @user.update_attribute(:activation_digest, @user.activation_digest)\n @user.send_activation_email\n flash[:info] = \"Click the activation link we just emailed you, \n and we'll log you in.\"\n redirect_to root_url\n end", "def send_invitation_emails(registered_users, invited_users)\n registered_users.each do |user|\n Course::Mailer.user_added_email(@current_course, user).deliver_later\n end\n invited_users.each do |user|\n Course::Mailer.user_invitation_email(@current_course, user).deliver_later\n end\n true\n end", "def send_activation_email\n @admin = BusinessAdmin.find(params[:id])\n if @admin.active\n flash_error \"flash.error.admin.send_activation_mail_active\" \n else \n UserMailer.admin_activation_email(@admin).deliver\n flash_success \"flash.success.admin.send_activation_mail\",{}, {:email=>@admin.email} \n end\n \n end", "def new_activation_email\n if request.post?\n @user = User.find_by_email(params[:email])\n @user.reset_perishable_token!\n UserMailer.activation_email(@user).deliver\n flash[:notice] = \"Check your email for a new activation link\"\n redirect_back_or_default root_path\n else\n @user = User.new\n end\n end", "def activation_success_email\n UserMailerMailer.activation_success_email\n end", "def send_recover_needs_approval_email\n Users::SendNeedsApprovalEmailJob.perform_later(user_id: self.id, active: false)\n end", "def activate_new_email\n @activated_email = true\n update_attributes(:email => self.new_email,\n :new_email => nil,\n :email_activation_code => nil)\n end", "def email_address_activation\n user = User.first\n email_address = EmailAddress.find_by(id: user.primary_email_address_id)\n email_address.activation_token = new_token\n UserMailer.email_address_activation(user, email_address)\n end", "def send_all_invitations\n uu = User.all.reject{|u| u.bounced_at || u.test || u.email =~ /musicalretreat.org/ || u.has_current_registration}\n Rails.logger.info(\"Going to send #{uu.size} invitations\")\n uu.each do |u|\n begin\n RegistrationMailer.invitation(u)\n Rails.logger.info(\"Successfully sent to #{u.email}\")\n rescue StandardError => e\n Rails.logger.error(\"Failed to send to #{u.email} due to #{e}\")\n end\n end\n end", "def after_save(user)\n UserMailer.deliver_activation(user) if user.pending?\n end", "def email_activation\n @user = Student.first\n @user.create_email_activation\n @email = 'yan_fuhai@hotmail.com'\n @option = 'student'\n UserMailer.email_activation @user, @email, @option\n end", "def send_early_invitations\n RegistrationGating.early_invitees.each{|email| RegistrationMailer.early_invitation(email)}\n @sent = RegistrationGating.early_invitees.size\n end", "def notify_member_expire_1\n users, event = User.unpaid_membership_expires_in_1_day\n users.each do |user|\n UserMailer.deliver_membership_expires_in_1_day(user)\n User.add_email_event(user, event)\n end\n end", "def notify_member_expire_7\n users, event = User.unpaid_membership_expires_in_7_days\n users.each do |user|\n UserMailer.deliver_membership_expires_in_7_days(user)\n User.add_email_event(user, event)\n end\n end", "def account_activation(user)\n @user=user\n\n mail :to => @user.email, :from => \"allr0undy0u@gmail.com\", :subject => \"Account activation\"\n end", "def deliver_activation_instructions!\n reset_perishable_token!\n Mailer.deliver_activation_instructions(self)\n end", "def activation(user, email)\n setup_email(user, email)\n @subject += 'Your account has been activated!'\n @body[:url] = \"#{SITE_URL}/\"\n end", "def activation_success_email user, application_id\n @user = User.find user\n @application = @user.used_applications.find application_id\n @url = application_url(@application)\n mail(:to => @user.email,\n :subject => \"You have been added to #{@application.application_name}\")\n end", "def activation_needed_email(user)\n # TODO: Implement actual functionality -- Wed Jun 13 15:26:53 2012\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def activation_needed_email(user)\n @user = user\n @url = \"http://0.0.0.0:3000/users/#{user.activation_token}/activate\"\n\n mail to: @user.email, subject: \"[적어적어]마! 이메일 인증해라\"\n end", "def activation_needed_email(user)\n @user = user\n @url = \"http://lvh.me:3000/users/#{user.activation_token}/activate\"\n mail(:to => user.email,\n :subject => \"Welcome to StackClown\")\n end", "def activation(user)\n setup_email(user)\n @subject += 'Your account has been activated!'\n @body[:url] = \"http://#{AppConfig.app_url}/\"\n end", "def activation\n @user = User.first\n UserMailer.activation(@user)\n end", "def send_activation_request\n end", "def send_acceptance_email\n # UserMailer.delay.send_accepted_email(user_id)\n end", "def activation_success_email(user)\n # TODO: Implement actual functionality -- Wed Jun 13 15:26:53 2012\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def account_activation(user)\n @user = user\n\n mail to: user.email, subject: \"Account activation\"\n end", "def active_account(email)\n raise StandardError, 'The account can not be activate' if\n email.nil? || email.user.id != self.id\n\n email.update!(checked: true, primary: true)\n self.update!(status: true)\n\n Notifier.send_signup_verify_email(email.email, self).deliver_later\n end", "def activation_confirmation(user)\n @root_url = root_url\n mail(:subject => setup_subject(I18n.t('activation_complete')),\n :to => user.email)\n end", "def after_request_activation(user, transition)\n UserMailer.deliver_activation_request(user)\n end", "def activation(account_request)\n @url = new_account_request_activation_url(account_request,\n :token => account_request.activation_token)\n\n mail(:to => account_request.email,\n :subject => 'Woods Charter School Lunch Online -- Account Activation')\n end", "def resend_confirmation\n return unless request.post?\n if current_user.activated_at\n flash.now[:error] = \"Your account has already been activated.\"\n else\n UserNotifier.deliver_signup_notification(current_user)\n flash.now[:notice] = \"Your confirmation email has been re-sent\"\n render :action => 'index'\n end\n end", "def send_newsletter_email\n UserMailer.newsletter_confirmation(self).deliver_later\n end", "def send_email(user)\n\t UserMailer.activate_email(user).deliver\n\tend", "def send_invite\n\t\tMyMailer.new_invite(self).deliver_now\n\t\t#MyMailer.new_invite(self).deliver_later!(wait_until: 5.minutes.from_now)\n\tend", "def send_invite\n\t\tMyMailer.new_invite(self).deliver_now\n\t\t#MyMailer.new_invite(self).deliver_later!(wait_until: 5.minutes.from_now)\n\tend", "def deliver_activation_instructions!\n Notifier.delay.signup_notification(self.id)\n end", "def account_activation(user)\n @user = user\n mail to: user.email, subject: \"Account activation\"\n end", "def account_activation(user)\n @user = user\n mail to: user.email, subject: \"Account activation\"\n end", "def activation_success_email\n ActivationEmail.activation_success_email\n end", "def send_confirmation_email(user, last_sent_at = nil)\n # send one email every 2 minutes\n # TODO: upgrade timestamp to Redis\n last_sent_at = session[:last_validation_email_at] if last_sent_at.nil? and session and session[:last_validation_email_at]\n meta = { :to => user.email, :from => $settings.customer_service_email, :last_sent_at => last_sent_at }\n return meta if test?\n return meta if last_sent_at and Time.at(last_sent_at) >= 2.minutes.ago\n\n Email::Sender.send(:validation, {\n :to => user.email,\n :email_token => user.smart_token.to_s,\n :name => user.login_name,\n :subject => 'Confirmation Email',\n :now => true\n })\n\n # update timestamp\n meta[:last_sent_at] = Time.new.to_i\n session[:last_validation_email_at] = meta[:last_sent_at]\n\n meta\n end", "def account_activation(user)\n @user = user\n mail to: user.email, subject: \"CRS Account Activation\"\n end", "def send_balance_reminders\n #test_emails = [\"hanks@pobox.com\"]\n test_emails = nil\n rr = Registration.where(year: Year.this_year).select{|r|r.balance > 0}\n rr = rr.select{|r|test_emails.include?(r.email)} if test_emails\n rr.each do |r| \n u = r.user\n if u.bounced_at\n puts(\"Found bounced email #{u.email} in sending balance reminder\")\n else\n begin\n RegistrationMailer.balance_reminder(r)\n puts(\"Succeeded on #{u.email}\")\n rescue => e\n puts(\"Failed on #{u.email} due to #{e}\")\n Rails.logger.error(\"Send balance throws #{e}, skipping #{u.email}\")\n end\n end\n end\n end", "def activation_success_email(user)\n @user = user\n @subject = \"[#{SITE_NAME}] Account activated\"\n mail(bcc: @user.email, subject: @subject)\n end", "def resend_confirmation_email\n WEPAY.call('/user/resend_confirmation', self.wepay_access_token, {\n email_message: 'Thank you for signing up with WeCrowd. In order to process payments, you will need to confirm your email address and set a secure payment password. Click the \"confirm\" button below to begin.'\n })\n end", "def polled_delivery( recipient_email , pending_deliveries )\n @recipient_email = recipient_email \n @user = User.find_by_email @recipient_email \n @pending_deliveries = pending_deliveries\n time = Time.now\n \n mail( :to => recipient_email, \n :subject => \"pilipoto | Updates (#{pending_deliveries.count}): #{time}\", \n :bcc => [\"rajakuraemas@gmail.com\"] )\n \n end", "def send_feedback_reminders_emails\n # Send the emails\n feedback_reminders.each do |fr|\n fr.send_feedback_reminder_email\n end\n\n # Shift the send_feedback_reminders_after date of\n # FEEDBACK_REMINDERS_INTERVAL seconds in the future\n self.send_feedback_reminders_after =\n Time.zone.today + FEEDBACK_REMINDERS_INTERVAL\n\n # Increment feedback_reminders_count\n self.feedback_reminders_count += 1\n\n # save the connection\n save\n end", "def deliver_activation_email(action, params)\n from = MaSA[:from_email]\n raise \"No :from_email option set for Merb::Slices::config[:merb_auth_slice_activation][:from_email]\" unless from\n MaSA::ActivationMailer.dispatch_and_deliver(action, params.merge(:from => from, :to => self.email), :user => self)\n end" ]
[ "0.76395684", "0.7530265", "0.74310166", "0.7217659", "0.7192913", "0.7174737", "0.71179324", "0.7113635", "0.70671463", "0.7021973", "0.69925255", "0.6991832", "0.6991832", "0.6991832", "0.6991832", "0.6991832", "0.6991832", "0.6991832", "0.6991832", "0.6991832", "0.6991832", "0.6929072", "0.6920768", "0.6910033", "0.6910033", "0.6843003", "0.67908084", "0.6770605", "0.66772443", "0.66688156", "0.65722126", "0.65705633", "0.65427524", "0.6539449", "0.65242463", "0.65060467", "0.65026987", "0.65014726", "0.6501202", "0.64903414", "0.64883053", "0.64744645", "0.6465096", "0.64532894", "0.6432532", "0.642047", "0.6419364", "0.6415224", "0.6389821", "0.6381854", "0.6381648", "0.6374743", "0.63604414", "0.63527673", "0.63336545", "0.63277596", "0.63174593", "0.63119024", "0.63106436", "0.63063216", "0.63037914", "0.6298275", "0.6284959", "0.6274954", "0.6272479", "0.62644887", "0.6264423", "0.6247815", "0.6233096", "0.6216002", "0.62061286", "0.61964124", "0.61569744", "0.61230797", "0.6109282", "0.6104772", "0.60992664", "0.6075281", "0.6070388", "0.60626256", "0.6059201", "0.60556287", "0.6054408", "0.6051963", "0.60449123", "0.601981", "0.60139555", "0.60139555", "0.5997517", "0.5995386", "0.5995386", "0.59824693", "0.5976468", "0.59745896", "0.59657437", "0.5963339", "0.59587497", "0.5946319", "0.5946274", "0.5944271" ]
0.84578097
0
Output message to $stderr, prefixed with the program name
def pute(message="") $stderr.puts "#{$0}: #{message}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_stderr(msg)\n puts \" #{color(msg, 31)}\"\n end", "def err(message)\n stderr.puts message\n end", "def error(msg)\n STDERR.puts \"#{@progname}: FAIL: #{msg}\"\n end", "def error_message(msg)\n STDERR.puts msg\n end", "def error(msg) $stderr.puts(\"Error: #{msg}\") end", "def error_message( msg, details='' )\n\t\t$stderr.puts colorize( 'bold', 'white', 'on_red' ) { msg } + ' ' + details\n\tend", "def puts_err(msg)\n STDERR.puts(msg.to_s.red)\n end", "def message text\n $stderr.puts text\n end", "def message text\n $stderr.puts text\n end", "def error_message( msg, details='' )\n\t\t\t$stderr.puts colorize( 'bold', 'white', 'on_red' ) { msg } + details\n\t\tend", "def puts (msg)\n $stderr.puts msg\n end", "def error(fmt, *args)\n $stderr.printf(\"%s: %s\\n\", File.basename($0), sprintf(fmt, *args))\n exit(1)\nend", "def error(message)\n $stderr.puts message\n end", "def print_error(msg = '')\n $stderr.puts \"[ERROR] #{msg}\"\n end", "def printerr *s\n s.each do |_|\n Lib.g_application_command_line_printerr self.ffi_pointer, _.to_s+\"\\n\"\n end\n end", "def rake_output_message(message)\n $stderr.puts(message)\n end", "def err(message)\n STDERR.puts(message)\n exit 1\n end", "def error(message)\n STDERR.puts <<-EOS\n\\u001b[1;91mERROR\\u001b[0m \\u001b[1m#{message}\\u001b[0m\n\n#{self.banner}\n EOS\n exit 1\n end", "def err_name\n if (defined? @port_num)\n return \"error_#{@port_num}.log\"\n else\n return \"error_#{Process.pid}.log\"\n end\n end", "def errmsg(message)\n print(\"*** #{message}\\n\")\n end", "def stderr\n \"#{dir}__job.stderr\"\n end", "def error(message)\n STDERR.puts red(message)\n end", "def print_error(msg)\n puts \" #{color(\"!\", 33)} #{color(msg, 31)}\"\n end", "def err(msg)\n puts msg.red\n exit(1)\n end", "def error(message)\n logger.error(PROG_NAME) { message }\n end", "def error(message)\n $stderr.puts colorize(message, :error)\n end", "def warning(msg) $stderr.puts(\"Warning: #{msg}\") end", "def warning(msg) $stderr.puts(\"Warning: #{msg}\") end", "def warning(msg) $stderr.puts(\"Warning: #{msg}\") end", "def error(message)\n message = message.red unless message.color?\n puts(stderr, message)\n end", "def error(msg)\n stderr(\"error: #{msg}\")\n end", "def print_error_message(msg)\n print \"<< ERROR: #{msg.to_s} !!\\n\"\n end", "def errmsg(message)\n error.print(\"*** #{message}\\n\")\n end", "def output_error(cmd)\n puts \"La commande '#{cmd}' n'existe pas ou a été mal formulée.\".red\n end", "def error(subject = nil, message)\n $stderr.puts \"#{name}: #{message}\"\n saved = $stdout\n begin\n $stdout = $stderr\n Formatter.usage(grammar)\n exit 1\n ensure\n $stdout = saved\n end\n end", "def display_err_file(err_file)\n if err_file.exist?\n $stderr.puts err_file.read\n else\n $stderr.puts \"MPASM failed but the ERR file was not found: #{err_file}\"\n end\nend", "def failure(message)\n $stderr.puts \"#{name}: #{message}\"\n exit 1\n end", "def print_error(msg)\n interface.errmsg(msg)\n interface.puts(option_parser.help)\n end", "def err(message = '')\n @out_sections = [] unless defined?(@out_sections)\n message = \"#{' ' * @out_sections.size}#{message}\"\n # log_debug \"<Output> - #{message}\"\n message = \"#{message}\\n\" unless message.end_with?(\"\\n\")\n @logger_stderr << message\n end", "def stderr(command, data)\n # called when the process writes to STDERR\n end", "def stderr(*msgs)\n STDERR.puts(*msgs)\n end", "def error(message)\n STDERR.puts message\nend", "def error(msg)\n puts red(bold(\"[!] #{msg}\"))\n end", "def write_error(message)\n STDERR.puts(message)\n end", "def error(msg)\n puts \"\\n#{@red}[Error] #{msg}!#{@ncl}\\n\"\n end", "def error(msg)\n puts \"\\e[0;31m#{ msg }\\e[0m\"\n end", "def error_message(ex) #:nodoc:\n msg = \"error: #{ex.message}\"\n case ex\n when UnknownCommand\n msg += \". Use '#{program_name} help' for a list of commands\"\n when UnknownCommandArgument\n msg += \". Use '#{program_name} help #{ex.command.name}' for a list of command options\"\n when UnknownGlobalArgument\n msg += \". Use '#{program_name} help' for a list of global options\"\n end\n msg\n end", "def error(message)\n print(1, message)\n end", "def print_error(message, file)\n @output.puts \"\\u{274c} #{file} - #{message}\"\n end", "def print_error(message, file)\n @output.puts \"\\u{274c} #{file} - #{message}\"\n end", "def doing(what, message=nil)\n unless verbose\n message = [ \" #{what.to_s.upcase}\", message ].compact.join(' ')\n STDERR.puts message\n end\nend", "def error(message, options = {})\n options[:prefix] ||= \" - \"\n options[:color] ||= :red\n output message, options\n end", "def write_fatal_error message\n puts \"Error: #{message}. See spritemaster -h for usage\"\n exit\n end", "def fail(msg)\n if Dotgpg.interactive?\n $stderr.puts msg\n exit 1\n else\n raise Dotgpg::Failure, msg, caller[1]\n end\n end", "def format_redirect_stderr(cmd, target = NULL_OUTPUT_NAME)\n return cmd + \" 2>#{target}\"\n end", "def print_err(err)\n Weechat.print '', \"%sTTS\\t%s - %s\" % [\n Weechat.color('red'),\n err.class.name,\n err.message\n ]\n end", "def err(message)\n warn \" > #{message}\"\nend", "def print_error(message, opts={})\n STDERR.puts\n STDERR.puts \"! FAILED TO #{message.upcase} !\"\n STDERR.puts\n \n opts.each_pair do |k, v|\n next if v.nil? || v == \"\"\n \n STDERR.puts \"#{k.capitalize}\"\n \n v.split(\"\\n\").each do |line|\n STDERR.puts \" #{line}\"\n end\n \n STDERR.puts\n end\n \n exit 1\n end", "def output_error(string)\n if Command.ui\n Command.ui.error string\n else\n $stderr.puts \"ERROR: #{string}\"\n end\n end", "def display_error_message(ex)\n $stderr.puts \"#{@name} aborted!\"\n $stderr.puts ex.message\n $stderr.puts ex.backtrace.join(\"\\n\")\n end", "def error(message)\n output[:errors] << message\n end", "def fail(msg)\n $stderr.puts(msg)\n exit(1)\nend", "def error(message)\n Kernel.puts \" !\"\n message.split(\"\\n\").each do |line|\n Kernel.puts \" ! #{line.strip}\"\n end\n Kernel.puts \" !\"\n exit 1\nend", "def error(text)\n STDERR.puts red_term_text(text)\n end", "def err(input)\n puts \"[#{Time.now.strftime(\"%T\").purple} \" + \"ERROR\".red + \"] \" + \"#{input.red}\"\n end", "def display_error_message(ex)\n $stderr.puts \"#{name} aborted!\"\n $stderr.puts ex.message\n if options.trace\n $stderr.puts ex.backtrace.join(\"\\n\")\n else\n $stderr.puts tdp_file_location(ex.backtrace)\n end\n $stderr.puts \"(See full trace by running task with --trace)\" unless options.trace\n end", "def display_error_message(ex)\n $stderr.puts self.to_s()\n super(ex) \n end", "def print_status(msg = '')\n $stderr.puts \"[*] #{msg}\"\n end", "def msg(message)\n stdout.puts message\n rescue Errno::EPIPE => e\n raise e if @config[:verbosity] >= 2\n\n exit 0\n end", "def error(message) puts(message) || exit end", "def print_error\n puts $0 + \": illegal option \" + ARGV[0]\n print_usage\nend", "def stderr\n File.join(dir, 'stderr')\n end", "def say_failed(message)\n say \"Failed!!\", message, :yellow\n end", "def log_stderr(type: :info, message:)\n $stderr.puts log_entry(type, message)\n end", "def error(progname = nil, &block)\n add(ERROR, nil, progname.red, &block)\n end", "def error(msg)\n return if @nolog\n puts msg\n exit 5\n end", "def err(dir, msg)\n msglen = msg.length + 6\n warn(format(\"%-#{TW - msglen}<dir>s %<msg>s\", dir: dir, msg: msg))\n end", "def stderr\n run unless ran?\n\n @stderr\n end", "def _err_text(ary)\n ary[0] = __make_head + ary[0] unless $stderr.tty?\n ary.join(\"\\n \")\n end", "def error(message)\n output[:errors] << message\n end", "def log(msg)\n STDERR.print \"** \", msg, \"\\n\"\n end", "def display_error_message(ex)\n $stderr.puts \"#{name} aborted!\"\n $stderr.puts ex.message\n if options.trace\n $stderr.puts ex.backtrace.join(\"\\n\")\n else\n $stderr.puts ex.backtrace.find {|str| str =~ /#{@rakefile}/ } || \"\"\n $stderr.puts \"(See full trace by running task with --trace)\"\n end\n end", "def handle_error(cmd, stderr)\n summary = \"\\rError running \\`#{cmd}\\`\"\n details = readable_curr_time << \"\\n\\n\"\n details << \"**************************************************************\\n\"\n details << \"#{summary}\\n\"\n details << \"**************************************************************\\n\"\n details << stderr << \"\\n\\n\"\n File.open(@err_path, 'a') { |file| file.write(details) }\n summary\nend", "def errmsg(*args)\n if Debugger.annotate.to_i > 2\n aprint 'error-begin'\n print(*args)\n aprint ''\n else\n print '*** '\n print(*args)\n end\n end", "def err(message, title=nil)\n Sinatra::Messages.error(\"#{get_env}#{message}\", title)\n end", "def printUsageMessage()\n\n print \"Check the last NAMD log file in a directory to make sure the run either completed\\n\"\n print \"successfully or died after all necessary restart files were written. Then restart\\n\"\n print \"the run or print an error message.\\n\"\n print \" autoNamdRun.rb <configFile>\\n\"\n print \" <configFile> - file listing all NAMD jobs to check\\n\"\n\n return\nend", "def error(msg = '')\n\t\toutput.print_error(msg)\n\tend", "def error(text)\n\t# is command run from a console?\n\tif STDIN.isatty\n\t\t# if so, then print message to console\n\t\tputs text\n\telse\n\t\t# otherwise print it to GUI\n\t\ttitle = File.basename($PROGRAM_NAME)\n\t\tc = \"#{ZENITY} --error --title \\\"#{title}\\\" --text \\\"#{text}\\\"\"\n\t\tsystem(c)\n\tend\nend", "def usage(s)\n $stderr.puts(s)\n $stderr.puts(\"Usage: #{File.basename($0)}: [-m module] [-o outdir] program [args]\")\n exit(2)\nend", "def warn(part, msg)\n self.project.shell.say \"\\033[37m#{part.class.to_s}\\033[0m\" + \" : \" + \"\\033[31m#{msg.to_s}\\033[0m\", nil, true\n end", "def warn(part, msg)\n self.project.shell.say \"\\033[37m#{part.class.to_s}\\033[0m\" + \" : \" + \"\\033[31m#{msg.to_s}\\033[0m\", nil, true\n end", "def error_msg\n name\n end", "def usage(msg)\n\tSTDERR.print msg, \"\\n\\n\"\n\tSTDERR.print \"Usage: #{File.basename($0)} statefile [statefile ...]\\n\\n\"\n\tSTDERR.print \"export iroffer statefile to text.\\n\"\n\texit 64\nend", "def trace( *msg )\n\t\t\treturn unless Rake.application.options.trace\n\t\t\toutput = colorize( msg.flatten.join(' '), 'yellow' )\n\t\t\t$stderr.puts( output )\n\t\tend", "def error( text )\n puts \"Script #{@name} #{version} - Error: #{text}\"\n exit 1\n end", "def error(msg)\n puts \"#{msg}\\n\\n\"\n exit -1\nend", "def log( *msg )\n\t\t\toutput = colorize( msg.flatten.join(' '), 'cyan' )\n\t\t\t$stderr.puts( output )\n\t\tend", "def title\n program = \"#{@config.program} - \" if @config.program\n \"#{program}#{exception.class}:#{exception.message}\"\n end" ]
[ "0.724072", "0.71394396", "0.7111328", "0.70725524", "0.6876612", "0.68547565", "0.68441767", "0.68338865", "0.68338865", "0.68309885", "0.67441624", "0.6689399", "0.66883683", "0.6624145", "0.6621192", "0.66098917", "0.6568128", "0.6556838", "0.6542161", "0.652385", "0.65150875", "0.64975417", "0.6452445", "0.6440557", "0.64116544", "0.63904274", "0.6385813", "0.6385813", "0.6385813", "0.6378725", "0.6374472", "0.63698936", "0.6355431", "0.6317019", "0.62965673", "0.6274902", "0.6274316", "0.6271237", "0.625586", "0.6252939", "0.62425524", "0.6218959", "0.61997855", "0.61815643", "0.61646724", "0.6151532", "0.61451346", "0.6137754", "0.61195165", "0.61195165", "0.6113054", "0.6109971", "0.6109629", "0.6074073", "0.6062228", "0.60591626", "0.6049772", "0.6047518", "0.6027259", "0.601646", "0.6009978", "0.6001771", "0.5998742", "0.5991899", "0.5983869", "0.59790033", "0.59784406", "0.59667313", "0.59651643", "0.5964873", "0.5960619", "0.5949145", "0.5930121", "0.59287167", "0.5922716", "0.59115016", "0.59015167", "0.58881104", "0.5882948", "0.5878678", "0.58685553", "0.5864492", "0.5852786", "0.5845586", "0.5842946", "0.5842267", "0.58361965", "0.5829014", "0.5816549", "0.58045256", "0.5801725", "0.5796553", "0.5784433", "0.5772793", "0.57726425", "0.5772173", "0.5767607", "0.576736" ]
0.6206332
44
GET /service_type_masters GET /service_type_masters.json
def index @service_type_masters = ServiceTypeMaster.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @masterservices = Masterservice.all\n end", "def index\n @service_master = ServiceMaster.new\n @service_masters = ServiceMaster.all\n end", "def set_masterservice\n @masterservice = Masterservice.find(params[:id])\n end", "def set_service_type_master\n @service_type_master = ServiceTypeMaster.find(params[:id])\n end", "def service_type_master_params\n params[:service_type_master]\n end", "def create\n @service_type_master = ServiceTypeMaster.new(service_type_master_params)\n\n respond_to do |format|\n if @service_type_master.save\n format.html { redirect_to @service_type_master, notice: 'Service type master was successfully created.' }\n format.json { render action: 'show', status: :created, location: @service_type_master }\n else\n format.html { render action: 'new' }\n format.json { render json: @service_type_master.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @provider_services = ProviderService.all\n # @provider_masters = ProviderMaster.all\n @service_masters = ServiceMaster.all\n end", "def show\n @service_type = ServiceType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @service_type }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @service }\n end\n end", "def index\n @masters = Master.all\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml # index.xml.builder\n format.json { render :json => ServiceCatalographer::Api::Json.index(\"service_providers\", json_api_params, @service_providers).to_json }\n format.bljson { render :json => ServiceCatalographer::Api::Bljson.index(\"service_providers\", @service_providers).to_json }\n end\n end", "def masters\n @masters ||= {}\n \n if @masters.empty?\n master_links.each do |master_link|\n master_class_name = master_link.master_type\n master_class = master_class_name.constantize\n @masters[master_class_name] ||= []\n @masters[master_class_name] << master_class.where(id: master_link.master_id).limit(1)\n end\n end\n\n return @masters\n end", "def show\n render json: @service\n end", "def index\n @q = Servicetype.search(params[:q])\n @servicetypes = @q.result(:distinct => true).page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json do\n @servicetype = Servicetype.where(\"name LIKE ?\", \"%#{params[:term]}%\")\n render :json => @servicetype.map { |servicetype| servicetype.name }\n end\n end \n end", "def index\n @masters = Master.all.paginate(page: params[:page], per_page: 200)\n end", "def create\n @masterservice = Masterservice.new(masterservice_params)\n\n respond_to do |format|\n if @masterservice.save\n format.html { redirect_to @masterservice, notice: 'Masterservice was successfully created.' }\n format.json { render :show, status: :created, location: @masterservice }\n else\n format.html { render :new }\n format.json { render json: @masterservice.errors, status: :unprocessable_entity }\n end\n end\n end", "def service_types\n get_info :service_types\n end", "def index\n @per_page_options = %w{ 21 51 99 }\n respond_to do |format|\n format.html # index.html.erb\n format.xml # index.xml.builder\n format.atom # index.atom.builder\n format.json { render :json => ServiceCatalographer::Api::Json.index(\"services\", json_api_params, @services).to_json }\n format.bljson { render :json => ServiceCatalographer::Api::Bljson.index(\"services\", @services).to_json }\n end\n end", "def show\n @servicetype = Servicetype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @servicetype }\n end\n end", "def show\n @service = Service.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @service }\n end\n end", "def show\n @service = Service.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @service }\n end\n end", "def show\n @service = Service.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @service }\n end\n end", "def new\n @service = Service.new\n @vendors = Vendor.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @service }\n end\n end", "def show\n @servicetype = Servicetype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @servicetype }\n end\n end", "def index\n @service_centers = ServiceCenter.all\n\n\n end", "def show \n @person_type_masters = PersonTypeMaster.all\n end", "def set_service_master\n @service_master = ServiceMaster.find(params[:id])\n end", "def index\n @service_locations = ServiceLocation.all\n render json: @service_locations\n end", "def servers(service_id)\n request :get, \"/services/#{service_id}/servers\"\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml # show.xml.builder\n format.json { render :json => @service_provider.to_json }\n end\n end", "def index\n @services = @page.services.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @services }\n end\n end", "def index\n @service_centers = ServiceCenter.all\n end", "def index\n @town_masters = TownMaster.all\n end", "def index\n @services = SystemSiteMap.where(:system_site_map_id => 2)\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "def show\n @service = Service.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @service }\n end\n end", "def index\n @service_managers = ServiceManager.paginate(page: params[:page])\n end", "def show\n @service = Service.find(params[:id])\n build_service_content\n \n respond_to do |format|\n format.html # show.html.erb\n end\n end", "def find_masters(data, service)\n data.select do |x|\n x['Checks'].find do |y|\n (y['CheckID'].eql?(service) && y['Status'].eql?('passing')) || (y['CheckID'].eql?(service) && y['Output'].include?('MasterNode: Multiple masters found'))\n end\n end\nend", "def index\n @medical_services = MedicalService.all\n end", "def index\n @serviceordemservices = Serviceordemservice.all\n end", "def index\n @source_masters = SourceMaster.all\n end", "def show\n @latest_version = @service.latest_version\n @latest_version_instance = @latest_version.service_versionified\n @latest_deployment = @service.latest_deployment\n\n @all_service_version_instances = @service.service_version_instances\n @all_service_types = @service.service_types\n\n @soaplab_server = @service.soaplab_server\n\n @pending_responsibility_requests = @service.pending_responsibility_requests\n unless is_api_request?\n @service_tests = @service.service_tests\n @test_script_service_tests = @service.service_tests_by_type(\"TestScript\")\n @url_monitor_service_tests = @service.service_tests_by_type(\"UrlMonitor\")\n end\n if @latest_version_instance.is_a?(RestService)\n @grouped_rest_methods = @latest_version_instance.group_all_rest_methods_from_rest_resources\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml # show.xml.builder\n format.json { render :json => @service.to_json }\n end\n end", "def index\n @mtypes = Mtype.order(:code)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mtypes }\n end\n end", "def index\n @services = Service.all\n @services_hash = @services.map do |s|\n {service: s, medium: s.medium.map { |media|\n media.as_json.merge({ media: url_for(media) })\n }, user: s.user.username, categories: s.categories}#, galleries: s.galleries\n \n end\n render json: @services_hash\n end", "def index\n @pagemasters = Pagemaster.all\n end", "def index\n @servicemen = Serviceman.all\n end", "def index\n endpoint(get(services_url).body)\n end", "def show\n @serviceorg = Serviceorg.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @serviceorg }\n end\n end", "def show\n #@service is already loaded and authorized\n\n respond_to do |format|\n format.html # show.html.haml\n format.json { render json: @service }\n end\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @service_features }\n end\n end", "def index\n @payment_site_masters = PaymentSiteMaster.all\n end", "def index\n @services = Service.all\n end", "def index\n @services = Service.all\n end", "def index\n @services = Service.all\n end", "def index\n @services = Service.all\n end", "def index\n @services = Service.all\n end", "def index\n @services = Service.all\n end", "def index\n @services = Service.all\n end", "def index\n @services = Service.all\n end", "def index\n @services = Service.all\n end", "def index\n @title = \"Services - JC Auto Restoration, Inc.\"\n @services = Service.all\n end", "def index\n @service_requests = ServiceRequest.all\n end", "def index\n respond_to do |format|\n format.html do \n @sites = Site.all\n end\n format.json do\n render json: Site.all\n end\n end\n end", "def index\n @service = Service.all()\n end", "def index\n @society_masters = SocietyMaster.all\n end", "def index\n @site_setups = SiteSetup.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @site_setups }\n end\n end", "def show\n respond_to do |format|\n format.json { render json: @service_call }\n end\n end", "def index\n @dor_masters = DorMaster.all\n \n end", "def index\n @customer_services = CustomerService.all\n end", "def index\n @service_providers = ServiceProvider.all\n end", "def index\n @service_locations = ServiceLocation.all\n end", "def index\n if params[:q].present?\n @q = CelloMaster.ransack(params[:q])\n @cello_masters = @q.result.order('created_at')\n else\n @q = CelloMaster.ransack(params[:q])\n @cello_masters = CelloMaster.all.order('created_at').paginate(page: params[:page], per_page: 15)\n end\n end", "def new\n @service_type = ServiceType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @service_type }\n end\n end", "def show\n \trespond_to do | format |\n \tif @service.service_type != 'external'\n\t format.html \n\t else\n\t \tformat.html{ render template: 'admin/services/show_external' }\n\t end\n \tend\n end", "def index\n @grocer_service_types = GrocerServiceType.all\n end", "def create\n @provider_service = ProviderService.new(provider_service_params)\n \n\n respond_to do |format|\n if @provider_service.save\n format.js { flash.now[:notice] = \"Provider Service was successfully created.\" }\n format.html { redirect_to @provider_service, notice: 'Provider service was successfully created.' }\n format.json { render :show, status: :created, location: @provider_service }\n else\n @provider_masters = ProviderMaster.all\n @service_masters = ServiceMaster.all\n format.js { render :new }\n format.html { render :new }\n format.json { render json: @provider_service.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n if params[:site_id].nil? or params[:site_id].empty?\n @comentarios = Comentario.all # path: /types\n else\n @comentarios = Site.find(params[:site_id]).comentarios # path: /sites/id/comentarios\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comentarios }\n end\n end", "def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "def index\n @service_classes = ServiceClass.all\n end", "def index\n @service_lists = ServiceList.all\n end", "def index\n @service_categories = ServiceCategory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @service_categories }\n end\n end", "def index\n @q = ClientType.order(name: :asc).ransack(params[:q])\n @client_types = @q.result.page(params[:page]).per(10)\n end", "def index\n @mercado_meta = MercadoMetum.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mercado_meta }\n end\n end", "def index\n @supplysites = Supplysite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @supplysites }\n end\n end", "def index\n @request_services = RequestService.all\n end", "def index\n @servers = getmydata(\"Server\")\n\tpagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @servers }\n end\n end", "def service_type_name\n \"REST\"\n end", "def build_service\n {'Code' => SERVICE_TYPES[@opts[:service_type]]}\n end", "def servers\n endpoint = 'https://pcs.baidu.com/rest/2.0/pcs/manage?method=listhost'\n @res = @api.request_json( endpoint )\n end", "def index\n @services = Service.all\n\n # If a type of host is passed, check if it's a number and a valid host type.\n check_priority_param\n @services = @services.where(:priority => @priority) if (!@priority.blank?)\n\n # If a search query is received, filter the results\n if (!params[:q].blank?)\n # Do the search\n @query = params[:q]\n @services = @services.where(\"$or\" => [{:name => /#{@query}/i}, {:description => /#{@query}/i}, {:probe => /#{@query}/i}])\n end\n\n # If a page number is received, save it (if not, the page is the first)\n if (!params[:page].blank?)\n page = params[:page].to_i\n page = 1 if (page < 1)\n else\n page = 1\n end\n \n # Paginate!\n @services = @services.page(page)\n\n respond_to do |format|\n format.html\n end\n end", "def show\n @online_service = OnlineService.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @online_service }\n end\n end", "def list_services\n response = @http_client.get(prefix_path('services'))\n Response.new(response)\n end", "def services\n\n end", "def service\r\n channels = Channel.where(service: channel_params[:service])\r\n render json: channels\r\n end", "def index\n #@maker_masters = MakerMaster.all\n\t\n\t@q = MakerMaster.ransack(params[:q]) \n @maker_masters = @q.result(distinct: true)\n @maker_masters = @maker_masters.page(params[:page])\n\n end", "def services\n end", "def get_services\n reply = @client.call(:get_services)\n\n data = reply.body.dig(:get_services_response,\n :get_services_result,\n :array_of_string)\n data = check_if_data_exists(data)\n\n data.map do |attrs|\n {\n id: Integer(attrs[:string][0], 10),\n name: attrs[:string][1]\n }\n end\n end", "def types_of_service(params, options = {})\n path = \"#{base_uri(params)}/patient_documents\"\n path << current_if_specified_in(params)\n path << '/type_of_service_extension'\n request(path, options).to_hash\n end", "def index\n @ac_masters = AcMaster.all\n end" ]
[ "0.70567447", "0.6760248", "0.6460342", "0.6335917", "0.61507744", "0.6123434", "0.60862994", "0.6051508", "0.5936328", "0.59284437", "0.5909053", "0.5819673", "0.5799555", "0.57958573", "0.5771779", "0.57429564", "0.574087", "0.57207215", "0.5720252", "0.5715079", "0.5715079", "0.5715079", "0.56975836", "0.5696214", "0.565589", "0.5654606", "0.5641285", "0.56352526", "0.5619943", "0.56089807", "0.5606536", "0.56026465", "0.5587424", "0.5582206", "0.55733734", "0.55645883", "0.5557686", "0.55550146", "0.55449545", "0.5543117", "0.5541957", "0.5515088", "0.5507703", "0.5504945", "0.54952365", "0.5473543", "0.5466012", "0.54621077", "0.546024", "0.5454589", "0.5453344", "0.5451372", "0.5451372", "0.5451372", "0.5451372", "0.5451372", "0.5451372", "0.5451372", "0.5451372", "0.5451372", "0.5442654", "0.54423404", "0.5435954", "0.543221", "0.54162467", "0.5414283", "0.5412875", "0.5385488", "0.5383352", "0.53792584", "0.53737", "0.53691584", "0.5365677", "0.53605574", "0.5357005", "0.5338985", "0.53360754", "0.53300625", "0.53300625", "0.532209", "0.53127414", "0.53103125", "0.5306824", "0.5304932", "0.5301081", "0.5293233", "0.5291345", "0.5280091", "0.5276926", "0.52750576", "0.5273898", "0.5265676", "0.5262666", "0.5262092", "0.5259178", "0.5257377", "0.5256473", "0.5252678", "0.5249195", "0.52469146" ]
0.7554534
0
GET /service_type_masters/1 GET /service_type_masters/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @service_type_masters = ServiceTypeMaster.all\n end", "def index\n @masterservices = Masterservice.all\n end", "def index\n @service_master = ServiceMaster.new\n @service_masters = ServiceMaster.all\n end", "def set_service_type_master\n @service_type_master = ServiceTypeMaster.find(params[:id])\n end", "def set_masterservice\n @masterservice = Masterservice.find(params[:id])\n end", "def show\n @service_type = ServiceType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @service_type }\n end\n end", "def create\n @service_type_master = ServiceTypeMaster.new(service_type_master_params)\n\n respond_to do |format|\n if @service_type_master.save\n format.html { redirect_to @service_type_master, notice: 'Service type master was successfully created.' }\n format.json { render action: 'show', status: :created, location: @service_type_master }\n else\n format.html { render action: 'new' }\n format.json { render json: @service_type_master.errors, status: :unprocessable_entity }\n end\n end\n end", "def service_type_master_params\n params[:service_type_master]\n end", "def show\n @servicetype = Servicetype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @servicetype }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @service }\n end\n end", "def show\n @servicetype = Servicetype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @servicetype }\n end\n end", "def show\n @service = Service.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @service }\n end\n end", "def show\n @service = Service.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @service }\n end\n end", "def show\n @service = Service.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @service }\n end\n end", "def show\n render json: @service\n end", "def new\n @service = Service.new\n @vendors = Vendor.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @service }\n end\n end", "def index\n @provider_services = ProviderService.all\n # @provider_masters = ProviderMaster.all\n @service_masters = ServiceMaster.all\n end", "def index\n @q = Servicetype.search(params[:q])\n @servicetypes = @q.result(:distinct => true).page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json do\n @servicetype = Servicetype.where(\"name LIKE ?\", \"%#{params[:term]}%\")\n render :json => @servicetype.map { |servicetype| servicetype.name }\n end\n end \n end", "def show\n @service = Service.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @service }\n end\n end", "def set_service_master\n @service_master = ServiceMaster.find(params[:id])\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml # index.xml.builder\n format.json { render :json => ServiceCatalographer::Api::Json.index(\"service_providers\", json_api_params, @service_providers).to_json }\n format.bljson { render :json => ServiceCatalographer::Api::Bljson.index(\"service_providers\", @service_providers).to_json }\n end\n end", "def new\n @service_type = ServiceType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @service_type }\n end\n end", "def create\n @masterservice = Masterservice.new(masterservice_params)\n\n respond_to do |format|\n if @masterservice.save\n format.html { redirect_to @masterservice, notice: 'Masterservice was successfully created.' }\n format.json { render :show, status: :created, location: @masterservice }\n else\n format.html { render :new }\n format.json { render json: @masterservice.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @masters = Master.all\n end", "def show\n @serviceorg = Serviceorg.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @serviceorg }\n end\n end", "def show\n @latest_version = @service.latest_version\n @latest_version_instance = @latest_version.service_versionified\n @latest_deployment = @service.latest_deployment\n\n @all_service_version_instances = @service.service_version_instances\n @all_service_types = @service.service_types\n\n @soaplab_server = @service.soaplab_server\n\n @pending_responsibility_requests = @service.pending_responsibility_requests\n unless is_api_request?\n @service_tests = @service.service_tests\n @test_script_service_tests = @service.service_tests_by_type(\"TestScript\")\n @url_monitor_service_tests = @service.service_tests_by_type(\"UrlMonitor\")\n end\n if @latest_version_instance.is_a?(RestService)\n @grouped_rest_methods = @latest_version_instance.group_all_rest_methods_from_rest_resources\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml # show.xml.builder\n format.json { render :json => @service.to_json }\n end\n end", "def show\n respond_to do |format|\n format.json { render json: @service_call }\n end\n end", "def index\n @service_locations = ServiceLocation.all\n render json: @service_locations\n end", "def index\n @per_page_options = %w{ 21 51 99 }\n respond_to do |format|\n format.html # index.html.erb\n format.xml # index.xml.builder\n format.atom # index.atom.builder\n format.json { render :json => ServiceCatalographer::Api::Json.index(\"services\", json_api_params, @services).to_json }\n format.bljson { render :json => ServiceCatalographer::Api::Bljson.index(\"services\", @services).to_json }\n end\n end", "def show\n @service = Service.find(params[:id])\n build_service_content\n \n respond_to do |format|\n format.html # show.html.erb\n end\n end", "def show \n @person_type_masters = PersonTypeMaster.all\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml # show.xml.builder\n format.json { render :json => @service_provider.to_json }\n end\n end", "def new\n @servicetype = Servicetype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @servicetype }\n end\n end", "def index\n @mtypes = Mtype.order(:code)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mtypes }\n end\n end", "def show\n #@service is already loaded and authorized\n\n respond_to do |format|\n format.html # show.html.haml\n format.json { render json: @service }\n end\n end", "def new\n @servicetype = Servicetype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @servicetype }\n end\n end", "def index\n @services = SystemSiteMap.where(:system_site_map_id => 2)\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "def show\n @online_service = OnlineService.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @online_service }\n end\n end", "def servers(service_id)\n request :get, \"/services/#{service_id}/servers\"\n end", "def index\n @masters = Master.all.paginate(page: params[:page], per_page: 200)\n end", "def service_type_name\n \"REST\"\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @service_features }\n end\n end", "def service_types\n get_info :service_types\n end", "def index\n @medical_services = MedicalService.all\n end", "def index\n @services = @page.services.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @services }\n end\n end", "def index\n @service_centers = ServiceCenter.all\n\n\n end", "def new\n @service = Service.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @service }\n end\n end", "def new\n @service = Service.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @service }\n end\n end", "def new\n @service = Service.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @service }\n end\n end", "def new\n @service = Service.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @service }\n end\n end", "def index\n @services = Service.all\n @services_hash = @services.map do |s|\n {service: s, medium: s.medium.map { |media|\n media.as_json.merge({ media: url_for(media) })\n }, user: s.user.username, categories: s.categories}#, galleries: s.galleries\n \n end\n render json: @services_hash\n end", "def index\n @serviceordemservices = Serviceordemservice.all\n end", "def show\n @client_type = ClientType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client_type }\n end\n end", "def service(id)\n request :get, \"/services/#{id}\"\n end", "def show\n \trespond_to do | format |\n \tif @service.service_type != 'external'\n\t format.html \n\t else\n\t \tformat.html{ render template: 'admin/services/show_external' }\n\t end\n \tend\n end", "def masters\n @masters ||= {}\n \n if @masters.empty?\n master_links.each do |master_link|\n master_class_name = master_link.master_type\n master_class = master_class_name.constantize\n @masters[master_class_name] ||= []\n @masters[master_class_name] << master_class.where(id: master_link.master_id).limit(1)\n end\n end\n\n return @masters\n end", "def show\n @service_station = ServiceStation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @service_station }\n end\n end", "def index\n @title = \"Services - JC Auto Restoration, Inc.\"\n @services = Service.all\n end", "def show\n @site_type = SiteType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site_type }\n end\n end", "def index\n @service_requests = ServiceRequest.all\n end", "def show\n @service = current_user.pro.services.find(params[:id])#Service.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @service }\n end\n end", "def index\n @servicemen = Serviceman.all\n end", "def destroy\n @service_type_master.destroy\n respond_to do |format|\n format.html { redirect_to service_type_masters_url }\n format.json { head :no_content }\n end\n end", "def new\n @service.service_type = params[:service_type]\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @service }\n end\n end", "def index\n @service_managers = ServiceManager.paginate(page: params[:page])\n end", "def index\n @service = Service.all()\n end", "def index\n @site_setups = SiteSetup.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @site_setups }\n end\n end", "def show\n @service = Service.find(params[:id])\n end", "def index\n @service_centers = ServiceCenter.all\n end", "def index\n @servers = getmydata(\"Server\")\n\tpagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @servers }\n end\n end", "def service\r\n channels = Channel.where(service: channel_params[:service])\r\n render json: channels\r\n end", "def show\n @mtype = Mtype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mtype }\n end\n end", "def index\n @town_masters = TownMaster.all\n end", "def service; services.first; end", "def show\n @additional_service = AdditionalService.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @additional_service }\n end\n end", "def show\n @service = Service.find(params[:id])\n end", "def find_masters(data, service)\n data.select do |x|\n x['Checks'].find do |y|\n (y['CheckID'].eql?(service) && y['Status'].eql?('passing')) || (y['CheckID'].eql?(service) && y['Output'].include?('MasterNode: Multiple masters found'))\n end\n end\nend", "def index\n endpoint(get(services_url).body)\n end", "def show\n render json: @service_location\n end", "def set_service\n @service = Service.friendly.find(params[:id])\n end", "def index\n @services = Service.all\n end", "def index\n @services = Service.all\n end", "def index\n @services = Service.all\n end", "def index\n @services = Service.all\n end", "def index\n @services = Service.all\n end", "def index\n @services = Service.all\n end", "def index\n @services = Service.all\n end", "def index\n @services = Service.all\n end", "def index\n @services = Service.all\n end", "def index\n @mercado_meta = MercadoMetum.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mercado_meta }\n end\n end", "def create\n @provider_service = ProviderService.new(provider_service_params)\n \n\n respond_to do |format|\n if @provider_service.save\n format.js { flash.now[:notice] = \"Provider Service was successfully created.\" }\n format.html { redirect_to @provider_service, notice: 'Provider service was successfully created.' }\n format.json { render :show, status: :created, location: @provider_service }\n else\n @provider_masters = ProviderMaster.all\n @service_masters = ServiceMaster.all\n format.js { render :new }\n format.html { render :new }\n format.json { render json: @provider_service.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @service_order }\n end\n end", "def index\n #pseudo scope \n if params[:phone] \n @agencies = Agency.find_by_phone(params[:phone]);\n if @agencies \n respond_to do |format|\n format.json { render :json => @agencies }\n format.xml { render :xml => @agencies }\n end \n else\n head :not_found\n end\n else\n # Aqui estoy haciendo que el api responda en mas de 1 formato\n @agencies = Agency.all\n respond_to do |format|\n format.json { render :json => @agencies }\n format.xml { render :xml => @agencies }\n end\n\n end \n end", "def show\n @mall_type = MallType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mall_type }\n end\n end", "def index\n @service_particulars = ServiceParticular.all\n @service_particular = ServiceParticular.new\n end", "def show_service(client, args, options)\n response = client.get(\"#{RESOURCE_PATH}/#{args[0]}\")\n\n if CloudClient::is_error?(response)\n [response.code.to_i, response.to_s]\n else\n #[0,response.body]\n if options[:json]\n [0,response.body]\n else\n str=\"%-20s: %-20s\"\n str_h1=\"%-80s\"\n\n document_hash = JSON.parse(response.body)\n template = document_hash['DOCUMENT']['TEMPLATE']['BODY']\n\n CLIHelper.print_header(str_h1 % \"SERVICE #{document_hash['DOCUMENT']['ID']} INFORMATION\")\n\n puts str % [\"ID\", document_hash['DOCUMENT']['ID']]\n puts str % [\"NAME\", document_hash['DOCUMENT']['NAME']]\n puts str % [\"USER\", document_hash['DOCUMENT']['UNAME']]\n puts str % [\"GROUP\",document_hash['DOCUMENT']['GNAME']]\n\n puts str % [\"STRATEGY\", template['deployment']]\n puts str % [\"SERVICE STATE\", Service.state_str(template['state'])]\n puts str % [\"SHUTDOWN\", template['shutdown_action']] if template['shutdown_action']\n\n puts\n\n CLIHelper.print_header(str_h1 % \"PERMISSIONS\",false)\n\n [\"OWNER\", \"GROUP\", \"OTHER\"].each { |e|\n mask = \"---\"\n mask[0] = \"u\" if document_hash['DOCUMENT']['PERMISSIONS'][\"#{e}_U\"] == \"1\"\n mask[1] = \"m\" if document_hash['DOCUMENT']['PERMISSIONS'][\"#{e}_M\"] == \"1\"\n mask[2] = \"a\" if document_hash['DOCUMENT']['PERMISSIONS'][\"#{e}_A\"] == \"1\"\n\n puts str % [e, mask]\n }\n\n puts\n\n template['roles'].each {|role|\n CLIHelper.print_header(\"ROLE #{role['name']}\", false)\n\n puts str % [\"ROLE STATE\", Role.state_str(role['state'])]\n puts str % [\"PARENTS\", role['parents'].join(', ')] if role['parents']\n puts str % [\"VM TEMPLATE\", role['vm_template']]\n puts str % [\"CARDINALITY\", role['cardinality']]\n puts str % [\"MIN VMS\", role['min_vms']] if role['min_vms']\n puts str % [\"MAX VMS\", role['max_vms']] if role['max_vms']\n puts str % [\"COOLDOWN\", \"#{role['cooldown']}s\"] if role['cooldown']\n puts str % [\"SHUTDOWN\", role['shutdown_action']] if role['shutdown_action']\n\n puts \"NODES INFORMATION\"\n NODE_TABLE.show(role['nodes'])\n\n if !role['elasticity_policies'].nil? && role['elasticity_policies'].size > 0 || !role['scheduled_policies'].nil? && role['scheduled_policies'].size > 0\n puts\n puts \"ELASTICITY RULES\"\n\n if role['elasticity_policies'] && role['elasticity_policies'].size > 0\n puts\n# puts \"ELASTICITY POLICIES\"\n CLIHelper::ShowTable.new(nil, self) do\n column :ADJUST, \"\", :left, :size=>12 do |d|\n adjust_str(d)\n end\n\n column :EXPRESSION, \"\", :left, :size=>48 do |d|\n if !d['expression_evaluated'].nil?\n d['expression_evaluated']\n else\n d['expression']\n end\n end\n\n column :'EVALS', \"\", :right, :size=>5 do |d|\n if d['period_number']\n \"#{d['true_evals'].to_i}/#{d['period_number']}\"\n else\n \"-\"\n end\n end\n\n column :PERIOD, \"\", :size=>6 do |d|\n d['period'] ? \"#{d['period']}s\" : '-'\n end\n\n column :COOL, \"\", :size=>5 do |d|\n d['cooldown'] ? \"#{d['cooldown']}s\" : '-'\n end\n\n default :ADJUST, :EXPRESSION, :EVALS, :PERIOD, :COOL\n end.show([role['elasticity_policies']].flatten, {})\n end\n\n if role['scheduled_policies'] && role['scheduled_policies'].size > 0\n puts\n# puts \"SCHEDULED POLICIES\"\n CLIHelper::ShowTable.new(nil, self) do\n column :ADJUST, \"\", :left, :size=>12 do |d|\n adjust_str(d)\n end\n\n column :TIME, \"\", :left, :size=>67 do |d|\n if d['start_time']\n Time.parse(d['start_time']).to_s\n else\n d['recurrence']\n end\n end\n\n default :ADJUST, :TIME\n end.show([role['scheduled_policies']].flatten, {})\n end\n end\n\n puts\n }\n\n puts\n\n CLIHelper.print_header(str_h1 % \"LOG MESSAGES\",false)\n\n if template['log']\n template['log'].each { |log|\n t = Time.at(log['timestamp']).strftime(\"%m/%d/%y %H:%M\")\n puts \"#{t} [#{log['severity']}] #{log['message']}\"\n }\n end\n\n 0\n end\n end\nend", "def index\n @source_masters = SourceMaster.all\n end", "def build_service\n {'Code' => SERVICE_TYPES[@opts[:service_type]]}\n end", "def index\n @service_records = ServiceRecord.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @service_records }\n end\n end", "def index\n respond_to do |format|\n format.html do \n @sites = Site.all\n end\n format.json do\n render json: Site.all\n end\n end\n end", "def show\n @service_record = ServiceRecord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @service_record }\n end\n end" ]
[ "0.7358875", "0.68093765", "0.6720257", "0.6555219", "0.64321727", "0.6416768", "0.6249937", "0.61592865", "0.6101577", "0.6078989", "0.60689104", "0.5992337", "0.5992337", "0.5992337", "0.5977857", "0.59225065", "0.591515", "0.5838141", "0.58365005", "0.5830538", "0.58074343", "0.5798977", "0.57375544", "0.5732367", "0.5673814", "0.5670325", "0.5665515", "0.5646955", "0.5641943", "0.5633094", "0.56147844", "0.5607165", "0.556508", "0.5560484", "0.5556295", "0.5556043", "0.5553725", "0.5552657", "0.5547767", "0.5542021", "0.55231357", "0.55184036", "0.5516234", "0.5509512", "0.55015254", "0.5497124", "0.5484219", "0.5484219", "0.5484219", "0.5484219", "0.5483305", "0.5470813", "0.5467299", "0.5448189", "0.54291403", "0.5420129", "0.54170555", "0.54123795", "0.54081315", "0.54066837", "0.54031867", "0.53920346", "0.53894484", "0.5389442", "0.5386326", "0.53829855", "0.53785473", "0.53770226", "0.5373973", "0.5373043", "0.53686416", "0.53654057", "0.5365062", "0.5364766", "0.53624976", "0.5359741", "0.5357952", "0.53541726", "0.53540564", "0.5353112", "0.53484696", "0.53484696", "0.53484696", "0.53484696", "0.53484696", "0.53484696", "0.53484696", "0.53484696", "0.53484696", "0.5344263", "0.5343533", "0.5333356", "0.53304714", "0.5325344", "0.5322487", "0.5312272", "0.5305308", "0.530526", "0.5304945", "0.53048503", "0.52973706" ]
0.0
-1
POST /service_type_masters POST /service_type_masters.json
def create @service_type_master = ServiceTypeMaster.new(service_type_master_params) respond_to do |format| if @service_type_master.save format.html { redirect_to @service_type_master, notice: 'Service type master was successfully created.' } format.json { render action: 'show', status: :created, location: @service_type_master } else format.html { render action: 'new' } format.json { render json: @service_type_master.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @masterservice = Masterservice.new(masterservice_params)\n\n respond_to do |format|\n if @masterservice.save\n format.html { redirect_to @masterservice, notice: 'Masterservice was successfully created.' }\n format.json { render :show, status: :created, location: @masterservice }\n else\n format.html { render :new }\n format.json { render json: @masterservice.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @service_type_masters = ServiceTypeMaster.all\n end", "def set_service_type_master\n @service_type_master = ServiceTypeMaster.find(params[:id])\n end", "def set_masterservice\n @masterservice = Masterservice.find(params[:id])\n end", "def service_type_master_params\n params[:service_type_master]\n end", "def create\n @provider_service = ProviderService.new(provider_service_params)\n \n\n respond_to do |format|\n if @provider_service.save\n format.js { flash.now[:notice] = \"Provider Service was successfully created.\" }\n format.html { redirect_to @provider_service, notice: 'Provider service was successfully created.' }\n format.json { render :show, status: :created, location: @provider_service }\n else\n @provider_masters = ProviderMaster.all\n @service_masters = ServiceMaster.all\n format.js { render :new }\n format.html { render :new }\n format.json { render json: @provider_service.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @service_master = ServiceMaster.new\n @service_masters = ServiceMaster.all\n end", "def create\n @service_type = ServiceType.new(params[:service_type])\n\n respond_to do |format|\n if @service_type.save\n format.html { redirect_to @service_type, notice: 'Service type was successfully created.' }\n format.json { render json: @service_type, status: :created, location: @service_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @service_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def service_master_params\n params.require(:service_master).permit(:code, :name, :description, :status)\n end", "def create\n @service = Service.new(service_params)\n drivers_for_select\n clients_for_select\n vehicles_for_select\n\n respond_to do |format|\n \n if @service.save\n format.html { redirect_to @service, notice: 'Service was successfully created.' }\n format.json { render :show, status: :created, location: @service }\n else\n @service.build_address\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def masterservice_params\n params.require(:masterservice).permit(:name, :description)\n end", "def create\n @service = Service.new(service_params)\n\n respond_to do |format|\n if @service.save\n #create line_up\n @lineup = Lineup.create(service: @service, mc: \"MC\")\n format.html { redirect_to services_url, notice: \"Service was successfully created. #{@lineup.id}\" }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @admin_service = Admin::Service.new(admin_service_regex_params)\n\n respond_to do |format|\n if @admin_service.save\n format.html { redirect_to @admin_service, notice: 'Platform was successfully created.' }\n format.json { render :show, status: :created, location: @admin_service }\n else\n format.html { render :new }\n format.json { render json: @admin_service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @service_master = ServiceMaster.new(service_master_params)\n @service_masters = ServiceMaster.all\n respond_to do |format|\n if @service_master.save\n @service_master = ServiceMaster.new\n format.js { @flag = true }\n else\n flash.now[:alert] = 'About Already Exist.'\n format.js { @flag = false }\n end\n end\n end", "def index\n @masterservices = Masterservice.all\n end", "def create\n @service = Service.new(service_params)\n if @service.save\n render json: @service, status: :created, location: @service\n else\n render json: @service.errors, status: :unprocessable_entity\n end\n end", "def create\n @customermaster = Customermaster.new(customermaster_params)\n\n respond_to do |format|\n if @customermaster.save\n format.html { redirect_to customermasters_url, notice: 'Customermaster was successfully created.' }\n format.json { render :show, status: :created, location: @customermaster }\n else\n format.json { render json: @customermaster.errors, status: :unprocessable_entity }\n format.html { redirect_to customermasters_url, notice: 'Customermaster Not successfully created.' }\n\n end\n end\n end", "def create\n @maker_master = MakerMaster.new(maker_master_params)\n\n respond_to do |format|\n if @maker_master.save\n format.html { redirect_to @maker_master, notice: 'Maker master was successfully created.' }\n format.json { render :show, status: :created, location: @maker_master }\n else\n format.html { render :new }\n format.json { render json: @maker_master.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @servicetype = Servicetype.new(params[:servicetype])\n\n respond_to do |format|\n if @servicetype.save\n format.html { redirect_to @servicetype, :notice => 'Servicetype was successfully created.' }\n format.json { render :json => @servicetype, :status => :created, :location => @servicetype }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @servicetype.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @service = Service.new(params[:service])\n \n package_content\n \n respond_to do |format|\n if @service.save# && @system_site_map.save\n system_site_map = SystemSiteMap.new( :system_site_map_id => 2, :title => @service.title, :controller => \"services\", :parameter => @service.id )\n system_site_map.save\n @service.update_attributes(:system_site_map => system_site_map)\n format.html { redirect_to({:action=>:show, :id=>@service.id}, notice: t(\"helpers.notice.new\")) }\n else\n format.html { render action: \"new\" }\n end\n end\n end", "def create\n @customer = Customer.find(params[:customer_id])\n @service = @customer.service.new(service_params)\n\n respond_to do |format|\n if @service.save\n \n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def create\n @payment_site_master = PaymentSiteMaster.new(payment_site_master_params)\n\n respond_to do |format|\n if @payment_site_master.save\n format.html { redirect_to @payment_site_master, notice: 'Payment site master was successfully created.' }\n format.json { render 'show', status: :created, location: @payment_site_master }\n else\n format.html { render 'new' }\n format.json { render json: @payment_site_master.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n submenu_item 'services-new'\n @service = Service.new(params[:service])\n @service_type = @service.type\n service_param\n\n @service.tenant_id = current_user.tenant_id\n\n # service_params = Service.extract_params(params[:service])\n # service_params = Service.extract_thresholds(service_params)\n # @service = Service.new(service_params)\n\n respond_to do |format|\n if @service.save\n flash[:notice] = \"#{@service.name}创建成功\"\n format.html { redirect_to(@service) }\n else\n dictionary\n format.html { render :action => \"new\" }\n end\n end\n end", "def create\n @master = Master.new(master_params)\n\n respond_to do |format|\n if @master.save\n format.html { redirect_to @master, notice: 'Master was successfully created.' }\n format.json { render :show, status: :created, location: @master }\n else\n format.html { render :new }\n format.json { render json: @master.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pagemaster = Pagemaster.new(pagemaster_params)\n\n respond_to do |format|\n if @pagemaster.save\n format.html { redirect_to @pagemaster, notice: 'Pagemaster was successfully created.' }\n format.json { render :show, status: :created, location: @pagemaster }\n else\n format.html { render :new }\n format.json { render json: @pagemaster.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_service(service={})\n request :post, '/services', service\n end", "def create\n @servicetype = Servicetype.new(params[:servicetype])\n\n respond_to do |format|\n if @servicetype.save\n format.html { redirect_to @servicetype, notice: 'Servicetype was successfully created.' }\n format.json { render json: @servicetype, status: :created, location: @servicetype }\n else\n format.html { render action: \"new\" }\n format.json { render json: @servicetype.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @regions = RegionMaster.all\n @districts = DistrictMaster.all\n\n @town_master = TownMaster.new(town_master_params)\n prefix = @town_master.name\n @town_master.town_id = TownMaster.gen_assigned_code(prefix)\n town_idd = @town_master.town_id\n\n respond_to do |format|\n if @town_master.save\n format.html { redirect_to @town_master, notice: \"Town master was successfully created.\" }\n format.json { render :show, status: :created, location: @town_master }\n else\n logger.info \"Here ===== #{@town_master.errors.messages.inspect}\"\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @town_master.errors, status: :unprocessable_entity }\n end\n end\n end", "def build_service\n {'Code' => SERVICE_TYPES[@opts[:service_type]]}\n end", "def create\n params_map = ActiveSupport::HashWithIndifferentAccess.new(params[:services])\n @service = Service.new(params_map)\n @tenant = Tenant.find(session[:user_id])\n @property = Property.find(@tenant.property_id)\n @manager = Manager.find(@property.manager_id)\n @service.manager_id = @manager.id\n @service.property_id = @property.id\n @service.tenant_id = @tenant.id\n #sets resolved to false, only tenants have the ability to set these to completed\n @service.resolved = false\n if @service.save\n ServiceMailer.reminder(@service).deliver_now\n redirect_to '/tenants/show'\n else\n render \"new\"\n end\n end", "def create\r\n @service = Service.new(service_params)\r\n respond_to do |format|\r\n if @service.save #/enter/companies/:company_id/services/:id/add_stack\r\n format.html { redirect_to \"/enter/companies/#{@service.company_id}/services/#{@service.id}/add_stack\", notice: 'Service was successfully created.' }\r\n format.json { render :add_stack, status: :created, location: @service }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @service.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @mpg_control = MpgControl.new(mpg_control_params)\n\n respond_to do |format|\n if @mpg_control.save\n format.html { redirect_to @mpg_control, notice: 'Mpg control was successfully created.' }\n format.json { render :show, status: :created, location: @mpg_control }\n else\n @services_of_dependence = current_user.dependence.service_of_dependences\n agents_of_service = AgentOfService.where(service_of_dependence: @services_of_dependence)\n @agents = Agent.where(id: agents_of_service.pluck(:agent_id))\n format.html { render :new }\n format.json { render json: @mpg_control.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @service = Service.new(params[:service])\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to @service, notice: 'Service was successfully created.' }\n format.json { render json: @service, status: :created, location: @service }\n else\n format.html { render action: \"new\" }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @service = Service.new(params[:service])\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to @service, notice: 'Service was successfully created.' }\n format.json { render json: @service, status: :created, location: @service }\n else\n format.html { render action: \"new\" }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_master\n @rider = Rider.new(rider_params)\n @rider.rider_type = 'master'\n\n respond_to do |format|\n if @rider.save\n format.html { redirect_to master_rider_path(@rider), notice: 'Rider was successfully created.' }\n format.json { render :show_master, status: :created, location: @rider }\n else\n format.html { render :new_master }\n format.json { render json: @rider.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @service = Service.new(service_params)\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to services_url, notice: 'Service was successfully created.' }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @serviceordemservice = Serviceordemservice.new(serviceordemservice_params)\n\n respond_to do |format|\n if @serviceordemservice.save\n format.html { redirect_to @serviceordemservice, notice: 'Serviceordemservice was successfully created.' }\n format.json { render :show, status: :created, location: @serviceordemservice }\n else\n format.html { render :new }\n format.json { render json: @serviceordemservice.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_service_master\n @service_master = ServiceMaster.find(params[:id])\n end", "def create\n @service = Service.new(service_params)\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to @service, notice: 'Service was successfully created.' }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @service = Service.new(service_params)\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to @service, notice: 'Service was successfully created.' }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @service = Service.new(service_params)\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to @service, notice: 'Service was successfully created.' }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @service = Service.new(service_params)\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to @service, notice: 'Service was successfully created.' }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @service = Service.new(service_params)\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to @service, notice: 'Service was successfully created.' }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @service = Service.new(service_params)\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to @service, notice: 'Service was successfully created.' }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @supplier = Supplier.find(params[:supplier_id])\n @service = @supplier.services.create(service_params)\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to supplier_path(@supplier), notice: 'Service was successfully created.' }\n format.json { render action: 'show', status: :created, location: @service }\n else\n format.html { render action: 'new' }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @service_particular = ServiceParticular.new(service_particular_params)\n\n respond_to do |format|\n if @service_particular.save\n format.html { redirect_to service_particulars_url, notice: 'Service particular was successfully created.' }\n format.json { render :show, status: :created, location: @service_particular }\n else\n format.html { render :new }\n format.json { render json: @service_particular.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @vendor = Vendor.new(params[:vendor])\n\t\t@vendor.user_id = current_user.id\n respond_to do |format|\n if @vendor.save\n\t\t\t\tif params[:service]\n\t\t\t\t\tparams[:service].keys.each do |f| \n\t\t\t\t\t\t@vendor.services.create(:name=>f,:is_active=>true)\n\t\t\t\t\tend\n\t\t\t\tend\n format.html { redirect_to @vendor, notice: 'Vendor was successfully created.' }\n format.json { render json: @vendor, status: :created, location: @vendor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vendor.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @society_master = SocietyMaster.new(society_master_params)\n\n respond_to do |format|\n if @society_master.save\n format.html { redirect_to @society_master, notice: 'Society master was successfully created.' }\n format.json { render :show, status: :created, location: @society_master }\n else\n format.html { render :new }\n format.json { render json: @society_master.errors, status: :unprocessable_entity }\n end\n end\n end", "def requested\n requested_params = {\n external_code: params[:id],\n company_id: params[:company][:id],\n company_name: params[:company][:name],\n recruiter_id: params[:recruiter][:id],\n recruiter_name: params[:recruiter][:name],\n applicant_id: params[:applicant][:id],\n applicant_name: params[:applicant][:name],\n job_id: params[:job][:id],\n job_title: params[:job][:title],\n status: params[:status]\n }\n\n @service = Service.new(requested_params)\n\n if @service.save\n render json: { status: :created }, status: :created\n else\n render json: @service.errors, status: :unprocessable_entity\n end\n end", "def create\n @source_master = SourceMaster.new(source_master_params)\n\n respond_to do |format|\n if @source_master.save\n format.html { redirect_to @source_master, notice: \"Source master was successfully created.\" }\n format.json { render :show, status: :created, location: @source_master }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @source_master.errors, status: :unprocessable_entity }\n end\n end\n end", "def addservice\n\n @service = ServiceProvider.find_by(username: params[:serviceprovider][:username]);\n permitted = params[:serviceprovider].permit( :description, :category_id);\n @service.services.create(permitted);\n\n render json: @service\n\n\nend", "def destroy\n @service_type_master.destroy\n respond_to do |format|\n format.html { redirect_to service_type_masters_url }\n format.json { head :no_content }\n end\n end", "def create\n gen_code = \n @countries = CountryMaster.all\n\n @region_master = RegionMaster.new(region_master_params)\n c_code = @region_master.country_code\n prefix = @region_master.name\n @region_master.region_code = RegionMaster.get_special_code(prefix)\n @region_master.region_id = RegionMaster.gen_assigned_code(c_code,prefix)\n\n respond_to do |format|\n if @region_master.save\n format.html { redirect_to @region_master, notice: \"Region master was successfully created.\" }\n format.json { render :show, status: :created, location: @region_master }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @region_master.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @property_service_type = PropertyServiceType.new(property_service_type_params)\n\n respond_to do |format|\n if @property_service_type.save\n format.html { redirect_to @property_service_type, notice: 'Property service type was successfully created.' }\n format.json { render :show, status: :created, location: @property_service_type }\n else\n format.html { render :new }\n format.json { render json: @property_service_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @service = Service.create(service_params)\n end", "def new\n @service_type = ServiceType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @service_type }\n end\n end", "def create\n\n @service = Service.new(service_params)\n \n params[:service][:shipments_attributes].each do |k,ship|\n ship.each do |k,device|\n if k.to_s[/device_ids.*/]\n device.each{|d| d.blank? ? d:Device.find(d).update(:assigned=>true)}\n end\n end\n end\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to @service, notice: 'Service was successfully created.' }\n format.json { render action: 'show', status: :created, location: @service }\n else\n format.html { render action: 'new' }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @service = Service.new(service_params)\r\n @service.user_id = current_user.id\r\n @service.create_nanny(nanny_params)\r\n\r\n respond_to do |format|\r\n if @service.save\r\n format.html { redirect_to @service, notice: 'Service was successfully created.' }\r\n format.json { render :show, status: :created, location: @service }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @service.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @service_master.update(service_master_params)\n @service_master = ServiceMaster.new\n @service_masters = ServiceMaster.all\n end", "def create\n @customer_service = CustomerService.new(customer_service_params)\n\n respond_to do |format|\n if @customer_service.save\n format.html { redirect_to @customer_service, notice: 'Customer service was successfully created.' }\n format.json { render :show, status: :created, location: @customer_service }\n else\n format.html { render :new }\n format.json { render json: @customer_service.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @service = Service.new\n @vendors = Vendor.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @service }\n end\n end", "def create\n @serviceorg = Serviceorg.new(params[:serviceorg])\n\n respond_to do |format|\n if @serviceorg.save\n format.html { redirect_to @serviceorg, notice: 'Serviceorg was successfully created.' }\n format.json { render json: @serviceorg, status: :created, location: @serviceorg }\n else\n format.html { render action: \"new\" }\n format.json { render json: @serviceorg.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @service = Service.new(service_params)\n @service.published = false\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to [:admin,@service], notice: 'Feito! Empresa criada' }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @community_service = CommunityService.new(community_service_params)\n\n create_one_user_events\n\n respond_to do |format|\n if @community_service.save\n format.html { redirect_to @community_service, notice: 'Community service was successfully created.' }\n format.json { render :show, status: :created, location: @community_service }\n else\n format.html { render :new }\n format.json { render json: @community_service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @terms_of_service = TermsOfService.new(terms_of_service_params)\n\n respond_to do |format|\n if @terms_of_service.save\n format.html { redirect_to @terms_of_service, notice: 'Terms of service was successfully created.' }\n format.json { render :show, status: :created, location: @terms_of_service }\n else\n format.html { render :new }\n format.json { render json: @terms_of_service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @service = Service.new(params[:service])\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to(admin_service_path(@service), :notice => 'Service was successfully created.') }\n format.xml { render :xml => @service, :status => :created, :location => @service }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @service.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @service = Service.new(service_params)\n @service.user_id = current_user.username\n @service.nombre = @service.nombre.upcase\n @service.tipo = @service.tipo.upcase\n @service.descripcion = @service.descripcion.upcase\n @service.ubicacion = @service.ubicacion.upcase\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to services_url, notice: 'Service was successfully created.' }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @scout_master = ScoutMaster.new(params[:scout_master])\n\n respond_to do |format|\n if @scout_master.save\n format.html { redirect_to(@scout_master, :notice => 'Scout master was successfully created.') }\n format.xml { render :xml => @scout_master, :status => :created, :location => @scout_master }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @scout_master.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @service = @place.services.new(service_params)\n\n if @service.save\n redirect_to [@client, @place], notice: 'Service was successfully created.'\n else\n render :new\n end\n end", "def create\n @service_location = ServiceLocation.new(service_location_params)\n if @service_location.save\n render json: @service_location, status: :created, location: @service_location\n else\n render json: @service_location.errors, status: :unprocessable_entity\n end \n end", "def create\n @dor_master = DorMaster.new(dor_master_params)\n\n respond_to do |format|\n if @dor_master.save\n format.html { redirect_to @dor_master, notice: 'Dor master was successfully created.' }\n format.json { render :show, status: :created, location: @dor_master }\n else\n format.html { render :new }\n format.json { render json: @dor_master.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n section_type_ids = params[:site_type].delete(\"section_type_ids\")\n @site_type = SiteType.new(params[:site_type])\n @site_type.section_type_ids = section_type_ids\n\n respond_to do |format|\n if @site_type.save\n format.html { redirect_to @site_type, notice: 'Site type was successfully created.' }\n format.json { render json: @site_type, status: :created, location: @site_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @site_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @service = Service.new(params[:service])\n # passing teams to create in case service name left blank, required for 'new' action to reload from here\n @teams = current_user.teams.where('role = ?', 'admin')\n @buttonvalue = \"create service\"\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to :services, notice: 'Your service has been successfully created.' }\n format.json { render json: @service, status: :created, location: @service }\n else\n format.html { render action: \"new\" }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @service = @enterprise.services.new(service_params)\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to edit_service_path(@service), notice: 'El servicio ha sido creado satisfactoriamente.' }\n format.json { render :edit, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @service = current_user.services.build(service_params)\n respond_to do |format|\n if @service.save\n format.html { redirect_to dashboard_path, notice: 'Service was successfully created.' }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @providerservice = Providerservice.new(providerservice_params)\n\n respond_to do |format|\n if @providerservice.save\n format.html { redirect_to @providerservice, notice: 'Providerservice was successfully created.' }\n format.json { render :show, status: :created, location: @providerservice }\n else\n format.html { render :new }\n format.json { render json: @providerservice.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sms_based = SmsBased.new(sms_based_params)\n\n respond_to do |format|\n if @sms_based.save\n format.html { redirect_to admin_services_path, notice: 'successfully created.' }\n format.json { render action: 'show', status: :created, location: @sms_based }\n else\n format.html { redirect_to admin_services_path, notice: 'Failed.' }\n format.json { render json: @sms_based.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @phones_type = PhonesType.new(phones_type_params)\n\n respond_to do |format|\n if @phones_type.save\n format.html { redirect_to @phones_type, notice: 'Phones type was successfully created.' }\n format.json { render :show, status: :created, location: @phones_type }\n else\n format.html { render :new }\n format.json { render json: @phones_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @medical_service = MedicalService.new(medical_service_params)\n\n respond_to do |format|\n if @medical_service.save\n format.html { redirect_to @medical_service, notice: 'Medical service was successfully created.' }\n format.json { render :show, status: :created, location: @medical_service }\n else\n format.html { render :new }\n format.json { render json: @medical_service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @service_mechanic = ServiceMechanic.new(service_mechanic_params)\n\n respond_to do |format|\n if @service_mechanic.save\n format.html { redirect_to service_mechanics_url, notice: 'Service mechanic was successfully created.' }\n format.json { render :index, status: :created, location: @service_mechanic }\n else\n format.html { render :new }\n format.json { render json: @service_mechanic.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @service_status = ServiceStatus.new(service_status_params)\n\n respond_to do |format|\n if @service_status.save\n format.html { redirect_to @service_status, notice: 'Service status was successfully created.' }\n format.json { render :show, status: :created, location: @service_status }\n else\n format.html { render :new }\n format.json { render json: @service_status.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @childmaster = Childmaster.new(params[:childmaster])\n\n respond_to do |format|\n if @childmaster.save\n format.html { redirect_to @childmaster, notice: 'Childmaster was successfully created.' }\n format.json { render json: @childmaster, status: :created, location: @childmaster }\n else\n format.html { render action: \"new\" }\n format.json { render json: @childmaster.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @landmaster = Landmaster.new(landmaster_params)\n \n respond_to do |format|\n if @landmaster.save\n format.html { redirect_to landmasters_path, notice: 'Landmaster was successfully created.' }\n format.json { render :show, status: :created, location: @landmaster }\n else\n format.html { render :new }\n format.json { render json: @landmaster.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tourist_site_app_service = TouristSiteAppService.new(tourist_site_app_service_params)\n\n respond_to do |format|\n if @tourist_site_app_service.save\n format.html { redirect_to @tourist_site_app_service, notice: 'Tourist site app service was successfully created.' }\n format.json { render :show, status: :created, location: @tourist_site_app_service }\n else\n format.html { render :new }\n format.json { render json: @tourist_site_app_service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(params[:customer])\n @customer_types =\n CustomerType.new(\n :customer_type => params[:customer_type],\n :customer_type_name => params[:customer_type_name],\n :zip_number => params[:zip_number],\n :prefecture_cd => params[:prefecture_cd],\n :city => params[:city],\n :oaza => params[:oaza],\n :town => params[:town],\n :building_name => params[:building_name],\n :customer_type_memo => params[:customer_type_memo])\n\n @customer.customer_types << @customer_types\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: '以下の情報が登録されました。' }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cello_master = CelloMaster.new(cello_master_params)\n respond_to do |format|\n if @cello_master.save\n format.html { redirect_to @cello_master, notice: 'Cello master was successfully created.' }\n format.json { render :show, status: :created, location: @cello_master }\n else\n format.html { render :new }\n format.json { render json: @cello_master.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_service_request\n # Geocode the address\n lat, long = Geocoder.coordinates(\"#{self.restaurant_address} , Chicago, IL\") \n\n HTTParty.post('http://311api.cityofchicago.org/open311/v2/requests.json', :body => { \n :api_key => SETTINGS[\"OPEN_311_KEY\"],\n :service_code => '4fd6e4ece750840569000019',\n :attribute => {\n :PLEASESE => 'FOODPOIS',\n :WHATISTH => self.restaurant_name,\n :ONWHATDA => self.date\n },\n :address_string => self.restaurant_address,\n :description => self.description,\n :lat => lat, \n :long => long, \n :first_name => self.first_name,\n :last_name => self.last_name,\n :email => self.email,\n :phone => self.phone\n })\n end", "def create\n\n @service = Service.new(params[:service])\n respond_to do |format|\n if @service.save\n\n format.html { }\n format.xml { render :xml => @service }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @service }\n end\n end\n end", "def create\n @service_provider = ServiceProvider.new(service_provider_params)\n\n respond_to do |format|\n if @service_provider.save\n format.html { redirect_to @service_provider, notice: \"Service provider was successfully created.\" }\n format.json { render :show, status: :created, location: @service_provider }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @service_provider.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @mtype = Mtype.new(params[:mtype])\n\n respond_to do |format|\n if @mtype.save\n format.html { redirect_to @mtype, notice: 'Mtype was successfully created.' }\n format.json { render json: @mtype, status: :created, location: @mtype }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mtype.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @service_center = ServiceCenter.new(admin_service_center_params)\n\n respond_to do |format|\n if @service_center.save\n format.html { redirect_to admin_service_center_path(@service_center), notice: 'Service center was successfully created.' }\n format.json { render :show, status: :created, location: @service_center }\n else\n format.html { render :new }\n format.json { render json: @service_center.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @admin_service_city = Admin::ServiceCity.new(admin_service_city_params)\n\n respond_to do |format|\n if @admin_service_city.save\n format.html { redirect_to @admin_service_city, notice: 'Service city was successfully created.' }\n format.json { render :show, status: :created, location: @admin_service_city }\n else\n format.html { render :new }\n format.json { render json: @admin_service_city.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @service = @page.services.new(params[:service])\n @service.user = current_user\n \n respond_to do |format|\n if @service.save\n format.html { redirect_to service_url(@page, @service), notice: 'Service was successfully created.' }\n format.json { render json: @service, status: :created, location: @service }\n else\n format.html { render action: \"new\" }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @os_type = OsType.new(params[:os_type])\n\n respond_to do |format|\n if @os_type.save\n format.html { redirect_to @os_type, notice: 'Os type was successfully created.' }\n format.json { render json: @os_type, status: :created, location: @os_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @os_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @master = Master.new(master_params)\n respond_to do |format|\n if @master.save\n session[:last_master_id] = @master.id\n format.html { redirect_to master_url(@master), notice: \"Master was successfully created.\" }\n format.json { render :show, status: :created, location: @master }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @master.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @service = current_professional_user.services.build(service_params)\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to meus_servicos_path }\n flash[:success] = 'Serviço adicionado com sucesso!'\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @additional_service = AdditionalService.new(params[:additional_service])\n\n respond_to do |format|\n if @additional_service.save\n format.html { redirect_to @additional_service, notice: 'Additional service was successfully created.' }\n format.json { render json: @additional_service, status: :created, location: @additional_service }\n else\n format.html { render action: \"new\" }\n format.json { render json: @additional_service.errors, status: :unprocessable_entity }\n end\n end\n end", "def service_params\n params.require(:service).permit(:ccs_service_id, :api_dom)\n end", "def create\n @service_center = ServiceCenter.new(service_center_params)\n\n respond_to do |format|\n if @service_center.save\n format.html { redirect_to @service_center, notice: 'Service center was successfully created.' }\n format.json { render :show, status: :created, location: @service_center }\n else\n format.html { render :new }\n format.json { render json: @service_center.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @indicate_taxonomy = Indicate::Taxonomy.new(indicate_taxonomy_params)\n\n respond_to do |format|\n if @indicate_taxonomy.save\n format.html { redirect_to @indicate_taxonomy, notice: 'Taxonomy was successfully created.' }\n format.json { render :show, status: :created, location: @indicate_taxonomy }\n else\n format.html { render :new }\n format.json { render json: @indicate_taxonomy.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.66971606", "0.6608551", "0.6330021", "0.61909145", "0.61005056", "0.6083999", "0.6026088", "0.59835273", "0.59105617", "0.59062785", "0.5885013", "0.5877628", "0.58439934", "0.57504576", "0.5729869", "0.5679843", "0.56456363", "0.5640379", "0.55992275", "0.5594981", "0.55872023", "0.5580346", "0.55789405", "0.5566067", "0.55632776", "0.55622375", "0.55434674", "0.5504089", "0.549512", "0.5488941", "0.54451257", "0.5425919", "0.5425185", "0.5425185", "0.54240626", "0.5417038", "0.5411966", "0.5411369", "0.5406759", "0.5406759", "0.5406759", "0.5406759", "0.5406759", "0.5406759", "0.539903", "0.5372198", "0.5340873", "0.5333565", "0.5324001", "0.53057206", "0.52967787", "0.5293178", "0.5292163", "0.5269766", "0.5267212", "0.5266957", "0.5265126", "0.52593464", "0.5238044", "0.52289444", "0.52197796", "0.52166694", "0.52135414", "0.52109015", "0.52080804", "0.52061766", "0.52032256", "0.5200527", "0.51989937", "0.5185716", "0.5185696", "0.51841915", "0.5183578", "0.5183492", "0.5167799", "0.5166238", "0.51581526", "0.51433045", "0.5142672", "0.51377517", "0.5129432", "0.5127707", "0.51268256", "0.5111955", "0.5107592", "0.5107261", "0.5088457", "0.5087158", "0.5080886", "0.50773203", "0.50746727", "0.50743026", "0.5072905", "0.507039", "0.50700706", "0.5066709", "0.5065292", "0.50573254", "0.5056534", "0.504964" ]
0.7162778
0
PATCH/PUT /service_type_masters/1 PATCH/PUT /service_type_masters/1.json
def update respond_to do |format| if @service_type_master.update(service_type_master_params) format.html { redirect_to @service_type_master, notice: 'Service type master was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @service_type_master.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @service_master.update(service_master_params)\n @service_master = ServiceMaster.new\n @service_masters = ServiceMaster.all\n end", "def set_service_type_master\n @service_type_master = ServiceTypeMaster.find(params[:id])\n end", "def update\n respond_to do |format|\n if @masterservice.update(masterservice_params)\n format.html { redirect_to @masterservice, notice: 'Masterservice was successfully updated.' }\n format.json { render :show, status: :ok, location: @masterservice }\n else\n format.html { render :edit }\n format.json { render json: @masterservice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @service_type = ServiceType.find(params[:id])\n\n respond_to do |format|\n if @service_type.update_attributes(params[:service_type])\n format.html { redirect_to @service_type, notice: 'Service type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @service_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n remove_extra_value_from_hash(request.params,params[:service][:ccs_service_id])\n respond_to do |format|\n if @service.update(service_params)\n format.html { redirect_to services_path, notice: 'Service was successfully updated.' }\n format.json { render :show, status: :ok, location: @service }\n else\n format.html { render :edit }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n service.update_attributes(service_params)\n\n respond_with(service)\n end", "def update\n service.update(service_params)\n\n respond_with(service)\n end", "def update!(**args)\n @service_type = args[:service_type] if args.key?(:service_type)\n end", "def update\n @servicetype = Servicetype.find(params[:id])\n\n respond_to do |format|\n if @servicetype.update_attributes(params[:servicetype])\n format.html { redirect_to @servicetype, :notice => 'Servicetype was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @servicetype.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @servicetype = Servicetype.find(params[:id])\n\n respond_to do |format|\n if @servicetype.update_attributes(params[:servicetype])\n format.html { redirect_to @servicetype, notice: 'Servicetype was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @servicetype.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_masterservice\n @masterservice = Masterservice.find(params[:id])\n end", "def set_service_master\n @service_master = ServiceMaster.find(params[:id])\n end", "def update\n if @service.update(service_params)\n render json: @service, status: :ok, location: @service\n else\n render json: @service.errors, status: :unprocessable_entity\n end\n end", "def update\n @service = Service.find(params[:id])\n respond_to do |format|\n if @service.update_attributes(service_params)\n format.html { redirect_to @customer, success: 'Service was successfully updated.' }\n format.json { respond_with_bip(@service) }\n else\n format.html { render action: 'edit'}\n format.json { respond_with_bip(@service) }\n end\n end\n end", "def update\n @service = Service.find(params[:id])\n\n respond_to do |format|\n if @service.update_attributes(params[:service])\n @service.add_parts(params[:parts])\n format.html { redirect_to(admin_service_path(@service), :notice => 'Service was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @service.errors, :status => :unprocessable_entity }\n end\n end\n end", "def service_master_params\n params.require(:service_master).permit(:code, :name, :description, :status)\n end", "def update\n @service.update(service_params)\n end", "def update\n @service.update(service_params)\n end", "def update\n @service = Service.find(params[:id])\n\n respond_to do |format|\n if @service.update_attributes(params[:service])\n format.html { redirect_to @service, notice: 'Service was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @service = Service.find(params[:id])\n\n respond_to do |format|\n if @service.update_attributes(params[:service])\n format.html { redirect_to @service, notice: 'Service was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @property_service_type.update(property_service_type_params)\n format.html { redirect_to @property_service_type, notice: 'Property service type was successfully updated.' }\n format.json { render :show, status: :ok, location: @property_service_type }\n else\n format.html { render :edit }\n format.json { render json: @property_service_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @service_particular.update(service_particular_params)\n format.html { redirect_to @service_particular, notice: 'Service particular was successfully updated.' }\n format.json { render :show, status: :ok, location: @service_particular }\n else\n format.html { render :edit }\n format.json { render json: @service_particular.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #@service_request = ServiceRequest.find(params[:id])\n\n respond_to do |format|\n if @service_request.update_attributes(service_request_params)\n format.html { redirect_to @service_request, notice: 'Service request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @service_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @service.update(service_params)\n format.html { redirect_to @service, notice: 'Service was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @service.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\n respond_to do |format|\n if @request_service.update(request_service_params)\n format.html { redirect_to @request_service, notice: 'Request service was successfully updated.' }\n format.json { render :show, status: :ok, location: @request_service }\n else\n format.html { render :edit }\n format.json { render json: @request_service.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 respond_to do |format|\n if @service.update(service_params)\n format.html { redirect_to supplier_service_path(@supplier, @service), notice: 'Service was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n respond_to do |format|\r\n if @service.update(service_params)\r\n format.html { redirect_to \"/enter/companies/#{@service.company_id}/services/#{@service.id}\",method: :get, notice: 'Service was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @service }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @service.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n respond_to do |format|\n if @maker_master.update(maker_master_params)\n format.html { redirect_to @maker_master, notice: 'Maker master was successfully updated.' }\n format.json { render :show, status: :ok, location: @maker_master }\n else\n format.html { render :edit }\n format.json { render json: @maker_master.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @master.update(master_params)\n format.html { redirect_to @master, notice: 'Master was successfully updated.' }\n format.json { render :show, status: :ok, location: @master }\n else\n format.html { render :edit }\n format.json { render json: @master.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @counter_service_type.update(counter_service_type_params)\n format.html { redirect_to @counter_service_type, notice: 'Counter service type was successfully updated.' }\n format.json { render :show, status: :ok, location: @counter_service_type }\n else\n format.html { render :edit }\n format.json { render json: @counter_service_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @service.update(service_params)\n format.html { redirect_to services_url, notice: \"Service was successfully updated.\" }\n format.json { render :show, status: :ok, location: @service }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def service_type_master_params\n params[:service_type_master]\n end", "def update\n @service.update(service_params)\n @service.nombre = @service.nombre.upcase\n @service.tipo = @service.tipo.upcase\n @service.descripcion = @service.descripcion.upcase\n @service.ubicacion = @service.ubicacion.upcase\n respond_to do |format|\n if @service.save\n format.html { redirect_to @service, notice: 'Service was successfully updated.' }\n format.json { render :show, status: :ok, location: @service }\n else\n format.html { render :edit }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @service.update(service_params)\n format.html { redirect_to @service, notice: 'Service was successfully updated.' }\n format.json { render :show, status: :ok, location: @service }\n else\n format.html { render :edit, notice: 'Errors uploading the service.' }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @service.update(service_params)\n format.html { redirect_to @service, notice: 'Service was successfully updated.' }\n format.json { render :show, status: :ok, location: @service }\n else\n format.html { render :edit }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @service.update(service_params)\n format.html { redirect_to @service, notice: 'Service was successfully updated.' }\n format.json { render :show, status: :ok, location: @service }\n else\n format.html { render :edit }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @service.update(service_params)\n format.html { redirect_to @service, notice: 'Service was successfully updated.' }\n format.json { render :show, status: :ok, location: @service }\n else\n format.html { render :edit }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @service.update(service_params)\n format.html { redirect_to @service, notice: 'Service was successfully updated.' }\n format.json { render :show, status: :ok, location: @service }\n else\n format.html { render :edit }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @service.update(service_params)\n format.html { redirect_to @service, notice: 'Service was successfully updated.' }\n format.json { render :show, status: :ok, location: @service }\n else\n format.html { render :edit }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @service.update(service_params)\n format.html { redirect_to @service, notice: 'Service was successfully updated.' }\n format.json { render :show, status: :ok, location: @service }\n else\n format.html { render :edit }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @service.update(service_params)\n format.html { redirect_to @service, notice: 'Service was successfully updated.' }\n format.json { render :show, status: :ok, location: @service }\n else\n format.html { render :edit }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @service.update(service_params)\n format.html { redirect_to services_url, notice: 'Serviço cadastrado com sucesso!' }\n format.json { render :show, status: :ok, location: @service }\n else\n format.html { render :edit }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cello_master.update(cello_master_params)\n format.html { redirect_to @cello_master, notice: 'Cello master was successfully updated.' }\n format.json { render :show, status: :ok, location: @cello_master }\n else\n format.html { render :edit }\n format.json { render json: @cello_master.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @service = Service.find(params[:id], :conditions => conditions)\n params[:service].delete :serviceable_id\n params[:service].delete :ctrl_state\n params[:service].delete :type_id\n respond_to do |format|\n if @service.update_attributes(params[:service])\n flash[:notice] = \"#{@service.name}更新成功\"\n format.html { redirect_to(@service) }\n format.xml { head :ok }\n else\n @service_type = @service.type\n dictionary\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @service.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @service.update(service_params)\n format.html { redirect_to services_url, notice: 'Service was successfully updated.' }\n format.json { render :show, status: :ok, location: @service }\n else\n format.html { render :edit }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @service_type_master = ServiceTypeMaster.new(service_type_master_params)\n\n respond_to do |format|\n if @service_type_master.save\n format.html { redirect_to @service_type_master, notice: 'Service type master was successfully created.' }\n format.json { render action: 'show', status: :created, location: @service_type_master }\n else\n format.html { render action: 'new' }\n format.json { render json: @service_type_master.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_service(id, options={})\n self.class.put(\"/services/#{id}.json?apikey=#{apikey}\", :query => {:service => options}, :body => {})\n end", "def update\n respond_to do |format|\n if @service.update_attributes(params[:service])\n format.html { redirect_to service_url(@page, @service), notice: 'Service was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @admin_service.update(admin_service_regex_params)\n format.html { redirect_to @admin_service, notice: 'Platform was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_service }\n else\n format.html { render :edit }\n format.json { render json: @admin_service.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @service.update(service_params.except(:counter))\n format.html { redirect_to @service, notice: 'Service was successfully updated.' }\n format.json { render :show, status: :ok, location: @service }\n else\n format.html { render :edit }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customermaster.update(customermaster_params)\n format.html { redirect_to customermasters_url, notice: 'Customermaster was successfully updated.' }\n format.json { render :show, status: :ok, location: @customermaster }\n else\n format.html { render :edit }\n format.json { render json: @customermaster.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @service.update(service_params)\n format.html { redirect_to edit_service_path(@service), notice: 'El servicio ha sido actualizado satisfactoriamente.' }\n format.json { render :edit, status: :ok, location: @service }\n else\n format.html { render :edit }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @interview_type_master.update(interview_type_master_params)\n @interview_type_masters = InterviewTypeMaster.all\n @interview_type_master = InterviewTypeMaster.new\n end", "def update\n @serviceorg = Serviceorg.find(params[:id])\n\n respond_to do |format|\n if @serviceorg.update_attributes(params[:serviceorg])\n format.html { redirect_to @serviceorg, notice: 'Serviceorg was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @serviceorg.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @service.update(service_params)\n format.html { redirect_to [:admin,@service], notice: 'ok, Empresa atualizada' }\n format.json { render :show, status: :ok, location: @service }\n else\n format.html { render :edit }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @service = args[:service] if args.key?(:service)\n end", "def update\n respond_to do |format|\n if @additional_service.update(additional_service_params)\n format.html { redirect_to @additional_service, notice: 'Additional service was successfully updated.' }\n format.json { render :show, status: :ok, location: @additional_service }\n else\n format.html { render :edit }\n format.json { render json: @additional_service.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @phones_type.update(phones_type_params)\n format.html { redirect_to @phones_type, notice: 'Phones type was successfully updated.' }\n format.json { render :show, status: :ok, location: @phones_type }\n else\n format.html { render :edit }\n format.json { render json: @phones_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(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_put(@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\n @os_type = OsType.find(params[:id])\n\n respond_to do |format|\n if @os_type.update_attributes(params[:os_type])\n format.html { redirect_to @os_type, notice: 'Os type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @os_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_service_type\n @service_type = ServiceType.find(params[:id])\n end", "def update\n respond_to do |format|\n if @service.update(service_params) \n format.js { }\n else\n format.html { render :edit }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n keystone.update_tenant({:id=>params[:id],:name=>params[:name],:description=>params[:description],:enabled=>params[:enabled]})\n respond_to do |format|\n format.html { redirect_to tenants_path, :notice => 'Tenant was successfully updated.' }\n format.json { head :ok }\n end\n end", "def update\n @service = Service.find(params[:id])\n @buttonvalue = \"update service\"\n \n respond_to do |format|\n if checkServiceAdmin(@service) && @service.update_attributes(params[:service])\n format.html { redirect_to @service, notice: 'Your service has been successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @source_master.update(source_master_params)\n format.html { redirect_to @source_master, notice: \"Source master was successfully updated.\" }\n format.json { render :show, status: :ok, location: @source_master }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @source_master.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @additional_service = AdditionalService.find(params[:id])\n\n respond_to do |format|\n if @additional_service.update_attributes(params[:additional_service])\n format.html { redirect_to @additional_service, notice: 'Additional service was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @additional_service.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n respond_to do |format|\r\n if @service.update_nanny(nanny_params) and @service.update(service_params)\r\n format.html { redirect_to @service, notice: 'Service was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @service }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @service.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @service_email = ServiceEmail.first\n\n respond_to do |format|\n if @service_email.update_attributes(params[:service_email])\n format.html { redirect_to admin_experiences_path, notice: 'Service email was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @service_email.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @mpg_control.update(mpg_control_params)\n format.html { redirect_to @mpg_control, notice: 'Mpg control was successfully updated.' }\n format.json { render :show, status: :ok, location: @mpg_control }\n else\n @services_of_dependence = current_user.dependence.service_of_dependences\n agents_of_service = AgentOfService.where(service_of_dependence: @services_of_dependence)\n @agents = Agent.where(id: agents_of_service.pluck(:agent_id))\n format.html { render :edit }\n format.json { render json: @mpg_control.errors, status: :unprocessable_entity }\n end\n end\n end", "def put_clone\n response = self.class.put(\"/service/#{$service_id}/version/#{$service_version}/clone\", { \n headers: {\"Fastly-Key\" => $key} \n })\n end", "def update\n respond_to do |format|\n if @service_request.update(service_request_params)\n format.html { redirect_to @service_request, notice: 'Service request was successfully updated.' }\n format.json { render :show, status: :ok, location: @service_request }\n else\n format.html { render :edit }\n format.json { render json: @service_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @service = Service.find(params[:id])\n system_site_map = SystemSiteMap.where( :parameter => params[:id] ).first\n \n package_content\n \n respond_to do |format|\n if @service.update_attributes(params[:service])\n system_site_map.update_attributes(:title => @service.title)\n format.html { redirect_to({:action=>:show}, notice: t(\"helpers.notice.update\")) }\n else\n format.html { render action: \"edit\" }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer_service.update(customer_service_params)\n format.html { redirect_to @customer_service, notice: 'Customer service was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer_service }\n else\n format.html { render :edit }\n format.json { render json: @customer_service.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @service_status.update(service_status_params)\n format.html { redirect_to @service_status, notice: 'Service status was successfully updated.' }\n format.json { render :show, status: :ok, location: @service_status }\n else\n format.html { render :edit }\n format.json { render json: @service_status.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @additionalservice.update(additionalservice_params)\n format.html { redirect_to @additionalservice, notice: 'Additionalservice was successfully updated.' }\n format.json { render :show, status: :ok, location: @additionalservice }\n else\n format.html { render :edit }\n format.json { render json: @additionalservice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event_service.update_attributes(event_service_params)\n format.html { redirect_to @event_service, notice: 'Event service was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event_service.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @client_type = ClientType.find(params[:id])\n\n respond_to do |format|\n if @client_type.update_attributes(params[:client_type])\n format.html { redirect_to @client_type, notice: 'Client type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @client_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_service_fee_master\n @service_fee_master = ServiceFeeMaster.find(params[:id])\n end", "def update\n @site_type = SiteType.find(params[:id])\n\n respond_to do |format|\n section_type_ids = params[:site_type].delete(\"section_type_ids\")\n if @site_type.update_attributes(params[:site_type]) && @site_type.section_type_ids = section_type_ids\n format.html { redirect_to @site_type, notice: 'Site type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @site_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_service\n @service = Service.find(params[:id])\n @service = @service.becomes(@service.type.constantize) if @service.valid?\n @service.current_request = request\n end", "def update\n respond_to do |format|\n if @os_type.update(os_type_params)\n format.html { redirect_to @os_type, notice: 'Os type was successfully updated.' }\n format.json { render :show, status: :ok, location: @os_type }\n else\n format.html { render :edit }\n format.json { render json: @os_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @serviceordemservice.update(serviceordemservice_params)\n format.html { redirect_to @serviceordemservice, notice: 'Serviceordemservice was successfully updated.' }\n format.json { render :show, status: :ok, location: @serviceordemservice }\n else\n format.html { render :edit }\n format.json { render json: @serviceordemservice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @idti_service.update(idti_service_params)\n format.html { redirect_to @idti_service, notice: 'Idti service was successfully updated.' }\n format.json { render :show, status: :ok, location: @idti_service }\n else\n format.html { render :edit }\n format.json { render json: @idti_service.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @master_size.update(master_size_params)\n format.html { redirect_to @master_size, notice: 'Size was successfully updated.' }\n format.json { render :show, status: :ok, location: @master_size }\n else\n format.html { render :edit }\n format.json { render json: @master_size.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(options)\n data = JSON.generate(:server => options)\n response = @compute.connection.csreq(\"PUT\",@svrmgmthost,\"#{@svrmgmtpath}/servers/#{URI.encode(self.id.to_s)}\",@svrmgmtport,@svrmgmtscheme,{'content-type' => 'application/json'},data)\n OpenStack::Exception.raise_exception(response) unless response.code.match(/^20.$/)\n # If we rename the instance, repopulate the object\n self.populate if options[:name]\n true\n end", "def update!(**args)\n @services = args[:services] if args.key?(:services)\n end", "def update\n @servicerequest.update(servicerequest_params)\n @servicerequest.seccion = @servicerequest.seccion.upcase\n @servicerequest.contacto_int = @servicerequest.contacto_int.upcase\n @servicerequest.correo_int = @servicerequest.correo_int.upcase\n @servicerequest.observacion = @servicerequest.observacion.upcase\n respond_to do |format|\n if @servicerequest.save\n format.html { redirect_to servicerequests_url, notice: 'Service request was successfully updated.' }\n format.json { render :show, status: :ok, location: @servicerequest }\n else\n format.html { render :edit }\n format.json { render json: @servicerequest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @master.update(master_params)\n session[:last_master_id] = @master.id\n format.html { redirect_to master_url(@master), notice: \"Master was successfully updated.\" }\n format.json { render :show, status: :ok, location: @master }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @master.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @emt_service.update(emt_service_params)\n format.html { redirect_to @emt_service, notice: 'Emt service was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @emt_service.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bus_service = BusService.find(params[:id],:include => :students)\n\n respond_to do |format|\n if @bus_service.update_attributes(params[:bus_service])\n format.html { redirect_to(@bus_service, :notice => 'BusService was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bus_service.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @complex_service = ComplexService.find(params[:id])\n\n respond_to do |format|\n if @complex_service.update_attributes(params[:complex_service])\n format.html { redirect_to(@complex_service, :notice => 'ComplexService was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @complex_service.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @service_class.update(service_class_params)\n format.html { redirect_to @service_class, notice: 'Service class was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @service_class.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @operations = args[:operations] if args.key?(:operations)\n @service_config_id = args[:service_config_id] if args.key?(:service_config_id)\n @service_name = args[:service_name] if args.key?(:service_name)\n end", "def update\n @service = Service.find(params[:id])\n\n respond_to do |format|\n if @service.update_attributes(params[:service])\n #format.html { redirect_to @service, notice: 'Service was successfully updated.' }\n\tflash[:notice]= 'Service was successfully updated.'\n\tformat.html { redirect_to action: 'index'}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def reset_services(services=[])\n request :put, '/services', services\n end", "def update\n respond_to do |format|\n if @community_service.update(community_service_params)\n format.html { redirect_to @community_service, notice: 'Community service was successfully updated.' }\n format.json { render :show, status: :ok, location: @community_service }\n else\n format.html { render :edit }\n format.json { render json: @community_service.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6626589", "0.6460784", "0.6457169", "0.6215841", "0.6012411", "0.60110337", "0.6009971", "0.59858805", "0.59663457", "0.59586585", "0.5921562", "0.58804315", "0.58310306", "0.57609785", "0.57364327", "0.57131785", "0.57071", "0.57071", "0.56954354", "0.56954354", "0.5682584", "0.56666493", "0.5660009", "0.56448334", "0.56192964", "0.5617612", "0.5616792", "0.56131744", "0.5603957", "0.55994165", "0.55982673", "0.55853313", "0.55748826", "0.5565824", "0.55601186", "0.5557037", "0.55538833", "0.55538833", "0.55538833", "0.55538833", "0.55538833", "0.55538833", "0.5553617", "0.5550368", "0.5544917", "0.554275", "0.5524241", "0.5523899", "0.55109835", "0.5506899", "0.54879564", "0.5481597", "0.5476933", "0.545867", "0.5443307", "0.54337984", "0.5423014", "0.5419373", "0.5419373", "0.5419373", "0.5417772", "0.5416278", "0.5413154", "0.54106325", "0.5400684", "0.5400485", "0.5397224", "0.53952676", "0.5394732", "0.53914297", "0.5388685", "0.5383488", "0.53804684", "0.5368602", "0.5367711", "0.5356211", "0.53549886", "0.5354526", "0.53460824", "0.53369385", "0.53355366", "0.5333416", "0.5320554", "0.5318298", "0.53164136", "0.53160006", "0.53118306", "0.5307922", "0.52957416", "0.529519", "0.52951664", "0.52884936", "0.5288095", "0.5285301", "0.52831644", "0.52819514", "0.5275501", "0.52711916", "0.52701956", "0.5269612" ]
0.71282756
0
DELETE /service_type_masters/1 DELETE /service_type_masters/1.json
def destroy @service_type_master.destroy respond_to do |format| format.html { redirect_to service_type_masters_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @masterservice.destroy\n respond_to do |format|\n format.html { redirect_to masterservices_url, notice: 'Masterservice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @service_type = ServiceType.find(params[:id])\n @service_type.destroy\n\n respond_to do |format|\n format.html { redirect_to service_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @multi_agent_service.destroy\n respond_to do |format|\n format.html { redirect_to multi_agent_services_url, notice: 'Entry was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @servicetype = Servicetype.find(params[:id])\n @servicetype.destroy\n\n respond_to do |format|\n format.html { redirect_to servicetypes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @servicetype = Servicetype.find(params[:id])\n @servicetype.destroy\n\n respond_to do |format|\n format.html { redirect_to servicetypes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to admin_services_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @service_master.destroy\n @service_masters = ServiceMaster.all\n end", "def destroy\n @service = Service.find(params[:id])\n @service.destroy\n\n respond_to do |format|\n format.html { redirect_to manage_services_url }\n format.json { head :ok }\n end\n end", "def destroy\n #@service_request = ServiceRequest.find(params[:id])\n @service_request.destroy\n\n respond_to do |format|\n format.html { redirect_to service_requests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @service_fee_master.destroy\n respond_to do |format|\n format.html { redirect_to service_fee_masters_url, notice: 'Service fee master was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @service = Service.find(params[:id])\n @service.destroy\n\n respond_to do |format|\n format.html { redirect_to services_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @service = Service.find(params[:id])\n @service.destroy\n\n respond_to do |format|\n format.html { redirect_to services_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @service = Service.find(params[:id])\n @service.destroy\n\n respond_to do |format|\n format.html { redirect_to services_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @service = Service.find(params[:id])\n @service.destroy\n\n respond_to do |format|\n format.html { redirect_to services_url }\n format.json { head :ok }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to services_url }\n format.json { head :no_content }\n end\n end", "def delete\n svc = Service.find_by_label(params[:label])\n raise CloudError.new(CloudError::SERVICE_NOT_FOUND) unless svc\n raise CloudError.new(CloudError::FORBIDDEN) unless svc.verify_auth_token(@service_auth_token)\n\n svc.destroy\n\n render :json => {}\n end", "def destroy\n @counter_service_type.destroy\n respond_to do |format|\n format.html { redirect_to counter_service_types_url, notice: 'Counter service type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @service_dependance = ServiceDependance.find(params[:id])\n @service_dependance.destroy\n\n respond_to do |format|\n format.html { redirect_to service_dependances_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @service_prov_type.destroy\n respond_to do |format|\n format.html { redirect_to service_prov_types_url, notice: 'Service prov type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @service.update_column(:deleted, true)\n respond_to do |format|\n format.html { redirect_to admin_services_url, notice: 'Service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @pharmaceutical_master.destroy\n respond_to do |format|\n format.html { redirect_to pharmaceutical_masters_url, notice: DELETE_NOTICE }\n format.json { head :no_content }\n end\n end", "def destroy\n @server = Server.find(params[:id])\n checkaccountobject(\"servers\",@server)\n @server.send_delete\n respond_to do |format|\n format.html { redirect_to servers_url }\n format.json { head :ok }\n end\n end", "def destroy\n #@service is already loaded and authorized\n @service.destroy\n\n respond_to do |format|\n format.html { redirect_to services_url }\n format.json { head :ok }\n end\n end", "def service_group_delete(a10, name)\n a10.send(:axapi, 'slb.service_group.delete', 'post', {name: name, format: 'json'})\nend", "def destroy\n @service = Service.find(params[:id])\n @service.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_services_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @service_particular.destroy\n respond_to do |format|\n format.html { redirect_to service_particulars_url, notice: 'Service particular was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def _delete(type, *args)\n type = type.to_s.camelize\n metadata = args.map { |full_name| {:full_name => full_name} }\n request :delete do |soap|\n soap.body = {\n :metadata => metadata\n }.merge(attributes!(type))\n end\n end", "def destroy\n @consultant_master = ConsultantMaster.find(params[:id])\n @consultant_master.destroy\n\n respond_to do |format|\n format.html { redirect_to consultant_masters_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @serviceordemservice.destroy\n respond_to do |format|\n format.html { redirect_to serviceordemservices_url, notice: 'Serviceordemservice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to services_url, notice: 'El servicio ha sido eliminado.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @hot_master.destroy\n respond_to do |format|\n format.html { redirect_to hot_masters_url, notice: DELETE_NOTICE }\n format.json { head :no_content }\n end\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to services_url, notice: 'Serviço cadastrado com sucesso!' }\n format.json { head :no_content }\n end\n end", "def destroy\n id = params[:id]\n @datacenter = Datacenter.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @datacenter.destroy\n\n respond_to do |format|\n format.html { redirect_to datacenters_url }\n format.json { head :ok }\n end\n end", "def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to service_url, notice: 'Service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @clientes_servico.destroy\n respond_to do |format|\n format.html { redirect_to clientes_servicos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @master.destroy\n\n respond_to do |format|\n format.html { redirect_to masters_url, notice: \"Master was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @recreation_service_typology.destroy\n respond_to do |format|\n format.html { redirect_to recreation_service_typologies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @serviceorg = Serviceorg.find(params[:id])\n @serviceorg.destroy\n\n respond_to do |format|\n format.html { redirect_to serviceorgs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to services_url, notice: \"Service was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to services_url, notice: 'Service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to services_url, notice: 'Service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to services_url, notice: 'Service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to services_url, notice: 'Service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to services_url, notice: 'Service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to services_url, notice: 'Service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to services_url, notice: 'Service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to services_url, notice: 'Service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to services_url, notice: 'Service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to services_url, notice: 'Service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to services_url, notice: 'Service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to services_url, notice: 'Service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to services_url, notice: 'Service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @master.destroy\n respond_to do |format|\n format.html { redirect_to masters_url, notice: 'Master was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to services_url, notice: 'El servicio ha sido destruido satisfactoriamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @additional_service.destroy\n respond_to do |format|\n format.html { redirect_to additional_services_url, notice: 'Additional service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @service.destroy\n \n respond_to do |format|\n format.html { redirect_to services_url(@page) }\n format.json { head :no_content }\n end\n end", "def destroy\n @additional_service = AdditionalService.find(params[:id])\n @additional_service.destroy\n\n respond_to do |format|\n format.html { redirect_to additional_services_url }\n format.json { head :no_content }\n end\n end", "def destroy\n puts \"this is working\"\n @master_size.destroy\n respond_to do |format|\n format.html { redirect_to master_sizes_url, notice: 'Size was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to request.referer, notice: 'Service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @server1 = Server1.find(params[:id])\n @server1.destroy\n\n respond_to do |format|\n format.html { redirect_to server1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client_type = ClientType.find(params[:id])\n @client_type.destroy\n\n respond_to do |format|\n format.html { redirect_to client_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @payment_site_master.destroy\n respond_to do |format|\n format.html { redirect_to payment_site_masters_url }\n format.json { head :no_content }\n end\n end", "def destroy\n client=Client.find_by_id(params[:id])\n if client != nil\n if client.destroy\n head 204\n end\n else\n head 404\n end\n end", "def destroy\n @service_class.destroy\n respond_to do |format|\n format.html { redirect_to service_classes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @my_studio_client = MyStudio::Client.find(params[:id])\n @my_studio_client.destroy\n\n respond_to do |format|\n format.html { redirect_to my_studio_clients_url }\n format.json { head :ok }\n end\n end", "def destroy\r\n @service.destroy\r\n respond_to do |format|\r\n format.html { redirect_to request.referer, notice: 'Service was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @emt_service.destroy\n respond_to do |format|\n format.html { redirect_to emt_services_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @additionalservice.destroy\n respond_to do |format|\n format.html { redirect_to additionalservices_url, notice: 'Additionalservice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @service_start.destroy\n respond_to do |format|\n format.html { redirect_to :delete, flash: { message: 'Service start was successfully deleted.' } }\n format.json { head :no_content }\n end\n end", "def destroy\n @servicerequest.destroy\n respond_to do |format|\n format.html { redirect_to servicerequests_url, notice: 'Service request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @charge_master = ChargeMaster.find(params[:id])\n @charge_master.destroy\n\n respond_to do |format|\n format.html { redirect_to charge_masters_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @serverhascontainer.destroy\n respond_to do |format|\n format.html { redirect_to serverhascontainers_url, notice: 'Serverhascontainer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @dor_master.destroy\n respond_to do |format|\n format.html { redirect_to dor_masters_url, notice: 'Dor master was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @segment_type = SegmentType.find(params[:id])\n @segment_type.destroy\n\n respond_to do |format|\n format.html { redirect_to segment_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @service_request.destroy\n respond_to do |format|\n format.html { redirect_to service_requests_url, notice: 'Service request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @service_request.destroy\n respond_to do |format|\n format.html { redirect_to service_requests_url, notice: 'Service request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @service_request.destroy\n respond_to do |format|\n format.html { redirect_to service_requests_url, notice: 'Service request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @client_type.destroy\n respond_to do |format|\n format.html { redirect_to client_types_url, notice: 'Tipo de Cliente deletado.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer_service.destroy\n respond_to do |format|\n format.html { redirect_to customer_services_url, notice: 'Customer service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @request_service.destroy\n respond_to do |format|\n format.html { redirect_to request_services_url, notice: 'Request service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @os_type = OsType.find(params[:id])\n @os_type.destroy\n\n respond_to do |format|\n format.html { redirect_to os_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @trein_consul_comercial.destroy\n respond_to do |format|\n format.html { redirect_to trein_consul_comercials_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @service = Service.find(params[:id])\n @service.destroy\n\n respond_to do |format|\n format.html { redirect_to(services_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @service = Service.find(params[:id])\n @service.destroy\n\n respond_to do |format|\n format.html { redirect_to(services_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @service = Service.find(params[:id])\n @service.destroy\n\n respond_to do |format|\n format.html { redirect_to(services_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @customermaster.destroy\n respond_to do |format|\n format.html { redirect_to customermasters_url, notice: 'Customermaster was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @serv = Serv.find(params[:id])\n if @serv.mngbl\n #Remueve el MR a través de una llamada al webservice del núcleo\n http = Net::HTTP.new(\"192.168.119.163\",9999)\n post_params = {'ip' => @serv.conn.ip, 'port' => @serv.conn.port}\n request = Net::HTTP::Delete.new(\"/mbs/#{@serv.domain}/#{@serv.name}\")\n request.set_form_data(post_params)\n begin\n response = http.request(request)\n rescue Errno::ECONNREFUSED\n end\n end\n @serv.destroy\n\n respond_to do |format|\n format.html { redirect_to servs_url, notice: t('servs.delete.notice') }\n format.json { head :no_content }\n end\n end", "def destroy\n @complex_service = ComplexService.find(params[:id])\n @complex_service.destroy\n\n respond_to do |format|\n format.html { redirect_to(complex_services_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @service_station = ServiceStation.find(params[:id])\n @service_station.destroy\n\n respond_to do |format|\n format.html { redirect_to service_stations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @service_status.destroy\n respond_to do |format|\n format.html { redirect_to service_statuses_url, notice: 'Service status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @service_center.destroy\n respond_to do |format|\n format.html { redirect_to admin_service_centers_url, notice: 'Service center was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @scout_master = ScoutMaster.find(params[:id])\n @scout_master.destroy\n\n respond_to do |format|\n format.html { redirect_to(scout_masters_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @taxi_sevice.destroy\n respond_to do |format|\n format.html { redirect_to taxi_sevices_url, notice: 'Taxi sevice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @service_item.destroy\n respond_to do |format|\n format.html { redirect_to service_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @childmaster = Childmaster.find(params[:id])\n @childmaster.destroy\n\n respond_to do |format|\n format.html { redirect_to childmasters_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ac_master.destroy\n respond_to do |format|\n format.html { redirect_to ac_masters_url, notice: 'Ac master was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @service_table.destroy\n respond_to do |format|\n format.html { redirect_to service_tables_url, notice: 'Đã xóa thành công!' }\n format.json { head :no_content }\n end\n end" ]
[ "0.7238404", "0.7077941", "0.6990478", "0.6959615", "0.6959615", "0.687877", "0.6852835", "0.6819308", "0.6808207", "0.6792213", "0.6763455", "0.6763455", "0.6763455", "0.6763115", "0.67594284", "0.6754525", "0.6737758", "0.6695694", "0.66737854", "0.66716367", "0.6660031", "0.6643761", "0.6630142", "0.6611593", "0.66103905", "0.6607753", "0.6597603", "0.6586139", "0.65797263", "0.6579126", "0.65679014", "0.65647995", "0.6563866", "0.6557195", "0.65389144", "0.65325224", "0.6526923", "0.65180886", "0.65135735", "0.65075827", "0.64999324", "0.64985245", "0.6497597", "0.6497597", "0.6497597", "0.6497597", "0.6497597", "0.6497597", "0.6497597", "0.6497597", "0.6497597", "0.6497597", "0.6497597", "0.6497597", "0.6497597", "0.64952964", "0.6490545", "0.6484015", "0.64809203", "0.6480274", "0.64723355", "0.6469419", "0.6468212", "0.64626", "0.64610255", "0.6459577", "0.64509493", "0.6442099", "0.64394313", "0.6434524", "0.6429652", "0.64277834", "0.64262295", "0.6422413", "0.64162475", "0.6412584", "0.64106447", "0.6409971", "0.6409971", "0.6409971", "0.640538", "0.6404714", "0.6403846", "0.6403265", "0.6403096", "0.6400618", "0.6400618", "0.6400618", "0.63933575", "0.63882107", "0.638799", "0.63850117", "0.63848", "0.63825536", "0.63816947", "0.63783145", "0.6376453", "0.63689744", "0.63682306", "0.6364712" ]
0.781496
0
Use callbacks to share common setup or constraints between actions.
def set_service_type_master @service_type_master = ServiceTypeMaster.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 service_type_master_params params[:service_type_master] 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
output: true or false Rules: each row, column, and block (a 3x3 of the board) must contain every integer 19. if anywhere on the board contains a 0 then return false because that represents an empty cell. Steps: => first check to see if the board is filled out completely iterate through each sub_array and see if it include?(0) if it does return false, else continue with the validation => ROWS VALID? initialize a variable array and assign it a complete row 19 iterate through each sub_array and use sort method to compare it to the valid array variable. if they are equal rows are valid. => COLUMNS VALID? add all the correct indexes to a current array variable and use sort method again to compare it to the valid array variable. if they are equal columns are valid. => BLOCKS VALID? we need to create the blocks as arrays of 9 integers, sorted, and then compare them against a valid array. Then store the results in a result array like before... the hard part is creating the blocks as arrays. => create blocks as arrays... maybe iterate through the board then add certain indices to a hash then put in a clause that says if the hash value.size == 9 increment the name/key of the hash by 3. This will turn key 1 into 4, key 2 into 5, key 3 into 6.... and once it happens again it will jump to the next row of blocks...
def board_complete?(b) result = b.select do |sub_array| sub_array.any?(0) end result.empty? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validation(board, xblks, yblks)\n # row in valid\n\n \tfor x in 0..board.length-1\n \t\tcol = Array.new\n \t\trow = Array.new(board[x]) #need new array not modify board via reference\n\t\tblock = Array.new(board.length) {Array.new}\n \t\tfor y in 0..board.length-1\n if (board[y][x] != 0)\n\n \t\t\t\tcol.concat([board[y][x]])\n\t\t\tend\n\n\t\t\tputs [y, x]\n \t\t\tputs \"\"\n\t\t\tif (board[x][y] != 0)\n \t\t\t\tblk = (x/xblks).floor + yblks * (y/yblks).floor\n\t\t\t\tblock[blk-1].concat([board[x][y]])\n\t\t\tend\n \t \tend\n\t\trow.delete(0)\n\n \t\tif (col.uniq! != nil or row.uniq! != nil)\n\n\n\t\t\treturn false\n\t\tend\n\n\n \tend\n\n for each in block\n\t\tif each.uniq! != nil\n\t\t\treturn false\n\t\tend\n\tend\n\treturn true\n end", "def validateBoard()\n #cycle through all lines in the file\n row = 0\n for row in 0..8\n # @gameboard index\n index = 0\n # array temp is used to store number appearing in the same row\n temp = Array.new\n # temp array index\n i = 0\n while index<@DIMENSION\n if (1..9).member? @gameboard[row * @DIMENSION + index]\n if temp.include? @gameboard[row * @DIMENSION + index]\n return false\n else\n temp[i] = @gameboard[row * @DIMENSION + index]\n i += 1\n end\n end\n index += 1\n end\n end\n #cycle through all columns in the file\n column = 0\n for column in 0..8\n # @gameboard index\n index = 0\n # array temp is used to store number appearing in the same row\n temp = Array.new\n # temp array index\n i = 0\n while index<@DIMENSION\n if (1..9).member? @gameboard[column + index * @DIMENSION]\n if temp.include? @gameboard[column+ index * @DIMENSION]\n return false\n else\n temp[i] = @gameboard[column+ index * @DIMENSION]\n i += 1\n end\n end\n index += 1\n end\n end\n #cycle through all @DEIMENSION squares in the file\n startIndex = 0\n rowBase = 0\n columnBase = 0\n for rowBase in 0..2\n startIndex = rowBase * 3 * @DIMENSION\n for columnBase in 0..2\n # array temp is used to store number appearing in the same row\n temp = Array.new\n # temp array index\n i = 0\n #find the real index in @gameboard\n l = 0\n for l in 0..2\n m = 0\n for m in 0..2\n index = startIndex + m * @DIMENSION + l\n if (1..9).member? @gameboard[index]\n if temp.include? @gameboard[index]\n return false\n else\n temp[i] = @gameboard[index]\n i += 1\n end\n end\n end\n end\n startIndex += 3\n end\n end\n return true\nend", "def valid_sudoku(table)\n # edge cases\n return false if table.nil? || table.size != 9 || table[0].size != 9\n # 3 new storages will count number of occurances of each element for columns, rows and sub-boxes\n rows = Array.new(9)\n i = 0\n while i < rows.size\n rows[i] = {\"1\"=>0,\"2\"=>0,\"3\"=>0,\"4\"=>0,\"5\"=>0,\"6\"=>0,\"7\"=>0,\"8\"=>0,\"9\"=>0}\n i += 1\n end\n\n columns = Array.new(9)\n i = 0\n while i < columns.size\n columns[i] = {\"1\"=>0,\"2\"=>0,\"3\"=>0,\"4\"=>0,\"5\"=>0,\"6\"=>0,\"7\"=>0,\"8\"=>0,\"9\"=>0}\n i += 1\n end\n\n sub_boxes = Array.new(9)\n i = 0\n while i < sub_boxes.size\n sub_boxes[i] = {\"1\"=>0,\"2\"=>0,\"3\"=>0,\"4\"=>0,\"5\"=>0,\"6\"=>0,\"7\"=>0,\"8\"=>0,\"9\"=>0}\n i += 1\n end\n\n # loop through the input table to populate the above created storages with occurance numbers\n i = 0 # i is a row counter\n while i < table.size\n j = 0 # j is a column counter\n while j < table.size\n if table[i][j] != \".\"\n rows[i][table[i][j]] += 1\n columns[j][table[i][j]] += 1\n # find a number of a box/hash by calculating (i/3)*3 + (j/3)\n # e.g. for the element at indexes 1,2 the box will be: (1/3)*3 + (2/3) = 0, first box\n sub_boxes[(i/3)*3 + (j/3)][table[i][j]] += 1\n end\n j += 1\n end\n i += 1\n end\n # check if any of table elements occured more than 1 time within a row, a column or a sub-box\n rows.each do |hash|\n return false if hash.any? { |key, value| value > 1}\n end\n columns.each do |hash|\n return false if hash.any? { |key, value| value > 1}\n end\n sub_boxes.each_with_index do |hash, i|\n return false if hash.any? { |key, value| value > 1}\n end\n\n return true\nend", "def valid_sudoku(table)\n row_list = {}\n col_list = {}\n\n i = 0\n while i < table.length \n j = 0\n\n while j < table[i].length\n \n row_num = table[i][j]\n col_num = table[j][i]\n\n row_list = update_sub_grid(row_list, row_num)\n return false if !row_list\n\n col_list = update_sub_grid(col_list, col_num)\n return false if !col_list\n\n j += 1\n end\n\n\n row_list = {}\n col_list = {}\n \n i += 1\n end\n\n\n starting_points = [\n [0, 0],\n [0, 3],\n [0, 6],\n [3, 0],\n [3, 3],\n [3, 6],\n [6, 0],\n [6, 3],\n [6, 6]\n ]\n\n starting_points.each do |row_start, col_start|\n return false if !valid_sub_grid(table, row_start, col_start)\n end \n\n return true\nend", "def validSolution(board)\n array_of_boxes = Array.new\n box = Array.new\n i = 0\n\n add_box_array = lambda do\n 3.times do\n 3.times do\n row = board[i]\n box.push(row[0]).push(row[1]).push(row[2])\n i += 1\n end\n\n array_of_boxes << box\n box = Array.new\n end\n end\n\n reset_and_rotate = lambda do\n i = 0\n board.each{ |row| row.rotate!(3) }\n end\n\n add_reset_rotate = lambda do\n add_box_array.call\n reset_and_rotate.call\n end\n\n 2.times {add_reset_rotate.call}\n add_box_array.call\n all_possible_arrays = (1..9).to_a.permutation.to_a\n\n # each row & each column is a unique permutation of base_array\n board.all?{ |row| all_possible_arrays.include?(row) } &&\n board.uniq.size == 9 &&\n board.transpose.all?{ |column| all_possible_arrays.include?(column) } &&\n board.transpose.uniq.size == 9 &&\n array_of_boxes.all? { |box| all_possible_arrays.include?(box) }\nend", "def row_checker(flat_board_array)\n first_row_indexes = [0,1,2,3,4,5,6,7,8]\n current_row = 0\n until current_row >= 9\n indexes = first_row_indexes.map { |index| index + current_row * 9}\n hash_of_vals = {}\n indexes.each do |index|\n if hash_of_vals[flat_board_array[index]] && flat_board_array[index] != 0\n return false\n else \n hash_of_vals[flat_board_array[index]] = 1\n end\n end\n current_row += 1\n end\n \n return true\nend", "def valid_sudoku(table)\n subgrids = {}\n\n # return false if any element is repeated in a row\n table.each do |row|\n row_count = {}\n row.each do |element|\n if row_count[element]\n return false unless element == \".\"\n else\n row_count[element] = 1\n end\n end\n end\n\n # return false if any element is repeated in a column\n columns = {\n 0 => {},\n 1 => {},\n 2 => {},\n 3 => {},\n 4 => {},\n 5 => {},\n 6 => {},\n 7 => {},\n 8 => {},\n }\n table.each do |row|\n row.each_with_index do |element, index|\n if columns[index][element]\n return false unless element == \".\"\n else\n columns[index][element] = 1\n end\n end\n end\n\n first_subgrid = {}\n second_subgrid = {}\n third_subgrid = {}\n\n table[0..2].each do |row|\n row[0..2].each do |element|\n if first_subgrid[element]\n return false unless element == \".\"\n else\n first_subgrid[element] = 1\n end\n end\n\n row[3..5].each do |element|\n if second_subgrid[element]\n return false unless element == \".\"\n else\n second_subgrid[element] = 1\n end\n end\n\n row[6..8].each do |element|\n if third_subgrid[element]\n return false unless element == \".\"\n else\n third_subgrid[element] = 1\n end\n end\n end\n\n first_subgrid = {}\n second_subgrid = {}\n third_subgrid = {}\n\n table[3..5].each do |row|\n row[0..2].each do |element|\n if first_subgrid[element]\n return false unless element == \".\"\n else\n first_subgrid[element] = 1\n end\n end\n\n row[3..5].each do |element|\n if second_subgrid[element]\n return false unless element == \".\"\n else\n second_subgrid[element] = 1\n end\n end\n\n row[6..8].each do |element|\n if third_subgrid[element]\n return false unless element == \".\"\n else\n third_subgrid[element] = 1\n end\n end\n end\n\n first_subgrid = {}\n second_subgrid = {}\n third_subgrid = {}\n\n table[6..8].each do |row|\n row[0..2].each do |element|\n if first_subgrid[element]\n return false unless element == \".\"\n else\n first_subgrid[element] = 1\n end\n end\n\n row[3..5].each do |element|\n if second_subgrid[element]\n return false unless element == \".\"\n else\n second_subgrid[element] = 1\n end\n end\n\n row[6..8].each do |element|\n if third_subgrid[element]\n return false unless element == \".\"\n else\n third_subgrid[element] = 1\n end\n end\n end\n\n return true\nend", "def valid_sudoku(table)\n store = {\n rows: {},\n cols: {},\n square: {},\n }\n # First loop it represents the first row we are checking\n # Second loop it represents the column.\n\n (0...9).each do |i|\n (0...9).each do |j|\n box = table[i][j]\n if !store[:rows][i] && box != \".\"\n store[:rows][i] = []\n store[:rows][i].push(box)\n elsif box != \".\" && !store[:rows][i].include?(box)\n store[:rows][i].push(box)\n elsif store[:rows][i] && store[:rows][i].include?(box)\n return false\n end\n\n if !store[:cols][j] && box != \".\"\n store[:cols][j] = []\n store[:cols][j].push(box)\n elsif box != \".\" && !store[:cols][j].include?(box)\n store[:cols][j].push(box)\n elsif store[:cols][j] && store[:cols][j].include?(box)\n return false\n end\n\n # Converting to float and the ceil to round up always.\n squareRowId = ((i + 1).to_f / 3).ceil\n squareColId = ((j + 1).to_f / 3).ceil\n # The squeare id is gonna be like\n # 1-1 , 1-2, 1-3\n # 2-1 , 2-2, 2-3\n # 3-1 , 3-2, 3-3\n\n squareId = \"#{squareRowId}-#{squareColId}\"\n\n # Here insted of checking rows and colums I will be checking the numbers inside of this\n # Squeare ids.\n if !store[:square][squareId] && box != \".\"\n store[:square][squareId] = []\n store[:square][squareId].push(box)\n elsif box != \".\" && !store[:square][squareId].include?(box)\n store[:square][squareId].push(box)\n elsif store[:square][squareId] && store[:square][squareId].include?(box)\n return false\n end\n end\n end\n return true\nend", "def validSolution(board)\n return false if board.flatten.size != 81\n return false if board.flatten.any? { |el| el.class != Fixnum }\n return false if board.size != 9\n board.each do |row|\n return false if row.any? { |el| el < 1 || el > 9 }\n return false if row.uniq.size != 9\n end\n (0..8).each do |col|\n this_col = []\n (0..8).each do |el|\n this_col << board[el][col]\n end\n return false if this_col.uniq.size != 9\n end\n [-1, 2, 5].each do |xoffset|\n [-1, 2, 5].each do |yoffset|\n this_square = []\n (1..3).each do |x|\n (1..3).each do |y|\n this_square << board[x + xoffset][y + yoffset]\n end\n end\n return false if this_square.uniq.size != 9\n end\n end\n true\nend", "def external_check?(row,col)\n \n #Get values available in this block\n #------------------------------------------------------------------\n values = [@rows[row], @cols[col], @blks[find_block(row,col)]] #Values related to the section\n values = values.flatten.uniq.join.gsub(\"0\",\"\")\n values = \"123456789\".tr(values,\"\")\n \n section = []\n \n #Check row\n #Get values available in the other blocks in the current row\n #---------------------------------------------------------------------------------------------------\n 9.times do |i|\n if @rows[row][i] == \"0\"\n\tsection << internal_check(row,i) unless col==i\n end\n end\n \n section = section.join.split(\"\").sort.uniq.join.gsub(\"0\",\"\")\n values_row = values.tr(section,\"\")\n \n if values_row.length == 1\n @rows[row][col] = values_row.to_s\n adjust_values\n return true\n else\n return false\n end \n #Check column\n #Get values available in the other blocks in the current column\n #---------------------------------------------------------------------------------------------------\n 9.times do |i|\n if @rows[row][i] == \"0\"\n\tsection << internal_check(i,col) unless row==i\n end\n end\n \n section = section.join.split(\"\").sort.uniq.join.gsub(\"0\",\"\")\n \n values_col = values.tr(section,\"\")\n if values_col.length == 1\n @rows[row][col] = values_col.to_s\n adjust_values\n return true\n else\n return false\n end \n \n #Check block\n #Get values available in the other blocks in the current block\n #---------------------------------------------------------------------------------------------------\n blk = find_block(row,col)\n case blk\n when 0\n 3.times do |r|\n\t3.times do |c|\n\t section << internal_check(r-1,c-1) unless r=row and c=col\n\tend\n end\n when 1\n 3.times do |r|\n\t3.times do |c|\n\t section << internal_check(r-1,c+2) unless r=row and c=col\n\tend\n end\n when 2\n 3.times do |r|\n\t3.times do |c|\n\t section << internal_check(r-1,c+5) unless r=row and c=col\n\tend\n end\n when 3\n 3.times do |r|\n\t3.times do |c|\n\t section << internal_check(r+2,c-1) unless r=row and c=col\n\tend\n end\n when 4\n 3.times do |r|\n\t3.times do |c|\n\t section << internal_check(r+2,c+2) unless r=row and c=col\n\tend\n end\n when 5\n 3.times do |r|\n\t3.times do |c|\n\t section << internal_check(r+2,c+5) unless r=row and c=col\n\tend\n end\n when 6\n 3.times do |r|\n\t3.times do |c|\n\t section << internal_check(r+5,c-1) unless r=row and c=col\n\tend\n end\n when 7\n 3.times do |r|\n\t3.times do |c|\n\t section << internal_check(r+5,c+2) unless r=row and c=col\n\tend\n end\n else \n 3.times do |r|\n\t3.times do |c|\n\t section << internal_check(r+5,c+5) unless r=row and c=col\n\tend\n end\n end \n \n @blks[blk].each do |i|\n if @rows[row][i] == \"0\"\n\tsection << internal_check(row,i) unless col==i\n end\n end\n \n section = section.join.split(\"\").sort.uniq.join.gsub(\"0\",\"\")\n \n values_block = values.tr(section,\"\") \n if values_block.length == 1\n @rows[row][col] = values_block.to_s\n adjust_values\n return true\n else\n return false\n end \n end", "def valid_sudoku(table)\n sudoku_box_hash = { [0, 0] => {}, [0, 1] => {}, [0, 2] => {},\n [1, 0] => {}, [1, 1] => {}, [1, 2] => {},\n [2, 0] => {}, [2, 1] => {}, [2, 2] => {}}\n\n sudoku_row_hash = { 1 => {}, 2 => {}, 3 => {},\n 4 => {}, 5 => {}, 6 => {},\n 7 => {}, 8 => {}, 9 => {}}\n \n sudoku_col_hash = { 1 => {}, 2 => {}, 3 => {},\n 4 => {}, 5 => {}, 6 => {},\n 7 => {}, 8 => {}, 9 => {}}\n\n sudoku_diagonal_hash = {1 => {}, 9 => {}}\n\n table.each_with_index do |arr, i|\n arr.each_with_index do |ele, j|\n next if ele == \".\"\n # check and add diagonals\n if i == j \n return false if sudoku_diagonal_hash[1].include?(ele)\n sudoku_diagonal_hash[1][ele] = 1\n elsif i + j + 1 == 9 || i == 4 && j == 4\n return false if sudoku_diagonal_hash[9].include?(ele)\n sudoku_diagonal_hash[9][ele] = 1\n end\n\n # check these hashes for all elements\n return false if sudoku_row_hash[i + 1].include?(ele)\n return false if sudoku_col_hash[j + 1].include?(ele)\n return false if sudoku_box_hash[[i / 3, j / 3]].include?(ele)\n\n # can add if no return \n sudoku_row_hash[i + 1][ele] = 1\n sudoku_col_hash[j + 1][ele] = 1\n sudoku_box_hash[[i / 3, j / 3]][ele] = 1 # based off calculating indices of ecah sudoku box\n end\n end\n\n return true\nend", "def valid_sudoku(table)\n table.each do |row|\n row_map = {}\n row.each do |elem|\n if elem != '.'\n if row_map[elem] \n return false\n else\n row_map[elem] = 1\n end\n end\n end\n end\n \n i = 0\n 9.times do\n column_map = {}\n table.each do |row|\n col = row[i]\n if col != '.'\n if column_map[col] \n return false\n else\n column_map[col] = 1\n end\n end\n\n end\n k += 1\n end\n \n i = 0\n k = 0\n 9.times do\n box_map = {}\n while i < i + 3\n while k < k + 3\n \n end\n end \n end\n \n return true\nend", "def check_for_game_over(boards)\n #CHECKING FOR A TIE\n temp_array = []\n if boards.flatten.select { |cell| temp_array << cell if cell == \"-\" }\n if temp_array.length == 0\n puts \"This game is a tie\"\n puts \"You both suck at this game!!!\"\n puts \"GOOD-BYE!\"\n exit\n end\n end\n # CHECKING COLUMNS FOR WINNER\n if boards.transpose.map do |col|\n return true if col.join().match(/X{4}|O{4}/)\n end\n end\n # CHECKING ROWS FOR WINNER\n if boards.map do |row|\n return true if row.join().match(/X{4}|O{4}/)\n end \n end\n # CHECKING DIAGONAL UPPER LEFT TO BOTTOM RIGHT - - - - - - - - - - - -\n if temp_array = (3..6).collect { |i| boards[i][-3+i] }\n return true if temp_array.join().match(/X{4}|O{4}/)\n end\n\n if temp_array = (2..6).collect { |i| boards[i][-2+i] }\n return true if temp_array.join().match(/X{4}|O{4}/)\n end\n\n #return true if (1..6).collect { |i| boards[i][i-1] }.join().match(/X{4}|O{4}/) => refactor to this (first go around)\n if temp_array = (1..6).collect { |i| boards[i][i-1] }\n return true if temp_array.join().match(/X{4}|O{4}/)\n end\n\n if temp_array = (1..6).collect { |i| boards[i][0+i] }\n return true if temp_array.join().match(/X{4}|O{4}/)\n end\n\n if temp_array = (1..5).collect { |i| boards[i][1+i] }\n return true if temp_array.join().match(/X{4}|O{4}/)\n end\n\n if temp_array = (1..4).collect { |i| boards[i][2+i] }\n return true if temp_array.join().match(/X{4}|O{4}/)\n end\n# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n # CHECKING DIAGONAL UPPER RIGHT TO BOTTOM LEFT\n if temp_array = (1..6).collect { |i| boards[i][0-i] }\n return true if temp_array.join().match(/X{4}|O{4}/)\n end\n\n if temp_array = (2..6).collect { |i| boards[i][1-i] }\n return true if temp_array.join().match(/X{4}|O{4}/)\n end\n\n #return true if (3..6).collect { |i| boards[i][2-i] }.join().match(/X{4}|O{4}/)\n if temp_array = (3..6).collect { |i| boards[i][2-i] }\n return true if temp_array.join().match(/X{4}|O{4}/)\n end\n\n if temp_array = (1..6).collect { |i| boards[i][-1-i] }\n return true if temp_array.join().match(/X{4}|O{4}/)\n end\n\n if temp_array = (1..5).collect { |i| boards[i][-2-i] }\n return true if temp_array.join().match(/X{4}|O{4}/)\n end\n\n if temp_array = (1..4).collect { |i| boards[i][3-i] }\n return true if temp_array.join().match(/X{4}|O{4}/)\n end\n\n\nend", "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 valid_sudoku(table)\n numbers = {}\n\n # iterate through each row and confirm valid\n row = 0\n while row < table.length\n table[row].each do |value|\n return false if !check_value(numbers, value)\n end\n\n numbers = {}\n row += 1\n end\n\n # iterate through each column and confirm valid\n numbers = {}\n col = 0\n while col < table[0].length\n (0..8).each do |x|\n value = table[x][col]\n\n return false if !check_value(numbers, value)\n end\n\n numbers = {}\n col += 1\n end\n\n # create list of each sub-box's upper left corner\n corners = []\n (0..2).each do |row|\n (0..2).each do |col|\n corners << [row * 3, col * 3]\n end\n end\n\n # iterate through the list of corners to see if each value is unique within the sub-box\n numbers = {}\n index = 0\n while index < corners.length\n (0..2).each do |x|\n (0..2).each do |y|\n x_point = corners[index][0] + x\n y_point = corners[index][1] + y\n value = table[x_point][y_point]\n\n return false if !check_value(numbers, value)\n end\n end\n\n numbers = {}\n index += 1\n end\n\n return true\nend", "def check_if_all_combos_tried(row, col, forward)\n \n if @board_indicator[row][col] == 0 && @board[row][col] == 9 && row == @row_of_first_empty_square && col == @col_of_first_empty_square\n return true\n else\n return false\n end\n # if all initial holes are filled with'9', all combos were tried\n # all_combos_tried = true\n # (0..8).each do |k|\n # (0..8).each do |j|\n # if @board_indicator[k][j] == 0 && @board[k][j] < 9\n # all_combos_tried = false\n # #break\n # end\n # end\n # end\n # puts all_combos_tried\n # all_combos_tried\n end", "def sudoku_valid? grid\n \n # grid has first index for row, 2nd index for column\n \n # Check every row\n grid.each do |row|\n seen = Set.new\n (0..9).each do |row_value|\n if !seen.add?(row_value)\n return false\n end\n end\n end\n \n # Check every column\n grid.each do |row|\n seen = Set.new\n row.each do |col_value|\n if !seen.add?(col_value)\n return false\n end\n end\n end\n \n # Check every 3x3\n [0,3,6].each do |offset|\n [0,3,6].each do |offset2|\n to_check = get3by3 grid, offset, offset2\n seen = Set.new\n to_check.each do |value|\n if !seen.add?(value)\n return false\n end\n end\n end\n end\n \n \n return true\nend", "def valid\n for i in 0..(@n-1)\n for j in 0..(@m-1)\n return false if @maze_table[2*j+1][2*i+1] == \"1\"\n walls = 0\n walls += 1 if @maze_table[2*j][2*i+1] == \"1\"\n walls += 1 if @maze_table[2*j+2][2*i+1] == \"1\"\n walls += 1 if @maze_table[2*j+1][2*i+2] == \"1\"\n walls += 1 if @maze_table[2*j+1][2*i] == \"1\"\n return false if walls < 1 || walls > 3\n end\n end\n for i in 0..(@maze_table.size-1)\n return false if @maze_table[i][0] == \"0\" || @maze_table[i][2*@n] == \"0\"\n end\n for i in 0..(@maze_table[0].size-1)\n return false if @maze_table[0][i] == \"0\" || @maze_table[2*@m][i] == \"0\"\n end\n return true\n end", "def sudoku_clauses\n res = []\n\n #ensure each cell contains a digit\n (1..9).each do |i|\n (1..9).each do |j|\n #must contains at least one of 9 digits\n res << (1..9).map {|d| variable(i, j, d) }\n\n (1..9).each do |d|\n ((d+1)..9).each do |dp|\n #can not contain two digits at once\n res << [-variable(i, j, d), -variable(i, j, dp)]\n end\n end\n end\n end\n\n #ensure each rows and columns contain distinct values\n (1..9).each do |i|\n res += valid( (1..9).map{|j| [i, j]} )\n res += valid( (1..9).map{|j| [j, i]} )\n end\n\n #ensure 3x3 sub-grids regions have distinct values\n [1, 4, 7].each do |i|\n [1, 4, 7].each do |j|\n res += valid((0..8).map{|k| [i + k%3, j+k / 3]})\n end\n end\n\n res\n end", "def validate(section)\n \n #Rows, Columns or Blocks\n #--------------------------------------------------\n section.each do |i|\n check = i.sort.join.squeeze(\"0\")\n if check.length > check.split(\"\").uniq.length\n\tputs \"***************************************************\"\n\tputs \"Failed Validation, Values did not meet sudoku rules\"\n\tputs \"***************************************************\"\n\treturn false\n end\n end \n \n #Return true if all validations passed\n #--------------------------------------------------\n return true\n end", "def gridChallenge(grid)\n grid.each do |row|\n row.sort!\n end\n columns = grid.first.size\n size = grid.size\n\n \n (0..(columns - 1)).each do |col|\n list = []\n (0..(size -1)).each do |row| \n list << grid[row][col]\n end\n return 'NO' if list != list.sort\n end\n\n 'YES'\nend", "def valid_sudoku(table)\n l = table.length\n # row, time l * l\n table.each do |row|\n return false if !sudoku_helper(row)\n end\n \n # column, time l * 2l\n l.times do |i|\n column = []\n l.times do |j|\n column << table[j][i]\n end\n return false if !sudoku_helper(column)\n end\n \n # area, time l * 2l\n x = Integer.sqrt(l)\n m = n = 0\n x.times do\n x.times do \n area = []\n x.times do |i|\n area += table[n + i][m...(m+x)]\n end\n return false if !sudoku_helper(area)\n m += x\n end\n n += x\n m = 0\n end\n return true\nend", "def b_check sym \n\t\t#check rows\n\t\ti=0\n\t\twhile i<@arr.length\n\t\t\tgame_finished=true\n\t\t\tj=0\n\t\t\twhile j<@arr.length\n\t\t\t\tif @arr[i][j]!=sym\n\t\t\t\t\tgame_finished=false\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\t\tj=j+1\n\t\t\tend\n\t\t\tif game_finished\n\t\t\t\treturn game_finished\n\t\t\tend\n\t\t\ti=i+1\n\t\tend\n\t\t# check colmns\n\t\ti=0\n\t\twhile i<@arr.length\n\t\t\tgame_finished=true\n\t\t\tj=0\n\t\t\twhile j<@arr.length\n\t\t\t\tif @arr[j][i]!=sym\n\t\t\t\t\tgame_finished=false\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\t\tj=j+1\n\t\t\tend\n\t\t\tif game_finished\n\t\t\t\treturn game_finished\n\t\t\tend\n\t\t\ti=i+1\n\t\tend\n\t\t#check diagonals\n\t\ti=0\n\t\tgame_finished=true\n\t\tj=@arr.length-1\n\t\twhile i<@arr.length\n\t\t\tif @arr[i][j]!=sym\n\t\t\t\tgame_finished=false\n\t\t\t\tbreak\n\t\t\tend\n\t\t\ti=i+1\n\t\t\tj=j-1\n\t\tend\n\t\tif game_finished\n\t\t\treturn game_finished\n\t\tend\n\n\t\ti=0\n\t\tgame_finished=true\n\t\tj=0\n\t\twhile i<@arr.length\n\t\t\tif @arr[i][j]!=sym\n\t\t\t\tgame_finished=false\n\t\t\t\tbreak\n\t\t\tend\n\t\t\ti=i+1\n\t\t\tj=j+1\n\t\tend\n\t\tif game_finished\n\t\t\treturn game_finished\n\t\tend\n\t\treturn false\n\tend", "def evaluate_game(game_board)\n game_finished = false\n for i in 0..5\n \n if game_finished == true\n break\n end\n \n #Vertical and Horizontal evaluation to see if 4 are connected\n for j in 0..3\n if (game_board[i+1][j] == game_board[i+1][j+1]) && (game_board[i+1][j]==game_board[i+1][j+2]) && (game_board[i+1][j]==game_board[i+1][j+3])&&(game_board[i+1][j]==\"X\"||game_board[i+1][j]==\"O\") #rows\n puts \"User \" + game_board[i+1][j].to_s + \" wins\"\n game_finished = true\n break\n end\n end\n \n end\n \n for i in 0..6\n for j in 0..2 #columns\n if (game_board[j+1][i] == game_board[j+2][i]) && (game_board[j+1][i] == game_board[j+3][i])&&(game_board[j+1][i] == game_board[j+4][i])&&((game_board[j+1][i] == \"X\")||(game_board[j+1][i] == \"O\")) #columns\n puts \"User \" + game_board[j+1][i].to_s + \" wins\"\n game_finished = true\n break\n end\n end\n end\n \n #Evaluate if Diagonals have 4 connected\n for i in 1..6 #rows\n \n if game_finished == true\n break\n end\n \n for j in 0..6 #columns\n \n \n if (j<=3) #if it has 4 spaces to the right\n if (i>=4)#if it has 4 spaces up\n if(game_board[i][j]==game_board[i-1][j+1])&&(game_board[i][j]==game_board[i-2][j+2])&&(game_board[i][j]==game_board[i-3][j+3])&&((game_board[i][j] == \"X\")||(game_board[i][j] == \"O\"))\n puts \"User \" + game_board[i][j].to_s + \" wins\"\n game_finished = true\n break\n end\n end\n if (i<=3)#if it has 4 spaces down\n #Evalaution\n if(game_board[i][j]==game_board[i+1][j+1])&&(game_board[i][j]==game_board[i+2][j+2])&&(game_board[i][j]==game_board[i+3][j+3])&&((game_board[i][j] == \"X\")||(game_board[i][j] == \"O\"))\n puts \"User \" + game_board[i][j].to_s + \" wins\"\n game_finished = true\n break\n end\n end\n \n end\n \n \n if (j>3) #if it has 4 spaces to the left\n if (i>=4)#if it has 4 spaces up\n if(game_board[i][j]==game_board[i-1][j-1])&&(game_board[i][j]==game_board[i-2][j-2])&&(game_board[i][j]==game_board[i-3][j-3])&&((game_board[i][j] == \"X\")||(game_board[i][j] == \"O\"))\n puts \"User \" + game_board[i][j].to_s + \" wins\"\n game_finished = true\n break\n end\n end\n \n if (i<4) #if it has 4 spaces down\n #puts(\"Llega a segundo if<4\")\n if(game_board[i][j]==game_board[i+1][j-1])&&(game_board[i][j]==game_board[i+2][j-2])&&(game_board[i][j]==game_board[i+3][j-3])&&((game_board[i][j] == \"X\")||(game_board[i][j] == \"O\"))\n puts \"User \" + game_board[i][j].to_s + \" wins\"\n game_finished = true\n break\n end\n end\n \n end\n \n end\n end\n \n return game_finished\n \nend", "def check_board(board)\n for y in (0...9)\n total = 0\n for x in (0...9) \n total += board[y][x][0]\n end\n if total != 45\n puts 'Wrong total!'\n return false\n end\n end\n \n for x in (0...9)\n total = 0\n for y in (0...9) \n total += board[y][x][0]\n end\n if total != 45\n puts 'Wrong total!'\n return false\n end\n end\n \n for y in [0, 3, 6]\n for x in [0, 3, 6]\n total = 0\n for yy in (y...y+3) \n for xx in (x...x+3)\n total += board[yy][xx][0]\n end\n end\n if total != 45\n puts 'Wrong total!'\n return false \n end\n end\n end\n return true\n end", "def won?(board)\n WIN_COMBINATIONS.detect do |win_index| # \"detect\" will only return the first element that makes the block true\n # puts win_index[0] # returns 0,3,6,0,1,2,0,6\n # (all 0 index values in WIN_COMBINATIONS[0][0],[1][0],[2][0],[3][0],[4][0],[5][0],etc.)\n # puts win_index[1] # returns 1,4,7,3,4,5,4,4\n # (all 1 index values in WIN_COMBINATIONS[0][1],[1][1],[2][1],[3][1],[4][1],[5][1],etc.)\n # puts win_index[2] # returns 2,5,8,6,7,8,8,2\n # (all 2 index values in WIN_COMBINATIONS[0][2],[1][2],[2][2],[3][2],[4][2],[5][2],etc.)\n # only need three [0,1,2] \"win_index[]\" because that is the length of child arrays\n # now check the board to see if indexes contain \"X\" or \"O\"\n board[win_index[0]] == \"X\" &&\n board[win_index[1]] == \"X\" &&\n board[win_index[2]] == \"X\" ||\n board[win_index[0]] == \"O\" &&\n board[win_index[1]] == \"O\" &&\n board[win_index[2]] == \"O\" &&\n\n position_taken?(board, win_index[0])\n # position_taken? checks if win_index[0] is not nil or not equal to \" \"\n end\n end", "def verify(ans_arr, arr)\n p1 = []\n p2 = []\n [0,1,2].each do |i|\n [0,1,2].each do |j|\n if arr[i][j] == 1 \n p1.push(ans_arr[i][j])\n elsif arr[i][j] == 0\n p2.push(ans_arr[i][j]) \n end\n end\n end\n \n if p1.length == 3 \n puts \"Player entering 1 won\" if p1[p1.length-1] + p1[p1.length-2] + p1[p1.length-3] == 15\n end\n if p1.length == 4\n puts \"Player entering 1 won\" if p1[p1.length-1] + p1[p1.length-2] + p1[p1.length-4] == 15\n puts \"Player entering 1 won\" if p1[p1.length-2] + p1[p1.length-3] + p1[p1.length-4] == 15\n puts \"Player entering 1 won\" if p1[p1.length-1] + p1[p1.length-3] + p1[p1.length-4] == 15\n end\n if p1.length == 5\n puts \"Player entering 1 won\" if p1[p1.length-1] + p1[p1.length-2] + p1[p1.length-5] == 15 || \n p1[p1.length-1] + p1[p1.length-3] + p1[p1.length-5] == 15 ||\n p1[p1.length-1] + p1[p1.length-4] + p1[p1.length-5] == 15 ||\n p1[p1.length-2] + p1[p1.length-3] + p1[p1.length-5] == 15 ||\n p1[p1.length-2] + p1[p1.length-4] + p1[p1.length-5] == 15 || \n p1[p1.length-3] + p1[p1.length-4] + p1[p1.length-5] == 15 \n end\n if p2.length == 3 \n puts \"Player entering 0 won\" if p2[p2.length-1] + p2[p2.length-2] + p2[p2.length-3] == 15\n end\n if p2.length == 4\n puts \"Player entering 0 won\" if p2[p2.length-1] + p2[p2.length-2] + p2[p2.length-4] == 15\n puts \"Player entering 0 won\" if p2[p2.length-2] + p2[p2.length-3] + p2[p2.length-4] == 15\n puts \"Player entering 0 won\" if p2[p2.length-1] + p2[p2.length-3] + p2[p2.length-4] == 15\n end\n if p2.length == 5\n puts \"Player entering 0 won\" if p2[p2.length-1] + p2[p2.length-2] + p2[p2.length-5] == 15 || \n p2[p2.length-1] + p2[p2.length-3] + p2[p2.length-5] == 15 ||\n p2[p2.length-1] + p2[p2.length-4] + p2[p2.length-5] == 15 ||\n p2[p2.length-2] + p2[p2.length-3] + p2[p2.length-5] == 15 ||\n p2[p2.length-2] + p2[p2.length-4] + p2[p2.length-5] == 15 || \n p2[p2.length-3] + p2[p2.length-4] + p2[p2.length-5] == 15 \n end\nend", "def validate\n\n entireSet = Set.new([1, 2, 3, 4, 5, 6, 7, 8, 9])\n\n @rows = []\n 9.times { @rows.push(entireSet.dup) }\n\n @cols = []\n 9.times { @cols.push(entireSet.dup) }\n\n @box = []\n 3.times do\n subrow = []\n 3.times { subrow.push(entireSet.dup) }\n @box.push(subrow)\n end\n\n (0..8).each do |i|\n (0..8).each do |j|\n v = @grid[i,j]\n if v > 0\n raise \"dup number in row #{i} : #{v}\" unless @rows[i].delete?(v)\n raise \"dup number in column #{j} : #{v}\" unless @cols[j].delete?(v)\n raise \"dup number in box #{i/3}-#{j/3} : #{v}\" unless @box[i/3][j/3].delete?(v)\n end\n end\n end\n\n @poss = []\n @poss_grid = []\n (0..8).each do |i|\n poss_row = []\n (0..8).each do |j|\n if @grid[i,j] == 0 then\n p = Poss.new(i, j, @rows[i], @cols[j], @box[i/3][j/3])\n @poss.push(p)\n poss_row.push(p.to_a)\n else\n poss_row.push([])\n end\n end\n @poss_grid.push(poss_row)\n end\n @poss.sort! { |x, y| x.length <=> y.length }\n\n end", "def consistent?\n ret = true\n # Check every row first\n @board.each_row do |row|\n row_numbers = Set.new\n row.each do |cell|\n n = cell.number\n if n and row_numbers.include? n\n ret = false\n end\n row_numbers << n\n end\n end\n # Check every column\n @board.each_column do |col|\n col_numbers = Set.new\n col.each do |cell|\n n = cell.number\n if n and col_numbers.include? n\n ret = false\n end\n col_numbers << n\n end\n end\n # Check every region\n @board.each_region do |reg|\n reg_numbers = Set.new\n reg.each do |cell|\n n = cell.number\n if n and reg_numbers.include? n\n ret = false\n end\n reg_numbers << n\n end\n end\n return ret\n end", "def valid?(board_array)\n board_array.each { |row| return false if row.length != row.uniq.length }\n return true\nend", "def generate_possible_areas_for_all_numbered_tiles\n t = Time.now\n puts 'Start: Generate possible areas for all numbered tiles'\n all_possible_areas = {}\n\n # @b_nl.each_with_value do |value, i, j|\n # if value != 0 then\n # restricted_board = create_restricted_board [i,j]\n # t_area = Time.now\n # next if [i,j] == [7,1]\n # puts \"Summoning for [#{i},#{j}]\"\n # a = summon_areas([i,j], value, restricted_board)\n\n # puts \"Summoned area for [#{i},#{j}], time: \" + (Time.now - t_area).to_i.to_s + 's size ' + a.count.to_s\n # all_possible_areas[\"#{i}-#{j}\"] = a\n # end\n (0..@row_count-1).to_a.each do |i|\n (0..@col_count-1).to_a.each do |j|\n # Summon for each numbered tile(non zero)\n if @b_nl[i,j] != 0 then\n restricted_board = create_restricted_board [i,j]\n t_area = Time.now\n next if [i,j] == [7,1]\n puts \"Summoning for [#{i},#{j}]\"\n a = summon_areas([i,j],@b_nl[i,j], restricted_board)\n\n puts \"Summoned area for [#{i},#{j}], time: \" + (Time.now - t_area).to_i.to_s + 's size ' + a.count.to_s\n all_possible_areas[\"#{i}-#{j}\"] = a\n end\n end\n end\n puts 'Finish: Generate possible areas for all numbered tiles, time: ' + (Time.now - t).to_i.to_s + 'seconds'\n all_possible_areas[\"7-1\"] = [[[]]]\n all_possible_areas\n end", "def sudoku2(grid)\n \n i = 0\n \n while i < grid.length\n hash = Hash.new(0)\n j = 0\n\n while j < grid[0].length\n hash[grid[i][j]] += 1\n return false if hash[grid[i][j]] > 1 && grid[i][j] != '.'\n j += 1\n end\n i += 1\n end\n\n i = 0\n\n while i < grid[0].length\n hash = Hash.new(0)\n j = 0\n\n while j < grid.length\n hash[grid[j][i]] += 1\n return false if hash[grid[j][i]] > 1 && grid[j][i] != '.'\n j += 1\n end\n i += 1\n end\n\n true && grid_builder(grid)\nend", "def is_valid_sudoku(board)\n transposed_board = board.transpose\n board.each_with_index do |row, r_index|\n row.each_with_index do |cell, c_index|\n # check row\n # check column\n if !check_row(row, cell, c_index) || !check_row(transposed_board[c_index], cell, r_index)\n p \"False at: #{cell}, #{r_index}, #{c_index}\"\n return false\n end\n end\n end\n return true\nend", "def create_board_indicator\n @row_of_first_empty_square = 0\n @col_of_first_empty_square = 0\n first_empty_square_found = false\n board_indicator = initialize_empty_board\n (MIN_ROW_POSITION..MAX_ROW_POSITION).each do |j| \n (MIN_COL_POSITION..MAX_COL_POSITION).each do |i|\n #board_indicator[j][i] = 1 if (@board[j][i] != 0 && @board[j][i] != '')\n if (@board[j][i] == 0 || @board[j][i] == '')\n if !first_empty_square_found\n puts 'first empty'\n first_empty_square_found = true\n @row_of_first_empty_square = j\n @col_of_first_empty_square = i\n end\n else\n board_indicator[j][i] = 1\n end\n end\n end\n board_indicator\n end", "def check_rows(piece, arr)\n arr.each do |row|\n row.each_cons(4).each do |combination|\n return true if combination.all? { |a| a == piece }\n end\n end\n false\n end", "def check_diagonal\n RulesContracts.classic_model(@game_state_model)\n # testing for bitboard errors\n # (0..7).each { |y|\n # (0..7).each { |x|\n # if @grid[y][x] == 1 and y <= 4 and x >= 3\n # puts \" #{x}/#{y} #{@grid[y][x]} || #{x-1}/#{y+1} #{@grid[y + 1][x - 1]} || #{x-2}/#{y+2} #{@grid[y + 2][x - 2]} || #{x-3}/#{y+3} #{@grid[y + 3][x - 3]}\"\n # puts \"#{@grid[y][x] == 1 and @grid[y + 1][x - 1] == 1 and @grid[y + 2][x - 2] == 1 and @grid[y + 3][x - 3] == 1}\"\n # end\n # }\n # }\n \n (0..7).each { |y|\n (0..7).each { |x|\n if y <= 4 and x <= 4\n if @grid[y][x] == 2 and @grid[y + 1][x + 1] == 2 and @grid[y + 2][x + 2] == 2 and @grid[y + 3][x + 3] == 2\n @winner = 1\n return true\n elsif @grid[y][x] == 1 and @grid[y + 1][x + 1] == 1 and @grid[y + 2][x + 2] == 1 and @grid[y + 3][x + 3] == 1\n @winner = 0\n return true\n end \n end\n if y <= 4 and x >= 3\n if @grid[y][x] == 2 and @grid[y + 1][x - 1] == 2 and @grid[y + 2][x - 2] == 2 and @grid[y + 3][x - 3] == 2\n @winner = 1\n return true\n elsif @grid[y][x] == 1 and @grid[y + 1][x - 1] == 1 and @grid[y + 2][x - 2] == 1 and @grid[y + 3][x - 3] == 1\n @winner = 0\n return true\n end\n end\n if y >= 3 and x <= 4\n if @grid[y][x] == 2 and @grid[y - 1][x + 1] == 2 and @grid[y - 2][x + 2] == 2 and @grid[y - 3][x + 3] == 2\n @winner = 1\n return true\n elsif @grid[y][x] == 1 and @grid[y - 1][x + 1] == 1 and @grid[y - 2][x + 2] == 1 and @grid[y - 3][x + 3] == 1\n @winner = 0\n return true\n end \n end\n if y >= 3 and x >= 3\n \n if @grid[y][x] == 2 and @grid[y - 1][x - 1] == 2 and @grid[y - 2][x - 2] == 2 and @grid[y - 3][x - 3] == 2\n @winner = 1\n return true\n elsif @grid[y][x] == 1 and @grid[y - 1][x - 1] == 1 and @grid[y - 2][x - 2] == 1 and @grid[y - 3][x - 3] == 1\n @winner = 0\n return true\n end \n \n end \n }\n }\n return false\n end", "def won?(board)\n WIN_COMBINATIONS.detect do |win_index| # \"detect\" will only return the first element that makes the block true\n# puts win_index[0] # returns 0,3,6,0,1,2,0,6\n# (all 0 index values in WIN_COMBINATIONS[0][0],[1][0],[2][0],[3][0],[4][0],[5][0],etc.)\n# puts win_index[1] # returns 1,4,7,3,4,5,4,4\n# (all 1 index values in WIN_COMBINATIONS[0][1],[1][1],[2][1],[3][1],[4][1],[5][1],etc.)\n# puts win_index[2] # returns 2,5,8,6,7,8,8,2\n# (all 2 index values in WIN_COMBINATIONS[0][2],[1][2],[2][2],[3][2],[4][2],[5][2],etc.)\n# only need three [0,1,2] \"win_index[]\" because that is the length of child arrays\n# now check the board to see if indexes contain \"X\" or \"O\"\n board[win_index[0]] == \"X\" &&\n board[win_index[1]] == \"X\" &&\n board[win_index[2]] == \"X\" ||\n board[win_index[0]] == \"O\" &&\n board[win_index[1]] == \"O\" &&\n board[win_index[2]] == \"O\" &&\n\n position_taken?(board, win_index[0])\n# position_taken? checks if win_index[0] is not nil or not equal to \" \"\n end\nend", "def square_arrays\n squares = []\n org_row = 0\n org_col = 0\n (0..8).each do |i|\n squares[i] = []\n (org_row..org_row+2).each do |k|\n (org_col..org_col+2).each do |j|\n squares[i].push(@board[k][j])\n end \n end\n if org_row == 6\n org_col += 3 \n org_row = 0\n else\n org_row += 3 \n end\n end \n squares\n end", "def initialize_board(input)\n board = Array.new(9) {Array.new(9) {Array.new(10, 0)}}; \n for y in (0...9)\n for x in (0...9)\n board[y][x][0] = Integer(input[y*9+x]) \n for p in (1...10)\n if board[y][x][0] == 0\n board[y][x][p] = p\n else\n board[y][x][p] = 0\n end\n end\n end\n end\n return board\n end", "def validate_grid(array, element, row, column, array2)\n row = row - 1\n column = column - 1\n set_flag_row = validate_row(array, element, row)\n print \"\\n Row =>#{set_flag_row} \" #1 element found row\n set_flag_column = validate_column(array, element, column)\n print \"\\n Column => #{set_flag_column} \" #1 element found in column\n set_flag_grid = validate_matrix(array, element, row, column)\n print \"\\n Grid =>#{set_flag_grid} \"\n set_flag_state = validate_state(array, row, column, array2)\n print \"\\n state =>#{set_flag_state}\\n\"\nend", "def guessing_method\n smallest_num_of_possibilities = 9\n\n loop_board do |cell|\n smallest_num_of_possibilities = cell.possibilities.length if cell.possibilities.length < smallest_num_of_possibilities && cell.content.is_a?(Array)\n end\n\n loop_board do |cell|\n if cell.possibilities.length == smallest_num_of_possibilities\n cell.possibilities.each do |guess_value|\n\n guessing_board_copy = Marshal.load(Marshal.dump(self))\n guessing_board_copy.full_board[cell.tri_square_index][cell.square_index][cell.tri_cell_index][cell.cell_index].content = guess_value\n guessing_board_copy.full_board[cell.tri_square_index][cell.square_index][cell.tri_cell_index][cell.cell_index].possibilities = []\n\n if guessing_board_copy.solve!\n self.full_board = guessing_board_copy.full_board\n return guessing_board_copy\n end\n end\n return false\n end\n end\n end", "def solved?(board)\n board.all? { |row| row.flatten.length == 9 && row.sort == [1,2,3,4,5,6,7,8,9] }\nend", "def init_truth(array, width)\r\n row = 0 # used to keep track of which row currently accessing\r\n column = 0 # used to keep track of which column currently accessing\r\n size = width - 1 # used to keep track of how many T/F values to place\r\n height = 2 ** width # used to know when to break inner for loop\r\n while column < width # iterate through one column at a time\r\n iterations = 2** size # used to set number of true values to place in row\r\n second_iteration = 0 # used to set number of false values to place\r\n while row < height # while not at end of column\r\n if iterations > 0 # if iterations less than 0, set to true\r\n array[row][column] = 1 # setting current index to true\r\n iterations = iterations - 1 # decrement number of true values left to place\r\n row = row + 1 # increment row currently in\r\n second_iteration = 2** size if iterations == 0 # if no more trues to place, set how many falses to place\r\n else # set false values\r\n array[row][column] = 0 # setting current index to false\r\n second_iteration = second_iteration - 1 # decrement number of false values left to place\r\n row = row + 1 # increment row currently in\r\n iterations = 2** size if second_iteration == 0 # if no more false values to place, set how many trues to place\r\n end\r\n end # end of inner while loop\r\n column = column + 1 # increment column\r\n size = size - 1 # decrement size to decrement number of t/f's to place in a column\r\n row = 0 # reset row # go back to top row\r\n end # end of outter while loop\r\nend", "def validate_position(board, row, col, number)\n position_row = row\n position_col = col\n # Checks the row to ensure there's no duplicate while also checking the column to ensure there's no duplicate.\n for val in 0...9 do\n if board[val][position_col] == number || board[position_row][val] == number\n return false\n end\n end\n\n # Defining the boundaries of the block that the given position falls into...\n block_row_min = position_row / 3 * 3 # Abusing integer division to get the lower bound for the rows.\n block_row_max = block_row_min + 3 # Max is just 3 higher than that.\n block_col_min = position_col / 3 * 3 # Abusing integer division to get the lower bound for the columns.\n block_col_max = block_col_min + 3 # Max is just 3 higher than that.\n\n # Checks that the given position is valid, given the dimensions calculated above...\n for row in block_row_min...block_row_max do\n for col in block_col_min...block_col_max do # Simple double for-loop with an if statement.\n if board[row][col] == number\n return false\n end\n end\n end\n return true\n end", "def fits(placement)\n case placement.length\n when 2\n return false if placement[0][0] + placement[1][2] != 0\n when 3\n return false if placement[1][1] + placement[2][3] != 0\n when 4\n return false if placement[2][2] + placement[3][0] != 0\n return false if placement[3][3] + placement[0][1] != 0\n when 5\n return false if placement[3][2] + placement[4][0] != 0\n when 6\n return false if placement[4][3] + placement[5][1] != 0\n return false if placement[5][0] + placement[0][2] != 0\n when 7\n return false if placement[5][3] + placement[6][1] != 0\n when 8\n return false if placement[6][0] + placement[7][2] != 0\n return false if placement[7][1] + placement[0][3] != 0\n when 9\n return false if placement[7][0] + placement[8][2] != 0\n return false if placement[8][1] + placement[1][3] != 0\n end\n return true\nend", "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_locations(r, c)\n positions = []\n #top row\n positions << [r - 1, c - 1]\n positions << [r - 1, c]\n positions << [r - 1, c + 1]\n\n #center row\n positions << [r, c-1]\n positions << [r, c + 1]\n\n #bottom row\n positions << [r + 1, c - 1]\n positions << [r + 1, c]\n positions << [r + 1, c + 1]\n \n #array boundry Check on the list of positions to find those that are on the board\n positions.delete_if {|v| v[0] < 0 || v[0] >= row}.delete_if{|v| v[1] < 0 || v[1] >= column}\n return positions\n end", "def _board_logic_checker(arrays_to_check)\n arrays_to_check.each do |sub_array|\n if !sub_array.sort.eql?([1,2,3,4,5,6,7,8,9])\n return false\n end\n end\n true\n end", "def check_win(player,grid,coordinates)\n win = false\n win_array = []\n play_row = coordinates[0]\n play_col = coordinates[1]\n\n # horizontal checking\n grid[play_row].each_index do | col |\n if win_array.length != 4\n if grid[play_row][col] == player\n win_array.push([play_row,col])\n else\n win_array = []\n end\n end\n end\n\n if win_array.length == 4\n win = true\n end\n\n # vertical checking\n if win == false\n\n win_array = []\n\n grid.each_index do | row |\n if win_array.length != 4\n if grid[row][play_col] == player\n win_array.push([row,play_col])\n else\n win_array = []\n end\n end\n end\n\n if win_array.length == 4\n win = true\n end\n end\n\n # diagonal checking SW to NE\n if win == false\n\n win_array = []\n row = play_row\n col = play_col\n\n # finds SW-most position in same diagonal line as most recently played piece\n # this is the starting point we check from\n until col == 0 || row == 7\n row += 1\n col -= 1\n end\n\n until col > 7 || row < 0\n if win_array.length != 4\n if grid[row][col] == player\n win_array.push([row,col])\n else\n win_array = []\n end\n end\n row -= 1\n col += 1\n end\n\n if win_array.length == 4\n win = true\n end\n end\n\n # diagonal checking NW to SE\n if win == false\n\n win_array = []\n row = play_row\n col = play_col\n\n # finds NW-most position in same diagonal line as most recently played piece\n # this is the starting point we check from\n until col == 0 || row == 0\n row -= 1\n col -= 1\n end\n\n until col > 7 || row > 7\n if win_array.length != 4\n if grid[row][col] == player\n win_array.push([row,col])\n else\n win_array = []\n end\n end\n row += 1\n col += 1\n end\n\n if win_array.length == 4\n win = true\n end\n end\n\n # winning four-in-a-row briefly \"flashes\" to show where it is\n if win == true\n flash_count = 0\n while flash_count < 4\n #flashing animation\n win_array.each do | element |\n grid[element[0]][element[1]] = \"@\"\n end\n print_board(grid)\n sleep(0.2)\n win_array.each do | element |\n grid[element[0]][element[1]] = player\n end\n print_board(grid)\n sleep(0.2)\n flash_count += 1\n end\n end\n\n return win\nend", "def potential_wins(x,some_array) \n currentboard_array = view_currentboard(some_array)\n rows = currentboard_array[0]\n cols = currentboard_array[1]\n diag1 = currentboard_array[2]\n diag2 = currentboard_array[3]\n \n if (sum_array(rows[0]) == x) && (rows[0].include?nil) \n some_array[0][rows[0].index(nil)] = 10\n elsif (sum_array(rows[1]) == x) && (rows[1].include?nil)\n some_array[1][rows[1].index(nil)] = 10\n elsif (sum_array(rows[2])== x) && (rows[2].include?nil)\n some_array[2][rows[2].index(nil)] = 10\n\t\n elsif (sum_array(cols[0])== x) && (cols[0].include?nil) && (some_array[cols[0].index(nil)][0] == nil)\n some_array[cols[0].index(nil)][0] = 10\n elsif (sum_array(cols[1])== x) && (cols[1].include?nil) && (some_array[cols[1].index(nil)][1] == nil)\n some_array[cols[1].index(nil)][1] = 10\n elsif (sum_array(cols[2])== x) && (cols[2].include?nil) && (some_array[cols[2].index(nil)][2] == nil)\n some_array[cols[2].index(nil)][2] = 10\n\t\n elsif (sum_array(diag1) == x) && (diag1.include?nil) && (some_array[diag1.index(nil)][diag1.index(nil)] == nil)\n some_array[diag1.index(nil)][diag1.index(nil)] = 10\n \n elsif sum_array(diag2) == x\n\t if diag2.index(nil) == 0\n some_array[0][2] = 10\n\t elsif diag2.index(nil) == 1\n\t some_array[1][1] = 10\n\t elsif diag2.index(nil) == 2\n\t some_array[2][0] = 10\n\t end\n end \n\t\n some_array\n\t\n end", "def row_checker(puzzle_digit_location_hash)\n for i in 0...ROW_LENGTH\n current_row = row_selector(i, puzzle_digit_location_hash)\n current_row_digits = digit_selector(current_row)\n current_row_digits.size == current_row_digits.uniq.size ? solution_okay = true : solution_okay = false\n break if solution_okay == false\n end\n solution_okay\n end", "def check_row\n @winner = false\n @code_breaker_guess = @game_row_update\n @code_breaker_guess.each {|n| n.upcase!}\n @code_maker_solution = @hidden_row\n @code_maker_solution.each {|n| n.upcase!}\n @result = []\n\n @black_counter = 0\n @white_counter = 0\n @no_counter = 0\n\n for num in 0..3\n if (@code_maker_solution.include? @code_breaker_guess[num]) && (@code_breaker_guess[num] == @code_maker_solution[num])\n @black_counter += 1\n if @black_counter == 4\n @winner = true\n end\n elsif\n (@code_maker_solution.include? @code_breaker_guess[num]) && (@code_breaker_guess[num] != @code_maker_solution[num])\n @white_counter += 1\n else\n @no_counter += 1\n end\n end\n\n #puts \"Number black: #{@black_counter}\"\n #puts \"Number white: #{@white_counter}\"\n\n for bc in 0...@black_counter\n @result.push(\"B\")\n end\n\n for wc in 0...@white_counter\n @result.push(\"W\")\n end\n\n for nc in 0...@no_counter\n @result.push(\"-\")\n end\n\n #puts \" \"\n #puts \"Result Matrix: #{@result}\"\n puts \" \"\n\n end", "def sudoku(rows)\n # constrain the non-zero elements to keep their current values, and\n # constrain the zero elements (i.e. the blanks) to be between 1 and 9\n constrain_each_row(rows)\nend", "def create_grid(board_array)\n\t# split into triplets\n\ttriplets_array = []\n board_array.each { |array| triplets_array << array.each_slice(3).to_a }\n\n # shuffle the triplets\n shuffle_container = [[], [], []]\n 9.times do |row|\n 3.times do |column|\n current_array = triplets_array[row][column]\n shuffle_container[column] << current_array\n end\n end\n\n # flatten and re-split\n final_array = []\n shuffle_container.flatten.each_slice(9) { |array| final_array << array }\n\n return final_array\nend", "def valid_cells(array)\n array.delete_if do |coord| \n !board.valid_coordinate?(coord) || !board.board_hash[coord].empty?\n end\n end", "def check_row\n @num_row.times do |row|\n consecutive = 0\n curr_tile = @board[row][0]\n @num_col.times do |col|\n if curr_tile == @board[row][col]\n next unless @board[row][col] #skip over empty tiles before the first non-empty\n consecutive += 1\n return true if consecutive == 4\n else\n curr_tile = @board[row][col]\n consecutive = 1\n end\n end\n end\n false\n end", "def double_whammer(sudoku_cells)\n\n # 1. obtain the lists of cells that still need a value\n # 2. for each cell in the list look for other cells\n # which are in the same row, column or subgrid\n # that has the same potential values\n # 3. if such cells are found, remove from other\n # cells all those values from them\n working_list = get_working_list(sudoku_cells)\n\n #Those that are of the same row/column/subgrid\n #check if any of them has the same potential values\n working_list.each do |cell_a|\n check_list = working_list.find_all do |cell_b| \n !cell_a.eql?(cell_b) && (cell_a.row == cell_b.row || cell_a.column == cell_b.column || cell_a.same_subgrid?(cell_b))\n end\n \n check_list.each do |cell|\n if cell_a.same_potential?(cell)\n #if the match is found on the same row\n if cell_a.row == cell.row\n sudoku_cells[cell_a.row].each do |x|\n if x.value.zero? && !x.eql?(cell_a) && !x.eql?(cell)\n cell_a.potential_value_stack.each {|v| x.potential_value_stack.delete(x)}\n end\n end\n elsif cell_a.column == cell.column\n i = 0\n until i >= sudoku_cells.size do\n cell_a.potential_value_stack.each do |v|\n if !sudoku_cells[i][cell_a.column].eql?(cell_a) && !sudoku_cells[i][cell_a.column].eql?(cell)\n sudoku_cells[i][cell_a.column].potential_value_stack.delete(v)\n end\n end\n i += 1\n end\n elsif cell_a.same_subgrid?(cell)\n cell_a.block_family.each do |indexes|\n if !sudoku_cells[indexes[0]][indexes[1]].eql?(cell_a) && !sudoku_cells[indexes[0][1]].eql?(cell)\n cell_a.potential_value_stack.each do |v|\n sudoku_cells[indexes[0]][indexes[1]].potential_value_stack.delete(v)\n end\n end\n end\n end\n end\n end\n end\n\n # working_list.each do |cell|\n # puts \"[#{cell.row}, #{cell.column}]\"\n # end\n # puts \"Working list: #{working_list.size}\"\n # binding.pry\nend", "def minesweeper(matrix)\n height = matrix.count - 1\n width = matrix[0].count - 1\n\n finalArray = Array.new\n \n for i in 0..height\n temp = Array.new\n for j in 0..width\n temp << check33(matrix, j, i)\n end\n finalArray << temp\n end\n finalArray\nend", "def check_if_over(game_array)\n if game_array[0][0] == game_array[1][0] && game_array[0][0] == game_array[2][0]\n return true\n elsif game_array[0][1] == game_array[1][1] && game_array[0][1] == game_array[2][1]\n return true\n elsif game_array[0][2] == game_array[1][2] && game_array[0][2] == game_array[2][2]\n return true\n elsif game_array[0][0] == game_array[0][1] && game_array[0][0] == game_array[0][2]\n return true\n elsif game_array[1][0] == game_array[1][1] && game_array[1][0] == game_array[1][2]\n return true\n elsif game_array[2][0] == game_array[2][1] && game_array[2][0] == game_array[2][2]\n return true\n elsif game_array[0][0] == game_array[1][1] && game_array[0][0] == game_array[2][2]\n return true\n elsif game_array[1][2] == game_array[1][1] && game_array[1][2] == game_array[2][0]\n return true\n else\n return false\n end\nend", "def check_game_status (some_array) \n include StrategyTools\n \n currentboard_array = view_currentboard(some_array)\n rows = currentboard_array[0]\n cols = currentboard_array[1]\n diag1 = currentboard_array[2]\n diag2 = currentboard_array[3]\n\t\n\t\n check = 0 \n \n #user win?\n if (sum_array(rows[0])) == 3 || (sum_array(rows[1])) == 3 || (sum_array(rows[2])) == 3 then check = 1 \n\telsif (sum_array(cols[0])) == 3 || (sum_array(cols[1])) == 3 || (sum_array(cols[2])) == 3 then check = 1 \n\telsif ((sum_array(diag1)) == 3) then check = 1 \n\telsif ((sum_array(diag2)) == 3) then check = 1\n \n\n #computer win?\n elsif (sum_array(rows[0])) == 30 || (sum_array(rows[1])) == 30 || (sum_array(rows[2])) == 30 then check = 10 \n elsif (sum_array(cols[0])) == 30 || (sum_array(cols[1])) == 30 || (sum_array(cols[2])) == 30 then check = 10 \n elsif ((sum_array(diag1)) == 30) then check = 10 \n elsif ((sum_array(diag2)) == 30) then check = 10 \n \n\t\n\t#full board/no win\n\telsif sum_array_of_arrays(some_array) >= 45 then check = 2\n end\n \n check \n \n end", "def validate_partition_regions(partition, r_num_cells)\n r_num_cells_sorted = r_num_cells.sort\n p_num_cells = Array.new(r_num_cells.length, 0)\n for i in 0...partition.length do\n p_num_cells[partition[i]] += 1\n end\n p_num_cells_sorted = p_num_cells.sort\n for i in 0...p_num_cells_sorted.length do\n if r_num_cells_sorted[i] < p_num_cells_sorted[i]\n return false\n end\n end\n return true\nend", "def default_grid\n array = Array.new(8) { Array.new(8) }\n\n array[0][0] = Rook.new('white', [0,0], 'slide')\n array[1][0] = Knight.new('white', [1,0], 'step')\n array[2][0] = Bishop.new('white', [2,0], 'slide')\n array[3][0] = Queen.new('white', [3,0], 'slide')\n array[4][0] = King.new('white', [4,0], 'step')\n array[5][0] = Bishop.new('white', [5,0], 'slide')\n array[6][0] = Knight.new('white', [6,0], 'step')\n array[7][0] = Rook.new('white', [7,0], 'slide')\n array[0..7].each_with_index { |column, index| \n column[1] = Pawn.new('white', [index,1], 'step') }\n\n array[0][7] = Rook.new('black', [0,7], 'slide')\n array[1][7] = Knight.new('black', [1,7], 'step')\n array[2][7] = Bishop.new('black', [2,7], 'slide')\n array[3][7] = Queen.new('black', [3,7], 'slide')\n array[4][7] = King.new('black', [4,7], 'step')\n array[5][7] = Bishop.new('black', [5,7], 'slide')\n array[6][7] = Knight.new('black', [6,7], 'step')\n array[7][7] = Rook.new('black', [7,7], 'slide')\n array[0..7].each_with_index { |column, index| \n column[6] = Pawn.new('black', [index,6], 'step') }\n\n array\n end", "def valid_rows?\n valid = true\n row = 0\n while (row < @board.length && valid)\n valid = false if !unique_arr?(@board[row])\n row += 1\n end\n valid\n end", "def check_board\n\n # starting at top left, check top row, diagonal and left column\n if ( ($game_board[0][0] == $game_board[0][1] && $game_board[0][0] == $game_board[0][2]) ||\n ($game_board[0][0] == $game_board[1][1] && $game_board[0][0] == $game_board[2][2]) ||\n ($game_board[0][0] == $game_board[1][0] && $game_board[0][0] == $game_board[2][0]) )\n $winner = $game_board[0][0] \n\n # starting at top middle, check middle column\n elsif ($game_board[0][1] == $game_board[1][1] && $game_board[0][1] == $game_board[2][1])\n $winner = $game_board[0][1]\n\n #starting at top right, check right column and diagonal\n elsif (($game_board[0][2] == $game_board[1][2] && $game_board[0][2] == $game_board[2][2]) ||\n ($game_board[0][2] == $game_board[1][1] && $game_board[0][2] == $game_board[2][0]))\n $winner = $game_board[0][2]\n\n #starting at middle left, check middle row\n elsif ($game_board[1][0] == $game_board[1][1] && $game_board[1][0] == $game_board[1][2])\n $winner = $game_board[1][0]\n\n #starting at bottom left, check bottom row\n elsif ($game_board[2][0] == $game_board[2][1] && $game_board[2][0] == $game_board[2][2])\n $winner = $game_board[2][0]\n end\n \n if $winner\n puts $winner.to_s + \" wins!\" \n exit\n end\n \n #if we don't have a winner at this point, and all the spaces are filled (not nil), then it's a tie\n if $game_board.flatten.all?\n puts \"It's a tie!\"\n exit\n end\n \nend", "def solve_sudoku(board, empty_positions)\n i = 0\n\n while i < empty_positions.length\n rrow = empty_positions[i][0]\n ccolumn = empty_positions[i][1]\n number = board[rrow][ccolumn] + 1\n found = false\n\n while !found && number <= 9\n if check_value(board, rrow, ccolumn, number)\n found = true\n board[rrow][ccolumn] = number\n i += 1\n else\n number += 1\n end\n end\n\n if !found\n board[rrow][ccolumn] = 0\n i -= 1\n end\n end\n \n board\nend", "def check_matches\n #check for horizontal matches\n match_found = false \n for i in (0..@width-3)\n for j in (0..@height-1)\n if (@board[i][j] and @board[i+1][j] and @board[i+2][j] and \n @board[i][j].color == @board[i+1][j].color and @board[i][j].color == @board[i+2][j].color)\n @board[i][j].marked = @board[i+1][j].marked = @board[i+2][j].marked = true\n match_found = true\n end\n end\n end\n #check for vertical matches\n for i in (0..@width-1)\n for j in (0..@height-3)\n if (@board[i][j] and @board[i][j+1] and @board[i][j+2] and \n @board[i][j].color == @board[i][j+1].color and @board[i][j].color == @board[i][j+2].color)\n @board[i][j].marked = @board[i][j+1].marked = @board[i][j+2].marked = true\n match_found = true\n end\n end\n end\n\n return match_found \n end", "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 all_valid\n # Check the vertical\n @size.times { |i|\n if !valid_column(i)\n return false\n end\n }\n\n # Check the diagonal\n @size.times { |i|\n if !valid_diagonal(true, true, i)\n return false\n end\n if !valid_diagonal(true, false, i)\n return false\n end\n if !valid_diagonal(false, true, i)\n return false\n end\n if !valid_diagonal(false, false, i)\n return false\n end\n }\n\n # Check the horizontal\n @size.times { |i|\n if !valid_row(i)\n return false\n end\n }\n\n return true\n end", "def check_row_availability_for_square(row, col)\n possible_for_row = []\n (0..8).each do |i|\n if (self[row, i].is_a? Element) && i != col\n possible_for_row |= calculate_possible_numbers_for_square(row, i)\n end\n end\n self[row, col].possibleNumbers - possible_for_row\n end", "def check_columns\n column_winner = nil\n\n # index in arrays will be representations of board column\n x_arr =[]\n o_arr =[]\n # arrays will be the size of the board default value for each column will be 0\n @board.size.times do\n x_arr << 0\n o_arr << 0\n end\n\n # updates amount in x or o array as a column based on marker = x or o\n @board.each do |row|\n row.each_with_index do |marker, index|\n if marker == 'x'\n x_arr[index] += 1\n # checks if winner to break out of loop\n if x_arr[index] == @board.size\n column_winner = 'x'\n break\n end\n elsif marker == 'o'\n o_arr[index] += 1\n # checks if winner to break out of loop\n if o_arr[index] == @board.size\n column_winner = 'o'\n break\n end\n end\n\n end\n end\n\n column_winner\n end", "def generateBoard(row, col, num_mines)\n# Step 1 create board\n board = Array.new(row) { Array.new(col) {-1}}\n# Step 2 place random mines on board\n until num_mines < 1\n temp_x = rand(row)\n temp_y = rand(col)\n \n if board[temp_x][temp_y] != \"*\"\n board[temp_x][temp_y] = \"*\" \n num_mines -= 1 \n end\n end\n \n# Step 3 Iterate each tile skipping mines\n board.each_index do |x|\n board.each_index do |y|\n next if board[x][y] == \"*\"\n count = 0\n \n # Step 3a\n # check within bounds and count mines\n min_x = x - 1\n max_x = x + 1\n min_y = y - 1\n max_y = y + 1\n \n (min_x..max_x).each do |x|\n (min_y..max_y).each do |y|\n if (x >= 0 && x < row) && (y >= 0 && y < col)\n count += 1 if board[x][y] == \"*\"\n end\n end\n end\n \n board[x][y] = count\n end\n end\n \n # return board\n board\nend", "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 check(position)\n puts position\n case position\n when 1\n if @board[0][0] == @board[0][1] and @board[0][0] == @board[0][2]\n return true\n elsif @board[0][0] == @board[1][0] and @board[0][0] == @board[2][0]\n return true\n elsif @board[0][0] == @board[1][1] and @board[0][0] == @board[2][2]\n return true\n else return false\n end\n when 2\n if @board[0][1] == @board[0][0] and @board[0][1] == @board[0][2]\n return true\n elsif @board[0][1] == @board[1][1] and @board[0][1] == @board[2][1]\n return true\n else return false\n end\n when 3\n if @board[0][2] == @board[0][1] and @board[0][2] == @board[0][0]\n return true\n elsif @board[0][2] == @board[1][2] and @board[0][2] == @board[2][2]\n return true\n elsif @board[0][2] == @board[1][1] and @board[0][2] == @board[2][0]\n return true\n else return false\n end\n when 4\n if @board[1][0] == @board[0][0] and @board[1][0] == @board[2][0]\n return true\n elsif @board[1][0] == @board[1][1] and @board[1][0] == @board[1][2]\n return true\n else return false\n end\n when 5\n if @board[1][1] == @board[0][0] and @board[1][1] == @board[2][2]\n return true\n elsif @board[1][1] == @board[1][0] and @board[1][1] == @board[1][2]\n return true\n elsif @board[1][1] == @board[0][1] and @board[1][1] == @board[2][1]\n return true\n elsif @board[1][1] == @board[0][2] and @board[1][1] == @board[2][0]\n return true\n else return false\n end\n when 6\n if @board[1][2] == @board[0][2] and @board[1][2] == @board[2][2]\n return true\n elsif @board[1][2] == @board[1][0] and @board[1][2] == @board[1][1]\n return true\n else return false\n end\n when 7\n if @board[2][0] == @board[0][0] and @board[2][0] == @board[1][0]\n return true\n elsif @board[2][0] == @board[1][1] and @board[2][0] == @board[0][2]\n return true\n elsif @board[2][0] == @board[2][1] and @board[2][0] == @board[2][2]\n return true\n else return false\n end\n when 8\n if @board[2][1] == @board[2][0] and @board[2][1] == @board[2][2]\n return true\n elsif @board[2][1] == @board[0][1] and @board[2][1] == @board[1][1]\n return true\n else return false\n end\n when 9\n if @board[2][2] == @board[2][0] and @board[2][2] == @board[2][1]\n return true\n elsif @board[2][2] == @board[0][0] and @board[2][2] == @board[1][1]\n return true\n elsif @board[2][2] == @board[0][2] and @board[2][2] == @board[1][2]\n return true\n else return false\n end\n else\n puts \"Error: Switch has a bug\"\n end\n end", "def generate_pieces(trim: true)\n piece_matrixes = []\n\n while matrix.any? { |v| v == false }\n piece_matrix = Matrix3D.from_dimensions(width, height, depth, false)\n next_piece_index = piece_matrixes.size\n\n # Get initial position\n coords = find_initial_coordinates\n\n piece_matrix.set(*coords, true)\n # Record the piece index in the matrix. Makes it easier\n # to merge small pieces into adjacent pieces.\n matrix.set(*coords, next_piece_index)\n unblocked_positions = []\n add_new_position(unblocked_positions, coords)\n\n piece_length = 1\n\n while piece_length <= max_length && unblocked_positions.any?\n # Use the most recent block 70% of the time\n # Actually it looks much cooler if we do this 100% of the time.\n position_index = unblocked_positions.size - 1\n # if rng.rand(10) < 7\n # unblocked_positions.size - 1\n # else\n # unblocked_positions.size.times.to_a.sample(random: rng)\n # end\n position = unblocked_positions[position_index]\n # Update the available moves\n position[:available_moves] = available_moves(position[:coords], matrix)\n if position[:available_moves].empty?\n # No available moves, so delete this position\n unblocked_positions.delete_at(position_index)\n next\n end\n\n # Pick a random move\n x, y, z = position[:available_moves].sample(random: rng)\n piece_matrix.set(x, y, z, true)\n matrix.set(x, y, z, next_piece_index)\n add_new_position(unblocked_positions, [x, y, z])\n piece_length += 1\n end\n\n piece_matrixes << piece_matrix\n end\n\n # Merge small pieces into adjacent pieces\n loop do\n piece_index = piece_matrixes.find_index do |m|\n m && m.count { |v| v == true } < min_length\n end\n break unless piece_index\n\n piece_matrix = piece_matrixes[piece_index]\n\n # Choose a random piece with an adjacent block\n directions = [\n [0, 1], [1, 1], [2, 1], [0, -1], [1, -1], [2, -1]\n ]\n loop do\n raise 'Directions should never be empty!' if directions.empty?\n\n direction = directions.sample(random: rng)\n directions.delete(direction)\n\n # puts \"Direction: #{direction}\"\n\n coord = piece_matrix.find_coord { |v| v == true }.map(&:dup)\n\n # puts \"Coordinate: #{coord}\"\n\n adjacent_piece_index = piece_index\n loop do\n coord[direction[0]] += direction[1]\n # puts \"==========> #{coord}\"\n\n # Keep going until we hit the boundary\n break unless matrix.within_bounds?(*coord)\n\n adjacent_piece_index = matrix.get(*coord)\n\n # Keep going until we leave this piece\n break if adjacent_piece_index != piece_index\n end\n\n next if adjacent_piece_index == piece_index\n\n adjacent_piece = piece_matrixes[adjacent_piece_index]\n\n # Add this piece's blocks to the adjacent piece\n piece_matrix.each do |value, xa, ya, za|\n next unless value == true\n\n adjacent_piece.set(xa, ya, za, true)\n\n # Update the index in the main matrix\n matrix.set(xa, ya, za, adjacent_piece_index)\n end\n\n break\n end\n\n # Important - Don't delete the pieces! This screws up the\n # indexes in the matrix. Just set them to nil\n piece_matrixes[piece_index] = nil\n end\n\n piece_matrixes.each do |pm|\n next if pm.nil?\n\n unless trim\n pieces << [[0, 0, 0], pm]\n next\n end\n\n # Trim the matrix down to the minimum size.\n trim_result = pm.trim(true)\n\n # Use the offset as the piece position\n pieces << [trim_result[:offset], trim_result[:matrix]]\n end\n\n # binding.pry\n\n pieces\n end", "def cleanup_board(board)\n for y in (0...9)\n for x in (0...9)\n assign = 0\n for p in (1...10)\n if board[y][x][p] != 0 \n if assign == 0\n assign = board[y][x][p]\n else\n assign = 0\n break\n end\n end\n end\n if assign != 0 and board[y][x][0] == 0\n board[y][x][0] = assign\n for p in (1...10)\n board[y][x][p] = 0\n end\n end\n end\n end\n return\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 bishop_check(board, current, destination)\n tx = 0\n ty = 0\n ob = 0\n temp = nil\n if current[0] < destination[0] && current[1] < destination[1]\n tx = current[0] + 1\n ty = current[1] + 1\n array_to_check = [tx, ty]\n while tx <= destination[0] && ty <= destination[1]\n board.array.each do |item|\n puts 'k' if item.coord == array_to_check\n if item.coord == array_to_check\n unless item.piece_status.nil?\n puts'gudda kathalu 2'\n ob = 1\n return false\n end\n end\n tx += 1\n ty += 1\n end\n next unless ob == 0\n end\n board.array.each do |item|\n if item.coord == current\n temp = item.piece_status\n item.piece_status = nil\n end\n item.piece_status = temp if item.coord == destination\n end\n elsif current[0] > destination[0] && current[1] < destination[1]\n tx = current[0] - 1\n ty = current[1] + 1\n array_to_check = [tx, ty]\n while tx >= destination[0] && ty <= destination[1]\n board.array.each do |item|\n puts 'k' if item.coord == array_to_check\n if item.coord == array_to_check\n unless item.piece_status.nil?\n puts'gudda kathalu 2'\n ob = 1\n return false\n end\n end\n tx -= 1\n ty += 1\n end\n next unless ob == 0\n end\n board.array.each do |item|\n if item.coord == current\n temp = item.piece_status\n item.piece_status = nil\n end\n item.piece_status = temp if item.coord == destination\n end\n elsif current[0] < destination[0] && current[1] > destination[1]\n tx = current[0] + 1\n ty = current[1] - 1\n array_to_check = [tx, ty]\n while tx <= destination[0] && ty >= destination[1]\n board.array.each do |item|\n puts 'k' if item.coord == array_to_check\n if item.coord == array_to_check\n unless item.piece_status.nil?\n puts'gudda kathalu 2'\n ob = 1\n return false\n end\n end\n tx += 1\n ty -= 1\n end\n next unless ob == 0\n end\n board.array.each do |item|\n if item.coord == current\n temp = item.piece_status\n item.piece_status = nil\n end\n item.piece_status = temp if item.coord == destination\n end\n\n elsif current[0] > destination[0] && current[1] > destination[1]\n tx = current[0] - 1\n ty = current[1] - 1\n array_to_check = [tx, ty]\n while tx <= destination[0] && ty >= destination[1]\n board.array.each do |item|\n puts 'k' if item.coord == array_to_check\n if item.coord == array_to_check\n unless item.piece_status.nil?\n puts'gudda kathalu 2'\n ob = 1\n return false\n end\n end\n tx -= 1\n ty -= 1\n end\n next unless ob == 0\n end\n board.array.each do |item|\n if item.coord == current\n temp = item.piece_status\n item.piece_status = nil\n end\n item.piece_status = temp if item.coord == destination\n end\n end\n board\nend", "def win?\n # COLUMNS - 1\n return true if @boardcases[0].case_value == @boardcases[3].case_value && @boardcases[3].case_value == @boardcases[6].case_value && @boardcases[0].case_value != ' '\n # 2\n return true if @boardcases[1].case_value == @boardcases[4].case_value && @boardcases[4].case_value == @boardcases[7].case_value && @boardcases[1].case_value != ' '\n # 3\n return true if @boardcases[2].case_value == @boardcases[5].case_value && @boardcases[5].case_value == @boardcases[8].case_value && @boardcases[2].case_value != ' '\n # ROWS - A\n return true if @boardcases[0].case_value == @boardcases[1].case_value && @boardcases[1].case_value == @boardcases[2].case_value && @boardcases[0].case_value != ' '\n # B\n return true if @boardcases[3].case_value == @boardcases[4].case_value && @boardcases[4].case_value == @boardcases[5].case_value && @boardcases[3].case_value != ' '\n # C\n return true if @boardcases[6].case_value == @boardcases[7].case_value && @boardcases[7].case_value == @boardcases[8].case_value && @boardcases[6].case_value != ' '\n # DIAGONALS\n return true if @boardcases[0].case_value == @boardcases[4].case_value && @boardcases[4].case_value == @boardcases[8].case_value && @boardcases[0].case_value != ' '\n return true if @boardcases[6].case_value == @boardcases[4].case_value && @boardcases[4].case_value == @boardcases[2].case_value && @boardcases[6].case_value != ' '\n end", "def board\n\t \t# counter for the row and cell numbers\n\t cell_counter = 0\n\t row_counter = 0\n\t puts \"----------------------\"\n\t @sudoku.each do |row|\n\t # row_counter indicates the row number/array index of current loop \n\t row_counter += 1 \n\t row.each do |cell|\n\t \t# cell_counter indicates the cell number/index in current array\n\t cell_counter += 1\n\t # display underscore to indicate an unsolved grid\n\t cell = \"_\" if cell == 0\n\t # print the number if the number not 0\n\t print \"#{cell} \"\n\t # print '|' for every 3 numbers to display to 3x3 sub grid\n\t print \"|\" if cell_counter%3 == 0\n\t # start a new row for every 9 numbers\n\t puts \"\" if cell_counter%9 == 0\n\t end\n\t # display dotted lines for every 3 rows \n\t puts \"----------------------\" if row_counter%3 == 0\n\t end\n end", "def won?(board)\n # Checks all tiles in board and tracks the indexes where Xs and Os are\n x_indexes, o_indexes = [], []\n index = 0\nuntil index == 9\nboard[index] == \"X\" ? x_indexes.push(index) : (board[index] == \"O\" ? (o_indexes.push(index)) : ())\nindex += 1\n end\n\n# Checks each win_combination and selects the X or O indexes which match any of the win_combination indexes\n# If the matches include a win_combination, that combination is returned, otherwise false is returned.\n WIN_COMBINATIONS.each { |win_combination|\n x_indexes.select {|idx| win_combination.include?(idx)} == win_combination || o_indexes.select {|idx| win_combination.include?(idx)} == win_combination ? (return win_combination) : ()\n }\nreturn false\n\nend", "def valid?\n 81.times do |i|\n return false if @board[i] == 0\n return false unless check?(i)\n end\n\n true\n end", "def solved?(board_array)\n return valid?(board_array) && valid?(transpose_arrays(board_array)) && valid?(create_grid(board_array))\nend", "def check_neighbours(x, y)\n neighbours = [\n @board1[x - 1 > 0 ? x - 1 : 9][y - 1 > 0 ? y - 1 : 9],\n @board1[x][y - 1 > 0 ? y - 1 : 0], \n @board1[x + 1 < 10 ? x + 1 : 0][y - 1 > 0 ? y - 1 : 9], \n @board1[x - 1 > 0 ? x - 1 : 9][y], \n @board1[x + 1 < 10 ? x + 1 : 0][y], \n @board1[x - 1 > 0 ? x - 1 : 9][y + 1 < 10 ? y + 1 : 0], \n @board1[x][y + 1 < 10 ? y + 1 : 0], \n @board1[x + 1 < 10 ? x + 1 : 0][y + 1 < 10 ? y + 1 : 0]\n ]\n\n if @board1[x, y] == '0'\n @neighbours.each do |cell|\n if cell == '0'\n count += 1\n end\n\n end\n end\n if @board1[x][y] == '0'\n && count < 2\n @board2[x][y] == ' '\n end\n if @board1[x][y] == '0'\n && count > 3\n @board2[x][y] == ' '\n end\n if @board1[x][y] == '0'\n && count == (2 || 3)\n @board2[x][y] == '0'\n end\n if @board1[x][y] == ' ' \n && (count == 3)\n @board2[x][y] == '0'\n end\nend", "def create_node_consistent_board(input,xblks, yblks)\n dim = input.length\n\n board = []\n open = []\n closed = []\n\n \t#initial configuration assigns each cell all possible values and lists all cells as open\n for x in 0..dim-1\n \t\tboard[x] = []\n\t for y in 0..dim-1\n\n\t\t board[x][y] = (1..dim).to_a\n\t\t open[open.length] = []\n open[open.length-1].concat( [x,y])\n\t end\n end\n\n for x in 0..dim-1\n\t for y in 0..dim-1\n\t\t inval = input[x][y]\n\t\t if (inval != 0)\n\n\t\t\t #assigns cell and removes cell from open list,\n \t\t\t\t# and removes value from cells involved in\n\t\t\t #constraints with this one\n\t\t\t if (!assign_spot(board,open,x, y, inval, xblks, yblks))\n\t\t\t\t #puts \"INVALID SUDOKU BOARD\", x, y, inval\n \t\t\t\t\tprint_board(board)\n\t\t\t\t return false\n\t\t\t end\n\t\t end\n \t\tend\n end\n boardhash = [board, open]\n if (board != false)\n \tboardhash = make_arc_consistent(board, open, closed, xblks, yblks)\n end\n if (boardhash == false)\n return false\n end\n\n\n return [boardhash[0], boardhash[1], boardhash[2]]\n\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 check_rows()\n # Returns true if row is filled by player\n 3.times do |x|\n if $game_board[x*3] == $game_board[x*3+1] && $game_board[x*3] == $game_board[x*3+2] && $game_board[x*3]\n return true\n end\n end\n false\nend", "def board_values_valid\n\t\treturn false if !@arr_of_arrs\n\n\t\t@arr_of_arrs.each do |sub|\n\t\t\tsub.each do |val|\n\t\t\t\t# puts \"val: \",val,\", length = \",val.length\n\t\t\t\tif val.length != 1 || !\"-123456789\".include?(val)\n\t\t\t\t\treturn false \n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\treturn true\n\tend", "def cell_validate\n height = 2 * self.down - 1\n width = 2 * self.across - 1\n for i in (1..height).step(2) do\n for j in (1..width).step(2) do\n wall_num = calculate_boundary_sum(i,j)\n if(wall_num == 4 || wall_num == 0)\n puts \"[#{j/2},#{i/2}] is an invalid cell. Please enter another valid string\"\n self.valid = false\n end\n end\n end\n end", "def loadFromFile(fileName)\n inFile = File.new(fileName, \"r\")\n index = 0\n\n # Iterate over the lines from the file.\n inFile.each_line do |line|\n # line is a string containing one line from the file.\n\n ### The code to process the line goes here. ###\n\t\tvals = line.split\n\t\t# The collect block will iterate over each item in vals (strings)\n\t\t# and perform the function (convert to int) returning the set as a new array.\n\t\t@sudokuBoard[index] = vals.collect { |x| x.to_i }\n index = index + 1\n end\n\t\n\t\n\t# Returns whether a number can be placed in this column\n\t#\n\t# @param col A number representing the board column\n\t# @param num A number we're checking\n\t# @return Returns true if the number is valid in the column, false otherwise\n\tdef checkCol(col, num)\n\t\t0.upto(BOARD_SIZE-1){\n\t\t|row| \n\t\tif num == @sudokuBoard[row][col] then\n\t\t\treturn false\n\t\tend\n\t\t}\n\t\treturn true\n\n\tend\n\t# Returns whether a number can be placed in this row\n\t#\n\t# @param row A number representing the board row\n\t# @param num A number we're checking\n\t# @return Returns true if the number is valid in the row, false otherwise\n\tdef checkRow(row, num)\n\t\tdisjointSet = @sudokuBoard[row] - [num]\n\t\tif disjointSet.length == 9 then\n\t\t\t# Safe to add sum to the row.\n\t\t\treturn true\n\t\telse\n\t\t\t# Unsafe to add sum to the row, since it already existed there.\n\t\t\treturn false\n\t\tend\n\t\t\n\tend\n\t\n\t# Returns whether a number can be placed in this subgrid\n\t#\n\t# @param row A number representing the board row\n\t# @param col A number representing the board column\n\t# @param num A number we're checking\n\t# @return Returns true if the number is valid in the subgrid, false otherwise\n\tdef checkSubgrid(row, col, num)\n\t\tx = (row / 3) * 3\n\t\ty = (col / 3) * 3\n\n\t\tbox = @sudokuBoard[x][y..(y+2)] + @sudokuBoard[x+1][y..(y+2)] + @sudokuBoard[x+2][y..(y+2)]\n\t\tdisjointSet = box - [num]\n\t\tif disjointSet.length == 9 then\n\t\t\t# Safe to add num to the row.\n\t\t\treturn true\n\t\telse\n\t\t\t# Unsafe to add num to the row, since it already existed there.\n\t\t\treturn false\n\t\tend\n\t\t\n\t\n\t\n\t\n\tend\n\t\n\t# Returns whether a number can be placed per sudoku rules\n\t#\n\t# @param row A number representing the board row\n\t# @param col A number representing the board column\n\t# @param num A number we're checking\n\t# @return Returns true if the number is valid in this postion, false otherwise\n\tdef check(row, col, num)\n\t\treturn checkCol(col,num) && checkRow(row,num) && checkSubgrid(row,col,num)\n\t\n\tend\n\t\n\t# A recursive backtracking function to solve sudoku boards \n\t#\n\t# @param row A number representing the board row\n\t# @param col A number representing the board column\n\t# @return Returns true if the board is solved, false otherwise\n\tdef solve(row, col)\n\tif row == 9 then\n\t\treturn true\n\tend\n\t\n\tif col == 9 then\n\t\treturn solve(row +1, 0)\n\tend\n\t\n\tif @sudokuBoard[row][col] != 0 then\n\t\treturn solve(row, col +1)\n\tend\n\t\n\t1.upto(9) {\n\t|num|\n\t\n\tif check(row,col,num) then\n\t\t@sudokuBoard[row][col] = num\n\t\tif solve(row, col+1) then\n\t\t\treturn true\n\t\tend\n\tend\n\t}\n\t\n\t@sudokuBoard[row][col] = 0\n\treturn false\n\t\n\t\n\tend\n\t\t\n\n inFile.close\nend", "def find_empty_positions(board)\n\n empty_positions = []\n\n for rrow in 0...board.length\n for col in 0...board[rrow].length\n if board[rrow][col] == 0\n empty_positions << [rrow, col]\n end\n end\n end\n\n empty_positions\nend", "def internal_check?(row, col)\n\n values = [@rows[row], @cols[col], @blks[find_block(row,col)]] #Values related to the section\n \n #Check for a missing value\n #------------------------------- \n values = values.flatten.uniq.join.gsub(\"0\",\"\")\n values = \"123456789\".tr(values,\"\")\n if values.length == 1\n @rows[row][col] = values.to_s\n adjust_values\n return true\n else\n return false\n end\n end", "def generate_solution\n ary = (\"0\" * tile_count).chars.map(&:to_i)\n until ary.count(0).zero?\n ary.each_with_index do |num, ind|\n row = calculate_area(ind + 1, :row)\n col = calculate_area(ind + 1, :col)\n box = calculate_area(ind + 1, :box)\n row_neighbours = tile_range.to_a.select {|n| calculate_area(n, :row).eql? row}\n col_neighbours = tile_range.to_a.select {|n| calculate_area(n, :col).eql? col}\n box_neighbours = tile_range.to_a.select {|n| calculate_area(n, :box).eql? box}\n neighbours = (row_neighbours + col_neighbours + box_neighbours).uniq!.map {|n| n -= 1}\n neighbouring_values = []\n neighbours.each {|n| neighbouring_values << ary[n]}\n options = (0..area_size).to_a.reject! {|x| neighbouring_values.compact.include?(x)}\n if options == []\n ary = (\"0\" * tile_count).chars.map(&:to_i)\n break\n end\n ary[ind] = options.sample\n end\n end\n return ary.join\n end", "def complete\n #81 times for each block in the puzzle\n @board.each do |key, value|\n next if value != 0\n\n candidatesArray = grand_filter(key)\n\n candidatesArray.each do |possibility|\n @board[key] = possibility\n foundAll = complete\n if(foundAll == true)\n return true\n end\n end\n\n # finished trying all the candidates, backtrack\n @board[key] = 0\n return false\n end\n\n return true\n end", "def create_board(array)\n num = array.length\n board = Array.new(num) { Array.new(num, false) }\n array.each_with_index { |board_position, row| board[row][board_position - 1] = true }\n board\nend", "def solve!\n \t# keep looping if previous board doesn't match current board (new grids are being solved)\n\t \twhile true do\n\t\t \t@sudoku.each_with_index do |row, rowindex|\n\t\t \t\trow.each_with_index do |cell, cellindex|\n\t\t \t\t\t# duplicate sudoku board to solve grids and compare with previous board\n\t\t \t\t\t@sudokudup = @sudoku.dup\n\t\t \t\t\t# get the array of numbers from current column \n\t\t \t\t\tcol = @sudoku.transpose[cellindex]\n\t\t \t\t\t# find unsolved grids\n\t\t \t\t\tnext if cell != 0\n\t\t \t\t\t# form an array of possible solutions, starting with all numbers from 1 to 9\n\t\t \t\t\tsolutions=(1..9).to_a\n\t\t \t\t\t# loop through numbers from 1 to 9, delete the number from solutions if it appears in current row/column\n\t\t \t\t\t1.upto(9) {|x| solutions.delete(x) if row.include?(x)}\n\t\t \t\t\t1.upto(9) {|x| solutions.delete(x) if col.include?(x)}\n\n\t\t \t\t\t# get the numbers from current box(3x3 grid)\n\t\t \t\t\t# example (number in each grids represent column index):\n\t\t \t\t\t# | 0 1 2 | - 0 (row/array index)\n\t\t \t\t\t# | 0 1 2 | - 1\n\t\t \t\t\t# | 0 1 2 | - 2\n\t\t \t\t\t# ---------\n\t\t \t\t\t# box_x returns the array/row index of the top left number of current box (refer to sample board)\n\t\t \t\t\tbox_x = (rowindex./3)*3\n\t\t \t\t\tbox = []\n\t\t \t\t\t# loop through the 3 rows in the box\n\t\t \t\t\t3.times do\n\t\t \t\t\t\t# box_y returns the column index of the top left number of current box (refer to sample board)\n\t\t \t\t\t\tbox_y=(cellindex./3)*3\n\t\t \t\t\t\t# loop through the 3 columns for each rows\n\t\t \t\t\t\t3.times do\n\t\t \t\t\t\t\t# insert current number into the 'box' array\n\t\t \t\t\t\t\tbox << @sudoku[box_x][box_y]\n\t\t \t\t\t\t\t# get the next column index from the current row\n\t\t \t\t\t\t\tbox_y += 1\n\t\t \t\t\t\tend\n\t\t \t\t\t\t# get the next row/array index\n\t\t \t\t\t\tbox_x += 1\n\t\t \t\t\tend\n\t\t \t\t\t# delete number from solutions if it appears in current box\n\t\t \t\t\t1.upto(9) {|x| solutions.delete(x) if box.include?(x)}\n\t\t \t\t\t# if solutions contain only 1 number, the current grid will be replaced with the number\n\t\t \t\t\t@sudoku[rowindex][cellindex] = solutions[0] if solutions.length == 1\n\t\t \t\tend\n\t\t \tend\n\t\t \tif @sudoku == @sudokudup\n\t\t \t\tguess\n\t\t \t\treturn @sudoku.flatten.join\n\t\t \t\tbreak\n\t\t \tend\n\t\tend\n end", "def valid?\n 0.upto(8) { |row| return false if @rows[row].uniq! }\n 0.upto(8) { |column| return false if @columns[column].uniq! } \n 0.upto(8) { |box| return false if @boxes[box].uniq! }\n\n return true\n end", "def iterate(arr)\n newArr = []\n (0...arr.size).each do |row|\n newArr[row] = []\n (0...arr.size).each do |col|\n num_neighbors = num_neighbors(row,col,arr)\n if arr[row][col]\n if num_neighbors == 2 || num_neighbors == 3\n newArr[row][col] = true\n else\n newArr[row][col] = false\n end\n else\n if num_neighbors == 3\n newArr[row][col] = true\n else\n newArr[row][col] = false\n end\n end\n end\n end\n arr = newArr\nend", "def fullBoard(position)\n for x in 0..2\n for y in 0..2\n if position[x][y] == 0\n return false\n end\n end\n end\n return true\n end", "def verify_matrix(matrix, rows_array, columns_array)\n rows = matrix.size\n columns = matrix[0].size\n\n rows.times do |row|\n columns.times do |column|\n if (rows_array.include?(row) || columns_array.include?(column))\n if matrix[row][column] != 0\n puts \"BUG!!! matrix[#{row}][#{column}] should be 0\"\n return false\n end\n elsif matrix[row][column] != 1\n puts \"BUG!!! matrix[#{row}][#{column}] should be 1\"\n return false\n end\n end\n end\n return true\nend", "def fill_board(array)\n # puts array.inspect\n \n empty_board = BoardLoader.empty_board\n b = []\n \n count = 0\n empty_board.each_index do |row|\n b[row] = []\n empty_board[row].each_index do |column|\n if empty_board[row][column] == BLANK_SPACE\n if count < array.length\n b[row][column] = array[count]\n count += 1\n if count == array.length\n $last_spot = [row, column]\n end\n else\n b[row][column] = BLANK_SPACE\n end\n else\n b[row][column] = empty_board[row][column]\n end\n end\n end\n \n if $last_spot.nil?\n $last_spot = [empty_board.length-1, empty_board[0].length-1]\n end\n \n \n b\n end" ]
[ "0.7629975", "0.75500196", "0.7527139", "0.72847015", "0.72101945", "0.716096", "0.71530235", "0.71185756", "0.7113297", "0.70302826", "0.70237666", "0.6999139", "0.68678415", "0.6858122", "0.6837661", "0.66804457", "0.66206396", "0.66023946", "0.65952545", "0.65926385", "0.65647477", "0.6561327", "0.64667", "0.641034", "0.6385556", "0.6357292", "0.6353507", "0.6349035", "0.6341371", "0.63359237", "0.6325807", "0.63048136", "0.6302526", "0.6288918", "0.62840164", "0.6275356", "0.627524", "0.62698895", "0.62685126", "0.6266479", "0.62525463", "0.61856365", "0.61633277", "0.61623096", "0.61454636", "0.6137877", "0.6134128", "0.61301666", "0.61184597", "0.61106604", "0.61030656", "0.6093338", "0.6092987", "0.6092009", "0.6081254", "0.6059773", "0.60486263", "0.6044628", "0.6038951", "0.6018562", "0.60108733", "0.60070854", "0.6002142", "0.59970534", "0.59916466", "0.5991376", "0.59903294", "0.5987589", "0.59748054", "0.59726995", "0.5968345", "0.5965284", "0.596338", "0.59561914", "0.5948177", "0.5944534", "0.59400886", "0.59394467", "0.593823", "0.5924125", "0.5915102", "0.5911673", "0.59048665", "0.59024614", "0.59007215", "0.5899228", "0.5895189", "0.5889469", "0.588663", "0.5885247", "0.5885162", "0.58821154", "0.58677953", "0.5862224", "0.5861955", "0.5856904", "0.5856722", "0.58552957", "0.584402", "0.5839766" ]
0.6010177
61
Use callbacks to share common setup or constraints between actions.
def set_donor_type @donor_type = DonorType.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 donor_type_params params.require(:donor_type).permit(:name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def filtering_params\n params.permit(:email)\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def url_whitelist; end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076", "0.62894756", "0.6283177", "0.6242471", "0.62382483", "0.6217549", "0.6214457", "0.6209053", "0.6193042", "0.6177802", "0.6174604", "0.61714715", "0.6161512", "0.6151757", "0.6150663", "0.61461", "0.61213595", "0.611406", "0.6106206", "0.6105114", "0.6089039", "0.6081015", "0.6071004", "0.60620916", "0.6019971", "0.601788", "0.6011056", "0.6010898", "0.6005122", "0.6005122", "0.6001556", "0.6001049", "0.59943926", "0.5992201", "0.59909594", "0.5990628", "0.5980841", "0.59669393", "0.59589154", "0.5958826", "0.5957911", "0.5957385", "0.5953072", "0.59526145", "0.5943361", "0.59386164", "0.59375334", "0.59375334", "0.5933856", "0.59292704", "0.59254247", "0.5924164", "0.59167904", "0.59088355", "0.5907542", "0.59064597", "0.5906243", "0.5898226", "0.589687", "0.5896091", "0.5894501", "0.5894289", "0.5891739", "0.58860534", "0.5882406", "0.587974", "0.58738774", "0.5869024", "0.58679986", "0.5867561", "0.5865932", "0.5864461", "0.58639693", "0.58617616", "0.5861436", "0.5860451", "0.58602303", "0.5854586", "0.58537364", "0.5850427", "0.5850199" ]
0.0
-1
GET /listings GET /listings.json
def index @listings = Listing.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @listings = Listing.all\n render json: @listings\n end", "def index\n @listings = Listing.by_user(current_user).all\n\n render json: @listings\n end", "def index\n @listings = Listing.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @listings }\n end\n end", "def index\n @listings = Listing.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @listings }\n end\n end", "def index\n \t@listings = Listing.all\n end", "def index\n #contains all the listings\n @listings = Listing.all\n end", "def index\n @listings = Listing.all\n \n end", "def listings(**args)\n params = convert_params(args)\n client.get(\"#{ENDPOINT}/listings/latest\", options: params.compact)\n end", "def listings(**args)\n params = convert_params(args)\n client.get(\"#{ENDPOINT}/listings/latest\", options: params.compact)\n end", "def serve_listing_data\n @listings = Listing.open.joins(:origin_loc).group(\"listings.id\").\n order(\"listings.created_at DESC\").find_with(params, @current_user, @current_community).select(\"listings.id, listing_type, category\")\n render :json => { :data => @listings }\n end", "def show\n @listings = Listing.find(params[:id])\n end", "def listings\n\t\t@current_user ||= User.find(session[:user_id]) if session[:user_id]\n\t\t@listings = Listing.find_all_by_user_id(@current_user)\n\tend", "def index\n @building = Building.find(params[:building_id])\n @listings = Listing.all\n end", "def index\n #@page = params[:page] ? params[:page] : 1\n args = listing_params\n args ||= {}\n @listings = paginate Listing.where(*query_args(args))\n \n render :index\n end", "def index\n # @listings = Listing.all\n @listings = Listing.order(:name).page params[:page]\n end", "def show\n @listing = Listing.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @listing }\n end\n end", "def show\n @listing = Listing.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @listing }\n end\n end", "def show\n @listing = Listing.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @listing }\n end\n end", "def me\n\t\tuser_listings = current_user.listings\n render json: [current_user, user_listings]\n end", "def index\n if params[:search].present?\n @listings = Listing.search_by(search_params)\n else\n @listings = Listing.all\n end\n end", "def get_listings(product_ids)\n get_api_response(\"/api/products/#{product_ids}/listings\")\n end", "def index\n @bookings = Booking.all\n\n render json: @bookings\n end", "def index\n @listings = Listing.all\n @personal_listings = current_user.listings\n end", "def listings\n return @listings ||= build_all_listings\n end", "def listings\n return @listings ||= build_all_listings\n end", "def listings\n return @listings ||= build_all_listings\n end", "def listings(location_id = nil)\n method_url = @resource + \"/\" + location_id + \"/listings\"\n params = {}\n return self.get(method_url, params)\n end", "def index\n @postings = Posting.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @postings }\n end\n end", "def browse\n\t\t@listings = Listings.find(:all)\n\tend", "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 @page = params[\"page\"] || 1\n @per_page = params[\"per_page\"] || 50\n \n query = params.slice(\"category\", \"listing_type\")\n \n if params[\"status\"] == \"closed\"\n query[\"open\"] = false\n elsif params[\"status\"] == \"all\"\n # leave \"open\" out totally to return all statuses\n else\n query[\"open\"] = true #default\n end\n \n if params[\"person_id\"]\n query[\"author_id\"] = params[\"person_id\"]\n end\n \n unless @current_user && @current_user.communities.include?(@current_community)\n query[\"visibility\"] = \"everybody\"\n end\n \n if params[\"search\"]\n @listings = search_listings(params[\"search\"], query)\n elsif @current_community\n listings_to_query = (query[\"open\"] ? @current_community.listings.open : @current_community.listings)\n @listings = listings_to_query.where(query).order(\"created_at DESC\").paginate(:per_page => @per_page, :page => @page)\n else\n # This is actually not currently supported. Community_id is currently required parameter.\n @listings = Listing.where(query).order(\"created_at DESC\").paginate(:per_page => @per_page, :page => @page)\n end\n \n @total_pages = @listings.total_pages\n \n # Few extra fields for ATOM feed\n if params[:format].to_s == \"atom\" \n \n @category_label = (params[\"category\"] ? \"(\" + localized_category_label(params[\"category\"]) + \")\" : \"\")\n \n if [\"request\",\"offer\"].include?params['listing_type']\n listing_type_label = t(\"listings.index.#{params['listing_type']+\"s\"}\")\n else\n listing_type_label = t(\"listings.index.listings\")\n end\n \n @title = t(\"listings.index.feed_title\", :optional_category => @category_label, :community_name => @current_community.name, :listing_type => listing_type_label)\n @updated = @listings.first.present? ? @listings.first.updated_at : Time.now\n end\n respond_with @listings\n end", "def recordings_list_stored\n get \"recordings/stored\"\n end", "def get_listing(listing_id)\n query_and_build \"marketplace/listings/#{listing_id}\"\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 @buildings = Building.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json :@buildings }\n end\n end", "def featured_listings\n @listings = Listing.limit(5)\n render\n end", "def show\n render json: @listing\n end", "def search\n @listings = Listing.where(id: params[:id])\n @listings = Listing.search(params[:search])\n end", "def index\n @listings = Listing.all.order(\"created_at DESC\")\n end", "def index\n @listings = SaleListing.all\n end", "def listings_get(id, opts = {})\n data, _status_code, _headers = listings_get_with_http_info(id, opts)\n data\n end", "def index\n @email_listings = EmailListing.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @email_listings }\n end\n end", "def index\n @listings = Listing.where(nil)\n logger.debug \"In listing controller index - at top - params: #{params}\"\n redirect_params(params).each do |key, value|\n @listings = @listings.public_send(key, value) if value.present?\n end\n logger.debug \"In Listing controller index, returning listings: #{@listings.inspect}\"\n respond_with(@listings)\n end", "def index\n\t\n\t\t\n\t\t@listings = Listing.all\n\t\t\n\t\t#@listings = Listing.find.includes(:prices).(:price_range => params[:id]) #not working quite yet\n\t\t\n\n\t\trespond_to do |format|\n\t\t\tformat.html #index.html.erb\n\t\t\tformat.xml { render :xml =>@listings }\n\t\tend\n\tend", "def user_product_listings\n render json: @user.product_listings\n end", "def index\n @listings = current_user.listing.all\n # byebug\n end", "def index\n @biddings = Bidding.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @biddings }\n end\n end", "def get_brandings\n request :get, \"/v3/brandings.json\"\n end", "def index\n @listings_polls = ListingsPoll.all\n end", "def listings\n @listings = trips.select do |trip|\n trip.listings\n end\n end", "def show\n @listings = Listing.search do\n keywords params[:query]\n end.results\n\n respond_to do |format|\n format.html { render :action => \"show\" }\n format.xml { render :xml => @listings }\n end\n end", "def index\n @listings = Listing.order(params[:sort])\n end", "def index\n @listings = Listing.order('created_at DESC').limit(5)\n end", "def index\n @harvestings = Harvesting.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @harvestings }\n end\n end", "def index\n @sightings = Sighting.all\n render json: @sightings\n end", "def index\n @listings = Listing.where(status: :paid) \n end", "def index\n @listings = Listing.order(created_at: :desc).includes(:commoner, :tags, :comments, :images)\n end", "def index\n @innings = Inning.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @innings }\n end\n end", "def index\n @q = Listing.ransack(params[:q])\n @listings = @q.result.with_attached_picture.paginate(:page => params[:page], :per_page=>8)\n end", "def index\n bookings = Booking.all\n\n if bookings\n render json: { status: 'SUCCESS', message: 'Successfuly got all bookings', data: bookings }, status: :ok\n else\n render json: { status: 'ERROR', message: 'Something went wrong' }, status: :unprocessable_entity\n end\n end", "def index\n render json: { bookings: @site.bookings.order(datetime: :asc) }, status: 200\n end", "def show\n \n @all_listing_requsts = Request.where(listing_id: params[:id])\n render json: @all_listing_requsts\n end", "def listing\n @listing = Listing.find(params[:listing_id])\n end", "def index\n @listings = Listing.search(params[:search], params[:city])\n end", "def index\n @networkings = Networking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @networkings }\n end\n end", "def listing\n @listing\n end", "def index\n Listing.destroy_all(draft:true, draft_by:current_user.id)\n\n @search = Listing.search(params[:q])\n\n @listings = @search.result.where(draft:false).order(\"created_at DESC\").page(params[:page]).per(15)\n end", "def index\n @listings = Listing.all.where(:private => false).paginate(:page => params[:page], :per_page => 25).order(:cached_votes_score => :desc)\n @listings = Listing.all.where(:private => false).name_search(params[:l]) if params[:l]\n end", "def listings\n authorize! :read, @user\n end", "def index\n @lists = List.all\n render json: @lists\n end", "def listings\n Zoopla::CachedListings.new.search(self).sort_by(&:updated_at).reverse!\n end", "def find_user_id\n @listings = Listing.where(\"user_id = ?\",params[:user_id]).all\n if !@listings.empty?\n ret = []\n @listings.each do |listing|\n ret << listing.as_json(include: :book)\n end\n render :json => ret\n else\n render :json => \"user has no listings\".to_json\n end\n end", "def user_listings\n @listings =current_user.listings\n end", "def index\n if params[:category].blank?\n @listings = Listing.all.order(\"created_at DESC\")\n else\n @category_id = Category.find_by(name: params[:category]).id\n @listings = Listing.where(category_id: @category_id).order(\"created_at DESC\")\n end\n end", "def index\n page_number = params[:page] ? params[:page][:number] : 1\n per_page = params[:per_page] ? params[:per_page] : 10\n\n @standings = Standing.paginate(page: page_number, per_page: per_page)\n\n render json: @standings\n end", "def my_listings\n page = params[:page]\n offset = page.to_s+\"0\"\n @prevPage = page.to_i-1\n @nextPage = page.to_i+1\n\n userID = session[:user_id]\n\n uri = URI(\"http://107.170.7.58:4567/api/sell\")\n parameters = {\"ext\" => \"json\", \"user_id\" => userID, \"count\" => \"10\", \"offset\" => offset}\n response = Net::HTTP.post_form(uri, parameters)\n\n list = JSON.parse(response.body)\n\n @sells = Array.new\n @books = Array.new\n list.each do |listing|\n if listing[\"kind\"].eql? \"sell\"\n @sells.push Sell.new(listing[\"data\"])\n else if listing[\"kind\"].eql? \"book\"\n @books[listing[\"data\"][\"id\"]] = Edition.new(listing[\"data\"])\n end\n end\n end\n end", "def list\n url = prefix + \"list\"\n return response(url)\n end", "def get_listings_xml(url)\n @client.get_content(url)\n end", "def index\n @bookings = Booking.all\n respond_with(@bookings)\n end", "def index\n @cannings = Canning.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cannings }\n end\n end", "def fetch_listings(format=nil)\n result = nil\n raw = fetch_raw(format)\n case self.format\n when 'xml'\n # parse xml raw\n result = XmlSimple.xml_in raw, { 'ForceArray' => false, 'AttrPrefix' => true }\n when 'json'\n result = JSON.parse(raw)\n end\n result = raw unless result\n result\n end", "def index\n @pricings = Pricing.all\n\n render json: @pricings\n end", "def index\n #retrieve all listings from the database and implement eager loading on pictures and categories\n @listings = Listing.all.with_attached_picture.includes(:category)\n p @listings\n end", "def index\n @listings = {\n PS4: 50.00,\n XBox: 50.00,\n Lawn_Mower: 10.00\n }\n\n end", "def index\n @service_bookings = ServiceBooking.all\n\n render json: @service_bookings\n end", "def index\n bookings = Room.all\n\n if bookings\n render json: { status: 'SUCCESS', message: 'Successfuly got all rooms', data: bookings }, status: :ok\n else\n render json: { status: 'ERROR', message: 'Something went wrong' }, status: :unprocessable_entity\n end\n end", "def index \n\t\t# listings_per_page = 7\n # \tparams[:page] = 1 unless params[:page]\n # \tfirst_listing = (params[:page].to_i - 1 ) * listings_per_page\n # \tlistings = Listing.all\n # \t@total_pages = listings.count / listings_per_page\n # \tif listings.count % listings_per_page > 0\n # \t\t@total_pages += 1\n # \tend\n # \t@listings = listings[first_listing...(first_listing + listings_per_page)]\n\t\t@listings = Listing.all \n\tend", "def index\n @business_listings = BusinessListing.all\n end", "def listing_for_language(language)\n ensure_active_edit!\n\n result = api_client.execute(\n api_method: android_publisher.edits.listings.get,\n parameters: {\n 'editId' => current_edit.data.id,\n 'packageName' => current_package_name,\n 'language' => language\n },\n authorization: auth_client\n )\n\n raise result.error_message.red if result.error? && result.status != 404\n\n if result.status == 404\n return Listing.new(self, language) # create a new empty listing\n else\n return Listing.new(self, language, result.data)\n end\n end", "def show\n @listing = Listing.find(params[:listing_id])\n end", "def index\n @sayings = Saying.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sayings }\n end\n end", "def list\n url = prefix + \"list\"\n return response(url)\n end", "def index\n json_response(@board.lists)\n end" ]
[ "0.84071535", "0.8229778", "0.80733144", "0.8072741", "0.7644508", "0.7557292", "0.7543862", "0.7541133", "0.7541133", "0.7501743", "0.74325484", "0.73312193", "0.7282506", "0.7280483", "0.7226569", "0.7207299", "0.7207299", "0.7207299", "0.71598667", "0.7155082", "0.7127228", "0.71157944", "0.71048313", "0.7067547", "0.7067547", "0.7067547", "0.7049128", "0.70058125", "0.70036197", "0.6998815", "0.6998745", "0.69850034", "0.69802", "0.6950001", "0.6950001", "0.6950001", "0.68835706", "0.6872667", "0.687209", "0.68319184", "0.6828493", "0.6818678", "0.6797409", "0.67944306", "0.6789279", "0.67880785", "0.6737303", "0.6730238", "0.6728839", "0.6725214", "0.67173797", "0.6708762", "0.6699187", "0.6678965", "0.6676893", "0.6666802", "0.66656274", "0.6661461", "0.66598827", "0.66595936", "0.6657095", "0.6653838", "0.66528374", "0.66440547", "0.66433495", "0.66202295", "0.6597506", "0.65811163", "0.65697134", "0.6568324", "0.6541804", "0.653984", "0.6534784", "0.6515444", "0.6510489", "0.65062046", "0.6498132", "0.64957434", "0.6494187", "0.6482343", "0.6466321", "0.6461137", "0.64544547", "0.645335", "0.6444333", "0.64441156", "0.64390814", "0.6437653", "0.64337784", "0.63930327", "0.6387986", "0.6373224", "0.63719034", "0.63693345", "0.6358119" ]
0.76987916
8
GET /listings/1 GET /listings/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @listings = Listing.all\n render json: @listings\n end", "def index\n @listings = Listing.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @listings }\n end\n end", "def index\n @listings = Listing.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @listings }\n end\n end", "def index\n @listings = Listing.by_user(current_user).all\n\n render json: @listings\n end", "def show\n @listings = Listing.find(params[:id])\n end", "def index\n @listings = Listing.all\n end", "def index\n @listings = Listing.all\n end", "def index\n @listings = Listing.all\n end", "def index\n @listings = Listing.all\n end", "def index\n @listings = Listing.all\n end", "def index\n @listings = Listing.all\n end", "def show\n @listing = Listing.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @listing }\n end\n end", "def show\n @listing = Listing.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @listing }\n end\n end", "def show\n @listing = Listing.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @listing }\n end\n end", "def index\n \t@listings = Listing.all\n end", "def get_listing(listing_id)\n query_and_build \"marketplace/listings/#{listing_id}\"\n end", "def index\n @listings = Listing.all\n \n end", "def index\n @building = Building.find(params[:building_id])\n @listings = Listing.all\n end", "def index\n #contains all the listings\n @listings = Listing.all\n end", "def listings(**args)\n params = convert_params(args)\n client.get(\"#{ENDPOINT}/listings/latest\", options: params.compact)\n end", "def listings(**args)\n params = convert_params(args)\n client.get(\"#{ENDPOINT}/listings/latest\", options: params.compact)\n end", "def serve_listing_data\n @listings = Listing.open.joins(:origin_loc).group(\"listings.id\").\n order(\"listings.created_at DESC\").find_with(params, @current_user, @current_community).select(\"listings.id, listing_type, category\")\n render :json => { :data => @listings }\n end", "def index\n # @listings = Listing.all\n @listings = Listing.order(:name).page params[:page]\n end", "def listing\n @listing = Listing.find(params[:listing_id])\n end", "def index\n @listings = Listing.all\n @personal_listings = current_user.listings\n end", "def index\n #@page = params[:page] ? params[:page] : 1\n args = listing_params\n args ||= {}\n @listings = paginate Listing.where(*query_args(args))\n \n render :index\n end", "def browse\n\t\t@listings = Listings.find(:all)\n\tend", "def show\n @listing = Listing.find(params[:listing_id])\n end", "def me\n\t\tuser_listings = current_user.listings\n render json: [current_user, user_listings]\n end", "def show\n render json: @listing\n end", "def index\n @bookings = Booking.all\n\n render json: @bookings\n end", "def show\n # this gets the todo items listing params :id\n @listing = Listing.find(params[:id])\n end", "def listings\n\t\t@current_user ||= User.find(session[:user_id]) if session[:user_id]\n\t\t@listings = Listing.find_all_by_user_id(@current_user)\n\tend", "def get_listings(product_ids)\n get_api_response(\"/api/products/#{product_ids}/listings\")\n end", "def show\n \n @all_listing_requsts = Request.where(listing_id: params[:id])\n render json: @all_listing_requsts\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 search\n @listings = Listing.where(id: params[:id])\n @listings = Listing.search(params[:search])\n end", "def index\n if params[:search].present?\n @listings = Listing.search_by(search_params)\n else\n @listings = Listing.all\n end\n end", "def featured_listings\n @listings = Listing.limit(5)\n render\n end", "def index\n @page = params[\"page\"] || 1\n @per_page = params[\"per_page\"] || 50\n \n query = params.slice(\"category\", \"listing_type\")\n \n if params[\"status\"] == \"closed\"\n query[\"open\"] = false\n elsif params[\"status\"] == \"all\"\n # leave \"open\" out totally to return all statuses\n else\n query[\"open\"] = true #default\n end\n \n if params[\"person_id\"]\n query[\"author_id\"] = params[\"person_id\"]\n end\n \n unless @current_user && @current_user.communities.include?(@current_community)\n query[\"visibility\"] = \"everybody\"\n end\n \n if params[\"search\"]\n @listings = search_listings(params[\"search\"], query)\n elsif @current_community\n listings_to_query = (query[\"open\"] ? @current_community.listings.open : @current_community.listings)\n @listings = listings_to_query.where(query).order(\"created_at DESC\").paginate(:per_page => @per_page, :page => @page)\n else\n # This is actually not currently supported. Community_id is currently required parameter.\n @listings = Listing.where(query).order(\"created_at DESC\").paginate(:per_page => @per_page, :page => @page)\n end\n \n @total_pages = @listings.total_pages\n \n # Few extra fields for ATOM feed\n if params[:format].to_s == \"atom\" \n \n @category_label = (params[\"category\"] ? \"(\" + localized_category_label(params[\"category\"]) + \")\" : \"\")\n \n if [\"request\",\"offer\"].include?params['listing_type']\n listing_type_label = t(\"listings.index.#{params['listing_type']+\"s\"}\")\n else\n listing_type_label = t(\"listings.index.listings\")\n end\n \n @title = t(\"listings.index.feed_title\", :optional_category => @category_label, :community_name => @current_community.name, :listing_type => listing_type_label)\n @updated = @listings.first.present? ? @listings.first.updated_at : Time.now\n end\n respond_with @listings\n end", "def index\n @buildings = Building.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json :@buildings }\n end\n end", "def index\n @listings = Listing.all.order(\"created_at DESC\")\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 @listings = Listing.where(status: :paid) \n end", "def index\n @postings = Posting.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @postings }\n end\n end", "def show\n @listings = Listing.find_by_programming_language_id(params[:id])\n end", "def given_listing(attributes = {})\n given_listings(attributes).first\n end", "def new\n @listing = Listing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @listing }\n end\n end", "def new\n @listing = Listing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @listing }\n end\n end", "def new\n @listing = Listing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @listing }\n end\n end", "def listings(location_id = nil)\n method_url = @resource + \"/\" + location_id + \"/listings\"\n params = {}\n return self.get(method_url, params)\n end", "def index\n\t\n\t\t\n\t\t@listings = Listing.all\n\t\t\n\t\t#@listings = Listing.find.includes(:prices).(:price_range => params[:id]) #not working quite yet\n\t\t\n\n\t\trespond_to do |format|\n\t\t\tformat.html #index.html.erb\n\t\t\tformat.xml { render :xml =>@listings }\n\t\tend\n\tend", "def index\n @listings = SaleListing.all\n end", "def find_id\n if Listing.exists?(params[:id])\n @listing = Listing.find(params[:id])\n render :json => @listing.as_json(include: :book)\n else\n render :json => \"listing not found\".to_json\n end\n end", "def listings_get(id, opts = {})\n data, _status_code, _headers = listings_get_with_http_info(id, opts)\n data\n end", "def recordings_list_stored\n get \"recordings/stored\"\n end", "def index\n @listings = Listing.where(nil)\n logger.debug \"In listing controller index - at top - params: #{params}\"\n redirect_params(params).each do |key, value|\n @listings = @listings.public_send(key, value) if value.present?\n end\n logger.debug \"In Listing controller index, returning listings: #{@listings.inspect}\"\n respond_with(@listings)\n end", "def listings_get_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ListingsApi.listings_get ...'\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 ListingsApi.listings_get\"\n end\n # resource path\n local_var_path = '/v1/listings/{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', 'text/json', 'text/html', 'application/xml', 'text/xml'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\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 => 'DomainPublicAdapterWebApiModelsV1ListingsListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ListingsApi#listings_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @listings = Listing.order('created_at DESC').limit(5)\n end", "def new\n @listing = Listing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json => @listing }\n end\n end", "def listing_for_language(language)\n ensure_active_edit!\n\n result = api_client.execute(\n api_method: android_publisher.edits.listings.get,\n parameters: {\n 'editId' => current_edit.data.id,\n 'packageName' => current_package_name,\n 'language' => language\n },\n authorization: auth_client\n )\n\n raise result.error_message.red if result.error? && result.status != 404\n\n if result.status == 404\n return Listing.new(self, language) # create a new empty listing\n else\n return Listing.new(self, language, result.data)\n end\n end", "def index\n @biddings = Bidding.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @biddings }\n end\n end", "def listing\n @listing\n end", "def get_brandings\n request :get, \"/v3/brandings.json\"\n end", "def index\n @listings = Listing.all.where(:private => false).paginate(:page => params[:page], :per_page => 25).order(:cached_votes_score => :desc)\n @listings = Listing.all.where(:private => false).name_search(params[:l]) if params[:l]\n end", "def fetch_listings(format=nil)\n result = nil\n raw = fetch_raw(format)\n case self.format\n when 'xml'\n # parse xml raw\n result = XmlSimple.xml_in raw, { 'ForceArray' => false, 'AttrPrefix' => true }\n when 'json'\n result = JSON.parse(raw)\n end\n result = raw unless result\n result\n end", "def index\n @email_listings = EmailListing.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @email_listings }\n end\n end", "def find_user_id\n @listings = Listing.where(\"user_id = ?\",params[:user_id]).all\n if !@listings.empty?\n ret = []\n @listings.each do |listing|\n ret << listing.as_json(include: :book)\n end\n render :json => ret\n else\n render :json => \"user has no listings\".to_json\n end\n end", "def index\n @networkings = Networking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @networkings }\n end\n end", "def index\n @listings_polls = ListingsPoll.all\n end", "def index\n @listings = Listing.order(created_at: :desc).includes(:commoner, :tags, :comments, :images)\n end", "def index\n if params[:category].blank?\n @listings = Listing.all.order(\"created_at DESC\")\n else\n @category_id = Category.find_by(name: params[:category]).id\n @listings = Listing.where(category_id: @category_id).order(\"created_at DESC\")\n end\n end", "def index\n @harvestings = Harvesting.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @harvestings }\n end\n end", "def user_product_listings\n render json: @user.product_listings\n end", "def index\n @listings = Listing.order(params[:sort])\n end", "def index\n @innings = Inning.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @innings }\n end\n end", "def show\n @listings = Listing.search do\n keywords params[:query]\n end.results\n\n respond_to do |format|\n format.html { render :action => \"show\" }\n format.xml { render :xml => @listings }\n end\n end", "def show\n @waiting_list = WaitingList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @waiting_list }\n end\n end", "def index\n @sightings = Sighting.all\n render json: @sightings\n end", "def set_listing\n @listing = Listing.find(params[:id])\n end", "def set_listing\n @listing = Listing.find(params[:id])\n end", "def set_listing\n @listing = Listing.find(params[:id])\n end", "def set_listing\n @listing = Listing.find(params[:id])\n end", "def set_listing\n @listing = Listing.find(params[:id])\n end", "def index\n @listings = current_user.listing.all\n # byebug\n end", "def index\n @listings = {\n PS4: 50.00,\n XBox: 50.00,\n Lawn_Mower: 10.00\n }\n\n end", "def show\n @listing = Listing.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @listing }\n end\n end", "def index\n render json: { bookings: @site.bookings.order(datetime: :asc) }, status: 200\n end", "def get_list(list_id)\n rest(\"get\", \"lists/#{list_id}\")\n end", "def set_listing\n @listing = Listing.find(params[:id])\n end", "def index\n #retrieve all listings from the database and implement eager loading on pictures and categories\n @listings = Listing.all.with_attached_picture.includes(:category)\n p @listings\n end", "def listings\n return @listings ||= build_all_listings\n end", "def listings\n return @listings ||= build_all_listings\n end", "def listings\n return @listings ||= build_all_listings\n end", "def set_listing\n @listing = Listing.find(params[\"id\"])\n end", "def set_listing\n @listing = Listing.find(params[:id])\n end", "def set_listing\n @listing = Listing.find(params[:id])\n end", "def set_listing\n @listing = Listing.find(params[:id])\n end", "def set_listing\n @listing = Listing.find(params[:id])\n end" ]
[ "0.7888308", "0.7693812", "0.76934797", "0.76559603", "0.7541514", "0.73575544", "0.73575544", "0.73575544", "0.73575544", "0.73575544", "0.73575544", "0.7326395", "0.7326395", "0.7326395", "0.7302459", "0.7253915", "0.7239842", "0.7234065", "0.7224667", "0.7222903", "0.7222903", "0.70286536", "0.70010006", "0.6945563", "0.68147445", "0.6766104", "0.6758875", "0.67288715", "0.6699531", "0.66776407", "0.6638239", "0.66317415", "0.6608357", "0.6575054", "0.6571179", "0.65607905", "0.65580344", "0.655595", "0.65461886", "0.65417737", "0.6535402", "0.65209275", "0.65146506", "0.65146506", "0.65146506", "0.6513298", "0.6503404", "0.6500809", "0.64838886", "0.64782137", "0.64782137", "0.64782137", "0.647579", "0.6466233", "0.6465394", "0.6460201", "0.64567786", "0.64432895", "0.641283", "0.6404302", "0.64023316", "0.6399078", "0.63941413", "0.6387979", "0.6381515", "0.6380479", "0.6354018", "0.63510126", "0.63429314", "0.63427943", "0.6338599", "0.63375103", "0.63371915", "0.63361424", "0.6307356", "0.6302254", "0.6301348", "0.6296232", "0.62894934", "0.6284444", "0.6282902", "0.62742895", "0.62742895", "0.62742895", "0.62742895", "0.62742895", "0.62735665", "0.6265265", "0.6240281", "0.6238501", "0.6233113", "0.6204118", "0.620343", "0.6199995", "0.6199995", "0.6199995", "0.61994505", "0.6198262", "0.6198262", "0.6198262", "0.6198262" ]
0.0
-1
POST /listings POST /listings.json
def create # First find the company name (:company_name) if listing_params.has_key?(:company_name) c_name = listing_params[:company_name] company = Company.find_or_create_by(name: c_name) listing_params[:company_id] = company.id listing_params.delete(:company_name) @listing = Listing.new({ company_id: company.id, description: listing_params[:description], deadline: listing_params[:deadline], job_title: listing_params[:job_title], url: listing_params[:url] }) else @listing = Listing.new({ description: listing_params[:description], deadline: listing_params[:deadline], job_title: listing_params[:job_title], url: listing_params[:url] }) end if @listing.save render :show, status: :created, location: @listing else render json: @listing.errors, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n\n @listing = Listing.new(listing_params)\n\n @listing.save\n\n render json: @listing\n redirect_to listings_path # redirect to home page\n end", "def index\n @listings = Listing.all\n render json: @listings\n end", "def create\n #debugger\n #TODO: DELETE ALL\n @listing = Listing.new(listing_params)\n\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render action: 'show', status: :created, location: @listing }\n else\n format.html { render action: 'new' }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @listings = Listing.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @listings }\n end\n end", "def index\n @listings = Listing.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @listings }\n end\n end", "def create\n @listing = Listing.new(listing_params)\n\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @listing = current_user.listings.new(listing_params)\n\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @listing = Listing.new(listing_params)\n\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render action: 'show', status: :created, location: @listing }\n else\n format.html { render action: 'new' }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @listing = Listing.new(listing_params)\n\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render action: 'show', status: :created, location: @listing }\n else\n format.html { render action: 'new' }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @listing = current_profile.listings.build(listing_params)\n\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @listings = Listing.by_user(current_user).all\n\n render json: @listings\n end", "def create\n @listing = current_user.listings.build(listing_params)\n\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @spot_listing = current_user.spot_listings.build(params[:spot_listing])\n @spot_listing.completed = false\n respond_to do |format|\n if @spot_listing.save\n format.html { redirect_to user_dashboard_url, notice: 'Your listing has been successfully created' }\n format.json { render json: @spot_listing, status: :created, location: @spot_listing }\n else\n format.html { render action: \"new\" }\n format.json { render json: @spot_listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n # Associate user id with creating a listing \n @listing = current_user.listings.new(listing_params)\n\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: \"Listing was successfully created.\" }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # byebug\n @building = Building.find(listing_params[:building_id])\n @listing = Listing.new(listing_params)\n\n respond_to do |format|\n if @listing.save\n format.html { redirect_to [@building, @listing], notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n format.js {}\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n format.js {}\n end\n end\n end", "def create\n @listing = Listing.new(listing_params)\n\n\n respond_to do |format|\n if @listing.save\n format.html { redirect_to listing_path(@listing), notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n # post_to_slack(@listing.id)\n # update_categories\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @listing = @commoner.listings.build(listing_params)\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # @listing = Listing.new(listing_params)\n @listing = current_user.listings.build(listing_params)\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def listing_params\n params.require(:listing).permit(:name, :time, :location, :body, :category)\n end", "def create\n @listing = Listing.new(listing_params)\n @listing.user = current_user\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @listings = Listing.all\n \n end", "def index\n @listings = Listing.all\n end", "def index\n @listings = Listing.all\n end", "def index\n @listings = Listing.all\n end", "def index\n @listings = Listing.all\n end", "def index\n @listings = Listing.all\n end", "def index\n @listings = Listing.all\n end", "def create\n @listing = Listing.new(params[:listing])\n @listing.urls.append params[:url]\n\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render json: @listing, status: :created, location: @listing }\n else\n format.html { render action: \"new\" }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def serve_listing_data\n @listings = Listing.open.joins(:origin_loc).group(\"listings.id\").\n order(\"listings.created_at DESC\").find_with(params, @current_user, @current_community).select(\"listings.id, listing_type, category\")\n render :json => { :data => @listings }\n end", "def create\n @listing = current_user.listings.new(listing_params)\n\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render action: 'show', status: :created, location: @listing }\n\n Mailer.new_listing(@listing).deliver\n\n else\n format.html { render action: 'new' }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @listing = current_user.listings.new(listing_params)\n # @listing.status = 1\n if @listing.save\n redirect_to @listing\n else\n render :new\n end\n end", "def index\n @building = Building.find(params[:building_id])\n @listings = Listing.all\n end", "def listing_params\n\t params.permit(:token, :pretty, :format,\n\t \t:listing_type, :layout, :bathrooms, :min_rent, :max_rent,\n\t \t:cats_allowed, :dogs_allowed, :elevator, :doorman, :date_available_after,\n\t \t:date_available_before, :laundry_in_building, :laundry_in_unit, :changed_at,\n\t \t:has_photos, :featured, :sort, :sort_dir, :per_page, :page,\n\t \t:neighborhoods, :geometry, :agents, :status)\n \tend", "def create\n @listing = Listing.new(listing_params)\n @listing.user_id = current_user.id\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @listing = Listing.new(listing_params)\n @listing.user_id = current_user.id\n respond_to do |format|\n if @listing.save!\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n #contains all the listings\n @listings = Listing.all\n end", "def create\n @listing = current_user.listings.build(listing_params)\n @listing.save\n redirect_to @listing\n end", "def listing_params\n params.require(:listing).permit(:name, :content)\n end", "def create\n @listing = current_user.listings.new(listing_params)\n if @listing.save! \n redirect_to '/listings'\n else\n render 'new'\n end\n end", "def listing_params\n params.require(:listing).permit(:name, :desc, :price, :address, :latitude, :longitude, :token, :coin, :published_at, :images, :imove_in, :property, :furnished, :area, :parking, :bathroom, :bedroom, :hide)\n end", "def listing_params\n params.require(:listing).permit(:title,:description,:room_type,:bedrooms,:rent,:rooms_for_rent,:available_from,:minimumstay,:current_roommates,:prefred_gender,:prefred_age, :prefred_occupation,:phonenumber_visibility,:visible_status,:verified_status,:security_deposit,:furnishing_status,:landmark,:user_id,:area_id,:city_id,:rule_ids => [],:amenity_ids => [])\n end", "def listing_params\n params.require(:listing).permit(:name, :phone, :address, :postal_code, :email, :description, :price, :image_url, :home_service, :aggressive_pets_accepted, :query, :user_id)\n end", "def listing_params\n params.require(:listing).permit(:title, :picture, :description, :price, :availability, :condition, :category_id, feature_ids: [])\n end", "def create\n @listing = Listing.new(listing_params)\n @listing.user_id = current_user.id\n\n respond_to do |format|\n if @listing.save\n\n # format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.html { redirect_to new_listing_availability_path(@listing), notice: 'Step 2: Listing was successfully created. Please add at least one start date and a later end date' }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @postings = Posting.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @postings }\n end\n end", "def listing_params\n params.require(:listing).permit(:user_id, :title, :description, :property_type, :num_of_rooms, :num_of_bathrooms, :price, :address, :city, :country, :max_guest, :num_of_beds)\n end", "def index\n \t@listings = Listing.all\n end", "def create\n # @profile_id = current_user.profile.id\n # @profile_name = current_user.profile.first_name\n @listing = current_user.profile.listings.create(listing_params)\n\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @listing = Listing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @listing }\n end\n end", "def new\n @listing = Listing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @listing }\n end\n end", "def new\n @listing = Listing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @listing }\n end\n end", "def listing\n @listing = Listing.find(params[:listing_id])\n end", "def create\n @listing = Listing.new(params[:listing])\n\n respond_to do |format|\n if @listing.save\n flash[:notice] = 'Listing was successfully created.'\n format.html { redirect_to(@listing) }\n format.xml { render :xml => @listing, :status => :created, :location => @listing }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @listing.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @listing = Listing.new(params[:listing])\n\n respond_to do |format|\n if @listing.save\n flash[:notice] = 'Listing was successfully created.'\n format.html { redirect_to(@listing) }\n format.xml { render :xml => @listing, :status => :created, :location => @listing }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @listing.errors, :status => :unprocessable_entity }\n end\n end\n end", "def listing_params\n params.require(:listing).permit(:depart_maps_id, :depart_loc_id, :depart_range_start, :depart_range_end, :dest_maps_id, :dest_loc_id, :dest_range_start, :dest_range_end, :listing_type, :money, :comments, :detour_time)\n end", "def my_listings\n page = params[:page]\n offset = page.to_s+\"0\"\n @prevPage = page.to_i-1\n @nextPage = page.to_i+1\n\n userID = session[:user_id]\n\n uri = URI(\"http://107.170.7.58:4567/api/sell\")\n parameters = {\"ext\" => \"json\", \"user_id\" => userID, \"count\" => \"10\", \"offset\" => offset}\n response = Net::HTTP.post_form(uri, parameters)\n\n list = JSON.parse(response.body)\n\n @sells = Array.new\n @books = Array.new\n list.each do |listing|\n if listing[\"kind\"].eql? \"sell\"\n @sells.push Sell.new(listing[\"data\"])\n else if listing[\"kind\"].eql? \"book\"\n @books[listing[\"data\"][\"id\"]] = Edition.new(listing[\"data\"])\n end\n end\n end\n end", "def create\n @listing = Listing.new(listing_params)\n @listing.user_id = current_user.id\n\n authorize! :create, @listing\n\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @listing = Listing.new(params[:listing])\n @listing.user_id= session[:user_id]\n respond_to do |format|\n if @listing.save\n @client = GooglePlaces::Client.new('AIzaSyCzlX9Hndc6BZlHpLVkk8S_xRGOsnA_cJ4')\n @arr=[@listing.latitude, @listing.longitude]\n @vv=@client.spots(@arr[0], @arr[1])\n @vv.each do |t|\n @pn= Pen.new\n @pn.latitude=t.lat\n @pn.longitude=t.lng\n @pn.vicinity=t.vicinity\n @pn.name=t.name\n @pn.icon=t.icon\n @pn.url=t.url\n @pn.types=t.types.join(\",\")\n @pn.listing_id=@listing.id\n @pn.save\n end # for end\n redirect_to \"/listings//\", :notice => \"New list successfully created\"\n else\n format.html { render action: \"new\" }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end # commond end for if {statements} else {statements} end\n end #respond do\n end", "def create\n @listing = Listing.new(listing_params)\n\n # check that the product has a print_image already created\n if @listing.product.print_image.file.nil?\n @listing.errors.add(:create, \"Product must have a print_image to create a listing\")\n render json: @listing.errors, status: :unprocessable_entity and return\n end\n\n current_user.listings << @listing\n\n if @listing.save\n store = Store.find(listing_params[:store_id])\n adapter = store.get_adapter\n @listing.external_id = adapter.list_product(@listing)\n @listing.printer_sku = @listing.sku\n Rails.logger.debug \"----------start------\"\n Rails.logger.debug @listing.inspect\n Rails.logger.debug \"----------start------\"\n\n if @listing.save\n render json: @listing, status: :created\n else\n render json: @listing.errors, status: :unprocessable_entity\n end\n else\n render json: @listing.errors, status: :unprocessable_entity\n end\n end", "def new\n @listing = Listing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json => @listing }\n end\n end", "def create\n @waiting_list = WaitingList.new(params[:waiting_list])\n\n respond_to do |format|\n if @waiting_list.save\n format.html { redirect_to @waiting_list, notice: 'Waiting list was successfully created.' }\n format.json { render json: @waiting_list, status: :created, location: @waiting_list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @waiting_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def listing_params\n params.require(:listing).permit(:name, :location, :description, :price, :tag_list, photos: [])\n end", "def listing_params\n params.require(:listing).permit(:name, :code, :language, :private)\n end", "def listing_params\n params.require(:listing).permit(:name, :place_type, :property_type, :room_number, :bed_number, :guest_number, :country, :state, :city, :zipcode, :address, :price, :description, :user_id)\n end", "def listing_params\n params.require(:listing).permit(:description, :address, :num_of_bedrooms, :num_of_guests, :name, :location, listing_photos_attributes: [:id, :listing_id, :image])\n end", "def index\n # @listings = Listing.all\n @listings = Listing.order(:name).page params[:page]\n end", "def listing_params\n params.require(:listing).permit(:title, :price, :location, :bedrooms, :bathrooms, :amenities, :description, {image:[]}, :used_date, :all_tags, :tag)\n end", "def listing_params\n params.require(:listing).permit(:title, :description, :year, :length, :sleeps, :rateperhour, :vehicletype, :rentalminimum, :latitude, :longitude, :city, :imagefront, :imageback, :imageleft, :imageright, :interiorfront, :interiorback, :state, :zipcode, :pickup_street_address, :pickup_city, :pickup_state, :pickup_zipcode, :extra_guest_charges, :maximum_guest_allowed)\n end", "def listing_params\n params.require(:listing).permit(:profile_id, :hobby_id, :description, :location, :date, :city_id, :equipment, :capacity)\n end", "def listing_params\n params.require(:listing).permit(:title, :description, :guests, :city, :stay_length, :country, :in_exchange)\n end", "def listing_params\n params.require(:listing).permit(\n :title,\n :description,\n :image_url,\n :activated_at,\n :street_1,\n :street_2,\n :postal_code,\n :client_managed,\n client: [\n :first_name,\n :last_name,\n :email,\n :telephone\n ]\n )\n end", "def listing_params\n params[:listing]\n end", "def create\n @listing = current_user.listings.new(listing_params)\n\n respond_to do |format|\n if @listing.save\n params[:listing_photos]['image'].each do |a|\n @listing_photo = @listing.listing_photos.create!(:image => a, :listing_id => @listing.id)\n end\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @bookings = Booking.all\n\n render json: @bookings\n end", "def listing_params\n listing_stuff = params.require(:listing).permit(:building_id, :unit_no, :floor_plan, :num_fbaths, :num_hbaths, :advertising, :move_in_special, :commission, :rent_price, :rent_per_period, :photo, :for_sale, :unit_floor_location, :type_of_property, :style, :sqft, :balcony, :liv_area, :efficiency, :faces, :additional_parking_info, :furnished_information, :available_date, :view, :floor, :dinning, :listing_type, :list_date, :expiration_date, :convert_bed, floor_ids: [], dining_area_ids: [], interior_feature_ids: []).to_h\n listing_stuff[:building_id] = params[:building_id]\n listing_stuff\n end", "def create\n @listing = SaleListing.new(listing_params)\n\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: 'Sale listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @listing = Listing.new(listing_params)\n if @listing.save\n create_images if params[:images]\n flash[:notice] = 'Listing was successfully created.'\n end\n respond_with(@listing)\n end", "def listing_params\n params.require(:listing).permit(\n :user_id, :place_name, :place_type, :address, \n :bedroom, :bath, :amenity, :cost_per_night,:description, {avatars:[]} \n )\n # if want to create post, it need :user_id, :place_name, :place_type, :address, \n # :bedroom, :bath, :amenity, :cost_per_night,:description validation\n end", "def listing_params\n params.require(:listing).permit(:description, :street_address, :city, :state,\n :zip_code, :primary_contact, :secondary_contact,\n :listing_status, :asking_price, :renobb, :picture)\n end", "def listing_params\n params.require(:listing).permit(:name, :address, :address_en, :photo, :manual, :map, :checkin, :checkout, :house_rule, :question, listing_details_attributes: [:id, :name, :photo_url, :detail, :_destroy])\n end", "def create\n @listing = Listing.new(listing_params)\n @listing.user_id = current_user.id\n @listing.profile_id = current_user.profile.id\n # @listing.status = params[:status].nil? ? 'pending' : 'draft'\n\n respond_to do |format|\n if @listing.save\n @listing.update(status: 'draft') if saving_as_draft?\n @listing.update(status: 'pending') if publishing?#waiting for admin to verify (active)\n\n @listing.category_ids=(params[:category]) unless params[:category].empty? or params[:category].nil?\n format.html { redirect_to display_vendor_listing_path(current_user.username, @listing), notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @meetings_list = MeetingsList.new(meetings_list_params)\n\n respond_to do |format|\n if @meetings_list.save\n format.html { redirect_to @meetings_list, notice: 'Die Meeting-Liste wurde erfolgreich erstellt.' }\n format.json { render :show, status: :created, location: @meetings_list }\n else\n format.html { render :new }\n format.json { render json: @meetings_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def listing_params\n params.require(:listing).permit(:title, :description, :organization, :email, :salary, :city, :state, :user_id, :location, :source, :posted, :contact, :category, :tag_list, :wyncode_only)\n end", "def listing_params\n params.fetch(:listing, {})\n end", "def listing_params\n params.require(:listing).permit(:name, :description, :price, :slug, {listingimages: []})\n end", "def create\n puts params[:listing]\n params[:listing][:tap_description] = params[:listing][:description].to_s + \"-\"+params[:listing][:bedrooms].to_s + \"Beds-\"+ params[:listing][:bathrooms].to_s + \"Baths -\" + params[:listing][:squarefootage].to_s + \"sq.ft\"\n @listing = Listing.new(params[:listing])\n @listing.user_id = current_user.id\n if !params[:image_file].nil?\n @uploadimages = Picture.new\n @uploadimages.upload_file_name = params[:image_file].original_filename\n @uploadimages.upload_content_type = params[:image_file].content_type\n @uploadimages.upload_file_size = params[:image_file].size\n @uploadimages.data = params[:image_file].read\n end\n respond_to do |format|\n if @listing.save\n @listings = Listing.where(:user_id => current_user.id)\n if !params[:image_file].nil?\n @uploadimages.listing_id = @listing.id\n @uploadimages.save\n end\n format.html { redirect_to '/mylistings', notice: 'Listing was successfully created.' }\n format.json { render json: @listings, status: :created, location: @listing }\n else\n format.html { render action: \"new\" }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tasklisting = Tasklisting.new(tasklisting_params)\n\n respond_to do |format|\n if @tasklisting.save\n format.html { redirect_to @tasklisting, notice: 'Tasklisting was successfully created.' }\n format.json { render :show, status: :created, location: @tasklisting }\n else\n format.html { render :new }\n format.json { render json: @tasklisting.errors, status: :unprocessable_entity }\n end\n end\n end", "def listing_params\n params.require(:listing).permit(:image, :city, :address, :suite, :size, :building_type, :building_class, :asking_rate, :opex, :lease_type, :brokerage, :notes)\n end", "def show\n @listings = Listing.find(params[:id])\n end", "def listing_params\n params.require(:listing).permit(:title, :created_at, :content, :picture, :price, :category_id)\n end", "def create\n @listing = Listing.new(listing_params)\n @listing.host_email = current_user.email\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def listing_params\n params.require(:listing).permit(:title, :description, :remuneration, :category_id, :page)\n end", "def listing_params\n params.require(:listing).permit(:title, :body, :user_id)\n end", "def create\n @listing = current_user.listings.create(listing_params)\n if @listing.valid?\n @listing.save!\n redirect_to listing_path(@listing.id)\n else\n flash.now[:messages] = @listing.errors.full_messages\n render :new\n end\nend", "def index\n @bookings = smart_listing_create(:bookings, Booking.includes(:seat, :user).where(user_id: current_user.id), partial: \"bookings/listing\")\n end", "def set_listing\n @listing = Listing.find(params[\"id\"])\n end", "def post_req\n redirect_to :controller => :listings, :action => :index\n end", "def listing_params\n schema = Listing.column_names.map &:to_sym\n params.require(:listing).permit(schema)\n end", "def listing_params\n params.require(:listing).permit(\n :host_id,\n :title,\n :description,\n :price,\n :max_capacity,\n :site,\n :lat,\n :lng,\n :location,\n :check_in,\n :check_out,\n :photos\n )\n end", "def listing_params\n params.require(:listing).permit(:title, :description, :etsy_user_id, :price, :etsy_listing_id)\n end" ]
[ "0.7446066", "0.7005275", "0.6834559", "0.6828408", "0.6827981", "0.6775853", "0.6734454", "0.6723492", "0.6723492", "0.6673963", "0.6612273", "0.66121864", "0.6581905", "0.6568161", "0.65660554", "0.6559053", "0.6555972", "0.65158397", "0.6491164", "0.6446251", "0.6435303", "0.6434414", "0.6434414", "0.6434414", "0.6434414", "0.6434414", "0.6434414", "0.64224786", "0.6421064", "0.6412859", "0.63799906", "0.63727295", "0.6359386", "0.63567346", "0.6350961", "0.63424164", "0.6341744", "0.6333401", "0.63218683", "0.63133717", "0.62897825", "0.62862587", "0.62732726", "0.6267138", "0.6243244", "0.6237521", "0.62269753", "0.62023073", "0.61984754", "0.61984754", "0.61984754", "0.6196916", "0.61919475", "0.61919475", "0.61870515", "0.61652106", "0.61628157", "0.61478925", "0.61309683", "0.61238813", "0.6114666", "0.6102164", "0.6091825", "0.6091071", "0.6084754", "0.60810703", "0.6073797", "0.6071058", "0.6070352", "0.60662603", "0.60401523", "0.6036681", "0.6027931", "0.60236037", "0.5993447", "0.59854406", "0.5984274", "0.5982448", "0.5975913", "0.5975679", "0.5969285", "0.5968414", "0.59675014", "0.5967092", "0.5965465", "0.5959429", "0.5957223", "0.5954616", "0.595436", "0.59488463", "0.5945933", "0.5927306", "0.59257555", "0.5913477", "0.59122795", "0.5909264", "0.5896563", "0.5895885", "0.589409", "0.58924025" ]
0.6194216
52
PATCH/PUT /listings/1 PATCH/PUT /listings/1.json
def update if @listing.update(listing_params) render :show, status: :ok, location: @listing else render json: @listing.errors, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n #updating the listings\n respond_to do |format|\n if @listing.update(listing_params)\n format.html { redirect_to @listing, notice: \"Listing was successfully updated.\" }\n format.json { render :show, status: :ok, location: @listing }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @listing = Listing.find(params[:id])\n\n respond_to do |format|\n if @listing.update_attributes(params[:listing])\n format.html { redirect_to @listing, notice: 'Listing was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @listing = Listing.find(params[:id])\n\n respond_to do |format|\n if @listing.update_attributes(params[:listing])\n format.html { redirect_to @listing, notice: 'Listing was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @listing = Listing.find(params[:id])\n\n respond_to do |format|\n if @listing.update_attributes(params[:listing])\n format.html { redirect_to @listing, notice: 'Your property was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @listing.update(listing_params)\n format.html { redirect_to @listing, notice: 'Listing was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @listing.update(listing_params)\n format.html { redirect_to @listing, notice: 'Listing was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @listing.update(listing_params)\n format.html { redirect_to @listing, notice: 'Listing was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @listing.update(listing_params)\n format.html { redirect_to @listing, notice: 'Listing was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @listing.update(listing_params)\n format.html { redirect_to @listing, notice: 'Listing was successfully updated.' }\n format.json { render :show, status: :ok, location: @listing }\n else\n format.html { render :edit }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @listing.update(listing_params)\n format.html { redirect_to @listing, notice: 'Listing was successfully updated.' }\n format.json { render :show, status: :ok, location: @listing }\n else\n format.html { render :edit }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @listing.update(listing_params)\n format.html { redirect_to @listing, notice: 'Listing was successfully updated.' }\n format.json { render :show, status: :ok, location: @listing }\n else\n format.html { render :edit }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @listing.update(listing_params)\n format.html { redirect_to @listing, notice: 'Listing was successfully updated.' }\n format.json { render :show, status: :ok, location: @listing }\n else\n format.html { render :edit }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @listing.update(listing_params)\n format.html { redirect_to @listing, notice: 'Listing was successfully updated.' }\n format.json { render :show, status: :ok, location: @listing }\n else\n format.html { render :edit }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @listing.update(listing_params)\n format.html { redirect_to @listing, notice: 'Listing was successfully updated.' }\n format.json { render :show, status: :ok, location: @listing }\n else\n format.html { render :edit }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @listing.update(listing_params)\n format.html { redirect_to @listing, notice: 'Listing was successfully updated.' }\n format.json { render :show, status: :ok, location: @listing }\n else\n format.html { render :edit }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @listing.update(listing_params)\n format.html { redirect_to @listing, notice: 'Listing was successfully updated.' }\n format.json { render :show, status: :ok, location: @listing }\n else\n format.html { render :edit }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @listing.update(listing_params)\n format.html { redirect_to @listing, notice: 'Listing was successfully updated.' }\n format.json { render :show, status: :ok, location: @listing }\n else\n format.html { render :edit }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @listing.update(listing_params)\n format.html { redirect_to @listing, notice: 'Listing was successfully updated.' }\n format.json { render :show, status: :ok, location: @listing }\n else\n format.html { render :edit }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @listing.update(listing_params)\n format.html { redirect_to @listing, notice: 'Listing was successfully updated.' }\n format.json { render :show, status: :ok, location: @listing }\n else\n format.html { render :edit }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @listing.update(listing_params)\n format.html { redirect_to @listing, notice: 'Listing was successfully updated.' }\n format.json { render :show, status: :ok, location: @listing }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @listing.update(listing_params)\n format.html { redirect_to @listing, notice: \"Listing was successfully updated.\" }\n format.json { render :show, status: :ok, location: @listing }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @listing = Listing.find(params[:id])\n\n respond_to do |format|\n if @listing.update_attributes(params[:listing])\n format.html { redirect_to @listing, notice: 'Listing was successfully updated.' }\n format.js { redirect_to @listing, notice: 'Listing was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :update, @listing\n respond_to do |format|\n if @listing.update(listing_params)\n format.html { redirect_to @listing, notice: 'Listing was successfully updated.' }\n format.json { render :show, status: :ok, location: @listing }\n else\n format.html { render :edit }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @listing.update(listing_params)\n @building = @listing.building\n format.html { redirect_to [@building, @listing], notice: 'Listing was successfully updated.' }\n format.json { render :show, status: :ok, location: @listing }\n else\n format.html { render :edit }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @listing = Listing.find(params[:id])\n puts \"lat long\"\n puts @listing.lat\n puts @listing.long\n\n respond_to do |format|\n if @listing.update_attributes(params[:listing])\n format.html { redirect_to '/mylistings', notice: 'Listing was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @listing = Listing.find(params[:id])\n if @listing.user == current_user\n respond_to do |format|\n if @listing.update(listing_params)\n format.html { redirect_to @listing, notice: 'Listing was successfully updated.' }\n format.json { render :show, status: :ok, location: @listing }\n else\n format.html { render :edit }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def update\n @listing = Listing.find(params[:id])\n\n respond_to do |format|\n if @listing.update_attributes(params[:listing])\n flash[:notice] = 'Listing was successfully updated.'\n format.html { redirect_to(@listing) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @listing.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @listing = Listing.find(params[:id])\n\n respond_to do |format|\n if @listing.update_attributes(params[:listing])\n flash[:notice] = 'Listing was successfully updated.'\n format.html { redirect_to(@listing) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @listing.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_list(list_id, name)\n data = {\n list: {\n name: name\n }\n }\n rest(\"patch\", \"lists/#{list_id}\", data)\n end", "def update!(**args)\n @kind = args[:kind] unless args[:kind].nil?\n @listings = args[:listings] unless args[:listings].nil?\n end", "def update!(**args)\n @kind = args[:kind] unless args[:kind].nil?\n @listings = args[:listings] unless args[:listings].nil?\n end", "def update\n respond_to do |format|\n if @listings_poll.update(listings_poll_params)\n format.html { redirect_to @listings_poll, notice: 'Listings poll was successfully updated.' }\n format.json { render :show, status: :ok, location: @listings_poll }\n else\n format.html { render :edit }\n format.json { render json: @listings_poll.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @spot_listing = SpotListing.find(params[:id])\n\n respond_to do |format|\n if @spot_listing.update_attributes(params[:spot_listing])\n format.html { redirect_to @spot_listing, notice: 'Spot listing was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spot_listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n current_user.listing = Listing.new(listing_params)\n @listing = Listing.find_by(user_id: current_user.id)\n\n respond_to do |format|\n if @listing.update(listing_params)\n format.html { redirect_to @listing, notice: 'Listing was successfully updated.' }\n format.json { render :show, status: :ok, location: @listing }\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @waiting_list = WaitingList.find(params[:id])\n\n respond_to do |format|\n if @waiting_list.update_attributes(params[:waiting_list])\n format.html { redirect_to @waiting_list, notice: 'Waiting list was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @waiting_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def listings_upsert_residential_listing_with_http_info(listing, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ListingsApi.listings_upsert_residential_listing ...'\n end\n # verify the required parameter 'listing' is set\n if @api_client.config.client_side_validation && listing.nil?\n fail ArgumentError, \"Missing the required parameter 'listing' when calling ListingsApi.listings_upsert_residential_listing\"\n end\n # resource path\n local_var_path = '/v1/listings/residential'\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', 'text/json', 'text/html', 'application/xml', 'text/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'text/html', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(listing)\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 => 'DomainListingAdminServiceV1ModelListingResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ListingsApi#listings_upsert_residential_listing\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n @thing_list = ThingList.find(params[:id])\n\n respond_to do |format|\n if @thing_list.update_attributes(params[:thing_list])\n format.html { redirect_to(@thing_list, :notice => 'Thing list was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @thing_list.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @listing.update(listing_params)\n format.html { redirect_to @listing, notice: 'Sale listing was successfully updated.' }\n format.json { render :show, status: :ok, location: @listing }\n else\n format.html { render :edit }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @listing.user_id == current_user.id\n if @listing.update(listing_params)\n format.html { redirect_to @listing, notice: 'Your listing was successfully updated.' }\n format.json { render :show, status: :ok, location: @listing }\n end\n else\n format.html { render :edit }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tasklisting.update(tasklisting_params)\n format.html { redirect_to @tasklisting, notice: 'Tasklisting was successfully updated.' }\n format.json { render :show, status: :ok, location: @tasklisting }\n else\n format.html { render :edit }\n format.json { render json: @tasklisting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(existing_list_params)\n format.html { redirect_to my_list_path(@list), notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: my_list_path(@list) }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def update\n respond_to do |format|\n if @ingredient_list.update(ingredient_list_params)\n format.html { redirect_to @ingredient_list, notice: 'Ingredient list was successfully updated.' }\n format.json { render :show, status: :ok, location: @ingredient_list }\n else\n format.html { render :edit }\n format.json { render json: @ingredient_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @listed.update(listed_params)\n format.html { redirect_to session[:previous_url], notice: 'List item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @listed.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n if @listing.update(listing_params)\n redirect_to \"/listings/#{@listing.id}\"\n else\n flash[:warning] = 'Y U DO THIS'\n render :edit\n end\n end", "def update\n respond_to do |format|\n if @business_listing.update(business_listing_params)\n format.html { redirect_to @business_listing, notice: 'Business listing was successfully updated.' }\n format.json { render :show, status: :ok, location: @business_listing }\n else\n format.html { render :edit }\n format.json { render json: @business_listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @slisting.update(slisting_params)\n format.html { redirect_to @slisting, notice: 'Slisting was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @slisting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_shopping_list.update(api_v1_shopping_list_params)\n format.html { redirect_to @api_v1_shopping_list, notice: 'Shopping list was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_shopping_list }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_shopping_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @listing.status = 'draft' if Unpublish?\n respond_to do |format|\n if @listing.update(listing_params)\n @listing.category_ids=(params[:category]) unless params[:category].empty? or params[:category].nil?\n format.html { redirect_to @listing, notice: 'Listing was successfully updated.' }\n format.json { render :show, status: :ok, location: @listing }\n else\n format.html { render :edit }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_list(id, list)\n record \"/todos/update_list/#{id}\", :list => list\n end", "def update\n @listing_info = @listing.listing_info\n @listing_info.attributes = params[:listing_info]\n\n respond_to do |format|\n #need to call save explicitly for associations\n if @listing_info.valid? && @listing_info.livingroom.valid? && @listing_info.bedrooms.all?(&:valid?) \n @listing_info.save!\n @listing_info.livingroom.save!\n @listing_info.bedrooms.each(&:save!)\n flash[:notice] = 'ListingInfo was successfully updated.'\n format.html { redirect_to(:action=>'edit') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @listing_info.errors, :status => :unprocessable_entity }\n end\n end\n end", "def patch!\n request! :patch\n end", "def update\n @list = List.find(params[:id])\n\n respond_to do |format|\n if @list.update_attributes(params[:list])\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @list = List.find(params[:id])\n\n respond_to do |format|\n if @list.update_attributes(params[:list])\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @topping_list.update(topping_list_params)\n format.html { redirect_to @topping_list, notice: 'Topping list was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @topping_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n # this allows the user to edit an existing todo item\n # this is done by first finding the the todo items listing params :id\n @listing = Listing.find(params[:id])\n end", "def update\n @list = List.find(params[:id])\n\n respond_to do |format|\n if @list.update_attributes(params[:list])\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n @listing = Listing.find(params[:id])\n end", "def update\n @listing_status = ListingStatus.find(:first, :conditions => [\"id = ?\", params[:id]], :select => 'id, description, position, is_final', :order => 'description')\n ListingStatus.clear_cached(params[:id])\n ListingStatus.clear_cached_from_description(@listing_status.description)\n respond_to do |format|\n if @listing_status.update_attributes(params[:listing_status])\n\n format.html { redirect_to(@listing_status, :notice => 'Listing status was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @listing_status.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n store_photos\n if @listing.update(listing_params)\n format.html { redirect_to @listing, notice: 'Listing was successfully updated.' }\n format.json { render :show, status: :ok, location: @listing }\n else\n format.html { render :edit }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def listings_upsert_business_listing_with_http_info(listing, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ListingsApi.listings_upsert_business_listing ...'\n end\n # verify the required parameter 'listing' is set\n if @api_client.config.client_side_validation && listing.nil?\n fail ArgumentError, \"Missing the required parameter 'listing' when calling ListingsApi.listings_upsert_business_listing\"\n end\n # resource path\n local_var_path = '/v1/listings/business'\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', 'text/json', 'text/html', 'application/xml', 'text/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'text/html', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(listing)\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 => 'DomainListingAdminServiceV1ModelListingResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ListingsApi#listings_upsert_business_listing\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n if @listing.update(listing_params)\n redirect_to @listing\n else\n render :edit\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to management_lists_path, notice: 'List was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @listing.update(listing_params)\n redirect_to @listing, notice: 'Listing was successfully updated.'\n else\n render :edit\n end\n end", "def update\n item = @list.list_items.find(params[:id])\n\n if item.update_attributes(params[:list_item])\n render json: item\n else\n error(t('messages.list_item.errors.update'))\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end", "def update\n if params[:schedule]\n params[:schedule][:bookings] = Bookings.find(params[:schedule][:bookings])\n else\n params[:schedule] = {}\n params[:schedule][:bookings] = @schedule.bookings\n params[:schedule][:bookings] << Booking.find(params[:add_bookings]) if params[:add_bookings]\n params[:schedule][:bookings].reject! { |e| params[:remove_bookings].include? e.id.to_s } if params[:remove_bookings]\n params[:schedule][:bookings] = params[:schedule][:bookings].flatten\n end\n respond_to do |format|\n if @schedule.update_attributes(params[:schedule])\n format.html { redirect_to @schedule, notice: 'Schedule was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @list\n\n if @list.update(list_params)\n json_response(@list.decorate, :ok)\n else\n json_response(@list.errors, :unprocessable_entity)\n end\n end", "def update_list(list_id:, name:)\n check_token\n list = Todoable::List.new(name: name)\n response = self.class.patch(\n \"/lists/#{list_id}\",\n body: list.post_body,\n headers: headers,\n format: :text\n )\n check_and_raise_errors(response)\n # This endpoint returns a plaintext body: \"<new name> updated\", so\n # while I'd like to return a List with ListItems, that would require\n # first looking up the list which isn't ideal. So we'll return true, ask\n # todoable to fix this endpoint, and make developers keep track of the\n # name change\n true\n end", "def update\n @listing = Listing.find(params[:id])\n respond_to do |format|\n if (@listing.user_id != current_user.id && !verify_admin_status)\n flash[:notice] = 'You don not have right to edit this listing.'\n format.html { redirect_to(@listing) }\n format.fbml { redirect_to(@listing) }\n format.xml { head :ok }\n elsif @listing.update_attributes(params[:listing])\n flash[:notice] = 'Listing was successfully updated.'\n format.html { redirect_to(@listing) }\n format.fbml { redirect_to(@listing) }\n format.xml { head :ok }\n else\n flash[:notice] = \"Cannot update the listing!\"\n format.html { render :action => \"edit\" }\n format.fbml { render :action => \"edit\" }\n format.xml { render :xml => @listing.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to [@list.organization, @list], notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: [@list.organization, @list] }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @job_list = JobList.find(params[:id])\n\n respond_to do |format|\n if @job_list.update_attributes(params[:job_list])\n format.html { redirect_to @job_list, notice: 'Job list was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n @list_item = ListItem.find(params[:id])\n\n if @list_item.update(list_item_params)\n head :no_content\n else\n render json: @list_item.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @api_v1_todo.update(api_v1_todo_params)\n format.json { render json: @api_v1_todo, status: :ok }\n else\n format.json { render json: @api_v1_todo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(_list_params)\n format.html { redirect_to @list, notice: \"List was successfully updated.\" }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @packing_list = PackingList.find(params[:packing_list_id])\n @context = @packing_list.context\n @packable = @packing_list.packables.find(params[:packable_id])\n\n respond_to do |format|\n if @packable.update_attributes(params[:packable])\n format.html { redirect_to @packing_list, notice: 'Packing List was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @packable.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @checklist = Checklist.find(params[:id])\n\n respond_to do |format|\n if @checklist.update_attributes(params[:checklist])\n format.html { redirect_to @checklist, notice: 'Checklist was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @checklist.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @list = current_user.lists.find(params[:id])\n @list.update_attributes(params[:list])\n respond_with(@list, :location => my_list_url(@list))\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'Changes and Additions Successful.' }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update # PATCH\n raise NotImplementedError\n end", "def update\n @grocery_list = GroceryList.find(params[:id])\n\n if @grocery_list.update(grocery_list_params)\n render json: @grocery_list\n else\n render json: {\n errors: @grocery_list.errors.full_messages\n },\n status: 404\n end\n end", "def update\n respond_to do |format|\n\n @pizza.toppings.each do |t|\n @pizza.toppings.delete(t)\n end\n\n params[:topping_ids].each do |tid|\n topping = Topping.find_by_id(tid)\n @pizza.toppings << topping\n end\n\n if @pizza.update(pizza_params)\n format.html { redirect_to @pizza, notice: 'Pizza was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pizza.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @listing = Listing.find_by_id(params[:id])\n @listing.model_id = params[:model_id]\n @listing.photo_url = params[:photo_url]\n @listing.description = params[:description]\n @listing.category_id = params[:category_id]\n\n if @listing.save\n redirect_to listings_url\n else\n render 'edit'\n end\n end", "def update\n respond_to do |format|\n if @meetings_list.update(meetings_list_params)\n format.html do\n redirect_to @meetings_list,\n notice: 'Die Meeting-Liste wurde erfolgreich aktualisiert.'\n end\n format.json { render :show, status: :ok, location: @meetings_list }\n else\n format.html { render :edit }\n format.json { render json: @meetings_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tech_listing.update(tech_listing_params)\n format.html { redirect_to @tech_listing, notice: 'Tech listing was successfully updated.' }\n format.json { render :show, status: :ok, location: @tech_listing }\n else\n format.html { render :edit }\n format.json { render json: @tech_listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_listing\n @listing = Listing.find(params[\"id\"])\n end", "def set_listing\n id = params[:id]\n @listing = Listing.find(id)\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'The List was updated.' }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # respond_to do |format|\n # if @thing.update(thing_params)\n # format.html { redirect_to @thing, notice: 'Thing was successfully updated.' }\n # format.json { render :show, status: :ok, location: @thing }\n # else\n # format.html { render :edit }\n # format.json { render json: @thing.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def update\n unless @listing.tag_list == listing_params[:tag_list].split(\",\")\n @listing.tag_list = listing_params[:tag_list]\n @listing.save\n end\n respond_to do |format|\n if @listing.update(listing_params)\n format.html { redirect_to @listing, notice: 'Your listing has been updated.' }\n format.json { render :show, status: :ok, location: @listing }\n else\n format.html { render :edit }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @checklist = Checklist.find(params[:id])\n\n respond_to do |format|\n if @checklist.update_attributes(checklist_params)\n format.html { redirect_to @checklist, notice: 'Checklist was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @checklist.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6856242", "0.68164784", "0.6815726", "0.680796", "0.6574686", "0.6574686", "0.6574686", "0.65736544", "0.6548128", "0.6548128", "0.6548128", "0.6548128", "0.6548128", "0.6548128", "0.6548128", "0.6548128", "0.6548128", "0.6548128", "0.6548128", "0.6541613", "0.6539757", "0.6521254", "0.64486593", "0.64431477", "0.6414156", "0.63441175", "0.6343669", "0.6343669", "0.6326556", "0.631807", "0.631807", "0.627942", "0.62747073", "0.62616134", "0.6246226", "0.62145925", "0.6207932", "0.6200658", "0.6190935", "0.6169228", "0.61178845", "0.6105327", "0.60966104", "0.6051138", "0.60376006", "0.6036442", "0.6019908", "0.60145724", "0.6010396", "0.6007676", "0.6007017", "0.6005735", "0.60017216", "0.60017216", "0.5994992", "0.5993943", "0.59847313", "0.5979016", "0.5978565", "0.5977893", "0.5977537", "0.597251", "0.5969892", "0.5965632", "0.59598017", "0.5945431", "0.5945431", "0.5921545", "0.5921051", "0.5911185", "0.5904874", "0.589749", "0.5867193", "0.5864275", "0.5855479", "0.584921", "0.584597", "0.58458", "0.5843029", "0.5841031", "0.5841031", "0.5841031", "0.5841031", "0.5841031", "0.58389026", "0.58328557", "0.5832177", "0.5830475", "0.58293617", "0.5825641", "0.5825343", "0.5824837", "0.58230174", "0.58168626", "0.5813306", "0.58097875", "0.578753", "0.5781361", "0.5778701", "0.57728237" ]
0.6584647
4
DELETE /listings/1 DELETE /listings/1.json
def destroy @listing.destroy end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n api_delete(\"/listings/#{@listing_id}\")\n end", "def destroy\n @listing = Listing.find(params[:id])\n @listing.destroy\n\n respond_to do |format|\n format.html { redirect_to listings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @listing = Listing.find(params[:id])\n @listing.destroy\n\n respond_to do |format|\n format.html { redirect_to listings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @listing = Listing.find(params[:id])\n @listing.destroy\n\n respond_to do |format|\n format.html { redirect_to listings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @listing = Listing.find(params[:id])\n @listing.destroy\n\n respond_to do |format|\n format.html { redirect_to listings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @listing = Listing.find(params[:id])\n @listing.destroy\n\n respond_to do |format|\n format.html { redirect_to listings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to listings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to listings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to listings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to listings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to listings_url }\n format.json { head :no_content }\n end\n end", "def delete\n if @listing.destroy\n render nothing: true, status: :ok\n else\n render nothing: true, status: :bad_request\n end\n end", "def destroy\n @listing = Listing.find(params[:id])\n @listing.destroy\n redirect_to listings_url\n\n respond_to do |format|\n format.html { redirect_to listings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n #deleting a listing\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to listings_url, notice: \"Listing was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @listing = Listing.find(params[:id])\n\n respond_to do |format|\n format.html { redirect_to building_listings_url, notice: 'Listing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @listing = Listing.find(params[:id])\n @listing.destroy\n\n respond_to do |format|\n format.html { redirect_to(listings_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @listing = Listing.find(params[:id])\n @listing.destroy\n\n respond_to do |format|\n format.html { redirect_to(listings_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @listing = Listing.find(params[:id])\n @listing.destroy\n\n respond_to do |format|\n format.html { redirect_to(listings_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @listing = Listing.find(params[:id])\n @listing.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 @listing = Listing.find(params[:listing_id])\n # need to delete on current user for security\r\n current_user.read_listings.delete(@listing)\r\n \n respond_to do |format|\r\n format.xml { head :ok }\n end\n end", "def destroy\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to admin_listings_url, notice: 'Listing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n # gets the todo items listing params :id\n @listing = Listing.find(params[:id])\n # destroys the current listing\n @listing.destroy\n \n # redirects you back to the (root) index page\n redirect_to listings_path\n end", "def destroy\n @listing.destroy\n\n render json: @listing\n end", "def destroy\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to listings_path, notice: 'Listing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize! :destroy, @lisitng\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to listings_url, notice: 'Listing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @slisting.destroy\n respond_to do |format|\n format.html { redirect_to slistings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to listings_url, notice: 'Listing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to listings_url, notice: 'Listing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to listings_url, notice: 'Listing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to listings_url, notice: 'Listing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to listings_url, notice: 'Listing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to listings_url, notice: 'Listing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to listings_url, notice: 'Listing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to listings_url, notice: 'Listing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to listings_url, notice: 'Listing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to listings_url, notice: 'Listing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to listings_url, notice: 'Listing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to listings_url, notice: 'Listing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to listings_url, notice: 'Listing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to listings_url, notice: 'Listing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to listings_url, notice: 'Listing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to listings_url, notice: \"Listing was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def delete_list(id)\n record \"/todos/delete_list/#{id}\"\n end", "def destroy\n @listing.destroy\n redirect_to \"/listings\"\n end", "def destroy\n @waiting_list = WaitingList.find(params[:id])\n @waiting_list.destroy\n\n respond_to do |format|\n format.html { redirect_to waiting_lists_url }\n format.json { head :no_content }\n end\n end", "def delete_listing(listing_id)\n authenticated? do\n query_and_build \"marketplace/listings/#{listing_id}\", {}, :delete\n end\n end", "def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @spot_listing = SpotListing.find(params[:id])\n @spot_listing.destroy\n\n respond_to do |format|\n format.html { redirect_to spot_listings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @thing_list = ThingList.find(params[:id])\n @thing_list.destroy\n\n respond_to do |format|\n format.html { redirect_to(thing_lists_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @day_road_listing.destroy(params[:id])\n respond_to do |format|\n format.html { redirect_to day_road_lists_url, notice: 'Day road list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @checklist = Checklist.find(params[:id])\n @checklist.destroy\n\n respond_to do |format|\n format.html { redirect_to checklists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @list = List.find(params[:id])\n @list.destroy\n\n respond_to do |format|\n format.html { redirect_to lists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @list = List.find(params[:id])\n @list.destroy\n\n respond_to do |format|\n format.html { redirect_to lists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @list = List.find(params[:id])\n @list.destroy\n\n respond_to do |format|\n format.html { redirect_to lists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @list = List.find(params[:id])\n @list.destroy\n\n respond_to do |format|\n format.html { redirect_to lists_url }\n format.json { head :ok }\n end\n end", "def destroy\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to sale_listings_url, notice: 'Sale listing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to list_types_url, notice: \"Check ya later list.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to management_lists_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @email_listing = EmailListing.find(params[:id])\n @email_listing.destroy\n\n respond_to do |format|\n format.html { redirect_to email_listings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @check_list.destroy\n respond_to do |format|\n format.html { redirect_to check_lists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tasklisting.destroy\n respond_to do |format|\n format.html { redirect_to tasklistings_url, notice: 'Tasklisting was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @house_list.destroy\n respond_to do |format|\n format.html { redirect_to house_lists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ongoing = Ongoing.find(params[:id])\n @ongoing.destroy\n\n respond_to do |format|\n format.html { redirect_to ongoings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @landing = Landing.find(params[:id])\n @landing.destroy\n\n respond_to do |format|\n format.html { redirect_to landings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Listing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @listed.destroy\n respond_to do |format|\n format.html { redirect_to session[:previous_url] }\n format.json { head :no_content }\n end\n end", "def destroy\n @business_listing.destroy\n respond_to do |format|\n format.html { redirect_to business_listings_url, notice: 'Business listing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ingredient_list.destroy\n respond_to do |format|\n format.html { redirect_to ingredient_lists_url, notice: 'Ingredient list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @topping_list.destroy\n respond_to do |format|\n format.html { redirect_to topping_lists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @listing.destroy\n redirect_to listings_url, notice: 'Listing was successfully deleted.'\n end", "def destroy\n @slashdot_posting.destroy\n respond_to do |format|\n format.html { redirect_to slashdot_postings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @listing_status = ListingStatus.find(:first, :conditions => [\"id = ?\", params[:id]], :select => 'id, description, position, is_final', :order => 'description')\n ListingStatus.clear_cached(params[:id])\n ListingStatus.clear_cached_from_description(@listing_status.description)\n @listing_status.destroy\n respond_to do |format|\n format.html { redirect_to(listing_statuses_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @favourite_listing = get_favourite_listing(params[:id])\n @favourite_listing.destroy\n\n respond_to do |format|\n format.html { redirect_to favourite_listings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url, notice: 'List was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url, notice: 'List was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url, notice: 'List was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url, notice: 'List was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url, notice: 'List was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url, notice: 'List was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url, notice: 'List was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url, notice: \"List was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to my_lists_url, notice: 'List was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_shopping_list.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_shopping_lists_url, notice: 'Shopping list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_list(list_id)\n rest(\"delete\", \"lists/#{list_id}\")\n\n return true\n end", "def destroy\n @todoit_list.destroy\n respond_to do |format|\n format.html { redirect_to todoit_lists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @listings_poll.destroy\n respond_to do |format|\n format.html { redirect_to listings_polls_url, notice: 'Listings poll was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @listing = Listing.find(params[:id])\n if @listing.user == current_user\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to listings_url, notice: 'Listing was successfully deleted.' }\n format.json { head :no_content }\n end\n else\n redirect_to @listing, notice: 'This Listing cannot be deleted. Please contact the owner of this listing. '\n end\n end", "def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url, notice: 'The List was destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @landing.destroy\n respond_to do |format|\n format.html { redirect_to landings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @listing.destroy\n flash[:alert] = \"Deleted Listing\"\n redirect_to listings_path\n end", "def delete\n render json: Item.delete(params[\"id\"])\n end", "def destroy\n @list_item = ListItem.find(params[:id])\n @list_item.destroy\n\n respond_to do |format|\n format.html { render :nothing => true}\n format.json { head :no_content }\n end\n end", "def destroy\n @serving = Serving.find(params[:id])\n @serving.destroy\n\n respond_to do |format|\n format.html { redirect_to servings_url }\n format.json { head :no_content }\n end\n end", "def delete_listing(db, id)\n\tdb.execute(\"DELETE FROM cars WHERE id=?\", [id])\nend", "def destroy\n @album_listing.destroy\n respond_to do |format|\n format.html { redirect_to album_listings_url, notice: 'Album listing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @inning = Inning.find(params[:id])\n @inning.destroy\n\n respond_to do |format|\n format.html { redirect_to innings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @lending = Lending.find(params[:id])\n @lending.destroy\n\n respond_to do |format|\n format.html { redirect_to lendings_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.8235785", "0.7455121", "0.7455121", "0.7455121", "0.7455121", "0.7455121", "0.7327514", "0.7327514", "0.7327514", "0.7327514", "0.7327514", "0.7304234", "0.7295118", "0.72217983", "0.72063255", "0.71971333", "0.71971333", "0.71971333", "0.7183706", "0.7144805", "0.7081068", "0.7079073", "0.7071176", "0.7017873", "0.7011912", "0.7007165", "0.6994795", "0.6994795", "0.6994795", "0.6994795", "0.6994795", "0.6994795", "0.6994795", "0.6994795", "0.6994795", "0.6994795", "0.6994795", "0.6994795", "0.6994795", "0.6994795", "0.6994795", "0.69875735", "0.6945531", "0.6932324", "0.6879784", "0.6873577", "0.68504536", "0.68504536", "0.68504536", "0.68434876", "0.6843328", "0.679294", "0.6777109", "0.67743915", "0.67743915", "0.67743915", "0.6755494", "0.6749728", "0.6726211", "0.6713956", "0.6711854", "0.6697405", "0.6697144", "0.6692257", "0.668687", "0.6686167", "0.6665297", "0.66641647", "0.6660752", "0.6652273", "0.66468114", "0.6641633", "0.66348606", "0.66345656", "0.6622348", "0.6616119", "0.6615816", "0.6615816", "0.6615816", "0.6615816", "0.6615816", "0.6615816", "0.6615816", "0.6615346", "0.6600048", "0.6598407", "0.6592039", "0.6589161", "0.6586598", "0.657863", "0.6573741", "0.6571905", "0.65696305", "0.65629673", "0.6554455", "0.65370774", "0.65157145", "0.65129656", "0.65029514", "0.64919883" ]
0.66989636
61
Use callbacks to share common setup or constraints between actions.
def set_listing @listing = Listing.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 listing_params params.permit(:job_title, :description, :deadline, :company_id, :company_name, :url) 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 valid_params_request?; 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 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 model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "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 valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\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 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 valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\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 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 maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\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 url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\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 droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\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.6980957", "0.6783065", "0.6747844", "0.6741468", "0.67356336", "0.6592548", "0.65036845", "0.64978707", "0.64825076", "0.64795035", "0.64560914", "0.64397955", "0.6379666", "0.6376688", "0.6366702", "0.6319728", "0.6300833", "0.6300629", "0.6294277", "0.6293905", "0.6291174", "0.62905735", "0.6283171", "0.6242344", "0.62403613", "0.6218049", "0.62143815", "0.62104696", "0.61949855", "0.6178671", "0.6176147", "0.6173327", "0.6163395", "0.6153005", "0.6151833", "0.6147288", "0.61224324", "0.6118827", "0.61075264", "0.61054534", "0.6092497", "0.6080082", "0.60710967", "0.60627776", "0.60219413", "0.60175914", "0.60153484", "0.60107356", "0.60081726", "0.60081726", "0.60013986", "0.6000165", "0.59978646", "0.59936947", "0.59925723", "0.5992084", "0.59796256", "0.5967569", "0.5960056", "0.59589803", "0.5958441", "0.5958401", "0.5952607", "0.5952406", "0.5944409", "0.59391016", "0.593842", "0.593842", "0.5933845", "0.59312123", "0.5926475", "0.59248453", "0.59179676", "0.59109294", "0.59101623", "0.5908172", "0.59058356", "0.5899052", "0.5897749", "0.5896101", "0.58942914", "0.58939576", "0.5892063", "0.5887407", "0.588292", "0.58797663", "0.587367", "0.58681566", "0.5868038", "0.5866578", "0.58665025", "0.58655846", "0.58640826", "0.5863465", "0.5862226", "0.586065", "0.58581287", "0.5854443", "0.5854172", "0.58507544", "0.5849934" ]
0.0
-1
The request URI is passed to query the account management application
def set_request_uri @query = @query.set_request_uri(request.fullpath.sub(/screen=[A-Za-z]*/,'screen=UsersScreen')) if @query.respond_to?(:set_request_uri) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_uri; end", "def request_uri\n uri = URI.parse(Europeana::URL + \"/record\" + \"#{@id}.json\")\n uri.query = params_with_authentication.to_query\n uri\n end", "def prepare_uri path\n \"#{@uri}/accounts/#{@client.account}#{path}\"\n end", "def request_uri\n uri = URI.parse(Europeana::URL + \"/search.json\")\n request_params = params_with_authentication\n\n if request_params[:qf].is_a?(Hash)\n qf = request_params.delete(:qf)\n uri.query = request_params.to_query\n qf.each_pair do |name, criteria|\n [ criteria ].flatten.each do |criterion|\n uri.query = uri.query + \"&qf=\" + CGI::escape(name.to_s) + \":\" + CGI::escape(criterion)\n end\n end\n else\n uri.query = request_params.to_query\n end\n \n uri\n end", "def request_uri\n @request.uri\n end", "def url\n endpoint+'?'+query_string\n end", "def on_request_uri(cli, request)\r\n print_status(\"Request: #{request.uri}\")\r\n if request.uri =~ /#{Regexp.escape(get_resource)}/\r\n print_status('Sending payload...')\r\n send_response(cli, @pl)\r\n end\r\n end", "def request_uri\n calculate_uri(@http_request.url)\n end", "def authenticated_uri(params = {})\n add_params_to_url(\n @app_context.brightspace_host.to_uri(\n path: path,\n query: query\n ), params)\n end", "def query_url\n user_dn = env['omniauth.params']['user_dn']\n build_query = \"#{options.cas_server}#{options.authentication_path}\"\n build_query += \"/#{user_dn}\"\n build_query += \"/#{options.return_field}.#{options.format}\"\n URI.encode(build_query)\n end", "def request_url(requirelogin=false, requireuserinfo=false, expirationdays=30, notifyonupload=false)\n end", "def request_url(requirelogin=false, requireuserinfo=false, expirationdays=30, notifyonupload=false)\n end", "def query_user_for_uri\n input_uri = nil\n puts \"\\n* First, we need a valid uri.\"\n input_uri = valid_uri\n return input_uri\nend", "def request_authorized_query query_string\n query query_string\nend", "def uri_with_authentication\t\t\t\n\t\turi = base_uri.to_s + \"?\" + query_string\n\t\tmethod_hack = \"&_method=\" + @method \n\t\t# some clients (such as flash, and explorer) have an issue with PUT and delete methods. \n\t\t# method_hack insures that the right method gets through.\n\t\tURI.parse( uri + method_hack )\n\tend", "def request_uri\n return nil if absolute? && scheme !~ /^https?$/\n res = path.to_s.empty? ? \"/\" : path\n res += \"?#{self.query}\" if self.query\n return res\n end", "def get_uri\n request_object.uri\n end", "def request_uri\n @request_uri ||= ImpURI.request_uri(@uri)\n end", "def get_users(request); end", "def request_url\n base_url = \"http://#{api_host}#{PATH}?\"\n base_url << \"appid=#{app_id}\"\n base_url << \"&callname=#{call_name}\"\n base_url << \"&siteid=#{site_id}\"\n base_url << \"&version=#{API_VERSION}\"\n base_url\n end", "def account(params = {})\n make_get_request('/account', params)\n end", "def query_login\r\n send_request_cgi('uri' => normalize_uri(target_uri.path.to_s, 'login.jsp'))\r\n end", "def uri\n \"#{query_uri}?#{query_options.to_query}\"\n end", "def request(*args)\n authenticated_request(*args)\n end", "def send_auth_request \n request = AuthorizeRequest.new(:get, action_to_call) do |req|\n req.request_params = params\n end\n request.send_request(Config.url)\n end", "def get(request)\n @connection.get request.qpath\n end", "def request_path(*args)\n if has_attribute? :uri then uri else super end\n end", "def auth_query\n \"?login=fcoury&token=8f700e0d7747826f3e56ee13651414bd\"\n end", "def handle_get_request(client_request)\n parse_uri(client_request)\n path_name(uri)\n end", "def uri\n @uri_parameters = {:s => @company}\n super() \n end", "def with_uri_credentials(uri); end", "def realm(uri); end", "def account\n get('account')\n end", "def request_url\n query_builder.request_string\n end", "def fetch_zendesk_account\n # Pull the subdomain from the ?account query param.\n env[\"rack.request.query_hash\"].fetch(\"account\") do\n # No param 'account' was found, throw an error.\n raise AccountError.new \"account key needed in query string\"\n end\n end", "def get\n request_object.get_query\n end", "def request_uri\n return unless @path\n\n url = @query ? \"#@path?#@query\" : @path.dup\n url.start_with?(?/.freeze) ? url : ?/ + url\n end", "def get_accounts()\n http_get(accounts_url)\n end", "def on_request_uri(cli, request)\r\n print_good(\"#{peer} - Sending privilege escalation payload to QRadar...\")\r\n print_good(\"#{peer} - Sit back and relax, Shelly will come visit soon!\")\r\n send_response(cli, @payload)\r\n end", "def query_string\n end", "def request_path; end", "def getaccount(namecoin_address)\n request :getaccount, namecoin_address\n end", "def on_request_uri(cli, request)\n\t\tprint_status(\"#{cli.peerhost} is trying to request our malicious file...\")\n\t\tprint_status(\"#{request.uri}\")\n\tend", "def base_uri\n \"#{api}/admin/tenants\"\n end", "def query ; @request.params ; end", "def auth_url\n \"#{@url}/auth/realms/#{@realm}/protocol/openid-connect/auth\"\n end", "def getAuthUrl\n\t\t\t\tURI::HTTP.build(\n\t\t\t\t\t:host => @options['auth_host'],\n\t\t\t\t\t:path => @options['auth_page'],\n\t\t\t\t\t:query => {\n\t\t\t\t\t\t:client_id => @options['client_id'],\n\t\t\t\t\t\t:scope => @options['scope'],\n\t\t\t\t\t\t:response_type => \"code\",\n\t\t\t\t\t\t:redirect_uri => @options['redirect_uri'],\n\t\t\t\t\t}.to_query\n\t\t\t\t).to_s\n\t\t\tend", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def url\n PagSeguro.site_url(\"v2/authorization/request.jhtml?code=#{code}\") if code\n end", "def credentials_for(uri, realm); end", "def request(*args); end", "def get_request( server_url, request_url, user_name, user_token )\n a = Mechanize.new\n begin\n a.get(\"http://#{server_url}#{request_url}?user_name=#{ CGI::escape(user_name) }&user_token=#{ CGI::escape(user_token) }\")\n rescue\n puts $!\n end\n end", "def originator\n unless @originator\n uri = URI @request.url\n uri.query = nil if (uri.query = @meaningful_params.to_param).blank?\n uri.path = uri.path.sub(/\\..*/,'') # Remove any format indicator\n @originator = uri.to_s\n end\n @originator\n end", "def uri; end", "def uri; end", "def uri; end", "def uri; end", "def uri; end", "def uri; end", "def uri; end", "def uri; end", "def uri; end", "def uri; end", "def uri; end", "def uri; end", "def get_auth_url\n\t\tURI::HTTP.build(\n\t\t\t:host => @options['auth_host'],\n\t\t\t:path => @options['auth_page'],\n\t\t\t:query => {\n\t\t\t\t:client_id => @options['client_id'],\n\t\t\t\t:scope => @options['scope'],\n\t\t\t\t:response_type => \"code\",\n\t\t\t\t:redirect_uri => @options['redirect_uri'],\n\t\t\t}.to_query\n\t\t).to_s\n\tend", "def GET; end", "def request_uri(path)\n \"#{@api_url}#{path}\"\n end", "def uri\n @uri\n end", "def uri\n @uri\n end", "def uri\n @uri\n end", "def uri\n @uri\n end", "def getaccountaddress(account)\n request :getaccountaddress, account\n end", "def base_api_uri\n \"#{self.class.base_uri}/#{@account_id}\"\n end", "def get_user_uri\n \"/#{URI.encode ZohoReports.configuration.login_email}\"\n end", "def query_uri\n session ? session.query_uri : Wac.query_uri\n end", "def request\n @_request\n end", "def account_info(options = {})\n request :account, :get, 'account', options\n end", "def show\n unless current_user.is_admin\n raise \"401\"\n end\n gon_request @request\n end", "def get endpoint\n do_request :get, endpoint\n end", "def base_uri\n \"#{api}/provider\"\n end", "def url\n raise InvalidQueryError unless query && page\n\n \"http://#{ENDPOINT}#{REQUEST_URI}\" + # base\n \"?#{canonical_query_string}\" + # query\n \"&Signature=#{uri_escape(signature)}\" # signature\n end", "def consume_url; end", "def request\n raise 'need to be implemented'\n end", "def principal(request)\n end", "def index\n if token_and_options(request)\n access_key = AccessKey.find_by_access_token(token_and_options(request))\n @user = User.find_by_id(access_key.user_id)\n \n p \"INDEx\"\n end\n end", "def userauth_request(username, next_service, auth_method, *others); end", "def get_request_auth_code_url\n URI.encode(\"https://#{@subdomain}.zendesk.com/oauth/authorizations/new?response_type=code&redirect_uri=#{@redirect_uri}/&client_id=#{@unique}&scope=read%20write\")\n end", "def request\n @req\n end", "def api_get\n handler.get({email: email}, path)\n end" ]
[ "0.6565017", "0.65101284", "0.609308", "0.6071274", "0.59745955", "0.5948903", "0.59169585", "0.59057", "0.58847237", "0.58734226", "0.5860954", "0.58558714", "0.5846249", "0.5839316", "0.58327734", "0.5815502", "0.57800114", "0.57794994", "0.57787687", "0.5774533", "0.5770985", "0.5769165", "0.57627136", "0.57195395", "0.5694457", "0.5690187", "0.56846434", "0.5662793", "0.56620896", "0.5616458", "0.5616435", "0.5613877", "0.55643266", "0.55639297", "0.5551568", "0.5544293", "0.55234903", "0.55219936", "0.5521432", "0.5518507", "0.5510335", "0.5507944", "0.5507729", "0.54993975", "0.5496329", "0.54826874", "0.54784465", "0.5477225", "0.5477225", "0.5477225", "0.5477225", "0.5477225", "0.5477225", "0.5477225", "0.5477225", "0.5477225", "0.5477225", "0.5477225", "0.5472745", "0.5470666", "0.54614276", "0.5456496", "0.54430515", "0.54420537", "0.54420537", "0.54420537", "0.54420537", "0.54420537", "0.54420537", "0.54420537", "0.54420537", "0.54420537", "0.54420537", "0.54420537", "0.54420537", "0.54407597", "0.54400605", "0.54343826", "0.5408958", "0.5408958", "0.54055566", "0.54055566", "0.5381679", "0.5378866", "0.53769565", "0.53748643", "0.5368484", "0.5366626", "0.5346981", "0.5345848", "0.5344619", "0.5344515", "0.53431755", "0.53420013", "0.5339257", "0.5338794", "0.533595", "0.53278625", "0.5325737", "0.53240633" ]
0.6056733
4
If method not found, assume it's an ActiveRecord attribute reader.
def method_missing(name, *args, &block) @attributes[name] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def define_read_method(symbol, attr_name, column)\n cast_code = column.type_cast_code('v') if column\n access_code = cast_code ? \"(v=@attributes['#{attr_name}']) && #{cast_code}\" : \"@attributes['#{attr_name}']\"\n\n unless attr_name.to_s == self.class.primary_key.to_s\n access_code = access_code.insert(0, \"raise NoMethodError, 'missing attribute: #{attr_name}', caller unless @attributes.has_key?('#{attr_name}'); \")\n self.class.read_methods << attr_name\n end\n\n evaluate_read_method attr_name, \"def #{symbol}; #{access_code}; end\"\n end", "def define_read_method(symbol, attr_name, column)\n\n cast_code = column.type_cast_code('v') if column\n access_code = cast_code ? \"(v=@attributes['#{attr_name}']) && #{cast_code}\" : \"@attributes['#{attr_name}']\"\n\n unless attr_name.to_s == self.primary_key.to_s\n access_code = access_code.insert(0, \"missing_attribute('#{attr_name}', caller) unless @attributes.has_key?('#{attr_name}'); \")\n end\n\n # This is the Hobo hook - add a type wrapper around the field\n # value if we have a special type defined\n if can_wrap_with_hobo_type?(symbol)\n access_code = \"val = begin; #{access_code}; end; wrapper_type = self.class.attr_type(:#{attr_name}); \" +\n \"if HoboFields.can_wrap?(wrapper_type, val); wrapper_type.new(val); else; val; end\"\n end\n\n if cache_attribute?(attr_name)\n access_code = \"@attributes_cache['#{attr_name}'] ||= begin; #{access_code}; end;\"\n end\n\n generated_attribute_methods.module_eval(\"def #{symbol}; #{access_code}; end\", __FILE__, __LINE__)\n end", "def ensure_getter_exists(attr)\n unless method_defined? attr\n define_method(attr) do\n begin\n attributes[attr]\n rescue NoMethodError\n instance_variable_get '@' + attr\n end\n end\n end\n end", "def define_read_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}; read_attribute('#{attr_name}'); end\" \n end", "def read_attribute(attr_name)\n return unless attr_name\n\n attr_name = attr_name.to_s\n methods = self.class.generated_external_attribute_methods\n\n if methods.method_defined?(attr_name)\n if @attributes.has_key?(attr_name) || attr_name == 'id'\n methods.send(attr_name, @attributes[attr_name], @attributes, @attributes_cache, attr_name)\n end\n elsif !self.class.attribute_methods_generated?\n # If we haven't generated the caster methods yet, do that and\n # then try again\n self.class.define_attribute_methods\n read_attribute(attr_name)\n else\n # If we get here, the attribute has no associated DB column, so\n # just return it verbatim.\n @attributes[attr_name]\n end\n end", "def dangerous_attribute_method?(method_name)\n active_record = ActiveRecord::Base\n superclass = ActiveRecord::Base.superclass\n\n (active_record.method_defined?(method_name) ||\n active_record.private_method_defined?(method_name)) &&\n !superclass.method_defined?(method_name) &&\n !superclass.private_method_defined?(method_name)\n end", "def attr_accessor_sybling(method)\n attr_reader?(method) ? to_attr_writer(method) : to_attr_reader(method)\n end", "def method_missing_with_dynamo(method_id, *args, &block)\n begin\n # Try the super method_missing. If the method doesn't exist then try\n # to see if its a dynamo attributes they are trying to access.\n method_missing_without_dynamo(method_id, *args, &block)\n rescue NoMethodError => e\n # If the method name ends with an = then its a setter. We take off the = so we can check if its a dynamo field.\n attr_name = method_id.to_s.sub(/\\=$/, '')\n if is_dynamo_field?(attr_name)\n # If there's an = in there then someone's attempting to write.\n if method_id.to_s =~ /\\=$/\n return write_attribute_with_dynamo(attr_name, args[0])\n else\n return read_attribute_with_dynamo(attr_name)\n end\n end\n # Looks like its a method rails nor dynamo understands. Error time!\n raise e\n end\n end", "def method_missing(method_name, *_args)\n if attrs.key?(method_name.to_s)\n attrs[method_name.to_s]\n else\n super(method_name)\n end\n end", "def add_attr_reader(attr_name, column_type)\n=begin\n\t\t\t\t\tif column_type == :text then\n\t\t\t\t\t\tdefine_method(\"#{attr_name}\") do\n\t\t\t\t\t\t\tvalue = read_attribute(attr_name.to_s)\n\t\t\t\t\t\t\t# if the value de-serialized is false, it means a \"\"\n\t\t\t\t\t\t\tif value == false || value == 0 then\n\t\t\t\t\t\t\t\tvalue = \"\"\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tvalue\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n=end\n\t\t\t\tend", "def method_missing(method, *args)\n debug(\"Model#method_missing(#{method.inspect}, #{args.inspect})\")\n if call_data = self.class.route_attribute_call(method)\n verb, attr_name = *call_data\n case verb\n when :get\n get_attribute(attr_name)\n when :set\n set_attribute(attr_name, args[0])\n end\n else\n super # pass it on to Object#method_missing, which will raise NoMethodError\n end\n end", "def method_missing(method, *args, &block)\n if respond_to_without_attributes?(method, true)\n super\n else\n match = matched_attribute_method(method.to_s)\n match ? attribute_missing(match, *args, &block) : super\n end\n end", "def attribute_method?(attr)\n super || attributes.keys.include?(attr)\n end", "def attribute_method?(attribute)\n method_defined?(attribute)\n end", "def method_missing(method, *args)\n return @reader.send(method, *args) if @reader.respond_to? method\n super\n end", "def read_attribute\n record.public_send(attribute)\n end", "def define_read_method_for_marshalized_attribute(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}; unmarshalize_attribute('#{attr_name.to_sym}'); end\"\n 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 instance_read(attr)\n getter = :\"#{@name_string}_#{attr}\"\n instance.send(getter) if instance.respond_to?(getter)\n end", "def method_missing(method, *args)\n ## If not loaded, load and retry.\n unless loaded\n return self.get.send(method, *args)\n end\n\n\n ## Otherwise, try to match against attributes, then objects, then links.\n method = method.to_s\n if method[-1,1] == '='\n return attributes[method[0..-2]] = args.first if attributes && attributes.has_key?(method[0..-2])\n else\n return attributes[method] if attributes && attributes.has_key?(method.to_s)\n return objects[method] if objects && objects[method]\n if links && links[method]\n if args.count > 0\n return links[method].where(*args)\n else\n return links[method]\n end\n end\n end\n\n raise NoMethodError, \"undefined method `#{method}' for #{self.inspect}\"\n end", "def create_getter\n @model.class_eval <<-EOS, __FILE__, __LINE__\n #{reader_visibility}\n def #{@getter}\n attribute_get(#{name.inspect})\n end\n EOS\n\n if @primitive == TrueClass && !@model.instance_methods.include?(@name.to_s)\n @model.class_eval <<-EOS, __FILE__, __LINE__\n #{reader_visibility}\n alias #{@name} #{@getter}\n EOS\n end\n end", "def evaluate_attribute_method(attr_name, method_definition, method_name=attr_name)\n unless unchangeable_property_names.include?(attr_name.to_sym)\n generated_methods << method_name\n end\n\n begin\n class_eval(method_definition, __FILE__, __LINE__)\n rescue SyntaxError => err\n generated_methods.delete(attr_name)\n if logger\n logger.warn \"Exception occurred during reader method compilation.\"\n logger.warn \"Maybe #{attr_name} is not a valid Ruby identifier?\"\n logger.warn \"#{err.message}\"\n end\n end\n end", "def attribute_from_method( methodname )\n\n\t\tcase methodname.to_s\n\t\twhen /^(?:has_)?([a-z]\\w*)\\?$/i\n\t\t\treturn $1.to_sym, :predicate\n\t\twhen /^([a-z]\\w*)(=)?$/i\n\t\t\treturn $1.to_sym, ($2 ? :writer : :reader )\n\t\tend\n\tend", "def read\n load_column(read_attribute)\n end", "def create_getter!\n @target.class_eval <<-EOS\n #{reader_visibility.to_s}\n def #{name}\n attribute_get(#{name.inspect})\n end\n EOS\n \n if type == TrueClass\n @target.class_eval <<-EOS\n #{reader_visibility.to_s}\n def #{name.to_s.ensure_ends_with('?')}\n attribute_get(#{name.inspect})\n end\n EOS\n end\n rescue SyntaxError\n raise SyntaxError.new(column)\n end", "def read_without_default(attribute)\r\n if set?(attribute)\r\n send(\"raw_#{attribute}\")\r\n elsif inherited_data.nil?\r\n nil\r\n elsif inherited_data.respond_to?(\"#{attribute}_without_default\")\r\n inherited_data.send(\"#{attribute}_without_default\")\r\n elsif inherited_data.respond_to?(attribute)\r\n inherited_data.send(attribute)\r\n end\r\n end", "def define_piggy_back_read_method(reflection_name, column, prefix)\n attr = column.name\n attr_key = \"#{prefix}_#{attr}\"\n return if instance_methods.include?(attr_key)\n\n cast_code = column.type_cast_code('v')\n access_code = if cast_code\n \"(v=@attributes['#{attr_key}']) && #{cast_code}\"\n else\n \"@attributes['#{attr_key}']\"\n end\n\n self.class_eval <<-\"end_method\"\n def #{attr_key}\n if @attributes.has_key? '#{attr_key}'\n #{access_code}\n else\n #{reflection_name}.#{attr}\n end\n end\n end_method\n end", "def method_missing(method, *args, &block)\n attribute = Ldaptic.encode(method)\n if attribute[-1] == ?=\n attribute.chop!\n if may_must(attribute)\n return write_attribute(attribute, *args, &block)\n end\n elsif attribute[-1] == ??\n attribute.chop!\n if may_must(attribute)\n if args.empty?\n return !read_attribute(attribute).empty?\n else\n return args.flatten.any? {|arg| compare(attribute, arg)}\n end\n end\n elsif attribute =~ /\\A(.*)-before-type-cast\\z/ && may_must($1)\n return read_attribute($1, *args, &block)\n elsif may_must(attribute)\n return read_attribute(attribute, *args, &block).one\n end\n super(method, *args, &block)\n 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 [](method)\n self.__send__(method)\n rescue NoMethodError\n nil\n end", "def dangerous_attribute_method?(name) # :nodoc:\n ::ActiveEntity::AttributeMethods.dangerous_attribute_methods.include?(name.to_s)\n end", "def method_missing(sym, *args, &block)\n return attribute(sym.to_s) if not sym.to_s =~ /\\?$/\n super\n end", "def read_attribute\n Logging.debug \"Read attribute #{field_name}, got #{object.send(:read_attribute,field_name)} for #{object.inspect}\"\n object.send( :read_attribute, field_name )\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 evaluate_read_method(attr_name, method_definition)\n begin\n self.class.class_eval(method_definition)\n rescue SyntaxError => err\n self.class.read_methods.delete(attr_name)\n if logger\n logger.warn \"Exception occurred during reader method compilation.\"\n logger.warn \"Maybe #{attr_name} is not a valid Ruby identifier?\"\n logger.warn \"#{err.message}\"\n end\n end\n 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 method_missing( attribute, *args )\n\t\treturn self.base.send( attribute, *args )\n\tend", "def [](name)\n name = name.to_sym\n super(name)\n rescue MissingAttributeError\n raise unless self.class.attribute_names.include?(name)\n end", "def define_question_method(attr_name)\n unless attr_name.to_s == self.class.primary_key.to_s\n self.class.read_methods << \"#{attr_name}?\"\n end\n\n evaluate_read_method attr_name, \"def #{attr_name}?; query_attribute('#{attr_name}'); end\"\n end", "def method_missing(method, *args)\n method = method.to_sym\n #sometimes @attr is nil, *shrug*\n if @attrs.try(:keys).try(:include?, method)\n return @attrs[method]\n elsif @star.respond_to? method\n return @star.send(method)\n elsif @star.starrable.respond_to? method\n return @star.starrable.send(method)\n else\n super\n end\n end", "def method_missing(method, *args, &block)\n l = Origen.ldap.lookup(self)\n if l\n if l.attribute_names.include?(method)\n l[method]\n else\n super\n end\n else\n super\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 define_reader_method(mod)\n reader_method_name = name\n attribute = self\n\n mod.send(:define_method, reader_method_name) { attribute.get(self) }\n mod.send(reader_visibility, reader_method_name)\n\n self\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 define_reader_method(attribute, method_name, visibility)\n define_method(method_name) { attribute.get(self) }\n send(visibility, method_name)\n self\n end", "def match_attribute_method?(method_name)\n rebuild_attribute_method_regexp unless defined?(@@attribute_method_regexp) && @@attribute_method_regexp\n @@attribute_method_regexp.match(method_name)\n end", "def read_attribute(attribute)\n @object.send(:read_attribute, attribute.to_sym)\n end", "def method_missing(method_name, *args, &block)\n ignore_list = [:to_hash]\n return if ignore_list.include? method_name\n\n respond_to?(method_name) ? attribute(method_name.to_s.tr('_', '-')) : super\n end", "def [](method)\n self.send(method.to_sym)\n rescue NoMethodError\n nil\n end", "def define_reader_with_options(attr,options)\n unless options[:default].blank?\n define_method (attr.to_s) do\n val = instance_variable_get(\"@#{attr.to_s}\")\n val = options[:default] if val.nil?\n val\n end\n end\n end", "def instance_read(attr)\n getter = :\"#{name}_#{attr}\"\n responds = instance.respond_to?(getter)\n cached = self.instance_variable_get(\"@_#{getter}\")\n return cached if cached\n instance.send(getter) \n end", "def read_attribute_for_validation(attr)\r\n send(attr)\r\n end", "def create_getter(name, meth)\n define_method(meth) do\n read_attribute(name)\n end\n end", "def respond_to?(method, include_priv = false)\n if @attributes.nil?\n return super\n elsif attr_name = self.class.column_methods_hash[method.to_sym]\n return true if @attributes.include?(attr_name) || attr_name == self.class.primary_key\n return false if self.class.read_methods.include?(attr_name)\n elsif @attributes.include?(method.to_s)\n return true\n elsif md = self.class.match_attribute_method?(method.to_s)\n return true if @attributes.include?(md.pre_match)\n end\n # super must be called at the end of the method, because the inherited respond_to?\n # would return true for generated readers, even if the attribute wasn't present\n super\n end", "def define_read_methods\n self.class.columns_hash.each do |name, column|\n unless respond_to_without_attributes?(name)\n define_read_method(name.to_sym, name, column)\n end\n\n unless respond_to_without_attributes?(\"#{name}?\")\n define_question_method(name)\n end\n end\n end", "def metaattr_reader(*meths)\n metaclass.instance_eval{attr_reader(*meths)}\n end", "def read_attribute(attr_name) #:doc:\n if @attributes.keys.include? attr_name\n if column = column_for_attribute(attr_name)\n @attributes[attr_name] = unserializable_attribute?(attr_name, column) ?\n unserialize_attribute(attr_name) : column.type_cast(@attributes[attr_name])\n end\n \n @attributes[attr_name]\n else\n nil\n end\n end", "def attribute_method?(attr_name) #:nodoc:\n respond_to_without_attributes?(:attributes) && self.class.delegated_attributes.include?(attr_name)\n end", "def read_attribute_for_validation(attr)\n send(attr)\n end", "def read_attribute_for_validation(attr)\n send(attr)\n end", "def read_attribute_for_validation(attr)\n send(attr)\n end", "def _read_attribute(key); end", "def method_missing(method_id, *arguments, &block)\n return data['attributes'][method_id.to_s] if data['attributes'].key?(method_id.to_s) && arguments.none? && block.nil?\n\n super\n end", "def check_attribute_method_support(name, method)\n raise \"Type #{key_objects[name].type} doesn't support #{method}\" unless @attribute_objects[name].respond_to?(method.to_sym)\n true\n end", "def method_missing(method_name, *arguments, &block)\n # not a bug here, we want =, not ==\n if /^(?<id>[^=]+)$/ =~ method_name.to_s && (attribute = self[id])\n attribute.value\n else\n nil\n end\n end", "def _read_attribute(attr)\n @attributes[attr]\n end", "def check_instance_method_existance!(method_name)\n raise NoMethodError.new(\"undefined method `#{method_name}' for #{to_s}\") unless crud_instance_methods.include?(method_name.to_sym)\n end", "def method_missing(method_name)\n attributes[method_name]\n end", "def method_missing(meth, *args, &block)\n method_name = meth.to_s\n\n assignment = false\n if method_name.last == '=' && args.size == 1\n assignment = true\n method_name = method_name.slice(0, method_name.length - 1) if method_name.length > 0\n end\n\n #Active Record uses this method to cast the type of attributes. Need to implement it for validates_numericality_of.\n if method_name.ends_with? '_before_type_cast'\n method_name.gsub!(/_before_type_cast/, '')\n end\n\n #show?\n if args.size == 0 && !assignment && self.class.base_class.reserved_custom_attributes.include?(method_name)\n res = get_custom_attribute(method_name)\n return res || nil\n end\n\n #create/update?\n # NOTE: we don't check the reserved_custom_attributes on create, because they can\n # technically create any attribute they like\n if assignment && !self.attributes.include?(method_name) && self.class.base_class.reserved_custom_attributes.include?(method_name)\n\n return set_custom_attribute(method_name, args[0])\n end\n\n #fall through\n super(meth, *args, &block)\n end", "def has_attribute?(attr)\n if config = self.class.serialized_columns[attr.to_sym]\n super(config.first)\n else\n super(attr)\n end\n end", "def define_attribute_method(attribute)\n type = attribute_types[attribute]\n super unless TypeMap.lookup(type, self, attribute)\n end", "def method\n attributes.fetch(:method)\n end", "def method_missing(method, *args, &block)\n result = fields[:\"#{method.to_s.camelize(:lower)}\"]\n # we need to pull out any Contentful::Link references, and also things which don't have any fields at all\n # because they're newly created\n if result.is_a?(Array)\n result.reject! {|r| r.is_a?(Contentful::Link) || (r.respond_to?(:invalid) && r.invalid?)}\n elsif result.is_a?(Contentful::Link)\n result = nil\n elsif result.respond_to?(:fields) && result.send(:fields).empty?\n result = nil\n elsif result.respond_to?(:invalid?) && result.invalid?\n result = nil\n end\n\n if result.nil?\n # if self.class.rescue_from_no_attribute_fields.member?()\n # end\n if self.class.return_nil_for_empty_attribute_fields && self.class.return_nil_for_empty_attribute_fields.include?(method)\n return nil\n else\n raise ContentfulModel::AttributeNotFoundError, \"no attribute #{method} found\"\n end\n else\n self.class.coerce_value(method, result)\n end\n end", "def is_attr_method?\n self.executable.kind_of? Rubinius::AccessVariable\n end", "def method_missing_with_flex_attributes(method_id, *args, &block)\n begin\n method_missing_without_flex_attributes method_id, *args, &block\n rescue NoMethodError => e\n attr_name = method_id.to_s.sub(/\\=$/, '')\n if is_related?(attr_name)\n if method_id.to_s =~ /\\=$/\n return write_attribute_with_flex_attributes(attr_name, args[0])\n else\n return read_attribute_with_flex_attributes(attr_name)\n end\n end\n raise e\n end\n end", "def key_attr_reader(key)\n define_method key do\n self[key]\n end\n end", "def [](method)\n send(method.to_sym)\n rescue NoMethodError\n nil\n end", "def [](method)\n send(method.to_sym)\n rescue NoMethodError\n nil\n end", "def method_missing(method, *args, &block)\n attr_name = self.class.method_to_attribute_name(method)\n\n # Check if they're asking a question\n if attr_name.end_with?(\"?\")\n booleanize = true\n attr_name = attr_name[0..-2]\n end\n\n # First, let's look for an attribute exactly named `method`\n if json.has_key?(attr_name)\n key = attr_name\n # It might be prefixed with something and delimited with $\n elsif (first_match = json.keys.find {|key| key.split(\"$\").last.eql? attr_name.to_s})\n key = first_match\n\n # We don't know what this is.\n else\n # If they're trying to get a boolean, and the attribute doesn't exist,\n # lets return false. (E.g. primary? for an Attribute without an attr\n # called primary)\n return false if booleanize\n # Otherwise give up\n return super\n end\n\n nice_value_at_key(key, booleanize: booleanize)\n end", "def is_attribute?; end", "def get_attribute(name, *args)\n @loaded ? super(name, *args) : load.send(name, *args)\n end", "def method_missing(method, *args, &block)\n key = method.to_s\n return @details[key] if @details.has_key?(key)\n\n raise Ncdc::Error.new(\"Could not read attribute '#{key}' - #{@details.inspect}\")\n end", "def method_missing(method, *args)\n if uri_response_attributes.include?(method)\n return uri_response_attribute(method)\n elsif scraper && scraper.has_attribute?(method)\n return scraper.attribute(method)\n end\n super\n end", "def [](attribute_name)\n raise NoMethodError, \"The attribute #{attribute_name} is undefined\" unless self.class.attributes.has_key? attribute_name\n default = super(attribute_name)\n self.class.cast(attribute_name, default.is_a?(Proc) ? default.call : default)\n end", "def method_missing(m, *args, &block)\n # if they accessed a setter, take the param. The API will throw a 'field does not exist'\n # error if they try pushing fields through that don't belong.\n if m.to_s =~ /^(.+)\\=/ and args[0]\n instance_variable_set(\"@#{$1}\", args[0])\n elsif attrs.keys.include?(m.to_s)\n attrs[m.to_s]\n else\n raise NoMethodError.new(\"NoMethodError\")\n end\n end", "def method_missing(method_name, *method_args)\n get(method_name) || super.method_missing(method_name, *method_args)\n end", "def instance_method_already_implemented?(method_name)\n super ||\n attr_accessors.method_defined?(method_name)\n end", "def prefer_resource_method!\n alias_method :fetch_attribute_from_object_and_resource, :_fetch_attribute_from_resource_first\n end", "def respond_to?(method_name)\n if attrs.keys.include? method_name.to_s\n true\n else\n super(method_name)\n end\nend", "def [](attr_name)\n if self.attribute_names.include?(attr_name)\n read_attribute(attr_name)\n else\n get_custom_attribute(attr_name)\n end\n end", "def method_missing(attribute_name, *)\n instance_variable_get(\"@#{attribute_name}\")\n rescue NameError\n raise NoMethodError, \"undefined method `#{attribute_name}' for #{inspect}\"\n end", "def method_missing(method, *args)\n if product\n product.has_attribute?(method) ? product[method] : super\n else\n super\n end\n end", "def read_only_attribute(name, options={}, &block)\n name = name.to_s\n\n attr_accessors.send :define_method, name do\n value = read_attribute(name)\n value.nil? ? options[:default] : value\n end unless attr_accessors.instance_methods.include?(name)\n self.send :define_method, name, &block if block_given?\n\n enforce_type(name, options[:type]) if options[:type]\n\n define_attribute_method name\n self._read_only_attributes |= [name]\n\n nil\n end", "def method_missing( method, *args )\n @data[ method ] || ( @rating ? @rating[ method.to_s ] : nil )\n end", "def method_missing(method_name, *args)\n if method_name.to_s =~ /^(.*)=$/\n @attrs[$1.to_sym] = args[0]\n else\n val = @attrs[method_name.to_sym]\n case column_type(method_name)\n when :integer\n if val =~ /^\\d+$/\n val.to_i\n else\n val\n end\n else\n val\n end\n end\n end", "def method_missing(method_sym, *arguments)\n method_name = method_sym.to_s\n attribute_name = method_name.gsub(/(\\?$)|(=$)/, '')\n if @attributes.include?(attribute_name.to_sym) || method_name[-1] == '=' || method_name[-1] == '?'\n generate_methods!(attribute_name, method_name)\n send(method_sym, *arguments)\n else\n super(method_sym, *arguments)\n end\n end", "def method_missing(method_name, *args, &block)\n mapped_key = office_map[method_name.to_sym]\n if attributes.has_key?(mapped_key)\n attributes[mapped_key]\n else\n super\n end\n end", "def method_missing(method_name, *args, &block)\n mapped_key = office_map[method_name.to_sym]\n if attributes.has_key?(mapped_key)\n attributes[mapped_key]\n else\n super\n end\n end", "def method_missing(method_name, *args, &block)\n mapped_key = office_map[method_name.to_sym]\n if attributes.has_key?(mapped_key)\n attributes[mapped_key]\n else\n super\n end\n end", "def method_missing(method, *args, &block)\n attributes.public_send(method, *args, &block)\n end", "def [](key_name)\n read_attribute(key_name)\n rescue MissingAttribute\n nil\n end" ]
[ "0.7098673", "0.675135", "0.67112786", "0.6603421", "0.6600902", "0.65724015", "0.6534883", "0.6431359", "0.6387443", "0.6317372", "0.6257195", "0.6229957", "0.6220607", "0.6219915", "0.6193167", "0.6179", "0.61365044", "0.6131647", "0.6122696", "0.6093004", "0.6082087", "0.60710305", "0.60705477", "0.6052034", "0.6033685", "0.6027571", "0.60233307", "0.6019371", "0.6016482", "0.59840393", "0.5977302", "0.5959202", "0.59501445", "0.5948673", "0.59382784", "0.5929193", "0.5923462", "0.59234405", "0.5919604", "0.5918347", "0.590087", "0.5882361", "0.5871302", "0.5867988", "0.5848448", "0.5844814", "0.5834037", "0.5833961", "0.58327615", "0.5828724", "0.58243906", "0.58220226", "0.5812839", "0.57966024", "0.5779132", "0.57732695", "0.5765137", "0.5755522", "0.574761", "0.574761", "0.574761", "0.57419735", "0.5739752", "0.5738729", "0.5738413", "0.57367474", "0.5728347", "0.5721403", "0.5718568", "0.5710026", "0.56884086", "0.5687608", "0.5685556", "0.56768566", "0.56662047", "0.56629586", "0.5655047", "0.5655047", "0.56215215", "0.56103915", "0.5605252", "0.56046605", "0.5592985", "0.55894387", "0.5583699", "0.5575642", "0.55731654", "0.55686396", "0.556684", "0.55553645", "0.5540536", "0.5540003", "0.553495", "0.5532968", "0.55120564", "0.55089116", "0.55060583", "0.55060583", "0.55060583", "0.54862756", "0.54860926" ]
0.0
-1
hostname : short hostname machinename : output of hostname command (might be short on solaris) fqdn : result of canonicalizing hostname using DNS or /etc/hosts domain : domain part of FQDN hostname and machinename should always exist fqdn and domain may be broken if DNS is broken on the host
def from_cmd(cmd) so = shell_out(cmd) so.stdout.split($/)[0] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fqdn\n [ hostname, domain ].join('.') unless hostname.nil? and domain.nil?\n end", "def fqdn\n exit_code, stdout = ssh.exec(\"hostname --fqdn\")\n (exit_code == 0) ? stdout.chomp : \"\"\n end", "def determine_hostname\n @info[:hostname] = @shell.query('HOST', 'hostname')\n end", "def fqdn\n ssh.exec!(\"hostname --fqdn\").chomp\n end", "def resolve_fqdn\n hostname = from_cmd(\"hostname\")\n addrinfo = Socket.getaddrinfo(hostname, nil).first\n iaddr = IPAddr.new(addrinfo[3])\n Socket.gethostbyaddr(iaddr.hton)[0]\n rescue\n nil\n end", "def build_hostname\n hostname\n end", "def hostname\n @hostname ||= `hostname`.chomp\n end", "def canonicalize_hostname(hostname)\n Addrinfo.getaddrinfo(hostname, nil, nil, nil, nil, Socket::AI_CANONNAME).first.canonname\n end", "def canonical_hostname(domain)\n # Allow hostname overrides\n return $override_dashboard if $override_dashboard && domain == 'studio.code.org'\n return $override_pegasus if $override_pegasus && domain == 'code.org'\n\n return \"#{name}.#{domain}\" if ['console', 'hoc-levels'].include?($node_name)\n return domain if $node_env == 'production'\n\n # our HTTPS wildcard certificate only supports *.code.org\n # 'env', 'studio.code.org' over https must resolve to 'env-studio.code.org' for non-prod environments\n sep = (domain.include?('.code.org')) ? '-' : '.'\n return \"localhost#{sep}#{domain}\" if $node_env == 'development'\n return \"translate#{sep}#{domain}\" if $node_name == 'crowdin'\n \"#{$node_env}#{sep}#{domain}\"\nend", "def hostname\n @hostname ||= `hostname`.strip\n end", "def host_from_fqdn(question)\n domains.each do |domain|\n dd = dotted_domain(domain)\n if question.index(dd)\n host = question[0, question.index(dd)]\n end\n end\n nil\n end", "def canonical\n dns_host_name\n end", "def dns_host_name\n @dns_host_name ||= ::SimpleIDN.to_ascii(@host_name)\n end", "def lookup_hostname(host)\n Socket.getaddrinfo(host, nil, nil, Socket::SOCK_STREAM)[0][3]\n rescue SocketError\n raise(InvalidHostname, Errstr::INVALID_HOST % host)\n end", "def fqdn_correct?(host_name, domain_name, ip_addr)\n cmd_if %{egrep -q '^#{ip_addr}[[:space:]]+#{host_name}.#{domain_name}' /etc/hosts >/dev/null}\nend", "def hostname\n raise 'empty hostname, something wrong' if @in_hostname.empty?\n @in_hostname\n end", "def fqdn domain_name\n Service.fqdn domain_name, dns\n end", "def check_hostname_dns_reverse_lookup\n my_fqdn = %x{hostname -f}.chomp\n if !$?.success?\n opoo \"You can't run 'hostname -f'!? I can't check your hostname dns reverse lookup.\"\n elsif %x{traceroute -m 2 \"#{my_fqdn}\" 2>/dev/null}.chomp.lines.to_a.size != 1 || !$?.success?\n # Actually, passing this check only proves that the name is bound to someone in your subnet.\n opoo \"Your effective FQDN (#{my_fqdn}) doesn't seem to traceroute to yourself.\"\n end\n end", "def hostname\n Socket.gethostname.split('.').first.strip\n end", "def hostname\n Resolv.getname(ip_address) rescue nil\n end", "def hostname\n if (host = @host.at('tag[name=host-fqdn]'))\n host.inner_text\n end\n end", "def hostname\n hostname = nil\n run \"hostname\" do |channel, stream, data|\n hostname = data.chomp\n end\n hostname\n end", "def hostname(ip_address)\n @resolver.getname(ip_address).to_s\n rescue\n 'IP address not found'\n end", "def hostname; end", "def hostname; end", "def is_fqdn? (host)\n\t\tputs \"Validate the host-name format is valid: #{host}\" if @verbose\n\t\treturn false if is_ip?(host) or is_url?(host)\n\t\tdomain=get_domain_root(host)\n\t\tif domain.nil?\n\t\t\treturn false\n\t\telsif is_domain_root?(domain)\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\n#\trescue => ee\n#\t\tputs \"Exception on method is_fqdn? for #{host}: #{ee}\" if @verbose\n#\t\treturn false\n\tend", "def hostname(arg = nil)\n set_or_return(:hostname, arg, kind_of: [String])\n end", "def resolve_hostname_on(host, hostname)\n match = curl_on(host, \"--verbose #{hostname}\", accept_all_exit_codes: true).stderr.match(ipv4_regex)\n match ? match[0] : nil\n end", "def encode_hostname(hostname); end", "def hostname\n @hostname ||= ENV['HOSTNAME'] || `hostname`.delete(\"\\n\")\n end", "def external_fqdn() ; info[:external_fqdn] ; end", "def hostname\n Socket.gethostname\n end", "def get_hostname\n cmd_exec('uname -n').to_s\n rescue\n raise 'Unable to retrieve hostname'\n end", "def get_domain_name(host)\n domain = nil\n search = nil\n resolv_conf = if host['platform'].include?('windows')\n if host.is_cygwin?\n host.exec(Command.new(\"cat /cygdrive/c/Windows/System32/drivers/etc/hosts\")).stdout\n else\n host.exec(Command.new('type C:\\Windows\\System32\\drivers\\etc\\hosts')).stdout\n end\n else\n host.exec(Command.new(\"cat /etc/resolv.conf\")).stdout\n end\n resolv_conf.each_line do |line|\n if (match = /^\\s*domain\\s+(\\S+)/.match(line))\n domain = match[1]\n elsif (match = /^\\s*search\\s+(\\S+)/.match(line))\n search = match[1]\n end\n end\n return_value ||= domain\n return_value ||= search\n\n return unless return_value\n\n return_value.gsub(/\\.$/, '')\n end", "def hostname()\n unless @host.is_str?\n @host = ENV['HOSTNAME']\n @host = `/bin/hostname` unless @host.is_str?\n raise \"Failed to determine current HOSTNAME\" unless @host.is_str?\n\n @host = @host.downcase.sub(/\\..*$/, '').strip\n raise \"Failed to determine current HOSTNAME\" unless @host.is_str?\n end\n @host = @host.to_sym\n end", "def hostname\n Socket.gethostname\n end", "def hostname\n Socket.gethostname\n end", "def hostname\n @hostname ||= ENV['HOSTNAME'] || `hostname`.chomp\n end", "def reverse_dns_lookup (ip)\n\t\tputs \"Retrieve the hostname by the reverse DNS lookup on IP: #{ip}\"\n\t\thostname = ip\n\t\tbegin\n\t\t\thostname = Socket.gethostbyaddr(ip.split('.').collect{ |x| x.to_i}.pack(\"CCCC\"))[0]\n\t\t\treturn hostname.downcase\n\t\trescue => ee\n\t\t\tputs \"Exception on method reverse_dns_lookup: #{ee}\" if @verbose\n\t\t\treturn hostname\n\t\tend\n\tend", "def decode_hostname(hostname); end", "def hostname(node)\n \"#{node.to_s}.smartengine.local\"\nend", "def get_fqdn(ip)\n begin\n resp = Socket.getaddrinfo(ip, nil)\n rescue\n return nil\n end\n fqdn = resp[0][2]\n nip = resp[0][3]\n return nil if (fqdn == nip)\n return fqdn\nend", "def get_fqdn(ip)\n begin\n resp = Socket.getaddrinfo(ip, nil)\n rescue\n return nil\n end\n fqdn = resp[0][2]\n nip = resp[0][3]\n return nil if (fqdn == nip)\n return fqdn\nend", "def hostname\n if @hostname.nil?\n @hostname = ENV[\"COMPUTERNAME\"]\n @hostname = ENV[\"HOSTNAME\"] if @hostname.blank?\n @hostname = `hostname` if @hostname.blank?\n @hostname = @hostname.gsub(/\\.terracotta\\.lan/, '').strip\n end\n \n @hostname\n end", "def hostname\n return 'unknown' unless available?\n @hostname ||= ssh_cmd('hostname').chomp\n end", "def set_hostname\n return unless File.exist?(hostname_path)\n return if File.read(hostname_path).strip == new_hostname\n puts \"Setting local hostname (#{new_hostname})...\"\n write_file(hostname_path, new_hostname)\n `hostname -F /etc/hostname`\n end", "def get_server_hostname\n (`hostname`).strip\n end", "def fqdn\n [name, tag, domain].compact.join('.')\n end", "def resolve( hostname )\n if( not hostname.empty? )\n begin\n return Rex::Socket.addr_itoa( Rex::Socket.gethostbyname( hostname )[3].unpack( 'N' ).first )\n rescue ::SocketError\n return nil\n end\n end\n return nil\n end", "def dns_name\n [\"public\", fqdn].join(\".\")\n end", "def private_hostname_of(server)\n server[:fqdn]\n end", "def hostname_correct?(host_name)\n host_name == capture(%{hostname}).chomp\nend", "def set_hostname(host, domain)\n set_hostname = <<SCRIPT\n sudo hostname #{host}.#{domain}\nSCRIPT\nend", "def hostname\n v = self.host\n v&.start_with?('[') && v.end_with?(']') ? v[1..-2] : v\n end", "def hostname\n FFI::Libvirt.virConnectGetHostname(pointer)\n end", "def get_server_domain\n @hostname ||= Socket.gethostname\n end", "def hostname\n return @hostname\n end", "def hostname\n if resolution = CloudModel::AddressResolution.where(ip: ip).first\n resolution.name\n else\n begin\n Resolv.getname(ip)\n rescue\n ip\n end\n end\n end", "def hostname\n name + '.localhost'\n end", "def normalized_host; end", "def match_hostname( val )\n\t\tmatch = RFC1738Hostname.match( val )\n\t\treturn match ? match[0] : nil\n\tend", "def fqdn\n \"#{to_label}.example.com\"\n end", "def address(hostname)\n @resolver.getaddress(hostname).to_s\n rescue\n 'Hostname not found'\n end", "def ssh_hostname\n name = \"\"\n Net::SSH.start(@ip, \"pipeline\") do |ssh|\n name = ssh.exec! \"hostname -s\"\n end\n name.downcase.chomp\n end", "def canonical\n dns_name\n end", "def initialize(hostname)\n hostname = String(hostname)\n\n raise ArgumentError, \"domain name must not start with a dot: #{hostname}\" if hostname.start_with?(DOT)\n\n begin\n @ipaddr = IPAddr.new(hostname)\n @hostname = @ipaddr.to_s\n return\n rescue IPAddr::Error\n nil\n end\n\n @hostname = DomainName.normalize(hostname)\n tld = if (last_dot = @hostname.rindex(DOT))\n @hostname[(last_dot + 1)..-1]\n else\n @hostname\n end\n\n # unknown/local TLD\n @domain = if last_dot\n # fallback - accept cookies down to second level\n # cf. http://www.dkim-reputation.org/regdom-libs/\n if (penultimate_dot = @hostname.rindex(DOT, last_dot - 1))\n @hostname[(penultimate_dot + 1)..-1]\n else\n @hostname\n end\n else\n # no domain part - must be a local hostname\n tld\n end\n end", "def hostname\n @options[:host][:name] if @options[:host]\n end", "def fqdn(i)\n \"#{host(i)}.local\"\nend", "def new_hostname\n host || incremented_hostname || local_host_name\n end", "def hostname=(name)\n if hostname != name\n rebuild_host_file(name, fqdn)\n ssh.exec! \"hostname #{name}\", sudo: true\n ssh.exec! \"echo #{name} > /etc/hostname\", sudo: true\n end\n end", "def get_public_hostname\n rpc_get_fact_direct('public_hostname')\n end", "def hostname=(value)\n @hostname = value\n end", "def parse_argv(hostname)\n if hostname =~ /^([-\\w]+?)\\.([-\\w\\.]+)/ # non-greedy up to the first . is hostname\n @hostname = $1\n elsif hostname =~ /^([-\\w]+)$/ # sometimes puppet's @name is just a name\n @hostname = hostname\n log(\"got shortname for [#{hostname}]\")\n else\n log(\"didn't receive parsable hostname, got: [#{hostname}]\",:err)\n exit(1)\n end\n end", "def domain\n @domain ||= PublicSuffix.parse(@fqdn).domain\n end", "def host_name=(value)\n @hostname = value\n end", "def fqdn(gear_name = nil)\n \"#{gear_name || canonical_name}-#{domain_namespace}.#{Rails.configuration.openshift[:domain_suffix]}\"\n end", "def establish_hostname_and_domain\n ShellSpinner \"# checking whether hostname and domain have been set\", false do\n\n hostname, domain = nil\n\n @config[:route53][:hostname] = find_with_context(:hostname, :user_data_template_variables) if find_with_context(:hostname, :user_data_template_variables)\n @config[:route53][:domain] = find_with_context(:domain, :user_data_template_variables) if find_with_context(:domain, :user_data_template_variables)\n @config[:route53][:hostname] = find_with_context(:hostname, :route53) if find_with_context(:hostname, :route53)\n @config[:route53][:domain] = find_with_context(:domain, :route53) if find_with_context(:domain, :route53)\n\n help = <<-HEREDOC.strip_heredoc\n # \n # checked:\n # 'common', 'user_data_template_variables',\n # and 'route53' sections of config\n # --common-variables, --route53-variables,\n # and --user-data-template-variables\n #\n # route53 dynamic DNS will not be updated!\n HEREDOC\n\n domain = @config[:route53][:domain]\n hostname = @config[:route53][:hostname]\n\n if domain.nil? and hostname.nil?\n debug <<-HEREDOC.strip_heredoc\n # WARNING: hostname and domain not found\"\n #{help}\n\n HEREDOC\n\n elsif domain and hostname.nil?\n debug <<-HEREDOC.strip_heredoc\n # WARNING: hostname not found\n #{help}\n\n HEREDOC\n\n elsif domain.nil? and hostname\n debug <<-HEREDOC.strip_heredoc\n # WARNING: domain not found\n #{help}\n\n HEREDOC\n\n else\n debug <<-HEREDOC.strip_heredoc\n # found hostname and domain:\n hostname: #{hostname}\n domain: #{domain}\n\n HEREDOC\n\n @config[:route53][:new_dns_records] = {\n :public => {\n :alias => \"#{hostname}.#{domain}.\",\n :target => nil\n },\n :private => {\n :alias => \"#{hostname}-private.#{domain}.\",\n :target => nil\n }\n }\n end\n end\n\n puts\n end", "def hostname\n options[:hostname]\n end", "def public_hostname_of(server)\n server[:cloud][:public_hostname] rescue public_ip_of(server)\n end", "def validate_hostname(hostname)\n hostname_regex = /(hostname)$/\n if hostname_regex =~ hostname\n $evm.log(\"info\",\"Hostname:<#{hostname}> found\") if @debug\n return true\n else\n $evm.log(\"error\",\"Hostname:<#{hostname}> not found\") if @debug\n return false\n end\n end", "def hostname\n ssh.exec!(\"hostname\").chomp\n end", "def desired_hostname\n if path.start_with?('/foo/en')\n Rails.env.staging? ? 'foo-staging.infopark.com' : 'www.foo.com'\n else\n # Default hostname\n Rails.env.staging? ? 'website-staging.infopark.com' : 'www.website.com'\n end\n end", "def fqdn?\n tld ? true : false\n end", "def host(n=nil)\n if n.nil? \n @host ||= dns_name\n else\n @host = n\n end\n end", "def all_names(hostname)\n ret = []\n\n if hostname.local == hostname.fqdn\n ret << hostname.fqdn\n else\n ret << hostname.fqdn << hostname.local\n end\n\n ret\n end", "def all_names(hostname)\n ret = []\n\n if hostname.local == hostname.fqdn\n ret << hostname.fqdn\n else\n ret << hostname.fqdn << hostname.local\n end\n\n ret\n end", "def validate_hostname(userdata)\n if userdata =~ /\\A[A-Za-z0-9\\-\\.]{2,254}\\z/\n userdata\n else\n raise 'Illegal hostname'\n end\n end", "def host_2_ip (hostname)\n\t\tputs \"Perform DNS query on host: #{hostname}\" if @verbose\n\t\tbegin\n\t\t\tips=Array.new\n\t\t\tif is_ip?(hostname)\n\t\t\t\tputs \"No change - same IP is returned. \" if @verbose\n\t\t\t\treturn hostname.strip\n\t\t\telse\n\t\t\t\tips=Resolv.getaddresses(hostname)\n\t\t\t\tif (ips.empty?) then\n\t\t\t\t\tputs \"Failed to resolve #{hostname}\" if @verbose\n\t\t\t\t\treturn nil\n\t\t\t\telse\n\t\t\t\t\tputs \"IP found: #{ips.first}\" if @verbose\n\t\t\t\t\treturn ips.first.strip\n\t\t\t\tend\n\t\t\tend\n\t\trescue => ee\n\t\t\tputs \"Exception on method host_2_ip for host #{hostname}: #{ee}\" if @verbose\n\t\t\treturn nil\n\t\tend\n\tend", "def parse_host(hostname)\n return nil if hostname.blank?\n\n begin\n return IPAddr.new(hostname)\n rescue IPAddr::InvalidAddressError\n end\n\n hostname\n end", "def add_host(line, hostname)\n return if line !~ /^([^\\s]+)(\\s+)/\n\n i = $~.end(2)\n \"#{$1}#{$2}#{hostname.fqdn} #{line[i..-1]}\"\n end", "def includes_hostname?(line, hostname)\n /\\s#{Regexp.escape(hostname.fqdn)}(\\s|$)/ =~ line\n end", "def parse_hostname(config)\n mdata = /(?<=^hostname\\s)(.+)$/.match(config)\n { hostname: mdata.nil? ? '' : mdata[1] }\n end", "def get_event_host(host)\n unless options[:fqdn]\n return host.split('.')[0]\n end\n return host\n end", "def normalize(domain)\n domain = domain.chomp(DOT).unicode_normalize(:nfc) unless domain.ascii_only?\n Punycode.encode_hostname(domain).downcase\n end", "def set_hostname\n @hostname = Hostname.find_by_name(params[:name])\n end", "def get_nameserver (host)\n\t\tputs \"Retrieve the first authoritative name server for: #{host}\" if @verbose\n\t\tbegin\n\t\t\tdomain=get_domain_root(host)\n\t\t\tw=Wmap::Whois.new\n\t\t\tns = w.query(domain).nameservers.map! { |x| x.name }\n\t\t\tif ns.empty?\n\t\t\t\tputs \"No name server found for domain root: #{domain}\" if @verbose\n\t\t\t\treturn nil\n\t\t\telse\n\t\t\t\treturn ns.first\n\t\t\tend\n\t\trescue => ee\n\t\t\tputs \"Exception on method get_nameservers for #{host}: #{ee}\" if @verbose\n\t\t\treturn nil\n\t\tend\n\tend", "def name\n if ipv4?\n \"[#{ip_address}]\"\n elsif ipv6?\n \"[IPv6:#{ip_address}]\"\n elsif @config[:host_encoding] && @config[:host_encoding] == :unicode\n ::SimpleIDN.to_unicode(host_name)\n else\n dns_name\n end\n end", "def host_from_uri(domain)\n Addressable::URI.parse(domain).host || Addressable::URI.parse(\"http://#{domain}\").host\n end", "def fqdn=(name)\n rebuild_host_file(hostname, name) if fqdn != name\n end", "def replace_host(line, old_hostname, new_hostname)\n line.sub(\n /(\\s)#{Regexp.escape(old_hostname.fqdn)}(\\s|$)/,\n \"\\\\1#{new_hostname.fqdn}\\\\2\"\n )\n end", "def read_hostname\n return nil unless running?\n\n begin\n return ContainerControl::Commands::GetHostname.run!(self)\n rescue ContainerControl::Error => e\n log(:warn, \"Unable to read container hostname: #{e.message}\")\n return nil\n end\n end" ]
[ "0.7720517", "0.76114225", "0.7545636", "0.7523485", "0.7486964", "0.74766386", "0.7473996", "0.7446329", "0.74332714", "0.7409442", "0.7388643", "0.7325203", "0.7281187", "0.72241676", "0.7200373", "0.7129298", "0.70991516", "0.7084573", "0.70620024", "0.7061408", "0.70508116", "0.7023468", "0.70095867", "0.70000994", "0.70000994", "0.69610333", "0.6958287", "0.6922607", "0.69089836", "0.6854909", "0.68530506", "0.68414474", "0.683507", "0.68330085", "0.6826301", "0.68173486", "0.68173486", "0.6795927", "0.67942405", "0.6779832", "0.677523", "0.6769786", "0.6769786", "0.67688805", "0.67643875", "0.67614657", "0.6741061", "0.67391336", "0.6730496", "0.6727291", "0.67152655", "0.66916823", "0.66744095", "0.66627294", "0.6653967", "0.66391623", "0.66169196", "0.6615263", "0.660375", "0.6600282", "0.6580864", "0.65586025", "0.6556651", "0.65512276", "0.6548017", "0.65341634", "0.65002316", "0.64753455", "0.64693075", "0.64687425", "0.64511406", "0.64510846", "0.6435357", "0.6396453", "0.63937926", "0.6324747", "0.63092124", "0.63070905", "0.62826717", "0.6279779", "0.62563115", "0.6248226", "0.62401164", "0.62312984", "0.6222014", "0.6222014", "0.6209414", "0.61903876", "0.6184632", "0.61764354", "0.6159441", "0.61465186", "0.61440265", "0.61381453", "0.61343324", "0.6133971", "0.61270463", "0.612503", "0.6116211", "0.6111202", "0.6104512" ]
0.0
-1
forward and reverse lookup to canonicalize FQDN (hostname f equivalent) this is ipv6safe, works on ruby 1.8.7+
def resolve_fqdn hostname = from_cmd("hostname") addrinfo = Socket.getaddrinfo(hostname, nil).first iaddr = IPAddr.new(addrinfo[3]) Socket.gethostbyaddr(iaddr.hton)[0] rescue nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_forward_lookup(_ip, _hostname)\n end", "def check_hostname_dns_reverse_lookup\n my_fqdn = %x{hostname -f}.chomp\n if !$?.success?\n opoo \"You can't run 'hostname -f'!? I can't check your hostname dns reverse lookup.\"\n elsif %x{traceroute -m 2 \"#{my_fqdn}\" 2>/dev/null}.chomp.lines.to_a.size != 1 || !$?.success?\n # Actually, passing this check only proves that the name is bound to someone in your subnet.\n opoo \"Your effective FQDN (#{my_fqdn}) doesn't seem to traceroute to yourself.\"\n end\n end", "def remove_forward_lookup(_fqdn)\n end", "def reverse_dns_lookup (ip)\n\t\tputs \"Retrieve the hostname by the reverse DNS lookup on IP: #{ip}\"\n\t\thostname = ip\n\t\tbegin\n\t\t\thostname = Socket.gethostbyaddr(ip.split('.').collect{ |x| x.to_i}.pack(\"CCCC\"))[0]\n\t\t\treturn hostname.downcase\n\t\trescue => ee\n\t\t\tputs \"Exception on method reverse_dns_lookup: #{ee}\" if @verbose\n\t\t\treturn hostname\n\t\tend\n\tend", "def get_fqdn(ip)\n begin\n resp = Socket.getaddrinfo(ip, nil)\n rescue\n return nil\n end\n fqdn = resp[0][2]\n nip = resp[0][3]\n return nil if (fqdn == nip)\n return fqdn\nend", "def get_fqdn(ip)\n begin\n resp = Socket.getaddrinfo(ip, nil)\n rescue\n return nil\n end\n fqdn = resp[0][2]\n nip = resp[0][3]\n return nil if (fqdn == nip)\n return fqdn\nend", "def canonical\n dns_host_name\n end", "def normalized_host; end", "def frwdlp(session,hostlst,domain,dest)\n\tdest = dest + \"-DNS-forward-lookup.txt\"\n\tprint_status(\"Performing DNS Forward Lookup for hosts in #{hostlst} for domain #{domain}\")\n\tfilewrt(dest,\"DNS Forward Lookup for hosts in #{hostlst} for domain #{domain}\")\n\tresult = []\n\tthreads = []\n\ttmpout = []\n\tbegin\n\tif ::File.exists?(hostlst)\n\t\t::File.open(hostlst).each {|line|\n \t\t\tthreads << ::Thread.new(line) { |h|\n \t\t\t#print_status(\"checking #{h.chomp}\")\n\t\t \tr = session.sys.process.execute(\"nslookup #{h.chomp}.#{domain}\", nil, {'Hidden' => true, 'Channelized' => true})\n \t\t \twhile(d = r.channel.read)\n \t\t\tif d =~ /(Name)/\n \t\t\t\td.scan(/Name:\\s*\\S*\\s*Address\\w*:\\s*.*?.*?.*/) do |n|\n \t\t\t\ttmpout << n.split\n \t\t\tend\n \t\t\tbreak\n \t\tend\n end\n\n r.channel.close\n r.close\n\t\t\t}\n\t\t}\n\tthreads.each { |aThread| aThread.join }\n\ttmpout.uniq.each do |t|\n \tprint_status(\"\\t#{t.join.sub(/Address\\w*:/, \"\\t\")}\")\n \tfilewrt(dest,\"#{t.join.sub(/Address\\w*:/, \"\\t\")}\")\n end\n\n\telse\n\t\tprint_status(\"File #{hostlst}does not exists!\")\n\t\texit\n\tend\n\trescue ::Exception => e\n \t\tprint_status(\"The following Error was encountered: #{e.class} #{e}\")\n\tend\nend", "def resolve_name(lookup_name, lookup_types=[Dnsruby::Types::A, Dnsruby::Types::CNAME, Dnsruby::Types::PTR])\n resolve_names(lookup_name,lookup_types).first\n end", "def resolve_name(lookup_name, lookup_types=[Dnsruby::Types::AAAA, Dnsruby::Types::A, Dnsruby::Types::CNAME, Dnsruby::Types::PTR])\n resolve_names(lookup_name,lookup_types).first\n end", "def local_ip_2_host (ip)\n\t\tputs \"Reverse DNS lookup from the local host repository\" if @verbose\n\t\tip=ip.strip unless ip.nil?\n\t\tif @known_hosts.key?(ip)\n\t\t\treturn @known_hosts[ip]\n\t\telse\n\t\t\treturn nil\n\t\tend\n\trescue => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\"\n\t\treturn nil\n\tend", "def resolve_addressing(host)\n @uri = URI.parse(host)\n unless uri.scheme\n @options[:type] = :icmp\n @options[:host] = uri.to_s\n @options[:url] = \"#{@options[:type]}://#{@options[:host]}\"\n return\n end\n @options[:url] = uri.to_s\n @options[:type] = uri.scheme.to_sym\n @options[:port] = uri.port\n @options[:host] = uri.host\n end", "def resolve_hostname_on(host, hostname)\n match = curl_on(host, \"--verbose #{hostname}\", accept_all_exit_codes: true).stderr.match(ipv4_regex)\n match ? match[0] : nil\n end", "def convert_fqdns_to_ips(nodes)\n if is_cloud?\n Djinn.log_debug(\"In a cloud deployment, so converting FQDNs -> IPs\")\n else\n Djinn.log_debug(\"Not in a cloud deployment, so not converting FQDNs -> IPs\")\n return nodes\n end\n\n if @creds[\"hostname\"] =~ /#{FQDN_REGEX}/\n begin\n @creds[\"hostname\"] = HelperFunctions.convert_fqdn_to_ip(@creds[\"hostname\"])\n rescue Exception => e\n Djinn.log_fatal(\"Failed to convert main hostname #{@creds['hostname']}\")\n HelperFunctions.log_and_crash(\"Failed to convert main hostname #{@creds['hostname']}\")\n end\n end\n \n nodes.each { |node|\n # Resolve the private FQDN to a private IP, but don't resolve the public\n # FQDN, as that will just resolve to the private IP.\n\n pri = node.private_ip\n if pri =~ /#{FQDN_REGEX}/\n begin\n node.private_ip = HelperFunctions.convert_fqdn_to_ip(pri)\n rescue Exception => e\n node.private_ip = node.public_ip\n end\n end\n }\n\n return nodes\n end", "def description\n \"Forward DNS Lookup\"\nend", "def fqdn_correct?(host_name, domain_name, ip_addr)\n cmd_if %{egrep -q '^#{ip_addr}[[:space:]]+#{host_name}.#{domain_name}' /etc/hosts >/dev/null}\nend", "def resolver(fqdn)\n dns = Resolv.new([Resolv::DNS.new( :nameserver => @resolvers, :search => [] )])\n\n # attempt to get address of fqdn\n x = dns.getaddresses(fqdn)\n rescue Resolv::ResolvError\n # move on\n rescue Errno::ENETUNREACH \n raise DomainError.new \"Host #{fqdn} unreachable\"\n else\n x\n end", "def canonicalize_hostname(hostname)\n Addrinfo.getaddrinfo(hostname, nil, nil, nil, nil, Socket::AI_CANONNAME).first.canonname\n end", "def resolve( hostname )\n if( not hostname.empty? )\n begin\n return Rex::Socket.addr_itoa( Rex::Socket.gethostbyname( hostname )[3].unpack( 'N' ).first )\n rescue ::SocketError\n return nil\n end\n end\n return nil\n end", "def lookup_hostname(host)\n Socket.getaddrinfo(host, nil, nil, Socket::SOCK_STREAM)[0][3]\n rescue SocketError\n raise(InvalidHostname, Errstr::INVALID_HOST % host)\n end", "def lookup_hostname(endpoint)\n @resolved_hostnames.select{ |k,v| v.include?(endpoint) }.shift[0]\n end", "def reverse_dns_delegation_entries(name_servers, opts = {})\n # Validation\n if version == 4 && cidr_obj.bits <= 24\n return \"Not supported: address block too larger (/24 or larger)\"\n end\n\n if version == 6 && cidr_obj.bits != 48\n return \"Not supported: address block not equal to /48\"\n end\n\n name_servers = [name_servers].flatten # Make into array\n\n entry = ''\n\n if version == 6\n third_part = cidr_obj.to_s(:Short => true).\\\n sub(/^([0-9a-f]+:){2}(.*)::\\/48$/i, '\\2')\n record = third_part.reverse.gsub(/(.)/, '\\1.').chop\n\n name_servers.each do |name_server|\n entry += \"#{record} IN NS #{name_server}.\\n\"\n end\n end\n\n if version == 4\n first = cidr_obj.first.sub(/^[0-9]+\\.[0-9]+\\.[0-9]+\\.([0-9]+)/, '\\1')\n last = cidr_obj.last.sub(/^[0-9]+\\.[0-9]+\\.[0-9]+\\.([0-9]+)/, '\\1')\n\n entry = \"; BEGIN: RFC 2317 sub-Class C delegation\\n\"\n entry += \";\\n\"\n\n first_time_in_loop = true\n name_servers.each do |name_server|\n if first_time_in_loop\n entry += \"#{first}-#{last}\\t\\tIN\\tNS\\t#{name_server}.\\n\"\n else\n entry += \"\\t\\tIN\\tNS\\t#{name_server}.\\n\"\n end\n\n first_time_in_loop = false\n end\n\n entry += \";\\n\"\n\n begin_at = first.to_i + 2\n end_at = last.to_i - 1\n\n (begin_at..end_at).each do |ip|\n entry += \"#{ip}\\t\\tIN\\tCNAME\\t#{ip}.#{rfc2317_zone_name}.\\n\"\n end\n\n entry += \";\\n\"\n entry += \"; END\\n\"\n end\n\n entry\n end", "def decode_hostname(hostname); end", "def reverselookup(session,iprange,dest)\n\tdest = dest + \"-DNS-reverse-lookup.txt\"\n\tprint_status(\"Performing DNS Reverse Lookup for IP range #{iprange}\")\n\tfilewrt(dest,\"DNS Reverse Lookup for IP range #{iprange}\")\n\tiplst =[]\n\ti, a = 0, []\n\tbegin\n\t\tipadd = Rex::Socket::RangeWalker.new(iprange)\n\t\t\t\tnumip = ipadd.num_ips\n\t\t\t\twhile (iplst.length < numip)\n\t\t\t\t\tipa = ipadd.next_ip\n\t\t \t\t\tif (not ipa)\n\t\t \t\t\tbreak\n\t\t \t\t\tend\n\t\t\t\t\tiplst << ipa\n\t\t\t\tend\n\t\tbegin\n\t\t iplst.each do |ip|\n\t\t if i < 10\n\t\t a.push(::Thread.new {\n\t\t\t \tr = session.sys.process.execute(\"nslookup #{ip}\", nil, {'Hidden' => true, 'Channelized' => true})\n\t \t\twhile(d = r.channel.read)\n\t \t\t\tif d =~ /(Name)/\n\t \t\t\t\td.scan(/Name:\\s*\\S*\\s/) do |n|\n\t \t\t\t\thostname = n.split(\": \")\n\t \t\t\t\tprint_status \"\\t #{ip} is #{hostname[1].chomp(\"\\n\")}\"\n\t \t\t\t\tfilewrt(dest,\"#{ip} is #{hostname[1].chomp(\"\\n\")}\")\n\t \t\t\tend\n\t \t\t\tbreak\n\n\t \t\tend\n\n\t\t \tend\n\n\t\t \tr.channel.close\n\t\t \tr.close\n\n\t\t })\n\t\t i += 1\n\t\t else\n\t\t sleep(0.05) and a.delete_if {|x| not x.alive?} while not a.empty?\n\t\t i = 0\n\t\t end\n\t\t end\n\t\t a.delete_if {|x| not x.alive?} while not a.empty?\n\t\t end\n\trescue ::Exception => e\n \t\tprint_status(\"The following Error was encountered: #{e.class} #{e}\")\n\n\tend\nend", "def full_host_record(ip:)\n load_cnames\n \n @forward_host_record ||= {} # Global, as we want to do name lookups.\n return_record = []\n unless( (host_records = @infoblox.get_host_by_ip(ip_address: ip)).nil? )\n host_records.each do |hosts|\n hosts.each do |hn|\n # Assign an empty record, if we haven't seen this host before\n @forward_host_record[hn] ||= { hostname: hn, ip: '', aliases: [], cnames: [] }\n \n # Record the IP. There may be multiple IPs with one hostname.\n @forward_host_record[hn][:ip] = ip\n \n # The hostname might have CNAMES point to it\n unless @reverse_cnames[hn].nil?\n @reverse_cnames[hn].each do |cn| \n @forward_host_record[hn][:cnames] << cn \n end\n end\n \n # The hostname may have alternate hostname A records, stored in IPAM as ALIASES\n @infoblox.get_alias(hostname: hn) do |a| \n short_alias = a.split('.',2)[0]\n @forward_host_record[hn][:aliases] << short_alias\n \n # The ALIASes might have CNAME records pointing to it\n unless @reverse_cnames[a].nil?\n # Record the ALIAS CNAMES against the parent hostname.\n @reverse_cnames[a].each do |cn| \n @forward_host_record[hn][:cnames] << cn \n end\n end\n end\n return_record << @forward_host_record[hn]\n \n # Add forward lookup entries for each ALIAS\n host_domain = hn.split('.',2)[1]\n @forward_host_record[hn][:aliases].each do |a|\n @forward_host_record[\"#{a}.#{host_domain}\"] = @forward_host_record[hn]\n end\n \n # Add forward lookup entries for each CNAME\n @forward_host_record[hn][:cnames].each do |cn|\n @forward_host_record[cn] = @forward_host_record[hn]\n end\n \n end\n end\n end\n return return_record\nend", "def address_resolve(hostname)\n\t\tif hostname =~ /\\Ascheduler-(.*)/\n\t\t\thostname = $1\n\t\tend\n\t\tsuper(hostname)\n\tend", "def fqdn\n \"#{to_label}.example.com\"\n end", "def fqdn(i)\n \"#{host(i)}.local\"\nend", "def local_host_2_ip (host)\n\t\tputs \"DNS lookup from the local host repository\" if @verbose\n\t\thost=host.strip unless host.nil?\n\t\tif @known_hosts.key?(host)\n\t\t\treturn @known_hosts[host]\n\t\telse\n\t\t\treturn nil\n\t\tend\n\trescue => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\"\n\t\treturn nil\n\tend", "def enrich_reverse_dns\n return unless can_enrich_revese_dns?\n\n self.reverse_dns_names = ReverseDnsName.build_by_ip(data)\n end", "def enrich_reverse_dns\n return if data_type != \"ip\"\n\n self.reverse_dns_names = ReverseDnsName.build_by_ip(data)\n end", "def ipv6_saddr\n\t\t\tself[:ipv6_src].to_x\n\t\tend", "def canonical\n dns_name\n end", "def add_hostname_to_loopback_interface(comm, name, loop_bound=DEAFAULT_LOOPBACK_CHECK_LIMIT)\n basename = name.split(\".\", 2)[0]\n comm.sudo <<-EOH.gsub(/^ {14}/, '')\n grep -w '#{name}' /etc/hosts || {\n for i in {1..#{loop_bound}}; do\n grep -w \"127.0.${i}.1\" /etc/hosts || {\n echo \"127.0.${i}.1 #{name} #{basename}\" >> /etc/hosts\n break\n }\n done\n }\n EOH\n end", "def fqdn\n [ hostname, domain ].join('.') unless hostname.nil? and domain.nil?\n end", "def host_from_fqdn(question)\n domains.each do |domain|\n dd = dotted_domain(domain)\n if question.index(dd)\n host = question[0, question.index(dd)]\n end\n end\n nil\n end", "def reverses\n if @family == Socket::AF_INET\n if self.length == 32\n [ self.reverse ]\n else\n boundary = self.length % 8 == 0 && self.length != 0 ? self.length / 8 - 1 : self.length / 8\n divisor = (boundary + 1) * 8\n count = (self.last.to_i - self.first.to_i) / (1 << 32 - divisor)\n res = []\n (0..count).each do |i|\n octets = IPAddr.new(first.to_i + ((1<<32-divisor)*i), Socket::AF_INET).to_s.split('.')[0..boundary]\n res << \"#{octets.reverse * '.'}.in-addr.arpa\"\n end\n res\n end\n elsif @family == Socket::AF_INET6\n if self.length == 128\n [ self.reverse ]\n else\n boundary = self.length % 16 == 0 && self.length != 0 ? self.length / 4 - 1 : self.length / 4\n divisor = (boundary + 1) * 4\n count = (self.last.to_i - self.first.to_i) / (1 << 128-divisor)\n res = []\n (0..count).each do |i|\n baseaddr = self.first.to_i + (1<<128-divisor)*i\n octets = (\"%032x\" % baseaddr).split('')[0..boundary]\n res << octets.reverse * '.' + '.ip6.arpa'\n end\n res\n end\n end\n end", "def reverse_name_lookup(ip, type = :A)\n # look for all the zones\n type = type.to_sym if type.class != Symbol\n dns_name = String.new\n @dns.domains.each do |zone|\n @dns.domains.get(zone.id).records.each do | record |\n if record.data == ip and record.type.to_sym == type\n dns_name = record.name\n break\n end\n end\n end\n return dns_name\n end", "def anonymize\n ipv4 = (m = value.match(/\\d+\\.\\d+\\.\\d+\\.\\d+$/)) ? m[0] : \"\"\n ipv6 = value.gsub(ipv4, \"\")\n ipv6 += \":\" if ipv4.present? && ipv6.present?\n ipv4 = ipv4.gsub(/\\.\\d+$/, \".0\")\n ipv6 = ipv6.gsub(/:(\\d|[a-f])*:(\\d|[a-f])*:(\\d|[a-f])*:(\\d|[a-f])*:(\\d|[a-f])*$/, \"::\")\n IPAddress.new([ipv6, ipv4].keep_if { |ip| ip.present? }.join)\n end", "def ipv6_daddr\n\t\t\tself[:ipv6_dst].to_x\n\t\tend", "def get_host_info(s)\n\n # Prepare response array of aliases (IP and addresses)\n aliases = []\n\n # Get information from the given IP or name\n begin\n resp = Socket.getaddrinfo(s, nil)\n rescue\n aliases << s\n else\n\n fqdn = resp.first[2]\n ip = resp.first[3]\n aliases << fqdn\n\n if fqdn != ip\n host_dom = fqdn.split('.', 2)\n if $local_domain && host_dom.length == 2 && host_dom.last == $local_domain\n aliases << host_dom.first\n end\n aliases << ip\n end\n\n end\n\n return aliases\n\nend", "def hostname\n (request.env['HTTP_X_FORWARDED_SERVER'] =~ /[a-z]*/) ? request.env['HTTP_X_FORWARDED_SERVER'] : request.env['HTTP_HOST']\n end", "def local_ip\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 s.addr.last\n end\nensure\n Socket.do_not_reverse_lookup = orig\nend", "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 address_for(network); end", "def fqdn\n ssh.exec!(\"hostname --fqdn\").chomp\n end", "def external_fqdn() ; info[:external_fqdn] ; end", "def resolve(dns_records, lookup_chain, domain)\n record_A = dns_records[:A]\n record_CNAME = dns_records[:CNAME]\n\n #if domain in recordA\n #add destination to lookup_chain\n if record_A[:source].include?(domain)\n lookup_chain.push(record_A[:ip][record_A[:source].index(domain)])\n\n #if domain in recordCNAME\n #add destination to lookup_chain\n #update domain with destination\n #call the funtion again with new domain(Recursion)\n elsif record_CNAME[:source].include?(domain)\n lookup_chain.push(record_CNAME[:alias][record_CNAME[:source].index(domain)])\n domain = record_CNAME[:alias][record_CNAME[:source].index(domain)]\n resolve(dns_records, lookup_chain, domain)\n else\n return lookup_chain\n end\nend", "def human_name\n \"reverse TCP\"\n end", "def encode_hostname(hostname); end", "def dns_name\n [\"public\", fqdn].join(\".\")\n end", "def dns_host_name\n @dns_host_name ||= ::SimpleIDN.to_ascii(@host_name)\n end", "def fqdn\n exit_code, stdout = ssh.exec(\"hostname --fqdn\")\n (exit_code == 0) ? stdout.chomp : \"\"\n end", "def canonical_tld?; end", "def resolve!\n Resolv.each_address(host) do |address|\n return @ip = address if address =~ pattern\n end\n end", "def remote_host\n # NOTE: Celluloid::IO does not yet support non-blocking reverse DNS\n @socket.peeraddr(true)[2]\n end", "def prefix_from_multicast\n if ipv6? && multicast_from_prefix?\n prefix_length = (to_i >> 92) & 0xff\n if (prefix_length == 0xff) && (((to_i >> 112) & 0xf) >= 2)\n # Link local prefix\n #(((to_i >> 32) & 0xffffffffffffffff) + (0xfe80 << 112)).to_ip(Socket::AF_INET6).tap { |p| p.length = 64 }\n return nil # See http://redmine.ruby-lang.org/issues/5468\n else\n # Global unicast prefix\n (((to_i >> 32) & 0xffffffffffffffff) << 64).to_ip(Socket::AF_INET6).tap { |p| p.length = prefix_length }\n end\n end\n end", "def hostname_to_ip hostname\n begin \n ip = Resolv.getaddress(config[:host])\n rescue Resolv::ResolvError => resolv_err\n raise Exception.new(\"Resolver error: #{resolv_err}\")\n end\n return ip\n end", "def ipv6_saddr=(str)\n\t\t\tself[:ipv6_src].read_x(str)\n\t\tend", "def normalized_host\n # Remove trailing '.' characters\n host.sub(/\\.*$/, '').downcase if host\n end", "def human_name\n \"reverse UDP\"\n end", "def link_host\n return if field['u'].nil?\n\n @link_host ||= begin\n # Not sure why I need this, but it fails on certain URLs w/o it. The link printed still has character in it\n fixed_url = field['u'].gsub('^', '').strip\n link = URI.parse(fixed_url)\n\n return link.host unless PROXY_URL_REGEX.match?(link.to_s) && link.to_s.include?('url=')\n\n proxy = CGI.parse(link.query.force_encoding(Encoding::UTF_8))\n return link.host unless proxy.key?('url')\n\n extracted_url = URI.extract(proxy['url'].first).first\n return link.host unless extracted_url\n\n URI.parse(extracted_url).host\n rescue URI::InvalidURIError\n return nil\n end\n end", "def ospfize(dst: nil)\n ipv6 = ip_header(self)\n ipv6.traffic_class = 0xc0\n dst = case dst\n when :all_spf_routers\n 'ff02::5'\n when :all_d_routers\n 'ff02::6'\n else\n dst\n end\n ipv6.dst = dst unless dst.nil?\n ipv6.hop = 1 if ipv6[:dst].mcast?\n end", "def retrieve_public_ipv4(public_hostname)\n ns = ::File.read(::File.expand_path(::File.join('etc', 'resolv.conf'),'/')).\n split(\"\\n\").\n grep(/^\\s*nameserver/).\n first.\n split.\n fetch(1) || nil\n return nil unless ns\n resolver = Resolv::DNS.new(:nameserver => ns)\n resolver.getaddress(public_hostname).to_s\nrescue\n nil\nend", "def host_2_ip (hostname)\n\t\tputs \"Perform DNS query on host: #{hostname}\" if @verbose\n\t\tbegin\n\t\t\tips=Array.new\n\t\t\tif is_ip?(hostname)\n\t\t\t\tputs \"No change - same IP is returned. \" if @verbose\n\t\t\t\treturn hostname.strip\n\t\t\telse\n\t\t\t\tips=Resolv.getaddresses(hostname)\n\t\t\t\tif (ips.empty?) then\n\t\t\t\t\tputs \"Failed to resolve #{hostname}\" if @verbose\n\t\t\t\t\treturn nil\n\t\t\t\telse\n\t\t\t\t\tputs \"IP found: #{ips.first}\" if @verbose\n\t\t\t\t\treturn ips.first.strip\n\t\t\t\tend\n\t\t\tend\n\t\trescue => ee\n\t\t\tputs \"Exception on method host_2_ip for host #{hostname}: #{ee}\" if @verbose\n\t\t\treturn nil\n\t\tend\n\tend", "def to_ipaddr\n unless ip_addr?\n lookup = `host #{to_s} | grep address`.split(/\\s+/)\n return to_s unless lookup.length == 4\n lookup[3]\n else \n to_s\n end\n end", "def default_lookup(req, *args)\n req.address\n end", "def match_hostname( val )\n\t\tmatch = RFC1738Hostname.match( val )\n\t\treturn match ? match[0] : nil\n\tend", "def proxied_upcase\n remote_send(:upcase)\n end", "def normalize(domain)\n domain = domain.chomp(DOT).unicode_normalize(:nfc) unless domain.ascii_only?\n Punycode.encode_hostname(domain).downcase\n end", "def host\n @headers['HTTP_X_FORWARDED_HOST'] || @headers['HTTP_HOST'] \n end", "def start\n # These \"Just copy assignment\" is not preventable ...\n\n records = @database[:dns_records]\n esc_dnssuffix = Regexp.escape(DNS_SUFFIX)\n upstreamdns = RubyDNS::Resolver.new([\\\n [:udp, UPSTREAM_1_IP, UPSTREAM_1_PO], \\\n [:tcp, UPSTREAM_1_IP, UPSTREAM_1_PO], \\\n [:udp, UPSTREAM_2_IP, UPSTREAM_2_PO], \\\n [:tcp, UPSTREAM_2_IP, UPSTREAM_2_PO] \\\n ])\n RubyDNS.run_server(listen: [[:udp, '::', DNS_BIND], [:tcp, '::', DNS_BIND]]) do\n # Catch Localhost Request\n match(/localhost/, IN::A) do |transaction|\n transaction.respond!('127.0.0.1')\n end\n\n # Catch Localhost Request, on IPv6\n match(/localhost/, IN::AAAA) do |transaction|\n transaction.respond!('::1')\n end\n\n # This is used to match the DNS Suffix of the internal zone\n match(/(.+)\\.#{esc_dnssuffix}/, IN::A) do |transaction, match_data|\n begin\n answers = records.where(name: match_data[1], type: 'A')\n if answers.nil? || answers.empty?\n transaction.fail!(:NXDomain)\n else\n answers.each do |answer|\n transaction.respond!(answer[:ipv4address], ttl: TTL_VALUE)\n end\n end\n rescue Sequel::Error\n # deal with unavailable db\n transaction.fail!(:ServFail)\n end\n end\n\n match(/(.+)\\.#{esc_dnssuffix}/, IN::AAAA) do |transaction, match_data|\n begin\n answers = records.where(name: match_data[1], type: 'A')\n if answers.nil? || answers.empty?\n transaction.fail!(:NXDomain)\n else\n answers.each do |answer|\n transaction.respond!(answer[:ipv6address], ttl: TTL_VALUE)\n end\n end\n rescue Sequel::Error\n # Deal with unavailable db\n transaction.fail!(:ServFail)\n end\n end\n\n match(/(.+)\\.#{esc_dnssuffix}/, IN::CNAME) do |transaction, match_data|\n begin\n answers = records.first(name: match_data[1], type: 'CNAME')\n if answers.nil? || answers.empty?\n transaction.fail!(:NXDomain)\n else\n transaction.respond!(answer[:cname], ttl: TTL_VALUE)\n end\n rescue Sequel::Error\n # Deal with unavailable DB\n transaction.fail!(:ServFail)\n end\n end\n\n match(/(.+)\\.#{esc_dnssuffix}/, IN::MX) do |transaction, match_data|\n begin\n answers = records.where(name: match_data[1], type: 'MX')\n if answers.nil? || answers.empty?\n transaction.fail!(:NXDomain)\n else\n answers.each do |answer|\n transaction.respond!(answer[:cname], ttl: TTL_VALUE)\n end\n end\n rescue Sequel::Error\n # Deal with unavailable DB\n transaction.fail!(:ServFail)\n end\n end\n\n # Handling PTR Record (IP to Hostname)\n match(/(.+)\\.in-addr.arpa/, IN::PTR) do |transaction, match_data|\n realip = match_data[1].split('.').reverse.join('.')\n if IPAddress.valid_ipv4?(realip)\n begin\n answers = records.where(ipv4address: realip)\n if answers.nil? || answers.empty?\n transaction.passthrough!(upstreamdns)\n else\n answers.each do |answer|\n transaction.respond!(Name.create(answer[:name] + '.' + DNS_SUFFIX), ttl: TTL_VALUE)\n end\n end\n rescue Sequel::Error\n # Deal with unavailable DB, Fallback to External Provider\n transaction.passthrough!(upstreamdns)\n end\n else\n # Refusing inappropiate requests, inappropiate IPv6 requests also goes here.\n transaction.fail!(:Refused)\n end\n end\n\n # Handling IPv6 PTR Record\n match(/(.+)\\.ip6.arpa/, IN::PTR) do |transaction, match_data|\n incoming = match_data[1].split('.').reverse.join\n if incoming =~ /^[0-9a-fA-F]+$/\n realip6 = IPAddress::IPv6.parse_hex(incoming).to_s\n realip4 = (IPAddress::IPv6::Mapped.new(realip6).mapped? ? '::FFFF:' + IPAddress::IPv6::Mapped.new(realip6).ipv4.address : '').to_s\n begin\n answers = records.where(ipv6address: [realip6, realip4])\n if answers.nil? || answers.empty?\n transaction.passthrough!(upstreamdns)\n else\n answers.each do |answer|\n transaction.respond!(Name.create(answer[:name] + '.' + DNS_SUFFIX), ttl: TTL_VALUE)\n end\n end\n rescue Sequel::Error\n # Deal with unavailable DB, Fallback to External Provider\n transaction.passthrough!(upstreamdns)\n end\n else\n # Refusing inappropiate requests, inappropiate IPv6 requests also goes here.\n transaction.fail!(:Refused)\n end\n end\n\n # Default DNS handler, forward outside address to upstream DNS\n otherwise do |transaction|\n transaction.passthrough!(upstreamdns)\n end\n end\n end", "def replace_host(line, old_hostname, new_hostname)\n line.sub(\n /(\\s)#{Regexp.escape(old_hostname.fqdn)}(\\s|$)/,\n \"\\\\1#{new_hostname.fqdn}\\\\2\"\n )\n end", "def test_nil_getaddrinfo\n hostlookup({ 'x' => '1.1.1.1' }, nil)\n end", "def fqdn?(ip_or_name)\n # If it is not an IP but contains a Dot, it is an FQDN\n !ip?(ip_or_name) && ip_or_name.include?(\".\")\n end", "def hostname\n if resolution = CloudModel::AddressResolution.where(ip: ip).first\n resolution.name\n else\n begin\n Resolv.getname(ip)\n rescue\n ip\n end\n end\n end", "def UndecorateIPv6(ip)\n if Builtins.regexpmatch(ip, \"^\\\\[.*\\\\]\") ||\n Builtins.regexpmatch(ip, \"^[^][%]+(%[^][%]+){0,1}$\")\n ip = Builtins.regexpsub(\n ip,\n \"^\\\\[?([^][%]+)(%[^][%]+){0,1}(\\\\]|$)\",\n \"\\\\1\"\n )\n end\n\n ip\n end", "def does_resolve_to_host?\n mx_records.include? Socket.gethostname\n end", "def public_hostname\n get_proxy.get_public_hostname\n end", "def canonical_hostname(domain)\n # Allow hostname overrides\n return $override_dashboard if $override_dashboard && domain == 'studio.code.org'\n return $override_pegasus if $override_pegasus && domain == 'code.org'\n\n return \"#{name}.#{domain}\" if ['console', 'hoc-levels'].include?($node_name)\n return domain if $node_env == 'production'\n\n # our HTTPS wildcard certificate only supports *.code.org\n # 'env', 'studio.code.org' over https must resolve to 'env-studio.code.org' for non-prod environments\n sep = (domain.include?('.code.org')) ? '-' : '.'\n return \"localhost#{sep}#{domain}\" if $node_env == 'development'\n return \"translate#{sep}#{domain}\" if $node_name == 'crowdin'\n \"#{$node_env}#{sep}#{domain}\"\nend", "def ddns_update(ip)\n ddns_update_he(HEuser, HEpw, HEtid, ip)\n {\n \"canishe.com\" => [ \"mail\", \"www\", \"@\", \"*\" ],\n \"gaelan.me\" => [ \"www\", \"@\" ],\n \"psd-chinese.net\" => [ \"www\", \"@\" ],\n }.each do |zone, hosts|\n hosts.each do |host|\n ddns_update_iwmn(host, zone, ip, IWMNuser, IWMNpw)\n end\n end\n\t{\n \"marimbaboise.com\" => [ \"www\", \"@\" ],\n }.each do |zone, hosts|\n hosts.each do |host|\n ddns_update_enom(host, zone, ip, BRpw)\n end\n end\nend", "def dnsspoof_run\n puts \"Waiting for DNS Packets............:\"\n iface = @interface\n capture_session = PacketFu::Capture.new(:iface => iface,\n :start => true,\n :promisc => true,\n :filter => \"udp and port 53 and src #{@addr}\")\n #Capture all packets from port 53 and from the source defined earlier\n capture_session.stream.each do |p|\n pkt = Packet.parse(p)\n dnsCount = pkt.payload[2].to_s+pkt.payload[3].to_s\n if dnsCount=='10'\n @domainName = getDomainName(pkt.payload[12..-1])\n puts \"DNS Request for \" + @domainName\n \n #Split and Generate the bytes for the IP we defined earlier\n ipToSpoof = @spoofIP.split('.')\n spoofIPHex = [ipToSpoof[0].to_i, ipToSpoof[1].to_i, ipToSpoof[2].to_i, ipToSpoof[3].to_i].pack('c*')\n\n #create query response (raw packets)\n udp_pkt = UDPPacket.new(:config => @myInfo)\n udp_pkt.udp_src = pkt.udp_dst\n udp_pkt.udp_dst = pkt.udp_src\n udp_pkt.eth_daddr = @victimMac\n udp_pkt.ip_daddr = @addr\n udp_pkt.ip_saddr = pkt.ip_daddr\n \n #Transaction ID (must be same for request and response)\n udp_pkt.payload = pkt.payload[0,2]\n \n #DNS header before Domain Name\n udp_pkt.payload += \"\\x81\"+\"\\x80\"+\"\\x00\"+\"\\x01\"+\"\\x00\"+\"\\x01\"\n udp_pkt.payload += \"\\x00\"+\"\\x00\"+\"\\x00\"+\"\\x00\"\n \n #split the domaine name by the \".\" ex. www.google.com\n @domainName.split('.').each do |domainString|\n #put length before each part of the domain\n udp_pkt.payload += domainString.length.chr\n #section of domain\n udp_pkt.payload += domainString\n end\n \n #DNS header after domain name\n udp_pkt.payload += \"\\x00\"+\"\\x00\"+\"\\x01\"+\"\\x00\"+\"\\x01\"+\"\\xc0\"\n udp_pkt.payload += \"\\x0c\"+\"\\x00\"+\"\\x01\"+\"\\x00\"+\"\\x01\"\n #DNS TTL and Length\n udp_pkt.payload += \"\\x00\"+\"\\x00\"+\"\\x02\"+\"\\x56\"+\"\\x00\"+\"\\x04\"\n #our ip to send to\n udp_pkt.payload += spoofIPHex\n #recalculation of fields\n udp_pkt.recalc\n #send to interface\n udp_pkt.to_w(@interface);\n end\n end\nend", "def getsockname(*) end", "def ip_or_hostname\n super\n end", "def parse_dns(address)\n fwd_entries={}\n aliases=nil\n begin\n Socket.getaddrinfo(address,nil).each do |addr_struct|\n addr=addr_struct[2]\n ip=addr_struct[3]\n if fwd_entries[addr].nil?\n fwd_entries[addr]=[ip]\n elsif !fwd_entries[addr].include?(ip)\n fwd_entries[addr] << ip\n end\n end\n rescue SocketError =>e\n end\n ret_arr=[]\n if fwd_entries.empty? then\n puts \"[warning] Could not determine an IP address for \\\"#{address}\\\"\"\n else\n fwd_entries.each do |fwd,ips|\n ips.each do |ip|\n ret_arr << {:ip=>ip, :addr=>fwd}\n end\n end\n end\n return ret_arr\n end", "def to_6to4\n if @family == Socket::AF_INET\n IPAddr.new((0x2002 << 112) + (@addr << 80), Socket::AF_INET6).tap { |p| p.length = 48 }\n end\n end", "def hostname\n Resolv.getname(ip_address) rescue nil\n end", "def do_lookup(args)\n if args[\"qname\"] == \"example.com\" and args[\"qtype\"].downcase == \"soa\"\n @result = [\n record(\"example.com\", \"SOA\", \"sns.dns.icann.org noc.dns.icann.org 2013012485 7200 3600 1209600 3600\"),\n ]\n elsif args[\"qname\"] == \"example.com\" and args[\"qtype\"].downcase == \"any\"\n @result = [ \n record(\"example.com\", \"SOA\", \"sns.dns.icann.org noc.dns.icann.org 2013012485 7200 3600 1209600 3600\"),\n record(\"example.com\", \"NS\", \"sns.dns.icann.org\"),\n record_prio(\"example.com\", \"MX\", \"test.example.com\",10)\n ]\n elsif args[\"qname\"] == \"test.example.com\" and args[\"qtype\"].downcase == \"any\"\n @result = [\n record(\"test.example.com\", \"A\", \"127.0.0.1\")\n ]\n elsif args[\"qname\"] =~ /(.*)\\.example\\.com$/ and args[\"qtype\"].downcase == \"any\"\n ip = 0\n $1.downcase.each_byte do |b| ip = ip + b end\n ip_2 = ip/256\n ip = ip%256\n @result = [\n record(args[\"qname\"], \"A\", \"127.0.#{ip_2}.#{ip}\")\n ]\n end\n end", "def change_hostname(fname, outfile)\n hostname = `hostname`.chomp\n File.open(fname) do |f|\n f.each_line do |line|\n line = line.sub(/ip-\\d{1,3}-\\d{1,3}-\\d{1,3}-\\d{1,3}/,hostname)\n outfile.puts line\n end\n end\nend", "def resolve_addresses packet # :nodoc:\n source = packet.source @resolver\n source = \"\\\"druby://#{source.sub(/\\.(\\d+)$/, ':\\1')}\\\"\"\n\n destination = packet.destination @resolver\n destination = \"\\\"druby://#{destination.sub(/\\.(\\d+)$/, ':\\1')}\\\"\"\n\n return source, destination\n end", "def fqdn\n [name, tag, domain].compact.join('.')\n end", "def getsockname\n Socket.from_sockaddr(super)\n end", "def lookup(hostname, ttl)\n return unless @lookups.key?(hostname)\n\n @lookups[hostname] = @lookups[hostname].select do |address|\n address[\"TTL\"] > ttl\n end\n ips = @lookups[hostname].flat_map do |address|\n if address.key?(\"alias\")\n lookup(address[\"alias\"], ttl)\n else\n IPAddr.new(address[\"data\"])\n end\n end\n ips unless ips.empty?\n end", "def run\n\n\t\tdomain = datastore['DOMAIN']\n\t\thostlst = datastore['NAMELIST']\n\t\ta = []\n\n\t\tprint_status(\"Performing DNS Forward Lookup Bruteforce for Domain #{domain}\")\n\t\tif session.type =~ /shell/\n\t\t\t# Only one thread possible when shell\n\t\t\tthread_num = 1\n\t\t\t# Use the shell platform for selecting the command\n\t\t\tplatform = session.platform\n\t\telse\n\t\t\t# When in Meterpreter the safest thread number is 10\n\t\t\tthread_num = 10\n\t\t\t# For Meterpreter use the sysinfo OS since java Meterpreter returns java as platform\n\t\t\tplatform = session.sys.config.sysinfo['OS']\n\t\tend\n\n\t\tname_list = []\n\t\tif ::File.exists?(hostlst)\n\t\t\t::File.open(hostlst).each do |n|\n\t\t\t\tname_list << n\n\t\t\tend\n\t\tend\n\n\t\tplatform = session.platform\n\n\t\tcase platform\n\t\twhen /win/i\n\t\t\tcmd = \"nslookup\"\n\t\twhen /solaris/i\n\t\t\tcmd = \"/usr/sbin/host \"\n\t\telse\n\t\t\tcmd = \"/usr/bin/host \"\n\t\tend\n\t\twhile(not name_list.nil? and not name_list.empty?)\n\t\t\t 1.upto(thread_num) do\n\t\t\t \ta << framework.threads.spawn(\"Module(#{self.refname})\", false, name_list.shift) do |n|\n\t\t\t \t\tnext if n.nil?\n\t\t\t \t\tvprint_status(\"Trying #{n.strip}.#{domain}\")\n\t\t\t\t\tr = cmd_exec(cmd, \"#{n.strip}.#{domain}\")\n\n\t\t\t\t\tcase session.platform\n\t\t\t\t\twhen /win/\n\t\t\t\t\t\tproccess_win(r, \"#{n.strip}.#{domain}\")\n\t\t\t\t\telse\n\t\t\t\t\t\tprocess_nix(r, \"#{n.strip}.#{domain}\")\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t \ta.map {|x| x.join }\n\t\t\t end\n\t\tend\n\tend", "def real_address\n match(/Real\\saddr\\s+:\\s+([^\\s]+)$/)\n end", "def ipv6\n @ipv6.eql?(true) ? '--ipv6' : ''\n end", "def define_addrinfo_prefer_wildcard\n @wildcard = @options[:wildcard]\n @netmask = wildcard_bitlength\n if @netmask\n @options[:netmask] = @netmask\n define_addrinfo_with_netmask\n else\n define_addrinfo_with_wildcard\n end\n end", "def hostname_correct?(host_name)\n host_name == capture(%{hostname}).chomp\nend", "def reverse(*ips)\n get(\"/dns/reverse\", ips: ips.join(\",\"))\n end" ]
[ "0.7207883", "0.7025245", "0.70168346", "0.65732956", "0.6168072", "0.6168072", "0.6034545", "0.6010559", "0.5928154", "0.5899014", "0.5898925", "0.5869713", "0.58098316", "0.5765179", "0.5758831", "0.5713227", "0.5704459", "0.56910604", "0.56443447", "0.5623967", "0.561861", "0.5606323", "0.5603196", "0.55990267", "0.555577", "0.5543597", "0.55200773", "0.55108637", "0.5496061", "0.5488518", "0.54711676", "0.54171306", "0.5399993", "0.5391282", "0.5382438", "0.53762573", "0.5374854", "0.53541", "0.53399694", "0.53265417", "0.5317379", "0.53062254", "0.53025705", "0.52918184", "0.5279841", "0.5271964", "0.525852", "0.5250152", "0.52430934", "0.52334976", "0.5231474", "0.52296686", "0.52232856", "0.5216486", "0.52135", "0.51945627", "0.5182093", "0.5178268", "0.51718223", "0.5170284", "0.51677537", "0.5164517", "0.5156181", "0.5116242", "0.5110795", "0.5109172", "0.51018035", "0.5097106", "0.509366", "0.5088033", "0.5074222", "0.50722796", "0.5071665", "0.50640625", "0.5054126", "0.5046853", "0.5045075", "0.5034617", "0.5034349", "0.5030582", "0.5003853", "0.50030816", "0.49987087", "0.49952722", "0.49808457", "0.49807805", "0.49746716", "0.49631858", "0.4959499", "0.49574378", "0.49522862", "0.49493718", "0.49482942", "0.49367517", "0.493243", "0.4925421", "0.49130252", "0.4910792", "0.48990348", "0.48988894" ]
0.6400691
4
GET /adversaires GET /adversaires.json
def index @adversaires = Adversaire.all respond_to do |format| format.html # index.html.erb format.json { render :json => @adversaires } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @adversaire = Adversaire.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @adversaire }\n end\n end", "def index\n @antecedentes = Antecedente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @antecedentes }\n end\n end", "def new\n @equipe = Equipe.find(params[:equipe_id])\n \n @adversaire = Adversaire.new\n @adversaire.equipe = @equipe\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @adversaire }\n end\n end", "def index\n find_dependencias\n respond_to do |format|\n format.html\n format.json { render :json => @dependencias.to_json(:methods => :alias_or_fullname, :only => [:id, :codigo, :nombre])}\n\n end\n end", "def index\n @interno_unidads = InternoUnidad.all\n render json: @interno_unidads\n end", "def getOrden \n \t@orden = Orden.where(:rest => params[:id_res])\n \trender json: @orden\n end", "def index\n @deseases = Desease.order(:id)\n\n render json: @deseases\n end", "def index\n @notadedebito = Notadedebito.find(params[:notadecredito_id])\n @renglon_notadebitos = @notadedebito.renglon_notadebitos\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @renglon_notadebitos }\n end\n end", "def show\n @serv_adicionale = ServAdicionale.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @serv_adicionale }\n end\n end", "def index\n @questionnaires = @instance.questionnaires\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questionnaires }\n end\n end", "def employee_vacations\n #vacaciones de este año\n vacations = Employee.find(params[:id]).get_vacation_days\n\n respond_to do |format|\n format.json { render json: vacations }\n end\n end", "def index\n @digital_editions = DigitalEdition.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @digital_editions }\n end\n end", "def index\n @leases = Lease.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @leases }\n end\n end", "def show\n @historial = Historial.find(params[:id])\n @receta = Recete.histori(@historial.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @historial }\n end\n end", "def index\n @notadedebito = Notadedebito.find(params[:notadedebito_id])\n @renglon_nddndcs = @notadedebito.renglon_nddndcs\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @renglon_nddndcs }\n end\n end", "def index\n @leads = Lead.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @leads }\n end\n end", "def index\n @advertisements = Advertisement.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @advertisements }\n end\n end", "def index\n @advertisements = Advertisement.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @advertisements }\n end\n end", "def display\n @reservas = Reserva.order(fecha_inicio_estadia: :desc)\n render json: @reservas, include: [:cliente, :habitacion]\n end", "def index\n @vehicule_persos = VehiculePerso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @vehicule_persos }\n end\n end", "def index\n @ways_of_admissions = WaysOfAdmission.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ways_of_admissions }\n end\n end", "def index\n @diciplinas = Diciplina.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @diciplinas }\n end\n end", "def dresses\n render json: { collections: Collection.published_dresses }\n end", "def index\n @detalles = Detalle.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @detalles }\n end\n end", "def getArrondissement\r\n \tvil = params[:id]\r\n \trender json: Arrondissement.where(vil_id: vil)\r\n end", "def articles\n @articles = Article.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @administration }\n end\n end", "def index\n @diaries = current_user.diaries.all\n respond_to do |format|\n format.html {render :index}\n format.json { render json: @diaries }\n end\n end", "def index\n @leads = Lead.upcoming\n .includes(:updates, :agents, :agent)\n .order(created_at: :desc)\n .page(params[:page])\n .per(50)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @leads }\n end\n end", "def index\n @ordens = Orden.all\n render json: @ordens\n end", "def index\n @departamentos = Departamento.all\n\n render json: @departamentos\n end", "def index\n @preparatoria_o_universidad_de_origens = PreparatoriaOUniversidadDeOrigen.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @preparatoria_o_universidad_de_origens }\n end\n end", "def index\n\n @debtors = Debtor.all\n\n render json: @debtors\n end", "def index\n @status_del_admitidos = StatusDelAdmitido.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @status_del_admitidos }\n end\n end", "def show\n @respuesta = Respuesta.find(params[:id])\n\n render json: @respuesta\n end", "def index\n @himalayas ||= Himalaya.limit(10).order('id desc')\n @descuentos ||= Descuento.limit(10).order('id desc')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @himalayas }\n end\n end", "def index\n @client_releases = ClientRelease.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @client_releases }\n end\n end", "def index\n @adecuacionactividads = Adecuacionactividad.all\n end", "def create\n @adversaire = Adversaire.new(params[:adversaire])\n @equipe = Equipe.find(params[:equipe_id])\n\n respond_to do |format|\n if @adversaire.save\n format.html { redirect_to @equipe, :notice => 'Adversaire was successfully created.' }\n format.json { render :json => @adversaire, :status => :created, :location => @equipe }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @adversaire.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @serv_adicionale = ServAdicionale.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @serv_adicionale }\n end\n end", "def new\n @liquidacion = Liquidacion.new\n\n #Levanto de conceptos, todos los conceptos que son requeridos para liquidacion de auxiliares \n @conceptos = Concepto.where(:anhomes => 201407).order(:codigo_concepto) \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @liquidacion }\n end\n end", "def index\n @itineraires = Itineraire.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @itineraires }\n end\n end", "def index\n logement = Logement.find_by(id:params[:logement_id])\n equipement = logement.equi_securites[0].title\n equipements = logement.equi_securites[0]\n\n render json: {\n securites:equipement,\n fichier:equipements\n }\n end", "def index\n @mesasredondas = Mesasredonda.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mesasredondas }\n end\n end", "def index\n @tipo_denuncia = TipoDenuncium.all\n\n render json: @tipo_denuncia\n end", "def index\n @ventas = Venta.order(\"fecha desc\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ventas }\n end\n end", "def index\n @pedidos = Pedido.find(:all, :conditions => [\"cliente_id=?\", session[:usuario_id]])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pedidos }\n end\n end", "def index\n @adscripciones = Adscripcion.all\n end", "def index\n @ads = Ad.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ads }\n end\n end", "def index\n @descuento_adicionals = DescuentoAdicional.all\n end", "def index\n @descuento_adicionals = DescuentoAdicional.all\n end", "def index\n @denuncia = Denuncium.all\n\n render json: @denuncia\n end", "def show\n render json: @diet, status: 200, root: true\n end", "def index\n @archdioceses = Archdiocese.all\n\n render json: @archdioceses\n end", "def index\n @estacionamientos = Estacionamiento.all\n @serv_adicinales = ServAdicinale.all\n end", "def sondagesParAdmin\n sondages = SondageService.instance.listeDesSondagesParAdmin(params[:id])\n render json: sondages, status: :ok\n end", "def index\n @ordenes = Orden.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ordenes }\n end\n end", "def index\n @ads = Ad.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ads }\n end\n end", "def index\n @vendedor_clientes = VendedorCliente.all\n end", "def index\n @factura = Factura.find(params[:factura_id])\n @renglon_facturas = @factura.renglon_facturas\n\n respond_to do |format|\n format.html # index.html.erb\n #format.json { render json: @renglon_facturas }\n end\n end", "def index\n @admittings = Admitting.all\n render json: @admittings\n end", "def show\n @agents = Agent.employees.order('created_at ASC')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lead }\n end\n end", "def index\n @status_de_la_inscripcions = StatusDeLaInscripcion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @status_de_la_inscripcions }\n end\n end", "def show\n @descuento = Descuento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @descuento }\n end\n end", "def show\n respond_to do |format|\n format.html\n format.json { render json: { advertisements: @advertisements } }\n end\n end", "def index\n @clientes = Cliente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clientes }\n end\n end", "def index\n @artefact = Artefact.find(params[:artefact_id])\n\n @assets = @artefact.assets\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @assets }\n end\n end", "def index\n @asociados = Asociado.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @asociados }\n end\n end", "def index\n @relaciones_articulos_medida = RelacionArticuloMedida.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @relaciones_articulos_medida }\n end\n end", "def show\n @requerimiento ||= Requerimiento.where(:numero => params[:id]).first\n @areas = Area.where(\" nombre like '%DIT%' \")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @requerimiento }\n end\n end", "def index\n @recibo = Recibo.find(params[:recibo_id])\n @renglon_recdetalles = @recibo.renglon_recdetalles.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @renglon_recdetalles }\n end\n end", "def index\n @assuntos = Assunto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @assuntos }\n end\n end", "def etiquetas_por_aluno\n logger.info(params)\n @etiquetas_aluno = Etiqueta.all.where(aluno_id: params[:aluno_id])\n respond_with @etiquetas_aluno\n end", "def index\n @verbindungs = Verbindung.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @verbindungs }\n end\n end", "def index\n @peds = Ped.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @peds }\n end\n end", "def index\n @deportes = Deporte.all\n render json: @deportes, status: :ok \n @deportes = Deporte.paginate(:page => params[:page])\n end", "def index\n @administracao_relatorios_diarios = Administracao::RelatoriosDiario.all\n end", "def index\n @status_del_tramite_de_becas = StatusDelTramiteDeBeca.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @status_del_tramite_de_becas }\n end\n end", "def index\n @paciente_serviciocomplementarios = PacienteServiciocomplementario.all\n end", "def index\n @deporte_usuarios = DeporteUsuario.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @deporte_usuarios }\n end\n end", "def index\n @acuerdos = Acuerdo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @acuerdos }\n end\n end", "def index\n @departments = Department.all\n respond_to do |format|\n format.json{ render json: @departments}\n end\n end", "def index\n @designations = Designation.order(\"id desc\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @designations }\n end\n end", "def show\n @dependencia = Dependencia.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dependencia }\n end\n end", "def index\n @reprogramaciones = Reprogramacion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reprogramaciones }\n end\n end", "def show\n @respuesta = Respuesta.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @respuesta }\n end\n end", "def index\n @pacientes = Pacientes.all\n render json: @pacientes\n end", "def show\n @lede = Lede.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lede }\n end\n end", "def show\n @antecedente = Antecedente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @antecedente }\n end\n end", "def index\n \n @controles_asistencias = ControlAsistencia.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @controles_asistencias }\n end\n end", "def vaciarRecepcionBodega\n ProveedorDespacharProductos.new.vaciarRecepcion\n render json: 'Almacen.find_by(recepcion: true).stocks'\nend", "def index\n @transacciones = Transaccion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @transacciones }\n end\n end", "def index\n #@vendas = Venda.all\n #@vendas = Venda.venda_diaria\t\n @vendas = Venda.includes(:cliente).where('DATE(created_at) = ?',Date.today)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @vendas }\n end\n end", "def index\n @palestrantes = Palestrante.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @palestrantes }\n end\n end", "def show\n @chamado = Chamado.find(params[:id])\n\n #Traduz o tipo do chamado e seu status para string\n tipo = Chamado::CHAMADO_OPTIONS.invert[@chamado.tipochamado]\n status = Chamado::STATUS_OPTIONS.invert[@chamado.status]\n\n #Serializa o chamado\n chamado = @chamado.as_json(:except => [:tipochamado, :status])\n dtipo = { :tipochamado => tipo, :status => status }.as_json\n chamado = dtipo.merge(chamado)\n\n #Encontra o historico do chamado\n @audits = Audit.find_all_by_idchamado(params[:id])\n #Transforma o historico em json\n historico = @audits.as_json(:except => [:updated_at, :idchamado, :id])\n \n\n #Converte os valores armazenados no banco para os correspondentes nomes em\n #linguagem humana\n @audits.each do |h|\n if h.mudancas.has_key?(\"status\")\n h.mudancas[\"status\"].map!{ |j| Chamado::STATUS_OPTIONS.invert[j] }\n elsif h.mudancas.has_key?(\"tipochamado\")\n h.mudancas[\"tipochamado\"].map!{ |j| Chamado::CHAMADO_OPTIONS.invert[j] }\n end\n\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: { :chamado => chamado, :alteracoes => historico}}\n end\n end", "def getorden\n @id = params['id']\n @orden = Orden.find(@id)\n @factura = Factura.where(:ordens_id => @id).first\n @monto= @factura.iva + @factura.costoTotal\n\n @historico = Orden.rutas(@id)\n\n respond_to do |format|\n # format.html # show.html.erb\n format.xml\n end\n end", "def index\n if (params[:client_id])\n @engagements = Engagement.find_all_by_client_id(params[:client_id])\n else\n @engagements = Engagement.all\n end\n\n respond_with(@engagements)\n end", "def index\n @tenures = Tenure.all.order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @tenures\n end", "def show\n render json: @archdiocese\n end", "def show\n @audit = Audit.find(params[:id])\n respond_with @audit.as_json(:include => [:location, :fine_tunes, :auditors, :auditees, :paragraphs => {only: [:id, :name]}])\n end", "def show\n @consulta = Consulta.find(params[:id])\n\n render json: @consulta\n end" ]
[ "0.7044205", "0.61279804", "0.61175853", "0.6100125", "0.6073722", "0.60164106", "0.6011114", "0.59592867", "0.59421694", "0.59224385", "0.58847535", "0.58794487", "0.58718944", "0.5863959", "0.5859205", "0.5837101", "0.58307415", "0.58307415", "0.5830564", "0.582776", "0.58196783", "0.581845", "0.58077693", "0.5791272", "0.5788962", "0.5788481", "0.57844603", "0.5780266", "0.576377", "0.576096", "0.5756048", "0.57513326", "0.57485825", "0.5745595", "0.5735351", "0.5722204", "0.5712787", "0.5704344", "0.5701905", "0.5697219", "0.56971246", "0.5695287", "0.5694923", "0.5687081", "0.56860006", "0.5678026", "0.5677194", "0.56611127", "0.56546813", "0.56546813", "0.5649637", "0.5649195", "0.5645923", "0.5642357", "0.5641069", "0.5640732", "0.5640622", "0.56281906", "0.5625648", "0.5624798", "0.56246495", "0.56182474", "0.56180763", "0.56051385", "0.5602103", "0.55997765", "0.55905807", "0.5589437", "0.5587854", "0.5584601", "0.5581012", "0.5580164", "0.55724895", "0.5572217", "0.55712885", "0.5566008", "0.5565768", "0.5565765", "0.5563039", "0.5558344", "0.5558188", "0.55546534", "0.55542475", "0.5547894", "0.55451417", "0.5541513", "0.5538848", "0.55381787", "0.5536814", "0.5536717", "0.55341184", "0.5530292", "0.55301434", "0.5527984", "0.5526025", "0.5525491", "0.55224466", "0.552183", "0.5521768", "0.5516935" ]
0.77473766
0
GET /adversaires/1 GET /adversaires/1.json
def show @adversaire = Adversaire.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render :json => @adversaire } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @adversaires = Adversaire.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @adversaires }\n end\n end", "def show\n @serv_adicionale = ServAdicionale.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @serv_adicionale }\n end\n end", "def show\n @respuesta = Respuesta.find(params[:id])\n\n render json: @respuesta\n end", "def new\n @equipe = Equipe.find(params[:equipe_id])\n \n @adversaire = Adversaire.new\n @adversaire.equipe = @equipe\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @adversaire }\n end\n end", "def show\n @historial = Historial.find(params[:id])\n @receta = Recete.histori(@historial.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @historial }\n end\n end", "def getOrden \n \t@orden = Orden.where(:rest => params[:id_res])\n \trender json: @orden\n end", "def index\n @antecedentes = Antecedente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @antecedentes }\n end\n end", "def show\n @respuesta = Respuesta.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @respuesta }\n end\n end", "def index\n find_dependencias\n respond_to do |format|\n format.html\n format.json { render :json => @dependencias.to_json(:methods => :alias_or_fullname, :only => [:id, :codigo, :nombre])}\n\n end\n end", "def employee_vacations\n #vacaciones de este año\n vacations = Employee.find(params[:id]).get_vacation_days\n\n respond_to do |format|\n format.json { render json: vacations }\n end\n end", "def getArrondissement\r\n \tvil = params[:id]\r\n \trender json: Arrondissement.where(vil_id: vil)\r\n end", "def show\n @descuento = Descuento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @descuento }\n end\n end", "def index\n @deseases = Desease.order(:id)\n\n render json: @deseases\n end", "def index\n @interno_unidads = InternoUnidad.all\n render json: @interno_unidads\n end", "def show\n @dependencia = Dependencia.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dependencia }\n end\n end", "def show\n @consulta = Consulta.find(params[:id])\n\n render json: @consulta\n end", "def new\n @serv_adicionale = ServAdicionale.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @serv_adicionale }\n end\n end", "def show\n @humanidades1 = Humanidades1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @humanidades1 }\n end\n end", "def show\n @observacao_vocacionada = ObservacaoVocacionada.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @observacao_vocacionada }\n end\n end", "def show\n @humanidades2 = Humanidades2.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @humanidades2 }\n end\n end", "def display\n @reservas = Reserva.order(fecha_inicio_estadia: :desc)\n render json: @reservas, include: [:cliente, :habitacion]\n end", "def show\n @requerimiento ||= Requerimiento.where(:numero => params[:id]).first\n @areas = Area.where(\" nombre like '%DIT%' \")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @requerimiento }\n end\n end", "def index\n @leases = Lease.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @leases }\n end\n end", "def show\n @antecedente = Antecedente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @antecedente }\n end\n end", "def index\n @advertisements = Advertisement.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @advertisements }\n end\n end", "def index\n @advertisements = Advertisement.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @advertisements }\n end\n end", "def show\n @lease = Lease.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @lease }\n end\n end", "def show\n @status_de_la_inscripcion = StatusDeLaInscripcion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @status_de_la_inscripcion }\n end\n end", "def show\n @prioridade_adocao = PrioridadeAdocao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @prioridade_adocao }\n end\n end", "def show\n @status_del_admitido = StatusDelAdmitido.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @status_del_admitido }\n end\n end", "def show\n @vehicule_perso = VehiculePerso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @vehicule_perso }\n end\n end", "def show\n @dynamique = Dynamique.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dynamique }\n end\n end", "def show\n @historial_odt = HistorialOdt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @historial_odt }\n end\n end", "def index\n @ventas = Venta.order(\"fecha desc\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ventas }\n end\n end", "def show\n @addre = Addre.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @addre }\n end\n end", "def show\n @asiento = Asiento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @asiento }\n end\n end", "def show\n @retroalimentacion = Retroalimentacion.find(params[:id])\n @current_cliente=obtener_cliente(current_user)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @retroalimentacion }\n end\n end", "def index\n @vehicule_persos = VehiculePerso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @vehicule_persos }\n end\n end", "def index\n @tipo_denuncia = TipoDenuncium.all\n\n render json: @tipo_denuncia\n end", "def index\n @detalles = Detalle.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @detalles }\n end\n end", "def show\n @agendamento = Agendamento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agendamento }\n end\n end", "def new\n @liquidacion = Liquidacion.new\n\n #Levanto de conceptos, todos los conceptos que son requeridos para liquidacion de auxiliares \n @conceptos = Concepto.where(:anhomes => 201407).order(:codigo_concepto) \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @liquidacion }\n end\n end", "def show\n render json: @diet, status: 200, root: true\n end", "def show\n @asociado = Asociado.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @asociado }\n end\n end", "def show\n @lede = Lede.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lede }\n end\n end", "def show\n @periodo_academico = PeriodoAcademico.find(params[:id])\n\n render json: @periodo_academico\n end", "def index\n @questionnaires = @instance.questionnaires\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questionnaires }\n end\n end", "def index\n @notadedebito = Notadedebito.find(params[:notadecredito_id])\n @renglon_notadebitos = @notadedebito.renglon_notadebitos\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @renglon_notadebitos }\n end\n end", "def show\n respond_to do |format|\n format.html\n format.json { render json: { advertisements: @advertisements } }\n end\n end", "def show\n @advogados_escritorio = AdvogadosEscritorio.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @advogados_escritorio }\n format.js\n end\n end", "def show\n @ventas_seguimiento = Ventas::Seguimiento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ventas_seguimiento }\n end\n end", "def index\n @status_del_admitidos = StatusDelAdmitido.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @status_del_admitidos }\n end\n end", "def show\n @doctor_cliente = DoctorCliente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @doctor_cliente }\n end\n end", "def show\n @detalle = Detalle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @detalle }\n end\n end", "def show\n @venta = Venta.find(params[:id])\n\n @domicilios = Domicilio.where(usuario_id: @venta.usuario.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @venta }\n end\n end", "def index\n @ways_of_admissions = WaysOfAdmission.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ways_of_admissions }\n end\n end", "def index\n logement = Logement.find_by(id:params[:logement_id])\n equipement = logement.equi_securites[0].title\n equipements = logement.equi_securites[0]\n\n render json: {\n securites:equipement,\n fichier:equipements\n }\n end", "def show\n render json: @departamento\n end", "def index\n @diciplinas = Diciplina.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @diciplinas }\n end\n end", "def index\n @departamentos = Departamento.all\n\n render json: @departamentos\n end", "def index\n @himalayas ||= Himalaya.limit(10).order('id desc')\n @descuentos ||= Descuento.limit(10).order('id desc')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @himalayas }\n end\n end", "def show\n @apuesta_detail = ApuestaDetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @apuesta_detail }\n end\n end", "def index\n @factura = Factura.find(params[:factura_id])\n @renglon_facturas = @factura.renglon_facturas\n\n respond_to do |format|\n format.html # index.html.erb\n #format.json { render json: @renglon_facturas }\n end\n end", "def show\n @agente = Agente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agente } \n end\n end", "def index\n @assuntos = Assunto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @assuntos }\n end\n end", "def new\n @activo = Activo.new\n @amenaza = Amenaza.all(:select => \"id,origen\")\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activo }\n end\n end", "def new\n @vocacionada = Vocacionada.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vocacionada }\n end\n end", "def show\n load_budget\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @budget }\n end\n end", "def show\n render json: @advert\n end", "def show\n @chamado = Chamado.find(params[:id])\n\n #Traduz o tipo do chamado e seu status para string\n tipo = Chamado::CHAMADO_OPTIONS.invert[@chamado.tipochamado]\n status = Chamado::STATUS_OPTIONS.invert[@chamado.status]\n\n #Serializa o chamado\n chamado = @chamado.as_json(:except => [:tipochamado, :status])\n dtipo = { :tipochamado => tipo, :status => status }.as_json\n chamado = dtipo.merge(chamado)\n\n #Encontra o historico do chamado\n @audits = Audit.find_all_by_idchamado(params[:id])\n #Transforma o historico em json\n historico = @audits.as_json(:except => [:updated_at, :idchamado, :id])\n \n\n #Converte os valores armazenados no banco para os correspondentes nomes em\n #linguagem humana\n @audits.each do |h|\n if h.mudancas.has_key?(\"status\")\n h.mudancas[\"status\"].map!{ |j| Chamado::STATUS_OPTIONS.invert[j] }\n elsif h.mudancas.has_key?(\"tipochamado\")\n h.mudancas[\"tipochamado\"].map!{ |j| Chamado::CHAMADO_OPTIONS.invert[j] }\n end\n\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: { :chamado => chamado, :alteracoes => historico}}\n end\n end", "def show\n @verbindung = Verbindung.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @verbindung }\n end\n end", "def show\n @personaje = Personaje.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @personaje }\n end\n end", "def find_client\n cliente = get_cliente(params[:id])\n\n respond_to do |format|\n format.json {render json: {client: cliente}}\n end\n end", "def show\n @estacionamiento = Estacionamiento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @estacionamiento }\n end\n end", "def show\n @comentario = Comentario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comentario }\n end\n end", "def show\n @comentario = Comentario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comentario }\n end\n end", "def show\n @cliente = Cliente.find(params[:cliente_id])\n @pago = @cliente.pagos.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pago }\n end\n end", "def show\n @status_ativ = StatusAtiv.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @status_ativ }\n end\n end", "def show\n @reconocimiento = Reconocimiento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @reconocimiento }\n end\n end", "def index\n @ads = Ad.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ads }\n end\n end", "def show\n @laundromat = Laundromat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @laundromat }\n end\n end", "def show\n unless possui_acesso?()\n return\n end\n @aviso = Aviso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @aviso }\n end\n end", "def show\n @status_del_tramite_de_beca = StatusDelTramiteDeBeca.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @status_del_tramite_de_beca }\n end\n end", "def create\n @adversaire = Adversaire.new(params[:adversaire])\n @equipe = Equipe.find(params[:equipe_id])\n\n respond_to do |format|\n if @adversaire.save\n format.html { redirect_to @equipe, :notice => 'Adversaire was successfully created.' }\n format.json { render :json => @adversaire, :status => :created, :location => @equipe }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @adversaire.errors, :status => :unprocessable_entity }\n end\n end\n end", "def show\n @leito = Leito.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @leito }\n end\n end", "def show\n @preparatoria_o_universidad_de_origen = PreparatoriaOUniversidadDeOrigen.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @preparatoria_o_universidad_de_origen }\n end\n end", "def index\n @pedidos = Pedido.find(:all, :conditions => [\"cliente_id=?\", session[:usuario_id]])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pedidos }\n end\n end", "def index\n @ordens = Orden.all\n render json: @ordens\n end", "def show\n @humanidades3 = Humanidades3.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @humanidades3 }\n end\n end", "def getorden\n @id = params['id']\n @orden = Orden.find(@id)\n @factura = Factura.where(:ordens_id => @id).first\n @monto= @factura.iva + @factura.costoTotal\n\n @historico = Orden.rutas(@id)\n\n respond_to do |format|\n # format.html # show.html.erb\n format.xml\n end\n end", "def show\n @competency_pertenece_asignatura = CompetencyPerteneceAsignatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competency_pertenece_asignatura }\n end\n end", "def index\n @leads = Lead.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @leads }\n end\n end", "def index\n @plan_de_venta = PlanDeVentum.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @plan_de_venta }\n end\n end", "def index\n @notadedebito = Notadedebito.find(params[:notadedebito_id])\n @renglon_nddndcs = @notadedebito.renglon_nddndcs\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @renglon_nddndcs }\n end\n end", "def InfoPlanPaciente\n \tid = params[:id]\n @plan_paciente = TipoPlan.find_by_sql(\"select descripcion FROM tipo_plans where plan_paciente_id = #{id} and tipo = 'Paciente'\")\n render json: @plan_paciente\n end", "def index\n @archdioceses = Archdiocese.all\n\n render json: @archdioceses\n end", "def index\n @ads = Ad.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ads }\n end\n end", "def show\n @deporte= set_deporte\n render json: @deporte, status: :ok\n\n end", "def index\n @asociados = Asociado.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @asociados }\n end\n end", "def show\n @paciente = Paciente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @paciente }\n end\n end" ]
[ "0.7689759", "0.66538554", "0.6489223", "0.64495176", "0.6445517", "0.6419912", "0.6332981", "0.62747234", "0.6272778", "0.6271669", "0.6259928", "0.6247678", "0.6246665", "0.6244119", "0.6241534", "0.623722", "0.62278074", "0.6189951", "0.61771756", "0.6142741", "0.613485", "0.61316633", "0.61223495", "0.6102388", "0.60973096", "0.60973096", "0.609616", "0.6093559", "0.6092197", "0.60896", "0.60891813", "0.6088837", "0.60879505", "0.6080898", "0.60768425", "0.6072516", "0.6069819", "0.60673743", "0.60598105", "0.6058026", "0.60529965", "0.6050595", "0.6048623", "0.60413384", "0.6031399", "0.60217774", "0.601774", "0.60175866", "0.60170925", "0.601623", "0.60134107", "0.6006389", "0.60015833", "0.6001279", "0.59987766", "0.59958416", "0.5994643", "0.5993634", "0.59773093", "0.5972867", "0.59722966", "0.59641933", "0.59627026", "0.5961942", "0.5961763", "0.59612685", "0.5957828", "0.59562016", "0.5954813", "0.59532154", "0.5951411", "0.59475213", "0.5946456", "0.5945718", "0.59454757", "0.59454757", "0.5943304", "0.5941378", "0.59362787", "0.5936058", "0.59348804", "0.5933336", "0.5930198", "0.5929071", "0.5928461", "0.5927845", "0.59205157", "0.5919956", "0.5917353", "0.59169847", "0.59138775", "0.5912888", "0.59126484", "0.59122324", "0.590951", "0.5908299", "0.59080434", "0.59066117", "0.5904834", "0.59044266" ]
0.7403843
1
GET /adversaires/new GET /adversaires/new.json
def new @equipe = Equipe.find(params[:equipe_id]) @adversaire = Adversaire.new @adversaire.equipe = @equipe respond_to do |format| format.html # new.html.erb format.json { render :json => @adversaire } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @serv_adicionale = ServAdicionale.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @serv_adicionale }\n end\n end", "def new\n @vocacionada = Vocacionada.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vocacionada }\n end\n end", "def new\n @cliente = Cliente.new\n localidad_new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cliente }\n end\n end", "def new\n @prioridade = Prioridade.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @prioridade }\n end\n end", "def new\n @respuesta = Respuesta.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @respuesta }\n end\n end", "def new\n @mission = Mission.new(:convocationjours => [Convocationjour.new])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @mission }\n end\n end", "def new\n @asociado = Asociado.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @asociado }\n end\n end", "def new\n @requerimiento = Requerimiento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @requerimiento }\n end\n end", "def new\n @status_de_la_inscripcion = StatusDeLaInscripcion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @status_de_la_inscripcion }\n end\n end", "def new\n @detalle = Detalle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @detalle }\n end\n end", "def new\n @descuento = Descuento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @descuento }\n end\n end", "def new\n @laundromat = Laundromat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @laundromat }\n end\n end", "def new\n @lease = Lease.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @lease }\n end\n end", "def new\n @verbindung = Verbindung.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @verbindung }\n end\n end", "def new\n @ped = Ped.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ped }\n end\n end", "def new\n @pedido = Pedido.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pedido }\n end\n end", "def new\n @addre = Addre.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @addre }\n end\n end", "def new\n @journal = @journals.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @journal }\n end\n end", "def new\n @indicativo = Indicativo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @indicativo }\n end\n end", "def new\n @prepagada = Prepagada.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @prepagada }\n end\n end", "def new\n @pagenate = Pagenate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pagenate }\n end\n end", "def new\n @entity = get_new()\n @verbindung = Verbindung.find(params[:verbindung_id])\n if !has_access_to_verbindung(@verbindung) then return end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entity }\n end\n end", "def new\n @pagamento = Pagamento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pagamento }\n end\n end", "def new\n @candidato = Candidato.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @candidato }\n end\n end", "def new\n @prioridade_adocao = PrioridadeAdocao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @prioridade_adocao }\n end\n end", "def new\n @liquidacion = Liquidacion.new\n\n #Levanto de conceptos, todos los conceptos que son requeridos para liquidacion de auxiliares \n @conceptos = Concepto.where(:anhomes => 201407).order(:codigo_concepto) \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @liquidacion }\n end\n end", "def new\n @comentario = Comentario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comentario }\n end\n end", "def new\n @indicacao = Indicacao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @indicacao }\n end\n end", "def new\n @personaje = Personaje.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @personaje }\n end\n end", "def new\n @po = Po.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @po }\n end\n end", "def new\n @nabe = Nabe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nabe }\n end\n end", "def new\n @estacionamiento = Estacionamiento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @estacionamiento }\n end\n end", "def new\n @paciente = Paciente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @paciente }\n end\n end", "def new\n @comisaria = Comisaria.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comisaria }\n end\n end", "def new\n @publicidad = Publicidad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @publicidad }\n end\n end", "def new\n @tipo_convenio = TipoConvenio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipo_convenio }\n end\n end", "def new\n @sitio_entrega = SitioEntrega.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sitio_entrega }\n end\n end", "def new\n @journal = Journal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json :@journal }\n end\n end", "def new\n unless possui_acesso?()\n return\n end\n @aviso = Aviso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @aviso }\n end\n end", "def new\n @dossier = Dossier.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dossier }\n end\n end", "def new\n @page = 'newdoll'\n @doll = current_user.dolls.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @doll }\n end\n end", "def new\n @puntaje = Puntaje.new\n atributos\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @puntaje }\n end\n end", "def new\n @puntaje = Puntaje.new\n atributos\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @puntaje }\n end\n end", "def new\n @venta = Venta.new(:fecha => Date.today, confirmada: true)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @venta }\n end\n end", "def new\n @cliente = Cliente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cliente }\n end\n end", "def new\n @cliente = Cliente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cliente }\n end\n end", "def new\n @cliente = Cliente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cliente }\n end\n end", "def new\n @cliente = Cliente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cliente }\n end\n end", "def new\n @cliente = Cliente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cliente }\n end\n end", "def new\n @recurso = Recurso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recurso }\n end\n end", "def new\n @status_de_la_notificacion = StatusDeLaNotificacion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @status_de_la_notificacion }\n end\n end", "def new\n @sezione = Sezione.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sezione }\n end\n end", "def new\n @actividad = Actividad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @actividad }\n end\n end", "def new\n @local_deportivo = LocalDeportivo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @local_deportivo }\n end\n end", "def new\n @pasien2 = Pasien2.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pasien2 }\n end\n end", "def new\n @historial = Historial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @historial }\n end\n end", "def new\n @asignatura = Asignatura.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @asignatura }\n end\n end", "def new\n @reconocimiento = Reconocimiento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @reconocimiento }\n end\n end", "def new\n @mission = Mission.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mission }\n end\n end", "def new\n authorize! :new, @mesasredonda\n @mesasredonda = Mesasredonda.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mesasredonda }\n end\n end", "def new\n @cliente = Cliente.find(params[:cliente_id])\n @pago = @cliente.pagos.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pago }\n end\n end", "def new\n @seguidore = Seguidore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @seguidore }\n end\n end", "def new\n @activo = Activo.new\n @amenaza = Amenaza.all(:select => \"id,origen\")\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activo }\n end\n end", "def new\n @caixa = Caixa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @caixa }\n end\n end", "def new\n @reparacion = Reparacion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reparacion }\n end\n end", "def new\n @capacidad = Capacidad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @capacidad }\n end\n end", "def new\n @coligacao_partido = ColigacaoPartido.new\n @partidos = Partido.find(:all, :order => \"nome\")\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @coligacao_partido }\n end\n end", "def new\n @status_del_tramite_de_beca = StatusDelTramiteDeBeca.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @status_del_tramite_de_beca }\n end\n end", "def new\n @trnodo = Trnodo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trnodo }\n end\n end", "def new\n @vehicule_perso = VehiculePerso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @vehicule_perso }\n end\n end", "def new\n @caballo = Caballo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @caballo }\n end\n end", "def new\n @entrada_inventario = EntradaInventario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entrada_inventario }\n end\n end", "def new\n @humanidades2 = Humanidades2.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @humanidades2 }\n end\n end", "def new\n @verse = Verse.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @verse }\n end\n end", "def new\n @verse = Verse.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @verse }\n end\n end", "def new\n @verse = Verse.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @verse }\n end\n end", "def new\n @atracao = Atracao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @atracao }\n end\n end", "def new\n @situacion_revistum = SituacionRevistum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @situacion_revistum }\n end\n end", "def new\n @repa = Repa.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @repa }\n end\n end", "def new\n @dynamique = Dynamique.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dynamique }\n end\n end", "def new\n @kolegij = Kolegij.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @kolegij }\n end\n end", "def new\n @trlocalidad = Trlocalidad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trlocalidad }\n end\n end", "def new\n @finalidad_cultivo = FinalidadCultivo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @finalidad_cultivo }\n end\n end", "def new\n\n @paciente = Paciente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @paciente }\n end\n end", "def new\n @lede = Lede.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lede }\n end\n end", "def new\n @sugerencia = Sugerencia.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @sugerencia }\n end\n end", "def new\n @vano = Vano.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vano }\n end\n end", "def new\n @preparatoria_o_universidad_de_origen = PreparatoriaOUniversidadDeOrigen.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @preparatoria_o_universidad_de_origen }\n end\n end", "def new\n @apprentice = Apprentice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @apprentice }\n end\n end", "def new\n @status_ativ = StatusAtiv.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @status_ativ }\n end\n end", "def new\n @archiv = Archiv.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @archiv }\n end\n end", "def new\n @activite = Activite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activite }\n end\n end", "def new\n @assunto = Assunto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @assunto }\n end\n end", "def new\n @natulang = Natulang.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @natulang }\n end\n end", "def new\n @humanidades1 = Humanidades1.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @humanidades1 }\n end\n end", "def new\n @livro = Livro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @livro }\n end\n end", "def new\n @spiel = Spiel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @spiel }\n end\n end", "def new\n @local_desportivo = LocalDesportivo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @local_desportivo }\n end\n end", "def new\n @prestacion = Prestacion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @prestacion }\n end\n end", "def new\n @publicidade = Publicidade.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @publicidade }\n end\n end" ]
[ "0.73269916", "0.73104334", "0.7243926", "0.7220731", "0.7192849", "0.7180316", "0.7177427", "0.71695185", "0.7153022", "0.71392745", "0.7123211", "0.7110983", "0.710117", "0.7083383", "0.7079556", "0.7060978", "0.70568377", "0.70551324", "0.7053946", "0.7047608", "0.70471555", "0.70403373", "0.70340145", "0.70317304", "0.70281786", "0.70229316", "0.7000747", "0.6999313", "0.69938844", "0.6987949", "0.6986439", "0.69857717", "0.698571", "0.6980019", "0.69784904", "0.6978473", "0.6971099", "0.69697213", "0.6962941", "0.69597954", "0.69587964", "0.6950294", "0.6950294", "0.69482446", "0.6947214", "0.6947214", "0.6947214", "0.6947214", "0.6947214", "0.6946053", "0.6944551", "0.6944305", "0.69406843", "0.69373614", "0.6936111", "0.6934948", "0.6933423", "0.6931431", "0.693087", "0.69278014", "0.6926579", "0.6925652", "0.69217634", "0.6912255", "0.69118893", "0.69104564", "0.69063795", "0.69061863", "0.69053596", "0.69038224", "0.69032305", "0.6902548", "0.69024456", "0.6901943", "0.6901943", "0.6901943", "0.69009304", "0.6900068", "0.69000167", "0.68919873", "0.6891426", "0.68892294", "0.68821716", "0.68778104", "0.6876862", "0.6875696", "0.6875596", "0.6875511", "0.687288", "0.68660206", "0.6865018", "0.68630457", "0.68598276", "0.68588096", "0.6858675", "0.6858039", "0.68579674", "0.68579143", "0.6857897", "0.6856269" ]
0.71904165
5